Skip to content

Commit 44bc478

Browse files
committed
Restore old AutoBalancer scripts/transactions for old block height
1 parent efe7f48 commit 44bc478

4 files changed

Lines changed: 10 additions & 11 deletions

File tree

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import "FlowYieldVaultsAutoBalancersV1"
1+
import "FlowYieldVaultsAutoBalancers"
22

33
/// Returns the balance of the AutoBalancer related to the provided YieldVault ID or `nil` if none exists
44
///
55
access(all)
66
fun main(id: UInt64): UFix64? {
7-
return FlowYieldVaultsAutoBalancersV1.borrowAutoBalancer(id: id)?.vaultBalance()
7+
return FlowYieldVaultsAutoBalancers.borrowAutoBalancer(id: id)?.vaultBalance()
88
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import "FlowYieldVaultsAutoBalancersV1"
1+
import "FlowYieldVaultsAutoBalancers"
22

33
/// Returns the current value of the AutoBalancer's balance related to the provided YieldVault ID or `nil` if none exists
44
///
55
access(all)
66
fun main(id: UInt64): UFix64? {
7-
return FlowYieldVaultsAutoBalancersV1.borrowAutoBalancer(id: id)?.currentValue() ?? nil
7+
return FlowYieldVaultsAutoBalancers.borrowAutoBalancer(id: id)?.currentValue() ?? nil
88
}

cadence/transactions/flow-yield-vaults/admin/rebalance_auto_balancer_by_id.cdc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import "DeFiActions"
2-
import "AutoBalancers"
32

4-
import "FlowYieldVaultsAutoBalancersV1"
3+
import "FlowYieldVaultsAutoBalancers"
54

65
/// Calls on the AutoBalancer to rebalance which will result in a rebalancing around the value of deposits. If force is
76
/// `true`, rebalancing should occur regardless of the lower & upper thresholds configured on the AutoBalancer.
@@ -15,12 +14,12 @@ import "FlowYieldVaultsAutoBalancersV1"
1514
///
1615
transaction(id: UInt64, force: Bool) {
1716
// the AutoBalancer that will be rebalanced
18-
let autoBalancer: auth(AutoBalancers.Auto) &AutoBalancers.AutoBalancer
19-
17+
let autoBalancer: auth(DeFiActions.Auto) &DeFiActions.AutoBalancer
18+
2019
prepare(signer: auth(BorrowValue) &Account) {
2120
// derive the path and borrow an authorized reference to the AutoBalancer
22-
let storagePath = FlowYieldVaultsAutoBalancersV1.deriveAutoBalancerPath(id: id, storage: true) as! StoragePath
23-
self.autoBalancer = signer.storage.borrow<auth(AutoBalancers.Auto) &AutoBalancers.AutoBalancer>(from: storagePath)
21+
let storagePath = FlowYieldVaultsAutoBalancers.deriveAutoBalancerPath(id: id, storage: true) as! StoragePath
22+
self.autoBalancer = signer.storage.borrow<auth(DeFiActions.Auto) &DeFiActions.AutoBalancer>(from: storagePath)
2423
?? panic("Could not borrow reference to AutoBalancer id \(id) at path \(storagePath)")
2524
}
2625

0 commit comments

Comments
 (0)