NFT Keyed Ephemeral Counterfactual Minimal Proxy Contracts

These example contracts demonstrate a gas effective way to deploy counterfactual contracts using CREATE2. Using minimal proxy instances that are destroyed between transactions is a secure way to isolate assets in a way that only the key holder can access, Using the token ID of a known NFT contract allows this access to be transferred based on the permissions associated with that NFT.

This is an example of a simple “smart wallet” implementation. In practice allowing it to execute arbitrary calls will mean no other methods are needed, however additional security can be added by implementing explicit calls followed by selfdestruct().

[remote_content url='' decode_atts="true" htmlentities="true"]

This factory contract will create new minimal proxy instances using the token ID as the salt. Only the token owner is allowed to call the function to create the contract, so any assets in the contracts storage location will be safe between calls.

[remote_content url='' decode_atts="true" htmlentities="true"]

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *