docs · Base Sepolia ↔ Reactive Lasna

xlmflow guide

Everything you need to use the dashboard, understand what happens on chain when the price drops, and check each automatic repay yourself.

Overview

The name stands for cross-chain (X) Loan Margin flow: a price on one chain, a reaction on another and a repay back on the first keep the loan's margin safe.

xlmflow protects a loan from a falling price. The borrower sets aside a reserve of mUSD next to the loan. When the collateral price reaches the trigger, Reactive Network sees the price update and calls the vault back. The vault then pays part of the debt from the reserve, so the loan returns to a safe ratio. Nobody has to click anything, and no off-chain bot is involved.

price falls

The oracle on Base Sepolia publishes a new price.

reactive sees it

A reactive contract on Lasna reads the log and asks for a callback.

debt shrinks

The vault on Base Sepolia repays from the reserve, back to 150%.

Testnet. xlmflow runs on Base Sepolia and Reactive Lasna with test tokens (mCOL as collateral, mUSD as the loan currency). The oracle is a test oracle whose price is set by an operator, so a price drop can be shown on demand. All numbers in the dashboard are read from the deployed contracts.

How it works

  1. 1

    Price update Base Sepolia

    The operator calls MockOracle.setPrice. The oracle raises its version by one and emits PriceUpdated(version, priceE6, updatedAt).

  2. 2

    Reaction Reactive Lasna

    ReactiveRepay is subscribed to that event. Its react() function checks that the log really comes from the oracle on Base Sepolia and has the right shape. If the price is at or under $1,350, and this version was not handled before, it requests a callback and emits RepayRequested.

  3. 3

    Callback Base Sepolia

    The Reactive callback proxy calls RepayReceiver.executeRepay. The receiver accepts only the proxy, and only on behalf of ReactiveRepay. It forwards to LendingVault.autoRepay, which runs its own checks and emits either AutoRepaid or CallbackSkipped.

Each run is joined across both chains by two keys: the oracle version and the origin tx hash (the price update transaction). Both travel inside the callback, so every repay points back to the price update that caused it.

Quick start

Just looking

Open the dashboard. No wallet is needed to read: the loan, the protection rule, every past run and its transactions load straight from the chains, refreshed every few seconds.

Taking actions

  1. Install a wallet such as MetaMask.
  2. Click the wallet button in the top bar of the dashboard and connect.
  3. Approve the switch to Base Sepolia (chain 84532) when the wallet asks. Every write goes to Base Sepolia; Lasna is only read.
  4. Keep a little Base Sepolia ETH for gas. A transaction costs a tiny fraction of a cent at current testnet gas prices.
Who can do what. This deployment protects one demo loan. Loan actions (approve, repay, reserve, protection) are accepted only from the demo borrower's wallet, and price updates only from the oracle operator. Any other wallet can read everything; the dashboard explains which wallet is needed before it asks for a signature.

Ratio, trigger and reserve

Collateral ratio
Collateral value divided by debt. 1 mCOL at $1,800 against 1,000 mUSD of debt is 180%.
Opening ratio
A loan can be opened only at 160% or more, with a price no older than 15 minutes.
Trigger price
$1,350. At or under this price, the reactive contract requests a repay. The vault checks the same trigger again before it moves funds.
Target ratio
150%. An automatic repay brings the loan back to this ratio, unless the reserve or the limit runs out first.
Reserve
mUSD the borrower sets aside in the vault for automatic repays. It is kept apart from the vault's lending money, and only the borrower can withdraw it.
Max per repay
The most a single callback can repay. It caps how fast the reserve can be spent.
Liquidation line
120%. Shown for context only. Nothing is ever liquidated in this demo.
Price freshness
A price older than 15 minutes is stale. The vault refuses to open loans or repay on a stale price. The age is measured with block timestamps.
Oracle version
A counter that rises by one with every price update. A repay can happen at most once per version.

How much gets repaid

target debt = collateral value ÷ 1.5

repay = min( debt − target debt, reserve, max per repay )

Worked example, from the run recorded on testnet on 18 Nov 2026:

Collateral1 mCOL at $1,350 = $1,350
Debt before1,000 mUSD (ratio 135%)
Target debt1,350 ÷ 1.5 = 900 mUSD
Limitsreserve 150 mUSD, max per repay 120 mUSD
Repaymin(100, 150, 120) = 100 mUSD
Afterdebt 900, reserve 50, ratio back to 150%

If the loan is already at or above 150% when the trigger fires, there is nothing to repay. The vault records the run as skipped, with the reason, and keeps the reserve untouched.

The ten checks

A callback moves funds only if all ten checks pass, in this order. The first two are done by RepayReceiver, the rest by LendingVault. Execution Details shows each one as passed or failed for every run.

#CheckIf it fails
1Sender is the Base Sepolia callback proxyreverts
2The proxy acts for ReactiveRepayreverts
3The position is openskipped: No position
4Protection is onskipped: Protection disabled
5The price is under 15 minutes oldskipped: Stale price
6The price is at or under the vault triggerskipped: Above trigger
7The callback carries the newest oracle versionskipped: Not latest version
8No repay yet for this loan and versionskipped: Already paid
9The version is newer than the last rule changeskipped: Configured after version
10There is something to repay and the reserve is not emptyskipped: Nothing to repay / Reserve empty

A skipped callback is a normal outcome, recorded on chain with a CallbackSkipped event. Only callers that are not allowed to call at all are reverted.

Pages at a glance

PageWhat it shows
OverviewThe loan in one screen: ratio gauge, price chart, debt and reserve, the latest runs.
PositionCollateral, debt, reserve, the price at 150% and at 120%, wallet balances, manual repay and close.
ProtectionThe repay rule (on or off, max per repay), the reserve, both trigger prices and a preview of the next repay.
Risk SimulatorWhat-if prices: drag or type a price and see the ratio and the repay that would follow. The operator can also push that price to the oracle from here.
ActivityEvery run and event in order, plus the deployment transactions.
Execution DetailsOne run in full: its three transactions, the ten checks, balances before and after, latency.

The top bar has a search box (pages, oracle versions, tx hashes), the Push price button for the operator, and the wallet button. The badge next to it reads Base Sepolia · Lasna when data is live; it turns to Syncing… while it catches up and to RPC error if a chain stops answering.

Manage the loan

All of these are on the Position page and need the borrower's wallet.

Open a loan

  1. Enter the collateral (mCOL) and the amount to borrow (mUSD). The preview shows the ratio; it must be 160% or more.
  2. Click 1. Approve mCOL once, so the vault may take the collateral.
  3. Click 2. Open position and confirm in the wallet.

Repay by hand

  1. Enter an amount, or click Repay all.
  2. Click Approve mUSD once, then Repay.

Close

When the debt is zero, Close position returns the collateral and any reserve left to the wallet.

Set up protection

On the Protection page:

  1. Fund the reserve. Enter an amount under Add to reserve, click Approve mUSD once, then Fund reserve.
  2. Set the limit. Enter Max repay per callback and click Save limit. A limit above zero turns protection on.
  3. Check the preview. The card At $1,350 shows what the next repay would be with today's balances, and how many such repays the reserve covers.

You can click Turn protection off at any time, and withdraw the reserve. Changing the rule only applies to price updates that come after the change.

Trigger a repay

This is the full loop, start to finish. It needs the operator wallet, because only the operator may set the test oracle's price.

  1. Work out a price that will cause a repay: it must be at or under $1,350, and low enough that the ratio falls under 150%. That is: price × collateral < debt × 1.5.
  2. Click Push price in the top bar (or use the Risk Simulator), enter the price in dollars and confirm in the wallet.
  3. Watch the Overview: a new run appears for the new version, then turns to Debt repaid and the gauge moves back to 150%. This usually takes a few seconds.
  4. Open the run in Execution Details to see its three transactions.
Example. With 1 mCOL and 900 mUSD of debt, a price of $1,300 gives a ratio of 144.4%. The vault repays about 33.33 mUSD and the ratio returns to 150%. Pushing $1,350 again would trigger the callback too, but the ratio would already be exactly 150%, so the vault skips it with Nothing to repay.

Trace a run

Every run in Execution Details lists three transactions, each linked to its explorer:

  1. Origin on Base Sepolia: the price update (PriceUpdated).
  2. Reaction on Lasna: the callback request (RepayRequested), carrying the origin tx hash and version.
  3. Callback on Base Sepolia: the outcome (AutoRepaid or CallbackSkipped), with the same hash and version.

Prices above the trigger produce only the origin transaction: Lasna still reads the log, but requests nothing.

Contracts and addresses

Deployed on 18 Nov 2026.

ContractChainAddress
LendingVaultBase Sepolia0xA1B5bccd…30d25332
MockOracleBase Sepolia0xf895f707…439d828a
RepayReceiverBase Sepolia0x849DeeF3…4F95eb41
mCOL (18 decimals)Base Sepolia0x82138701…7C6B67f2
mUSD (6 decimals)Base Sepolia0x0618D548…50B585EE
ReactiveRepayReactive Lasna0x428ce886…B3462462
Callback proxyBase Sepolia0x476F44b1…10743585
System contractReactive Lasna0x88888888…88888888

First recorded loop

StepChainTransaction
Price $1,350, version 3Base Sepolia0x70ec77fe…21f822
RepayRequestedReactive Lasna0xd997aca0…05d4c3
AutoRepaid, 100 mUSDBase Sepolia0x4a5e17ea…fa86aa1

Reactive Network details

  • ReactiveRepay lives on Lasna and subscribes once to PriceUpdated from the oracle on Base Sepolia (chain 84532).
  • react() may only be called by the system contract. Logs with the wrong chain, contract, topic or shape are ignored rather than reverted.
  • It requests at most one callback per oracle version, through requestCallbackV_1_0, with a gas limit of 600,000.
  • Reactive gas is paid in lREACT, deposited for ReactiveRepay at the system contract. Callback gas on Base Sepolia is paid in ETH, deposited for RepayReceiver at the callback proxy.
  • lREACT comes from the Lasna faucet: send Base Sepolia ETH to 0x2afaFD29…409f5967 and receive 100 lREACT per ETH.
  • Built on reactive-lib-omni v0.1.0. More in the Reactive docs ↗.

Latency

Latency is the time from the price update to the repay. Both transactions are on Base Sepolia, so they share one clock: the dashboard subtracts the two block timestamps. Timestamps count whole seconds, so the dashboard also shows how many blocks apart the two transactions are. Base Sepolia makes a block about every 0.2 seconds.

The first recorded loop took 1 second by timestamps, 6 blocks apart, about 1.2 seconds.

Troubleshooting

"This demo loan belongs to 0xF964…6a57"
The connected wallet is not the demo borrower. Reading works with any wallet; loan actions need that one.
"Only the oracle operator can push prices"
The test oracle accepts prices from its operator only.
"The oracle price is older than 15 minutes"
Opening a loan needs a fresh price. Push a new price first, then try again within 15 minutes.
"Approve the token for the vault first"
Click the Approve button next to the action. It is needed once per token.
The wallet asks to switch network
Accept the switch to Base Sepolia. All writes go there.
The badge says "Syncing…" or "RPC error"
A public RPC endpoint is slow or busy. The dashboard retries on its own every few seconds; data on chain is not affected.
A run shows "Skipped"
Open it in Execution Details. The failed check names the reason, for example Nothing to repay when the ratio was already at or above 150%.
A run stays without a callback
Prices above $1,350 never request one. Under the trigger, check that ReactiveRepay still has lREACT and RepayReceiver still has callback gas.

FAQ

Is this real money?
No. Every token is a test token on Base Sepolia, and the network fees are testnet ETH and lREACT.
Can I open my own protected loan?
Not in this deployment. Each ReactiveRepay watches one borrower, and the test tokens are minted by the deployer. A deployment for another borrower uses the same scripts.
Can a repay happen twice for one price drop?
No. Lasna requests at most once per oracle version, and the vault refuses a second repay for the same version.
What if the reserve runs out?
The callback is skipped with Reserve empty. Add to the reserve and the next qualifying price update repays again.
Is there a bot or server?
No. The reaction runs on Reactive Network and the repay runs in the vault. The dashboard only reads the chains and sends the transactions you sign.

For developers

The source is open under the MIT license.

# contracts: 27 tests, including fuzzing of the repay bounds
cd contracts && forge test

# dashboard and these docs
cd frontend && npm install && npm run dev

# deploy to Base Sepolia + Reactive Lasna (Foundry keystore or PRIVATE_KEY in .env)
cd contracts && ./deploy.sh

The deploy script checks both chains, deploys and wires the five contracts in four steps, funds reactive and callback gas, subscribes, and writes the manifest the dashboard reads. Full details are in the README ↗.