|
2 | 2 | ;; |
3 | 3 | ;; LP pool for canonical sBTC flash loans. |
4 | 4 | ;; Depositors earn sBTC yield from every flash loan fee. |
5 | | -;; Share value is denominated in sats — appreciates with BTC. |
| 5 | +;; Share value is denominated in sats - appreciates with BTC. |
6 | 6 | ;; |
7 | 7 | ;; Share model (identical to flashstack-stx-pool but in sats): |
8 | 8 | ;; shares_minted = deposit * total_shares / pool_balance |
|
12 | 12 | ;; |
13 | 13 | ;; Collateral oracle: |
14 | 14 | ;; get-share-price returns sats per share (scaled by SHARE-PRECISION) |
15 | | -;; Lending protocols can call this directly — no external oracle needed |
| 15 | +;; Lending protocols can call this directly - no external oracle needed |
16 | 16 | ;; Flash loan manipulation-resistant: reserve invariant guarantees |
17 | 17 | ;; pool balance only ever grows by >= fee per loan |
18 | 18 | ;; |
19 | 19 | ;; Security model: |
20 | 20 | ;; - Receiver whitelist prevents arbitrary contracts from borrowing |
21 | 21 | ;; - Repayment verified by reserve balance before/after |
22 | | -;; - Admin cannot drain pool — only set parameters |
| 22 | +;; - Admin cannot drain pool - only set parameters |
23 | 23 |
|
24 | 24 | (use-trait sbtc-flash-receiver-trait 'SP20XD46NGAX05ZQZDKFYCCX49A3852BQABNP0VG5.sbtc-flash-receiver-trait.sbtc-flash-receiver-trait) |
25 | 25 |
|
|
52 | 52 | (define-data-var total-volume uint u0) |
53 | 53 | (define-data-var total-fees uint u0) |
54 | 54 |
|
55 | | -(define-constant SHARE-PRECISION u100000000) ;; 1e8 — matches sBTC sat precision |
| 55 | +(define-constant SHARE-PRECISION u100000000) ;; 1e8 - matches sBTC sat precision |
56 | 56 |
|
57 | 57 | (define-map approved-receivers principal bool) |
58 | 58 | (define-map lp-shares principal uint) |
|
138 | 138 | ;; Invoke receiver callback |
139 | 139 | (try! (contract-call? receiver execute-sbtc-flash amount (as-contract tx-sender))) |
140 | 140 |
|
141 | | - ;; Verify repayment — reserve must have grown by >= fee |
| 141 | + ;; Verify repayment - reserve must have grown by >= fee |
142 | 142 | (let ((reserve-after (unwrap! |
143 | 143 | (contract-call? 'SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-token |
144 | 144 | get-balance (as-contract tx-sender)) |
|
202 | 202 | ) |
203 | 203 |
|
204 | 204 | ;; ============================================= |
205 | | -;; Read-only — including collateral oracle |
| 205 | +;; Read-only - including collateral oracle |
206 | 206 | ;; ============================================= |
207 | 207 |
|
208 | 208 | ;; Current value of one pool share in sats, scaled by SHARE-PRECISION (1e8). |
|
0 commit comments