Deep Dive
MultiFungibleTokenTemplate1 contract
A MFT is uniquely identified by its ethereum address and a numeric (non-zero) ID. The ID represents a unique combination of dimensions that define the MFT. SUFI tokens are examples of MFTs where:
- FTokens and ITokens are 2-dimensional (Currency and Expiry)
- STokens and UTokens are 4-dimensional (Currency, Expiry, Underlying, and Strike Price)
MFT is DAO-controlled, i.e., only Lendroid’s DAOs can mint or burn a MFT.
Dao-only
Function | Params | Description |
---|---|---|
initialize | constructor_params ,daos[5] | Called only by the CurrencyDao when a new ERC20 Token is supported by the protocol. The CurrencyDao deploys and initializes the corresponding SUFI Tokens. References: CurrencyDao, function Authorizes the following DAO addresses to
|
get_or_create_id | currency ,expiry ,underlying ,strike_price | Can be called only by an authorized DAO. Inspired by Google App Engine’s concept of creating Datastore Entity keys from a given Key path, an ID is either retrieved or created from the given combination of inputs. |
Common
Function | Params | Description |
---|---|---|
id | currency ,expiry ,underlying ,strike_price | A numeric (non-zero) number which represents a unique combination of the given inputs. |
is_valid_id | id | Returns True if a given ID is valid. False otherwise. |
safeTransferFrom | from ,to ,id ,value ,data | Can be called by either the token holder or an authorized DAO. Transfers tokens with a given ID from an address to another address. |
burn | id ,from ,quantity | Can be called by either the token holder or an authorized DAO. Burns tokens with a given ID from an address. |
balanceOf | address ,id | Returns the balance of an address for a particular token id. |
totalBalanceOf | address | Returns the combined balance of an address for all token ids. |
balanceOfBatch | address | Returns the combined balance of an address for all token ids. |
totalBalanceOf | address ,ids[5] | Returns the combined balance of an address for given 5 token ids. |