This section will walk you through minting tokens (like ETHBTC or yCOMP) for the first time on Etherscan’s contract interaction GUI. If you already have a position (i.e. if you’ve already minted tokens, these steps may not apply to you). The screenshots and example numbers used in this tutorial reflect the ETHBTC token, but all steps in this article apply just the same to any other ExpiringMultiParty tokens. All you’ll need to get started is some DAI to use as collateral (50 DAI should be enough) and ETH to pay for transaction gas (0.05 ETH should be enough).
The token minting contract needs approval to transfer the collateral currency (DAI in this case) on your behalf. To do that, follow these instructions:
- Go to the Write Contract Tab on the DAI contract page.
- Search for the
- For the first argument, pass in the address of the token minting contract (for ETHBTC it is
0x3f2d9edd9702909cf1f8c4237b7c4c5931f9c944, for yCOMP it is
- For the second argument, pass in the maximum amount of collateral you intend to supply or alternatively any sufficiently high number.
- This will be in units of Wei; use this converter.
- For example, 100 DAI would be a value of
- Hit write, and confirm the transaction through your wallet. Once the transaction is mined, your allowance is now set.
- You can confirm this by going to the Read Contract Tab and looking for the
- Pass in your own address as the first argument and the token minting contract address (from Step 3 above) as the second argument.
- Hit Query and confirm that you get the resulting DAI allowance you just set.
There are three things we need to be concerned about when minting tokens for the first time (note that this is a little different if you have an existing position):
- Meeting the Global Collateralization Ratio (GCR);
- Minting the minimum required number of tokens, and;
- Supplying the minimum required amount of collateral.
Once we have determined the values for these three items, then we will be ready to mint some tokens!
This process can seem a little intimidating, but rest assured that it gets a lot easier after this step.
The GCR is defined as the ratio of total collateral to the total number of tokens outstanding (i.e. GCR = total collateral / total tokens) and we can only mint tokens if we collateralize enough to keep the GCR at its current level or higher.
To compute that, we need the true total collateral amount, and this we get from multiplying the “raw collateral” amount with a “cumulative fee multiplier”. This multiplier allows us to account for any fees that belong to the Oracle’s
These instructions will compute for the GCR:
Search for the
cumulativeFeeMultiplierfunction and observe the number there. This is in units of Wei so you will again need to convert it back into a human-readable number with the converter above. For example, a value of
1000000000000000000would equate to a multiplier with the value of
Next search for the
rawTotalPositionCollateralfunction and observe the number there. Multiply this number with the multiplier above to get the true total collateral amount. In this example, the resulting total collateral amount is
75204285203707845817894, or ~
75,204when converted from Wei.
Next, search for the
totalTokensOutstandingfunction and observe the number there. In this example the total number of tokens outstanding is
2,004,251when converted from Wei.
The GCR is simply a ratio of these two numbers (i.e. total collateral / total tokens outstanding), so in our example: GCR = 75,204 / 2,004,251 = ~0.038
There is a setting in the contract that defines the minimum number of tokens your position must have. For ETHBTC this value is set at 1000 tokens and for yCOMP it is 1 token, but if you wanted to confirm this on Etherscan, you can follow these instructions:
Search for the
minSponsorTokensfunction and observe the number there. In this example, a value of
1000tokens when converted from Wei.
This means that by the end of your minting transaction, you would need to make sure that you would have minted a total of 1000 tokens outstanding.
GCR = total collateral / total tokens, in order to maintain the GCR while minting the minimum amount of tokens, we simply multiply the number of tokens we want to mint with the GCR to find the required amount of collateral.
Assuming we want to mint 1000 tokens, that would mean we need
1000 * GCR (~0.038) = ~38 DAI of collateral.
Finally, we are ready to mint the actual synthetic tokens. You might want to add a bit more collateral than the minimum to prevent yourself from being liquidated (the minimum collateralization ratio is 120% for ETHBTC and 150% for yCOMP). In this example, we will put in 40 DAI.
- Go to the Write Contract Tab on the token minting contract page (for ETHBTC click here, for yCOMP click here).
- Search for the
- For the first argument, input the collateral amount in Wei wrapped in double-quotes and square brackets. For example, 40 DAI of collateral would mean inputting
- For the second argument, input the number of tokens (in Wei) that you want to mint, and wrap it in double-quotes with square brackets just like above.
- Hit write, and confirm the transaction through your wallet. Once the transaction completes, you should have minted your tokens. The Etherscan page for that transaction should look something like this:
Now that we have minted our tokens, let’s check the smart contract to make sure it’s keeping tracking of our tokens and collateral properly.
- Go to the Read Contract Tab on the token minting contract page (for ETHBTC click here, for yCOMP click here).
- Search for the
- Paste in your address into the textbox and hit Query.
- You should see something like the following:
From this, we can conclude that we have successfully minted 1000 tokens with 40 DAI of supplied collateral.
Now that you have minted your tokens, you need to make sure that it stays collateralized as the value of the underlying moves (e.g. the ETH to BTC ratio, or the price of COMP in USD).
In order to get short exposure, don't forget to sell these tokens rather than hold onto them (the idea is that you can buy them cheaper on the market later on to unwind your position). For example, on Uniswap you can trade ETHBTC tokens here and yCOMP tokens here. The tokens in the example above will expire on August 1st, 2020 (and become redeemable by anyone), so make sure to keep that in mind as well.