Skip to content

Commit 6bb1d0f

Browse files
committed
Merge branch 'main' into vishal/add_cadence_linter
2 parents 59af50b + e08ba49 commit 6bb1d0f

138 files changed

Lines changed: 6841 additions & 1779 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@ coverage.json
77
/.pr-body.md
88
/.github/pr_bodies/
99
lcov.info
10-
.flow-fork-cache

AGENTS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,9 @@ flow test cadence/tests/interest_accrual_integration_test.cdc --name test_combin
5757
```bash
5858
grep "fun test" cadence/tests/interest_accrual_integration_test.cdc
5959
```
60+
61+
# Cadence Coding Guidelines
62+
63+
- 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.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ FlowALP/
179179

180180
- `FungibleToken.Vault`: Standard token operations
181181
- `DeFiActions.Sink/Source`: DeFi protocol composability
182-
- Entitlements: `FlowALPv0.EParticipant`, `FlowALPv0.EPosition`, `FlowALPv0.EGovernance`, `FlowALPv0.ERebalance`
182+
- Entitlements: `FlowALPModels.EParticipant`, `FlowALPModels.EPosition`, `FlowALPModels.EGovernance`, `FlowALPModels.ERebalance`
183183

184184
## 🛠️ Development
185185

cadence/contracts/FlowALPEvents.cdc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,11 @@ access(all) contract FlowALPEvents {
141141
)
142142

143143
/// Emitted when the insurance rate for a token is updated by governance.
144-
/// The insurance rate is an annual fraction of debit interest diverted to the insurance fund.
144+
/// The insurance rate is a fee of accrued debit interest diverted to the insurance fund.
145145
///
146146
/// @param poolUUID the UUID of the pool containing the token
147147
/// @param tokenType the type identifier string of the token whose rate changed
148-
/// @param insuranceRate the new annual insurance rate (e.g. 0.001 for 0.1%)
148+
/// @param insuranceRate the new insurance fee (e.g. 0.001 for 0.1%)
149149
access(all) event InsuranceRateUpdated(
150150
poolUUID: UInt64,
151151
tokenType: String,
@@ -167,11 +167,11 @@ access(all) contract FlowALPEvents {
167167
)
168168

169169
/// Emitted when the stability fee rate for a token is updated by governance.
170-
/// The stability fee rate is an annual fraction of debit interest diverted to the stability fund.
170+
/// The stability fee rate is a fee of accrued debit interest diverted to the stability fund.
171171
///
172172
/// @param poolUUID the UUID of the pool containing the token
173173
/// @param tokenType the type identifier string of the token whose rate changed
174-
/// @param stabilityFeeRate the new annual stability fee rate (e.g. 0.05 for 5%)
174+
/// @param stabilityFeeRate the new stability fee (e.g. 0.05 for 5%)
175175
access(all) event StabilityFeeRateUpdated(
176176
poolUUID: UInt64,
177177
tokenType: String,

cadence/contracts/FlowALPHealth.cdc

Lines changed: 255 additions & 362 deletions
Large diffs are not rendered by default.

cadence/contracts/FlowALPInterestRates.cdc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ access(all) contract FlowALPInterestRates {
44
///
55
/// A simple interface to calculate interest rate for a token type.
66
access(all) struct interface InterestCurve {
7-
/// Returns the annual interest rate for the given credit and debit balance, for some token T.
7+
/// Returns the annual nominal interest rate for the given credit and debit balance, for some token T.
88
/// @param creditBalance The credit (deposit) balance of token T
99
/// @param debitBalance The debit (withdrawal) balance of token T
1010
access(all) fun interestRate(creditBalance: UFix128, debitBalance: UFix128): UFix128 {
@@ -19,10 +19,10 @@ access(all) contract FlowALPInterestRates {
1919

2020
/// FixedCurve
2121
///
22-
/// A fixed-rate interest curve implementation that returns a constant yearly interest rate
22+
/// A fixed-rate interest curve implementation that returns a constant nominal yearly interest rate
2323
/// regardless of utilization. This is suitable for stable assets like MOET where predictable
2424
/// rates are desired.
25-
/// @param yearlyRate The fixed yearly interest rate as a UFix128 (e.g., 0.05 for 5% APY)
25+
/// @param yearlyRate The fixed yearly nominal rate as a UFix128 (e.g., 0.05 for a 5% nominal yearly rate)
2626
access(all) struct FixedCurve: InterestCurve {
2727

2828
access(all) let yearlyRate: UFix128
@@ -64,7 +64,7 @@ access(all) contract FlowALPInterestRates {
6464
/// This matches the live TokenState accounting used by FlowALP.
6565
///
6666
/// @param optimalUtilization The target utilization ratio (e.g., 0.80 for 80%)
67-
/// @param baseRate The minimum yearly interest rate (e.g., 0.01 for 1% APY)
67+
/// @param baseRate The minimum yearly nominal rate (e.g., 0.01 for a 1% nominal yearly rate)
6868
/// @param slope1 The total rate increase from 0% to optimal utilization (e.g., 0.04 for 4%)
6969
/// @param slope2 The total rate increase from optimal to 100% utilization (e.g., 0.60 for 60%)
7070
access(all) struct KinkCurve: InterestCurve {

0 commit comments

Comments
 (0)