Skip to content

Commit 6cf024f

Browse files
author
Edward (OpenClaw)
committed
docs(asset-leasing): clarify how the per-second lease fee actually accrues
The §1 lifecycle steps said 'a per-second lending fee accrues... settled by pay_lease_fee' which made it sound like the short seller needs to call pay_lease_fee every second. They don't. Now explained correctly: - The fee is a number that GROWS continuously against the locked collateral, but no transactions fire automatically. - The program computes the accrued fee ON DEMAND: every handler multiplies (now - last_paid_timestamp) * lease_fee_per_second and debits the result from collateral. - The short seller doesn't have to do anything while waiting; fees auto-settle at return_lease / liquidate / close_expired. - pay_lease_fee is OPTIONAL - call it to settle the running balance early so it doesn't eat into the collateral cushion.
1 parent f5ebe0e commit 6cf024f

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

defi/asset-leasing/anchor/README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,22 @@ tokens.
4343
The short seller's full lifecycle is:
4444

4545
1. **Open the position** by calling `take_lease`. This borrows A from
46-
the holder and locks B as collateral. A per-second lending fee
47-
accrues from this point onward, settled by `pay_lease_fee`.
46+
the holder and locks B as collateral. From this point on, a
47+
per-second lending fee accrues against the locked collateral. The
48+
fee is computed on demand: the program tracks
49+
`last_paid_timestamp` and `lease_fee_per_second` on the lease
50+
account, multiplies by elapsed seconds whenever any handler runs,
51+
and debits the result from the collateral. Nothing happens onchain
52+
each second - the fee is just a number that grows until someone
53+
pokes the lease.
4854
2. **Sell A immediately** on a market like Jupiter, receiving more B
4955
in return. The short seller now has more B and owes A.
5056
3. **Wait.** They are betting A's price (denominated in B) will fall.
51-
While waiting, they may call `top_up_collateral` to defend the
52-
position if A's price moves against them, and `pay_lease_fee` to
53-
settle accrued fees.
57+
The short seller doesn't have to call anything while they wait -
58+
accrued fees auto-settle at close. They can optionally call
59+
`pay_lease_fee` to settle the running balance early (so the fee
60+
doesn't eat into their collateral cushion), and `top_up_collateral`
61+
to add more collateral if A's price moves against them.
5462
4. **Close the position** by calling `return_lease`. They buy A back
5563
on the open market - hopefully at a lower price than they sold it
5664
for - and return the same quantity of A to the holder. The B they

0 commit comments

Comments
 (0)