Mint A Pre-Existing Index Token
To interact with index contracts in order to mint a new amount of an Index token, it is necessary to use the second mint
public function:
This function uses the interoperable Item interface version.
Its inputs are as follows:
objectId
-> the index token's interoperable interface objectId. PassobjectId = 0x0000000000000000000000000000000000000000
to input ETHvalue
-> amount of the index tokens to mint. The value parameter calculates the required token amounts to mint the index tokens astokenValue = (_amounts[i] * value) / 1e18
receiver
-> pass0x0000000000000000000000000000000000000000
to send the index tokens tomsg.sender
or otherwise the specific receiveraddress
The mint function internally calls the _safeTransferFrom
function to transfer the required token amounts from the msg.sender to the contract, or msg.value in the case that ETH is involved:
It then mints the amount of index tokens by calling the mint
method of the native Item collection, and then sends them to the receiver address using the _safeTransfer
method via the index token's interoperable Item interface version:
Last updated