You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Use string templating, not concatenation: `"Hello \(name)"` not `"Hello ".concat(name)`
64
+
- Use `equalWithinVariance` from `test_helpers.cdc` for equality assertions where rounding errors are possible
65
+
- Use red-green TDD for bug fixes and extensions to functionality. Tests must use assertions (eg. `Test.assert`) to verify expected behaviour, not logs.
Copy file name to clipboardExpand all lines: README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,7 @@
36
36
37
37
## 🏦 About FlowALP
38
38
39
-
FlowALP is a decentralized lending and borrowing protocol built on the Flow blockchain. This repository contains the v1 Cadence implementation deployed as the `FlowALPv0` contract. It is token-agnostic (operates over any `FungibleToken.Vault`) and integrates with DeFi Actions for composability.
39
+
FlowALP is a decentralized lending and borrowing protocol built on the Flow blockchain. This repository contains the current Cadence implementation deployed as the `FlowALPv0` contract. It is token-agnostic (operates over any `FungibleToken.Vault`) and integrates with DeFi Actions for composability.
Copy file name to clipboardExpand all lines: RebalanceArchitecture.md
+11-9Lines changed: 11 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,16 @@
1
1
## Updated Rebalance Architecture
2
2
3
-
This system **rebalances Flow Credit Market (FCM) positions on a schedule**: at a configurable interval, a rebalancer triggers the position’s `rebalance` function. **FCM** holds positions and exposes `rebalance`.
3
+
This system **rebalances FlowALP positions on a schedule**: at a configurable interval, a rebalancer triggers the position’s `rebalance` function. **FlowALP** holds positions and exposes `rebalance`.
4
+
5
+
**Implementation note:** In the current implementation, the FlowALP pool is `FlowALPv0.Pool`.
4
6
5
7
A **Rebalancer** when invoked, calls `rebalance` on the position and tries to schedules the next run.
6
8
7
9
A **Supervisor** runs on its own schedule (cron) and calls `fixReschedule()` on each registered rebalancer so that transient scheduling failures (e.g. temporary lack of funds) don’t leave rebalancers stuck.
8
10
9
11
### Key Principles
10
12
11
-
***Isolation:**FCM, Rebalancer, and Supervisor are fully independent.
13
+
***Isolation:**FlowALP, Rebalancer, and Supervisor are fully independent.
12
14
***Least Privilege:** The Rebalancer can *only* trigger the `rebalance` function.
13
15
***Resilience:** The `fixReschedule()` call is idempotent and permissionless, ensuring the system can recover without complex auth (see below).
14
16
@@ -39,7 +41,7 @@ There are two rebalancer types; they behave the same for triggering rebalances;
39
41
|**User’s control**| Full: config, fixReschedule, withdraw/destroy | Only: fixReschedule by UUID, or delete their RebalancerPaid (stops and removes the rebalancer) |
40
42
|**Use case**| User wants full autonomy and to pay their own fees | Admin retains autonomy and pays fees for users (us only) |
41
43
42
-
**Note:** The Supervisor and the Paid Rebalancer are only intended for use by us; the Standard Rebalancer is for users who self-custody. The bundled `FlowALPSupervisorV1` only tracks **paid** rebalancers (`addPaidRebalancer` / `removePaidRebalancer`). For standard rebalancers, users can call `fixReschedule()` themselves when needed.
44
+
**Note:** The Supervisor and the Paid Rebalancer are only intended for use by us; the Standard Rebalancer is for users who self-custody. The bundled `FlowALPSupervisorv1` only tracks **paid** rebalancers (`addPaidRebalancer` / `removePaidRebalancer`). For standard rebalancers, users can call `fixReschedule()` themselves when needed.
43
45
44
46
### Why calls `fixReschedule()` are necessary
45
47
@@ -57,12 +59,12 @@ User creates a position, then creates a **paid** rebalancer (which lives in the
57
59
sequenceDiagram
58
60
actor admin
59
61
actor User
60
-
participant FCM
62
+
participant FlowALP
61
63
participant Paid as Paid Rebalancer Contract
62
64
participant Supervisor
63
65
Note over admin,Paid: One-time: admin sets defaultRecurringConfig (incl. txFunder)
0 commit comments