0

Is there a way to save the deployed contract address into a variable. Something related to a constructor that save the deployed address into the variable?

  • 1
    You mean address(this) in Solidity? – Lauri Peltonen Feb 12 at 7:56
  • Im going to test – UnexpectedCharacter Feb 12 at 7:57
  • 2
    Why save it? You can get it in any function of the contract at any time. Saving address(this) into a state-variable and then using that state-variable every time you need it is going to be a lot more expensive than simply fetching address(this) into a local variable every time you need it. – goodvibration Feb 12 at 9:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.