Skip to content

Commit db46658

Browse files
author
Edward (OpenClaw)
committed
docs(asset-leasing): replace bare \u00a73.x section references with named anchor links
Bare '\u00a73.4' or 'See \u00a74' references force the reader to scroll back through the doc to find the section. Lawyer-style cross-references should always be clickable links to a named anchor. Replaced all 12 bare \u00a7-references with markdown links to the corresponding GitHub-auto-generated heading anchors. Verified each anchor slug against the heading text manually.
1 parent 6cf024f commit db46658

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

defi/asset-leasing/anchor/README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,9 @@ rallies against the collateral. A drop in the borrowed asset price is
165165
purely beneficial to the short seller. The streaming lending fee is
166166
the position's only ongoing cost in either direction.
167167

168-
§3 walks each instruction handler with concrete numbers that match
169-
the LiteSVM tests; the xNVDA example above is the same machinery
170-
applied to a real asset pair.
168+
[Section 3 (Lifecycle)](#3-lifecycle) walks each instruction handler
169+
with concrete numbers that match the LiteSVM tests; the xNVDA example
170+
above is the same machinery applied to a real asset pair.
171171

172172
### Production deviations to know
173173

@@ -176,7 +176,7 @@ applied to a real asset pair.
176176
inline in `liquidate.rs`. Production code would depend on the
177177
`pyth-solana-receiver-sdk` crate so layout changes are caught at
178178
compile time.
179-
- See §4 for the rest of the deliberate simplifications.
179+
- See [Section 4 (Safety and edge cases)](#4-safety-and-edge-cases) for the rest of the deliberate simplifications.
180180

181181
---
182182

@@ -387,8 +387,9 @@ being liquidated, or defaulting; no further lease fees are owed.
387387
`lease.last_paid_timestamp = min(now, end_timestamp)`.
388388
- If the vault did not have enough collateral to cover the full
389389
`lease_fee_due`, the residual is silently left as a debt the next
390-
`liquidate` or `close_expired` call cleans up. (See §4 for the
391-
rationale on this trade-off.)
390+
`liquidate` or `close_expired` call cleans up. (See
391+
[Section 4 (Safety and edge cases)](#4-safety-and-edge-cases) for
392+
the rationale on this trade-off.)
392393
- **Errors:**
393394
- `InvalidLeaseStatus` if the lease is not `Active`
394395
- `MathOverflow` if `elapsed * lease_fee_per_second` overflows `u64`
@@ -614,7 +615,7 @@ Shared starting parameters:
614615
The holder starts with 1 000 000 000 leased units; the short seller
615616
starts with 1 000 000 000 collateral units. Each scenario opens with
616617
`create_lease` and (where relevant) `take_lease` running as described
617-
in §3.1 and §3.2. Lease fees use the formula in §3.3.
618+
in [§3.1](#31-the-holder-lists-the-tokens---create_lease) and [§3.2](#32-the-short-seller-takes-the-offer---take_lease). Lease fees use the formula in [§3.3](#33-the-lease-fee-streams---pay_lease_fee).
618619

619620
#### 3.8.1 Liquidation - leased asset rallies
620621

@@ -629,7 +630,7 @@ pot of ~200 000 000 - maintenance ratio is `200/400 = 50%`, far below
629630
the required 120%. The keeper does not need to call `pay_lease_fee`
630631
first; `liquidate` settles accrued fees itself.
631632

632-
The keeper calls `liquidate` (mechanics in §3.6). At `T + 300`:
633+
The keeper calls `liquidate` (mechanics in [§3.6](#36-branch-position-underwater---liquidate)). At `T + 300`:
633634

634635
- Accrued lease fee: `300 × 10 = 3_000` collateral units. The vault
635636
has 200 000 000, so `lease_fee_payable = 3_000` flows to the holder.
@@ -668,7 +669,7 @@ a healthy position.
668669
At `T + 600` (10 minutes in) the short seller buys 100 leased tokens
669670
on the open market at the new price (about 50 collateral tokens
670671
total - far less than the 200 they posted) and calls `return_lease`
671-
(mechanics in §3.5). Accrued lease fees are `600 × 10 = 6_000`
672+
(mechanics in [§3.5](#35-the-short-seller-closes---return_lease)). Accrued lease fees are `600 × 10 = 6_000`
672673
collateral units. The settlement:
673674

674675
- 100 000 000 leased units flow short seller → leased vault → holder.
@@ -689,8 +690,8 @@ Final balances:
689690
payoff.
690691

691692
The short seller can defend a borderline position with
692-
`top_up_collateral` (§3.4) or close it early via `return_lease`
693-
(§3.5). Only adverse price moves trigger liquidation.
693+
`top_up_collateral` ([§3.4](#34-the-short-seller-defends-the-position---top_up_collateral)) or close it early via `return_lease`
694+
([§3.5](#35-the-short-seller-closes---return_lease)). Only adverse price moves trigger liquidation.
694695

695696
#### 3.8.3 Default - `close_expired` on an `Active` lease
696697

@@ -700,7 +701,7 @@ is never called. The clock advances past
700701
`end_timestamp = T + 86_400`.
701702

702703
At `T + 100_000` the holder calls `close_expired` (mechanics in
703-
§3.7). Because `status == Active` and `now >= end_timestamp`, the
704+
[§3.7](#37-branch-cancel-or-default---close_expired)). Because `status == Active` and `now >= end_timestamp`, the
704705
default branch runs:
705706

706707
- `leased_vault` is empty (the short seller kept the tokens) - no
@@ -722,7 +723,7 @@ Final balances:
722723

723724
The cheap cancel path. `create_lease` runs; no short seller ever
724725
calls `take_lease`. The holder calls `close_expired` immediately
725-
(mechanics in §3.7). Because `status == Listed`, no expiry check
726+
(mechanics in [§3.7](#37-branch-cancel-or-default---close_expired)). Because `status == Listed`, no expiry check
726727
applies:
727728

728729
- `leased_vault` holds 100 000 000 leased units; all of it drains

0 commit comments

Comments
 (0)