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
querygetCommitmentsForRolloverLoanModal { 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 }}