Default and Custom
A contract can use either the Default Extension or a Custom Extension.
Default Extension
The default extension has been developed to be used by individual wallets and other hosts that do not require customized methods, features or integrations. It is deployed and cloned through the Factory contract.
To use the default extension, clone it with the cloneFarmDefaultExtension
function:
The default extension's main functions are:
Init
function
This establishes the three main initial data parameters:
a boolean value; (
true
) if the reward token will be minted, (false
) if sent from a reservethe host address;
the treasury
address
setHost
This is used to update the extension host.
setTreasury
This is used to update the treasury.
data
This function returns: the farming contract address
deployed; whether the reward tokens are minted or if they come (true)
from a reserve (false)
; the host address
; the treasury address
; and the reward token address
.
setFarmingSetups
This is used to create, update or disable the farming setups of a contract.
transferTo
This allows the extension to transfer reward tokens to the contract. If they will be sent from a reserve, the _safeTransfer
function is called to transfer them; if they will be minted, the _mintAndTransfer
function is called to first mint and then transfer them. This qualifies a setup for activation.
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). See here for more info.
_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
Custom extensions allow for the integration of Covenant farming contracts with external protocols like DFOs, DAOs, dApps and custom smart contracts. The extension is the de facto integration mode.
For more details, see the Organization-Based Farming Extension Contract section.
Last updated