Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
21 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
d1ff732
Merge branch 'main' into taras/147-multi-position-per-user-scenarios-…
mts1715 Mar 10, 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
9 changes: 9 additions & 0 deletions cadence/scripts/flow-alp/get_oracle_price.cdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import "MockOracle"

access(all) fun main(tokenIdentifier: String): UFix64? {
let tokenType = CompositeType(tokenIdentifier)
?? panic("Invalid token identifier: ".concat(tokenIdentifier))

let oracle = MockOracle.PriceOracle()
return oracle.price(ofToken: tokenType)
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ fun testRecursiveWithdrawSource() {

let initialDeposit1 = 10000.0
createPosition(
admin: PROTOCOL_ACCOUNT,
signer: user1,
amount: initialDeposit1,
vaultStoragePath: /storage/flowTokenVault,
Expand Down
2 changes: 1 addition & 1 deletion cadence/tests/adversarial_type_spoofing_test.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fun setup() {
setupMoetVault(hackerAccount, beFailed: false)

// provide liquidity to the pool we can extract
createPosition(signer: liquidityAccount, amount: 10000.0, vaultStoragePath: flowVaultStoragePath, pushToDrawDownSink: false)
createPosition(admin: PROTOCOL_ACCOUNT, signer: liquidityAccount, amount: 10000.0, vaultStoragePath: flowVaultStoragePath, pushToDrawDownSink: false)
}

access(all)
Expand Down
2 changes: 1 addition & 1 deletion cadence/tests/async_update_position_test.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fun testUpdatePosition() {
setupMoetVault(user, beFailed: false)
mintFlow(to: user, amount: 1_000.0)

createPosition(signer: user, amount: 100.0, vaultStoragePath: FLOW_VAULT_STORAGE_PATH, pushToDrawDownSink: false)
createPosition(admin: PROTOCOL_ACCOUNT, signer: user, amount: 100.0, vaultStoragePath: FLOW_VAULT_STORAGE_PATH, pushToDrawDownSink: false)

// increase price
setMockOraclePrice(signer: PROTOCOL_ACCOUNT, forTokenIdentifier: FLOW_TOKEN_IDENTIFIER, price: initialPrice * priceIncreaseFactor)
Expand Down
12 changes: 6 additions & 6 deletions cadence/tests/deposit_capacity_test.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ fun test_deposit_capacity_consumption() {
let capacityBeforePositionCreation = capacityInfo["depositCapacity"]!
let initialDepositAmount = 100.0

createPosition(signer: user, amount: initialDepositAmount, vaultStoragePath: MOET.VaultStoragePath, pushToDrawDownSink: false)
createPosition(admin: PROTOCOL_ACCOUNT, signer: user, amount: initialDepositAmount, vaultStoragePath: MOET.VaultStoragePath, pushToDrawDownSink: false)

// Get capacity right after position creation - should have decreased by initialDepositAmount
capacityInfo = getDepositCapacityInfo(vaultIdentifier: MOET_TOKEN_IDENTIFIER)
Expand Down Expand Up @@ -118,7 +118,7 @@ fun test_per_user_deposit_limits() {
mintMoet(signer: PROTOCOL_ACCOUNT, to: user1.address, amount: 10000.0, beFailed: false)

let initialDeposit1 = 100.0
createPosition(signer: user1, amount: initialDeposit1, vaultStoragePath: MOET.VaultStoragePath, pushToDrawDownSink: false)
createPosition(admin: PROTOCOL_ACCOUNT, signer: user1, amount: initialDeposit1, vaultStoragePath: MOET.VaultStoragePath, pushToDrawDownSink: false)
// After position creation: usage = 100 (out of 500 limit)

// User 1 deposits more (should be accepted up to limit)
Expand All @@ -140,7 +140,7 @@ fun test_per_user_deposit_limits() {
mintMoet(signer: PROTOCOL_ACCOUNT, to: user2.address, amount: 10000.0, beFailed: false)

let initialDeposit2 = 100.0
createPosition(signer: user2, amount: initialDeposit2, vaultStoragePath: MOET.VaultStoragePath, pushToDrawDownSink: false)
createPosition(admin: PROTOCOL_ACCOUNT, signer: user2, amount: initialDeposit2, vaultStoragePath: MOET.VaultStoragePath, pushToDrawDownSink: false)
// After position creation: usage = 100 (out of 500 limit)

// User 2 should be able to deposit up to their own limit (500 total, so 400 more)
Expand Down Expand Up @@ -197,7 +197,7 @@ fun test_capacity_regeneration() {
let capacityBeforePositionCreation = capacityInfo["depositCapacity"]!
let initialDepositAmount = 100.0

createPosition(signer: user, amount: initialDepositAmount, vaultStoragePath: MOET.VaultStoragePath, pushToDrawDownSink: false)
createPosition(admin: PROTOCOL_ACCOUNT, signer: user, amount: initialDepositAmount, vaultStoragePath: MOET.VaultStoragePath, pushToDrawDownSink: false)

// Get capacity right after position creation (no regeneration should occur)
capacityInfo = getDepositCapacityInfo(vaultIdentifier: MOET_TOKEN_IDENTIFIER)
Expand Down Expand Up @@ -275,7 +275,7 @@ fun test_user_usage_reset_on_regeneration() {
mintMoet(signer: PROTOCOL_ACCOUNT, to: user.address, amount: 10000.0, beFailed: false)

let initialDepositAmount = 100.0
createPosition(signer: user, amount: initialDepositAmount, vaultStoragePath: MOET.VaultStoragePath, pushToDrawDownSink: false)
createPosition(admin: PROTOCOL_ACCOUNT, signer: user, amount: initialDepositAmount, vaultStoragePath: MOET.VaultStoragePath, pushToDrawDownSink: false)
// After position creation: usage = 100 (out of 500 limit)

// User deposits more to reach their limit (500 total, so 400 more)
Expand Down Expand Up @@ -346,7 +346,7 @@ fun test_multiple_hours_regeneration() {
mintMoet(signer: PROTOCOL_ACCOUNT, to: user.address, amount: 1000.0, beFailed: false)

let initialDepositAmount = 100.0
createPosition(signer: user, amount: initialDepositAmount, vaultStoragePath: MOET.VaultStoragePath, pushToDrawDownSink: false)
createPosition(admin: PROTOCOL_ACCOUNT, signer: user, amount: initialDepositAmount, vaultStoragePath: MOET.VaultStoragePath, pushToDrawDownSink: false)
// The initial deposit consumes capacity, but we're checking the cap regeneration, not capacity

// Make a small deposit to trigger regeneration
Expand Down
Loading
Loading