@@ -560,6 +560,15 @@ fun getAutoBalancerValueOfDeposits(id: UInt64): UFix64? {
560560 return res .returnValue as ! UFix64 ?
561561}
562562
563+ /// Returns [currentValue, valueOfDeposits] for the AutoBalancer in a single script call.
564+ /// This is more efficient than calling getAutoBalancerCurrentValue and getAutoBalancerValueOfDeposits separately.
565+ access (all )
566+ fun getAutoBalancerMetrics (id : UInt64 ): [UFix64 ]? {
567+ let res = _executeScript (" ../scripts/flow-yield-vaults/get_auto_balancer_metrics_by_id.cdc" , [id ])
568+ Test .expect (res , Test .beSucceeded ())
569+ return res .returnValue as ! [UFix64 ]?
570+ }
571+
563572access (all )
564573fun getPositionDetails (pid : UInt64 , beFailed : Bool ): FlowALPv0 .PositionDetails {
565574 let res = _executeScript (" ../../lib/FlowALP/cadence/scripts/flow-alp/position_details.cdc" ,
@@ -1222,64 +1231,3 @@ access(all) fun getMOETDebtFromPosition(pid: UInt64): UFix64 {
12221231 }
12231232 return 0.0
12241233}
1225-
1226- access (all )
1227- fun setupGenericVault (signer : Test .TestAccount , vaultIdentifier : String ) {
1228- let setupResult = _executeTransaction (
1229- " ../../lib/flow-evm-bridge/cadence/transactions/example-assets/setup/setup_generic_vault.cdc" ,
1230- [vaultIdentifier ],
1231- signer
1232- )
1233- Test .expect (setupResult , Test .beSucceeded ())
1234- }
1235-
1236- access (all )
1237- fun setERC20Balance (
1238- signer : Test .TestAccount ,
1239- tokenAddress : String ,
1240- holderAddress : String ,
1241- balanceSlot : UInt256 ,
1242- amount : UInt256
1243- ) {
1244- let res = _executeTransaction (
1245- " transactions/set_erc20_balance.cdc" ,
1246- [tokenAddress , holderAddress , balanceSlot , amount ],
1247- signer
1248- )
1249- Test .expect (res , Test .beSucceeded ())
1250- }
1251-
1252- access (all )
1253- fun mintBTC (signer : Test .TestAccount , amount : UFix64 ) {
1254- let wbtcAddress = " 0x717dae2baf7656be9a9b01dee31d571a9d4c9579"
1255- let wbtcTokenId = " A.1e4aa0b87d10b141.EVMVMBridgedToken_717dae2baf7656be9a9b01dee31d571a9d4c9579.Vault"
1256- let wbtcBalanceSlot : UInt256 = 5
1257-
1258- // Ensure signer has a COA (needs some FLOW for gas)
1259- if getCOA (signer .address ) == nil {
1260- createCOA (signer , fundingAmount : 1.0 )
1261- }
1262- let coaAddress = getCOA (signer .address )!
1263-
1264- // Set wBTC ERC20 balance for the signer's COA on EVM
1265- // wBTC has 8 decimals, so multiply amount by 1e8
1266- // Split to avoid UFix64 overflow for large amounts
1267- let whole = UInt256 (amount )
1268- let frac = amount - UFix64 (UInt64 (amount ))
1269- let amountSmallestUnit = whole * 100_000_000 + UInt256 (frac * 100_000_000.0 )
1270- setERC20Balance (
1271- signer : signer ,
1272- tokenAddress : wbtcAddress ,
1273- holderAddress : coaAddress ,
1274- balanceSlot : wbtcBalanceSlot ,
1275- amount : amountSmallestUnit
1276- )
1277-
1278- // Bridge wBTC from EVM to Cadence
1279- let bridgeRes = _executeTransaction (
1280- " ../../lib/flow-evm-bridge/cadence/transactions/bridge/tokens/bridge_tokens_from_evm.cdc" ,
1281- [wbtcTokenId , amountSmallestUnit ],
1282- signer
1283- )
1284- Test .expect (bridgeRes , Test .beSucceeded ())
1285- }
0 commit comments