@alphafi/alphafi-sdk 0.0.39 → 0.0.41
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/adminFunctions.d.ts.map +1 -1
- package/dist/cjs/adminFunctions.js +9 -1
- package/dist/cjs/adminFunctions.js.map +1 -1
- package/dist/cjs/common/coins.d.ts.map +1 -1
- package/dist/cjs/common/coins.js +18 -0
- package/dist/cjs/common/coins.js.map +1 -1
- package/dist/cjs/common/constants.d.ts +288 -0
- package/dist/cjs/common/constants.d.ts.map +1 -1
- package/dist/cjs/common/constants.js +214 -8
- package/dist/cjs/common/constants.js.map +1 -1
- package/dist/cjs/common/maps.d.ts +1 -0
- package/dist/cjs/common/maps.d.ts.map +1 -1
- package/dist/cjs/common/maps.js +207 -14
- package/dist/cjs/common/maps.js.map +1 -1
- package/dist/cjs/common/types.d.ts +58 -5
- package/dist/cjs/common/types.d.ts.map +1 -1
- package/dist/cjs/common/types.js.map +1 -1
- package/dist/cjs/graphql/getMultiReceipts.d.ts.map +1 -1
- package/dist/cjs/graphql/getMultiReceipts.js +49 -36
- package/dist/cjs/graphql/getMultiReceipts.js.map +1 -1
- package/dist/cjs/index.d.ts +5 -9
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +17 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/sui-sdk/functions/fetchUserVaultBalances.d.ts.map +1 -1
- package/dist/cjs/sui-sdk/functions/fetchUserVaultBalances.js +2 -3
- package/dist/cjs/sui-sdk/functions/fetchUserVaultBalances.js.map +1 -1
- package/dist/cjs/sui-sdk/functions/getPortfolioAmounts.d.ts.map +1 -1
- package/dist/cjs/sui-sdk/functions/getPortfolioAmounts.js +6 -12
- package/dist/cjs/sui-sdk/functions/getPortfolioAmounts.js.map +1 -1
- package/dist/cjs/sui-sdk/functions/getReceipts.d.ts +6 -3
- package/dist/cjs/sui-sdk/functions/getReceipts.d.ts.map +1 -1
- package/dist/cjs/sui-sdk/functions/getReceipts.js +42 -26
- package/dist/cjs/sui-sdk/functions/getReceipts.js.map +1 -1
- package/dist/cjs/transactions/7k.d.ts +13 -0
- package/dist/cjs/transactions/7k.d.ts.map +1 -0
- package/dist/cjs/transactions/7k.js +46 -0
- package/dist/cjs/transactions/7k.js.map +1 -0
- package/dist/cjs/transactions/alpha.d.ts.map +1 -1
- package/dist/cjs/transactions/alpha.js +1 -0
- package/dist/cjs/transactions/alpha.js.map +1 -1
- package/dist/cjs/transactions/bluefin.d.ts +12 -0
- package/dist/cjs/transactions/bluefin.d.ts.map +1 -1
- package/dist/cjs/transactions/bluefin.js +937 -91
- package/dist/cjs/transactions/bluefin.js.map +1 -1
- package/dist/cjs/transactions/cetus.d.ts +0 -3
- package/dist/cjs/transactions/cetus.d.ts.map +1 -1
- package/dist/cjs/transactions/cetus.js +4 -63
- package/dist/cjs/transactions/cetus.js.map +1 -1
- package/dist/cjs/transactions/deposit.d.ts +3 -0
- package/dist/cjs/transactions/deposit.d.ts.map +1 -1
- package/dist/cjs/transactions/deposit.js +77 -1
- package/dist/cjs/transactions/deposit.js.map +1 -1
- package/dist/cjs/transactions/deposit1.d.ts +1 -0
- package/dist/cjs/transactions/deposit1.d.ts.map +1 -0
- package/dist/cjs/transactions/deposit1.js +86 -0
- package/dist/cjs/transactions/deposit1.js.map +1 -0
- package/dist/cjs/transactions/types.d.ts +14 -0
- package/dist/cjs/transactions/types.d.ts.map +1 -0
- package/dist/cjs/transactions/types.js +3 -0
- package/dist/cjs/transactions/types.js.map +1 -0
- package/dist/cjs/transactions/withdraw.d.ts.map +1 -1
- package/dist/cjs/transactions/withdraw.js +17 -2
- package/dist/cjs/transactions/withdraw.js.map +1 -1
- package/dist/cjs/transactions/zapDeposit.d.ts +9 -0
- package/dist/cjs/transactions/zapDeposit.d.ts.map +1 -1
- package/dist/cjs/transactions/zapDeposit.js +1117 -725
- package/dist/cjs/transactions/zapDeposit.js.map +1 -1
- package/dist/esm/adminFunctions.d.ts.map +1 -1
- package/dist/esm/adminFunctions.js +10 -2
- package/dist/esm/adminFunctions.js.map +1 -1
- package/dist/esm/common/coins.d.ts.map +1 -1
- package/dist/esm/common/coins.js +18 -0
- package/dist/esm/common/coins.js.map +1 -1
- package/dist/esm/common/constants.d.ts +288 -0
- package/dist/esm/common/constants.d.ts.map +1 -1
- package/dist/esm/common/constants.js +214 -8
- package/dist/esm/common/constants.js.map +1 -1
- package/dist/esm/common/maps.d.ts +1 -0
- package/dist/esm/common/maps.d.ts.map +1 -1
- package/dist/esm/common/maps.js +206 -13
- package/dist/esm/common/maps.js.map +1 -1
- package/dist/esm/common/types.d.ts +58 -5
- package/dist/esm/common/types.d.ts.map +1 -1
- package/dist/esm/common/types.js.map +1 -1
- package/dist/esm/graphql/getMultiReceipts.d.ts.map +1 -1
- package/dist/esm/graphql/getMultiReceipts.js +49 -36
- package/dist/esm/graphql/getMultiReceipts.js.map +1 -1
- package/dist/esm/index.d.ts +5 -9
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +5 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/sui-sdk/functions/fetchUserVaultBalances.d.ts.map +1 -1
- package/dist/esm/sui-sdk/functions/fetchUserVaultBalances.js +2 -3
- package/dist/esm/sui-sdk/functions/fetchUserVaultBalances.js.map +1 -1
- package/dist/esm/sui-sdk/functions/getPortfolioAmounts.d.ts.map +1 -1
- package/dist/esm/sui-sdk/functions/getPortfolioAmounts.js +7 -13
- package/dist/esm/sui-sdk/functions/getPortfolioAmounts.js.map +1 -1
- package/dist/esm/sui-sdk/functions/getReceipts.d.ts +6 -3
- package/dist/esm/sui-sdk/functions/getReceipts.d.ts.map +1 -1
- package/dist/esm/sui-sdk/functions/getReceipts.js +43 -26
- package/dist/esm/sui-sdk/functions/getReceipts.js.map +1 -1
- package/dist/esm/transactions/7k.d.ts +13 -0
- package/dist/esm/transactions/7k.d.ts.map +1 -0
- package/dist/esm/transactions/7k.js +42 -0
- package/dist/esm/transactions/7k.js.map +1 -0
- package/dist/esm/transactions/alpha.d.ts.map +1 -1
- package/dist/esm/transactions/alpha.js +1 -0
- package/dist/esm/transactions/alpha.js.map +1 -1
- package/dist/esm/transactions/bluefin.d.ts +12 -0
- package/dist/esm/transactions/bluefin.d.ts.map +1 -1
- package/dist/esm/transactions/bluefin.js +928 -86
- package/dist/esm/transactions/bluefin.js.map +1 -1
- package/dist/esm/transactions/cetus.d.ts +0 -3
- package/dist/esm/transactions/cetus.d.ts.map +1 -1
- package/dist/esm/transactions/cetus.js +2 -57
- package/dist/esm/transactions/cetus.js.map +1 -1
- package/dist/esm/transactions/deposit.d.ts +3 -0
- package/dist/esm/transactions/deposit.d.ts.map +1 -1
- package/dist/esm/transactions/deposit.js +74 -2
- package/dist/esm/transactions/deposit.js.map +1 -1
- package/dist/esm/transactions/deposit1.d.ts +2 -0
- package/dist/esm/transactions/deposit1.d.ts.map +1 -0
- package/dist/esm/transactions/deposit1.js +86 -0
- package/dist/esm/transactions/deposit1.js.map +1 -0
- package/dist/esm/transactions/types.d.ts +14 -0
- package/dist/esm/transactions/types.d.ts.map +1 -0
- package/dist/esm/transactions/types.js +2 -0
- package/dist/esm/transactions/types.js.map +1 -0
- package/dist/esm/transactions/withdraw.d.ts.map +1 -1
- package/dist/esm/transactions/withdraw.js +18 -3
- package/dist/esm/transactions/withdraw.js.map +1 -1
- package/dist/esm/transactions/zapDeposit.d.ts +9 -1
- package/dist/esm/transactions/zapDeposit.d.ts.map +1 -1
- package/dist/esm/transactions/zapDeposit.js +1113 -726
- package/dist/esm/transactions/zapDeposit.js.map +1 -1
- package/docs/assets/highlight.css +78 -0
- package/docs/assets/icons.js +18 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +60 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1493 -0
- package/docs/functions/alphaLpBreakdown.html +1 -0
- package/docs/functions/cetusLpBreakdown.html +1 -0
- package/docs/functions/claimRewardTxb.html +1 -0
- package/docs/functions/coinAmountToXTokensDoubleAsset.html +1 -0
- package/docs/functions/coinAmountToXTokensSingleAsset.html +1 -0
- package/docs/functions/coinsInPool.html +1 -0
- package/docs/functions/collectRewards.html +1 -0
- package/docs/functions/deposit.html +1 -0
- package/docs/functions/depositDoubleAssetTxb.html +1 -0
- package/docs/functions/depositSingleAssetTxb.html +1 -0
- package/docs/functions/fetchAfterTransactionEvents.html +1 -0
- package/docs/functions/fetchAutoCompoundingEvents.html +1 -0
- package/docs/functions/fetchAutoCompoundingEventsGql.html +1 -0
- package/docs/functions/fetchCetusPools.html +1 -0
- package/docs/functions/fetchChainIdentifier.html +1 -0
- package/docs/functions/fetchCheckRatioEvents.html +1 -0
- package/docs/functions/fetchLiquidityChangeEvents.html +1 -0
- package/docs/functions/fetchMultiReceipts.html +1 -0
- package/docs/functions/fetchNftHolders.html +1 -0
- package/docs/functions/fetchPools.html +1 -0
- package/docs/functions/fetchPortfolioData.html +1 -0
- package/docs/functions/fetchProtocolData.html +1 -0
- package/docs/functions/fetchTVL.html +1 -0
- package/docs/functions/fetchUserVaultBalances.html +1 -0
- package/docs/functions/fetchUserVaults.html +1 -0
- package/docs/functions/fetchUserWalletData.html +1 -0
- package/docs/functions/fetchWithdrawV2Events.html +1 -0
- package/docs/functions/getAirdropShare.html +1 -0
- package/docs/functions/getAllDoubleAssetVaults.html +1 -0
- package/docs/functions/getAllSingleAssetVaults.html +1 -0
- package/docs/functions/getAllVaultBalances.html +1 -0
- package/docs/functions/getAllVaults.html +1 -0
- package/docs/functions/getAlphaUnlocks.html +1 -0
- package/docs/functions/getAlphaVaultBalance.html +1 -0
- package/docs/functions/getAmounts.html +1 -0
- package/docs/functions/getApr.html +1 -0
- package/docs/functions/getAprs.html +1 -0
- package/docs/functions/getApy.html +1 -0
- package/docs/functions/getApys.html +1 -0
- package/docs/functions/getCetusInvestorTicksMap.html +1 -0
- package/docs/functions/getCetusSqrtPriceMap.html +1 -0
- package/docs/functions/getCoinAmountsFromLiquidity.html +1 -0
- package/docs/functions/getConf.html +1 -0
- package/docs/functions/getCurrentTick.html +1 -0
- package/docs/functions/getDoubleAssetVaultBalance.html +1 -0
- package/docs/functions/getDoubleAssetVaults.html +1 -0
- package/docs/functions/getHoldersFromTransactions.html +1 -0
- package/docs/functions/getInvestor.html +1 -0
- package/docs/functions/getInvestorPoolMap.html +1 -0
- package/docs/functions/getLastAutoCompoundTime.html +1 -0
- package/docs/functions/getLatestPrices.html +1 -0
- package/docs/functions/getLiquidity.html +1 -0
- package/docs/functions/getMultiInvestor.html +1 -0
- package/docs/functions/getMultiLatestPrices.html +1 -0
- package/docs/functions/getMultiParentPool.html +1 -0
- package/docs/functions/getMultiPool.html +1 -0
- package/docs/functions/getMultiReceipts.html +1 -0
- package/docs/functions/getParentPool.html +1 -0
- package/docs/functions/getPool.html +1 -0
- package/docs/functions/getPoolExchangeRateMap.html +1 -0
- package/docs/functions/getPositionRange.html +1 -0
- package/docs/functions/getPositionTicks.html +1 -0
- package/docs/functions/getPriceToTick.html +1 -0
- package/docs/functions/getRebalanceHistories.html +1 -0
- package/docs/functions/getRebalanceHistory.html +1 -0
- package/docs/functions/getReceipts.html +1 -0
- package/docs/functions/getSingleAssetVaultBalance.html +1 -0
- package/docs/functions/getSingleAssetVaults.html +1 -0
- package/docs/functions/getSuiClient.html +3 -0
- package/docs/functions/getSuiNodeUrl.html +3 -0
- package/docs/functions/getTVLs.html +1 -0
- package/docs/functions/getTickToPrice.html +1 -0
- package/docs/functions/getUserTokensFromTransactions.html +1 -0
- package/docs/functions/getUserTokensInUsdFromTransactions.html +1 -0
- package/docs/functions/getVaultBalance.html +1 -0
- package/docs/functions/getVaultBalanceForActiveUsers.html +1 -0
- package/docs/functions/getVaults.html +1 -0
- package/docs/functions/getXTokenVaultBalanceForActiveUsers.html +1 -0
- package/docs/functions/getZapAmounts.html +1 -0
- package/docs/functions/lastAutocompoundTime.html +1 -0
- package/docs/functions/liquidityToTokens.html +1 -0
- package/docs/functions/multiLiquidityToTokens.html +1 -0
- package/docs/functions/multiTokensToUsd.html +1 -0
- package/docs/functions/multiXTokensToLiquidity.html +1 -0
- package/docs/functions/parseUserWalletData.html +1 -0
- package/docs/functions/setSuiClient.html +7 -0
- package/docs/functions/setSuiNodeUrl.html +5 -0
- package/docs/functions/withdraw.html +1 -0
- package/docs/functions/withdrawAlphaTxb.html +1 -0
- package/docs/functions/withdrawTxb.html +1 -0
- package/docs/functions/zapDepositTxb.html +1 -0
- package/docs/index.html +76 -0
- package/docs/interfaces/Coin.html +12 -0
- package/docs/interfaces/CoinPair.html +3 -0
- package/docs/interfaces/NaviVoloData.html +3 -0
- package/docs/interfaces/RebalanceHistoryType.html +9 -0
- package/docs/modules.html +177 -0
- package/docs/types/AfterTransactionEventNode.html +1 -0
- package/docs/types/Allocator.html +1 -0
- package/docs/types/AlphaFiDoubleAssetVault.html +1 -0
- package/docs/types/AlphaFiMultiVaultBalance.html +1 -0
- package/docs/types/AlphaFiSingleAssetVault.html +1 -0
- package/docs/types/AlphaFiVault.html +1 -0
- package/docs/types/AlphaFiVaultBalance.html +1 -0
- package/docs/types/AlphaPoolType.html +1 -0
- package/docs/types/AlphaReceipt.html +1 -0
- package/docs/types/AlphaReceiptFields.html +1 -0
- package/docs/types/AlphaVaultBalance.html +1 -0
- package/docs/types/AutoCompoundingEventNode.html +1 -0
- package/docs/types/BluefinInvestor.html +1 -0
- package/docs/types/BluefinPoolType.html +1 -0
- package/docs/types/BucketInvestor.html +1 -0
- package/docs/types/CetusInvestor.html +1 -0
- package/docs/types/CetusPoolType.html +1 -0
- package/docs/types/CetusSwapOptions.html +1 -0
- package/docs/types/CoinAmounts.html +1 -0
- package/docs/types/CoinName.html +1 -0
- package/docs/types/CoinType.html +1 -0
- package/docs/types/CommonInvestorFields.html +1 -0
- package/docs/types/CreatePoolOptions.html +1 -0
- package/docs/types/Distributor.html +1 -0
- package/docs/types/DoubleAssetMultiVaultBalance.html +1 -0
- package/docs/types/DoubleAssetPoolNames.html +1 -0
- package/docs/types/DoubleAssetTokenHoldings.html +1 -0
- package/docs/types/DoubleAssetVaultBalance.html +1 -0
- package/docs/types/GetHoldersParams.html +1 -0
- package/docs/types/GetTokenHoldingsParams.html +1 -0
- package/docs/types/GetUserTokensFromTransactionsParams.html +1 -0
- package/docs/types/GetUserTokensInUsdFromTransactionsParams.html +1 -0
- package/docs/types/GetVaultBalanceForActiveUsersParams.html +1 -0
- package/docs/types/GetVaultBalanceParams.html +1 -0
- package/docs/types/HoldingsObj.html +1 -0
- package/docs/types/Icon.html +1 -0
- package/docs/types/Investor.html +1 -0
- package/docs/types/LiquidityChangeEventNode.html +1 -0
- package/docs/types/LiquidityToTokensParams.html +1 -0
- package/docs/types/LiquidityToUsdParams.html +1 -0
- package/docs/types/LoopingDebt.html +1 -0
- package/docs/types/LpBreakdownType.html +1 -0
- package/docs/types/MemberPoolDataType.html +1 -0
- package/docs/types/MemberType.html +1 -0
- package/docs/types/MultiGetVaultBalancesParams.html +1 -0
- package/docs/types/NaviInvestor.html +1 -0
- package/docs/types/OtherReceiptFields.html +1 -0
- package/docs/types/PoolName.html +1 -0
- package/docs/types/PoolReceipt.html +1 -0
- package/docs/types/PoolType.html +1 -0
- package/docs/types/Receipt.html +1 -0
- package/docs/types/ReceiptGQL.html +1 -0
- package/docs/types/SingleAssetMultiVaultBalance.html +1 -0
- package/docs/types/SingleAssetPoolNames.html +1 -0
- package/docs/types/SingleAssetTokenHoldings.html +1 -0
- package/docs/types/SingleAssetVaultBalance.html +1 -0
- package/docs/types/SingleGetVaultBalancesParams.html +1 -0
- package/docs/types/StrategyType.html +1 -0
- package/docs/types/SuiNetwork.html +1 -0
- package/docs/types/SwapOptions.html +1 -0
- package/docs/types/TickSpacing.html +1 -0
- package/docs/types/TotalWeightType.html +1 -0
- package/docs/types/TransactionBlockType.html +1 -0
- package/docs/types/UserPoolLiquidity.html +1 -0
- package/docs/types/UserPoolTokenHoldings.html +1 -0
- package/docs/types/UserUsdHoldings.html +1 -0
- package/docs/types/VaultBalance.html +1 -0
- package/docs/types/WithdrawV2EventNode.html +1 -0
- package/docs/variables/bluefinPoolMap.html +1 -0
- package/docs/variables/cetusPoolMap.html +1 -0
- package/docs/variables/coinsList.html +1 -0
- package/docs/variables/defunctPoolsSet.html +1 -0
- package/docs/variables/doubleAssetPoolCoinMap.html +1 -0
- package/docs/variables/ignoredWalletsForDailyRevenue.html +1 -0
- package/docs/variables/loopingAccountAddresses.html +1 -0
- package/docs/variables/loopingPoolCoinMap.html +1 -0
- package/docs/variables/naviAssetMap.html +1 -0
- package/docs/variables/poolIdPoolNameMap.html +1 -0
- package/docs/variables/poolInfo.html +1 -0
- package/docs/variables/singleAssetPoolCoinMap.html +1 -0
- package/docs/variables/stableCoins.html +1 -0
- package/package.json +2 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Transaction } from "@mysten/sui/transactions";
|
|
2
2
|
import { coinsList } from "../common/coins.js";
|
|
3
3
|
import { getConf } from "../common/constants.js";
|
|
4
|
-
import { cetusPoolMap, doubleAssetPoolCoinMap, poolInfo, } from "../common/maps.js";
|
|
4
|
+
import { bluefinPoolMap, cetusPoolMap, doubleAssetPoolCoinMap, poolInfo, } from "../common/maps.js";
|
|
5
5
|
import { getReceipts } from "../sui-sdk/functions/getReceipts.js";
|
|
6
|
-
import { getAmounts } from "./cetus.js";
|
|
7
6
|
import { getSuiClient } from "../sui-sdk/client.js";
|
|
7
|
+
import { getAmounts } from "./deposit.js";
|
|
8
8
|
export const depositBluefinSuiFirstTxb = async (amount, poolName, isAmountA, options, transaction = undefined) => {
|
|
9
9
|
const suiClient = getSuiClient();
|
|
10
10
|
const address = options.address;
|
|
@@ -64,14 +64,13 @@ export const depositBluefinSuiFirstTxb = async (amount, poolName, isAmountA, opt
|
|
|
64
64
|
arguments: [txb.object(receipt[0].objectId)],
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
-
console.log(poolinfo.poolId);
|
|
68
67
|
if (poolName === "BLUEFIN-SUI-USDC") {
|
|
69
68
|
txb.moveCall({
|
|
70
69
|
target: `${poolinfo.packageId}::alphafi_bluefin_sui_first_pool::user_deposit`,
|
|
71
70
|
typeArguments: [
|
|
72
71
|
coinsList[pool1].type,
|
|
73
72
|
coinsList[pool2].type,
|
|
74
|
-
coinsList["
|
|
73
|
+
coinsList["BLUE"].type,
|
|
75
74
|
coinsList["SUI"].type,
|
|
76
75
|
],
|
|
77
76
|
arguments: [
|
|
@@ -86,7 +85,7 @@ export const depositBluefinSuiFirstTxb = async (amount, poolName, isAmountA, opt
|
|
|
86
85
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
87
86
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
88
87
|
txb.object(getConf().BLUEFIN_SUI_USDC_POOL),
|
|
89
|
-
txb.object(getConf().
|
|
88
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
90
89
|
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
91
90
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
92
91
|
],
|
|
@@ -98,7 +97,7 @@ export const depositBluefinSuiFirstTxb = async (amount, poolName, isAmountA, opt
|
|
|
98
97
|
typeArguments: [
|
|
99
98
|
coinsList[pool1].type,
|
|
100
99
|
coinsList[pool2].type,
|
|
101
|
-
coinsList["
|
|
100
|
+
coinsList["BLUE"].type,
|
|
102
101
|
coinsList["SUI"].type,
|
|
103
102
|
],
|
|
104
103
|
arguments: [
|
|
@@ -113,7 +112,7 @@ export const depositBluefinSuiFirstTxb = async (amount, poolName, isAmountA, opt
|
|
|
113
112
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
114
113
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
115
114
|
txb.object(getConf().BLUEFIN_SUI_BUCK_POOL),
|
|
116
|
-
txb.object(getConf().
|
|
115
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
117
116
|
txb.object(cetusPoolMap["BUCK-SUI"]),
|
|
118
117
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
119
118
|
],
|
|
@@ -125,7 +124,7 @@ export const depositBluefinSuiFirstTxb = async (amount, poolName, isAmountA, opt
|
|
|
125
124
|
typeArguments: [
|
|
126
125
|
coinsList[pool1].type,
|
|
127
126
|
coinsList[pool2].type,
|
|
128
|
-
coinsList["
|
|
127
|
+
coinsList["BLUE"].type,
|
|
129
128
|
coinsList["SUI"].type,
|
|
130
129
|
],
|
|
131
130
|
arguments: [
|
|
@@ -140,7 +139,7 @@ export const depositBluefinSuiFirstTxb = async (amount, poolName, isAmountA, opt
|
|
|
140
139
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
141
140
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
142
141
|
txb.object(getConf().BLUEFIN_SUI_AUSD_POOL),
|
|
143
|
-
txb.object(getConf().
|
|
142
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
144
143
|
txb.object(cetusPoolMap["AUSD-SUI"]),
|
|
145
144
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
146
145
|
],
|
|
@@ -154,6 +153,180 @@ export const depositBluefinSuiFirstTxb = async (amount, poolName, isAmountA, opt
|
|
|
154
153
|
}
|
|
155
154
|
return txb;
|
|
156
155
|
};
|
|
156
|
+
export const depositBluefinSuiSecondTxb = async (amount, poolName, isAmountA, options, transaction = undefined) => {
|
|
157
|
+
const suiClient = getSuiClient();
|
|
158
|
+
const address = options.address;
|
|
159
|
+
let txb;
|
|
160
|
+
if (transaction)
|
|
161
|
+
txb = transaction;
|
|
162
|
+
else
|
|
163
|
+
txb = new Transaction();
|
|
164
|
+
poolName = poolName.toUpperCase();
|
|
165
|
+
const pool1 = doubleAssetPoolCoinMap[poolName].coin1;
|
|
166
|
+
const pool2 = doubleAssetPoolCoinMap[poolName].coin2;
|
|
167
|
+
const receipt = await getReceipts(poolName, address, true);
|
|
168
|
+
let coins1 = [];
|
|
169
|
+
let currentCursor = null;
|
|
170
|
+
do {
|
|
171
|
+
const response = await suiClient.getCoins({
|
|
172
|
+
owner: address,
|
|
173
|
+
coinType: coinsList[pool1].type,
|
|
174
|
+
cursor: currentCursor,
|
|
175
|
+
});
|
|
176
|
+
coins1 = coins1.concat(response.data);
|
|
177
|
+
// Check if there's a next page
|
|
178
|
+
if (response.hasNextPage && response.nextCursor) {
|
|
179
|
+
currentCursor = response.nextCursor;
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
// No more pages available
|
|
183
|
+
// console.log("No more receipts available.");
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
} while (true);
|
|
187
|
+
const amounts = await getAmounts(poolName, isAmountA, amount);
|
|
188
|
+
if (amounts) {
|
|
189
|
+
const amount1 = amounts[0];
|
|
190
|
+
const amount2 = amounts[1];
|
|
191
|
+
let coin1;
|
|
192
|
+
if (coins1.length >= 1) {
|
|
193
|
+
//coin1
|
|
194
|
+
[coin1] = txb.splitCoins(txb.object(coins1[0].coinObjectId), [0]);
|
|
195
|
+
txb.mergeCoins(coin1, coins1.map((c) => c.coinObjectId));
|
|
196
|
+
const [depositCoinA] = txb.splitCoins(coin1, [amount1]);
|
|
197
|
+
//coin2
|
|
198
|
+
const [depositCoinB] = txb.splitCoins(txb.gas, [amount2]);
|
|
199
|
+
const poolinfo = poolInfo[poolName];
|
|
200
|
+
let someReceipt;
|
|
201
|
+
if (receipt.length == 0) {
|
|
202
|
+
[someReceipt] = txb.moveCall({
|
|
203
|
+
target: `0x1::option::none`,
|
|
204
|
+
typeArguments: [poolinfo.receiptType],
|
|
205
|
+
arguments: [],
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
[someReceipt] = txb.moveCall({
|
|
210
|
+
target: `0x1::option::some`,
|
|
211
|
+
typeArguments: [receipt[0].content.type],
|
|
212
|
+
arguments: [txb.object(receipt[0].objectId)],
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
if (poolName === "BLUEFIN-BLUE-SUI") {
|
|
216
|
+
txb.moveCall({
|
|
217
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_second_pool::user_deposit`,
|
|
218
|
+
typeArguments: [
|
|
219
|
+
coinsList[pool1].type,
|
|
220
|
+
coinsList[pool2].type,
|
|
221
|
+
coinsList["DEEP"].type,
|
|
222
|
+
coinsList["SUI"].type,
|
|
223
|
+
],
|
|
224
|
+
arguments: [
|
|
225
|
+
txb.object(getConf().ALPHA_4_VERSION),
|
|
226
|
+
txb.object(getConf().VERSION),
|
|
227
|
+
someReceipt,
|
|
228
|
+
txb.object(poolinfo.poolId),
|
|
229
|
+
depositCoinA,
|
|
230
|
+
depositCoinB,
|
|
231
|
+
txb.object(getConf().ALPHA_DISTRIBUTOR),
|
|
232
|
+
txb.object(poolinfo.investorId),
|
|
233
|
+
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
234
|
+
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
235
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
236
|
+
txb.object(getConf().BLUEFIN_DEEP_SUI_POOL),
|
|
237
|
+
txb.object(cetusPoolMap["BLUE-SUI"]),
|
|
238
|
+
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
239
|
+
],
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
else if (poolName === "BLUEFIN-WBTC-SUI") {
|
|
243
|
+
txb.moveCall({
|
|
244
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_second_pool::user_deposit`,
|
|
245
|
+
typeArguments: [
|
|
246
|
+
coinsList[pool1].type,
|
|
247
|
+
coinsList[pool2].type,
|
|
248
|
+
coinsList["BLUE"].type,
|
|
249
|
+
coinsList["SUI"].type,
|
|
250
|
+
],
|
|
251
|
+
arguments: [
|
|
252
|
+
txb.object(getConf().ALPHA_4_VERSION),
|
|
253
|
+
txb.object(getConf().VERSION),
|
|
254
|
+
someReceipt,
|
|
255
|
+
txb.object(poolinfo.poolId),
|
|
256
|
+
depositCoinA,
|
|
257
|
+
depositCoinB,
|
|
258
|
+
txb.object(getConf().ALPHA_DISTRIBUTOR),
|
|
259
|
+
txb.object(poolinfo.investorId),
|
|
260
|
+
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
261
|
+
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
262
|
+
txb.object(getConf().BLUEFIN_WBTC_SUI_POOL),
|
|
263
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
264
|
+
txb.object(cetusPoolMap["WBTC-SUI"]),
|
|
265
|
+
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
266
|
+
],
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
else if (poolName === "BLUEFIN-DEEP-SUI") {
|
|
270
|
+
txb.moveCall({
|
|
271
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_second_pool::user_deposit`,
|
|
272
|
+
typeArguments: [
|
|
273
|
+
coinsList[pool1].type,
|
|
274
|
+
coinsList[pool2].type,
|
|
275
|
+
coinsList["BLUE"].type,
|
|
276
|
+
coinsList["SUI"].type,
|
|
277
|
+
],
|
|
278
|
+
arguments: [
|
|
279
|
+
txb.object(getConf().ALPHA_4_VERSION),
|
|
280
|
+
txb.object(getConf().VERSION),
|
|
281
|
+
someReceipt,
|
|
282
|
+
txb.object(poolinfo.poolId),
|
|
283
|
+
depositCoinA,
|
|
284
|
+
depositCoinB,
|
|
285
|
+
txb.object(getConf().ALPHA_DISTRIBUTOR),
|
|
286
|
+
txb.object(poolinfo.investorId),
|
|
287
|
+
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
288
|
+
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
289
|
+
txb.object(getConf().BLUEFIN_DEEP_SUI_POOL),
|
|
290
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
291
|
+
txb.object(cetusPoolMap["DEEP-SUI"]),
|
|
292
|
+
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
293
|
+
],
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
else if (poolName === "BLUEFIN-STSUI-SUI") {
|
|
297
|
+
txb.moveCall({
|
|
298
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_stsui_sui_pool::user_deposit`,
|
|
299
|
+
typeArguments: [
|
|
300
|
+
coinsList[pool1].type,
|
|
301
|
+
coinsList[pool2].type,
|
|
302
|
+
coinsList["BLUE"].type,
|
|
303
|
+
],
|
|
304
|
+
arguments: [
|
|
305
|
+
txb.object(getConf().ALPHA_4_VERSION),
|
|
306
|
+
txb.object(getConf().VERSION),
|
|
307
|
+
someReceipt,
|
|
308
|
+
txb.object(poolinfo.poolId),
|
|
309
|
+
depositCoinA,
|
|
310
|
+
depositCoinB,
|
|
311
|
+
txb.object(getConf().ALPHA_DISTRIBUTOR),
|
|
312
|
+
txb.object(poolinfo.investorId),
|
|
313
|
+
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
314
|
+
txb.object(getConf().BLUEFIN_STSUI_SUI_POOL),
|
|
315
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
316
|
+
txb.object(getConf().LST_INFO),
|
|
317
|
+
txb.object(getConf().SUI_SYSTEM_STATE),
|
|
318
|
+
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
319
|
+
],
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
txb.transferObjects([coin1], address);
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
throw new Error(`No ${pool1} or ${pool2} Coins`);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
return txb;
|
|
329
|
+
};
|
|
157
330
|
export const depositBluefinType1Txb = async (amount, poolName, isAmountA, options, transaction = undefined) => {
|
|
158
331
|
const suiClient = getSuiClient();
|
|
159
332
|
const address = options.address;
|
|
@@ -241,7 +414,7 @@ export const depositBluefinType1Txb = async (amount, poolName, isAmountA, option
|
|
|
241
414
|
typeArguments: [
|
|
242
415
|
coinsList[pool1].type,
|
|
243
416
|
coinsList[pool2].type,
|
|
244
|
-
coinsList["
|
|
417
|
+
coinsList["BLUE"].type,
|
|
245
418
|
coinsList["SUI"].type,
|
|
246
419
|
],
|
|
247
420
|
arguments: [
|
|
@@ -256,7 +429,7 @@ export const depositBluefinType1Txb = async (amount, poolName, isAmountA, option
|
|
|
256
429
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
257
430
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
258
431
|
txb.object(getConf().BLUEFIN_USDT_USDC_POOL),
|
|
259
|
-
txb.object(getConf().
|
|
432
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
260
433
|
txb.object(cetusPoolMap["USDC-USDT"]),
|
|
261
434
|
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
262
435
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
@@ -269,7 +442,7 @@ export const depositBluefinType1Txb = async (amount, poolName, isAmountA, option
|
|
|
269
442
|
typeArguments: [
|
|
270
443
|
coinsList[pool1].type,
|
|
271
444
|
coinsList[pool2].type,
|
|
272
|
-
coinsList["
|
|
445
|
+
coinsList["BLUE"].type,
|
|
273
446
|
coinsList["SUI"].type,
|
|
274
447
|
],
|
|
275
448
|
arguments: [
|
|
@@ -284,7 +457,7 @@ export const depositBluefinType1Txb = async (amount, poolName, isAmountA, option
|
|
|
284
457
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
285
458
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
286
459
|
txb.object(getConf().BLUEFIN_AUSD_USDC_POOL),
|
|
287
|
-
txb.object(getConf().
|
|
460
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
288
461
|
txb.object(cetusPoolMap["USDC-AUSD"]),
|
|
289
462
|
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
290
463
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
@@ -297,7 +470,7 @@ export const depositBluefinType1Txb = async (amount, poolName, isAmountA, option
|
|
|
297
470
|
typeArguments: [
|
|
298
471
|
coinsList[pool1].type,
|
|
299
472
|
coinsList[pool2].type,
|
|
300
|
-
coinsList["
|
|
473
|
+
coinsList["BLUE"].type,
|
|
301
474
|
coinsList["SUI"].type,
|
|
302
475
|
],
|
|
303
476
|
arguments: [
|
|
@@ -312,13 +485,69 @@ export const depositBluefinType1Txb = async (amount, poolName, isAmountA, option
|
|
|
312
485
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
313
486
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
314
487
|
txb.object(getConf().BLUEFIN_WBTC_USDC_POOL),
|
|
315
|
-
txb.object(getConf().
|
|
488
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
316
489
|
txb.object(cetusPoolMap["USDC-WBTC"]),
|
|
317
490
|
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
318
491
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
319
492
|
],
|
|
320
493
|
});
|
|
321
494
|
}
|
|
495
|
+
else if (poolName === "BLUEFIN-SEND-USDC") {
|
|
496
|
+
txb.moveCall({
|
|
497
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::user_deposit`,
|
|
498
|
+
typeArguments: [
|
|
499
|
+
coinsList[pool1].type,
|
|
500
|
+
coinsList[pool2].type,
|
|
501
|
+
coinsList["BLUE"].type,
|
|
502
|
+
coinsList["SUI"].type,
|
|
503
|
+
],
|
|
504
|
+
arguments: [
|
|
505
|
+
txb.object(getConf().ALPHA_4_VERSION),
|
|
506
|
+
txb.object(getConf().VERSION),
|
|
507
|
+
someReceipt,
|
|
508
|
+
txb.object(poolinfo.poolId),
|
|
509
|
+
depositCoinA,
|
|
510
|
+
depositCoinB,
|
|
511
|
+
txb.object(getConf().ALPHA_DISTRIBUTOR),
|
|
512
|
+
txb.object(poolinfo.investorId),
|
|
513
|
+
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
514
|
+
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
515
|
+
txb.object(getConf().BLUEFIN_SEND_USDC_POOL),
|
|
516
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
517
|
+
txb.object(cetusPoolMap["USDC-SEND"]),
|
|
518
|
+
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
519
|
+
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
520
|
+
],
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
else if (poolName === "BLUEFIN-STSUI-USDC") {
|
|
524
|
+
txb.moveCall({
|
|
525
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::user_deposit`,
|
|
526
|
+
typeArguments: [
|
|
527
|
+
coinsList[pool1].type,
|
|
528
|
+
coinsList[pool2].type,
|
|
529
|
+
coinsList["BLUE"].type,
|
|
530
|
+
coinsList["SUI"].type,
|
|
531
|
+
],
|
|
532
|
+
arguments: [
|
|
533
|
+
txb.object(getConf().ALPHA_4_VERSION),
|
|
534
|
+
txb.object(getConf().VERSION),
|
|
535
|
+
someReceipt,
|
|
536
|
+
txb.object(poolinfo.poolId),
|
|
537
|
+
depositCoinA,
|
|
538
|
+
depositCoinB,
|
|
539
|
+
txb.object(getConf().ALPHA_DISTRIBUTOR),
|
|
540
|
+
txb.object(poolinfo.investorId),
|
|
541
|
+
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
542
|
+
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
543
|
+
txb.object(getConf().BLUEFIN_STSUI_USDC_POOL),
|
|
544
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
545
|
+
txb.object(cetusPoolMap["USDC-STSUI"]),
|
|
546
|
+
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
547
|
+
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
548
|
+
],
|
|
549
|
+
});
|
|
550
|
+
}
|
|
322
551
|
txb.transferObjects([coin1], address);
|
|
323
552
|
txb.transferObjects([coin2], address);
|
|
324
553
|
}
|
|
@@ -415,7 +644,7 @@ export const depositBluefinType2Txb = async (amount, poolName, isAmountA, option
|
|
|
415
644
|
typeArguments: [
|
|
416
645
|
coinsList[pool1].type,
|
|
417
646
|
coinsList[pool2].type,
|
|
418
|
-
coinsList["
|
|
647
|
+
coinsList["BLUE"].type,
|
|
419
648
|
coinsList["SUI"].type,
|
|
420
649
|
],
|
|
421
650
|
arguments: [
|
|
@@ -430,7 +659,7 @@ export const depositBluefinType2Txb = async (amount, poolName, isAmountA, option
|
|
|
430
659
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
431
660
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
432
661
|
txb.object(getConf().BLUEFIN_ALPHA_USDC_POOL),
|
|
433
|
-
txb.object(getConf().
|
|
662
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
434
663
|
txb.object(cetusPoolMap["ALPHA-USDC"]),
|
|
435
664
|
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
436
665
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
@@ -443,7 +672,7 @@ export const depositBluefinType2Txb = async (amount, poolName, isAmountA, option
|
|
|
443
672
|
typeArguments: [
|
|
444
673
|
coinsList[pool1].type,
|
|
445
674
|
coinsList[pool2].type,
|
|
446
|
-
coinsList["
|
|
675
|
+
coinsList["BLUE"].type,
|
|
447
676
|
coinsList["SUI"].type,
|
|
448
677
|
],
|
|
449
678
|
arguments: [
|
|
@@ -458,57 +687,406 @@ export const depositBluefinType2Txb = async (amount, poolName, isAmountA, option
|
|
|
458
687
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
459
688
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
460
689
|
txb.object(getConf().BLUEFIN_NAVX_VSUI_POOL),
|
|
461
|
-
txb.object(getConf().
|
|
690
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
462
691
|
txb.object(cetusPoolMap["NAVX-VSUI"]),
|
|
463
692
|
txb.object(cetusPoolMap["VSUI-SUI"]),
|
|
464
693
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
465
694
|
],
|
|
466
695
|
});
|
|
467
696
|
}
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
697
|
+
else if (poolName === "BLUEFIN-BLUE-USDC") {
|
|
698
|
+
txb.moveCall({
|
|
699
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_2_pool::user_deposit`,
|
|
700
|
+
typeArguments: [
|
|
701
|
+
coinsList[pool1].type,
|
|
702
|
+
coinsList[pool2].type,
|
|
703
|
+
coinsList["DEEP"].type,
|
|
704
|
+
coinsList["SUI"].type,
|
|
705
|
+
],
|
|
706
|
+
arguments: [
|
|
707
|
+
txb.object(getConf().ALPHA_4_VERSION),
|
|
708
|
+
txb.object(getConf().VERSION),
|
|
709
|
+
someReceipt,
|
|
710
|
+
txb.object(poolinfo.poolId),
|
|
711
|
+
depositCoinA,
|
|
712
|
+
depositCoinB,
|
|
713
|
+
txb.object(getConf().ALPHA_DISTRIBUTOR),
|
|
714
|
+
txb.object(poolinfo.investorId),
|
|
715
|
+
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
716
|
+
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
717
|
+
txb.object(getConf().BLUEFIN_BLUE_USDC_POOL),
|
|
718
|
+
txb.object(getConf().BLUEFIN_DEEP_SUI_POOL),
|
|
719
|
+
txb.object(cetusPoolMap["BLUE-USDC"]),
|
|
720
|
+
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
721
|
+
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
722
|
+
],
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
else if (poolName === "BLUEFIN-STSUI-ETH") {
|
|
726
|
+
txb.moveCall({
|
|
727
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_2_pool::user_deposit`,
|
|
728
|
+
typeArguments: [
|
|
729
|
+
coinsList[pool1].type,
|
|
730
|
+
coinsList[pool2].type,
|
|
731
|
+
coinsList["BLUE"].type,
|
|
732
|
+
coinsList["SUI"].type,
|
|
733
|
+
],
|
|
734
|
+
arguments: [
|
|
735
|
+
txb.object(getConf().ALPHA_4_VERSION),
|
|
736
|
+
txb.object(getConf().VERSION),
|
|
737
|
+
someReceipt,
|
|
738
|
+
txb.object(poolinfo.poolId),
|
|
739
|
+
depositCoinA,
|
|
740
|
+
depositCoinB,
|
|
741
|
+
txb.object(getConf().ALPHA_DISTRIBUTOR),
|
|
742
|
+
txb.object(poolinfo.investorId),
|
|
743
|
+
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
744
|
+
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
745
|
+
txb.object(getConf().BLUEFIN_STSUI_ETH_POOL),
|
|
746
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
747
|
+
txb.object(cetusPoolMap["STSUI-ETH"]),
|
|
748
|
+
txb.object(cetusPoolMap["ETH-SUI"]),
|
|
749
|
+
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
750
|
+
],
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
else if (poolName === "BLUEFIN-STSUI-WSOL") {
|
|
754
|
+
txb.moveCall({
|
|
755
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_2_pool::user_deposit`,
|
|
756
|
+
typeArguments: [
|
|
757
|
+
coinsList[pool1].type,
|
|
758
|
+
coinsList[pool2].type,
|
|
759
|
+
coinsList["BLUE"].type,
|
|
760
|
+
coinsList["SUI"].type,
|
|
761
|
+
],
|
|
762
|
+
arguments: [
|
|
763
|
+
txb.object(getConf().ALPHA_4_VERSION),
|
|
764
|
+
txb.object(getConf().VERSION),
|
|
765
|
+
someReceipt,
|
|
766
|
+
txb.object(poolinfo.poolId),
|
|
767
|
+
depositCoinA,
|
|
768
|
+
depositCoinB,
|
|
769
|
+
txb.object(getConf().ALPHA_DISTRIBUTOR),
|
|
770
|
+
txb.object(poolinfo.investorId),
|
|
771
|
+
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
772
|
+
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
773
|
+
txb.object(getConf().BLUEFIN_STSUI_WSOL_POOL),
|
|
774
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
775
|
+
txb.object(cetusPoolMap["STSUI-WSOL"]),
|
|
776
|
+
txb.object(cetusPoolMap["WSOL-SUI"]),
|
|
777
|
+
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
778
|
+
],
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
txb.transferObjects([coin1], address);
|
|
782
|
+
txb.transferObjects([coin2], address);
|
|
783
|
+
}
|
|
784
|
+
else {
|
|
785
|
+
throw new Error(`No ${pool1} or ${pool2} Coins`);
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
return txb;
|
|
789
|
+
};
|
|
790
|
+
export const depositBluefinStsuiTxb = async (amount, poolName, isAmountA, options, transaction = undefined) => {
|
|
791
|
+
const suiClient = getSuiClient();
|
|
792
|
+
const address = options.address;
|
|
793
|
+
let txb;
|
|
794
|
+
if (transaction)
|
|
795
|
+
txb = transaction;
|
|
796
|
+
else
|
|
797
|
+
txb = new Transaction();
|
|
798
|
+
poolName = poolName.toUpperCase();
|
|
799
|
+
const pool1 = doubleAssetPoolCoinMap[poolName].coin1;
|
|
800
|
+
const pool2 = doubleAssetPoolCoinMap[poolName].coin2;
|
|
801
|
+
const receipt = await getReceipts(poolName, address, true);
|
|
802
|
+
let coins1 = [];
|
|
803
|
+
let coins2 = [];
|
|
804
|
+
let currentCursor = null;
|
|
805
|
+
do {
|
|
806
|
+
const response = await suiClient.getCoins({
|
|
807
|
+
owner: address,
|
|
808
|
+
coinType: coinsList[pool1].type,
|
|
809
|
+
cursor: currentCursor,
|
|
810
|
+
});
|
|
811
|
+
coins1 = coins1.concat(response.data);
|
|
812
|
+
// Check if there's a next page
|
|
813
|
+
if (response.hasNextPage && response.nextCursor) {
|
|
814
|
+
currentCursor = response.nextCursor;
|
|
815
|
+
}
|
|
816
|
+
else {
|
|
817
|
+
// No more pages available
|
|
818
|
+
// console.log("No more receipts available.");
|
|
819
|
+
break;
|
|
820
|
+
}
|
|
821
|
+
} while (true);
|
|
822
|
+
currentCursor = null;
|
|
823
|
+
do {
|
|
824
|
+
const response = await suiClient.getCoins({
|
|
825
|
+
owner: address,
|
|
826
|
+
coinType: coinsList[pool2].type,
|
|
827
|
+
cursor: currentCursor,
|
|
828
|
+
});
|
|
829
|
+
coins2 = coins2.concat(response.data);
|
|
830
|
+
// Check if there's a next page
|
|
831
|
+
if (response.hasNextPage && response.nextCursor) {
|
|
832
|
+
currentCursor = response.nextCursor;
|
|
833
|
+
}
|
|
834
|
+
else {
|
|
835
|
+
// No more pages available
|
|
836
|
+
// console.log("No more receipts available.");
|
|
837
|
+
break;
|
|
838
|
+
}
|
|
839
|
+
} while (true);
|
|
840
|
+
const amounts = await getAmounts(poolName, isAmountA, amount);
|
|
841
|
+
console.log(amounts);
|
|
842
|
+
if (amounts) {
|
|
843
|
+
const amount1 = amounts[0];
|
|
844
|
+
const amount2 = amounts[1];
|
|
845
|
+
let coin1;
|
|
846
|
+
let coin2;
|
|
847
|
+
if (coins1.length >= 1 && coins2.length >= 1) {
|
|
848
|
+
//coin1
|
|
849
|
+
[coin1] = txb.splitCoins(txb.object(coins1[0].coinObjectId), [0]);
|
|
850
|
+
txb.mergeCoins(coin1, coins1.map((c) => c.coinObjectId));
|
|
851
|
+
const [depositCoinA] = txb.splitCoins(coin1, [amount1]);
|
|
852
|
+
//coin2
|
|
853
|
+
[coin2] = txb.splitCoins(txb.object(coins2[0].coinObjectId), [0]);
|
|
854
|
+
txb.mergeCoins(coin2, coins2.map((c) => c.coinObjectId));
|
|
855
|
+
const [depositCoinB] = txb.splitCoins(coin2, [amount2]);
|
|
856
|
+
const poolinfo = poolInfo[poolName];
|
|
857
|
+
let someReceipt;
|
|
858
|
+
if (receipt.length == 0) {
|
|
859
|
+
[someReceipt] = txb.moveCall({
|
|
860
|
+
target: `0x1::option::none`,
|
|
861
|
+
typeArguments: [poolinfo.receiptType],
|
|
862
|
+
arguments: [],
|
|
863
|
+
});
|
|
864
|
+
}
|
|
865
|
+
else {
|
|
866
|
+
[someReceipt] = txb.moveCall({
|
|
867
|
+
target: `0x1::option::some`,
|
|
868
|
+
typeArguments: [receipt[0].content.type],
|
|
869
|
+
arguments: [txb.object(receipt[0].objectId)],
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
if (poolName === "BLUEFIN-STSUI-USDC") {
|
|
873
|
+
txb.moveCall({
|
|
874
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_stsui_first_pool::user_deposit`,
|
|
875
|
+
typeArguments: [
|
|
876
|
+
coinsList[pool1].type,
|
|
877
|
+
coinsList[pool2].type,
|
|
878
|
+
coinsList["BLUE"].type,
|
|
879
|
+
],
|
|
880
|
+
arguments: [
|
|
881
|
+
txb.object(getConf().ALPHA_STSUI_VERSION),
|
|
882
|
+
txb.object(getConf().VERSION),
|
|
883
|
+
someReceipt,
|
|
884
|
+
txb.object(poolinfo.poolId),
|
|
885
|
+
depositCoinA,
|
|
886
|
+
depositCoinB,
|
|
887
|
+
txb.object(getConf().ALPHA_DISTRIBUTOR),
|
|
888
|
+
txb.object(poolinfo.investorId),
|
|
889
|
+
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
890
|
+
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
891
|
+
txb.object(getConf().BLUEFIN_STSUI_USDC_POOL),
|
|
892
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
893
|
+
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
894
|
+
txb.object(bluefinPoolMap["SUI-USDC"]),
|
|
895
|
+
txb.object(getConf().LST_INFO),
|
|
896
|
+
txb.object(getConf().SUI_SYSTEM_STATE),
|
|
897
|
+
txb.pure.bool(true),
|
|
898
|
+
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
899
|
+
],
|
|
900
|
+
});
|
|
901
|
+
}
|
|
902
|
+
else if (poolName === "BLUEFIN-ALPHA-STSUI") {
|
|
903
|
+
txb.moveCall({
|
|
904
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_stsui_second_pool::user_deposit`,
|
|
905
|
+
typeArguments: [
|
|
906
|
+
coinsList[pool1].type,
|
|
907
|
+
coinsList[pool2].type,
|
|
908
|
+
coinsList["BLUE"].type,
|
|
909
|
+
],
|
|
910
|
+
arguments: [
|
|
911
|
+
txb.object(getConf().ALPHA_STSUI_VERSION),
|
|
912
|
+
txb.object(getConf().VERSION),
|
|
913
|
+
someReceipt,
|
|
914
|
+
txb.object(poolinfo.poolId),
|
|
915
|
+
depositCoinA,
|
|
916
|
+
depositCoinB,
|
|
917
|
+
txb.object(getConf().ALPHA_DISTRIBUTOR),
|
|
918
|
+
txb.object(poolinfo.investorId),
|
|
919
|
+
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
920
|
+
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
921
|
+
txb.object(getConf().BLUEFIN_ALPHA_STSUI_POOL),
|
|
922
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
923
|
+
txb.object(cetusPoolMap["ALPHA-SUI"]),
|
|
924
|
+
txb.object(bluefinPoolMap["SUI-ALPHA"]),
|
|
925
|
+
txb.object(getConf().LST_INFO),
|
|
926
|
+
txb.object(getConf().SUI_SYSTEM_STATE),
|
|
927
|
+
txb.pure.bool(false),
|
|
928
|
+
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
929
|
+
],
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
txb.transferObjects([coin1], address);
|
|
933
|
+
txb.transferObjects([coin2], address);
|
|
934
|
+
}
|
|
935
|
+
else {
|
|
936
|
+
throw new Error(`No ${pool1} or ${pool2} Coins`);
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
return txb;
|
|
940
|
+
};
|
|
941
|
+
export const withdrawBluefinSuiFirstTxb = async (xTokens, poolName, options) => {
|
|
942
|
+
const address = options.address;
|
|
943
|
+
const txb = new Transaction();
|
|
944
|
+
const pool1 = doubleAssetPoolCoinMap[poolName].coin1;
|
|
945
|
+
const pool2 = doubleAssetPoolCoinMap[poolName].coin2;
|
|
946
|
+
const receipt = await getReceipts(poolName, address, true);
|
|
947
|
+
const alphaReceipt = await getReceipts("ALPHA", address, true);
|
|
948
|
+
if (receipt.length > 0) {
|
|
949
|
+
let alpha_receipt;
|
|
950
|
+
if (alphaReceipt.length == 0) {
|
|
951
|
+
[alpha_receipt] = txb.moveCall({
|
|
952
|
+
target: `0x1::option::none`,
|
|
953
|
+
typeArguments: [getConf().ALPHA_POOL_RECEIPT],
|
|
954
|
+
arguments: [],
|
|
955
|
+
});
|
|
956
|
+
}
|
|
957
|
+
else {
|
|
958
|
+
[alpha_receipt] = txb.moveCall({
|
|
959
|
+
target: `0x1::option::some`,
|
|
960
|
+
typeArguments: [alphaReceipt[0].content.type],
|
|
961
|
+
arguments: [txb.object(alphaReceipt[0].objectId)],
|
|
962
|
+
});
|
|
963
|
+
}
|
|
964
|
+
const poolinfo = poolInfo[poolName];
|
|
965
|
+
if (poolName === "BLUEFIN-SUI-USDC") {
|
|
966
|
+
txb.moveCall({
|
|
967
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_first_pool::user_withdraw`,
|
|
968
|
+
typeArguments: [
|
|
969
|
+
coinsList[pool1].type,
|
|
970
|
+
coinsList[pool2].type,
|
|
971
|
+
coinsList["BLUE"].type,
|
|
972
|
+
coinsList["SUI"].type,
|
|
973
|
+
],
|
|
974
|
+
arguments: [
|
|
975
|
+
txb.object(getConf().ALPHA_4_VERSION),
|
|
976
|
+
txb.object(getConf().VERSION),
|
|
977
|
+
txb.object(receipt[0].objectId),
|
|
978
|
+
alpha_receipt,
|
|
979
|
+
txb.object(getConf().ALPHA_POOL),
|
|
980
|
+
txb.object(poolinfo.poolId),
|
|
981
|
+
txb.object(getConf().ALPHA_DISTRIBUTOR),
|
|
982
|
+
txb.object(poolinfo.investorId),
|
|
983
|
+
txb.pure.u128(xTokens),
|
|
984
|
+
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
985
|
+
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
986
|
+
txb.object(getConf().BLUEFIN_SUI_USDC_POOL),
|
|
987
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
988
|
+
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
989
|
+
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
990
|
+
],
|
|
991
|
+
});
|
|
992
|
+
}
|
|
993
|
+
else if (poolName === "BLUEFIN-SUI-BUCK") {
|
|
994
|
+
txb.moveCall({
|
|
995
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_first_pool::user_withdraw`,
|
|
996
|
+
typeArguments: [
|
|
997
|
+
coinsList[pool1].type,
|
|
998
|
+
coinsList[pool2].type,
|
|
999
|
+
coinsList["BLUE"].type,
|
|
1000
|
+
coinsList["SUI"].type,
|
|
1001
|
+
],
|
|
1002
|
+
arguments: [
|
|
1003
|
+
txb.object(getConf().ALPHA_4_VERSION),
|
|
1004
|
+
txb.object(getConf().VERSION),
|
|
1005
|
+
txb.object(receipt[0].objectId),
|
|
1006
|
+
alpha_receipt,
|
|
1007
|
+
txb.object(getConf().ALPHA_POOL),
|
|
1008
|
+
txb.object(poolinfo.poolId),
|
|
1009
|
+
txb.object(getConf().ALPHA_DISTRIBUTOR),
|
|
1010
|
+
txb.object(poolinfo.investorId),
|
|
1011
|
+
txb.pure.u128(xTokens),
|
|
1012
|
+
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
1013
|
+
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
1014
|
+
txb.object(getConf().BLUEFIN_SUI_BUCK_POOL),
|
|
1015
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
1016
|
+
txb.object(cetusPoolMap["BUCK-SUI"]),
|
|
1017
|
+
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
1018
|
+
],
|
|
1019
|
+
});
|
|
1020
|
+
}
|
|
1021
|
+
else if (poolName === "BLUEFIN-SUI-AUSD") {
|
|
1022
|
+
txb.moveCall({
|
|
1023
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_first_pool::user_withdraw`,
|
|
1024
|
+
typeArguments: [
|
|
1025
|
+
coinsList[pool1].type,
|
|
1026
|
+
coinsList[pool2].type,
|
|
1027
|
+
coinsList["BLUE"].type,
|
|
1028
|
+
coinsList["SUI"].type,
|
|
1029
|
+
],
|
|
1030
|
+
arguments: [
|
|
1031
|
+
txb.object(getConf().ALPHA_4_VERSION),
|
|
1032
|
+
txb.object(getConf().VERSION),
|
|
1033
|
+
txb.object(receipt[0].objectId),
|
|
1034
|
+
alpha_receipt,
|
|
1035
|
+
txb.object(getConf().ALPHA_POOL),
|
|
1036
|
+
txb.object(poolinfo.poolId),
|
|
1037
|
+
txb.object(getConf().ALPHA_DISTRIBUTOR),
|
|
1038
|
+
txb.object(poolinfo.investorId),
|
|
1039
|
+
txb.pure.u128(xTokens),
|
|
1040
|
+
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
1041
|
+
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
1042
|
+
txb.object(getConf().BLUEFIN_SUI_AUSD_POOL),
|
|
1043
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
1044
|
+
txb.object(cetusPoolMap["AUSD-SUI"]),
|
|
1045
|
+
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
1046
|
+
],
|
|
1047
|
+
});
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
else {
|
|
1051
|
+
throw new Error("No receipt found!");
|
|
1052
|
+
}
|
|
1053
|
+
return txb;
|
|
1054
|
+
};
|
|
1055
|
+
export const withdrawBluefinSuiSecondTxb = async (xTokens, poolName, options) => {
|
|
1056
|
+
const address = options.address;
|
|
1057
|
+
const txb = new Transaction();
|
|
1058
|
+
const pool1 = doubleAssetPoolCoinMap[poolName].coin1;
|
|
1059
|
+
const pool2 = doubleAssetPoolCoinMap[poolName].coin2;
|
|
1060
|
+
const receipt = await getReceipts(poolName, address, true);
|
|
1061
|
+
const alphaReceipt = await getReceipts("ALPHA", address, true);
|
|
1062
|
+
if (receipt.length > 0) {
|
|
1063
|
+
let alpha_receipt;
|
|
1064
|
+
if (alphaReceipt.length == 0) {
|
|
1065
|
+
[alpha_receipt] = txb.moveCall({
|
|
1066
|
+
target: `0x1::option::none`,
|
|
1067
|
+
typeArguments: [getConf().ALPHA_POOL_RECEIPT],
|
|
1068
|
+
arguments: [],
|
|
1069
|
+
});
|
|
1070
|
+
}
|
|
1071
|
+
else {
|
|
1072
|
+
[alpha_receipt] = txb.moveCall({
|
|
1073
|
+
target: `0x1::option::some`,
|
|
1074
|
+
typeArguments: [alphaReceipt[0].content.type],
|
|
1075
|
+
arguments: [txb.object(alphaReceipt[0].objectId)],
|
|
1076
|
+
});
|
|
1077
|
+
}
|
|
1078
|
+
const poolinfo = poolInfo[poolName];
|
|
1079
|
+
if (poolName === "BLUEFIN-BLUE-SUI") {
|
|
1080
|
+
txb.moveCall({
|
|
1081
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_second_pool::user_withdraw`,
|
|
1082
|
+
typeArguments: [
|
|
1083
|
+
coinsList[pool1].type,
|
|
1084
|
+
coinsList[pool2].type,
|
|
1085
|
+
coinsList["DEEP"].type,
|
|
1086
|
+
coinsList["SUI"].type,
|
|
1087
|
+
],
|
|
1088
|
+
arguments: [
|
|
1089
|
+
txb.object(getConf().ALPHA_4_VERSION),
|
|
512
1090
|
txb.object(getConf().VERSION),
|
|
513
1091
|
txb.object(receipt[0].objectId),
|
|
514
1092
|
alpha_receipt,
|
|
@@ -519,20 +1097,20 @@ export const withdrawBluefinSuiFirstTxb = async (xTokens, poolName, options) =>
|
|
|
519
1097
|
txb.pure.u128(xTokens),
|
|
520
1098
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
521
1099
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
522
|
-
txb.object(getConf().
|
|
1100
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
523
1101
|
txb.object(getConf().BLUEFIN_DEEP_SUI_POOL),
|
|
524
|
-
txb.object(cetusPoolMap["
|
|
1102
|
+
txb.object(cetusPoolMap["BLUE-SUI"]),
|
|
525
1103
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
526
1104
|
],
|
|
527
1105
|
});
|
|
528
1106
|
}
|
|
529
|
-
else if (poolName === "BLUEFIN-SUI
|
|
1107
|
+
else if (poolName === "BLUEFIN-WBTC-SUI") {
|
|
530
1108
|
txb.moveCall({
|
|
531
|
-
target: `${poolinfo.packageId}::
|
|
1109
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_second_pool::user_withdraw`,
|
|
532
1110
|
typeArguments: [
|
|
533
1111
|
coinsList[pool1].type,
|
|
534
1112
|
coinsList[pool2].type,
|
|
535
|
-
coinsList["
|
|
1113
|
+
coinsList["BLUE"].type,
|
|
536
1114
|
coinsList["SUI"].type,
|
|
537
1115
|
],
|
|
538
1116
|
arguments: [
|
|
@@ -547,20 +1125,20 @@ export const withdrawBluefinSuiFirstTxb = async (xTokens, poolName, options) =>
|
|
|
547
1125
|
txb.pure.u128(xTokens),
|
|
548
1126
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
549
1127
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
550
|
-
txb.object(getConf().
|
|
551
|
-
txb.object(getConf().
|
|
552
|
-
txb.object(cetusPoolMap["
|
|
1128
|
+
txb.object(getConf().BLUEFIN_WBTC_SUI_POOL),
|
|
1129
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
1130
|
+
txb.object(cetusPoolMap["WBTC-SUI"]),
|
|
553
1131
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
554
1132
|
],
|
|
555
1133
|
});
|
|
556
1134
|
}
|
|
557
|
-
else if (poolName === "BLUEFIN-SUI
|
|
1135
|
+
else if (poolName === "BLUEFIN-DEEP-SUI") {
|
|
558
1136
|
txb.moveCall({
|
|
559
|
-
target: `${poolinfo.packageId}::
|
|
1137
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_second_pool::user_withdraw`,
|
|
560
1138
|
typeArguments: [
|
|
561
1139
|
coinsList[pool1].type,
|
|
562
1140
|
coinsList[pool2].type,
|
|
563
|
-
coinsList["
|
|
1141
|
+
coinsList["BLUE"].type,
|
|
564
1142
|
coinsList["SUI"].type,
|
|
565
1143
|
],
|
|
566
1144
|
arguments: [
|
|
@@ -575,9 +1153,36 @@ export const withdrawBluefinSuiFirstTxb = async (xTokens, poolName, options) =>
|
|
|
575
1153
|
txb.pure.u128(xTokens),
|
|
576
1154
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
577
1155
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
578
|
-
txb.object(getConf().BLUEFIN_SUI_AUSD_POOL),
|
|
579
1156
|
txb.object(getConf().BLUEFIN_DEEP_SUI_POOL),
|
|
580
|
-
txb.object(
|
|
1157
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
1158
|
+
txb.object(cetusPoolMap["DEEP-SUI"]),
|
|
1159
|
+
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
1160
|
+
],
|
|
1161
|
+
});
|
|
1162
|
+
}
|
|
1163
|
+
else if (poolName === "BLUEFIN-STSUI-SUI") {
|
|
1164
|
+
txb.moveCall({
|
|
1165
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_stsui_sui_pool::user_withdraw`,
|
|
1166
|
+
typeArguments: [
|
|
1167
|
+
coinsList[pool1].type,
|
|
1168
|
+
coinsList[pool2].type,
|
|
1169
|
+
coinsList["BLUE"].type,
|
|
1170
|
+
],
|
|
1171
|
+
arguments: [
|
|
1172
|
+
txb.object(getConf().ALPHA_4_VERSION),
|
|
1173
|
+
txb.object(getConf().VERSION),
|
|
1174
|
+
txb.object(receipt[0].objectId),
|
|
1175
|
+
alpha_receipt,
|
|
1176
|
+
txb.object(getConf().ALPHA_POOL),
|
|
1177
|
+
txb.object(poolinfo.poolId),
|
|
1178
|
+
txb.object(getConf().ALPHA_DISTRIBUTOR),
|
|
1179
|
+
txb.object(poolinfo.investorId),
|
|
1180
|
+
txb.pure.u128(xTokens),
|
|
1181
|
+
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
1182
|
+
txb.object(getConf().BLUEFIN_STSUI_SUI_POOL),
|
|
1183
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
1184
|
+
txb.object(getConf().LST_INFO),
|
|
1185
|
+
txb.object(getConf().SUI_SYSTEM_STATE),
|
|
581
1186
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
582
1187
|
],
|
|
583
1188
|
});
|
|
@@ -618,7 +1223,7 @@ export const withdrawBluefinType1Txb = async (xTokens, poolName, options) => {
|
|
|
618
1223
|
typeArguments: [
|
|
619
1224
|
coinsList[pool1].type,
|
|
620
1225
|
coinsList[pool2].type,
|
|
621
|
-
coinsList["
|
|
1226
|
+
coinsList["BLUE"].type,
|
|
622
1227
|
coinsList["SUI"].type,
|
|
623
1228
|
],
|
|
624
1229
|
arguments: [
|
|
@@ -634,7 +1239,7 @@ export const withdrawBluefinType1Txb = async (xTokens, poolName, options) => {
|
|
|
634
1239
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
635
1240
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
636
1241
|
txb.object(getConf().BLUEFIN_USDT_USDC_POOL),
|
|
637
|
-
txb.object(getConf().
|
|
1242
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
638
1243
|
txb.object(cetusPoolMap["USDC-USDT"]),
|
|
639
1244
|
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
640
1245
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
@@ -647,7 +1252,7 @@ export const withdrawBluefinType1Txb = async (xTokens, poolName, options) => {
|
|
|
647
1252
|
typeArguments: [
|
|
648
1253
|
coinsList[pool1].type,
|
|
649
1254
|
coinsList[pool2].type,
|
|
650
|
-
coinsList["
|
|
1255
|
+
coinsList["BLUE"].type,
|
|
651
1256
|
coinsList["SUI"].type,
|
|
652
1257
|
],
|
|
653
1258
|
arguments: [
|
|
@@ -663,7 +1268,7 @@ export const withdrawBluefinType1Txb = async (xTokens, poolName, options) => {
|
|
|
663
1268
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
664
1269
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
665
1270
|
txb.object(getConf().BLUEFIN_AUSD_USDC_POOL),
|
|
666
|
-
txb.object(getConf().
|
|
1271
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
667
1272
|
txb.object(cetusPoolMap["USDC-AUSD"]),
|
|
668
1273
|
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
669
1274
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
@@ -676,7 +1281,7 @@ export const withdrawBluefinType1Txb = async (xTokens, poolName, options) => {
|
|
|
676
1281
|
typeArguments: [
|
|
677
1282
|
coinsList[pool1].type,
|
|
678
1283
|
coinsList[pool2].type,
|
|
679
|
-
coinsList["
|
|
1284
|
+
coinsList["BLUE"].type,
|
|
680
1285
|
coinsList["SUI"].type,
|
|
681
1286
|
],
|
|
682
1287
|
arguments: [
|
|
@@ -692,13 +1297,71 @@ export const withdrawBluefinType1Txb = async (xTokens, poolName, options) => {
|
|
|
692
1297
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
693
1298
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
694
1299
|
txb.object(getConf().BLUEFIN_WBTC_USDC_POOL),
|
|
695
|
-
txb.object(getConf().
|
|
1300
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
696
1301
|
txb.object(cetusPoolMap["USDC-WBTC"]),
|
|
697
1302
|
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
698
1303
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
699
1304
|
],
|
|
700
1305
|
});
|
|
701
1306
|
}
|
|
1307
|
+
else if (poolName === "BLUEFIN-SEND-USDC") {
|
|
1308
|
+
txb.moveCall({
|
|
1309
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::user_withdraw`,
|
|
1310
|
+
typeArguments: [
|
|
1311
|
+
coinsList[pool1].type,
|
|
1312
|
+
coinsList[pool2].type,
|
|
1313
|
+
coinsList["BLUE"].type,
|
|
1314
|
+
coinsList["SUI"].type,
|
|
1315
|
+
],
|
|
1316
|
+
arguments: [
|
|
1317
|
+
txb.object(getConf().ALPHA_4_VERSION),
|
|
1318
|
+
txb.object(getConf().VERSION),
|
|
1319
|
+
txb.object(receipt[0].objectId),
|
|
1320
|
+
alpha_receipt,
|
|
1321
|
+
txb.object(getConf().ALPHA_POOL),
|
|
1322
|
+
txb.object(poolinfo.poolId),
|
|
1323
|
+
txb.object(getConf().ALPHA_DISTRIBUTOR),
|
|
1324
|
+
txb.object(poolinfo.investorId),
|
|
1325
|
+
txb.pure.u128(xTokens),
|
|
1326
|
+
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
1327
|
+
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
1328
|
+
txb.object(getConf().BLUEFIN_SEND_USDC_POOL),
|
|
1329
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
1330
|
+
txb.object(cetusPoolMap["USDC-SEND"]),
|
|
1331
|
+
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
1332
|
+
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
1333
|
+
],
|
|
1334
|
+
});
|
|
1335
|
+
}
|
|
1336
|
+
else if (poolName === "BLUEFIN-STSUI-USDC") {
|
|
1337
|
+
txb.moveCall({
|
|
1338
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::user_withdraw`,
|
|
1339
|
+
typeArguments: [
|
|
1340
|
+
coinsList[pool1].type,
|
|
1341
|
+
coinsList[pool2].type,
|
|
1342
|
+
coinsList["BLUE"].type,
|
|
1343
|
+
coinsList["SUI"].type,
|
|
1344
|
+
],
|
|
1345
|
+
arguments: [
|
|
1346
|
+
txb.object(getConf().ALPHA_4_VERSION),
|
|
1347
|
+
txb.object(getConf().VERSION),
|
|
1348
|
+
txb.object(receipt[0].objectId),
|
|
1349
|
+
alpha_receipt,
|
|
1350
|
+
txb.object(getConf().ALPHA_POOL),
|
|
1351
|
+
txb.object(poolinfo.poolId),
|
|
1352
|
+
txb.object(getConf().ALPHA_DISTRIBUTOR),
|
|
1353
|
+
txb.object(poolinfo.investorId),
|
|
1354
|
+
txb.pure.u128(xTokens),
|
|
1355
|
+
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
1356
|
+
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
1357
|
+
txb.object(getConf().BLUEFIN_STSUI_USDC_POOL),
|
|
1358
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
1359
|
+
txb.object(cetusPoolMap["USDC-STSUI"]),
|
|
1360
|
+
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
1361
|
+
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
1362
|
+
],
|
|
1363
|
+
});
|
|
1364
|
+
}
|
|
702
1365
|
}
|
|
703
1366
|
else {
|
|
704
1367
|
throw new Error("No receipt found!");
|
|
@@ -735,7 +1398,7 @@ export const withdrawBluefinType2Txb = async (xTokens, poolName, options) => {
|
|
|
735
1398
|
typeArguments: [
|
|
736
1399
|
coinsList[pool1].type,
|
|
737
1400
|
coinsList[pool2].type,
|
|
738
|
-
coinsList["
|
|
1401
|
+
coinsList["BLUE"].type,
|
|
739
1402
|
coinsList["SUI"].type,
|
|
740
1403
|
],
|
|
741
1404
|
arguments: [
|
|
@@ -751,7 +1414,7 @@ export const withdrawBluefinType2Txb = async (xTokens, poolName, options) => {
|
|
|
751
1414
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
752
1415
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
753
1416
|
txb.object(getConf().BLUEFIN_ALPHA_USDC_POOL),
|
|
754
|
-
txb.object(getConf().
|
|
1417
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
755
1418
|
txb.object(cetusPoolMap["ALPHA-USDC"]),
|
|
756
1419
|
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
757
1420
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
@@ -764,7 +1427,7 @@ export const withdrawBluefinType2Txb = async (xTokens, poolName, options) => {
|
|
|
764
1427
|
typeArguments: [
|
|
765
1428
|
coinsList[pool1].type,
|
|
766
1429
|
coinsList[pool2].type,
|
|
767
|
-
coinsList["
|
|
1430
|
+
coinsList["BLUE"].type,
|
|
768
1431
|
coinsList["SUI"].type,
|
|
769
1432
|
],
|
|
770
1433
|
arguments: [
|
|
@@ -780,13 +1443,192 @@ export const withdrawBluefinType2Txb = async (xTokens, poolName, options) => {
|
|
|
780
1443
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
781
1444
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
782
1445
|
txb.object(getConf().BLUEFIN_NAVX_VSUI_POOL),
|
|
783
|
-
txb.object(getConf().
|
|
1446
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
784
1447
|
txb.object(cetusPoolMap["NAVX-VSUI"]),
|
|
785
1448
|
txb.object(cetusPoolMap["VSUI-SUI"]),
|
|
786
1449
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
787
1450
|
],
|
|
788
1451
|
});
|
|
789
1452
|
}
|
|
1453
|
+
else if (poolName === "BLUEFIN-BLUE-USDC") {
|
|
1454
|
+
txb.moveCall({
|
|
1455
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_2_pool::user_withdraw`,
|
|
1456
|
+
typeArguments: [
|
|
1457
|
+
coinsList[pool1].type,
|
|
1458
|
+
coinsList[pool2].type,
|
|
1459
|
+
coinsList["DEEP"].type,
|
|
1460
|
+
coinsList["SUI"].type,
|
|
1461
|
+
],
|
|
1462
|
+
arguments: [
|
|
1463
|
+
txb.object(getConf().ALPHA_4_VERSION),
|
|
1464
|
+
txb.object(getConf().VERSION),
|
|
1465
|
+
txb.object(receipt[0].objectId),
|
|
1466
|
+
alpha_receipt,
|
|
1467
|
+
txb.object(getConf().ALPHA_POOL),
|
|
1468
|
+
txb.object(poolinfo.poolId),
|
|
1469
|
+
txb.object(getConf().ALPHA_DISTRIBUTOR),
|
|
1470
|
+
txb.object(poolinfo.investorId),
|
|
1471
|
+
txb.pure.u128(xTokens),
|
|
1472
|
+
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
1473
|
+
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
1474
|
+
txb.object(getConf().BLUEFIN_BLUE_USDC_POOL),
|
|
1475
|
+
txb.object(getConf().BLUEFIN_DEEP_SUI_POOL),
|
|
1476
|
+
txb.object(cetusPoolMap["BLUE-USDC"]),
|
|
1477
|
+
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
1478
|
+
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
1479
|
+
],
|
|
1480
|
+
});
|
|
1481
|
+
}
|
|
1482
|
+
else if (poolName === "BLUEFIN-STSUI-ETH") {
|
|
1483
|
+
txb.moveCall({
|
|
1484
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_2_pool::user_withdraw`,
|
|
1485
|
+
typeArguments: [
|
|
1486
|
+
coinsList[pool1].type,
|
|
1487
|
+
coinsList[pool2].type,
|
|
1488
|
+
coinsList["BLUE"].type,
|
|
1489
|
+
coinsList["SUI"].type,
|
|
1490
|
+
],
|
|
1491
|
+
arguments: [
|
|
1492
|
+
txb.object(getConf().ALPHA_4_VERSION),
|
|
1493
|
+
txb.object(getConf().VERSION),
|
|
1494
|
+
txb.object(receipt[0].objectId),
|
|
1495
|
+
alpha_receipt,
|
|
1496
|
+
txb.object(getConf().ALPHA_POOL),
|
|
1497
|
+
txb.object(poolinfo.poolId),
|
|
1498
|
+
txb.object(getConf().ALPHA_DISTRIBUTOR),
|
|
1499
|
+
txb.object(poolinfo.investorId),
|
|
1500
|
+
txb.pure.u128(xTokens),
|
|
1501
|
+
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
1502
|
+
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
1503
|
+
txb.object(getConf().BLUEFIN_STSUI_ETH_POOL),
|
|
1504
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
1505
|
+
txb.object(cetusPoolMap["STSUI-ETH"]),
|
|
1506
|
+
txb.object(cetusPoolMap["ETH-SUI"]),
|
|
1507
|
+
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
1508
|
+
],
|
|
1509
|
+
});
|
|
1510
|
+
}
|
|
1511
|
+
else if (poolName === "BLUEFIN-STSUI-WSOL") {
|
|
1512
|
+
txb.moveCall({
|
|
1513
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_2_pool::user_withdraw`,
|
|
1514
|
+
typeArguments: [
|
|
1515
|
+
coinsList[pool1].type,
|
|
1516
|
+
coinsList[pool2].type,
|
|
1517
|
+
coinsList["BLUE"].type,
|
|
1518
|
+
coinsList["SUI"].type,
|
|
1519
|
+
],
|
|
1520
|
+
arguments: [
|
|
1521
|
+
txb.object(getConf().ALPHA_4_VERSION),
|
|
1522
|
+
txb.object(getConf().VERSION),
|
|
1523
|
+
txb.object(receipt[0].objectId),
|
|
1524
|
+
alpha_receipt,
|
|
1525
|
+
txb.object(getConf().ALPHA_POOL),
|
|
1526
|
+
txb.object(poolinfo.poolId),
|
|
1527
|
+
txb.object(getConf().ALPHA_DISTRIBUTOR),
|
|
1528
|
+
txb.object(poolinfo.investorId),
|
|
1529
|
+
txb.pure.u128(xTokens),
|
|
1530
|
+
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
1531
|
+
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
1532
|
+
txb.object(getConf().BLUEFIN_STSUI_WSOL_POOL),
|
|
1533
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
1534
|
+
txb.object(cetusPoolMap["STSUI-WSOL"]),
|
|
1535
|
+
txb.object(cetusPoolMap["WSOL-SUI"]),
|
|
1536
|
+
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
1537
|
+
],
|
|
1538
|
+
});
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
else {
|
|
1542
|
+
throw new Error("No receipt found!");
|
|
1543
|
+
}
|
|
1544
|
+
return txb;
|
|
1545
|
+
};
|
|
1546
|
+
export const withdrawBluefinStsuiTxb = async (xTokens, poolName, options) => {
|
|
1547
|
+
const address = options.address;
|
|
1548
|
+
const txb = new Transaction();
|
|
1549
|
+
const pool1 = doubleAssetPoolCoinMap[poolName].coin1;
|
|
1550
|
+
const pool2 = doubleAssetPoolCoinMap[poolName].coin2;
|
|
1551
|
+
const receipt = await getReceipts(poolName, address, true);
|
|
1552
|
+
const alphaReceipt = await getReceipts("ALPHA", address, true);
|
|
1553
|
+
if (receipt.length > 0) {
|
|
1554
|
+
let alpha_receipt;
|
|
1555
|
+
if (alphaReceipt.length == 0) {
|
|
1556
|
+
[alpha_receipt] = txb.moveCall({
|
|
1557
|
+
target: `0x1::option::none`,
|
|
1558
|
+
typeArguments: [getConf().ALPHA_POOL_RECEIPT],
|
|
1559
|
+
arguments: [],
|
|
1560
|
+
});
|
|
1561
|
+
}
|
|
1562
|
+
else {
|
|
1563
|
+
[alpha_receipt] = txb.moveCall({
|
|
1564
|
+
target: `0x1::option::some`,
|
|
1565
|
+
typeArguments: [alphaReceipt[0].content.type],
|
|
1566
|
+
arguments: [txb.object(alphaReceipt[0].objectId)],
|
|
1567
|
+
});
|
|
1568
|
+
}
|
|
1569
|
+
const poolinfo = poolInfo[poolName];
|
|
1570
|
+
if (poolName === "BLUEFIN-STSUI-USDC") {
|
|
1571
|
+
txb.moveCall({
|
|
1572
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_stsui_first_pool::user_withdraw`,
|
|
1573
|
+
typeArguments: [
|
|
1574
|
+
coinsList[pool1].type,
|
|
1575
|
+
coinsList[pool2].type,
|
|
1576
|
+
coinsList["BLUE"].type,
|
|
1577
|
+
],
|
|
1578
|
+
arguments: [
|
|
1579
|
+
txb.object(getConf().ALPHA_STSUI_VERSION),
|
|
1580
|
+
txb.object(getConf().VERSION),
|
|
1581
|
+
txb.object(receipt[0].objectId),
|
|
1582
|
+
alpha_receipt,
|
|
1583
|
+
txb.object(getConf().ALPHA_POOL),
|
|
1584
|
+
txb.object(poolinfo.poolId),
|
|
1585
|
+
txb.object(getConf().ALPHA_DISTRIBUTOR),
|
|
1586
|
+
txb.object(poolinfo.investorId),
|
|
1587
|
+
txb.pure.u128(xTokens),
|
|
1588
|
+
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
1589
|
+
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
1590
|
+
txb.object(getConf().BLUEFIN_STSUI_USDC_POOL),
|
|
1591
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
1592
|
+
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
1593
|
+
txb.object(bluefinPoolMap["SUI-USDC"]),
|
|
1594
|
+
txb.object(getConf().LST_INFO),
|
|
1595
|
+
txb.object(getConf().SUI_SYSTEM_STATE),
|
|
1596
|
+
txb.pure.bool(true),
|
|
1597
|
+
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
1598
|
+
],
|
|
1599
|
+
});
|
|
1600
|
+
}
|
|
1601
|
+
else if (poolName === "BLUEFIN-ALPHA-STSUI") {
|
|
1602
|
+
txb.moveCall({
|
|
1603
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_stsui_second_pool::user_withdraw`,
|
|
1604
|
+
typeArguments: [
|
|
1605
|
+
coinsList[pool1].type,
|
|
1606
|
+
coinsList[pool2].type,
|
|
1607
|
+
coinsList["BLUE"].type,
|
|
1608
|
+
],
|
|
1609
|
+
arguments: [
|
|
1610
|
+
txb.object(getConf().ALPHA_STSUI_VERSION),
|
|
1611
|
+
txb.object(getConf().VERSION),
|
|
1612
|
+
txb.object(receipt[0].objectId),
|
|
1613
|
+
alpha_receipt,
|
|
1614
|
+
txb.object(getConf().ALPHA_POOL),
|
|
1615
|
+
txb.object(poolinfo.poolId),
|
|
1616
|
+
txb.object(getConf().ALPHA_DISTRIBUTOR),
|
|
1617
|
+
txb.object(poolinfo.investorId),
|
|
1618
|
+
txb.pure.u128(xTokens),
|
|
1619
|
+
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
1620
|
+
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
1621
|
+
txb.object(getConf().BLUEFIN_ALPHA_STSUI_POOL),
|
|
1622
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
1623
|
+
txb.object(cetusPoolMap["ALPHA-SUI"]),
|
|
1624
|
+
txb.object(bluefinPoolMap["SUI-ALPHA"]),
|
|
1625
|
+
txb.object(getConf().LST_INFO),
|
|
1626
|
+
txb.object(getConf().SUI_SYSTEM_STATE),
|
|
1627
|
+
txb.pure.bool(false),
|
|
1628
|
+
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
1629
|
+
],
|
|
1630
|
+
});
|
|
1631
|
+
}
|
|
790
1632
|
}
|
|
791
1633
|
else {
|
|
792
1634
|
throw new Error("No receipt found!");
|