auto-repay · Base Sepolia ↔ Reactive Lasna

Price falls Debt shrinks

When your collateral price hits the trigger, xlmflow pays down part of your loan from a reserve you set aside. No clicks needed

Demo loan trigger $1,350 · target 150% watching

example run · both chains

  • base sepoliaAutoRepaiddebt 1,000 → 900repaid
  • lasnaRepayRequestedoracle v3requested
  • base sepoliaPriceUpdatedv3 · $1,350origin
3 transactions one linked record
scroll

built on Reactive Network

the problem

Prices can drop while you sleep. xlmflow repays for you, from a reserve only you control

how the repay works

Started by the price, paid from your reserve

  1. 01 / repay rule

    Repays just enough

    At the trigger, the vault repays debt back to a 150% ratio. Never more than your reserve or your limit. Try a price on the right

    min(gap, reserve, limit)
  2. 02 / watch

    Lasna watches the price

    A contract on Reactive Lasna reads every price update from Base Sepolia. At $1,350 or lower, it asks for a repay

    onlySystem · requestCallbackV_1_0
  3. 03 / callback

    Only trusted calls get in

    The repay arrives through Reactive's callback proxy. The vault accepts it only when it comes from your Lasna contract

    proxy check · sender check
  4. 04 / guards

    Late or repeated calls are skipped

    Only the newest price counts, only once, and only while it is under 15 minutes old. Anything else is logged and skipped

    newest · once · 15 min
  5. 05 / reserve

    Your reserve stays yours

    Each borrower has a separate reserve, and only you can withdraw it. Close the loan to get your collateral and leftover reserve back

    fund · withdraw · close
xlmflow / position / repay rule
Repay ruletarget 150%
collateral · debt
1 mCOL · 1,000 mUSD
reserve · limit
150 · 120 mUSD
ratio at this price
…
debt at 150%
…
repay = min(debt − target, reserve, limit) …

type a price · the trigger is $1,350

react() on LasnaonlySystem
  • log chain id84532 · Base Sepolia✓
  • log emitterMockOracle✓
  • topic 0PriceUpdated✓
  • price at or below trigger1,350 ≤ 1,350✓
  • version not yet requestedv3✓
then, from Lasna requestCallbackV_1_0 → RepayRequested(v3, originTxHash)
Callback on Base Sepoliaproxy 0x476F…3585
payload encoded on Lasna executeRepay(address(0), 3, originTxHash)
payload delivered by the callback proxy executeRepay(ReactiveRepay, 3, originTxHash)
msg.sender
callback proxy ✓
reactiveSender
ReactiveRepay ✓
borrower · vault
immutable in receiver
next call
vault.autoRepay(borrower, 3, originTxHash)

calls from anyone else are rejected

Callback guardsvault checks
Postedoracle v3 Fresh15 min window Staleskipped now
  • v3autoRepay()ok · AutoRepaid
  • v3 againautoRepay()skipped · already paid
  • v2 lateautoRepay()skipped · not latest
  • v3 +16 minautoRepay()skipped · stale price
  • strangerautoRepay()reverted · not receiver

a landed call is not always a repay · the dashboard shows both

Reserve ledgerper borrower
reservedebtratio
You150%
Borrower B225%
withdrawReserve
the borrower only
closePosition
collateral + leftover reserve back
config version
rises on every reopen

Reopened loan: old callbacks are skipped, so they can't touch it

proof

Every repay, on the record

Each repay is three linked transactions: the price update, the request on Lasna and the repay itself. Open any of them in an explorer

run v3 · example

Demo position
repaid · 3 of 3
Collateral ratiotarget 150%
Run v3one line per step
  • 1PriceUpdated · base✓
  • 2RepayRequested · lasna✓
  • 3AutoRepaid · base✓ repaid
  • Δdebt 1,000 → 900 mUSD−100
  • Δreserve 150 → 50 mUSD−100
  • v2$1,400 · above triggerno request
latency repay block − price block resolution 1 second
collateral ratio 150% back on target
price v2 · $1,400 Above the trigger, so no repay as designed

every second counts

The price moves. Your reserve answers before you even look

safety

Two chains, one set of rules

The trigger is checked on Lasna and again in the vault. Every decision, even a skip, is logged

Every step is verified

Each contract only accepts calls from the one before it, from the oracle all the way to the vault

oracle → Lasna → proxy → vault

Clear limits

These ratios are fixed in the vault. The liquidation line is for reference only: nothing gets liquidated in this demo

  • to open a loanminimum160%
  • after a repaytarget150%
  • liquidation linereference only120%

only you can withdraw your reserve

your view

A price drop, step by step

What you see during a drop: room left, reserve used and where to check each step. Example data

room above the liquidation line repaid at v3
reserve spent

100 of 150 mUSD used, 50 left

steps per repay

3 transactions

2 on Base Sepolia, 1 on Lasna

debt and reserve

debtreserve

where to check
  • price updatesepolia.basescan.org
  • requestlasna.reactscan.net
  • repaysepolia.basescan.org

Every hash opens in its chain's explorer

key numbers

Rules written in code

Fixed in the contracts, not estimates

ratio after a repay 150% or as close as your reserve allows
price freshness 15 minutes before a price is too old
clicks needed 0 when the price hits the trigger

how it works

Four simple steps

  1. 01

    Open

    Lock collateral and borrow mUSD, at 160% or more

  2. 02

    Protect

    Fund a reserve, set a limit and turn protection on

  3. 03

    React

    The price hits $1,350 and Lasna asks for a repay

  4. 04

    Repay

    The vault repays from your reserve. All 3 transactions are linked

xlmflow

Automatic loan repay, built for the Reactive Omni Buildathon

try it

Every second counts

Open the demo loan, drop the price and watch the repay land