CoverCompared
  • INTRODUCTION
    • About Us
      • What is CoverCompared?
      • Our Products
  • CoverCompared Offerings
    • CoverCompared Services
    • How is CoverCompared different from other insurance platforms?
      • Cryptocurrency Hacks - a primer
    • What is DeFi insurance?
    • What problems are CoverCompared trying to solve?
  • COVERCOMPARED PLATFORM
    • Ecosystem Overview
    • Risk Management
    • Partnerships
  • COVERCOMPARED TOKENOMICS
    • What is $CVR
    • CVR Use Cases
    • CVR Tokenomics
  • CoverCompared dAPP
    • How to take part in our Testnet & Bugbounty programme
    • How To
      • Buy a Smart Contract Cover
      • Buy Device Insurance
      • Buy MSO Products
      • Check bought products
      • Get test $CVR tokens
    • DeFi Covers
      • IsurAce
      • Nexus Mutual
      • Exchange Agent
    • Contemporary Covers
      • P4L
      • MSO
      • Exchange Agent
    • Contract Addresses
  • resources
    • CVR - FAQ
    • FAQ
Powered by GitBook
On this page
  • Get Token Amount For ETH
  • Get Needed Token Amount
  • Swap Token with ETH
  • Swap Token with Token

Was this helpful?

  1. CoverCompared dAPP
  2. DeFi Covers

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

function getTokenAmountForETH(address _token, 
    uint256 _desiredAmount)

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

 function getNeededTokenAmount(
        address _token0,
        address _token1,
        uint256 _desiredAmount
    )

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.

function swapTokenWithETH(
        address _token,
        uint256 _amount,
        uint256 _desiredAmount
    )

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.

    function swapTokenWithToken(
        address _token0,
        address _token1,
        uint256 _amount,
        uint256 _desiredAmount
    )

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.

PreviousNexus MutualNextContemporary Covers

Last updated 3 years ago

Was this helpful?