Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 2 additions & 2 deletions cadence/contracts/PMStrategiesV1.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ access(all) contract PMStrategiesV1 {
}

access(contract) fun removePendingRedeem(id: UInt64) {
self.pendingRedeems.remove(key: id)
let _removedRedeem = self.pendingRedeems.remove(key: id)
}

access(contract) view fun getPendingRedeem(id: UInt64): PendingRedeemInfo? {
Expand Down Expand Up @@ -897,7 +897,7 @@ access(all) contract PMStrategiesV1 {
}
let entry: auth(Remove) &AnyStruct = &self.metadata["claimOutcomes"]!
let outcomes = entry as! auth(Remove) &{UInt64: String}
outcomes.remove(key: yieldVaultID)
let _removedOutcome = outcomes.remove(key: yieldVaultID)
}

access(contract) view fun getClaimOutcome(yieldVaultID: UInt64): String? {
Expand Down
2 changes: 1 addition & 1 deletion cadence/contracts/mocks/EVM.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ contract EVM {
)
}

keyList.add(
let _keyIndex = keyList.add(
key.publicKey,
hashAlgorithm: key.hashAlgorithm,
// normalization factor. We need to divide by 1000 because the
Expand Down
20 changes: 10 additions & 10 deletions cadence/contracts/mocks/FlowTransactionScheduler.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ access(all) contract FlowTransactionScheduler {
access(all) fun remove(timestamp: UFix64) {
// Only remove if the timestamp is in the array
if let index = self.timestamps.firstIndex(of: timestamp) {
self.timestamps.remove(at: index)
let _removedTimestamp = self.timestamps.remove(at: index)
}
}

Expand Down Expand Up @@ -605,7 +605,7 @@ access(all) contract FlowTransactionScheduler {
/// txRemovalLimit) require explicit authorization from the contract administrator.
access(UpdateConfig) fun setConfig(newConfig: {SchedulerConfig}, txRemovalLimit: UInt) {
self.config = newConfig
FlowTransactionScheduler.account.storage.load<UInt>(from: /storage/txRemovalLimit)
let _oldLimit = FlowTransactionScheduler.account.storage.load<UInt>(from: /storage/txRemovalLimit)
FlowTransactionScheduler.account.storage.save(txRemovalLimit, to: /storage/txRemovalLimit)
emit ConfigUpdated()
}
Expand Down Expand Up @@ -1032,7 +1032,7 @@ access(all) contract FlowTransactionScheduler {
if let priorityQueue = transactionQueue[transactionPriority] {
priorityQueue[transactionID] = nil
if priorityQueue.keys.length == 0 {
transactionQueue.remove(key: transactionPriority)
let _removedPriorityQueue = transactionQueue.remove(key: transactionPriority)
} else {
transactionQueue[transactionPriority] = priorityQueue
}
Expand All @@ -1041,8 +1041,8 @@ access(all) contract FlowTransactionScheduler {

// if the slot is now empty remove it from the maps
if transactionQueue.keys.length == 0 {
self.slotQueue.remove(key: slot)
self.slotUsedEffort.remove(key: slot)
let _removedSlotQueue = self.slotQueue.remove(key: slot)
let _removedSlotEffort = self.slotUsedEffort.remove(key: slot)

self.sortedTimestamps.remove(timestamp: slot)
}
Expand Down Expand Up @@ -1154,7 +1154,7 @@ access(all) contract FlowTransactionScheduler {
// charge the full fee for transaction execution
destroy tx!.payAndRefundFees(refundMultiplier: 0.0)

self.removeTransaction(txData: tx!)
let _removedExpiredTx = self.removeTransaction(txData: tx!)
}
}
}
Expand Down Expand Up @@ -1243,7 +1243,7 @@ access(all) contract FlowTransactionScheduler {

// keep the array under the limit
if UInt(self.canceledTransactions.length) > self.config.canceledTransactionsLimit {
self.canceledTransactions.remove(at: 0)
let _removedOldestCanceled = self.canceledTransactions.remove(at: 0)
}

emit Canceled(
Expand All @@ -1255,8 +1255,8 @@ access(all) contract FlowTransactionScheduler {
transactionHandlerTypeIdentifier: tx.handlerTypeIdentifier
)

self.removeTransaction(txData: tx)
let _removedCanceledTx = self.removeTransaction(txData: tx)

return <-refundedFees
}

Expand Down Expand Up @@ -1436,7 +1436,7 @@ access(all) contract FlowTransactionScheduler {
let storageUsedBefore = self.account.storage.used
self.account.storage.save(data!, to: storagePath)
let storageUsedAfter = self.account.storage.used
self.account.storage.load<AnyStruct>(from: storagePath)
let _loadedData = self.account.storage.load<AnyStruct>(from: storagePath)

return FlowStorageFees.convertUInt64StorageBytesToUFix64Megabytes(storageUsedAfter.saturatingSubtract(storageUsedBefore))
}
Expand Down
6 changes: 3 additions & 3 deletions cadence/tests/atomic_registration_gc_test.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ access(all) fun setup() {
let reserveAmount = 100_000_00.0
setupMoetVault(protocolAccount, beFailed: false)
setupYieldVault(protocolAccount, beFailed: false)
mintFlow(to: protocolAccount, amount: reserveAmount)
let _mintedFlowReserve = mintFlow(to: protocolAccount, amount: reserveAmount)
mintMoet(signer: protocolAccount, to: protocolAccount.address, amount: reserveAmount, beFailed: false)
mintYield(signer: yieldTokenAccount, to: protocolAccount.address, amount: reserveAmount, beFailed: false)
setMockSwapperLiquidityConnector(signer: protocolAccount, vaultStoragePath: MOET.VaultStoragePath)
Expand Down Expand Up @@ -70,13 +70,13 @@ access(all) fun setup() {
// Scheduler contracts are deployed as part of deployContracts()

// Fund FlowYieldVaults account for scheduling fees (atomic initial scheduling)
mintFlow(to: flowYieldVaultsAccount, amount: 100.0)
let _mintedFlowFees = mintFlow(to: flowYieldVaultsAccount, amount: 100.0)
}

access(all) fun testAtomicRegistrationAndGC() {
let user = Test.createAccount()
let fundingAmount = 100.0
mintFlow(to: user, amount: fundingAmount)
let _mintedFlowUser = mintFlow(to: user, amount: fundingAmount)

// Grant Beta Access
let betaRef = grantBeta(flowYieldVaultsAccount, user)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fun test_CreateYieldVaultManagerValidatesBetaRef() {

let user = Test.createAccount()
transferFlow(signer: serviceAccount, recipient: user.address, amount: 1.0)
grantBeta(flowYieldVaultsAccount, user)
let _grantBetaResult = grantBeta(flowYieldVaultsAccount, user)

let txn = Test.Transaction(
code: Test.readFile("../transactions/test/create_yield_vault_manager_with_beta_cap.cdc"),
Expand Down
8 changes: 4 additions & 4 deletions cadence/tests/forked_rebalance_boundary_test.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ fun test_UpperBoundary() {
let user = Test.createAccount()
let fundingAmount = 1000.0

transferFlow(signer: whaleFlowAccount, recipient: user.address, amount: fundingAmount)
grantBeta(flowYieldVaultsAccount, user)
let _transferFlowResult = transferFlow(signer: whaleFlowAccount, recipient: user.address, amount: fundingAmount)
let _grantBetaResult = grantBeta(flowYieldVaultsAccount, user)

// Set vault to baseline 1:1 price
setVaultSharePrice(
Expand Down Expand Up @@ -425,8 +425,8 @@ fun test_LowerBoundary() {
let user = Test.createAccount()
let fundingAmount = 1000.0

transferFlow(signer: whaleFlowAccount, recipient: user.address, amount: fundingAmount)
grantBeta(flowYieldVaultsAccount, user)
let _transferFlowResult = transferFlow(signer: whaleFlowAccount, recipient: user.address, amount: fundingAmount)
let _grantBetaResult = grantBeta(flowYieldVaultsAccount, user)

setVaultSharePrice(
vaultAddress: morphoVaultAddress,
Expand Down
6 changes: 3 additions & 3 deletions cadence/tests/forked_rebalance_scenario1_test.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ fun test_ForkedRebalanceYieldVaultScenario1() {
}

// confirm user exists.
getBalance(address: user.address, vaultPublicPath: /public/flowTokenReceiver)!
transferFlow(signer: whaleFlowAccount, recipient: user.address, amount: fundingAmount)
grantBeta(flowYieldVaultsAccount, user)
let _userBalance = getBalance(address: user.address, vaultPublicPath: /public/flowTokenReceiver)!
let _transferFlowResult = transferFlow(signer: whaleFlowAccount, recipient: user.address, amount: fundingAmount)
let _grantBetaResult = grantBeta(flowYieldVaultsAccount, user)

// Set vault to baseline 1:1 price
setVaultSharePrice(
Expand Down
4 changes: 2 additions & 2 deletions cadence/tests/forked_rebalance_scenario2_test.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@ fun test_RebalanceYieldVaultScenario2() {

// Likely 0.0
let _flowBalanceBefore = getBalance(address: user.address, vaultPublicPath: /public/flowTokenReceiver)!
transferFlow(signer: whaleFlowAccount, recipient: user.address, amount: fundingAmount)
grantBeta(flowYieldVaultsAccount, user)
let _transferFlowResult = transferFlow(signer: whaleFlowAccount, recipient: user.address, amount: fundingAmount)
let _grantBetaResult = grantBeta(flowYieldVaultsAccount, user)

// Set vault to baseline 1:1 price
setVaultSharePrice(
Expand Down
4 changes: 2 additions & 2 deletions cadence/tests/forked_rebalance_scenario3a_test.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ fun test_RebalanceYieldVaultScenario3A() {
// Likely 0.0
let flowBalanceBefore = getBalance(address: user.address, vaultPublicPath: /public/flowTokenReceiver)!
log("[TEST] flow balance before \(flowBalanceBefore)")
transferFlow(signer: whaleFlowAccount, recipient: user.address, amount: fundingAmount)
grantBeta(flowYieldVaultsAccount, user)
let _transferFlowResult = transferFlow(signer: whaleFlowAccount, recipient: user.address, amount: fundingAmount)
let _grantBetaResult = grantBeta(flowYieldVaultsAccount, user)

// Set vault to baseline 1:1 price
// Use 1 billion (1e9) as base - large enough to prevent slippage, safe from UFix64 overflow
Expand Down
4 changes: 2 additions & 2 deletions cadence/tests/forked_rebalance_scenario3b_test.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ fun test_RebalanceYieldVaultScenario3B() {
// Likely 0.0
let flowBalanceBefore = getBalance(address: user.address, vaultPublicPath: /public/flowTokenReceiver)!
log("[TEST] flow balance before \(flowBalanceBefore)")
transferFlow(signer: whaleFlowAccount, recipient: user.address, amount: fundingAmount)
grantBeta(flowYieldVaultsAccount, user)
let _transferFlowResult = transferFlow(signer: whaleFlowAccount, recipient: user.address, amount: fundingAmount)
let _grantBetaResult = grantBeta(flowYieldVaultsAccount, user)

// Set vault to baseline 1:1 price
setVaultSharePrice(
Expand Down
4 changes: 2 additions & 2 deletions cadence/tests/forked_rebalance_scenario3c_test.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ fun test_ForkedRebalanceYieldVaultScenario3C() {

// Likely 0.0
let _flowBalanceBefore = getBalance(address: user.address, vaultPublicPath: /public/flowTokenReceiver)!
transferFlow(signer: whaleFlowAccount, recipient: user.address, amount: fundingAmount)
grantBeta(flowYieldVaultsAccount, user)
let _transferFlowResult = transferFlow(signer: whaleFlowAccount, recipient: user.address, amount: fundingAmount)
let _grantBetaResult = grantBeta(flowYieldVaultsAccount, user)

// Set vault to baseline 1:1 price
setVaultSharePrice(
Expand Down
4 changes: 2 additions & 2 deletions cadence/tests/forked_rebalance_scenario3d_test.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ fun test_ForkedRebalanceYieldVaultScenario3D() {

// Likely 0.0
let _flowBalanceBefore = getBalance(address: user.address, vaultPublicPath: /public/flowTokenReceiver)!
transferFlow(signer: whaleFlowAccount, recipient: user.address, amount: fundingAmount)
grantBeta(flowYieldVaultsAccount, user)
let _transferFlowResult = transferFlow(signer: whaleFlowAccount, recipient: user.address, amount: fundingAmount)
let _grantBetaResult = grantBeta(flowYieldVaultsAccount, user)

// Set vault to baseline 1:1 price
setVaultSharePrice(
Expand Down
8 changes: 4 additions & 4 deletions cadence/tests/forked_rebalance_scenario4_test.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ fun test_RebalanceLowCollateralHighYieldPrices() {
let yieldPriceIncrease = 1500.0 // YT: $1000.0 → $1500.0

let user = Test.createAccount()
transferFlow(signer: whaleFlowAccount, recipient: user.address, amount: fundingAmount)
grantBeta(flowYieldVaultsAccount, user)
let _transferFlowResult = transferFlow(signer: whaleFlowAccount, recipient: user.address, amount: fundingAmount)
let _grantBetaResult = grantBeta(flowYieldVaultsAccount, user)

createYieldVault(
signer: user,
Expand Down Expand Up @@ -345,8 +345,8 @@ fun test_RebalanceHighCollateralLowYieldPrices() {
let yieldPriceIncrease = 1.5 // YT: $1.0 → $1.5

let user = Test.createAccount()
transferFlow(signer: whaleFlowAccount, recipient: user.address, amount: fundingAmount)
grantBeta(flowYieldVaultsAccount, user)
let _transferFlowResult = transferFlow(signer: whaleFlowAccount, recipient: user.address, amount: fundingAmount)
let _grantBetaResult = grantBeta(flowYieldVaultsAccount, user)

createYieldVault(
signer: user,
Expand Down
4 changes: 2 additions & 2 deletions cadence/tests/grant_beta_cleanup_test.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ fun test_ReGrantBetaRevokesPreviousCapability() {
let user = Test.createAccount()
transferFlow(signer: serviceAccount, recipient: user.address, amount: 1.0)

grantBeta(flowYieldVaultsAccount, user)
let _grantedBetaFirst = grantBeta(flowYieldVaultsAccount, user)

let backupRes = _executeTransaction("../transactions/test/backup_beta_cap.cdc", [], user)
Test.expect(backupRes, Test.beSucceeded())

// Re-granting should revoke the previously issued controller (and thus all old capability copies).
grantBeta(flowYieldVaultsAccount, user)
let _grantedBetaSecond = grantBeta(flowYieldVaultsAccount, user)

// Event assertions: the re-grant should emit BetaRevoked for the *previous* capID, then a fresh BetaGranted.
let grantedAny = Test.eventsOfType(Type<FlowYieldVaultsClosedBeta.BetaGranted>())
Expand Down
8 changes: 4 additions & 4 deletions cadence/tests/rebalance_scenario1_test.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fun setup() {
let reserveAmount = 100_000_00.0
setupMoetVault(protocolAccount, beFailed: false)
setupYieldVault(protocolAccount, beFailed: false)
mintFlow(to: protocolAccount, amount: reserveAmount)
let _mintedFlowReserve = mintFlow(to: protocolAccount, amount: reserveAmount)
mintMoet(signer: protocolAccount, to: protocolAccount.address, amount: reserveAmount, beFailed: false)
mintYield(signer: yieldTokenAccount, to: protocolAccount.address, amount: reserveAmount, beFailed: false)
setMockSwapperLiquidityConnector(signer: protocolAccount, vaultStoragePath: MOET.VaultStoragePath)
Expand Down Expand Up @@ -73,7 +73,7 @@ fun setup() {
)

// Fund FlowYieldVaults account for scheduling fees (atomic initial scheduling)
mintFlow(to: flowYieldVaultsAccount, amount: 100.0)
let _mintedFlowFees = mintFlow(to: flowYieldVaultsAccount, amount: 100.0)

snapshot = getCurrentBlockHeight()
}
Expand Down Expand Up @@ -103,8 +103,8 @@ fun test_RebalanceYieldVaultScenario1() {

// Likely 0.0
let _flowBalanceBefore = getBalance(address: user.address, vaultPublicPath: /public/flowTokenReceiver)!
mintFlow(to: user, amount: fundingAmount)
grantBeta(flowYieldVaultsAccount, user)
let _mintedFlowUser = mintFlow(to: user, amount: fundingAmount)
let _grantBetaResult = grantBeta(flowYieldVaultsAccount, user)

createYieldVault(
signer: user,
Expand Down
8 changes: 4 additions & 4 deletions cadence/tests/rebalance_scenario2_test.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ fun setup() {
let reserveAmount = 100_000_00.0
setupMoetVault(protocolAccount, beFailed: false)
setupYieldVault(protocolAccount, beFailed: false)
mintFlow(to: protocolAccount, amount: reserveAmount)
let _mintedFlowReserve = mintFlow(to: protocolAccount, amount: reserveAmount)
mintMoet(signer: protocolAccount, to: protocolAccount.address, amount: reserveAmount, beFailed: false)
mintYield(signer: yieldTokenAccount, to: protocolAccount.address, amount: reserveAmount, beFailed: false)
setMockSwapperLiquidityConnector(signer: protocolAccount, vaultStoragePath: MOET.VaultStoragePath)
Expand Down Expand Up @@ -142,7 +142,7 @@ fun setup() {
)

// Fund FlowYieldVaults account for scheduling fees (atomic initial scheduling)
mintFlow(to: flowYieldVaultsAccount, amount: 100.0)
let _mintedFlowFees = mintFlow(to: flowYieldVaultsAccount, amount: 100.0)

snapshot = getCurrentBlockHeight()
}
Expand All @@ -167,8 +167,8 @@ fun test_RebalanceYieldVaultScenario2() {

// Likely 0.0
let flowBalanceBefore = getBalance(address: user.address, vaultPublicPath: /public/flowTokenReceiver)!
mintFlow(to: user, amount: fundingAmount)
grantBeta(flowYieldVaultsAccount, user)
let _mintedFlowUser = mintFlow(to: user, amount: fundingAmount)
let _grantBetaResult = grantBeta(flowYieldVaultsAccount, user)

createYieldVault(
signer: user,
Expand Down
8 changes: 4 additions & 4 deletions cadence/tests/rebalance_scenario3a_test.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fun setup() {
let reserveAmount = 100_000_00.0
setupMoetVault(protocolAccount, beFailed: false)
setupYieldVault(protocolAccount, beFailed: false)
mintFlow(to: protocolAccount, amount: reserveAmount)
let _mintedFlowReserve = mintFlow(to: protocolAccount, amount: reserveAmount)
mintMoet(signer: protocolAccount, to: protocolAccount.address, amount: reserveAmount, beFailed: false)
mintYield(signer: yieldTokenAccount, to: protocolAccount.address, amount: reserveAmount, beFailed: false)
setMockSwapperLiquidityConnector(signer: protocolAccount, vaultStoragePath: MOET.VaultStoragePath)
Expand Down Expand Up @@ -74,7 +74,7 @@ fun setup() {
)

// Fund FlowYieldVaults account for scheduling fees (atomic initial scheduling)
mintFlow(to: flowYieldVaultsAccount, amount: 100.0)
let _mintedFlowFees = mintFlow(to: flowYieldVaultsAccount, amount: 100.0)

snapshot = getCurrentBlockHeight()
}
Expand All @@ -96,8 +96,8 @@ fun test_RebalanceYieldVaultScenario3A() {
// Likely 0.0
let flowBalanceBefore = getBalance(address: user.address, vaultPublicPath: /public/flowTokenReceiver)!
log("[TEST] flow balance before \(flowBalanceBefore)")
mintFlow(to: user, amount: fundingAmount)
grantBeta(flowYieldVaultsAccount, user)
let _mintedFlowUser = mintFlow(to: user, amount: fundingAmount)
let _grantBetaResult = grantBeta(flowYieldVaultsAccount, user)

createYieldVault(
signer: user,
Expand Down
8 changes: 4 additions & 4 deletions cadence/tests/rebalance_scenario3b_test.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fun setup() {
let reserveAmount = 100_000_00.0
setupMoetVault(protocolAccount, beFailed: false)
setupYieldVault(protocolAccount, beFailed: false)
mintFlow(to: protocolAccount, amount: reserveAmount)
let _mintedFlowReserve = mintFlow(to: protocolAccount, amount: reserveAmount)
mintMoet(signer: protocolAccount, to: protocolAccount.address, amount: reserveAmount, beFailed: false)
mintYield(signer: yieldTokenAccount, to: protocolAccount.address, amount: reserveAmount, beFailed: false)
setMockSwapperLiquidityConnector(signer: protocolAccount, vaultStoragePath: MOET.VaultStoragePath)
Expand Down Expand Up @@ -74,7 +74,7 @@ fun setup() {
)

// Fund FlowYieldVaults account for scheduling fees (atomic initial scheduling)
mintFlow(to: flowYieldVaultsAccount, amount: 100.0)
let _mintedFlowFees = mintFlow(to: flowYieldVaultsAccount, amount: 100.0)

snapshot = getCurrentBlockHeight()
}
Expand All @@ -96,8 +96,8 @@ fun test_RebalanceYieldVaultScenario3B() {
// Likely 0.0
let flowBalanceBefore = getBalance(address: user.address, vaultPublicPath: /public/flowTokenReceiver)!
log("[TEST] flow balance before \(flowBalanceBefore)")
mintFlow(to: user, amount: fundingAmount)
grantBeta(flowYieldVaultsAccount, user)
let _mintedFlowUser = mintFlow(to: user, amount: fundingAmount)
let _grantBetaResult = grantBeta(flowYieldVaultsAccount, user)

createYieldVault(
signer: user,
Expand Down
Loading
Loading