The loan offers are queried via our subgraph, with each individual network having it's own endpoint as outlined in the introduction of this guide
The query structure is the same across networks.
These fields are required for calculating the required data for submitting the transaction through the contracts.
query getCommitmentsForWETH {
commitments(
where: {
and: [
{
collateralToken_: {
address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
}
status: "Active"
expirationTimestamp_gt: "1729708565"
committedAmount_gt: "0"
}
{
}
orderBy: maxPrincipalPerCollateralAmount
orderDirection: desc
)
{
committedAmount
expirationTimestamp
maxDuration
maxPrincipalPerCollateralAmount
minAPY
collateralToken {
id
address
nftId
type
decimals
symbol
name
}
principalToken {
address
type
nftId
decimals
symbol
name
}
marketplace {
marketplaceFeePercent
}
acceptedPrincipal
maxPrincipal
forwarderAddress
}
}
The response from the above query would look like this, and these values will be used for executing the loan as outlined in the next section.
{
"data": {
"commitments": [
{
"acceptedPrincipal": "0",
"collateralToken": {
"address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"decimals": "18",
"id": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"name": "Wrapped Ether",
"nftId": null,
"symbol": "WETH",
"type": "ERC20"
},
"committedAmount": "5165603368",
"id": "1726",
"lenderAddress": "0x7133c664af6763ab9aeeb095d3c114a750d8dfdc",
"marketplace": {
"marketplaceFeePercent": "100"
},
"maxDuration": "259200",
"maxPrincipal": "5165603368",
"maxPrincipalPerCollateralAmount": "1000000000000000",
"minAPY": "7016",
"principalToken": {
"address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"decimals": "6",
"name": "USD Coin",
"nftId": null,
"symbol": "USDC",
"type": "ERC20"
},
"principalTokenAddress": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"status": "Active",
"updatedAt": "0",
"forwarderAddress": "0x17a8e82351661dfd568fee6d7c38695b67e1e924",
}
]
}
}
type Commitment @entity {
id: ID!
commitmentId: BigInt!
createdAt: BigInt!
updatedAt: BigInt!
status: String!
forwarderAddress: Bytes! # address of the LenderCommitmentForwarder contract
rolloverable: Boolean!
# Offer
committedAmount: BigInt! # Current committed amount
expirationTimestamp: BigInt!
maxDuration: BigInt!
minAPY: BigInt!
principalToken: Token!
principalTokenAddress: Bytes!
# Required Collateral
collateralToken: Token
collateralTokenAddress: Bytes
collateralTokenType: BigInt!
maxPrincipalPerCollateralAmount: BigInt
commitmentBorrowers: [Bytes!]!
# Lender
lender: Lender!
lenderAddress: Bytes!
lenderPrincipalBalance: BigInt!
lenderPrincipalAllowance: BigInt!
# Market
marketplace: MarketPlace!
marketplaceId: BigInt!
# TokenStats
tokenVolume: TokenVolume!
# Extra
maxPrincipal: BigInt!
acceptedPrincipal: BigInt! # funds that were accepted
_oldAcceptedPrincipal: BigInt! # funds that were accepted that was not previously tracked on-chain
_newAcceptedPrincipal: BigInt! # funds that were accepted AFTER commitmentPrincipalAccepted function was added on-chain
commitmentRewards: [CommitmentReward!]! @derivedFrom(field: "commitment")
}
# Association between RewardAllocations and Commitments
type CommitmentReward @entity {
id: ID!
createdAt: BigInt!
updatedAt: BigInt!
reward: RewardAllocation!
commitment: Commitment!
roi: BigInt!
apy: BigInt!
}