The motivation behind this question is the need to take a snapshot of a large mapping object in a cheap way. Basically I'd like to copy or have a reference to a large mapping from one contract to another without spending too much gas.

Is it possible to have a pointer to another contract's public state variable from a specific block number?

What would this look like in Solidity?

If it's not possible in Solidity, would it be possible in assembly?


No, both Solidity in and assembly you only have access to the current state. One way to go about it would be to explicitly store past snapshots of in the smart contract. This is, e.g. done by the MiniMe token with its balanceOfAt function.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.