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%.
How it works
-
1
Price update Base Sepolia
The operator calls
MockOracle.setPrice. The oracle raises its version by one and emitsPriceUpdated(version, priceE6, updatedAt). -
2
Reaction Reactive Lasna
ReactiveRepayis subscribed to that event. Itsreact()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 emitsRepayRequested. -
3
Callback Base Sepolia
The Reactive callback proxy calls
RepayReceiver.executeRepay. The receiver accepts only the proxy, and only on behalf ofReactiveRepay. It forwards toLendingVault.autoRepay, which runs its own checks and emits eitherAutoRepaidorCallbackSkipped.
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
- Install a wallet such as MetaMask.
- Click the wallet button in the top bar of the dashboard and connect.
- Approve the switch to Base Sepolia (chain 84532) when the wallet asks. Every write goes to Base Sepolia; Lasna is only read.
- Keep a little Base Sepolia ETH for gas. A transaction costs a tiny fraction of a cent at current testnet gas prices.
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:
| Collateral | 1 mCOL at $1,350 = $1,350 |
|---|---|
| Debt before | 1,000 mUSD (ratio 135%) |
| Target debt | 1,350 ÷ 1.5 = 900 mUSD |
| Limits | reserve 150 mUSD, max per repay 120 mUSD |
| Repay | min(100, 150, 120) = 100 mUSD |
| After | debt 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.
| # | Check | If it fails |
|---|---|---|
| 1 | Sender is the Base Sepolia callback proxy | reverts |
| 2 | The proxy acts for ReactiveRepay | reverts |
| 3 | The position is open | skipped: No position |
| 4 | Protection is on | skipped: Protection disabled |
| 5 | The price is under 15 minutes old | skipped: Stale price |
| 6 | The price is at or under the vault trigger | skipped: Above trigger |
| 7 | The callback carries the newest oracle version | skipped: Not latest version |
| 8 | No repay yet for this loan and version | skipped: Already paid |
| 9 | The version is newer than the last rule change | skipped: Configured after version |
| 10 | There is something to repay and the reserve is not empty | skipped: 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
| Page | What it shows |
|---|---|
| Overview | The loan in one screen: ratio gauge, price chart, debt and reserve, the latest runs. |
| Position | Collateral, debt, reserve, the price at 150% and at 120%, wallet balances, manual repay and close. |
| Protection | The repay rule (on or off, max per repay), the reserve, both trigger prices and a preview of the next repay. |
| Risk Simulator | What-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. |
| Activity | Every run and event in order, plus the deployment transactions. |
| Execution Details | One 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
- Enter the collateral (mCOL) and the amount to borrow (mUSD). The preview shows the ratio; it must be 160% or more.
- Click 1. Approve mCOL once, so the vault may take the collateral.
- Click 2. Open position and confirm in the wallet.
Repay by hand
- Enter an amount, or click Repay all.
- 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:
- Fund the reserve. Enter an amount under Add to reserve, click Approve mUSD once, then Fund reserve.
- Set the limit. Enter Max repay per callback and click Save limit. A limit above zero turns protection on.
- 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.
- 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.
- Click Push price in the top bar (or use the Risk Simulator), enter the price in dollars and confirm in the wallet.
- 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.
- Open the run in Execution Details to see its three transactions.
Trace a run
Every run in Execution Details lists three transactions, each linked to its explorer:
- Origin on Base Sepolia: the price update (
PriceUpdated). - Reaction on Lasna: the callback request (
RepayRequested), carrying the origin tx hash and version. - Callback on Base Sepolia: the outcome (
AutoRepaidorCallbackSkipped), 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.
| Contract | Chain | Address |
|---|---|---|
| LendingVault | Base Sepolia | 0xA1B5bccd…30d25332 |
| MockOracle | Base Sepolia | 0xf895f707…439d828a |
| RepayReceiver | Base Sepolia | 0x849DeeF3…4F95eb41 |
| mCOL (18 decimals) | Base Sepolia | 0x82138701…7C6B67f2 |
| mUSD (6 decimals) | Base Sepolia | 0x0618D548…50B585EE |
| ReactiveRepay | Reactive Lasna | 0x428ce886…B3462462 |
| Callback proxy | Base Sepolia | 0x476F44b1…10743585 |
| System contract | Reactive Lasna | 0x88888888…88888888 |
First recorded loop
| Step | Chain | Transaction |
|---|---|---|
| Price $1,350, version 3 | Base Sepolia | 0x70ec77fe…21f822 |
| RepayRequested | Reactive Lasna | 0xd997aca0…05d4c3 |
| AutoRepaid, 100 mUSD | Base Sepolia | 0x4a5e17ea…fa86aa1 |
Reactive Network details
ReactiveRepaylives on Lasna and subscribes once toPriceUpdatedfrom 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
ReactiveRepayat the system contract. Callback gas on Base Sepolia is paid in ETH, deposited forRepayReceiverat the callback proxy. - lREACT comes from the Lasna faucet: send Base Sepolia ETH to
0x2afaFD29…409f5967and 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
ReactiveRepaywatches 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 ↗.