Solvers and keepers

Three different jobs keep Pearcurve moving. They aren't the same bot, and they aren't permissioned:

RoleWhat it doesWhat it earns
SolverFinds lend and borrow orders that fit and settles them in batches.The borrower's matching fee (a tip).
LiquidatorCloses loans that hit liquidation LTV, or weren't repaid after maturity plus grace.Collateral covering the debt it repays, plus a bonus.
Refinancing keeperMoves loans with auto-refinance on to a cheaper lend order. Anyone can do it.A share of the refinancing fee.

Anyone in the community can run any of them. There is no allowlist and no bond: unlike solvers on some other protocols, these roles do not hold or control user funds. A solver only finds a match and submits settlement, so you don't lock capital to qualify. You earn when a tip or bonus pays more than the network fee.

These notes describe behaviour. Where a call name appears, it's the onchain surface builders use today; contract source is not verified on the explorer yet. See Contracts and Addresses.

What each earns today#

SettingToday
Matching fee a borrower can setUp to 1% of the loan (tip cap)
Matching fee actually chargedThe lower of the borrower's tip and today's tip cap
Protocol's share of the matching fee0%
Liquidation bonus5% (fixed at deploy)
Refinancing fee0.50% of the principal
Keeper's share of the refinancing fee50% of that fee

Most FeeManager takes stay at 0; deploy sets the refinancing fee and keeper slice. Fees may change before mainnet (within the hard caps). Liquidation bonus, close factor and grace are fixed at deploy. See Who controls what.

Batch matching (solvers)#

A solver settles many matches in one transaction through Main. Any wallet can do it: the sender must be the solver named in the batch, and the batch must arrive before its deadline. There is no separate signature; the solver's own transaction authorises the batch.

Find matches#

Read the open lend and borrow orders for each loan asset from the orderbook views.

A lend order and a borrow order fit when they have:

  • the same loan asset and collateral
  • rates that overlap: the lender's minimum is at most the borrower's maximum
  • a term that fits: the borrow term is within the lender's shortest and longest
  • room left on both, within the lender's smallest loan, limit per borrower and available funds
  • lender terms the borrower accepts (early repayment and liquidation LTV; see below)
  • a fill the borrower accepts (all-or-none / smallest fill)

Skip borrow orders with no matching fee: they pay nothing.

Price it#

Each fill pays a tip in the loan asset: the fill times the lower of the borrower's tip and the protocol cap, less the protocol's share. Compare that with the network fee (using the protocol price oracle to convert) and rank matches by what's left.

Build the batch#

Every match in the batch runs at the lender order's fixed rate (minRate). The solver only chooses which orders to pair and how much to fill.

FieldValue
Lend / borrow order idsThe orders in each match, in the same order.
Fill amountsEach match's principal.
SolverYour address (must be the transaction sender).
DeadlineA time after which the batch reverts.

Respect borrower terms#

A match outside the borrower's terms reverts:

CheckRule
All-or-noneIf set, the whole principal must be filled in this one batch (possibly from several lenders).
Smallest fillDon't fill below it unless the fill finishes the request.
Early repaymentIf the lender blocks early repayment, the borrower must allow that. Otherwise the lender's fee must be at most the borrower's maximum.
Liquidation LTVThe lender's liquidation LTV must be at least the borrower's minimum.

Send it#

Submit the batch through Main. Each match opens its own loan, and matching fees are paid to the solver. Registered lender callbacks are best-effort, so a failing hook can't stop a later match. Orders change between your read and your send, so estimate gas first and drop matches that would revert.

Liquidation (liquidators)#

Anyone can liquidate a loan once it reaches its liquidation loan-to-value, or isn't repaid by maturity plus the grace period (0, currently on testnet). The liquidator repays the debt and receives collateral worth that amount plus a bonus (currently 5%). No bond or allowlist. If the bonus covers the network fee, it's worth running.

Find liquidatable loans#

Page through open loans and check each loan's health. Act only when it is liquidatable.

A loan can't be liquidated on a stale price: if the oracle's price for either asset is too old, the check fails.

Liquidate#

  1. Approve the loan asset to LoanManager (it pulls the debt, so a gas estimate fails without the approval).
  2. Re-read the loan's health, since another liquidator may have got there first.
  3. Call liquidate on LoanManager directly, not through Main. The liquidator pays the debt and receives the collateral.

In a partial liquidation you repay part of the debt, and the rest of the collateral stays on the loan. In a full one the loan closes, and any collateral left over goes back to the borrower. The lender's early-repayment fee isn't charged.

If the collateral can't cover the debt, the loan still closes and the lender bears the shortfall. There is a separate path to close a liquidatable loan whose collateral can no longer cover a repayment.

Your profit is the bonus, in collateral, less the network fee. Check it in the same unit before sending, and leave room for the collateral's price to move while the transaction is pending.

Liquidation can't be paused. It runs under every protocol or market pause, gated only by loan health, maturity plus grace, and oracle freshness.

Auto-refinance (keepers)#

A borrower with auto-refinance on has set a rate. When a lend order opens below it, with room for the loan and the same collateral, anyone can move the loan to it and earn a share of the refinancing fee.

Find candidates#

Page through open loans. A candidate has an auto-refinance threshold above 0.

Skip loans listed for sale. If no lend order is cheap enough, the call reverts.

Trigger it#

Call auto-refinance on the matching engine or through Main. Either way the keeper's share goes to the caller: Main passes your address on. A borrower who triggers their own loan earns no share.

The new lender funds principal. LoanManager pulls the borrower's shortfall (interest / early make-whole) with transferFrom. If the borrower has not approved enough of the loan asset to LoanManager, or lacks the balance, the call reverts with insufficient allowance or balance.

The new loan keeps the remaining term, the collateral and the early-repayment settings. It only works if the original lender allowed early repayment.

The keeper's share is part of the refinancing fee: currently 50% of 0.50% of principal. Check it covers the network fee first. If either setting is 0, there is nothing to earn.