From 172c03749b5e695ab33c0162cede5c14a05709d4 Mon Sep 17 00:00:00 2001 From: Shrom Date: Fri, 27 Mar 2026 16:10:19 +0530 Subject: [PATCH 1/2] 1. single loop reward collection only for available coins. 2. update pool transaction for single loop pools. 3. corrected deep sui pool id --- src/core/index.ts | 9 +- src/strategies/singleAssetLooping.ts | 451 +++++++++------------------ src/utils/poolMap.ts | 2 +- 3 files changed, 155 insertions(+), 307 deletions(-) diff --git a/src/core/index.ts b/src/core/index.ts index 6cc4ab5..4328fdf 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -32,6 +32,7 @@ import { AlphaVaultStrategy } from '../strategies/alphaVault.js'; import { ZapDepositStrategy } from '../strategies/zapDeposit.js'; import { LpStrategy } from '../strategies/lp.js'; import { SlushSingleAssetLoopingStrategy } from '../strategies/slushSingleAssetLooping.js'; +import { SingleAssetLoopingStrategy } from 'src/strategies/singleAssetLooping.js'; // Re-export types for external use export type { RouterDataV3 } from '@cetusprotocol/aggregator-sdk'; @@ -80,7 +81,13 @@ export class AlphaFiSDK { const strategy = await this.protocol.getSinglePoolStrategy(poolId); return strategy.getData(); } - + async updatePool(poolId: string): Promise { + const strategy = (await this.protocol.getSinglePoolStrategy( + poolId, + )) as SingleAssetLoopingStrategy; + const tx = new Transaction(); + return strategy.updatePool(tx); + } /** * Get balance for a single pool. * diff --git a/src/strategies/singleAssetLooping.ts b/src/strategies/singleAssetLooping.ts index d1fe496..59a1445 100644 --- a/src/strategies/singleAssetLooping.ts +++ b/src/strategies/singleAssetLooping.ts @@ -275,7 +275,22 @@ export class SingleAssetLoopingStrategy extends BaseStrategy< }) .filter((receipt) => receipt.poolId === this.poolLabel.poolId); } - + async updatePool(tx: Transaction) { + await this.collectAndSwapRewards(tx); + tx.moveCall({ + target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::update_pool`, + typeArguments: [this.poolLabel.asset.type], + arguments: [ + tx.object(VERSIONS.ALPHALEND_VERSION), + tx.object(this.poolLabel.poolId), + tx.object(this.poolLabel.investorId), + tx.object(DISTRIBUTOR_OBJECT_ID), + tx.object(ALPHALEND_LENDING_PROTOCOL_ID), + tx.object(CLOCK_PACKAGE_ID), + ], + }); + return tx; + } private async collectAndSwapRewards(tx: Transaction) { const [ alphaCoin, @@ -300,67 +315,92 @@ export class SingleAssetLoopingStrategy extends BaseStrategy< 'wBTC', 'XAUm', ]); + let coinTypes = [ + alphaCoin, + stsuiCoin, + suiCoin, + blueCoin, + deepCoin, + usdcCoin, + walCoin, + tbtcCoin, + suibtcCoin, + xaumCoin, + ].map((entry) => entry.coinType); + const alphalendClient = new AlphalendClient( + this.context.blockchain.network, + this.context.blockchain.suiClient, + ); + await alphalendClient.updatePrices(tx, [this.poolLabel.asset.type]); + const positionId = this.investorObject.positionCap.positionId; + let portfolio = await alphalendClient.getUserPortfolioFromPosition(positionId); + let rewards = portfolio?.rewardsToClaim; + if (!rewards) { + console.log('no rewards for pool id: ', this.poolLabel.poolId); + return; + } + console.log(rewards); + + for (const x of rewards) { + if (x.coinType == alphaCoin.coinType) { + tx.moveCall({ + target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_bluefin`, + typeArguments: [this.poolLabel.asset.type, alphaCoin.coinType, stsuiCoin.coinType], + arguments: [ + tx.object(VERSIONS.ALPHALEND_VERSION), + tx.object(this.poolLabel.investorId), + tx.object(ALPHALEND_LENDING_PROTOCOL_ID), + tx.object( + await this.context.getPoolIdBySymbolsAndProtocol('ALPHA', 'stSUI', 'bluefin'), + ), + tx.object(GLOBAL_CONFIGS.BLUEFIN), + tx.pure.bool(true), + tx.pure.bool(false), + tx.object(CLOCK_PACKAGE_ID), + ], + }); + tx.moveCall({ + target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_bluefin`, + typeArguments: [this.poolLabel.asset.type, stsuiCoin.coinType, suiCoin.coinType], + arguments: [ + tx.object(VERSIONS.ALPHALEND_VERSION), + tx.object(this.poolLabel.investorId), + tx.object(ALPHALEND_LENDING_PROTOCOL_ID), + tx.object(await this.context.getPoolIdBySymbolsAndProtocol('stSUI', 'SUI', 'bluefin')), + tx.object(GLOBAL_CONFIGS.BLUEFIN), + tx.pure.bool(true), + tx.pure.bool(true), + tx.object(CLOCK_PACKAGE_ID), + ], + }); + } else if (coinTypes.includes(x.coinType) && x.coinType != this.poolLabel.asset.type) { + tx.moveCall({ + target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_bluefin`, + typeArguments: [this.poolLabel.asset.type, x.coinType, suiCoin.coinType], + arguments: [ + tx.object(VERSIONS.ALPHALEND_VERSION), + tx.object(this.poolLabel.investorId), + tx.object(ALPHALEND_LENDING_PROTOCOL_ID), + tx.object( + await this.context.getPoolIdByTypesAndProtocol( + x.coinType, + suiCoin.coinType, + 'bluefin', + ), + ), + tx.object(GLOBAL_CONFIGS.BLUEFIN), + tx.pure.bool(true), + tx.pure.bool(true), + tx.object(CLOCK_PACKAGE_ID), + ], + }); + } + } - if (this.poolLabel.asset.name === 'tBTC') { - tx.moveCall({ - target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_bluefin`, - typeArguments: [tbtcCoin.coinType, alphaCoin.coinType, stsuiCoin.coinType], - arguments: [ - tx.object(VERSIONS.ALPHALEND_VERSION), - tx.object(this.poolLabel.investorId), - tx.object(ALPHALEND_LENDING_PROTOCOL_ID), - tx.object(await this.context.getPoolIdBySymbolsAndProtocol('ALPHA', 'stSUI', 'bluefin')), - tx.object(GLOBAL_CONFIGS.BLUEFIN), - tx.pure.bool(true), - tx.pure.bool(false), - tx.object(CLOCK_PACKAGE_ID), - ], - }); - tx.moveCall({ - target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_bluefin`, - typeArguments: [tbtcCoin.coinType, stsuiCoin.coinType, suiCoin.coinType], - arguments: [ - tx.object(VERSIONS.ALPHALEND_VERSION), - tx.object(this.poolLabel.investorId), - tx.object(ALPHALEND_LENDING_PROTOCOL_ID), - tx.object(await this.context.getPoolIdBySymbolsAndProtocol('stSUI', 'SUI', 'bluefin')), - tx.object(GLOBAL_CONFIGS.BLUEFIN), - tx.pure.bool(true), - tx.pure.bool(true), - tx.object(CLOCK_PACKAGE_ID), - ], - }); - tx.moveCall({ - target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_bluefin`, - typeArguments: [tbtcCoin.coinType, blueCoin.coinType, suiCoin.coinType], - arguments: [ - tx.object(VERSIONS.ALPHALEND_VERSION), - tx.object(this.poolLabel.investorId), - tx.object(ALPHALEND_LENDING_PROTOCOL_ID), - tx.object(await this.context.getPoolIdBySymbolsAndProtocol('BLUE', 'SUI', 'bluefin')), - tx.object(GLOBAL_CONFIGS.BLUEFIN), - tx.pure.bool(true), - tx.pure.bool(true), - tx.object(CLOCK_PACKAGE_ID), - ], - }); + if (this.poolLabel.asset.name in ['tBTC', 'USDSUI', 'XAUm', 'WBTC']) { tx.moveCall({ target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_bluefin`, - typeArguments: [tbtcCoin.coinType, deepCoin.coinType, suiCoin.coinType], - arguments: [ - tx.object(VERSIONS.ALPHALEND_VERSION), - tx.object(this.poolLabel.investorId), - tx.object(ALPHALEND_LENDING_PROTOCOL_ID), - tx.object(await this.context.getPoolIdBySymbolsAndProtocol('DEEP', 'SUI', 'bluefin')), - tx.object(GLOBAL_CONFIGS.BLUEFIN), - tx.pure.bool(true), - tx.pure.bool(true), - tx.object(CLOCK_PACKAGE_ID), - ], - }); - tx.moveCall({ - target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_bluefin`, - typeArguments: [tbtcCoin.coinType, suiCoin.coinType, usdcCoin.coinType], + typeArguments: [this.poolLabel.asset.type, suiCoin.coinType, usdcCoin.coinType], arguments: [ tx.object(VERSIONS.ALPHALEND_VERSION), tx.object(this.poolLabel.investorId), @@ -372,63 +412,45 @@ export class SingleAssetLoopingStrategy extends BaseStrategy< tx.object(CLOCK_PACKAGE_ID), ], }); - tx.moveCall({ - target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_bluefin`, - typeArguments: [tbtcCoin.coinType, tbtcCoin.coinType, usdcCoin.coinType], - arguments: [ - tx.object(VERSIONS.ALPHALEND_VERSION), - tx.object(this.poolLabel.investorId), - tx.object(ALPHALEND_LENDING_PROTOCOL_ID), - tx.object(await this.context.getPoolIdBySymbolsAndProtocol('tBTC', 'USDC', 'bluefin')), - tx.object(GLOBAL_CONFIGS.BLUEFIN), - tx.pure.bool(false), - tx.pure.bool(true), - tx.object(CLOCK_PACKAGE_ID), - ], - }); + if (this.poolLabel.asset.name in ['XAUm']) { + tx.moveCall({ + target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_mmt`, + typeArguments: [xaumCoin.coinType, xaumCoin.coinType, usdcCoin.coinType], + arguments: [ + tx.object(VERSIONS.ALPHALEND_VERSION), + tx.object(this.poolLabel.investorId), + tx.object(ALPHALEND_LENDING_PROTOCOL_ID), + tx.object(await this.context.getPoolIdBySymbolsAndProtocol('XAUm', 'USDC', 'mmt')), + tx.object(VERSIONS.MMT), + tx.pure.bool(false), + tx.pure.bool(true), + tx.pure.u64(10), + tx.object(CLOCK_PACKAGE_ID), + ], + }); + } else { + tx.moveCall({ + target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_bluefin`, + typeArguments: [this.poolLabel.asset.type, this.poolLabel.asset.type, usdcCoin.coinType], + arguments: [ + tx.object(VERSIONS.ALPHALEND_VERSION), + tx.object(this.poolLabel.investorId), + tx.object(ALPHALEND_LENDING_PROTOCOL_ID), + tx.object( + await this.context.getPoolIdBySymbolsAndProtocol( + this.poolLabel.asset.name, + 'USDC', + 'bluefin', + ), + ), + tx.object(GLOBAL_CONFIGS.BLUEFIN), + tx.pure.bool(false), + tx.pure.bool(true), + tx.object(CLOCK_PACKAGE_ID), + ], + }); + } } else if (this.poolLabel.asset.name === 'wBTC') { - tx.moveCall({ - target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_bluefin`, - typeArguments: [suibtcCoin.coinType, alphaCoin.coinType, stsuiCoin.coinType], - arguments: [ - tx.object(VERSIONS.ALPHALEND_VERSION), - tx.object(this.poolLabel.investorId), - tx.object(ALPHALEND_LENDING_PROTOCOL_ID), - tx.object(await this.context.getPoolIdBySymbolsAndProtocol('ALPHA', 'stSUI', 'bluefin')), - tx.object(GLOBAL_CONFIGS.BLUEFIN), - tx.pure.bool(true), - tx.pure.bool(false), - tx.object(CLOCK_PACKAGE_ID), - ], - }); - tx.moveCall({ - target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_bluefin`, - typeArguments: [suibtcCoin.coinType, blueCoin.coinType, suiCoin.coinType], - arguments: [ - tx.object(VERSIONS.ALPHALEND_VERSION), - tx.object(this.poolLabel.investorId), - tx.object(ALPHALEND_LENDING_PROTOCOL_ID), - tx.object(await this.context.getPoolIdBySymbolsAndProtocol('BLUE', 'SUI', 'bluefin')), - tx.object(GLOBAL_CONFIGS.BLUEFIN), - tx.pure.bool(true), - tx.pure.bool(true), - tx.object(CLOCK_PACKAGE_ID), - ], - }); - tx.moveCall({ - target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_bluefin`, - typeArguments: [suibtcCoin.coinType, deepCoin.coinType, suiCoin.coinType], - arguments: [ - tx.object(VERSIONS.ALPHALEND_VERSION), - tx.object(this.poolLabel.investorId), - tx.object(ALPHALEND_LENDING_PROTOCOL_ID), - tx.object(await this.context.getPoolIdBySymbolsAndProtocol('DEEP', 'SUI', 'bluefin')), - tx.object(GLOBAL_CONFIGS.BLUEFIN), - tx.pure.bool(true), - tx.pure.bool(true), - tx.object(CLOCK_PACKAGE_ID), - ], - }); tx.moveCall({ target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_bluefin`, typeArguments: [suibtcCoin.coinType, suiCoin.coinType, suibtcCoin.coinType], @@ -443,202 +465,21 @@ export class SingleAssetLoopingStrategy extends BaseStrategy< tx.object(CLOCK_PACKAGE_ID), ], }); - } else if (this.poolLabel.asset.name === 'XAUm') { - tx.moveCall({ - target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_bluefin`, - typeArguments: [xaumCoin.coinType, alphaCoin.coinType, usdcCoin.coinType], - arguments: [ - tx.object(VERSIONS.ALPHALEND_VERSION), - tx.object(this.poolLabel.investorId), - tx.object(ALPHALEND_LENDING_PROTOCOL_ID), - tx.object(await this.context.getPoolIdBySymbolsAndProtocol('ALPHA', 'USDC', 'bluefin')), - tx.object(GLOBAL_CONFIGS.BLUEFIN), - tx.pure.bool(true), - tx.pure.bool(true), - tx.object(CLOCK_PACKAGE_ID), - ], - }); - tx.moveCall({ - target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_bluefin`, - typeArguments: [xaumCoin.coinType, deepCoin.coinType, suiCoin.coinType], - arguments: [ - tx.object(VERSIONS.ALPHALEND_VERSION), - tx.object(this.poolLabel.investorId), - tx.object(ALPHALEND_LENDING_PROTOCOL_ID), - tx.object(await this.context.getPoolIdBySymbolsAndProtocol('DEEP', 'SUI', 'bluefin')), - tx.object(GLOBAL_CONFIGS.BLUEFIN), - tx.pure.bool(true), - tx.pure.bool(true), - tx.object(CLOCK_PACKAGE_ID), - ], - }); - tx.moveCall({ - target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_bluefin`, - typeArguments: [xaumCoin.coinType, blueCoin.coinType, suiCoin.coinType], - arguments: [ - tx.object(VERSIONS.ALPHALEND_VERSION), - tx.object(this.poolLabel.investorId), - tx.object(ALPHALEND_LENDING_PROTOCOL_ID), - tx.object(await this.context.getPoolIdBySymbolsAndProtocol('BLUE', 'SUI', 'bluefin')), - tx.object(GLOBAL_CONFIGS.BLUEFIN), - tx.pure.bool(true), - tx.pure.bool(true), - tx.object(CLOCK_PACKAGE_ID), - ], - }); - tx.moveCall({ - target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_bluefin`, - typeArguments: [xaumCoin.coinType, suiCoin.coinType, usdcCoin.coinType], - arguments: [ - tx.object(VERSIONS.ALPHALEND_VERSION), - tx.object(this.poolLabel.investorId), - tx.object(ALPHALEND_LENDING_PROTOCOL_ID), - tx.object(await this.context.getPoolIdBySymbolsAndProtocol('SUI', 'USDC', 'bluefin')), - tx.object(GLOBAL_CONFIGS.BLUEFIN), - tx.pure.bool(true), - tx.pure.bool(true), - tx.object(CLOCK_PACKAGE_ID), - ], - }); - tx.moveCall({ - target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_mmt`, - typeArguments: [xaumCoin.coinType, xaumCoin.coinType, usdcCoin.coinType], - arguments: [ - tx.object(VERSIONS.ALPHALEND_VERSION), - tx.object(this.poolLabel.investorId), - tx.object(ALPHALEND_LENDING_PROTOCOL_ID), - tx.object(await this.context.getPoolIdBySymbolsAndProtocol('XAUm', 'USDC', 'mmt')), - tx.object(VERSIONS.MMT), - tx.pure.bool(false), - tx.pure.bool(true), - tx.pure.u64(10), - tx.object(CLOCK_PACKAGE_ID), - ], - }); - } else if (this.poolLabel.asset.name === 'WBTC') { - tx.moveCall({ - target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_bluefin`, - typeArguments: [this.poolLabel.asset.type, deepCoin.coinType, usdcCoin.coinType], - arguments: [ - tx.object(VERSIONS.ALPHALEND_VERSION), - tx.object(this.poolLabel.investorId), - tx.object(ALPHALEND_LENDING_PROTOCOL_ID), - tx.object(await this.context.getPoolIdBySymbolsAndProtocol('DEEP', 'USDC', 'bluefin')), - tx.object(GLOBAL_CONFIGS.BLUEFIN), - tx.pure.bool(true), - tx.pure.bool(true), - tx.object(CLOCK_PACKAGE_ID), - ], - }); - tx.moveCall({ - target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_bluefin`, - typeArguments: [this.poolLabel.asset.type, this.poolLabel.asset.type, usdcCoin.coinType], - arguments: [ - tx.object(VERSIONS.ALPHALEND_VERSION), - tx.object(this.poolLabel.investorId), - tx.object(ALPHALEND_LENDING_PROTOCOL_ID), - tx.object(await this.context.getPoolIdBySymbolsAndProtocol('WBTC', 'USDC', 'bluefin')), - tx.object(GLOBAL_CONFIGS.BLUEFIN), - tx.pure.bool(false), - tx.pure.bool(true), - tx.object(CLOCK_PACKAGE_ID), - ], - }); - } else if (this.poolLabel.asset.name === 'DEEP') { - tx.moveCall({ - target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_bluefin`, - typeArguments: [deepCoin.coinType, stsuiCoin.coinType, suiCoin.coinType], - arguments: [ - tx.object(VERSIONS.ALPHALEND_VERSION), - tx.object(this.poolLabel.investorId), - tx.object(ALPHALEND_LENDING_PROTOCOL_ID), - tx.object(await this.context.getPoolIdBySymbolsAndProtocol('stSUI', 'SUI', 'bluefin')), - tx.object(GLOBAL_CONFIGS.BLUEFIN), - tx.pure.bool(true), - tx.pure.bool(true), - tx.object(CLOCK_PACKAGE_ID), - ], - }); - tx.moveCall({ - target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_bluefin`, - typeArguments: [deepCoin.coinType, deepCoin.coinType, suiCoin.coinType], - arguments: [ - tx.object(VERSIONS.ALPHALEND_VERSION), - tx.object(this.poolLabel.investorId), - tx.object(ALPHALEND_LENDING_PROTOCOL_ID), - tx.object(await this.context.getPoolIdBySymbolsAndProtocol('DEEP', 'SUI', 'bluefin')), - tx.object(GLOBAL_CONFIGS.BLUEFIN), - tx.pure.bool(false), - tx.pure.bool(true), - tx.object(CLOCK_PACKAGE_ID), - ], - }); - } else if (this.poolLabel.asset.name === 'WAL') { - tx.moveCall({ - target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_bluefin`, - typeArguments: [walCoin.coinType, stsuiCoin.coinType, suiCoin.coinType], - arguments: [ - tx.object(VERSIONS.ALPHALEND_VERSION), - tx.object(this.poolLabel.investorId), - tx.object(ALPHALEND_LENDING_PROTOCOL_ID), - tx.object(await this.context.getPoolIdBySymbolsAndProtocol('stSUI', 'SUI', 'bluefin')), - tx.object(GLOBAL_CONFIGS.BLUEFIN), - tx.pure.bool(true), - tx.pure.bool(true), - tx.object(CLOCK_PACKAGE_ID), - ], - }); - tx.moveCall({ - target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_bluefin`, - typeArguments: [walCoin.coinType, walCoin.coinType, suiCoin.coinType], - arguments: [ - tx.object(VERSIONS.ALPHALEND_VERSION), - tx.object(this.poolLabel.investorId), - tx.object(ALPHALEND_LENDING_PROTOCOL_ID), - tx.object(await this.context.getPoolIdBySymbolsAndProtocol('WAL', 'SUI', 'bluefin')), - tx.object(GLOBAL_CONFIGS.BLUEFIN), - tx.pure.bool(false), - tx.pure.bool(true), - tx.object(CLOCK_PACKAGE_ID), - ], - }); - } else if (this.poolLabel.asset.name === 'USDSUI') { - tx.moveCall({ - target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_bluefin`, - typeArguments: [this.poolLabel.asset.type, stsuiCoin.coinType, suiCoin.coinType], - arguments: [ - tx.object(VERSIONS.ALPHALEND_VERSION), - tx.object(this.poolLabel.investorId), - tx.object(ALPHALEND_LENDING_PROTOCOL_ID), - tx.object(await this.context.getPoolIdBySymbolsAndProtocol('stSUI', 'SUI', 'bluefin')), - tx.object(GLOBAL_CONFIGS.BLUEFIN), - tx.pure.bool(true), - tx.pure.bool(true), - tx.object(CLOCK_PACKAGE_ID), - ], - }); - tx.moveCall({ - target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_bluefin`, - typeArguments: [this.poolLabel.asset.type, suiCoin.coinType, usdcCoin.coinType], - arguments: [ - tx.object(VERSIONS.ALPHALEND_VERSION), - tx.object(this.poolLabel.investorId), - tx.object(ALPHALEND_LENDING_PROTOCOL_ID), - tx.object(await this.context.getPoolIdBySymbolsAndProtocol('SUI', 'USDC', 'bluefin')), - tx.object(GLOBAL_CONFIGS.BLUEFIN), - tx.pure.bool(true), - tx.pure.bool(true), - tx.object(CLOCK_PACKAGE_ID), - ], - }); + } else if (this.poolLabel.asset.name in ['DEEP', 'WAL']) { tx.moveCall({ target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_bluefin`, - typeArguments: [this.poolLabel.asset.type, this.poolLabel.asset.type, usdcCoin.coinType], + typeArguments: [deepCoin.coinType, this.poolLabel.asset.type, suiCoin.coinType], arguments: [ tx.object(VERSIONS.ALPHALEND_VERSION), tx.object(this.poolLabel.investorId), tx.object(ALPHALEND_LENDING_PROTOCOL_ID), - tx.object(await this.context.getPoolIdBySymbolsAndProtocol('USDSUI', 'USDC', 'bluefin')), + tx.object( + await this.context.getPoolIdBySymbolsAndProtocol( + this.poolLabel.asset.name, + 'SUI', + 'bluefin', + ), + ), tx.object(GLOBAL_CONFIGS.BLUEFIN), tx.pure.bool(false), tx.pure.bool(true), diff --git a/src/utils/poolMap.ts b/src/utils/poolMap.ts index 1b3e30c..fe5fa89 100644 --- a/src/utils/poolMap.ts +++ b/src/utils/poolMap.ts @@ -178,7 +178,7 @@ export const POOL_REGISTRY: Record = { '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI', '0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP', )]: { - bluefin: '0x1b06371d74082856a1be71760cf49f6a377d050eb57afd017f203e89b09c89a2', + bluefin: '0x7242459a663c4e59434252ceb27c228f6b1f21f2ba506f3b62d71b19a7421cc1', cetus: '0xe01243f37f712ef87e556afb9b1d03d0fae13f96d324ec912daffc339dfdcbd2', mmt: '0x9b06ea8e1a0ee5c86f0b47512a3337e3c9c4e235c4ec698d15b51b0a8ec3e5a9', }, From 2b0644a4f79a4260ef9c1c88fd4765c25ef6da45 Mon Sep 17 00:00:00 2001 From: Shrom Date: Fri, 27 Mar 2026 20:01:25 +0530 Subject: [PATCH 2/2] generic base type --- src/strategies/singleAssetLooping.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/strategies/singleAssetLooping.ts b/src/strategies/singleAssetLooping.ts index 59a1445..ea63ea6 100644 --- a/src/strategies/singleAssetLooping.ts +++ b/src/strategies/singleAssetLooping.ts @@ -468,7 +468,7 @@ export class SingleAssetLoopingStrategy extends BaseStrategy< } else if (this.poolLabel.asset.name in ['DEEP', 'WAL']) { tx.moveCall({ target: `${this.poolLabel.packageId}::alphafi_alphalend_single_loop_pool::collect_reward_and_swap_bluefin`, - typeArguments: [deepCoin.coinType, this.poolLabel.asset.type, suiCoin.coinType], + typeArguments: [this.poolLabel.asset.type, this.poolLabel.asset.type, suiCoin.coinType], arguments: [ tx.object(VERSIONS.ALPHALEND_VERSION), tx.object(this.poolLabel.investorId),