Exchange Agent
Exchange Agent contract contains all the information and functions for which enables CoverCompared to take payment in multiple currencies even though our partners may take payments in limited forms.
Get Token Amount For ETH
Using Uniswap TWAP oracles the getTokenAmountforETH
function calculates needed _token amount for _desiredAmount of ETH to be paid to buy cover
Input variables :
_token : refers to the token which is to be compared against ETH
_desiredAmount : desired ETH amount
Get Needed Token Amount
Using Uniswap TWAP oracles the getNeededTokenAmount
function calculates needed _token0 amount for _desiredAmount of _token1
Input variables :
_token0 : refers to the token which is to be compared
_token1 : refers to the token which is to be compared
_desiredAmount : desired token1 amount
Swap Token with ETH
CoverCompared takes payment in a range of ERC20 tokens but our partners are limited and bound. Thus to forward the payment the swapTokenWithETH
function is called after which the equivalent ETH is transferred to the partner.
Input variables :
_token : refers to the token which is to be compared against ETH
amount : _token amount which user se
desiredAmount : ETH amount which user desires to get instead of amount of _token.
Swap Token with Token
CoverCompared takes payment in a range of ERC20 tokens but our partners are limited and bound. Thus to forward the payment the swapTokenToken
function is called after which the equivalent compliant ERC20 token is transferred.
Input variables :
_token0 : refers to the token which is to be compared
_token1 : refers to the token which is to be compared
_amount : token0 amount which user sends to get token1
desiredAmount : token1 amount which user desires to get instead of _amount of _token0
Note : When the total paid amout becomes equal to the loan amount, the status of the loan will be automatically changed to LOAN PAID.
Last updated