Skip to content

Commit c563641

Browse files
author
Edward (OpenClaw)
committed
docs(asset-leasing): name the instruction handlers in the §1 lifecycle steps
The §1 'short seller's full lifecycle' steps described the mechanics in plain English ('open the position', 'close the position') without naming the instruction handlers that actually perform those steps. The reader had no signpost connecting the narrative to the code. Now each step calls out the handler explicitly: take_lease, pay_lease_fee, top_up_collateral, return_lease — plus liquidate and close_expired in the failure paragraph. Reader can grep the handler name straight to §3 for full mechanics.
1 parent d55e3af commit c563641

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

defi/asset-leasing/anchor/README.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,28 @@ of the A tokens.
4242

4343
The short seller's full lifecycle is:
4444

45-
1. **Open the position.** Borrow A from the holder by posting B as
46-
collateral. Pay a per-second lending fee out of the collateral.
45+
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`.
4748
2. **Sell A immediately** on a market like Jupiter, receiving more B
4849
in return. The short seller now has more B and owes A.
4950
3. **Wait.** They are betting A's price (denominated in B) will fall.
50-
4. **Close the position.** Buy A back on the open market — hopefully
51-
at a lower price than they sold it for — and return the same
52-
quantity of A to the holder. The B they paid to re-acquire A is
53-
less than the B they got for selling it, and the difference is
54-
the short seller's profit.
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.
54+
4. **Close the position** by calling `return_lease`. They buy A back
55+
on the open market — hopefully at a lower price than they sold it
56+
for — and return the same quantity of A to the holder. The B they
57+
paid to re-acquire A is less than the B they got for selling it,
58+
and the difference is the short seller's profit.
5559

5660
If A's price *rises* instead, buying it back costs more B than they
5761
got for selling it — that's a loss. If it rises far enough that their
58-
locked collateral is no longer worth more than the A they owe, they
59-
get liquidated (see below).
62+
locked collateral is no longer worth more than the A they owe, anyone
63+
can call `liquidate` to close the position out, paying the keeper a
64+
bounty from the collateral. If the lease term ends without the short
65+
seller calling `return_lease`, the holder calls `close_expired` to
66+
seize the collateral and recover.
6067

6168
The program acts as a non-custodial escrow. It:
6269

0 commit comments

Comments
 (0)