🏦Lending Markets

Defitrack tries to track various lending markets across various chains. We try to maintain an up to date database of active and inactive markets in order to locate user funds, as well as locate opportunities.

Lending Markets

Fetching all supported markets for a specific protocol

Return a list of Lending Markets, which contain information about which tokens can be lent out on a specific platform. It often returns the APR, which is the rate you get for providing your assets to the lending pool.

Fetches all lending markets for a specific protocol.

GET https://api.decentri.fi/{protocol}/lending/all-markets

Path Parameters

NameTypeDescription

protocol*

String

slug of the protocol

[
   {
      "id":"compound-ethereum-0x6c8c6b02e7b2be14d4fa6022dfd6d75921d90e4e",
      "name":"Compound Basic Attention Token",
      "protocol":{
         "name":"COMPOUND",
         "logo":"https://static.defitrack.io/images/protocols/compound.png",
         "slug":"compound"
      },
      "network":{
         "name":"ETHEREUM",
         "logo":"https://static.defitrack.io/images/networks/ethereum.png",
         "chainId":1
      },
      "token":{
         "address":"0x0d8775f648430679a709e98d2b0cb6250d2887ef",
         "name":"Basic Attention Token",
         "decimals":18,
         "symbol":"BAT",
         "logo":"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x0D8775F648430679A709E98d2b0Cb6250d2887EF/logo.png",
         "type":"SINGLE"
      },
      "rate":0.0008,
      "poolType":"compound-lendingpool",
      "marketSize":54153981.17787066,
      "prepareInvestmentSupported":true
   }
]

Fetch all lending markets pertaining to a specific token and network

Return a list of Lending markets on a specific network for a specific token. This can be used to search for a lending market on a specific protocol (like compound) using DAI as your asset to be lent out.

Fetch lending markets for a specific protocol, token and network

GET https://api.decentri.fi/{protocol}/lending/markets?token={token}&network={network}

Path Parameters

NameTypeDescription

protocol*

String

slug of the protocol

Query Parameters

NameTypeDescription

token*

String

address of the token we want to find a lending market for

network*

String

network we want to find a lending market on

[
   {
      "id":"compound-ethereum-0x6c8c6b02e7b2be14d4fa6022dfd6d75921d90e4e",
      "name":"Compound Basic Attention Token",
      "protocol":{
         "name":"COMPOUND",
         "logo":"https://static.defitrack.io/images/protocols/compound.png",
         "slug":"compound"
      },
      "network":{
         "name":"ETHEREUM",
         "logo":"https://static.defitrack.io/images/networks/ethereum.png",
         "chainId":1
      },
      "token":{
         "address":"0x0d8775f648430679a709e98d2b0cb6250d2887ef",
         "name":"Basic Attention Token",
         "decimals":18,
         "symbol":"BAT",
         "logo":"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x0D8775F648430679A709E98d2b0Cb6250d2887EF/logo.png",
         "type":"SINGLE"
      },
      "rate":0.0008,
      "poolType":"compound-lendingpool",
      "marketSize":54153981.17787066,
      "prepareInvestmentSupported":true
   }
]

Prepare an investment transaction for a Lending Market

When fetching Lending Markets, the field prepareInvestmentSupported is returned. This indicates whether or not Defitrack supports preparation of transactions for the underlying market. In order to create an investment transaction to the underlying protocol, the following endpoint can be used.

The result of this endpoint can be used to construct and sign transaction, without having to know the ABI. The encoded function and contract address are returned.

Prepare investment transaction for lending market

POST https://api.defitrack.io/{protocol}/lending/markets/{id}?network={network}

Has to be sent in JSON format. Returns a list transactions that need to be signed and submitted in order.

Path Parameters

NameTypeDescription

id*

String

id of the lending market

Query Parameters

NameTypeDescription

network*

String

network we want to work on

Request Body

NameTypeDescription

user*

String

address of the user

amount

BigInteger

can be left empty. If empty, all available balance of the required token will be used to construct the transaction.

{
  "transactions": [
    {
      "to": "0x78AB636351c1C5f117C1442B82d14aB3a92F8464",
      "encodedFunction": "0xa0712d68000000000000000000000000000000000000000000000000000862601baa25ad"
    }
  ]
}

Last updated