Create a New Index Token
To interact with Covenants index contracts in order to create a new Index token, it is necessary to use the mint
public function.
The input functions are as follows:
name
-> tokenname
symbol
-> tokensymbol
uri
-> tokenuri
_tokens
-> array containing the address of tokens selected to be indexed as the index token. To input ETH as one of the chosen tokens, you need to pass0x0000000000000000000000000000000000000000
._amounts
-> amount of each chosen token. Every token input (in the previous tokens field) must correspond to its specific amount (there cannot be an amount equal to 0).value
-> amount of the Index token to create. The value parameter calculates the necessary amount of tokens for the creation of the Index as follows:
This implies that if the value is equal to 0, you are creating an empty index. In this case, to create the correctly interoperable version of the index and its object Id
(and to avoid the call failing), a value of 1e18 is adopted by default:
With value=0
the mint function burns what has been created so far, but the interoperable version of the created index remains to allow for its future minting:
receiver
-> pass0x0000000000000000000000000000000000000000
to send Index tokens tomsg.sender
or otherwise the specific receiver address
With a value > 0, the _safeTransferFrom
function is internally called to transfer the required token amounts from the msg.sender
(or msg.value
in the case that ETH is involved) to the contract:
The mint
function creates the desired amount of index tokens by calling the mint
method of the native Item collection:
Then, the amount is minted and sent to the receiver address using the _safeTransfer
method via the interoperable Item interface version:
Please note: the native collection of index tokens created via Covenants was initially created via the contract Constructor
.
Last updated