Inflation Extension
The extension plays a fundamental role in Covenant Inflation. Its implementation makes it possible to customize and extend a contract to achieve an extremely high level of security. Indeed, a contract has no choice but to have an extension, as it sets the parameters for both basic and advanced functionalities. There are two types of Inflation extensions:
Default Extension
The default extension is developed to be used by individual wallets or projects that do not require special integration and/or custom methods or features. It is cloned and deployed by the Inflation Factory (the address of which was passed in Factory Constructor
), in case you choose to use it:
Please note that the logic of the default extension can also be updated by the Covenants DFO.
The extension has a status, i.e. it is active or it is inactive. By default, the extension is inactive, and must be activated by the host. The _setactive
function is used to change the status of the extension. The active status allows the extension to perform contract operations.
The state of the extension also represents whether it correctly contains the amount of tokens needed to perform operations. When it is active and you try to perform an operation, this will only succeed if the extension has enough tokens. If it doesn't and the operation accordingly fails, the extension automatically becomes inactive through the deactivationByFailure
and no more operations can be performed until the extension returns to the active state.
The default extension provides a set of basic and general purpose functionalities designed for wallets or hosts that do not require a level of customization in functionality to interact with farming contracts.
Its main functions are:
Init
function
sets the as main parameters for he host address
setHost
updates the extension host
setActive
changes the extension status
setEntry
Calls internally the setEntry
of the contract to create/update a contract directly from the extension
receiveTokens
used by the contract to request tokens from the extension to perform operations
If the tokens come from reserve (so amountsToMint
[ ]=0), the function calls internally the safeTransfer
to transfer the tokens to the extension. If they are minted ( so amountsToMint
[ ] >0), the function calls internally the _mintAndTransfer
to mint the required amount and sends them to the contract.
flushBack
send back tokens from the contract to the extension address passing the token address(es)
deactivationByFailure
called by the contract to automatically disable the extension if there aren't enough tokens to perform operations
_mintAndTransfer
calls the classic IERC20 mint
method on the ERC20 token address
passed
Custom Extension
The use of a custom extension allows for the external integration of different projects (such as DFOs / DAOs / custom smart contracts) with Covenants inflation contracts. The extension is the de facto integration mode.
For more details, visit the DFO / DAO/ customized smart contract Integration section.
Last updated