Skip to main content

MISOFarmFactory

MISOFarmFactory is a factory contract to conveniently deploy your own token farming contracts.

The full contract can be found here.

Functions

initMISOFarmFactory

function initMISOFarmFactory(
address _accessControls,
address payable _misoDiv,
uint256 _minimumFee,
uint256 _integratorFeePct
)
external

Single gateway to initialize the MISO Farm Factory with proper addresses. Can only be initialized once.

Parameters

NameTypeDescription
accessControlsaddressaddress to get the access controls from
_misoDivaddress payableaddress to send dividends to
_minimumFeeuint256minimum fee for creating a farm in the factory
_integratorFeePctuint256fee to UI integration

setMinimumFee

function setMinimumFee(uint256 _amount) external

Sets the minimum fee.

Parameters

NameTypeDescription
_amountuint256fee amount to set

setIntegratorFeePct

function setIntegratorFeePct(uint256 _amount) external

Sets the integrator fee percentage.

Parameters

NameTypeDescription
_amountuint256percentage amount to set

setDividends

function setDividends(address payable _divaddr) external

Sets the dividend address.

Parameters

NameTypeDescription
_divaddraddressdividend address to set

setLocked

function setLocked(bool _locked) external

Sets the factory to be locked or unlocked.

Parameters

NameTypeDescription
_lockedbooltrue if locked, false if unlocked

setCurrentTemplateId

function setCurrentTemplateId(uint256 _templateType, uint256 _templateId) external

Sets the current template ID for any type. Must have operator access.

Parameters

NameTypeDescription
_templateTypeuint256type of template
_templateIduint256ID of the current template for that type

hasFarmMinterRole

function hasFarmMinterRole(address _address) public view returns (bool)

Used to check whether an address has the minter role, returns a boolean.

Parameters

NameTypeDescription
_addressaddressaddress of account or contract being checked

deployFarm

function deployFarm(
uint256 _templateId,
address payable _integratorFeeAccount
)
public payable returns (address farm)

Deploys a farm corresponding to the _templateId and transfers fees.

Parameters

NameTypeDescription
_templateIduint256template ID of the farm to create
_integratorFeeAccountaddress payableaddress to pay the fee to

Returns

NameTypeDescription
farmaddressnew farm address

createFarm

function createFarm(
uint256 _templateId,
address payable _integratorFeeAccount,
bytes calldata _data
)
external payable returns (address farm)

Creates a farm corresponding to the _templateId.

Parameters

NameTypeDescription
_templateIduint256template ID of the farm to create
_integratorFeeAccountaddress payableaddress to pay the fee to
_databytesdata passed to the farm contract for init

Returns

NameTypeDescription
farmaddressnew farm address

addFarmTemplate

function addFarmTemplate(address _template) external

Adds a farm template to create through factory. Must have operator access.

Parameters

NameTypeDescription
_templateaddressfarm template address to create a farm

removeFarmTemplate

function removeFarmTemplate(uint256 _templateId) external

Removes a farm template. Must have operator access.

Parameters

NameTypeDescription
_templateIduint256template ID to be deleted

getFarmTemplate

function getFarmTemplate(uint256 _farmTemplate) external view returns (address)

View function to get the template address based on the template ID.

Parameters

NameTypeDescription
_farmTemplateuint256template ID

getTemplateId

function getTemplateId(address _farmTemplate) external view returns (uint256)

View function to get the template ID based on the template address.

Parameters

NameTypeDescription
_farmTemplateaddresstemplate address

numberOfFarms

function numberOfFarms() external view returns (uint256)

View function that returns total number of farms in the factory.

getFarms

function getFarms() external view returns(address[] memory)

View function that returns all of the farm addresses created in the factory.