Getting Rollover Details

Querying for the offers

Similar to the borrow flow, the offers that can rolled over must be queried from our subgraph.

The query is also very similar to the borrow, with a couple of additions.

  • rolloverable must be true

  • Both the principalToken and the collateralToken of the new offer must be the same as the previous offer

In the below example we are looking at offers that have WETH as collateral token and USDC as primary token in mainnnet

query getCommitmentsForRolloverLoanModal {
  commitments(
    where: {
      and: [
        {
          collateralToken_: {
            address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
          }
          status: "Active"
          expirationTimestamp_gt: "1729978811"
          committedAmount_gt: "0"
        }
        { principalTokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" } # principal token must be the same between current loan and new one
        { rolloverable: true } # this is the important difference to make sure the commitment can be rolled over
      ]
    }
    orderBy: maxPrincipalPerCollateralAmount
    orderDirection: desc
  ) {
    committedAmount
    collateralTokenType
    createdAt
    expirationTimestamp
    forwarderAddress
    lenderAddress
    marketplaceId
    maxDuration
    maxPrincipalPerCollateralAmount
    minAPY
    principalTokenAddress
    status
    updatedAt
    collateralToken {
      id
      address
      nftId
      type
      decimals
      symbol
      name
    }
    principalToken {
      address
      type
      nftId
      decimals
      symbol
      name
    }
    marketplace {
      marketplaceFeePercent
    }
    acceptedPrincipal
    maxPrincipal
    forwarderAddress
  }
}

Sample response:

{
  "data": {
    "commitments": [
      {
        "acceptedPrincipal": "155973896144",
        "collateralToken": {
          "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
          "decimals": "18",
          "id": "0x692ac1e363ae34b6b489148152b12e2785a3d8d6",
          "name": "Wrapped Ethereum",
          "nftId": null,
          "symbol": "WETH",
          "type": "ERC20"
        },
        "collateralTokenType": "1",
        "commitmentBorrowers": [],
        "committedAmount": "18594503602",
        "createdAt": "1713723736",
        "expirationTimestamp": "1735660800",
        "forwarderAddress": "0xa1106d888f1fa689c6935e0983687432ef2a28c1",
        "id": "24",
        "lenderAddress": "0x0854d0c201fd3f9e0ae2341c92b28d289234549c",
        "marketplace": {
          "marketplaceFeePercent": "20"
        },
        "marketplaceId": "33",
        "maxDuration": "604800",
        "maxPrincipal": "5000000000000000",
        "maxPrincipalPerCollateralAmount": "121000",
        "minAPY": "2500",
        "principalToken": {
          "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
          "decimals": "6",
          "name": "USD Coin (PoS)",
          "nftId": null,
          "symbol": "USDC",
          "type": "ERC20"
        },
        "principalTokenAddress": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
        "rolloverable": true,
        "status": "Active",
        "updatedAt": "0"
      }
    ]
  }
}

Last updated