Extension Modules

An Extendable contract by itself contains no functions. Extension modules are the units that provide your Extendable contract with functional logic.

Instead of building monolithic contracts where all functions are defined in the same contract, these functions are split into separate Extensions that divide your contract into more manageable, bitesize pieces. Each Extension can then be administered on an individual basis, and used to extend your contracts to provide access to desired functionality.

All functions that exist in an Extension are made available to the Extendable contract being extended. An Extension can be as simple or complex as needed. A maximally simple and flexible Extension can contain a single function, and be as large as the contract size limit, allowing the developer maximum configurability.

Once extended, Extendable contracts behave as if the extended functions natively exist as part of the contract and can be called as normal.

Extensions are standalone contracts that are deployed separately. Commonly used Extensions therefore only need to be deployed once and re-used ad infinitum by any other contracts without having to incur the cost of redeploying the same code.

Upgradability is supported by Extensions through deploying a new Extension and performing a replace on the Extendable contract. Note that the Extension contract itself does not get replaced, but the contract that makes use of it rotates the implementation from the old contract to the new one.

Contract state is maintained through a shared storage model. Despite Extensions being re-usable by any Extendable contract, the use of Storage Modules are what keep state safely isolated in the right contract.

Last updated