Open LukSteib opened 1 year ago
Research done by @valiafetisov.
What a typical existing callee code does:
constructor
takes and sets some values
*router
– address of the router contract – from which the flash loan will be provideddaiJoin
– address of the MCD_JOIN_DAI
contract – to which the DAI needs to be returedMCD_JOIN_DAI
contract view method .dai()
MCD_JOIN_DAI
contract to take any amount of DAI from the callee addressclipperCall
sender
address – the address of the contract calling the function, which suppose to pay back the loanowe
(uint256
amount denominated in RAD) – DAI amount to pay back (otherwise the callee will fail)slice
(uint256
amount denominated in WAD) – amount of the token "received" (or rather "approved", the amount that can be taken by the callee from the "gemJoin" address)data
(calldata bytes
) – arbitary data that can be passed from the frontend to the callee. It is usually contains at least
to
address - the address to send remaining DAI togemJoin
address – address that holds slice
amount of tokens that callee is allowed to takeminProfit
(uint256
amount denominated in WAD) – minimum profit in DAI to makeslice
from WAD to the actual ERC20 amount of tokens (eg sliceERC20
)sliceERC20
amount of token from gemJoin
to the callee address*router
the approval to move sliceERC20
amount of tokens away from the callee addressowe
from RAY to the actual ERC20 amount of DAI (eg oweERC20
)*router
function to exchange sliceERC20
into DAI
oweERC20
as a parameter to validate that the transaction can succeedsliceERC20
amount, otherwise transfer back the leftoversoweERC20
of DAIto
addressThe only variations between callees that I've found so far:
*router
address, therefore can receive a different router address on every executionSo the overall next questions:
Goal
Research notes on how to implement callee for other DEX protocols
Context
Currently, the main liquidity provider for unified-auctions swap transactions is UniswapV3. But we want to add at least one other callee, the one which is the easiest to integrate in the limited amount of time we have. For this, we need to investigate further the technical details of the implementation and testing framework and prepare proof-of-concept.
Tasks