Programmatic Redemptions
a step-by-step guide for redeeming Index Coop products at the smart contract level
Last updated
a step-by-step guide for redeeming Index Coop products at the smart contract level
Last updated
All Index Coop products can be permissionlessly redeemed for their underlying assets at any time. In the absence of app or front-end support, this can be accomplished by interacting directly with the product's issuance module on the chain where it is natively deployed. This guide will provide a step-by-step walkthrough for programmatic redemptions using Etherscan.
Please note that this guide is limited to Indices, Yield, and Automated Strategy tokens. Leverage products are more complex to redeem because of the associated debt positions; a separate guide for leverage token redemptions will be published as soon as it is available.
Each product is represented by a unique token contract, which can be found in the table below. Different products utilize different issuance modules, so the primary issuance module contract for each product is listed in the table below too.
Start by identifying the product you want to redeem and matching it with the relevant issuance module; you'll need both addresses for subsequent steps.
For this example, we will redeem dsETH (0x341c05c0E9b33C0E38d64de76516b2Ce970bB3BE
) using the Debt Issuance Module v2_1 (0x04b59F9F09750C044D7CfbC177561E409085f0f3
) on Index Protocol V1.
Product | Protocol | Token Contract | Issuance Module Contract |
---|---|---|---|
Next, go to your product's token contract on Etherscan and navigate to the Contract > Read Contract tab. Select the balanceOf
function and paste in the wallet address that holds your tokens. After hitting the Query button, save the uint256 value that it returns.
See the example for dsETH below, with a uint256 value of 47910320749244497
.
Make sure to copy your uint256 value and/or leave the Etherscan tab open - you'll need it for the next step!
Next, you must allow the issuance module to "spend" your product tokens in exchange for the underlying components.
Go to the product token page on Etherscan and navigate to the Contract > Write Contract tab. Select the approve
function and carefully paste in the corresponding values...
spender
= the relevant issuance module contract address (from Step 1)
amount
= the uint256 value representing your wallet balance (from Step 2)
See the dsETH example below:
If you haven't already, connect the wallet that holds your product tokens to Etherscan. This will allow you to "write" to the contract and grant the issuance module permission to spend your tokens.
After double-checking your inputs and confirming your wallet is connected, click the Write button; this should trigger a transaction in the connected wallet. Carefully review the transaction before signing, and note that this approval transaction will cost gas.
A successful approval transaction for dsETH can be seen below:
Finally, you can redeem your product tokens for the underlying components by interacting directly with the issuance module contract.
Go to the relevant issuance module contract on Etherscan and navigate to the Contract > Write Contract tab. Connect the wallet that holds your product tokens, then select the redeem
function. Carefully paste in the corresponding values collected during previous steps...
_setToken
= the product's token contract address (from Step 1)
_quantity
= the uint256 value that represents your wallet balance (from Step 2)
_to
= the address that should receive the underlying components (i.e. your wallet)
See an example for dsETH below:
After double-checking your inputs and confirming your wallet is connected, click the Write button; this should trigger a transaction in the connected wallet. Carefully review the transaction before signing, and note that this approval transaction will cost more gas than the previous approval step.
Once you have executed this transaction, the product tokens will be burned and the underlying components will be sent to your wallet (or to a different _to
address that you provided).
A successful redemption transaction for dsETH can be found below:
And that's it! You have successfully redeemed your product for the underlying components.
Drop into the Index Coop Discord Server - this is the fastest way to have a real person answer any questions you have!