The Index Coop wishes to deploy a smart contract that enables a user to purchase or sell an index product in a single transaction using decentralized exchange liquidity (e.g. Uniswap/Sushiswap). It is advised that you take inspiration from DeFi Pulse’s arb bot, which has much of the logic for issuance and on-chain DEX trades.
- Should allow using the best price via sushiswap or uniswap for each purchase
- Should allow payment or receiving using an erc20 or Ether
- Should allow issuance or redemption using the BasicIssuanceModule of any Index or Set token
Successfully completing this bounty requires:
- Writing smart contract code in solidity, writing unit tests, and writing deployment scripts
- Code to be reviewed and audited by the Set engineering team
- Code is ultimately deployed into production
Bounty: 400 INDEX
Implementor: Currently being implemented by @ncitron and @alphaguy
Must all computation be done on-chain (e.g. picking uni vs sushi)?
Should they optimize the tx for lowest gas or best price?
I might give this bounty a try. Any tips on how I should deal with the leftover dust due to the uni/sushi trades? Maybe there could be a boolean argument for it to either be swapped back to ETH and sent back to the user, or to be donated to the coop (which I imagine many people will opt to do since the additional gas cost may not be worth it).
I believe it is possible to get exact amounts out of a uniswap/sushi trade, so there will not be dust. That said, you may need to send more of the payment token than expected.
Ping me on discord and we discuss more!
Your right. Looks like
swapETHForExactTokens is what I am looking for. I’ll ping you on Discord if I have any other questions.