I want to write a library which can be callcalled by any contract.

As part of this, I want to write a function which returns the contract address of the library to the contract which callcalled it.

address(this) is normally the solution, but in the case of callcode, it can only be used to check if the contract is being callcalled through if(address(this)==msg.sender) which become always true.

So how to perform this without having to rewrite the code each time because of the requirement to predict the future library’s contract address ?

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.