Docs
$RETURNOpen app
Get startedBorrowLendSafetyDevelopers
Developers
Developers
Developer overviewDeployments

Guides

Sign and fill ordersSettle loans

Reference

FunctionsEvents and errorsLimits and roundingABI

Limits and rounding

Open in Claude

The hard limits on order terms, and exactly how partial fills split collateral, interest and fees.

Limits

fill, post and previewFill revert with InvalidTerms when an order breaks these.

FieldLimit
principal1 to 2⁹⁶ − 1 raw units (uint96).
repaymentGreater than principal, up to 2⁹⁶ − 1 raw units.
collateralAmountUp to 2¹²⁸ − 1 raw units (uint128).
collateral, loanTokenTwo different admitted tokens, in either role.
duration1 second to 2³² − 1 seconds, about 136 years (uint32).
validUntilAn order can be filled up to and including this second.
minFillAt most principal. A fill of minFill must get some collateral, some interest, and more than its fee, so minFill is at least 2.
amountAt least minFill, at most what is left, and leaving either nothing or at least minFill.

Partial fills

For a fill of amount after offset principal has already been filled, with end = offset + amount:

collateral = floor(collateralAmount × end / principal) − floor(collateralAmount × offset / principal)
interest   = floor((repayment − principal) × end / principal) − floor((repayment − principal) × offset / principal)
repayment  = amount + interest
fee        = ceil(amount × 30 / 10000)
  • Collateral and interest are split cumulatively, so the totals across all fills equal the signed amounts exactly. One fill can differ from its exact share by less than one raw unit.
  • The fee rounds up per fill, so n fills can cost up to n − 1 raw units more than one fill would. Set minFill large enough that this is negligible.

Last updated 22 October 2026

Events and errors

Every event the Return contract emits, and what each custom error means.

ABI

The ABI of the ReturnERC20Loans contract.

On this page

LimitsPartial fills