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
13 changes: 13 additions & 0 deletions cadence/contracts/FlowYieldVaultsAutoBalancers.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,19 @@ access(all) contract FlowYieldVaultsAutoBalancers {
return nil
}

/// Creates a sink to an AutoBalancer for external deposits (e.g., cancel deferred redemption).
///
/// @param id: The yield vault/AutoBalancer ID
/// @return Sink that can deposit to the AutoBalancer, or nil if not found
///
access(account) fun createExternalSink(id: UInt64): {DeFiActions.Sink}? {
let storagePath = self.deriveAutoBalancerPath(id: id, storage: true) as! StoragePath
if let autoBalancer = self.account.storage.borrow<auth(DeFiActions.Get) &DeFiActions.AutoBalancer>(from: storagePath) {
return autoBalancer.createBalancerSink()
}
return nil
}

/// Checks if an AutoBalancer has at least one active (Scheduled) transaction.
/// Used by Supervisor to detect stuck yield vaults that need recovery.
///
Expand Down
661 changes: 634 additions & 27 deletions cadence/contracts/PMStrategiesV1.cdc

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions cadence/tests/PMStrategiesV1_FUSDEV_test.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ access(all) fun setup() {
)
Test.expect(err, Test.beNil())

log("Deploying FlowYieldVaultsAutoBalancers...")
err = Test.deployContract(
name: "FlowYieldVaultsAutoBalancers",
path: "../../cadence/contracts/FlowYieldVaultsAutoBalancers.cdc",
arguments: []
)
Test.expect(err, Test.beNil())

// Redeploy PMStrategiesV1 with latest local code to override mainnet version
log("Deploying PMStrategiesV1...")
err = Test.deployContract(
Expand Down
Loading
Loading