Exchange Issuance Bounty [December 2020] - IN PROGRESS

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.

Specification:

  • 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

6 Likes

Must all computation be done on-chain (e.g. picking uni vs sushi)?

Should they optimize the tx for lowest gas or best price?

1 Like

1 - Yep - on chain

2 - Best Price

1 Like

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).

2 Likes

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.