@alphafi/alphafi-sdk 0.0.66 → 0.0.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/common/coins.d.ts.map +1 -1
- package/dist/cjs/common/coins.js +13 -1
- package/dist/cjs/common/coins.js.map +1 -1
- package/dist/cjs/common/constants.d.ts +235 -0
- package/dist/cjs/common/constants.d.ts.map +1 -1
- package/dist/cjs/common/constants.js +203 -20
- package/dist/cjs/common/constants.js.map +1 -1
- package/dist/cjs/common/maps.d.ts +7 -0
- package/dist/cjs/common/maps.d.ts.map +1 -1
- package/dist/cjs/common/maps.js +184 -1
- package/dist/cjs/common/maps.js.map +1 -1
- package/dist/cjs/common/pyth.d.ts +1 -1
- package/dist/cjs/common/pyth.d.ts.map +1 -1
- package/dist/cjs/common/pyth.js.map +1 -1
- package/dist/cjs/common/types.d.ts +17 -3
- package/dist/cjs/common/types.d.ts.map +1 -1
- package/dist/cjs/common/types.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/sui-sdk/functions/getPortfolioAmounts.d.ts.map +1 -1
- package/dist/cjs/sui-sdk/functions/getPortfolioAmounts.js +17 -2
- package/dist/cjs/sui-sdk/functions/getPortfolioAmounts.js.map +1 -1
- package/dist/cjs/sui-sdk/transactions/fetchTransactions.d.ts.map +1 -1
- package/dist/cjs/sui-sdk/transactions/fetchTransactions.js +21 -5
- package/dist/cjs/sui-sdk/transactions/fetchTransactions.js.map +1 -1
- package/dist/cjs/sui-sdk/transactions/types.d.ts +2 -1
- package/dist/cjs/sui-sdk/transactions/types.d.ts.map +1 -1
- package/dist/cjs/sui-sdk/transactions/types.js.map +1 -1
- package/dist/cjs/transactions/alpha.js +2 -2
- package/dist/cjs/transactions/alpha.js.map +1 -1
- package/dist/cjs/transactions/bluefin.d.ts +6 -0
- package/dist/cjs/transactions/bluefin.d.ts.map +1 -1
- package/dist/cjs/transactions/bluefin.js +153 -1
- package/dist/cjs/transactions/bluefin.js.map +1 -1
- package/dist/cjs/transactions/deposit.d.ts +3 -3
- package/dist/cjs/transactions/deposit.d.ts.map +1 -1
- package/dist/cjs/transactions/deposit.js +25 -21
- package/dist/cjs/transactions/deposit.js.map +1 -1
- package/dist/cjs/transactions/navi-looping.d.ts.map +1 -1
- package/dist/cjs/transactions/navi-looping.js +865 -73
- package/dist/cjs/transactions/navi-looping.js.map +1 -1
- package/dist/cjs/transactions/navi.d.ts.map +1 -1
- package/dist/cjs/transactions/navi.js +1556 -191
- package/dist/cjs/transactions/navi.js.map +1 -1
- package/dist/cjs/transactions/naviOracle.d.ts +3 -0
- package/dist/cjs/transactions/naviOracle.d.ts.map +1 -0
- package/dist/cjs/transactions/naviOracle.js +18 -0
- package/dist/cjs/transactions/naviOracle.js.map +1 -0
- package/dist/cjs/transactions/withdraw.d.ts.map +1 -1
- package/dist/cjs/transactions/withdraw.js +8 -3
- package/dist/cjs/transactions/withdraw.js.map +1 -1
- package/dist/cjs/transactions/zapDeposit.d.ts +2 -6
- package/dist/cjs/transactions/zapDeposit.d.ts.map +1 -1
- package/dist/cjs/transactions/zapDeposit.js +1207 -1497
- package/dist/cjs/transactions/zapDeposit.js.map +1 -1
- package/dist/cjs/utils/prices.d.ts.map +1 -1
- package/dist/cjs/utils/prices.js +1 -1
- package/dist/cjs/utils/prices.js.map +1 -1
- package/dist/esm/common/coins.d.ts.map +1 -1
- package/dist/esm/common/coins.js +13 -1
- package/dist/esm/common/coins.js.map +1 -1
- package/dist/esm/common/constants.d.ts +235 -0
- package/dist/esm/common/constants.d.ts.map +1 -1
- package/dist/esm/common/constants.js +203 -20
- package/dist/esm/common/constants.js.map +1 -1
- package/dist/esm/common/maps.d.ts +7 -0
- package/dist/esm/common/maps.d.ts.map +1 -1
- package/dist/esm/common/maps.js +183 -0
- package/dist/esm/common/maps.js.map +1 -1
- package/dist/esm/common/pyth.d.ts +1 -1
- package/dist/esm/common/pyth.d.ts.map +1 -1
- package/dist/esm/common/pyth.js.map +1 -1
- package/dist/esm/common/types.d.ts +17 -3
- package/dist/esm/common/types.d.ts.map +1 -1
- package/dist/esm/common/types.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/sui-sdk/functions/getPortfolioAmounts.d.ts.map +1 -1
- package/dist/esm/sui-sdk/functions/getPortfolioAmounts.js +17 -2
- package/dist/esm/sui-sdk/functions/getPortfolioAmounts.js.map +1 -1
- package/dist/esm/sui-sdk/transactions/fetchTransactions.d.ts.map +1 -1
- package/dist/esm/sui-sdk/transactions/fetchTransactions.js +21 -5
- package/dist/esm/sui-sdk/transactions/fetchTransactions.js.map +1 -1
- package/dist/esm/sui-sdk/transactions/types.d.ts +2 -1
- package/dist/esm/sui-sdk/transactions/types.d.ts.map +1 -1
- package/dist/esm/sui-sdk/transactions/types.js.map +1 -1
- package/dist/esm/transactions/alpha.js +2 -2
- package/dist/esm/transactions/alpha.js.map +1 -1
- package/dist/esm/transactions/bluefin.d.ts +6 -0
- package/dist/esm/transactions/bluefin.d.ts.map +1 -1
- package/dist/esm/transactions/bluefin.js +151 -1
- package/dist/esm/transactions/bluefin.js.map +1 -1
- package/dist/esm/transactions/deposit.d.ts +3 -3
- package/dist/esm/transactions/deposit.d.ts.map +1 -1
- package/dist/esm/transactions/deposit.js +26 -22
- package/dist/esm/transactions/deposit.js.map +1 -1
- package/dist/esm/transactions/navi-looping.d.ts.map +1 -1
- package/dist/esm/transactions/navi-looping.js +866 -74
- package/dist/esm/transactions/navi-looping.js.map +1 -1
- package/dist/esm/transactions/navi.d.ts.map +1 -1
- package/dist/esm/transactions/navi.js +1557 -192
- package/dist/esm/transactions/navi.js.map +1 -1
- package/dist/esm/transactions/naviOracle.d.ts +3 -0
- package/dist/esm/transactions/naviOracle.d.ts.map +1 -0
- package/dist/esm/transactions/naviOracle.js +15 -0
- package/dist/esm/transactions/naviOracle.js.map +1 -0
- package/dist/esm/transactions/withdraw.d.ts.map +1 -1
- package/dist/esm/transactions/withdraw.js +9 -4
- package/dist/esm/transactions/withdraw.js.map +1 -1
- package/dist/esm/transactions/zapDeposit.d.ts +2 -6
- package/dist/esm/transactions/zapDeposit.d.ts.map +1 -1
- package/dist/esm/transactions/zapDeposit.js +1208 -1498
- package/dist/esm/transactions/zapDeposit.js.map +1 -1
- package/dist/esm/utils/prices.d.ts.map +1 -1
- package/dist/esm/utils/prices.js +2 -2
- package/dist/esm/utils/prices.js.map +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/functions/alphaLpBreakdown.html +1 -1
- package/docs/functions/cetusLpBreakdown.html +1 -1
- package/docs/functions/claimBlueRewardTxb.html +1 -1
- package/docs/functions/claimRewardTxb.html +1 -1
- package/docs/functions/coinAmountToXTokensDoubleAsset.html +1 -1
- package/docs/functions/coinAmountToXTokensSingleAsset.html +1 -1
- package/docs/functions/coinsInPool.html +1 -1
- package/docs/functions/collectRewards.html +1 -1
- package/docs/functions/deposit.html +1 -1
- package/docs/functions/depositDoubleAssetTxb.html +1 -1
- package/docs/functions/depositSingleAssetTxb.html +1 -1
- package/docs/functions/fetchAfterTransactionEvents.html +1 -1
- package/docs/functions/fetchAutoCompoundingEvents.html +1 -1
- package/docs/functions/fetchAutoCompoundingEventsGql.html +1 -1
- package/docs/functions/fetchCetusPools.html +1 -1
- package/docs/functions/fetchChainIdentifier.html +1 -1
- package/docs/functions/fetchCheckRatioEvents.html +1 -1
- package/docs/functions/fetchLiquidityChangeEvents.html +1 -1
- package/docs/functions/fetchMultiCategoryEvents.html +1 -1
- package/docs/functions/fetchMultiReceipts.html +1 -1
- package/docs/functions/fetchNftHolders.html +1 -1
- package/docs/functions/fetchPools.html +1 -1
- package/docs/functions/fetchPortfolioData.html +1 -1
- package/docs/functions/fetchProtocolData.html +1 -1
- package/docs/functions/fetchTVL.html +1 -1
- package/docs/functions/fetchTransactions.html +1 -0
- package/docs/functions/fetchUserVaultBalances.html +1 -1
- package/docs/functions/fetchUserVaults.html +1 -1
- package/docs/functions/fetchUserWalletData.html +1 -1
- package/docs/functions/fetchVoloExchangeRate.html +1 -1
- package/docs/functions/fetchWithdrawV2Events.html +1 -1
- package/docs/functions/getAirdropShare.html +1 -1
- package/docs/functions/getAllDoubleAssetVaults.html +1 -1
- package/docs/functions/getAllSingleAssetVaults.html +1 -1
- package/docs/functions/getAllVaultBalances.html +1 -1
- package/docs/functions/getAllVaults.html +1 -1
- package/docs/functions/getAlphaUnlocks.html +1 -1
- package/docs/functions/getAlphaVaultBalance.html +1 -1
- package/docs/functions/getAmounts.html +1 -1
- package/docs/functions/getApr.html +1 -1
- package/docs/functions/getAprs.html +1 -1
- package/docs/functions/getApy.html +1 -1
- package/docs/functions/getApys.html +1 -1
- package/docs/functions/getCetusInvestorTicksMap.html +1 -1
- package/docs/functions/getCetusPool.html +1 -1
- package/docs/functions/getCetusSqrtPriceMap.html +1 -1
- package/docs/functions/getCoinAmountsFromLiquidity.html +1 -1
- package/docs/functions/getConf.html +1 -1
- package/docs/functions/getCurrentTick.html +1 -1
- package/docs/functions/getDistributor.html +1 -1
- package/docs/functions/getDoubleAssetVaultBalance.html +1 -1
- package/docs/functions/getDoubleAssetVaults.html +1 -1
- package/docs/functions/getHoldersFromTransactions.html +1 -1
- package/docs/functions/getInvestor.html +1 -1
- package/docs/functions/getInvestorPoolMap.html +1 -1
- package/docs/functions/getLastAutoCompoundTime.html +1 -1
- package/docs/functions/getLatestPrices.html +1 -1
- package/docs/functions/getLiquidity.html +1 -1
- package/docs/functions/getMultiCetusPool.html +1 -1
- package/docs/functions/getMultiInvestor.html +1 -1
- package/docs/functions/getMultiLatestPrices.html +1 -1
- package/docs/functions/getMultiParentPool.html +1 -1
- package/docs/functions/getMultiPool.html +1 -1
- package/docs/functions/getMultiReceipts.html +1 -1
- package/docs/functions/getParentPool.html +1 -1
- package/docs/functions/getPool.html +1 -1
- package/docs/functions/getPoolExchangeRate.html +1 -1
- package/docs/functions/getPoolExchangeRateMap.html +1 -1
- package/docs/functions/getPoolsWeightDistribution.html +1 -1
- package/docs/functions/getPositionRange.html +1 -1
- package/docs/functions/getPositionRanges.html +1 -1
- package/docs/functions/getPositionTicks.html +1 -1
- package/docs/functions/getPriceToTick.html +1 -1
- package/docs/functions/getRebalanceHistories.html +1 -1
- package/docs/functions/getRebalanceHistory.html +1 -1
- package/docs/functions/getReceipts.html +1 -1
- package/docs/functions/getSingleAssetVaultBalance.html +1 -1
- package/docs/functions/getSingleAssetVaults.html +1 -1
- package/docs/functions/getSuiClient.html +2 -2
- package/docs/functions/getSuiNodeUrl.html +2 -2
- package/docs/functions/getTVLs-1.html +1 -1
- package/docs/functions/getTickSpacing.html +1 -1
- package/docs/functions/getTickToPrice.html +1 -1
- package/docs/functions/getTvls.html +1 -1
- package/docs/functions/getUserTokensFromTransactions.html +1 -1
- package/docs/functions/getUserTokensInUsdFromTransactions.html +1 -1
- package/docs/functions/getVaultBalance.html +1 -1
- package/docs/functions/getVaultBalanceForActiveUsers.html +1 -1
- package/docs/functions/getVaults.html +1 -1
- package/docs/functions/getXTokenVaultBalanceForActiveUsers.html +1 -1
- package/docs/functions/getZapAmounts.html +1 -1
- package/docs/functions/lastAutocompoundTime.html +1 -1
- package/docs/functions/liquidityToTokens.html +1 -1
- package/docs/functions/multiLiquidityToTokens.html +1 -1
- package/docs/functions/multiTokensToUsd.html +1 -1
- package/docs/functions/multiXTokensToLiquidity.html +1 -1
- package/docs/functions/parseUserWalletData.html +1 -1
- package/docs/functions/pendingBlueRewardAmount.html +1 -1
- package/docs/functions/setCustomSuiClient.html +2 -2
- package/docs/functions/setSuiClient.html +2 -2
- package/docs/functions/setSuiNodeUrl.html +2 -2
- package/docs/functions/setWeights.html +1 -1
- package/docs/functions/withdraw.html +1 -1
- package/docs/functions/withdrawAlphaTxb.html +1 -1
- package/docs/functions/withdrawTxb.html +1 -1
- package/docs/functions/zapDepositTxb.html +1 -1
- package/docs/index.html +2 -2
- package/docs/interfaces/Coin.html +6 -6
- package/docs/interfaces/CoinPair.html +2 -2
- package/docs/interfaces/NaviVoloData.html +2 -2
- package/docs/interfaces/PoolData.html +2 -2
- package/docs/interfaces/PoolWeightDistribution.html +2 -2
- package/docs/interfaces/RebalanceHistoryType.html +2 -2
- package/docs/modules.html +3 -2
- package/docs/types/AfterTransactionEventNode.html +1 -1
- package/docs/types/Allocator.html +1 -1
- package/docs/types/AlphaFiDoubleAssetVault.html +1 -1
- package/docs/types/AlphaFiMultiVaultBalance.html +1 -1
- package/docs/types/AlphaFiSingleAssetVault.html +1 -1
- package/docs/types/AlphaFiVault.html +1 -1
- package/docs/types/AlphaFiVaultBalance.html +1 -1
- package/docs/types/AlphaPoolType.html +1 -1
- package/docs/types/AlphaReceipt.html +1 -1
- package/docs/types/AlphaReceiptFields.html +1 -1
- package/docs/types/AlphaVaultBalance.html +1 -1
- package/docs/types/AutoBalancePoolNames.html +1 -1
- package/docs/types/AutoCompoundingEventNode.html +1 -1
- package/docs/types/BluefinInvestor.html +1 -1
- package/docs/types/BluefinPoolType.html +1 -1
- package/docs/types/BucketInvestor.html +1 -1
- package/docs/types/CetusInvestor.html +1 -1
- package/docs/types/CetusPoolType.html +1 -1
- package/docs/types/CetusSwapOptions.html +1 -1
- package/docs/types/CoinAmounts.html +1 -1
- package/docs/types/CoinName.html +1 -1
- package/docs/types/CoinType.html +1 -1
- package/docs/types/CommonInvestorFields.html +1 -1
- package/docs/types/CreatePoolOptions.html +1 -1
- package/docs/types/Distributor.html +1 -1
- package/docs/types/DoubleAssetMultiVaultBalance.html +1 -1
- package/docs/types/DoubleAssetPoolNames.html +1 -1
- package/docs/types/DoubleAssetTokenHoldings.html +1 -1
- package/docs/types/DoubleAssetVaultBalance.html +1 -1
- package/docs/types/EventCategory.html +1 -1
- package/docs/types/EventNode.html +1 -1
- package/docs/types/GetHoldersParams.html +1 -1
- package/docs/types/GetTokenHoldingsParams.html +1 -1
- package/docs/types/GetUserTokensFromTransactionsParams.html +1 -1
- package/docs/types/GetUserTokensInUsdFromTransactionsParams.html +1 -1
- package/docs/types/GetVaultBalanceForActiveUsersParams.html +1 -1
- package/docs/types/GetVaultBalanceParams.html +1 -1
- package/docs/types/HoldingsObj.html +1 -1
- package/docs/types/Icon.html +1 -1
- package/docs/types/Investor.html +1 -1
- package/docs/types/LiquidityChangeEventNode.html +1 -1
- package/docs/types/LiquidityToTokensParams.html +1 -1
- package/docs/types/LiquidityToUsdParams.html +1 -1
- package/docs/types/LoopingDebt.html +1 -1
- package/docs/types/LoopingPoolNames.html +1 -1
- package/docs/types/LpBreakdownType.html +1 -1
- package/docs/types/MemberPoolDataType.html +1 -1
- package/docs/types/MemberType.html +1 -1
- package/docs/types/MultiGetVaultBalancesParams.html +1 -1
- package/docs/types/NaviInvestor.html +1 -1
- package/docs/types/OtherReceiptFields.html +1 -1
- package/docs/types/PoolName.html +1 -1
- package/docs/types/PoolReceipt.html +1 -1
- package/docs/types/PoolType.html +1 -1
- package/docs/types/Receipt.html +1 -1
- package/docs/types/ReceiptGQL.html +1 -1
- package/docs/types/SingleAssetMultiVaultBalance.html +1 -1
- package/docs/types/SingleAssetPoolNames.html +1 -1
- package/docs/types/SingleAssetTokenHoldings.html +1 -1
- package/docs/types/SingleAssetVaultBalance.html +1 -1
- package/docs/types/SingleGetVaultBalancesParams.html +1 -1
- package/docs/types/StrategyType.html +1 -1
- package/docs/types/SuiNetwork.html +1 -1
- package/docs/types/SwapOptions.html +1 -1
- package/docs/types/TickSpacing.html +1 -1
- package/docs/types/TotalWeightType.html +1 -1
- package/docs/types/TransactionBlockType.html +1 -1
- package/docs/types/UserPoolLiquidity.html +1 -1
- package/docs/types/UserPoolTokenHoldings.html +1 -1
- package/docs/types/UserUsdHoldings.html +1 -1
- package/docs/types/VaultBalance.html +1 -1
- package/docs/types/WithdrawV2EventNode.html +1 -1
- package/docs/variables/bluefinPoolMap.html +1 -1
- package/docs/variables/cetusPoolMap.html +1 -1
- package/docs/variables/coinsList.html +1 -1
- package/docs/variables/defunctPoolsSet.html +1 -1
- package/docs/variables/doubleAssetPoolCoinMap.html +1 -1
- package/docs/variables/eventCategories.html +1 -1
- package/docs/variables/ignoredWalletsForDailyRevenue.html +1 -1
- package/docs/variables/loopingAccountAddresses.html +1 -1
- package/docs/variables/loopingPoolCoinMap.html +1 -1
- package/docs/variables/naviAssetMap.html +1 -1
- package/docs/variables/poolIdPoolNameMap.html +1 -1
- package/docs/variables/poolInfo.html +1 -1
- package/docs/variables/singleAssetPoolCoinMap.html +1 -1
- package/docs/variables/stableCoins.html +1 -1
- package/package.json +6 -4
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { Transaction } from "@mysten/sui/transactions";
|
|
2
2
|
import { getConf } from "../common/constants.js";
|
|
3
3
|
import { getSuiClient } from "../sui-sdk/client.js";
|
|
4
|
-
import { cetusPoolMap, poolInfo, singleAssetPoolCoinMap, } from "../common/maps.js";
|
|
4
|
+
import { cetusPoolMap, loopingAccountAddresses, loopingPoolCoinMap, naviPriceFeedMap, poolInfo, singleAssetPoolCoinMap, } from "../common/maps.js";
|
|
5
5
|
import { coinsList } from "../common/coins.js";
|
|
6
6
|
import { getReceipts } from "../sui-sdk/functions/getReceipts.js";
|
|
7
|
+
import { updateSingleTokenPrice } from "./naviOracle.js";
|
|
8
|
+
import { getAvailableRewards } from "navi-sdk/dist/libs/PTB/V3.js";
|
|
7
9
|
export async function loopingDeposit(poolName, amount, options) {
|
|
8
10
|
let txb = new Transaction();
|
|
11
|
+
updateSingleTokenPrice(naviPriceFeedMap[loopingPoolCoinMap[poolName].supplyCoin].pythPriceInfo, naviPriceFeedMap[loopingPoolCoinMap[poolName].supplyCoin].feedId, txb);
|
|
12
|
+
updateSingleTokenPrice(naviPriceFeedMap[loopingPoolCoinMap[poolName].borrowCoin].pythPriceInfo, naviPriceFeedMap[loopingPoolCoinMap[poolName].borrowCoin].feedId, txb);
|
|
9
13
|
if (poolName === "NAVI-LOOP-HASUI-SUI") {
|
|
10
14
|
txb = await naviHasuiSuiLoopDepositTx(amount, options);
|
|
11
15
|
}
|
|
@@ -25,6 +29,8 @@ export async function loopingDeposit(poolName, amount, options) {
|
|
|
25
29
|
}
|
|
26
30
|
export async function loopingWithdraw(poolName, xTokens, options) {
|
|
27
31
|
let txb = new Transaction();
|
|
32
|
+
updateSingleTokenPrice(naviPriceFeedMap[loopingPoolCoinMap[poolName].supplyCoin].pythPriceInfo, naviPriceFeedMap[loopingPoolCoinMap[poolName].supplyCoin].feedId, txb);
|
|
33
|
+
updateSingleTokenPrice(naviPriceFeedMap[loopingPoolCoinMap[poolName].borrowCoin].pythPriceInfo, naviPriceFeedMap[loopingPoolCoinMap[poolName].borrowCoin].feedId, txb);
|
|
28
34
|
if (poolName === "NAVI-LOOP-HASUI-SUI") {
|
|
29
35
|
txb = await naviHasuiSuiLoopWithdrawTx(xTokens, options);
|
|
30
36
|
}
|
|
@@ -47,7 +53,8 @@ export async function naviHasuiSuiLoopDepositTx(amount, options) {
|
|
|
47
53
|
const suiClient = getSuiClient();
|
|
48
54
|
const address = options.address;
|
|
49
55
|
const txb = new Transaction();
|
|
50
|
-
const
|
|
56
|
+
const poolName = "NAVI-LOOP-HASUI-SUI";
|
|
57
|
+
const poolData = poolInfo[poolName];
|
|
51
58
|
const receipt = await getReceipts("NAVI-LOOP-HASUI-SUI", address, true);
|
|
52
59
|
let coins = [];
|
|
53
60
|
let currentCursor = null;
|
|
@@ -87,9 +94,102 @@ export async function naviHasuiSuiLoopDepositTx(amount, options) {
|
|
|
87
94
|
arguments: [txb.object(receipt[0].objectId)],
|
|
88
95
|
});
|
|
89
96
|
}
|
|
97
|
+
const claimableRewards = await getAvailableRewards(getSuiClient(), loopingAccountAddresses[poolName]);
|
|
98
|
+
const rewardCoinSet = new Set();
|
|
99
|
+
if (claimableRewards) {
|
|
100
|
+
for (const reward of claimableRewards[coinsList[loopingPoolCoinMap[poolName].supplyCoin].type.substring(2)]
|
|
101
|
+
? claimableRewards[coinsList[loopingPoolCoinMap[poolName].supplyCoin].type.substring(2)]
|
|
102
|
+
: []) {
|
|
103
|
+
if (rewardCoinSet.has(reward.reward_coin_type) === false) {
|
|
104
|
+
if (reward.reward_coin_type === coinsList["NAVX"].type.substring(2)) {
|
|
105
|
+
txb.moveCall({
|
|
106
|
+
target: `${poolData.packageId}::alphafi_navi_hasui_sui_investor::collect_reward_with_two_swaps`,
|
|
107
|
+
typeArguments: [coinsList["NAVX"].type],
|
|
108
|
+
arguments: [
|
|
109
|
+
txb.object(poolData.investorId),
|
|
110
|
+
txb.object(C.ALPHA_2_VERSION),
|
|
111
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
112
|
+
txb.object(C.NAVI_STORAGE),
|
|
113
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
114
|
+
txb.object(C.NAVI_NAVX_REWARDS_POOL),
|
|
115
|
+
txb.object(C.HAEDEL_STAKING),
|
|
116
|
+
txb.object(C.SUI_SYSTEM_STATE),
|
|
117
|
+
txb.object(cetusPoolMap[`NAVX-SUI`]),
|
|
118
|
+
txb.object(cetusPoolMap[`HASUI-SUI`]),
|
|
119
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
120
|
+
],
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
else if (reward.reward_coin_type === coinsList["VSUI"].type.substring(2)) {
|
|
124
|
+
txb.moveCall({
|
|
125
|
+
target: `${poolData.packageId}::alphafi_navi_hasui_sui_investor::collect_reward_with_two_swaps`,
|
|
126
|
+
typeArguments: [coinsList["VSUI"].type],
|
|
127
|
+
arguments: [
|
|
128
|
+
txb.object(poolData.investorId),
|
|
129
|
+
txb.object(C.ALPHA_2_VERSION),
|
|
130
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
131
|
+
txb.object(C.NAVI_STORAGE),
|
|
132
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
133
|
+
txb.object(C.NAVI_VSUI_REWARDS_POOL),
|
|
134
|
+
txb.object(C.HAEDEL_STAKING),
|
|
135
|
+
txb.object(C.SUI_SYSTEM_STATE),
|
|
136
|
+
txb.object(cetusPoolMap[`VSUI-SUI`]),
|
|
137
|
+
txb.object(cetusPoolMap[`HASUI-SUI`]),
|
|
138
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
139
|
+
],
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
rewardCoinSet.add(reward.reward_coin_type);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
for (const reward of claimableRewards["0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"]
|
|
146
|
+
? claimableRewards["0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"]
|
|
147
|
+
: []) {
|
|
148
|
+
if (rewardCoinSet.has(reward.reward_coin_type) === false) {
|
|
149
|
+
if (reward.reward_coin_type === coinsList["NAVX"].type.substring(2)) {
|
|
150
|
+
txb.moveCall({
|
|
151
|
+
target: `${poolData.packageId}::alphafi_navi_hasui_sui_investor::collect_reward_with_two_swaps`,
|
|
152
|
+
typeArguments: [coinsList["NAVX"].type],
|
|
153
|
+
arguments: [
|
|
154
|
+
txb.object(poolData.investorId),
|
|
155
|
+
txb.object(C.ALPHA_2_VERSION),
|
|
156
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
157
|
+
txb.object(C.NAVI_STORAGE),
|
|
158
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
159
|
+
txb.object(C.NAVI_NAVX_REWARDS_POOL),
|
|
160
|
+
txb.object(C.HAEDEL_STAKING),
|
|
161
|
+
txb.object(C.SUI_SYSTEM_STATE),
|
|
162
|
+
txb.object(cetusPoolMap[`NAVX-SUI`]),
|
|
163
|
+
txb.object(cetusPoolMap[`HASUI-SUI`]),
|
|
164
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
165
|
+
],
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
else if (reward.reward_coin_type === coinsList["VSUI"].type.substring(2)) {
|
|
169
|
+
txb.moveCall({
|
|
170
|
+
target: `${poolData.packageId}::alphafi_navi_hasui_sui_investor::collect_reward_with_two_swaps`,
|
|
171
|
+
typeArguments: [coinsList["VSUI"].type],
|
|
172
|
+
arguments: [
|
|
173
|
+
txb.object(poolData.investorId),
|
|
174
|
+
txb.object(C.ALPHA_2_VERSION),
|
|
175
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
176
|
+
txb.object(C.NAVI_STORAGE),
|
|
177
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
178
|
+
txb.object(C.NAVI_VSUI_REWARDS_POOL),
|
|
179
|
+
txb.object(C.HAEDEL_STAKING),
|
|
180
|
+
txb.object(C.SUI_SYSTEM_STATE),
|
|
181
|
+
txb.object(cetusPoolMap[`VSUI-SUI`]),
|
|
182
|
+
txb.object(cetusPoolMap[`HASUI-SUI`]),
|
|
183
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
184
|
+
],
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
rewardCoinSet.add(reward.reward_coin_type);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
90
191
|
txb.moveCall({
|
|
91
|
-
target: `${poolData.packageId}::alphafi_navi_hasui_sui_pool::
|
|
92
|
-
typeArguments: [C.NAVX_COIN_TYPE],
|
|
192
|
+
target: `${poolData.packageId}::alphafi_navi_hasui_sui_pool::user_deposit_v2`, // change package id for testing
|
|
93
193
|
arguments: [
|
|
94
194
|
txb.object(C.ALPHA_2_VERSION), // change version object id for testing
|
|
95
195
|
txb.object(C.VERSION),
|
|
@@ -102,13 +202,9 @@ export async function naviHasuiSuiLoopDepositTx(amount, options) {
|
|
|
102
202
|
txb.object(C.NAVI_STORAGE),
|
|
103
203
|
txb.object(C.NAVI_HASUI_POOL),
|
|
104
204
|
txb.object(C.NAVI_SUI_POOL),
|
|
105
|
-
txb.object(C.
|
|
205
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
106
206
|
txb.object(C.NAVI_INCENTIVE_V2),
|
|
107
|
-
txb.object(C.NAVI_NAVX_FUNDS_POOL),
|
|
108
|
-
txb.object(C.NAVI_VSUI_FUNDS_POOL),
|
|
109
207
|
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
110
|
-
txb.object(cetusPoolMap["NAVX-SUI"]),
|
|
111
|
-
txb.object(cetusPoolMap["VSUI-SUI"]),
|
|
112
208
|
txb.object(cetusPoolMap["HASUI-SUI"]),
|
|
113
209
|
txb.object(C.HAEDEL_STAKING),
|
|
114
210
|
txb.object(C.SUI_SYSTEM_STATE),
|
|
@@ -126,8 +222,9 @@ export async function naviSuiVsuiLoopDepositTx(amount, options) {
|
|
|
126
222
|
const C = await getConf();
|
|
127
223
|
const address = options.address;
|
|
128
224
|
const txb = new Transaction();
|
|
129
|
-
const
|
|
130
|
-
const
|
|
225
|
+
const poolName = "NAVI-LOOP-SUI-VSUI";
|
|
226
|
+
const poolData = poolInfo[poolName];
|
|
227
|
+
const receipt = await getReceipts(poolName, address, true);
|
|
131
228
|
let someReceipt;
|
|
132
229
|
if (receipt.length == 0) {
|
|
133
230
|
[someReceipt] = txb.moveCall({
|
|
@@ -144,9 +241,94 @@ export async function naviSuiVsuiLoopDepositTx(amount, options) {
|
|
|
144
241
|
});
|
|
145
242
|
}
|
|
146
243
|
const [depositCoin] = txb.splitCoins(txb.gas, [amount]);
|
|
244
|
+
const claimableRewards = await getAvailableRewards(getSuiClient(), loopingAccountAddresses[poolName]);
|
|
245
|
+
console.log(JSON.stringify(claimableRewards, null, 2));
|
|
246
|
+
const rewardCoinSet = new Set();
|
|
247
|
+
if (claimableRewards) {
|
|
248
|
+
for (const reward of claimableRewards[coinsList[loopingPoolCoinMap[poolName].supplyCoin].type.substring(2)]
|
|
249
|
+
? claimableRewards[coinsList[loopingPoolCoinMap[poolName].supplyCoin].type.substring(2)]
|
|
250
|
+
: []) {
|
|
251
|
+
if (rewardCoinSet.has(reward.reward_coin_type) === false) {
|
|
252
|
+
if (reward.reward_coin_type === coinsList["NAVX"].type.substring(2)) {
|
|
253
|
+
rewardCoinSet.add(reward.reward_coin_type);
|
|
254
|
+
txb.moveCall({
|
|
255
|
+
target: `${poolData.packageId}::alphafi_navi_sui_vsui_investor::collect_reward_with_two_swaps`,
|
|
256
|
+
typeArguments: [coinsList["NAVX"].type],
|
|
257
|
+
arguments: [
|
|
258
|
+
txb.object(poolData.investorId),
|
|
259
|
+
txb.object(C.ALPHA_2_VERSION),
|
|
260
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
261
|
+
txb.object(C.NAVI_STORAGE),
|
|
262
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
263
|
+
txb.object(C.NAVI_NAVX_REWARDS_POOL),
|
|
264
|
+
txb.object(C.VOLO_NATIVE_POOL),
|
|
265
|
+
txb.object(C.VOLO_METADATA),
|
|
266
|
+
txb.object(C.SUI_SYSTEM_STATE),
|
|
267
|
+
txb.object(cetusPoolMap[`NAVX-SUI`]),
|
|
268
|
+
txb.object(cetusPoolMap[`VSUI-SUI`]),
|
|
269
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
270
|
+
],
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
else if (reward.reward_coin_type === coinsList["VSUI"].type.substring(2)) {
|
|
274
|
+
txb.moveCall({
|
|
275
|
+
target: `${poolData.packageId}::alphafi_navi_sui_vsui_investor::collect_reward_with_no_swap`,
|
|
276
|
+
arguments: [
|
|
277
|
+
txb.object(poolData.investorId),
|
|
278
|
+
txb.object(C.ALPHA_2_VERSION),
|
|
279
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
280
|
+
txb.object(C.NAVI_STORAGE),
|
|
281
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
282
|
+
txb.object(C.NAVI_VSUI_REWARDS_POOL),
|
|
283
|
+
],
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
rewardCoinSet.add(reward.reward_coin_type);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
for (const reward of claimableRewards["0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"]
|
|
290
|
+
? claimableRewards["0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"]
|
|
291
|
+
: []) {
|
|
292
|
+
if (rewardCoinSet.has(reward.reward_coin_type) === false) {
|
|
293
|
+
if (reward.reward_coin_type === coinsList["NAVX"].type.substring(2)) {
|
|
294
|
+
txb.moveCall({
|
|
295
|
+
target: `${poolData.packageId}::alphafi_navi_sui_vsui_investor::collect_reward_with_two_swaps`,
|
|
296
|
+
typeArguments: [coinsList["NAVX"].type],
|
|
297
|
+
arguments: [
|
|
298
|
+
txb.object(poolData.investorId),
|
|
299
|
+
txb.object(C.ALPHA_2_VERSION),
|
|
300
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
301
|
+
txb.object(C.NAVI_STORAGE),
|
|
302
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
303
|
+
txb.object(C.NAVI_NAVX_REWARDS_POOL),
|
|
304
|
+
txb.object(C.VOLO_NATIVE_POOL),
|
|
305
|
+
txb.object(C.VOLO_METADATA),
|
|
306
|
+
txb.object(C.SUI_SYSTEM_STATE),
|
|
307
|
+
txb.object(cetusPoolMap[`NAVX-SUI`]),
|
|
308
|
+
txb.object(cetusPoolMap[`VSUI-SUI`]),
|
|
309
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
310
|
+
],
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
else if (reward.reward_coin_type === coinsList["VSUI"].type.substring(2)) {
|
|
314
|
+
txb.moveCall({
|
|
315
|
+
target: `${poolData.packageId}::alphafi_navi_sui_vsui_investor::collect_reward_with_no_swap`,
|
|
316
|
+
arguments: [
|
|
317
|
+
txb.object(poolData.investorId),
|
|
318
|
+
txb.object(C.ALPHA_2_VERSION),
|
|
319
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
320
|
+
txb.object(C.NAVI_STORAGE),
|
|
321
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
322
|
+
txb.object(C.NAVI_VSUI_REWARDS_POOL),
|
|
323
|
+
],
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
rewardCoinSet.add(reward.reward_coin_type);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
147
330
|
txb.moveCall({
|
|
148
|
-
target: `${poolData.packageId}::alphafi_navi_sui_vsui_pool::
|
|
149
|
-
typeArguments: [coinsList["NAVX"].type],
|
|
331
|
+
target: `${poolData.packageId}::alphafi_navi_sui_vsui_pool::user_deposit_v2`,
|
|
150
332
|
arguments: [
|
|
151
333
|
txb.object(C.ALPHA_2_VERSION),
|
|
152
334
|
txb.object(C.VERSION),
|
|
@@ -159,12 +341,9 @@ export async function naviSuiVsuiLoopDepositTx(amount, options) {
|
|
|
159
341
|
txb.object(C.NAVI_STORAGE),
|
|
160
342
|
txb.object(C.NAVI_VSUI_POOL),
|
|
161
343
|
txb.object(C.NAVI_SUI_POOL),
|
|
162
|
-
txb.object(C.
|
|
344
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
163
345
|
txb.object(C.NAVI_INCENTIVE_V2),
|
|
164
|
-
txb.object(C.NAVI_NAVX_FUNDS_POOL),
|
|
165
|
-
txb.object(C.NAVI_VSUI_FUNDS_POOL),
|
|
166
346
|
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
167
|
-
txb.object(cetusPoolMap["NAVX-SUI"]),
|
|
168
347
|
txb.object(cetusPoolMap["VSUI-SUI"]),
|
|
169
348
|
txb.object(C.VOLO_NATIVE_POOL),
|
|
170
349
|
txb.object(C.VOLO_METADATA),
|
|
@@ -180,8 +359,9 @@ export async function naviSuiStsuiLoopDepositTx(amount, options) {
|
|
|
180
359
|
const C = getConf();
|
|
181
360
|
const address = options.address;
|
|
182
361
|
const txb = new Transaction();
|
|
183
|
-
const
|
|
184
|
-
const
|
|
362
|
+
const poolName = "NAVI-LOOP-SUI-STSUI";
|
|
363
|
+
const poolData = poolInfo[poolName];
|
|
364
|
+
const receipt = await getReceipts(poolName, address, true);
|
|
185
365
|
let someReceipt;
|
|
186
366
|
if (receipt.length == 0) {
|
|
187
367
|
[someReceipt] = txb.moveCall({
|
|
@@ -198,9 +378,98 @@ export async function naviSuiStsuiLoopDepositTx(amount, options) {
|
|
|
198
378
|
});
|
|
199
379
|
}
|
|
200
380
|
const [depositCoin] = txb.splitCoins(txb.gas, [amount]);
|
|
381
|
+
const claimableRewards = await getAvailableRewards(getSuiClient(), loopingAccountAddresses[poolName]);
|
|
382
|
+
const rewardCoinSet = new Set();
|
|
383
|
+
if (claimableRewards) {
|
|
384
|
+
for (const reward of claimableRewards[coinsList[loopingPoolCoinMap[poolName].supplyCoin].type.substring(2)]
|
|
385
|
+
? claimableRewards[coinsList[loopingPoolCoinMap[poolName].supplyCoin].type.substring(2)]
|
|
386
|
+
: []) {
|
|
387
|
+
if (rewardCoinSet.has(reward.reward_coin_type) === false) {
|
|
388
|
+
if (reward.reward_coin_type === coinsList["NAVX"].type.substring(2)) {
|
|
389
|
+
txb.moveCall({
|
|
390
|
+
target: `${poolData.packageId}::alphafi_navi_sui_stsui_pool::collect_v3_rewards_with_two_swaps`,
|
|
391
|
+
typeArguments: [coinsList["NAVX"].type],
|
|
392
|
+
arguments: [
|
|
393
|
+
txb.object(C.ALPHA_5_VERSION),
|
|
394
|
+
txb.object(poolData.investorId),
|
|
395
|
+
txb.object(C.NAVI_STORAGE),
|
|
396
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
397
|
+
txb.object(C.NAVI_NAVX_REWARDS_POOL),
|
|
398
|
+
txb.object(C.LST_INFO),
|
|
399
|
+
txb.object(C.SUI_SYSTEM_STATE),
|
|
400
|
+
txb.object(cetusPoolMap[`NAVX-SUI`]),
|
|
401
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
402
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
403
|
+
],
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
else if (reward.reward_coin_type === coinsList["VSUI"].type.substring(2)) {
|
|
407
|
+
txb.moveCall({
|
|
408
|
+
target: `${poolData.packageId}::alphafi_navi_sui_stsui_pool::collect_v3_rewards_with_two_swaps`,
|
|
409
|
+
typeArguments: [coinsList["VSUI"].type],
|
|
410
|
+
arguments: [
|
|
411
|
+
txb.object(C.ALPHA_5_VERSION),
|
|
412
|
+
txb.object(poolData.investorId),
|
|
413
|
+
txb.object(C.NAVI_STORAGE),
|
|
414
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
415
|
+
txb.object(C.NAVI_VSUI_REWARDS_POOL),
|
|
416
|
+
txb.object(C.LST_INFO),
|
|
417
|
+
txb.object(C.SUI_SYSTEM_STATE),
|
|
418
|
+
txb.object(cetusPoolMap[`VSUI-SUI`]),
|
|
419
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
420
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
421
|
+
],
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
rewardCoinSet.add(reward.reward_coin_type);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
for (const reward of claimableRewards["0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"]
|
|
428
|
+
? claimableRewards["0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"]
|
|
429
|
+
: []) {
|
|
430
|
+
if (rewardCoinSet.has(reward.reward_coin_type) === false) {
|
|
431
|
+
if (reward.reward_coin_type === coinsList["NAVX"].type.substring(2)) {
|
|
432
|
+
txb.moveCall({
|
|
433
|
+
target: `${poolData.packageId}::alphafi_navi_sui_stsui_pool::collect_v3_rewards_with_two_swaps`,
|
|
434
|
+
typeArguments: [coinsList["NAVX"].type],
|
|
435
|
+
arguments: [
|
|
436
|
+
txb.object(C.ALPHA_5_VERSION),
|
|
437
|
+
txb.object(poolData.investorId),
|
|
438
|
+
txb.object(C.NAVI_STORAGE),
|
|
439
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
440
|
+
txb.object(C.NAVI_NAVX_REWARDS_POOL),
|
|
441
|
+
txb.object(C.LST_INFO),
|
|
442
|
+
txb.object(C.SUI_SYSTEM_STATE),
|
|
443
|
+
txb.object(cetusPoolMap[`NAVX-SUI`]),
|
|
444
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
445
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
446
|
+
],
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
else if (reward.reward_coin_type === coinsList["VSUI"].type.substring(2)) {
|
|
450
|
+
txb.moveCall({
|
|
451
|
+
target: `${poolData.packageId}::alphafi_navi_sui_stsui_pool::collect_v3_rewards_with_two_swaps`,
|
|
452
|
+
typeArguments: [coinsList["VSUI"].type],
|
|
453
|
+
arguments: [
|
|
454
|
+
txb.object(C.ALPHA_5_VERSION),
|
|
455
|
+
txb.object(poolData.investorId),
|
|
456
|
+
txb.object(C.NAVI_STORAGE),
|
|
457
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
458
|
+
txb.object(C.NAVI_VSUI_REWARDS_POOL),
|
|
459
|
+
txb.object(C.LST_INFO),
|
|
460
|
+
txb.object(C.SUI_SYSTEM_STATE),
|
|
461
|
+
txb.object(cetusPoolMap[`VSUI-SUI`]),
|
|
462
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
463
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
464
|
+
],
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
rewardCoinSet.add(reward.reward_coin_type);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
}
|
|
201
471
|
txb.moveCall({
|
|
202
|
-
target: `${poolData.packageId}::alphafi_navi_sui_stsui_pool::
|
|
203
|
-
typeArguments: [coinsList["NAVX"].type],
|
|
472
|
+
target: `${poolData.packageId}::alphafi_navi_sui_stsui_pool::user_deposit_v2`,
|
|
204
473
|
arguments: [
|
|
205
474
|
txb.object(C.ALPHA_5_VERSION),
|
|
206
475
|
txb.object(C.VERSION),
|
|
@@ -213,16 +482,10 @@ export async function naviSuiStsuiLoopDepositTx(amount, options) {
|
|
|
213
482
|
txb.object(C.NAVI_STORAGE),
|
|
214
483
|
txb.object(C.NAVI_STSUI_POOL),
|
|
215
484
|
txb.object(C.NAVI_SUI_POOL),
|
|
216
|
-
txb.object(C.
|
|
485
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
217
486
|
txb.object(C.NAVI_INCENTIVE_V2),
|
|
218
|
-
txb.object(C.NAVI_NAVX_FUNDS_POOL),
|
|
219
|
-
txb.object(C.NAVI_VSUI_FUNDS_POOL),
|
|
220
|
-
txb.object(C.NAVI_STSUI_FUNDS_POOL),
|
|
221
487
|
txb.object(C.LST_INFO),
|
|
222
488
|
txb.object(C.SUI_SYSTEM_STATE),
|
|
223
|
-
txb.object(cetusPoolMap["NAVX-SUI"]),
|
|
224
|
-
txb.object(cetusPoolMap["VSUI-SUI"]),
|
|
225
|
-
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
226
489
|
txb.object(C.CLOCK_PACKAGE_ID),
|
|
227
490
|
],
|
|
228
491
|
});
|
|
@@ -233,6 +496,7 @@ export async function naviUsdcUsdtLoopDepositTx(amount, options) {
|
|
|
233
496
|
const suiClient = getSuiClient();
|
|
234
497
|
const address = options.address;
|
|
235
498
|
const txb = new Transaction();
|
|
499
|
+
const poolName = "NAVI-LOOP-USDC-USDT";
|
|
236
500
|
const poolData = poolInfo["NAVI-LOOP-USDC-USDT"];
|
|
237
501
|
const receipt = await getReceipts("NAVI-LOOP-USDC-USDT", address, true);
|
|
238
502
|
let coins = [];
|
|
@@ -273,6 +537,92 @@ export async function naviUsdcUsdtLoopDepositTx(amount, options) {
|
|
|
273
537
|
arguments: [txb.object(receipt[0].objectId)],
|
|
274
538
|
});
|
|
275
539
|
}
|
|
540
|
+
const claimableRewards = await getAvailableRewards(getSuiClient(), loopingAccountAddresses[poolName]);
|
|
541
|
+
const rewardCoinSet = new Set();
|
|
542
|
+
if (claimableRewards) {
|
|
543
|
+
for (const reward of claimableRewards[coinsList[loopingPoolCoinMap[poolName].supplyCoin].type.substring(2)]
|
|
544
|
+
? claimableRewards[coinsList[loopingPoolCoinMap[poolName].supplyCoin].type.substring(2)]
|
|
545
|
+
: []) {
|
|
546
|
+
if (rewardCoinSet.has(reward.reward_coin_type) === false) {
|
|
547
|
+
if (reward.reward_coin_type === coinsList["NAVX"].type.substring(2)) {
|
|
548
|
+
txb.moveCall({
|
|
549
|
+
target: `${poolData.packageId}::alphafi_navi_native_usdc_usdt_pool::collect_reward_with_two_swaps`,
|
|
550
|
+
typeArguments: [coinsList["NAVX"].type],
|
|
551
|
+
arguments: [
|
|
552
|
+
txb.object(poolData.investorId),
|
|
553
|
+
txb.object(C.ALPHA_2_VERSION),
|
|
554
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
555
|
+
txb.object(C.NAVI_STORAGE),
|
|
556
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
557
|
+
txb.object(C.NAVI_NAVX_REWARDS_POOL),
|
|
558
|
+
txb.object(cetusPoolMap[`NAVX-SUI`]),
|
|
559
|
+
txb.object(cetusPoolMap[`USDC-SUI`]),
|
|
560
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
561
|
+
],
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
else if (reward.reward_coin_type === coinsList["VSUI"].type.substring(2)) {
|
|
565
|
+
txb.moveCall({
|
|
566
|
+
target: `${poolData.packageId}::alphafi_navi_native_usdc_usdt_pool::collect_reward_with_two_swaps`,
|
|
567
|
+
typeArguments: [coinsList["VSUI"].type],
|
|
568
|
+
arguments: [
|
|
569
|
+
txb.object(poolData.investorId),
|
|
570
|
+
txb.object(C.ALPHA_2_VERSION),
|
|
571
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
572
|
+
txb.object(C.NAVI_STORAGE),
|
|
573
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
574
|
+
txb.object(C.NAVI_VSUI_REWARDS_POOL),
|
|
575
|
+
txb.object(cetusPoolMap[`VSUI-SUI`]),
|
|
576
|
+
txb.object(cetusPoolMap[`USDC-SUI`]),
|
|
577
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
578
|
+
],
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
rewardCoinSet.add(reward.reward_coin_type);
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
for (const reward of claimableRewards[coinsList[loopingPoolCoinMap[poolName].borrowCoin].type.substring(2)]
|
|
585
|
+
? claimableRewards[coinsList[loopingPoolCoinMap[poolName].borrowCoin].type.substring(2)]
|
|
586
|
+
: []) {
|
|
587
|
+
if (rewardCoinSet.has(reward.reward_coin_type) === false) {
|
|
588
|
+
if (reward.reward_coin_type === coinsList["NAVX"].type.substring(2)) {
|
|
589
|
+
txb.moveCall({
|
|
590
|
+
target: `${poolData.packageId}::alphafi_navi_native_usdc_usdt_pool::collect_reward_with_two_swaps`,
|
|
591
|
+
typeArguments: [coinsList["NAVX"].type],
|
|
592
|
+
arguments: [
|
|
593
|
+
txb.object(poolData.investorId),
|
|
594
|
+
txb.object(C.ALPHA_2_VERSION),
|
|
595
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
596
|
+
txb.object(C.NAVI_STORAGE),
|
|
597
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
598
|
+
txb.object(C.NAVI_NAVX_REWARDS_POOL),
|
|
599
|
+
txb.object(cetusPoolMap[`NAVX-SUI`]),
|
|
600
|
+
txb.object(cetusPoolMap[`USDC-SUI`]),
|
|
601
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
602
|
+
],
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
else if (reward.reward_coin_type === coinsList["VSUI"].type.substring(2)) {
|
|
606
|
+
txb.moveCall({
|
|
607
|
+
target: `${poolData.packageId}::alphafi_navi_native_usdc_usdt_pool::collect_reward_with_two_swaps`,
|
|
608
|
+
typeArguments: [coinsList["VSUI"].type],
|
|
609
|
+
arguments: [
|
|
610
|
+
txb.object(poolData.investorId),
|
|
611
|
+
txb.object(C.ALPHA_2_VERSION),
|
|
612
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
613
|
+
txb.object(C.NAVI_STORAGE),
|
|
614
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
615
|
+
txb.object(C.NAVI_VSUI_REWARDS_POOL),
|
|
616
|
+
txb.object(cetusPoolMap[`VSUI-SUI`]),
|
|
617
|
+
txb.object(cetusPoolMap[`USDC-SUI`]),
|
|
618
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
619
|
+
],
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
rewardCoinSet.add(reward.reward_coin_type);
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
}
|
|
276
626
|
txb.moveCall({
|
|
277
627
|
target: `${poolData.packageId}::alphafi_navi_native_usdc_usdt_pool::user_deposit_v2`,
|
|
278
628
|
arguments: [
|
|
@@ -392,6 +742,7 @@ export async function naviHasuiSuiLoopWithdrawTx(xTokens, options) {
|
|
|
392
742
|
const C = await getConf();
|
|
393
743
|
const address = options.address;
|
|
394
744
|
const txb = new Transaction();
|
|
745
|
+
const poolName = "NAVI-LOOP-HASUI-SUI";
|
|
395
746
|
const poolData = poolInfo["NAVI-LOOP-HASUI-SUI"];
|
|
396
747
|
const receipt = await getReceipts("NAVI-LOOP-HASUI-SUI", address, true);
|
|
397
748
|
const alphaReceipt = await getReceipts("ALPHA", address, true);
|
|
@@ -411,9 +762,102 @@ export async function naviHasuiSuiLoopWithdrawTx(xTokens, options) {
|
|
|
411
762
|
arguments: [txb.object(alphaReceipt[0].objectId)],
|
|
412
763
|
});
|
|
413
764
|
}
|
|
765
|
+
const claimableRewards = await getAvailableRewards(getSuiClient(), loopingAccountAddresses[poolName]);
|
|
766
|
+
const rewardCoinSet = new Set();
|
|
767
|
+
if (claimableRewards) {
|
|
768
|
+
for (const reward of claimableRewards[coinsList[loopingPoolCoinMap[poolName].supplyCoin].type.substring(2)]
|
|
769
|
+
? claimableRewards[coinsList[loopingPoolCoinMap[poolName].supplyCoin].type.substring(2)]
|
|
770
|
+
: []) {
|
|
771
|
+
if (rewardCoinSet.has(reward.reward_coin_type) === false) {
|
|
772
|
+
if (reward.reward_coin_type === coinsList["NAVX"].type.substring(2)) {
|
|
773
|
+
txb.moveCall({
|
|
774
|
+
target: `${poolData.packageId}::alphafi_navi_hasui_sui_investor::collect_reward_with_two_swaps`,
|
|
775
|
+
typeArguments: [coinsList["NAVX"].type],
|
|
776
|
+
arguments: [
|
|
777
|
+
txb.object(poolData.investorId),
|
|
778
|
+
txb.object(C.ALPHA_2_VERSION),
|
|
779
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
780
|
+
txb.object(C.NAVI_STORAGE),
|
|
781
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
782
|
+
txb.object(C.NAVI_NAVX_REWARDS_POOL),
|
|
783
|
+
txb.object(C.HAEDEL_STAKING),
|
|
784
|
+
txb.object(C.SUI_SYSTEM_STATE),
|
|
785
|
+
txb.object(cetusPoolMap[`NAVX-SUI`]),
|
|
786
|
+
txb.object(cetusPoolMap[`HASUI-SUI`]),
|
|
787
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
788
|
+
],
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
else if (reward.reward_coin_type === coinsList["VSUI"].type.substring(2)) {
|
|
792
|
+
txb.moveCall({
|
|
793
|
+
target: `${poolData.packageId}::alphafi_navi_hasui_sui_investor::collect_reward_with_two_swaps`,
|
|
794
|
+
typeArguments: [coinsList["VSUI"].type],
|
|
795
|
+
arguments: [
|
|
796
|
+
txb.object(poolData.investorId),
|
|
797
|
+
txb.object(C.ALPHA_2_VERSION),
|
|
798
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
799
|
+
txb.object(C.NAVI_STORAGE),
|
|
800
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
801
|
+
txb.object(C.NAVI_VSUI_REWARDS_POOL),
|
|
802
|
+
txb.object(C.HAEDEL_STAKING),
|
|
803
|
+
txb.object(C.SUI_SYSTEM_STATE),
|
|
804
|
+
txb.object(cetusPoolMap[`VSUI-SUI`]),
|
|
805
|
+
txb.object(cetusPoolMap[`HASUI-SUI`]),
|
|
806
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
807
|
+
],
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
rewardCoinSet.add(reward.reward_coin_type);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
for (const reward of claimableRewards["0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"]
|
|
814
|
+
? claimableRewards["0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"]
|
|
815
|
+
: []) {
|
|
816
|
+
if (rewardCoinSet.has(reward.reward_coin_type) === false) {
|
|
817
|
+
if (reward.reward_coin_type === coinsList["NAVX"].type.substring(2)) {
|
|
818
|
+
txb.moveCall({
|
|
819
|
+
target: `${poolData.packageId}::alphafi_navi_hasui_sui_investor::collect_reward_with_two_swaps`,
|
|
820
|
+
typeArguments: [coinsList["NAVX"].type],
|
|
821
|
+
arguments: [
|
|
822
|
+
txb.object(poolData.investorId),
|
|
823
|
+
txb.object(C.ALPHA_2_VERSION),
|
|
824
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
825
|
+
txb.object(C.NAVI_STORAGE),
|
|
826
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
827
|
+
txb.object(C.NAVI_NAVX_REWARDS_POOL),
|
|
828
|
+
txb.object(C.HAEDEL_STAKING),
|
|
829
|
+
txb.object(C.SUI_SYSTEM_STATE),
|
|
830
|
+
txb.object(cetusPoolMap[`NAVX-SUI`]),
|
|
831
|
+
txb.object(cetusPoolMap[`HASUI-SUI`]),
|
|
832
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
833
|
+
],
|
|
834
|
+
});
|
|
835
|
+
}
|
|
836
|
+
else if (reward.reward_coin_type === coinsList["VSUI"].type.substring(2)) {
|
|
837
|
+
txb.moveCall({
|
|
838
|
+
target: `${poolData.packageId}::alphafi_navi_hasui_sui_investor::collect_reward_with_two_swaps`,
|
|
839
|
+
typeArguments: [coinsList["VSUI"].type],
|
|
840
|
+
arguments: [
|
|
841
|
+
txb.object(poolData.investorId),
|
|
842
|
+
txb.object(C.ALPHA_2_VERSION),
|
|
843
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
844
|
+
txb.object(C.NAVI_STORAGE),
|
|
845
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
846
|
+
txb.object(C.NAVI_VSUI_REWARDS_POOL),
|
|
847
|
+
txb.object(C.HAEDEL_STAKING),
|
|
848
|
+
txb.object(C.SUI_SYSTEM_STATE),
|
|
849
|
+
txb.object(cetusPoolMap[`VSUI-SUI`]),
|
|
850
|
+
txb.object(cetusPoolMap[`HASUI-SUI`]),
|
|
851
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
852
|
+
],
|
|
853
|
+
});
|
|
854
|
+
}
|
|
855
|
+
rewardCoinSet.add(reward.reward_coin_type);
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
}
|
|
414
859
|
const [hasuiCoin] = txb.moveCall({
|
|
415
|
-
target: `${poolData.packageId}::alphafi_navi_hasui_sui_pool::
|
|
416
|
-
typeArguments: [C.NAVX_COIN_TYPE],
|
|
860
|
+
target: `${poolData.packageId}::alphafi_navi_hasui_sui_pool::user_withdraw_v2`, // change package id for testing
|
|
417
861
|
arguments: [
|
|
418
862
|
txb.object(C.ALPHA_2_VERSION), // change version object id for testing
|
|
419
863
|
txb.object(C.VERSION),
|
|
@@ -428,13 +872,9 @@ export async function naviHasuiSuiLoopWithdrawTx(xTokens, options) {
|
|
|
428
872
|
txb.object(C.NAVI_STORAGE),
|
|
429
873
|
txb.object(C.NAVI_HASUI_POOL),
|
|
430
874
|
txb.object(C.NAVI_SUI_POOL),
|
|
431
|
-
txb.object(C.
|
|
875
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
432
876
|
txb.object(C.NAVI_INCENTIVE_V2),
|
|
433
|
-
txb.object(C.NAVI_NAVX_FUNDS_POOL),
|
|
434
|
-
txb.object(C.NAVI_VSUI_FUNDS_POOL),
|
|
435
877
|
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
436
|
-
txb.object(cetusPoolMap["NAVX-SUI"]),
|
|
437
|
-
txb.object(cetusPoolMap["VSUI-SUI"]),
|
|
438
878
|
txb.object(cetusPoolMap["HASUI-SUI"]),
|
|
439
879
|
txb.object(C.HAEDEL_STAKING),
|
|
440
880
|
txb.object(C.SUI_SYSTEM_STATE),
|
|
@@ -456,8 +896,9 @@ export async function naviSuiVsuiLoopWithdrawTx(xTokens, options) {
|
|
|
456
896
|
const C = await getConf();
|
|
457
897
|
const address = options.address;
|
|
458
898
|
const txb = new Transaction();
|
|
459
|
-
const
|
|
460
|
-
const
|
|
899
|
+
const poolName = "NAVI-LOOP-SUI-VSUI";
|
|
900
|
+
const poolData = poolInfo[poolName];
|
|
901
|
+
const receipt = await getReceipts(poolName, address, true);
|
|
461
902
|
const alphaReceipt = await getReceipts("ALPHA", address, true);
|
|
462
903
|
if (receipt.length > 0) {
|
|
463
904
|
let alpha_receipt;
|
|
@@ -475,9 +916,92 @@ export async function naviSuiVsuiLoopWithdrawTx(xTokens, options) {
|
|
|
475
916
|
arguments: [txb.object(alphaReceipt[0].objectId)],
|
|
476
917
|
});
|
|
477
918
|
}
|
|
919
|
+
const claimableRewards = await getAvailableRewards(getSuiClient(), loopingAccountAddresses[poolName]);
|
|
920
|
+
const rewardCoinSet = new Set();
|
|
921
|
+
if (claimableRewards) {
|
|
922
|
+
for (const reward of claimableRewards[coinsList[loopingPoolCoinMap[poolName].supplyCoin].type.substring(2)]
|
|
923
|
+
? claimableRewards[coinsList[loopingPoolCoinMap[poolName].supplyCoin].type.substring(2)]
|
|
924
|
+
: []) {
|
|
925
|
+
if (rewardCoinSet.has(reward.reward_coin_type) === false) {
|
|
926
|
+
if (reward.reward_coin_type === coinsList["NAVX"].type.substring(2)) {
|
|
927
|
+
txb.moveCall({
|
|
928
|
+
target: `${poolData.packageId}::alphafi_navi_sui_vsui_investor::collect_reward_with_two_swaps`,
|
|
929
|
+
typeArguments: [coinsList["NAVX"].type],
|
|
930
|
+
arguments: [
|
|
931
|
+
txb.object(poolData.investorId),
|
|
932
|
+
txb.object(C.ALPHA_2_VERSION),
|
|
933
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
934
|
+
txb.object(C.NAVI_STORAGE),
|
|
935
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
936
|
+
txb.object(C.NAVI_NAVX_REWARDS_POOL),
|
|
937
|
+
txb.object(C.VOLO_NATIVE_POOL),
|
|
938
|
+
txb.object(C.VOLO_METADATA),
|
|
939
|
+
txb.object(C.SUI_SYSTEM_STATE),
|
|
940
|
+
txb.object(cetusPoolMap[`NAVX-SUI`]),
|
|
941
|
+
txb.object(cetusPoolMap[`VSUI-SUI`]),
|
|
942
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
943
|
+
],
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
else if (reward.reward_coin_type === coinsList["VSUI"].type.substring(2)) {
|
|
947
|
+
txb.moveCall({
|
|
948
|
+
target: `${poolData.packageId}::alphafi_navi_sui_vsui_investor::collect_reward_with_no_swap`,
|
|
949
|
+
arguments: [
|
|
950
|
+
txb.object(poolData.investorId),
|
|
951
|
+
txb.object(C.ALPHA_2_VERSION),
|
|
952
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
953
|
+
txb.object(C.NAVI_STORAGE),
|
|
954
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
955
|
+
txb.object(C.NAVI_VSUI_REWARDS_POOL),
|
|
956
|
+
],
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
rewardCoinSet.add(reward.reward_coin_type);
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
for (const reward of claimableRewards["0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"]
|
|
963
|
+
? claimableRewards["0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"]
|
|
964
|
+
: []) {
|
|
965
|
+
if (rewardCoinSet.has(reward.reward_coin_type) === false) {
|
|
966
|
+
if (reward.reward_coin_type === coinsList["NAVX"].type.substring(2)) {
|
|
967
|
+
txb.moveCall({
|
|
968
|
+
target: `${poolData.packageId}::alphafi_navi_sui_vsui_investor::collect_reward_with_two_swaps`,
|
|
969
|
+
typeArguments: [coinsList["NAVX"].type],
|
|
970
|
+
arguments: [
|
|
971
|
+
txb.object(poolData.investorId),
|
|
972
|
+
txb.object(C.ALPHA_2_VERSION),
|
|
973
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
974
|
+
txb.object(C.NAVI_STORAGE),
|
|
975
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
976
|
+
txb.object(C.NAVI_NAVX_REWARDS_POOL),
|
|
977
|
+
txb.object(C.VOLO_NATIVE_POOL),
|
|
978
|
+
txb.object(C.VOLO_METADATA),
|
|
979
|
+
txb.object(C.SUI_SYSTEM_STATE),
|
|
980
|
+
txb.object(cetusPoolMap[`NAVX-SUI`]),
|
|
981
|
+
txb.object(cetusPoolMap[`VSUI-SUI`]),
|
|
982
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
983
|
+
],
|
|
984
|
+
});
|
|
985
|
+
}
|
|
986
|
+
else if (reward.reward_coin_type === coinsList["VSUI"].type.substring(2)) {
|
|
987
|
+
txb.moveCall({
|
|
988
|
+
target: `${poolData.packageId}::alphafi_navi_sui_vsui_investor::collect_reward_with_no_swap`,
|
|
989
|
+
arguments: [
|
|
990
|
+
txb.object(poolData.investorId),
|
|
991
|
+
txb.object(C.ALPHA_2_VERSION),
|
|
992
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
993
|
+
txb.object(C.NAVI_STORAGE),
|
|
994
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
995
|
+
txb.object(C.NAVI_VSUI_REWARDS_POOL),
|
|
996
|
+
],
|
|
997
|
+
});
|
|
998
|
+
}
|
|
999
|
+
rewardCoinSet.add(reward.reward_coin_type);
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
478
1003
|
const [vsui_coin] = txb.moveCall({
|
|
479
|
-
target: `${poolData.packageId}::alphafi_navi_sui_vsui_pool::
|
|
480
|
-
typeArguments: [coinsList["NAVX"].type],
|
|
1004
|
+
target: `${poolData.packageId}::alphafi_navi_sui_vsui_pool::user_withdraw_v2`,
|
|
481
1005
|
arguments: [
|
|
482
1006
|
txb.object(C.ALPHA_2_VERSION),
|
|
483
1007
|
txb.object(C.VERSION),
|
|
@@ -492,12 +1016,9 @@ export async function naviSuiVsuiLoopWithdrawTx(xTokens, options) {
|
|
|
492
1016
|
txb.object(C.NAVI_STORAGE),
|
|
493
1017
|
txb.object(C.NAVI_VSUI_POOL),
|
|
494
1018
|
txb.object(C.NAVI_SUI_POOL),
|
|
495
|
-
txb.object(C.
|
|
1019
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
496
1020
|
txb.object(C.NAVI_INCENTIVE_V2),
|
|
497
|
-
txb.object(C.NAVI_NAVX_FUNDS_POOL),
|
|
498
|
-
txb.object(C.NAVI_VSUI_FUNDS_POOL),
|
|
499
1021
|
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
500
|
-
txb.object(cetusPoolMap["NAVX-SUI"]),
|
|
501
1022
|
txb.object(cetusPoolMap["VSUI-SUI"]),
|
|
502
1023
|
txb.object(C.VOLO_NATIVE_POOL),
|
|
503
1024
|
txb.object(C.VOLO_METADATA),
|
|
@@ -522,8 +1043,9 @@ export async function naviSuiStsuiLoopWithdrawTx(xTokens, options) {
|
|
|
522
1043
|
const C = getConf();
|
|
523
1044
|
const address = options.address;
|
|
524
1045
|
const txb = new Transaction();
|
|
525
|
-
const
|
|
526
|
-
const
|
|
1046
|
+
const poolName = "NAVI-LOOP-SUI-STSUI";
|
|
1047
|
+
const poolData = poolInfo[poolName];
|
|
1048
|
+
const receipt = await getReceipts(poolName, address, true);
|
|
527
1049
|
const alphaReceipt = await getReceipts("ALPHA", address, true);
|
|
528
1050
|
if (receipt.length > 0) {
|
|
529
1051
|
let alpha_receipt;
|
|
@@ -541,9 +1063,98 @@ export async function naviSuiStsuiLoopWithdrawTx(xTokens, options) {
|
|
|
541
1063
|
arguments: [txb.object(alphaReceipt[0].objectId)],
|
|
542
1064
|
});
|
|
543
1065
|
}
|
|
1066
|
+
const claimableRewards = await getAvailableRewards(getSuiClient(), loopingAccountAddresses[poolName]);
|
|
1067
|
+
const rewardCoinSet = new Set();
|
|
1068
|
+
if (claimableRewards) {
|
|
1069
|
+
for (const reward of claimableRewards[coinsList[loopingPoolCoinMap[poolName].supplyCoin].type.substring(2)]
|
|
1070
|
+
? claimableRewards[coinsList[loopingPoolCoinMap[poolName].supplyCoin].type.substring(2)]
|
|
1071
|
+
: []) {
|
|
1072
|
+
if (rewardCoinSet.has(reward.reward_coin_type) === false) {
|
|
1073
|
+
if (reward.reward_coin_type === coinsList["NAVX"].type.substring(2)) {
|
|
1074
|
+
txb.moveCall({
|
|
1075
|
+
target: `${poolData.packageId}::alphafi_navi_sui_stsui_pool::collect_v3_rewards_with_two_swaps`,
|
|
1076
|
+
typeArguments: [coinsList["NAVX"].type],
|
|
1077
|
+
arguments: [
|
|
1078
|
+
txb.object(C.ALPHA_5_VERSION),
|
|
1079
|
+
txb.object(poolData.investorId),
|
|
1080
|
+
txb.object(C.NAVI_STORAGE),
|
|
1081
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
1082
|
+
txb.object(C.NAVI_NAVX_REWARDS_POOL),
|
|
1083
|
+
txb.object(C.LST_INFO),
|
|
1084
|
+
txb.object(C.SUI_SYSTEM_STATE),
|
|
1085
|
+
txb.object(cetusPoolMap[`NAVX-SUI`]),
|
|
1086
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
1087
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
1088
|
+
],
|
|
1089
|
+
});
|
|
1090
|
+
}
|
|
1091
|
+
else if (reward.reward_coin_type === coinsList["VSUI"].type.substring(2)) {
|
|
1092
|
+
txb.moveCall({
|
|
1093
|
+
target: `${poolData.packageId}::alphafi_navi_sui_stsui_pool::collect_v3_rewards_with_two_swaps`,
|
|
1094
|
+
typeArguments: [coinsList["VSUI"].type],
|
|
1095
|
+
arguments: [
|
|
1096
|
+
txb.object(C.ALPHA_5_VERSION),
|
|
1097
|
+
txb.object(poolData.investorId),
|
|
1098
|
+
txb.object(C.NAVI_STORAGE),
|
|
1099
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
1100
|
+
txb.object(C.NAVI_VSUI_REWARDS_POOL),
|
|
1101
|
+
txb.object(C.LST_INFO),
|
|
1102
|
+
txb.object(C.SUI_SYSTEM_STATE),
|
|
1103
|
+
txb.object(cetusPoolMap[`VSUI-SUI`]),
|
|
1104
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
1105
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
1106
|
+
],
|
|
1107
|
+
});
|
|
1108
|
+
}
|
|
1109
|
+
rewardCoinSet.add(reward.reward_coin_type);
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
for (const reward of claimableRewards["0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"]
|
|
1113
|
+
? claimableRewards["0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"]
|
|
1114
|
+
: []) {
|
|
1115
|
+
if (rewardCoinSet.has(reward.reward_coin_type) === false) {
|
|
1116
|
+
if (reward.reward_coin_type === coinsList["NAVX"].type.substring(2)) {
|
|
1117
|
+
txb.moveCall({
|
|
1118
|
+
target: `${poolData.packageId}::alphafi_navi_sui_stsui_pool::collect_v3_rewards_with_two_swaps`,
|
|
1119
|
+
typeArguments: [coinsList["NAVX"].type],
|
|
1120
|
+
arguments: [
|
|
1121
|
+
txb.object(C.ALPHA_5_VERSION),
|
|
1122
|
+
txb.object(poolData.investorId),
|
|
1123
|
+
txb.object(C.NAVI_STORAGE),
|
|
1124
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
1125
|
+
txb.object(C.NAVI_NAVX_REWARDS_POOL),
|
|
1126
|
+
txb.object(C.LST_INFO),
|
|
1127
|
+
txb.object(C.SUI_SYSTEM_STATE),
|
|
1128
|
+
txb.object(cetusPoolMap[`NAVX-SUI`]),
|
|
1129
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
1130
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
1131
|
+
],
|
|
1132
|
+
});
|
|
1133
|
+
}
|
|
1134
|
+
else if (reward.reward_coin_type === coinsList["VSUI"].type.substring(2)) {
|
|
1135
|
+
txb.moveCall({
|
|
1136
|
+
target: `${poolData.packageId}::alphafi_navi_sui_stsui_pool::collect_v3_rewards_with_two_swaps`,
|
|
1137
|
+
typeArguments: [coinsList["VSUI"].type],
|
|
1138
|
+
arguments: [
|
|
1139
|
+
txb.object(C.ALPHA_5_VERSION),
|
|
1140
|
+
txb.object(poolData.investorId),
|
|
1141
|
+
txb.object(C.NAVI_STORAGE),
|
|
1142
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
1143
|
+
txb.object(C.NAVI_VSUI_REWARDS_POOL),
|
|
1144
|
+
txb.object(C.LST_INFO),
|
|
1145
|
+
txb.object(C.SUI_SYSTEM_STATE),
|
|
1146
|
+
txb.object(cetusPoolMap[`VSUI-SUI`]),
|
|
1147
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
1148
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
1149
|
+
],
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1152
|
+
rewardCoinSet.add(reward.reward_coin_type);
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
544
1156
|
const [stsui_coin] = txb.moveCall({
|
|
545
|
-
target: `${poolData.packageId}::alphafi_navi_sui_stsui_pool::
|
|
546
|
-
typeArguments: [coinsList["NAVX"].type],
|
|
1157
|
+
target: `${poolData.packageId}::alphafi_navi_sui_stsui_pool::user_withdraw_v2`,
|
|
547
1158
|
arguments: [
|
|
548
1159
|
txb.object(C.ALPHA_5_VERSION),
|
|
549
1160
|
txb.object(C.VERSION),
|
|
@@ -558,16 +1169,10 @@ export async function naviSuiStsuiLoopWithdrawTx(xTokens, options) {
|
|
|
558
1169
|
txb.object(C.NAVI_STORAGE),
|
|
559
1170
|
txb.object(C.NAVI_STSUI_POOL),
|
|
560
1171
|
txb.object(C.NAVI_SUI_POOL),
|
|
561
|
-
txb.object(C.
|
|
1172
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
562
1173
|
txb.object(C.NAVI_INCENTIVE_V2),
|
|
563
|
-
txb.object(C.NAVI_NAVX_FUNDS_POOL),
|
|
564
|
-
txb.object(C.NAVI_VSUI_FUNDS_POOL),
|
|
565
|
-
txb.object(C.NAVI_STSUI_FUNDS_POOL),
|
|
566
1174
|
txb.object(C.LST_INFO),
|
|
567
1175
|
txb.object(C.SUI_SYSTEM_STATE),
|
|
568
|
-
txb.object(cetusPoolMap["NAVX-SUI"]),
|
|
569
|
-
txb.object(cetusPoolMap["VSUI-SUI"]),
|
|
570
|
-
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
571
1176
|
txb.object(C.CLOCK_PACKAGE_ID),
|
|
572
1177
|
],
|
|
573
1178
|
});
|
|
@@ -578,7 +1183,7 @@ export async function naviSuiStsuiLoopWithdrawTx(xTokens, options) {
|
|
|
578
1183
|
});
|
|
579
1184
|
}
|
|
580
1185
|
else {
|
|
581
|
-
throw new Error(`No
|
|
1186
|
+
throw new Error(`No NAVI-LOOP-SUI-STSUI Receipt`);
|
|
582
1187
|
}
|
|
583
1188
|
return txb;
|
|
584
1189
|
}
|
|
@@ -586,8 +1191,9 @@ export async function naviUsdcUsdtLoopWithdrawTx(xTokens, options) {
|
|
|
586
1191
|
const C = await getConf();
|
|
587
1192
|
const address = options.address;
|
|
588
1193
|
const txb = new Transaction();
|
|
589
|
-
const
|
|
590
|
-
const
|
|
1194
|
+
const poolName = "NAVI-LOOP-USDC-USDT";
|
|
1195
|
+
const poolData = poolInfo[poolName];
|
|
1196
|
+
const receipt = await getReceipts(poolName, address, true);
|
|
591
1197
|
const alphaReceipt = await getReceipts("ALPHA", address, true);
|
|
592
1198
|
if (receipt.length > 0) {
|
|
593
1199
|
let alpha_receipt;
|
|
@@ -605,8 +1211,94 @@ export async function naviUsdcUsdtLoopWithdrawTx(xTokens, options) {
|
|
|
605
1211
|
arguments: [txb.object(alphaReceipt[0].objectId)],
|
|
606
1212
|
});
|
|
607
1213
|
}
|
|
1214
|
+
const claimableRewards = await getAvailableRewards(getSuiClient(), loopingAccountAddresses[poolName]);
|
|
1215
|
+
const rewardCoinSet = new Set();
|
|
1216
|
+
if (claimableRewards) {
|
|
1217
|
+
for (const reward of claimableRewards[coinsList[loopingPoolCoinMap[poolName].supplyCoin].type.substring(2)]
|
|
1218
|
+
? claimableRewards[coinsList[loopingPoolCoinMap[poolName].supplyCoin].type.substring(2)]
|
|
1219
|
+
: []) {
|
|
1220
|
+
if (rewardCoinSet.has(reward.reward_coin_type) === false) {
|
|
1221
|
+
if (reward.reward_coin_type === coinsList["NAVX"].type.substring(2)) {
|
|
1222
|
+
txb.moveCall({
|
|
1223
|
+
target: `${poolData.packageId}::alphafi_navi_native_usdc_usdt_investor::collect_reward_with_two_swaps`,
|
|
1224
|
+
typeArguments: [coinsList["NAVX"].type],
|
|
1225
|
+
arguments: [
|
|
1226
|
+
txb.object(poolData.investorId),
|
|
1227
|
+
txb.object(C.ALPHA_2_VERSION),
|
|
1228
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
1229
|
+
txb.object(C.NAVI_STORAGE),
|
|
1230
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
1231
|
+
txb.object(C.NAVI_NAVX_REWARDS_POOL),
|
|
1232
|
+
txb.object(cetusPoolMap[`NAVX-SUI`]),
|
|
1233
|
+
txb.object(cetusPoolMap[`USDC-SUI`]),
|
|
1234
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
1235
|
+
],
|
|
1236
|
+
});
|
|
1237
|
+
}
|
|
1238
|
+
else if (reward.reward_coin_type === coinsList["VSUI"].type.substring(2)) {
|
|
1239
|
+
txb.moveCall({
|
|
1240
|
+
target: `${poolData.packageId}::alphafi_navi_native_usdc_usdt_investor::collect_reward_with_two_swaps`,
|
|
1241
|
+
typeArguments: [coinsList["VSUI"].type],
|
|
1242
|
+
arguments: [
|
|
1243
|
+
txb.object(poolData.investorId),
|
|
1244
|
+
txb.object(C.ALPHA_2_VERSION),
|
|
1245
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
1246
|
+
txb.object(C.NAVI_STORAGE),
|
|
1247
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
1248
|
+
txb.object(C.NAVI_VSUI_REWARDS_POOL),
|
|
1249
|
+
txb.object(cetusPoolMap[`VSUI-SUI`]),
|
|
1250
|
+
txb.object(cetusPoolMap[`USDC-SUI`]),
|
|
1251
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
1252
|
+
],
|
|
1253
|
+
});
|
|
1254
|
+
}
|
|
1255
|
+
rewardCoinSet.add(reward.reward_coin_type);
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
for (const reward of claimableRewards[coinsList[loopingPoolCoinMap[poolName].borrowCoin].type.substring(2)]
|
|
1259
|
+
? claimableRewards[coinsList[loopingPoolCoinMap[poolName].borrowCoin].type.substring(2)]
|
|
1260
|
+
: []) {
|
|
1261
|
+
if (rewardCoinSet.has(reward.reward_coin_type) === false) {
|
|
1262
|
+
if (reward.reward_coin_type === coinsList["NAVX"].type.substring(2)) {
|
|
1263
|
+
txb.moveCall({
|
|
1264
|
+
target: `${poolData.packageId}::alphafi_navi_native_usdc_usdt_investor::collect_reward_with_two_swaps`,
|
|
1265
|
+
typeArguments: [coinsList["NAVX"].type],
|
|
1266
|
+
arguments: [
|
|
1267
|
+
txb.object(poolData.investorId),
|
|
1268
|
+
txb.object(C.ALPHA_2_VERSION),
|
|
1269
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
1270
|
+
txb.object(C.NAVI_STORAGE),
|
|
1271
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
1272
|
+
txb.object(C.NAVI_NAVX_REWARDS_POOL),
|
|
1273
|
+
txb.object(cetusPoolMap[`NAVX-SUI`]),
|
|
1274
|
+
txb.object(cetusPoolMap[`USDC-SUI`]),
|
|
1275
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
1276
|
+
],
|
|
1277
|
+
});
|
|
1278
|
+
}
|
|
1279
|
+
else if (reward.reward_coin_type === coinsList["VSUI"].type.substring(2)) {
|
|
1280
|
+
txb.moveCall({
|
|
1281
|
+
target: `${poolData.packageId}::alphafi_navi_native_usdc_usdt_investor::collect_reward_with_two_swaps`,
|
|
1282
|
+
typeArguments: [coinsList["VSUI"].type],
|
|
1283
|
+
arguments: [
|
|
1284
|
+
txb.object(poolData.investorId),
|
|
1285
|
+
txb.object(C.ALPHA_2_VERSION),
|
|
1286
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
1287
|
+
txb.object(C.NAVI_STORAGE),
|
|
1288
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
1289
|
+
txb.object(C.NAVI_VSUI_REWARDS_POOL),
|
|
1290
|
+
txb.object(cetusPoolMap[`VSUI-SUI`]),
|
|
1291
|
+
txb.object(cetusPoolMap[`USDC-SUI`]),
|
|
1292
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
1293
|
+
],
|
|
1294
|
+
});
|
|
1295
|
+
}
|
|
1296
|
+
rewardCoinSet.add(reward.reward_coin_type);
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
608
1300
|
const [usdcCoin] = txb.moveCall({
|
|
609
|
-
target: `${poolData.packageId}::alphafi_navi_native_usdc_usdt_pool::
|
|
1301
|
+
target: `${poolData.packageId}::alphafi_navi_native_usdc_usdt_pool::user_withdraw_v3`,
|
|
610
1302
|
arguments: [
|
|
611
1303
|
txb.object(C.ALPHA_2_VERSION),
|
|
612
1304
|
txb.object(C.VERSION),
|
|
@@ -621,15 +1313,10 @@ export async function naviUsdcUsdtLoopWithdrawTx(xTokens, options) {
|
|
|
621
1313
|
txb.object(C.NAVI_STORAGE),
|
|
622
1314
|
txb.object(C.NAVI_USDC_POOL),
|
|
623
1315
|
txb.object(C.NAVI_USDT_POOL),
|
|
624
|
-
txb.object(C.
|
|
1316
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
625
1317
|
txb.object(C.NAVI_INCENTIVE_V2),
|
|
626
|
-
txb.object(C.NAVI_VSUI_FUNDS_POOL),
|
|
627
|
-
txb.object(C.NAVI_NAVX_FUNDS_POOL),
|
|
628
|
-
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
629
|
-
txb.object(cetusPoolMap["VSUI-SUI"]),
|
|
630
|
-
txb.object(cetusPoolMap["NAVX-SUI"]),
|
|
631
|
-
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
632
1318
|
txb.object(cetusPoolMap["USDC-USDT"]),
|
|
1319
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
633
1320
|
txb.object(C.BLUEFIN_GLOBAL_CONFIG),
|
|
634
1321
|
txb.object(C.BLUEFIN_USDT_USDC_POOL),
|
|
635
1322
|
txb.pure.bool(true),
|
|
@@ -648,9 +1335,10 @@ export async function naviUsdcUsdtLoopWithdrawTx(xTokens, options) {
|
|
|
648
1335
|
return txb;
|
|
649
1336
|
}
|
|
650
1337
|
export async function naviUsdtUsdcLoopWithdrawTx(xTokens, options) {
|
|
651
|
-
const C =
|
|
1338
|
+
const C = getConf();
|
|
652
1339
|
const address = options.address;
|
|
653
1340
|
const txb = new Transaction();
|
|
1341
|
+
const poolName = "NAVI-LOOP-USDT-USDC";
|
|
654
1342
|
const poolData = poolInfo["NAVI-LOOP-USDT-USDC"];
|
|
655
1343
|
const receipt = await getReceipts("NAVI-LOOP-USDT-USDC", address, true);
|
|
656
1344
|
const alphaReceipt = await getReceipts("ALPHA", address, true);
|
|
@@ -670,9 +1358,118 @@ export async function naviUsdtUsdcLoopWithdrawTx(xTokens, options) {
|
|
|
670
1358
|
arguments: [txb.object(alphaReceipt[0].objectId)],
|
|
671
1359
|
});
|
|
672
1360
|
}
|
|
1361
|
+
const claimableRewards = await getAvailableRewards(getSuiClient(), loopingAccountAddresses[poolName]);
|
|
1362
|
+
const rewardCoinSet = new Set();
|
|
1363
|
+
if (claimableRewards) {
|
|
1364
|
+
for (const reward of claimableRewards[coinsList[loopingPoolCoinMap[poolName].supplyCoin].type.substring(2)]
|
|
1365
|
+
? claimableRewards[coinsList[loopingPoolCoinMap[poolName].supplyCoin].type.substring(2)]
|
|
1366
|
+
: []) {
|
|
1367
|
+
if (rewardCoinSet.has(reward.reward_coin_type) === false) {
|
|
1368
|
+
if (reward.reward_coin_type === coinsList["NAVX"].type.substring(2)) {
|
|
1369
|
+
txb.moveCall({
|
|
1370
|
+
target: `${poolData.packageId}::alphafi_navi_usdt_usdc_investor::collect_v3_rewards_with_three_swaps`,
|
|
1371
|
+
typeArguments: [
|
|
1372
|
+
coinsList["USDT"].type,
|
|
1373
|
+
coinsList["USDC"].type,
|
|
1374
|
+
coinsList["SUI"].type,
|
|
1375
|
+
"0x" + reward.reward_coin_type,
|
|
1376
|
+
],
|
|
1377
|
+
arguments: [
|
|
1378
|
+
txb.object(poolData.investorId),
|
|
1379
|
+
txb.object(C.ALPHA_5_VERSION),
|
|
1380
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
1381
|
+
txb.object(C.NAVI_STORAGE),
|
|
1382
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
1383
|
+
txb.object(C.NAVI_NAVX_REWARDS_POOL),
|
|
1384
|
+
txb.object(cetusPoolMap[`NAVX-SUI`]),
|
|
1385
|
+
txb.object(cetusPoolMap[`USDC-SUI`]),
|
|
1386
|
+
txb.object(cetusPoolMap[`USDC-USDT`]),
|
|
1387
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
1388
|
+
],
|
|
1389
|
+
});
|
|
1390
|
+
}
|
|
1391
|
+
else if (reward.reward_coin_type === coinsList["VSUI"].type.substring(2)) {
|
|
1392
|
+
txb.moveCall({
|
|
1393
|
+
target: `${poolData.packageId}::alphafi_navi_usdt_usdc_investor::collect_v3_rewards_with_three_swaps`,
|
|
1394
|
+
typeArguments: [
|
|
1395
|
+
coinsList["USDT"].type,
|
|
1396
|
+
coinsList["USDC"].type,
|
|
1397
|
+
coinsList["SUI"].type,
|
|
1398
|
+
"0x" + reward.reward_coin_type,
|
|
1399
|
+
],
|
|
1400
|
+
arguments: [
|
|
1401
|
+
txb.object(poolData.investorId),
|
|
1402
|
+
txb.object(C.ALPHA_5_VERSION),
|
|
1403
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
1404
|
+
txb.object(C.NAVI_STORAGE),
|
|
1405
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
1406
|
+
txb.object(C.NAVI_VSUI_REWARDS_POOL),
|
|
1407
|
+
txb.object(cetusPoolMap[`VSUI-SUI`]),
|
|
1408
|
+
txb.object(cetusPoolMap[`USDC-SUI`]),
|
|
1409
|
+
txb.object(cetusPoolMap[`USDC-USDT`]),
|
|
1410
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
1411
|
+
],
|
|
1412
|
+
});
|
|
1413
|
+
}
|
|
1414
|
+
rewardCoinSet.add(reward.reward_coin_type);
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
for (const reward of claimableRewards[coinsList[loopingPoolCoinMap[poolName].borrowCoin].type.substring(2)]
|
|
1418
|
+
? claimableRewards[coinsList[loopingPoolCoinMap[poolName].borrowCoin].type.substring(2)]
|
|
1419
|
+
: []) {
|
|
1420
|
+
if (rewardCoinSet.has(reward.reward_coin_type) === false) {
|
|
1421
|
+
if (reward.reward_coin_type === coinsList["NAVX"].type.substring(2)) {
|
|
1422
|
+
txb.moveCall({
|
|
1423
|
+
target: `${poolData.packageId}::alphafi_navi_usdt_usdc_investor::collect_v3_rewards_with_three_swaps`,
|
|
1424
|
+
typeArguments: [
|
|
1425
|
+
coinsList["USDT"].type,
|
|
1426
|
+
coinsList["USDC"].type,
|
|
1427
|
+
coinsList["SUI"].type,
|
|
1428
|
+
"0x" + reward.reward_coin_type,
|
|
1429
|
+
],
|
|
1430
|
+
arguments: [
|
|
1431
|
+
txb.object(poolData.investorId),
|
|
1432
|
+
txb.object(C.ALPHA_5_VERSION),
|
|
1433
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
1434
|
+
txb.object(C.NAVI_STORAGE),
|
|
1435
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
1436
|
+
txb.object(C.NAVI_NAVX_REWARDS_POOL),
|
|
1437
|
+
txb.object(cetusPoolMap[`NAVX-SUI`]),
|
|
1438
|
+
txb.object(cetusPoolMap[`USDC-SUI`]),
|
|
1439
|
+
txb.object(cetusPoolMap[`USDC-USDT`]),
|
|
1440
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
1441
|
+
],
|
|
1442
|
+
});
|
|
1443
|
+
}
|
|
1444
|
+
else if (reward.reward_coin_type === coinsList["VSUI"].type.substring(2)) {
|
|
1445
|
+
txb.moveCall({
|
|
1446
|
+
target: `${poolData.packageId}::alphafi_navi_usdt_usdc_investor::collect_v3_rewards_with_three_swaps`,
|
|
1447
|
+
typeArguments: [
|
|
1448
|
+
coinsList["USDT"].type,
|
|
1449
|
+
coinsList["USDC"].type,
|
|
1450
|
+
coinsList["SUI"].type,
|
|
1451
|
+
"0x" + reward.reward_coin_type,
|
|
1452
|
+
],
|
|
1453
|
+
arguments: [
|
|
1454
|
+
txb.object(poolData.investorId),
|
|
1455
|
+
txb.object(C.ALPHA_5_VERSION),
|
|
1456
|
+
txb.object(C.CLOCK_PACKAGE_ID),
|
|
1457
|
+
txb.object(C.NAVI_STORAGE),
|
|
1458
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
1459
|
+
txb.object(C.NAVI_VSUI_REWARDS_POOL),
|
|
1460
|
+
txb.object(cetusPoolMap[`VSUI-SUI`]),
|
|
1461
|
+
txb.object(cetusPoolMap[`USDC-SUI`]),
|
|
1462
|
+
txb.object(cetusPoolMap[`USDC-USDT`]),
|
|
1463
|
+
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
1464
|
+
],
|
|
1465
|
+
});
|
|
1466
|
+
}
|
|
1467
|
+
rewardCoinSet.add(reward.reward_coin_type);
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
673
1471
|
const [usdtCoin] = txb.moveCall({
|
|
674
|
-
target: `${poolData.packageId}::alphafi_navi_usdt_usdc_pool::
|
|
675
|
-
typeArguments: [coinsList["NAVX"].type],
|
|
1472
|
+
target: `${poolData.packageId}::alphafi_navi_usdt_usdc_pool::user_withdraw_v2`,
|
|
676
1473
|
arguments: [
|
|
677
1474
|
txb.object(C.ALPHA_5_VERSION),
|
|
678
1475
|
txb.object(C.VERSION),
|
|
@@ -687,15 +1484,10 @@ export async function naviUsdtUsdcLoopWithdrawTx(xTokens, options) {
|
|
|
687
1484
|
txb.object(C.NAVI_STORAGE),
|
|
688
1485
|
txb.object(C.NAVI_USDT_POOL),
|
|
689
1486
|
txb.object(C.NAVI_USDC_POOL),
|
|
690
|
-
txb.object(C.
|
|
1487
|
+
txb.object(C.NAVI_INCENTIVE_V3),
|
|
691
1488
|
txb.object(C.NAVI_INCENTIVE_V2),
|
|
692
|
-
txb.object(C.NAVI_VSUI_FUNDS_POOL),
|
|
693
|
-
txb.object(C.NAVI_NAVX_FUNDS_POOL),
|
|
694
1489
|
txb.object(C.CETUS_GLOBAL_CONFIG_ID),
|
|
695
|
-
txb.object(cetusPoolMap["VSUI-SUI"]),
|
|
696
1490
|
txb.object(cetusPoolMap["USDC-USDT"]),
|
|
697
|
-
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
698
|
-
txb.object(cetusPoolMap["NAVX-SUI"]),
|
|
699
1491
|
txb.object(C.CLOCK_PACKAGE_ID),
|
|
700
1492
|
],
|
|
701
1493
|
});
|