Delegatecall


Storing variables in the EVM is important




Delegatecall preventative techniquesIn order to avoid any security issues, delegatecall should always be used with care.Some things to always be on the lookout for:Always remember that delegatecall preserves context. This is really important, as any sent ether/gas/logic to do with the msg.sender can be affected. It is preserved to the delegated transaction to the last contract.Always keep state variables structured the same way as in the contract that you are delegatecalling to. This is especially dangerous, as it can be easily exploited.Solidity introduces a library keyword that is specifically designed to create libraries to delegatecall to. The reason behind their security is that a library is stateless. This means that it can't change the state (doesn't have state itself), can't call functions from itself.
Last updated