Create Uniswap Exchange Wrapper
richardliang opened this issue · 0 comments
Summary
Integrate Uniswap as a liquidity provider for Set issuance orders by creating an Exchange Wrapper contract similar to what we have done with 0x and Kyber.
Implementation
Our exchanges wrappers expose a single public function exchange
which implements the necessary logic behind the exchange protocol. Our current exchange wrapper implementations are here for reference.
In the case of Uniswap, there are 3 functions that will execute the swap: 1) ethToTokenSwapInput
to swap ETH with ERC-20 Tokens, 2) tokenToEthSwapInput
to swap ERC-20 Tokens with ETH, and 3) tokenToTokenSwapInput
to swap ERC-20 Tokens with ERC-20 Tokens. More information on the Solidity interface here. Each function above takes in a number of parameters as specified in the interface. The Uniswap frontend code shows how these 3 functions work.
The exchange
function should:
- check allowance for transfer
- parse order data from the Set issuance order
- execute
ethToTokenSwapInput
,tokenToEthSwapInput
, ortokenToTokenSwapInput
depending on ETH or ERC-20 swap - transfer unused maker token back to the issuance order user
A good source of reference is how we've implemented our exchange wrappers linked above. Feel free to discuss with us further on Telegram!