Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
9036283
Add mainnet fork test for multiple positions per user and batch liqui…
mts1715 Feb 18, 2026
4c2bf16
Add testMassUnhealthyLiquidations — a system-wide stress test that cr…
mts1715 Feb 19, 2026
bf31254
Merge remote-tracking branch 'origin/main' into taras/147-multi-posit…
mts1715 Feb 19, 2026
441c58e
fixes after merge
mts1715 Feb 19, 2026
86086fa
code style fix
mts1715 Feb 19, 2026
526704a
constant naming fix
mts1715 Feb 20, 2026
13c50e5
moved helper methods to test_helpers.cdc
mts1715 Feb 24, 2026
e7216bd
Update cadence/tests/fork_multiple_positions_per_user.cdc
mts1715 Feb 25, 2026
d064bc7
fix naming *_test.cdc, move not production script to test dir
mts1715 Feb 25, 2026
887ae21
flow.json: fix block height
mts1715 Feb 25, 2026
0df9e00
fix block height in flow.json, add actions/cache for ./imports keyed …
mts1715 Feb 25, 2026
c9cc894
add more description comments to test
mts1715 Feb 26, 2026
0e5577c
move scripts only for test to "cadence/test/transactions"
mts1715 Feb 26, 2026
5bc3cf1
remove useless transaction from test
mts1715 Feb 26, 2026
8fd216c
Merge branch 'main' into taras/147-multi-position-per-user-scenarios-…
mts1715 Mar 2, 2026
e5e5824
Merge branch 'main' into taras/147-multi-position-per-user-scenarios-…
mts1715 Mar 3, 2026
d7cefa5
Merge branch 'main' into taras/147-multi-position-per-user-scenarios-…
Kay-Zee Mar 6, 2026
d98a0aa
fix borrow asset to MOET instead of FLOW, fix liqudate transactions t…
mts1715 Mar 10, 2026
828600a
use constants instead of magic numbers in fork_multiple_positions_per…
mts1715 Mar 10, 2026
6e9d39c
Merge remote-tracking branch 'origin/main' into taras/147-multi-posit…
mts1715 Mar 10, 2026
1e0b091
docs: clarify nominal interest rate semantics
liobrasil Mar 10, 2026
2d40ba5
docs: align fixed-rate transaction wording
liobrasil Mar 10, 2026
404f0ef
Merge branch 'main' into lionel/interest-rate-terminology
liobrasil Mar 10, 2026
d1ff732
Merge branch 'main' into taras/147-multi-position-per-user-scenarios-…
mts1715 Mar 10, 2026
6f760e8
docs: finish nominal interest terminology cleanup
liobrasil Mar 10, 2026
6da3851
revert: keep yearlyRate naming in code
liobrasil Mar 10, 2026
63bca2b
Merge pull request #172 from onflow/taras/147-multi-position-per-user…
mts1715 Mar 10, 2026
c66d975
Update cadence/contracts/FlowALPEvents.cdc
liobrasil Mar 11, 2026
704b945
Update cadence/contracts/FlowALPEvents.cdc
liobrasil Mar 11, 2026
ccdc62c
Update cadence/contracts/FlowALPEvents.cdc
liobrasil Mar 11, 2026
410e3ec
Update cadence/contracts/FlowALPEvents.cdc
liobrasil Mar 11, 2026
b33a648
Update cadence/tests/interest_accrual_integration_test.cdc
liobrasil Mar 11, 2026
abe25a7
Update cadence/tests/interest_accrual_integration_test.cdc
liobrasil Mar 11, 2026
52acc2e
Merge branch 'main' into lionel/interest-rate-terminology
liobrasil Mar 11, 2026
2ca8757
Merge branch 'holyfuchs/FLO-18-nominal-interets' into lionel/interest…
liobrasil Mar 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/cadence_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ jobs:
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- uses: actions/cache@v4
with:
path: ./imports
key: flow-deps-${{ hashFiles('flow.json') }}
- name: Install Flow CLI
env:
FLOW_CLI_VERSION: v2.7.2
Expand Down
8 changes: 4 additions & 4 deletions cadence/contracts/FlowALPEvents.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ access(all) contract FlowALPEvents {
)

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

/// Emitted when the stability fee rate for a token is updated by governance.
/// The stability fee rate is an annual fraction of debit interest diverted to the stability fund.
/// The stability fee rate is a fee of accrued debit interest diverted to the stability fund.
///
/// @param poolUUID the UUID of the pool containing the token
/// @param tokenType the type identifier string of the token whose rate changed
/// @param stabilityFeeRate the new annual stability fee rate (e.g. 0.05 for 5%)
/// @param stabilityFeeRate the new stability fee (e.g. 0.05 for 5%)
access(all) event StabilityFeeRateUpdated(
poolUUID: UInt64,
tokenType: String,
Expand Down
8 changes: 4 additions & 4 deletions cadence/contracts/FlowALPInterestRates.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ access(all) contract FlowALPInterestRates {
///
/// A simple interface to calculate interest rate for a token type.
access(all) struct interface InterestCurve {
/// Returns the annual interest rate for the given credit and debit balance, for some token T.
/// Returns the annual nominal interest rate for the given credit and debit balance, for some token T.
/// @param creditBalance The credit (deposit) balance of token T
/// @param debitBalance The debit (withdrawal) balance of token T
access(all) fun interestRate(creditBalance: UFix128, debitBalance: UFix128): UFix128 {
Expand All @@ -19,10 +19,10 @@ access(all) contract FlowALPInterestRates {

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

access(all) let yearlyRate: UFix128
Expand Down Expand Up @@ -64,7 +64,7 @@ access(all) contract FlowALPInterestRates {
/// This matches the live TokenState accounting used by FlowALP.
///
/// @param optimalUtilization The target utilization ratio (e.g., 0.80 for 80%)
/// @param baseRate The minimum yearly interest rate (e.g., 0.01 for 1% APY)
/// @param baseRate The minimum yearly nominal rate (e.g., 0.01 for a 1% nominal yearly rate)
/// @param slope1 The total rate increase from 0% to optimal utilization (e.g., 0.04 for 4%)
/// @param slope2 The total rate increase from optimal to 100% utilization (e.g., 0.60 for 60%)
access(all) struct KinkCurve: InterestCurve {
Expand Down
12 changes: 5 additions & 7 deletions cadence/lib/FlowALPMath.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,11 @@ access(all) contract FlowALPMath {
}

/// Converts a nominal yearly interest rate to a per-second multiplication factor (stored in a UFix128 as a fixed
/// point number with 18 decimal places). The input is the nominal annual interest rate (e.g. 0.05 for 5%), and
/// the result is the per-second multiplier (e.g. 1.000000001585).
///
/// NOTE: This uses linear (nominal) decomposition — the per-second rate is simply `nominalRate / secondsPerYear`.
/// Because interest is then applied as `rate^timeElapsed` (exponential compounding), the effective APY will
/// exceed the stated nominal rate. Use `effectiveYearlyRate` to compute the true effective annual yield.
access(all) view fun perSecondInterestRate(nominalYearlyRate: UFix128): UFix128 {
/// point number with 18 decimal places). The input to this function is the relative nominal annual rate
/// (e.g. 0.05 for a 5% nominal yearly rate), and the result is the per-second multiplier
/// (e.g. 1.000000000001). For positive rates, the effective one-year growth will be slightly higher than the
/// nominal rate because interest compounds over time.
access(all) view fun perSecondInterestRate(yearlyRate: UFix128): UFix128 {
let perSecondScaledValue = nominalYearlyRate / 31_557_600.0 // 365.25 * 24.0 * 60.0 * 60.0
assert(
perSecondScaledValue < UFix128.max,
Expand Down
2 changes: 1 addition & 1 deletion cadence/tests/TEST_COVERAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ The `test_helpers.cdc` file provides:
3. **FLOW Debit Interest**
- KinkCurve-based interest rates
- Variable rates based on utilization
- Interest compounds continuously
- Interest compounds via discrete per-second updates

4. **FLOW Credit Interest**
- LP earnings with insurance spread
Expand Down
Loading