Skip to main content

Data provider

openLendDataProvider is a read-only helper contract that bundles openLend and oracle state into batchable views. No transaction requires it: everything it returns can be derived from openLend and the oracle directly, and its outputs are byte-compatible with computing things yourself. It exists so UIs and bots can read a market in a handful of eth_calls.

Reading arrangements

Three overloads return full LendingArrangement structs (layout under Inspect terms):
getRefiParams(lendingId), getOracleParams(lendingId), and getRateParams(lendingId) return the corresponding sub-structs individually.

Finalize state

Mirrors the decision finalize() would make at the current block, including the basefee gate, for a batch of loans:
FinalizeOutcome
None: not in liquidation. Pending: the oracle report is still disputable, so autoSettle is a no-op. Restore: finalizing would fail the liquidation and restore the loan. Liquidate: finalizing would liquidate.
uint256
When the oracle game becomes (or became) settleable: the last report’s timestamp plus settlementTime.
uint48
The grace period a Restore would set, 0 when none.

Amounts owed

The live close-out debt per loan (principal plus the greater of accrued and commitment interest, minus interest already paid), 0 for loans that are not active or already finished.

Oracle games

getOracleGames returns each loan’s live liquidation report id (0 when not in liquidation) and its stored oracle game (zeroed when none). getStoredGames is the raw batch for callers that already hold report ids, including past liquidations.

Delegates

Each loan’s refi delegate and lender delegate, address(0) when unset.

Fee receivers

The fee receiver for a loan’s live liquidation, with its predicted address, whether it is deployed yet (fees accrue either way), and the pending fee balances per token. Zeroed when the loan is not in liquidation. See Fee receiver. For past liquidations, rebuild the address from the LoanLiquidationUnderway snapshot:
getBeneficiaries returns the borrower, lender, and liquidator recorded on a receiver, zeroed when the receiver is not yet deployed or its lending id does not match. Match the receiver address against the loan’s LoanLiquidationUnderway event rather than trusting its reported lending id alone.

Param hash helpers

getParamHash(lendingId) and getLiquidateParamHash(lendingId) return the two hash variants computed from current storage. They are debugging helpers only: an integration should compute the hash itself from state it has read and reviewed, as described under Calculating the param hash and Calculating the liquidate param hash.