-
Notifications
You must be signed in to change notification settings - Fork 18
Metamorphic Contracts
The AliceNet Smart contract factory leverages the use of metamorphic contracts in order to deploy contracts at a certain location. The following section will give a brief overview of what is a metamorphic contract.
A Metamorphic Contract is a contract that can be redeployed while maintaining its immutable original address. This approach relies on the CREATE2
method and allows the establishment of a deterministic address contract environment, which provides important advantages such as:
- An access control system can be defined based on the contract's immutable addresses.
- There is no need to store contract addresses, just the salts that generate them.
As mentioned in Smart Contract Compilation and Deployment one of the parameters to compute a contract address is the creation code itself, so it'd seem that a contract could not be re-deployed on the same address with different logic. AliceNet Factory resolves this by always using a fixed creation bytecode that operates as a proxy leaving the salt as the only actual parameter that defines the contract address. This allows the creation of Metamorphic Contracts.