Skip to content

Commit 53c05b6

Browse files
committed
Update fork tests to PYUSD0 at height 147316310, deploy local contracts
1 parent 6bc7274 commit 53c05b6

15 files changed

Lines changed: 557 additions & 720 deletions

cadence/tests/btc_daily_2025_helpers.cdc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -807,12 +807,12 @@ access(all) let btc_daily_2025_agents: [SimAgent] = [
807807
]
808808

809809
access(all) let btc_daily_2025_pools: {String: SimPool} = {
810-
"moet_yt": SimPool(
810+
"pyusd0_yt": SimPool(
811811
size: 500000.00000000,
812812
concentration: 0.95000000,
813813
feeTier: 0.00050000
814814
),
815-
"moet_btc": SimPool(
815+
"pyusd0_btc": SimPool(
816816
size: 5000000.00000000,
817817
concentration: 0.80000000,
818818
feeTier: 0.00300000
@@ -822,7 +822,7 @@ access(all) let btc_daily_2025_pools: {String: SimPool} = {
822822
concentration: 0.80000000,
823823
feeTier: 0.00300000
824824
),
825-
"moet_fusdev": SimPool(
825+
"pyusd0_fusdev": SimPool(
826826
size: 500000.00000000,
827827
concentration: 0.95000000,
828828
feeTier: 0.00010000

cadence/tests/evm_state_helpers_test.cdc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Tests that EVM state helpers correctly set Uniswap V3 pool price and ERC4626 vault price
2-
#test_fork(network: "mainnet-fork", height: 143292255)
2+
#test_fork(network: "mainnet-fork", height: 147308555)
33

44
import Test
55
import BlockchainHelpers

cadence/tests/forked_rebalance_boundary_test.cdc

Lines changed: 103 additions & 123 deletions
Large diffs are not rendered by default.

cadence/tests/forked_rebalance_scenario1_test.cdc

Lines changed: 15 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Simulation spreadsheet: https://docs.google.com/spreadsheets/d/11DCzwZjz5K-78aKEWxt9NI-ut5LtkSyOT0TnRPUG7qY/edit?pli=1&gid=539924856#gid=539924856
22

3-
#test_fork(network: "mainnet-fork", height: 143292255)
3+
#test_fork(network: "mainnet-fork", height: 147316310)
44

55
import Test
66
import BlockchainHelpers
@@ -12,7 +12,6 @@ import "evm_state_helpers.cdc"
1212
import "FlowYieldVaults"
1313
// other
1414
import "FlowToken"
15-
import "MOET"
1615
import "FlowYieldVaultsStrategiesV2"
1716
import "FlowALPv0"
1817

@@ -28,7 +27,6 @@ access(all) let coaOwnerAccount = Test.getAccount(0xe467b9dd11fa00df)
2827

2928
access(all) var strategyIdentifier = Type<@FlowYieldVaultsStrategiesV2.FUSDEVStrategy>().identifier
3029
access(all) var flowTokenIdentifier = Type<@FlowToken.Vault>().identifier
31-
access(all) var moetTokenIdentifier = Type<@MOET.Vault>().identifier
3230

3331
// ============================================================================
3432
// PROTOCOL ADDRESSES
@@ -48,9 +46,6 @@ access(all) let morphoVaultAddress = "0xd069d989e2F44B70c65347d1853C0c67e10a9F8D
4846
// PYUSD0 - Stablecoin (FUSDEV's underlying asset)
4947
access(all) let pyusd0Address = "0x99aF3EeA856556646C98c8B9b2548Fe815240750"
5048

51-
// MOET - Flow ALP USD
52-
access(all) let moetAddress = "0x213979bB8A9A86966999b3AA797C1fcf3B967ae2"
53-
5449
// WFLOW - Wrapped Flow
5550
access(all) let wflowAddress = "0xd3bF53DAC106A0290B0483EcBC89d40FcC961f3e"
5651

@@ -59,7 +54,6 @@ access(all) let wflowAddress = "0xd3bF53DAC106A0290B0483EcBC89d40FcC961f3e"
5954
// ============================================================================
6055

6156
// Token balanceOf mapping slots (for EVM.store to manipulate balances)
62-
access(all) let moetBalanceSlot = 0 as UInt256
6357
access(all) let pyusd0BalanceSlot = 1 as UInt256
6458
access(all) let fusdevBalanceSlot = 12 as UInt256
6559
access(all) let wflowBalanceSlot = 3 as UInt256
@@ -98,38 +92,16 @@ fun setup() {
9892
signer: coaOwnerAccount
9993
)
10094

101-
setPoolToPrice(
102-
factoryAddress: factoryAddress,
103-
tokenAAddress: moetAddress,
104-
tokenBAddress: morphoVaultAddress,
105-
fee: 100,
106-
priceTokenBPerTokenA: feeAdjustedPrice(1.0, fee: 100, reverse: false),
107-
tokenABalanceSlot: moetBalanceSlot,
108-
tokenBBalanceSlot: fusdevBalanceSlot,
109-
signer: coaOwnerAccount
110-
)
111-
112-
setPoolToPrice(
113-
factoryAddress: factoryAddress,
114-
tokenAAddress: moetAddress,
115-
tokenBAddress: pyusd0Address,
116-
fee: 100,
117-
priceTokenBPerTokenA: feeAdjustedPrice(1.0, fee: 100, reverse: false),
118-
tokenABalanceSlot: moetBalanceSlot,
119-
tokenBBalanceSlot: pyusd0BalanceSlot,
120-
signer: coaOwnerAccount
121-
)
122-
123-
// BandOracle is only used for FLOW price for FlowALP collateral
95+
// BandOracle prices: FLOW for collateral, PYUSD for PYUSD0 debt token, USD for quote
12496
let symbolPrices: {String: UFix64} = {
12597
"FLOW": 1.0,
126-
"USD": 1.0
98+
"USD": 1.0,
99+
"PYUSD": 1.0
127100
}
128101
setBandOraclePrices(signer: bandOracleAccount, symbolPrices: symbolPrices)
129102

130103
let reserveAmount = 100_000_00.0
131104
transferFlow(signer: whaleFlowAccount, recipient: flowALPAccount.address, amount: reserveAmount)
132-
mintMoet(signer: flowALPAccount, to: flowALPAccount.address, amount: reserveAmount, beFailed: false)
133105

134106
// Fund FlowYieldVaults account for scheduling fees (atomic initial scheduling)
135107
transferFlow(signer: whaleFlowAccount, recipient: flowYieldVaultsAccount.address, amount: 100.0)
@@ -147,7 +119,7 @@ fun test_ForkedRebalanceYieldVaultScenario1() {
147119
// SCENARIO 1: FLOW price changes, Position rebalances to maintain Health = 1.3
148120
// ===================================================================================
149121
//
150-
// Initial: Collateral=1000 FLOW, Debt=$615.38, YIELD=615.38, Health=1.3
122+
// Initial: Collateral=1000 FLOW, Debt=615.38 PYUSD0, YIELD=615.38 FUSDEV, Health=1.3
151123
// Health = (1000 × FLOW_Price × 0.8) / 615.38
152124
//
153125
// Thresholds: minHealth=1.1, targetHealth=1.3, maxHealth=1.5
@@ -217,6 +189,9 @@ fun test_ForkedRebalanceYieldVaultScenario1() {
217189
signer: user
218190
)
219191

192+
// Refresh oracle prices to avoid stale timestamp (time advances between setup and here)
193+
setBandOraclePrices(signer: bandOracleAccount, symbolPrices: { "FLOW": 1.0, "USD": 1.0, "PYUSD": 1.0 })
194+
220195
createYieldVault(
221196
signer: user,
222197
strategyIdentifier: strategyIdentifier,
@@ -253,7 +228,8 @@ fun test_ForkedRebalanceYieldVaultScenario1() {
253228
// === FLOW PRICE CHANGES ===
254229
setBandOraclePrices(signer: bandOracleAccount, symbolPrices: {
255230
"FLOW": flowPrice,
256-
"USD": 1.0
231+
"USD": 1.0,
232+
"PYUSD": 1.0
257233
})
258234

259235
// Update WFLOW/PYUSD0 pool to match new Flow price
@@ -270,16 +246,16 @@ fun test_ForkedRebalanceYieldVaultScenario1() {
270246
signer: coaOwnerAccount
271247
)
272248

273-
// MOET/FUSDEV pool: fee adjustment direction depends on rebalance type
274-
// Surplus (flowPrice > 1.0): swaps MOET→FUSDEV (forward)
275-
// Deficit (flowPrice < 1.0): swaps FUSDEV→MOET (reverse)
249+
// PYUSD0/FUSDEV pool: fee adjustment direction depends on rebalance type
250+
// Surplus (flowPrice > 1.0): swaps PYUSD0→FUSDEV (forward)
251+
// Deficit (flowPrice < 1.0): swaps FUSDEV→PYUSD0 (reverse)
276252
setPoolToPrice(
277253
factoryAddress: factoryAddress,
278-
tokenAAddress: moetAddress,
254+
tokenAAddress: pyusd0Address,
279255
tokenBAddress: morphoVaultAddress,
280256
fee: 100,
281257
priceTokenBPerTokenA: feeAdjustedPrice(1.0, fee: 100, reverse: flowPrice < 1.0),
282-
tokenABalanceSlot: moetBalanceSlot,
258+
tokenABalanceSlot: pyusd0BalanceSlot,
283259
tokenBBalanceSlot: fusdevBalanceSlot,
284260
signer: coaOwnerAccount
285261
)

0 commit comments

Comments
 (0)