From 1ee75d2d0d955338e3eeaa839fccc41d7498ed8e Mon Sep 17 00:00:00 2001 From: loic1 <17323063+loic1@users.noreply.github.com> Date: Tue, 6 Jan 2026 18:50:49 -0500 Subject: [PATCH 1/4] add strategy type and owner to events --- cadence/contracts/FlowYieldVaults.cdc | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/cadence/contracts/FlowYieldVaults.cdc b/cadence/contracts/FlowYieldVaults.cdc index cb20b196..255c4969 100644 --- a/cadence/contracts/FlowYieldVaults.cdc +++ b/cadence/contracts/FlowYieldVaults.cdc @@ -25,10 +25,10 @@ access(all) contract FlowYieldVaults { /* --- EVENTS --- */ access(all) event CreatedYieldVault(id: UInt64, uuid: UInt64, strategyType: String, tokenType: String, initialAmount: UFix64, creator: Address?) - access(all) event DepositedToYieldVault(id: UInt64, tokenType: String, amount: UFix64, owner: Address?, fromUUID: UInt64) - access(all) event WithdrawnFromYieldVault(id: UInt64, tokenType: String, amount: UFix64, owner: Address?, toUUID: UInt64) - access(all) event AddedToManager(id: UInt64, owner: Address?, managerUUID: UInt64, tokenType: String) - access(all) event BurnedYieldVault(id: UInt64, strategyType: String, tokenType: String, remainingBalance: UFix64) + access(all) event DepositedToYieldVault(id: UInt64, strategyType: String, tokenType: String, amount: UFix64, owner: Address?, fromUUID: UInt64) + access(all) event WithdrawnFromYieldVault(id: UInt64, strategyType: String, tokenType: String, amount: UFix64, owner: Address?, toUUID: UInt64) + access(all) event AddedToManager(id: UInt64, strategyType: String, owner: Address?, managerUUID: UInt64, tokenType: String) + access(all) event BurnedYieldVault(id: UInt64, strategyType: String, tokenType: String, remainingBalance: UFix64, owner: Address?) /* --- CONSTRUCTS --- */ @@ -222,13 +222,18 @@ access(all) contract FlowYieldVaults { access(all) fun getYieldVaultBalance(): UFix64 { return self._borrowStrategy().availableBalance(ofToken: self.vaultType) } + /// Returns the strategy type identifier for this YieldVault + access(all) view fun getStrategyType(): String { + return self.strategy.getType().identifier + } /// Burner.Burnable conformance - emits the BurnedYieldVault event when burned access(contract) fun burnCallback() { emit BurnedYieldVault( id: self.uniqueID.id, - strategyType: self.strategy.getType().identifier, + strategyType: self.getStrategyType(), tokenType: self.getType().identifier, - remainingBalance: self.getYieldVaultBalance() + remainingBalance: self.getYieldVaultBalance(), + owner: self.owner?.address ) let _strategy <- self.strategy <- nil // Force unwrap to ensure burnCallback is called on the Strategy @@ -249,7 +254,7 @@ access(all) contract FlowYieldVaults { "Deposited vault of type \(from.getType().identifier) is not supported by this YieldVault" } let amount = from.balance - emit DepositedToYieldVault(id: self.uniqueID.id, tokenType: from.getType().identifier, amount: from.balance, owner: self.owner?.address, fromUUID: from.uuid) + emit DepositedToYieldVault(id: self.uniqueID.id, strategyType: self.getStrategyType(), tokenType: from.getType().identifier, amount: from.balance, owner: self.owner?.address, fromUUID: from.uuid) self._borrowStrategy().deposit(from: &from as auth(FungibleToken.Withdraw) &{FungibleToken.Vault}) assert( from.balance == 0.0, @@ -279,7 +284,7 @@ access(all) contract FlowYieldVaults { let res <- self._borrowStrategy().withdraw(maxAmount: amount, ofToken: self.vaultType) - emit WithdrawnFromYieldVault(id: self.uniqueID.id, tokenType: res.getType().identifier, amount: amount, owner: self.owner?.address, toUUID: res.uuid) + emit WithdrawnFromYieldVault(id: self.uniqueID.id, strategyType: self.getStrategyType(), tokenType: res.getType().identifier, amount: amount, owner: self.owner?.address, toUUID: res.uuid) return <- res } @@ -358,7 +363,7 @@ access(all) contract FlowYieldVaults { FlowYieldVaultsClosedBeta.validateBeta(self.owner?.address!, betaRef): "Invalid Beta Ref" } - emit AddedToManager(id: yieldVault.uniqueID.id, owner: self.owner?.address, managerUUID: self.uuid, tokenType: yieldVault.getType().identifier) + emit AddedToManager(id: yieldVault.uniqueID.id, strategyType: yieldVault.getStrategyType(), owner: self.owner?.address, managerUUID: self.uuid, tokenType: yieldVault.getType().identifier) self.yieldVaults[yieldVault.uniqueID.id] <-! yieldVault } /// Deposits additional funds to the specified YieldVault, reverting if none exists with the provided ID From 41bc5e7fc69d4482b920e378045ae4db1f2b9de2 Mon Sep 17 00:00:00 2001 From: loic1 <17323063+loic1@users.noreply.github.com> Date: Tue, 6 Jan 2026 19:46:52 -0500 Subject: [PATCH 2/4] improve formatting --- cadence/contracts/FlowYieldVaults.cdc | 69 +++++++++++++++++++++++---- 1 file changed, 61 insertions(+), 8 deletions(-) diff --git a/cadence/contracts/FlowYieldVaults.cdc b/cadence/contracts/FlowYieldVaults.cdc index 255c4969..6ba4844b 100644 --- a/cadence/contracts/FlowYieldVaults.cdc +++ b/cadence/contracts/FlowYieldVaults.cdc @@ -24,11 +24,44 @@ access(all) contract FlowYieldVaults { /* --- EVENTS --- */ - access(all) event CreatedYieldVault(id: UInt64, uuid: UInt64, strategyType: String, tokenType: String, initialAmount: UFix64, creator: Address?) - access(all) event DepositedToYieldVault(id: UInt64, strategyType: String, tokenType: String, amount: UFix64, owner: Address?, fromUUID: UInt64) - access(all) event WithdrawnFromYieldVault(id: UInt64, strategyType: String, tokenType: String, amount: UFix64, owner: Address?, toUUID: UInt64) - access(all) event AddedToManager(id: UInt64, strategyType: String, owner: Address?, managerUUID: UInt64, tokenType: String) - access(all) event BurnedYieldVault(id: UInt64, strategyType: String, tokenType: String, remainingBalance: UFix64, owner: Address?) + access(all) event CreatedYieldVault( + id: UInt64, + uuid: UInt64, + strategyType: String, + tokenType: String, + initialAmount: UFix64, + creator: Address? + ) + access(all) event DepositedToYieldVault( + id: UInt64, + strategyType: String, + tokenType: String, + amount: UFix64, + owner: Address?, + fromUUID: UInt64 + ) + access(all) event WithdrawnFromYieldVault( + id: UInt64, + strategyType: String, + tokenType: String, + amount: UFix64, + owner: Address?, + toUUID: UInt64 + ) + access(all) event AddedToManager( + id: UInt64, + strategyType: String, + owner: Address?, + managerUUID: UInt64, + tokenType: String + ) + access(all) event BurnedYieldVault( + id: UInt64, + strategyType: String, + tokenType: String, + remainingBalance: UFix64, + owner: Address? + ) /* --- CONSTRUCTS --- */ @@ -254,7 +287,14 @@ access(all) contract FlowYieldVaults { "Deposited vault of type \(from.getType().identifier) is not supported by this YieldVault" } let amount = from.balance - emit DepositedToYieldVault(id: self.uniqueID.id, strategyType: self.getStrategyType(), tokenType: from.getType().identifier, amount: from.balance, owner: self.owner?.address, fromUUID: from.uuid) + emit DepositedToYieldVault( + id: self.uniqueID.id, + strategyType: self.getStrategyType(), + tokenType: from.getType().identifier, + amount: from.balance, + owner: self.owner?.address, + fromUUID: from.uuid + ) self._borrowStrategy().deposit(from: &from as auth(FungibleToken.Withdraw) &{FungibleToken.Vault}) assert( from.balance == 0.0, @@ -284,7 +324,14 @@ access(all) contract FlowYieldVaults { let res <- self._borrowStrategy().withdraw(maxAmount: amount, ofToken: self.vaultType) - emit WithdrawnFromYieldVault(id: self.uniqueID.id, strategyType: self.getStrategyType(), tokenType: res.getType().identifier, amount: amount, owner: self.owner?.address, toUUID: res.uuid) + emit WithdrawnFromYieldVault( + id: self.uniqueID.id, + strategyType: self.getStrategyType(), + tokenType: res.getType().identifier, + amount: amount, + owner: self.owner?.address, + toUUID: res.uuid + ) return <- res } @@ -363,7 +410,13 @@ access(all) contract FlowYieldVaults { FlowYieldVaultsClosedBeta.validateBeta(self.owner?.address!, betaRef): "Invalid Beta Ref" } - emit AddedToManager(id: yieldVault.uniqueID.id, strategyType: yieldVault.getStrategyType(), owner: self.owner?.address, managerUUID: self.uuid, tokenType: yieldVault.getType().identifier) + emit AddedToManager( + id: yieldVault.uniqueID.id, + strategyType: yieldVault.getStrategyType(), + owner: self.owner?.address, + managerUUID: self.uuid, + tokenType: yieldVault.getType().identifier + ) self.yieldVaults[yieldVault.uniqueID.id] <-! yieldVault } /// Deposits additional funds to the specified YieldVault, reverting if none exists with the provided ID From 0724074a0016395dc8446e17a5c0bf3b50859a89 Mon Sep 17 00:00:00 2001 From: Alex <12097569+nialexsan@users.noreply.github.com> Date: Tue, 20 Jan 2026 16:29:59 -0500 Subject: [PATCH 3/4] Update cadence/contracts/FlowYieldVaults.cdc --- cadence/contracts/FlowYieldVaults.cdc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/cadence/contracts/FlowYieldVaults.cdc b/cadence/contracts/FlowYieldVaults.cdc index 1d505816..1b9c2b38 100644 --- a/cadence/contracts/FlowYieldVaults.cdc +++ b/cadence/contracts/FlowYieldVaults.cdc @@ -255,10 +255,6 @@ access(all) contract FlowYieldVaults { access(all) fun getYieldVaultBalance(): UFix64 { return self._borrowStrategy().availableBalance(ofToken: self.vaultType) } - /// Returns the strategy type identifier for this YieldVault - access(all) view fun getStrategyType(): String { - return self.strategy.getType().identifier - } /// Burner.Burnable conformance - emits the BurnedYieldVault event when burned access(contract) fun burnCallback() { emit BurnedYieldVault( From 142be7ad13269f865c83a89b2923fe64ce0f1c2e Mon Sep 17 00:00:00 2001 From: Alex <12097569+nialexsan@users.noreply.github.com> Date: Tue, 20 Jan 2026 16:35:02 -0500 Subject: [PATCH 4/4] revert change --- cadence/contracts/FlowYieldVaults.cdc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cadence/contracts/FlowYieldVaults.cdc b/cadence/contracts/FlowYieldVaults.cdc index 1b9c2b38..3c54616e 100644 --- a/cadence/contracts/FlowYieldVaults.cdc +++ b/cadence/contracts/FlowYieldVaults.cdc @@ -306,9 +306,9 @@ access(all) contract FlowYieldVaults { access(all) view fun isSupportedVaultType(type: Type): Bool { return self.getSupportedVaultTypes()[type] ?? false } - /// Returns the Type of the Strategy encapsulated by this YieldVault - access(all) view fun getStrategyType(): Type? { - return self.strategy?.getType() + /// Returns the strategy type identifier for this YieldVault + access(all) view fun getStrategyType(): String { + return self.strategy.getType().identifier } /// Withdraws the requested amount from the Strategy access(FungibleToken.Withdraw) fun withdraw(amount: UFix64): @{FungibleToken.Vault} {