Farming Extensions
Extensions play a fundamental role in Covenants farming. They make it possible to customize farming contracts to achieve an extremely high level of security in hosting. Indeed, all farming contracts must have extensions, as these set the parameters for both basic and more advanced functionalities. There are two possible farming extensions:
Default Extension
The default extension has been developed to be used by individual wallets or other hosts that do not require customized integrations, methods or features. It is deployed and cloned through the Factory contract (the address
of the default extension was passed in the Factory Constructor
).
If you want to use default extension, clone it with the cloneFarmDefaultExtension
function:
Please note that the standard logic of the default extension can only be updated by the Covenants DFO, governed exclusively by $UniFi holders.
Its main functions are:
Init
function
This sets the three main data parameters: a boolean value representing if the reward token is generated by mint (true
) or by reserve (false
); the host address
; and the treasury address
.
setHost
This is used to update the extension host.
setTreasury
This is used to update the extension treasury.
setFarmingSetups
This is used to create / update / disable the farming setups of a contract directly via the extension.
backToYou
The backToYou
function is called in the Farming contract to retrieve reward tokens, in case the amount of reward tokens sent by the extension to the Farming contract is not sufficient to activate the setup(s). Look here for more infos.
transferTo
This allows the extension to transfer the required amount of reward token
to the contract. If the tokens are to be issued from a reserve, the _safeTransfer
function is called to transfer them there from the reserve; if they are to be minted, the _mintAndTransfer
function is called to first mint and then transfer them to the contract. This function is used to qualify a setup for activation (see here for more details).
_mintAndTransfer
This calls the classic IERC20 mint
method on the passed ERC20 token address
.
_burn
This calls the classic IERC20 burn
method on the passed ERC20 token address
.
Custom Extension
Ccustom extensions allows for external integration of Covenants farming with different projects, such as DFOs, DAOs, dApps and custom smart contracts. The extension is the de facto integration mode.
For more details, see the DFO / DAO / Customized Smart Contract Integration section.
Last updated