@alphafi/alphafi-sdk 0.0.91 → 0.0.93
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/#package.json# +98 -0
- package/dist/cjs/adminFunctions.d.ts.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 +21 -0
- package/dist/cjs/common/constants.d.ts.map +1 -1
- package/dist/cjs/common/constants.js +15 -2
- 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 +65 -4
- 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 -21
- package/dist/cjs/common/types.d.ts.map +1 -1
- package/dist/cjs/common/types.js +0 -17
- package/dist/cjs/common/types.js.map +1 -1
- package/dist/cjs/graphql/client.d.ts +1 -1
- package/dist/cjs/graphql/client.d.ts.map +1 -1
- package/dist/cjs/graphql/executeMutations.d.ts +15 -3
- package/dist/cjs/graphql/executeMutations.d.ts.map +1 -1
- package/dist/cjs/graphql/executeMutations.js +6 -0
- package/dist/cjs/graphql/executeMutations.js.map +1 -1
- package/dist/cjs/graphql/fetchData.d.ts +23 -7
- package/dist/cjs/graphql/fetchData.d.ts.map +1 -1
- package/dist/cjs/graphql/fetchData.js +11 -11
- package/dist/cjs/graphql/fetchData.js.map +1 -1
- package/dist/cjs/graphql/fetchNftHolders.d.ts.map +1 -1
- package/dist/cjs/graphql/fetchNftHolders.js +3 -1
- package/dist/cjs/graphql/fetchNftHolders.js.map +1 -1
- package/dist/cjs/graphql/fetchReceipts.d.ts.map +1 -1
- package/dist/cjs/graphql/fetchReceipts.js +3 -1
- package/dist/cjs/graphql/fetchReceipts.js.map +1 -1
- package/dist/cjs/graphql/getMultiReceipts.d.ts.map +1 -1
- package/dist/cjs/graphql/getMultiReceipts.js +7 -2
- package/dist/cjs/graphql/getMultiReceipts.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +6 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/sui-sdk/client.d.ts.map +1 -1
- package/dist/cjs/sui-sdk/functions/getPortfolioAmounts.d.ts.map +1 -1
- package/dist/cjs/sui-sdk/functions/getPortfolioAmounts.js +9 -3
- package/dist/cjs/sui-sdk/functions/getPortfolioAmounts.js.map +1 -1
- package/dist/cjs/sui-sdk/functions/getReceipts.d.ts +1 -0
- package/dist/cjs/sui-sdk/functions/getReceipts.d.ts.map +1 -1
- package/dist/cjs/sui-sdk/functions/getReceipts.js +2 -2
- package/dist/cjs/sui-sdk/functions/getReceipts.js.map +1 -1
- package/dist/cjs/transactions/7k.d.ts +2 -7
- package/dist/cjs/transactions/7k.d.ts.map +1 -1
- package/dist/cjs/transactions/7k.js +18 -31
- package/dist/cjs/transactions/7k.js.map +1 -1
- package/dist/cjs/transactions/alpha.d.ts.map +1 -1
- package/dist/cjs/transactions/alphalend.d.ts +1 -0
- package/dist/cjs/transactions/alphalend.d.ts.map +1 -1
- package/dist/cjs/transactions/alphalend.js +148 -201
- package/dist/cjs/transactions/alphalend.js.map +1 -1
- package/dist/cjs/transactions/blueRewards.js +17 -7
- package/dist/cjs/transactions/blueRewards.js.map +1 -1
- package/dist/cjs/transactions/bluefin.d.ts.map +1 -1
- package/dist/cjs/transactions/cetus.d.ts.map +1 -1
- package/dist/cjs/transactions/collect_rewards.d.ts.map +1 -1
- package/dist/cjs/transactions/collect_rewards.js +1 -3
- package/dist/cjs/transactions/collect_rewards.js.map +1 -1
- package/dist/cjs/transactions/get_navi_rewards.d.ts +2 -0
- package/dist/cjs/transactions/get_navi_rewards.d.ts.map +1 -0
- package/dist/cjs/transactions/get_navi_rewards.js +42 -0
- package/dist/cjs/transactions/get_navi_rewards.js.map +1 -0
- package/dist/cjs/transactions/navi-looping.d.ts.map +1 -1
- package/dist/cjs/transactions/navi-looping.js +79 -79
- 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 +142 -141
- package/dist/cjs/transactions/navi.js.map +1 -1
- package/dist/cjs/transactions/newZapDeposit.d.ts +15 -0
- package/dist/cjs/transactions/newZapDeposit.d.ts.map +1 -0
- package/dist/cjs/transactions/newZapDeposit.js +1775 -0
- package/dist/cjs/transactions/newZapDeposit.js.map +1 -0
- package/dist/cjs/transactions/zapDeposit.d.ts +3 -3
- package/dist/cjs/transactions/zapDeposit.d.ts.map +1 -1
- package/dist/cjs/transactions/zapDeposit.js +1043 -503
- package/dist/cjs/transactions/zapDeposit.js.map +1 -1
- package/dist/cjs/utils/clmm/prices.d.ts.map +1 -1
- package/dist/cjs/utils/clmm/prices.js +4 -0
- package/dist/cjs/utils/clmm/prices.js.map +1 -1
- package/dist/cjs/utils/clmm/tokenAmountFromLiquidity.d.ts +0 -1
- package/dist/cjs/utils/clmm/tokenAmountFromLiquidity.d.ts.map +1 -1
- package/dist/cjs/utils/clmm/tokenAmountFromLiquidity.js +0 -1
- package/dist/cjs/utils/clmm/tokenAmountFromLiquidity.js.map +1 -1
- package/dist/cjs/utils/getReceipts.js +1 -1
- package/dist/cjs/utils/getReceipts.js.map +1 -1
- package/dist/cjs/utils/prices.js +2 -2
- package/dist/cjs/utils/prices.js.map +1 -1
- package/dist/esm/adminFunctions.d.ts.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 +21 -0
- package/dist/esm/common/constants.d.ts.map +1 -1
- package/dist/esm/common/constants.js +15 -2
- 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 +65 -4
- 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 -21
- package/dist/esm/common/types.d.ts.map +1 -1
- package/dist/esm/common/types.js +1 -17
- package/dist/esm/common/types.js.map +1 -1
- package/dist/esm/graphql/client.d.ts +1 -1
- package/dist/esm/graphql/client.d.ts.map +1 -1
- package/dist/esm/graphql/executeMutations.d.ts +15 -3
- package/dist/esm/graphql/executeMutations.d.ts.map +1 -1
- package/dist/esm/graphql/executeMutations.js +6 -0
- package/dist/esm/graphql/executeMutations.js.map +1 -1
- package/dist/esm/graphql/fetchData.d.ts +23 -7
- package/dist/esm/graphql/fetchData.d.ts.map +1 -1
- package/dist/esm/graphql/fetchData.js +11 -11
- package/dist/esm/graphql/fetchData.js.map +1 -1
- package/dist/esm/graphql/fetchNftHolders.d.ts.map +1 -1
- package/dist/esm/graphql/fetchNftHolders.js +3 -1
- package/dist/esm/graphql/fetchNftHolders.js.map +1 -1
- package/dist/esm/graphql/fetchReceipts.d.ts.map +1 -1
- package/dist/esm/graphql/fetchReceipts.js +3 -1
- package/dist/esm/graphql/fetchReceipts.js.map +1 -1
- package/dist/esm/graphql/getMultiReceipts.d.ts.map +1 -1
- package/dist/esm/graphql/getMultiReceipts.js +7 -2
- package/dist/esm/graphql/getMultiReceipts.js.map +1 -1
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/sui-sdk/client.d.ts.map +1 -1
- package/dist/esm/sui-sdk/functions/getPortfolioAmounts.d.ts.map +1 -1
- package/dist/esm/sui-sdk/functions/getPortfolioAmounts.js +9 -3
- package/dist/esm/sui-sdk/functions/getPortfolioAmounts.js.map +1 -1
- package/dist/esm/sui-sdk/functions/getReceipts.d.ts +1 -0
- package/dist/esm/sui-sdk/functions/getReceipts.d.ts.map +1 -1
- package/dist/esm/sui-sdk/functions/getReceipts.js +2 -2
- package/dist/esm/sui-sdk/functions/getReceipts.js.map +1 -1
- package/dist/esm/transactions/7k.d.ts +2 -7
- package/dist/esm/transactions/7k.d.ts.map +1 -1
- package/dist/esm/transactions/7k.js +19 -32
- package/dist/esm/transactions/7k.js.map +1 -1
- package/dist/esm/transactions/alpha.d.ts.map +1 -1
- package/dist/esm/transactions/alphalend.d.ts +1 -0
- package/dist/esm/transactions/alphalend.d.ts.map +1 -1
- package/dist/esm/transactions/alphalend.js +147 -201
- package/dist/esm/transactions/alphalend.js.map +1 -1
- package/dist/esm/transactions/bluefin.d.ts.map +1 -1
- package/dist/esm/transactions/cetus.d.ts.map +1 -1
- package/dist/esm/transactions/collect_rewards.d.ts.map +1 -1
- package/dist/esm/transactions/collect_rewards.js +1 -3
- package/dist/esm/transactions/collect_rewards.js.map +1 -1
- package/dist/esm/transactions/get_navi_rewards.d.ts +2 -0
- package/dist/esm/transactions/get_navi_rewards.d.ts.map +1 -0
- package/dist/esm/transactions/get_navi_rewards.js +39 -0
- package/dist/esm/transactions/get_navi_rewards.js.map +1 -0
- package/dist/esm/transactions/navi-looping.d.ts.map +1 -1
- package/dist/esm/transactions/navi-looping.js +79 -79
- 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 +142 -141
- package/dist/esm/transactions/navi.js.map +1 -1
- package/dist/esm/transactions/newZapDeposit.d.ts +15 -0
- package/dist/esm/transactions/newZapDeposit.d.ts.map +1 -0
- package/dist/esm/transactions/newZapDeposit.js +1771 -0
- package/dist/esm/transactions/newZapDeposit.js.map +1 -0
- package/dist/esm/transactions/zapDeposit.d.ts +3 -3
- package/dist/esm/transactions/zapDeposit.d.ts.map +1 -1
- package/dist/esm/transactions/zapDeposit.js +1043 -502
- package/dist/esm/transactions/zapDeposit.js.map +1 -1
- package/dist/esm/utils/clmm/prices.d.ts.map +1 -1
- package/dist/esm/utils/clmm/prices.js +4 -0
- package/dist/esm/utils/clmm/prices.js.map +1 -1
- package/dist/esm/utils/clmm/tokenAmountFromLiquidity.d.ts +0 -1
- package/dist/esm/utils/clmm/tokenAmountFromLiquidity.d.ts.map +1 -1
- package/dist/esm/utils/clmm/tokenAmountFromLiquidity.js +0 -1
- package/dist/esm/utils/clmm/tokenAmountFromLiquidity.js.map +1 -1
- package/dist/esm/utils/getReceipts.js +1 -1
- package/dist/esm/utils/getReceipts.js.map +1 -1
- package/dist/esm/utils/prices.js +2 -2
- package/dist/esm/utils/prices.js.map +1 -1
- package/docs/assets/hierarchy.js +1 -0
- package/docs/assets/icons.js +1 -1
- package/docs/assets/icons.svg +1 -1
- package/docs/assets/main.js +5 -5
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +1428 -1288
- package/docs/functions/alphaLpBreakdown.html +1 -1
- package/docs/functions/cetusLpBreakdown.html +1 -1
- package/docs/functions/claimRewardTxb.html +1 -1
- package/docs/functions/claimRewardsTxb.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/collectAndSwapRewardsSingleLoop.html +1 -0
- package/docs/functions/collectRewardTxb.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/fetchAirdropClaimEvents.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/fetchEvents.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/fetchRequiredPrices.html +1 -1
- package/docs/functions/fetchTVL.html +1 -1
- package/docs/functions/fetchTransactions.html +1 -1
- 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/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/getVaultBalance.html +1 -1
- package/docs/functions/getVaults.html +1 -1
- package/docs/functions/lastAutocompoundTime.html +1 -1
- package/docs/functions/liquidityToTokens.html +1 -1
- package/docs/functions/migrateBoostedToLoop.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/pendingRewardAmount.html +1 -1
- package/docs/functions/setCustomSuiClient.html +3 -3
- 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/zapDepositQuoteTxb.html +1 -0
- package/docs/functions/zapDepositTxb.html +1 -1
- package/docs/hierarchy.html +1 -0
- package/docs/index.html +19 -19
- package/docs/interfaces/Coin.html +10 -10
- package/docs/interfaces/CoinPair.html +3 -3
- package/docs/interfaces/CommonEventAttributes.html +7 -7
- package/docs/interfaces/NaviVoloData.html +3 -3
- package/docs/interfaces/PoolData.html +8 -8
- package/docs/interfaces/PoolWeightDistribution.html +4 -4
- package/docs/interfaces/RebalanceHistoryType.html +9 -9
- package/docs/modules.html +1 -206
- package/docs/types/AfterTransactionEventNode.html +1 -1
- package/docs/types/AirdropClaimEventNode.html +1 -1
- package/docs/types/Allocator.html +3 -1
- package/docs/types/AlphaFiDoubleAssetVault.html +9 -1
- package/docs/types/AlphaFiMultiVaultBalance.html +1 -1
- package/docs/types/AlphaFiSingleAssetVault.html +7 -1
- package/docs/types/AlphaFiVault.html +1 -1
- package/docs/types/AlphaFiVaultBalance.html +1 -1
- package/docs/types/AlphaLendInvestor.html +1 -1
- package/docs/types/AlphaPoolType.html +5 -1
- package/docs/types/AlphaReceipt.html +4 -1
- package/docs/types/AlphaReceiptFields.html +11 -1
- package/docs/types/AlphaVaultBalance.html +7 -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 +5 -1
- package/docs/types/BucketInvestor.html +2 -1
- package/docs/types/CetusInvestor.html +2 -1
- package/docs/types/CetusPoolType.html +5 -1
- package/docs/types/CetusSwapOptions.html +1 -1
- package/docs/types/CoinAmounts.html +3 -1
- package/docs/types/CoinName.html +1 -1
- package/docs/types/CoinType.html +1 -1
- package/docs/types/CommonInvestorFields.html +6 -1
- package/docs/types/CreatePoolOptions.html +8 -1
- package/docs/types/Distributor.html +6 -1
- package/docs/types/DoubleAssetMultiVaultBalance.html +6 -1
- package/docs/types/DoubleAssetPoolNames.html +1 -1
- package/docs/types/DoubleAssetTokenHoldings.html +5 -1
- package/docs/types/DoubleAssetVaultBalance.html +4 -1
- package/docs/types/EventCategory.html +1 -1
- package/docs/types/EventNode.html +1 -1
- package/docs/types/GetHoldersParams.html +4 -1
- package/docs/types/GetTokenHoldingsParams.html +4 -1
- package/docs/types/GetUserTokensFromTransactionsParams.html +5 -1
- package/docs/types/GetUserTokensInUsdFromTransactionsParams.html +6 -1
- package/docs/types/GetVaultBalanceParams.html +1 -1
- package/docs/types/HoldingsObj.html +4 -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 +3 -1
- package/docs/types/LiquidityToUsdParams.html +6 -1
- package/docs/types/LoopingDebt.html +5 -1
- package/docs/types/LoopingPoolNames.html +1 -1
- package/docs/types/LpBreakdownType.html +6 -1
- package/docs/types/MemberPoolDataType.html +3 -1
- package/docs/types/MemberType.html +3 -1
- package/docs/types/MultiGetVaultBalancesParams.html +4 -1
- package/docs/types/NaviInvestor.html +2 -1
- package/docs/types/OtherReceiptFields.html +9 -1
- package/docs/types/PoolName.html +1 -1
- package/docs/types/PoolReceipt.html +1 -1
- package/docs/types/PoolType.html +5 -1
- package/docs/types/Receipt.html +5 -1
- package/docs/types/ReceiptGQL.html +6 -1
- package/docs/types/SingleAssetMultiVaultBalance.html +5 -1
- package/docs/types/SingleAssetPoolNames.html +1 -1
- package/docs/types/SingleAssetTokenHoldings.html +4 -1
- package/docs/types/SingleAssetVaultBalance.html +3 -1
- package/docs/types/SingleGetVaultBalancesParams.html +3 -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 +3 -1
- package/docs/types/TransactionBlockType.html +6 -1
- package/docs/types/UserPoolLiquidity.html +4 -1
- package/docs/types/UserPoolTokenHoldings.html +1 -1
- package/docs/types/UserUsdHoldings.html +4 -1
- package/docs/types/VaultBalance.html +1 -1
- package/docs/types/VoteCastEvent.html +1 -1
- package/docs/types/WithdrawV2EventNode.html +1 -1
- package/docs/variables/AUTOBALANCE_SUI_FIRST_POOLS.html +1 -1
- package/docs/variables/AUTOBALANCE_SUI_SECOND_POOLS.html +1 -1
- package/docs/variables/AUTOBALANCE_TYPE_1_POOLS.html +1 -1
- package/docs/variables/alphalendMarketIdMap.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/eslint.config.js +53 -0
- package/package.json +39 -23
- package/scripts/package-lock.json +2506 -0
- package/scripts/package.json +30 -0
- package/scripts/testRun.ts +101 -0
- package/scripts/utils.ts +104 -0
- package/docs/functions/getZapAmounts.html +0 -1
|
@@ -1,358 +1,486 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.zapDepositTxb = zapDepositTxb;
|
|
4
|
-
exports.
|
|
5
|
-
const tslib_1 = require("tslib");
|
|
4
|
+
exports.zapDepositQuoteTxb = zapDepositQuoteTxb;
|
|
6
5
|
const transactions_1 = require("@mysten/sui/transactions");
|
|
7
|
-
const bn_js_1 = tslib_1.__importDefault(require("bn.js"));
|
|
8
|
-
const client_js_1 = require("../sui-sdk/client.js");
|
|
9
6
|
const maps_js_1 = require("../common/maps.js");
|
|
10
7
|
const coins_js_1 = require("../common/coins.js");
|
|
11
8
|
const deposit_js_1 = require("./deposit.js");
|
|
12
9
|
const _7k_js_1 = require("./7k.js");
|
|
10
|
+
const decimal_js_1 = require("decimal.js");
|
|
11
|
+
const client_js_1 = require("../sui-sdk/client.js");
|
|
13
12
|
const constants_js_1 = require("../common/constants.js");
|
|
14
13
|
const getReceipts_js_1 = require("../sui-sdk/functions/getReceipts.js");
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
14
|
+
async function zapDepositTxb(inputCoinAmount, isInputA, poolName, slippage, // 1% --> 0.01
|
|
15
|
+
address) {
|
|
16
|
+
const tx = new transactions_1.Transaction();
|
|
17
|
+
const suiClient = (0, client_js_1.getSuiClient)();
|
|
18
|
+
const swapGateway = new _7k_js_1.SevenKGateway();
|
|
19
|
+
const [coinTypeA, coinTypeB] = maps_js_1.poolInfo[poolName].assetTypes;
|
|
20
|
+
const coinObject = await getCoinObject(isInputA ? coinTypeA : coinTypeB, tx, suiClient, address);
|
|
21
|
+
const investor = (await (0, getReceipts_js_1.getInvestor)(poolName, false));
|
|
22
|
+
const parentPool = await (0, getReceipts_js_1.getParentPool)(poolName, false);
|
|
23
|
+
// get lower_tick, upper_tick, current_tick_index without 2's complement
|
|
24
|
+
const upper_bound = 443636;
|
|
25
|
+
let lower_tick = Number(investor.content.fields.lower_tick);
|
|
26
|
+
let upper_tick = Number(investor.content.fields.upper_tick);
|
|
27
|
+
let current_tick_index = Number(parentPool.content.fields.current_tick_index.fields.bits);
|
|
28
|
+
if (lower_tick > upper_bound) {
|
|
29
|
+
lower_tick = -~(lower_tick - 1);
|
|
30
|
+
}
|
|
31
|
+
if (upper_tick > upper_bound) {
|
|
32
|
+
upper_tick = -~(upper_tick - 1);
|
|
33
|
+
}
|
|
34
|
+
if (current_tick_index > upper_bound) {
|
|
35
|
+
current_tick_index = -~(current_tick_index - 1);
|
|
36
|
+
}
|
|
37
|
+
if (current_tick_index >= upper_tick) {
|
|
38
|
+
await handleFirstAmountZero({
|
|
39
|
+
tx,
|
|
40
|
+
address,
|
|
41
|
+
poolName,
|
|
42
|
+
inputCoinAmount,
|
|
43
|
+
isInputA,
|
|
44
|
+
slippage,
|
|
45
|
+
coinTypeA: coinTypeA,
|
|
46
|
+
coinTypeB: coinTypeB,
|
|
47
|
+
coinObject,
|
|
48
|
+
});
|
|
49
|
+
return tx;
|
|
50
|
+
}
|
|
51
|
+
else if (current_tick_index < lower_tick) {
|
|
52
|
+
await handleSecondAmountZero({
|
|
53
|
+
tx,
|
|
54
|
+
address,
|
|
55
|
+
poolName,
|
|
56
|
+
inputCoinAmount,
|
|
57
|
+
isInputA,
|
|
58
|
+
slippage,
|
|
59
|
+
coinTypeA: coinTypeA,
|
|
60
|
+
coinTypeB: coinTypeB,
|
|
61
|
+
coinObject,
|
|
62
|
+
});
|
|
63
|
+
return tx;
|
|
64
|
+
}
|
|
65
|
+
// get inital ratio in terms of 2 coins
|
|
66
|
+
let [amountA, amountB] = (await (0, deposit_js_1.getAmounts)(poolName, isInputA, inputCoinAmount.toString())).map((a) => new decimal_js_1.Decimal(a));
|
|
67
|
+
// convert coinA of the initial ratio to coinB to get the ratio in terms of 1 coin i.e. coinB
|
|
68
|
+
if (isInputA) {
|
|
69
|
+
const quoteResponse = await swapGateway.getQuote(coinTypeA, coinTypeB, amountA.toString(), [maps_js_1.poolInfo[poolName].parentPoolId]);
|
|
70
|
+
if (!quoteResponse) {
|
|
71
|
+
console.error("Error fetching quote for zap");
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
amountA = new decimal_js_1.Decimal(quoteResponse.returnAmountWithDecimal);
|
|
31
75
|
}
|
|
32
76
|
else {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
slippage: coinDetails.slippage,
|
|
38
|
-
};
|
|
39
|
-
const result = await zapSwap(swapOptionsI2B, params.txb, coinDetails.poolName);
|
|
40
|
-
if (result) {
|
|
41
|
-
params.amountB = result.amountOut;
|
|
42
|
-
params.txb = result.tx;
|
|
43
|
-
if (result.coinOut)
|
|
44
|
-
params.coinB = result.coinOut;
|
|
77
|
+
const quoteResponse = await swapGateway.getQuote(coinTypeB, coinTypeA, amountB.toString(), [maps_js_1.poolInfo[poolName].parentPoolId]);
|
|
78
|
+
if (!quoteResponse) {
|
|
79
|
+
console.error("Error fetching quote for zap");
|
|
80
|
+
return undefined;
|
|
45
81
|
}
|
|
82
|
+
amountB = new decimal_js_1.Decimal(quoteResponse.returnAmountWithDecimal);
|
|
46
83
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
84
|
+
// get input coin and handle how much of input coin needs to be swapped
|
|
85
|
+
const totalAmount = amountA.add(amountB);
|
|
86
|
+
let [inputCoinToType1, inputCoinToType2] = [new decimal_js_1.Decimal(0), new decimal_js_1.Decimal(0)];
|
|
87
|
+
if (isInputA) {
|
|
88
|
+
inputCoinToType2 = new decimal_js_1.Decimal(inputCoinAmount.toString())
|
|
89
|
+
.mul(amountB)
|
|
90
|
+
.div(totalAmount)
|
|
91
|
+
.mul(amountA.mul(slippage).div(totalAmount).add(1))
|
|
92
|
+
.floor();
|
|
93
|
+
const [coinIn] = tx.splitCoins(coinObject, [
|
|
94
|
+
inputCoinToType2.floor().toString(),
|
|
95
|
+
]);
|
|
96
|
+
const { coinOut: coinOutB, amountOut } = await zapSwap({
|
|
97
|
+
tx,
|
|
98
|
+
address,
|
|
99
|
+
poolName,
|
|
100
|
+
slippage,
|
|
101
|
+
tokenIn: coinTypeA,
|
|
102
|
+
tokenOut: coinTypeB,
|
|
103
|
+
amountIn: inputCoinToType2.toString(),
|
|
104
|
+
coinIn,
|
|
105
|
+
});
|
|
106
|
+
[inputCoinToType1, inputCoinToType2] = (await (0, deposit_js_1.getAmounts)(poolName, false, amountOut.toString(), false)).map((a) => new decimal_js_1.Decimal(a));
|
|
107
|
+
const [coinOutA] = tx.splitCoins(coinObject, [
|
|
108
|
+
inputCoinToType1.floor().toString(),
|
|
109
|
+
]);
|
|
110
|
+
await deposit({
|
|
111
|
+
tx,
|
|
112
|
+
coinA: coinOutA,
|
|
113
|
+
coinB: coinOutB,
|
|
114
|
+
amountA: inputCoinToType1.floor(),
|
|
115
|
+
amountB: inputCoinToType2.floor(),
|
|
116
|
+
address,
|
|
117
|
+
poolName,
|
|
118
|
+
});
|
|
62
119
|
}
|
|
63
120
|
else {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
slippage
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
121
|
+
// calculate amount of coinB to swap to Type A
|
|
122
|
+
inputCoinToType1 = new decimal_js_1.Decimal(inputCoinAmount.toString())
|
|
123
|
+
.mul(amountA)
|
|
124
|
+
.div(totalAmount)
|
|
125
|
+
.mul(amountB.mul(slippage).div(totalAmount).add(1))
|
|
126
|
+
.floor();
|
|
127
|
+
const [coinIn] = tx.splitCoins(coinObject, [
|
|
128
|
+
inputCoinToType1.floor().toString(),
|
|
129
|
+
]);
|
|
130
|
+
// swap coinB to coinA
|
|
131
|
+
const { coinOut: coinOutA, amountOut } = await zapSwap({
|
|
132
|
+
tx,
|
|
133
|
+
address,
|
|
134
|
+
poolName,
|
|
135
|
+
slippage,
|
|
136
|
+
tokenIn: coinTypeB,
|
|
137
|
+
tokenOut: coinTypeA,
|
|
138
|
+
amountIn: inputCoinToType1.toString(),
|
|
139
|
+
coinIn,
|
|
140
|
+
});
|
|
141
|
+
// calculate amount of coinB needed corresponding to the coinA swapped amount
|
|
142
|
+
[inputCoinToType1, inputCoinToType2] = (await (0, deposit_js_1.getAmounts)(poolName, true, amountOut.toString(), false)).map((a) => new decimal_js_1.Decimal(a));
|
|
143
|
+
const [coinOutB] = tx.splitCoins(coinObject, [
|
|
144
|
+
inputCoinToType2.floor().toString(),
|
|
145
|
+
]);
|
|
146
|
+
await deposit({
|
|
147
|
+
tx,
|
|
148
|
+
coinA: coinOutA,
|
|
149
|
+
coinB: coinOutB,
|
|
150
|
+
amountA: inputCoinToType1.floor(),
|
|
151
|
+
amountB: inputCoinToType2.floor(),
|
|
152
|
+
address,
|
|
153
|
+
poolName,
|
|
154
|
+
});
|
|
77
155
|
}
|
|
78
|
-
|
|
156
|
+
tx.transferObjects([coinObject], address);
|
|
157
|
+
return tx;
|
|
79
158
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
const
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
pair: { coinA: coinDetails.inputObject, coinB: coinDetails.swapObjectB },
|
|
107
|
-
senderAddress: coinDetails.address,
|
|
108
|
-
inAmount: new bn_js_1.default(inputAmountToType2),
|
|
109
|
-
slippage: coinDetails.slippage,
|
|
110
|
-
};
|
|
111
|
-
let swapResult;
|
|
112
|
-
if (coinDetails.inputObject.type === coinDetails.swapObjectA.type) {
|
|
113
|
-
swapResult = await zapSwap(swapOptionsI2B, params.txb, coinDetails.poolName);
|
|
114
|
-
if (swapResult) {
|
|
115
|
-
params.amountB = swapResult.amountOut;
|
|
116
|
-
params.txb = swapResult.tx;
|
|
117
|
-
if (swapResult.coinOut)
|
|
118
|
-
params.coinB = swapResult.coinOut;
|
|
119
|
-
}
|
|
120
|
-
params.amountA = inputAmountToType1.toString();
|
|
121
|
-
if (swapResult && swapResult.remainingLSTCoin) {
|
|
122
|
-
params.coinA = swapResult.remainingLSTCoin;
|
|
159
|
+
async function zapDepositQuoteTxb(inputCoinAmount, isInputA, poolName, slippage) {
|
|
160
|
+
const swapGateway = new _7k_js_1.SevenKGateway();
|
|
161
|
+
const [coinTypeA, coinTypeB] = maps_js_1.poolInfo[poolName].assetTypes;
|
|
162
|
+
const investor = (await (0, getReceipts_js_1.getInvestor)(poolName, false));
|
|
163
|
+
const parentPool = await (0, getReceipts_js_1.getParentPool)(poolName, false);
|
|
164
|
+
// get lower_tick, upper_tick, current_tick_index without 2's complement
|
|
165
|
+
const upper_bound = 443636;
|
|
166
|
+
let lower_tick = Number(investor.content.fields.lower_tick);
|
|
167
|
+
let upper_tick = Number(investor.content.fields.upper_tick);
|
|
168
|
+
let current_tick_index = Number(parentPool.content.fields.current_tick_index.fields.bits);
|
|
169
|
+
if (lower_tick > upper_bound) {
|
|
170
|
+
lower_tick = -~(lower_tick - 1);
|
|
171
|
+
}
|
|
172
|
+
if (upper_tick > upper_bound) {
|
|
173
|
+
upper_tick = -~(upper_tick - 1);
|
|
174
|
+
}
|
|
175
|
+
if (current_tick_index > upper_bound) {
|
|
176
|
+
current_tick_index = -~(current_tick_index - 1);
|
|
177
|
+
}
|
|
178
|
+
if (current_tick_index >= upper_tick) {
|
|
179
|
+
if (isInputA) {
|
|
180
|
+
const quoteResponse = await swapGateway.getQuote(coinTypeA, coinTypeB, inputCoinAmount.toString(), [maps_js_1.poolInfo[poolName].parentPoolId]);
|
|
181
|
+
if (!quoteResponse) {
|
|
182
|
+
throw new Error("Error fetching quote for zap");
|
|
183
|
+
}
|
|
184
|
+
return ["0", quoteResponse.returnAmountWithDecimal];
|
|
123
185
|
}
|
|
124
186
|
else {
|
|
125
|
-
|
|
126
|
-
params.txb = res.tx;
|
|
127
|
-
params.coinA = res.coinOut;
|
|
187
|
+
return ["0", inputCoinAmount.toString()];
|
|
128
188
|
}
|
|
129
189
|
}
|
|
130
|
-
else if (
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
params.amountA = swapResult.amountOut;
|
|
134
|
-
params.txb = swapResult.tx;
|
|
135
|
-
if (swapResult.coinOut)
|
|
136
|
-
params.coinA = swapResult.coinOut;
|
|
137
|
-
}
|
|
138
|
-
if (swapResult && swapResult.remainingLSTCoin) {
|
|
139
|
-
params.coinB = swapResult.remainingLSTCoin;
|
|
190
|
+
else if (current_tick_index < lower_tick) {
|
|
191
|
+
if (isInputA) {
|
|
192
|
+
return [inputCoinAmount.toString(), "0"];
|
|
140
193
|
}
|
|
141
194
|
else {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
195
|
+
const quoteResponse = await swapGateway.getQuote(coinTypeB, coinTypeA, inputCoinAmount.toString(), [maps_js_1.poolInfo[poolName].parentPoolId]);
|
|
196
|
+
if (!quoteResponse) {
|
|
197
|
+
throw new Error("Error fetching quote for zap");
|
|
198
|
+
}
|
|
199
|
+
return [quoteResponse.returnAmountWithDecimal, "0"];
|
|
146
200
|
}
|
|
147
201
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
swapResult = await zapSwap(swapOptionsI2B, params.txb, coinDetails.poolName);
|
|
157
|
-
if (swapResult) {
|
|
158
|
-
params.amountB = swapResult.amountOut;
|
|
159
|
-
params.txb = swapResult.tx;
|
|
160
|
-
if (swapResult.coinOut)
|
|
161
|
-
params.coinB = swapResult.coinOut;
|
|
202
|
+
// get inital ratio in terms of 2 coins
|
|
203
|
+
let [amountA, amountB] = (await (0, deposit_js_1.getAmounts)(poolName, isInputA, inputCoinAmount.toString())).map((a) => new decimal_js_1.Decimal(a));
|
|
204
|
+
// convert coinA of the initial ratio to coinB to get the ratio in terms of 1 coin i.e. coinB
|
|
205
|
+
if (isInputA) {
|
|
206
|
+
const quoteResponse = await swapGateway.getQuote(coinTypeA, coinTypeB, amountA.toString(), [maps_js_1.poolInfo[poolName].parentPoolId]);
|
|
207
|
+
if (!quoteResponse) {
|
|
208
|
+
console.error("Error fetching quote for zap");
|
|
209
|
+
return undefined;
|
|
162
210
|
}
|
|
163
|
-
|
|
164
|
-
return params;
|
|
165
|
-
}
|
|
166
|
-
async function zapDepositTxb(inputCoinName, inputCoinAmount, poolName, slippage, // 0.01 --> 1%, 0.001 --> 0.1%
|
|
167
|
-
address) {
|
|
168
|
-
const suiClient = (0, client_js_1.getSuiClient)();
|
|
169
|
-
let params = {
|
|
170
|
-
txb: new transactions_1.Transaction(),
|
|
171
|
-
coinA: undefined,
|
|
172
|
-
amountA: undefined,
|
|
173
|
-
coinB: undefined,
|
|
174
|
-
amountB: undefined,
|
|
175
|
-
};
|
|
176
|
-
const coinDetails = {
|
|
177
|
-
swapGateway: new _7k_js_1.SevenKGateway(),
|
|
178
|
-
inputObject: coins_js_1.coinsList[inputCoinName],
|
|
179
|
-
inputCoinAmount: inputCoinAmount,
|
|
180
|
-
swapObjectA: coins_js_1.coinsList[maps_js_1.doubleAssetPoolCoinMap[poolName].coin1],
|
|
181
|
-
swapObjectB: coins_js_1.coinsList[maps_js_1.doubleAssetPoolCoinMap[poolName].coin2],
|
|
182
|
-
address: address,
|
|
183
|
-
slippage: slippage,
|
|
184
|
-
poolName: poolName,
|
|
185
|
-
};
|
|
186
|
-
const amounts = await (0, deposit_js_1.getAmounts)(poolName, true, "100000001", true);
|
|
187
|
-
if (Number(amounts[0]) === 0) {
|
|
188
|
-
params = await handleFirstAmountZero(params, coinDetails, suiClient);
|
|
189
|
-
}
|
|
190
|
-
else if (Number(amounts[1]) === 0) {
|
|
191
|
-
params = await handleSecondAmountZero(params, coinDetails, suiClient);
|
|
211
|
+
amountA = new decimal_js_1.Decimal(quoteResponse.returnAmountWithDecimal);
|
|
192
212
|
}
|
|
193
213
|
else {
|
|
194
|
-
const
|
|
195
|
-
if (!
|
|
214
|
+
const quoteResponse = await swapGateway.getQuote(coinTypeB, coinTypeA, amountB.toString(), [maps_js_1.poolInfo[poolName].parentPoolId]);
|
|
215
|
+
if (!quoteResponse) {
|
|
216
|
+
console.error("Error fetching quote for zap");
|
|
196
217
|
return undefined;
|
|
197
|
-
params = result;
|
|
198
|
-
}
|
|
199
|
-
if (params.amountA && params.amountB && params.coinA && params.coinB) {
|
|
200
|
-
// fee charge
|
|
201
|
-
const feePercentage = 0.05;
|
|
202
|
-
const amountAFee = ((Number(params.amountA) * feePercentage) / 100).toFixed(0);
|
|
203
|
-
const amountBFee = ((Number(params.amountB) * feePercentage) / 100).toFixed(0);
|
|
204
|
-
const [feeCoinA] = params.txb.splitCoins(params.coinA, [amountAFee]);
|
|
205
|
-
const [feeCoinB] = params.txb.splitCoins(params.coinB, [amountBFee]);
|
|
206
|
-
params.txb.transferObjects([feeCoinA, feeCoinB], (0, constants_js_1.getConf)().FEE_ADDRESS);
|
|
207
|
-
// Removing fee amounts from amounts and some slippage
|
|
208
|
-
const pool1 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin1;
|
|
209
|
-
const pool2 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin2;
|
|
210
|
-
params.amountA = (Number(params.amountA) * 0.995).toString();
|
|
211
|
-
params.amountB = (Number(params.amountB) * 0.995).toString();
|
|
212
|
-
// Conditional deposit calls based on pool and protocol
|
|
213
|
-
const receipt = await (0, getReceipts_js_1.getReceipts)(poolName, address, true);
|
|
214
|
-
let amounts = await (0, deposit_js_1.getAmounts)(poolName, true, params.amountA, false);
|
|
215
|
-
if (amounts[0] > params.amountA || amounts[1] > params.amountB) {
|
|
216
|
-
amounts = await (0, deposit_js_1.getAmounts)(poolName, false, params.amountB, false);
|
|
217
|
-
}
|
|
218
|
-
const [depositCoinA] = params.txb.splitCoins(params.coinA, [amounts[0]]);
|
|
219
|
-
const [depositCoinB] = params.txb.splitCoins(params.coinB, [amounts[1]]);
|
|
220
|
-
let someReceipt;
|
|
221
|
-
if (receipt.length == 0) {
|
|
222
|
-
[someReceipt] = params.txb.moveCall({
|
|
223
|
-
target: `0x1::option::none`,
|
|
224
|
-
typeArguments: [maps_js_1.poolInfo[poolName].receiptType],
|
|
225
|
-
arguments: [],
|
|
226
|
-
});
|
|
227
218
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
219
|
+
amountB = new decimal_js_1.Decimal(quoteResponse.returnAmountWithDecimal);
|
|
220
|
+
}
|
|
221
|
+
// get input coin and handle how much of input coin needs to be swapped
|
|
222
|
+
const totalAmount = amountA.add(amountB);
|
|
223
|
+
let [inputCoinToType1, inputCoinToType2] = [new decimal_js_1.Decimal(0), new decimal_js_1.Decimal(0)];
|
|
224
|
+
if (isInputA) {
|
|
225
|
+
inputCoinToType2 = new decimal_js_1.Decimal(inputCoinAmount.toString())
|
|
226
|
+
.mul(amountB)
|
|
227
|
+
.div(totalAmount)
|
|
228
|
+
.mul(amountA.mul(slippage).div(totalAmount).add(1))
|
|
229
|
+
.floor();
|
|
230
|
+
const quoteResponse = await swapGateway.getQuote(coinTypeA, coinTypeB, inputCoinToType2.toString(), [maps_js_1.poolInfo[poolName].parentPoolId]);
|
|
231
|
+
if (!quoteResponse) {
|
|
232
|
+
throw new Error("Error fetching quote for zap");
|
|
234
233
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
234
|
+
const slippageReducedAmount = new decimal_js_1.Decimal(quoteResponse.returnAmountWithDecimal)
|
|
235
|
+
.mul(new decimal_js_1.Decimal(1).sub(slippage))
|
|
236
|
+
.floor();
|
|
237
|
+
[inputCoinToType1, inputCoinToType2] = (await (0, deposit_js_1.getAmounts)(poolName, false, slippageReducedAmount.toString(), false)).map((a) => new decimal_js_1.Decimal(a));
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
inputCoinToType1 = new decimal_js_1.Decimal(inputCoinAmount.toString())
|
|
241
|
+
.mul(amountA)
|
|
242
|
+
.div(totalAmount)
|
|
243
|
+
.mul(amountB.mul(slippage).div(totalAmount).add(1))
|
|
244
|
+
.floor();
|
|
245
|
+
const quoteResponse = await swapGateway.getQuote(coinTypeB, coinTypeA, inputCoinToType1.toString(), [maps_js_1.poolInfo[poolName].parentPoolId]);
|
|
246
|
+
if (!quoteResponse) {
|
|
247
|
+
throw new Error("Error fetching quote for zap");
|
|
245
248
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
249
|
+
const slippageReducedAmount = new decimal_js_1.Decimal(quoteResponse.returnAmountWithDecimal)
|
|
250
|
+
.mul(new decimal_js_1.Decimal(1).sub(slippage))
|
|
251
|
+
.floor();
|
|
252
|
+
[inputCoinToType1, inputCoinToType2] = (await (0, deposit_js_1.getAmounts)(poolName, true, slippageReducedAmount.toString(), false)).map((a) => new decimal_js_1.Decimal(a));
|
|
253
|
+
}
|
|
254
|
+
return [
|
|
255
|
+
inputCoinToType1.mul(0.9995).floor().toString(),
|
|
256
|
+
inputCoinToType2.mul(0.9995).floor().toString(),
|
|
257
|
+
];
|
|
258
|
+
}
|
|
259
|
+
async function getCoinObject(coinType, tx, suiClient, address) {
|
|
260
|
+
if (coinType === "0x2::sui::SUI" ||
|
|
261
|
+
coinType ===
|
|
262
|
+
"0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI") {
|
|
263
|
+
return tx.gas;
|
|
264
|
+
}
|
|
265
|
+
let currentCursor = null;
|
|
266
|
+
let coins1 = [];
|
|
267
|
+
do {
|
|
268
|
+
const response = await suiClient.getCoins({
|
|
269
|
+
owner: address,
|
|
270
|
+
coinType,
|
|
271
|
+
cursor: currentCursor,
|
|
272
|
+
});
|
|
273
|
+
coins1 = coins1.concat(response.data);
|
|
274
|
+
if (response.hasNextPage && response.nextCursor) {
|
|
275
|
+
currentCursor = response.nextCursor;
|
|
264
276
|
}
|
|
265
|
-
|
|
277
|
+
else
|
|
278
|
+
break;
|
|
279
|
+
} while (true);
|
|
280
|
+
if (coins1.length === 0) {
|
|
281
|
+
throw new Error(`No coins found for ${coinType} for owner ${address}`);
|
|
266
282
|
}
|
|
267
|
-
|
|
268
|
-
|
|
283
|
+
const [coin] = tx.splitCoins(tx.object(coins1[0].coinObjectId), [0]);
|
|
284
|
+
tx.mergeCoins(coin, coins1.map((c) => c.coinObjectId));
|
|
285
|
+
return coin;
|
|
269
286
|
}
|
|
270
|
-
async function
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
287
|
+
async function zapSwap(params) {
|
|
288
|
+
const swapGateway = new _7k_js_1.SevenKGateway();
|
|
289
|
+
const quoteResponse = await swapGateway.getQuote(params.tokenIn, params.tokenOut, params.amountIn, [maps_js_1.poolInfo[params.poolName].parentPoolId]);
|
|
290
|
+
if (!quoteResponse) {
|
|
291
|
+
throw new Error("Error fetching quote for zap");
|
|
292
|
+
}
|
|
293
|
+
const coinOut = await swapGateway.getTransactionBlock(params.tx, params.address, quoteResponse, params.slippage, params.coinIn);
|
|
294
|
+
if (!coinOut) {
|
|
295
|
+
throw new Error("Error getting transaction block for zap");
|
|
296
|
+
}
|
|
297
|
+
const slippageReducedAmount = new decimal_js_1.Decimal(quoteResponse.returnAmountWithDecimal)
|
|
298
|
+
.mul(new decimal_js_1.Decimal(1).sub(params.slippage))
|
|
299
|
+
.floor();
|
|
300
|
+
const [returnCoinOut] = params.tx.splitCoins(coinOut, [
|
|
301
|
+
slippageReducedAmount.toString(),
|
|
302
|
+
]);
|
|
303
|
+
params.tx.transferObjects([coinOut], params.address);
|
|
304
|
+
return {
|
|
305
|
+
coinOut: returnCoinOut,
|
|
306
|
+
amountOut: slippageReducedAmount,
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
async function handleFirstAmountZero(params) {
|
|
310
|
+
if (params.isInputA) {
|
|
311
|
+
const [toSwap] = params.tx.splitCoins(params.coinObject, [
|
|
312
|
+
params.inputCoinAmount.toString(),
|
|
313
|
+
]);
|
|
314
|
+
const swapResult = await zapSwap({
|
|
315
|
+
tx: params.tx,
|
|
316
|
+
address: params.address,
|
|
317
|
+
poolName: params.poolName,
|
|
318
|
+
slippage: params.slippage,
|
|
319
|
+
tokenIn: params.coinTypeA,
|
|
320
|
+
tokenOut: params.coinTypeB,
|
|
321
|
+
amountIn: params.inputCoinAmount.toString(),
|
|
322
|
+
coinIn: toSwap,
|
|
323
|
+
});
|
|
324
|
+
await deposit({
|
|
325
|
+
tx: params.tx,
|
|
326
|
+
coinA: params.tx.moveCall({
|
|
327
|
+
target: "0x2::coin::zero",
|
|
328
|
+
typeArguments: [params.coinTypeA],
|
|
329
|
+
arguments: [],
|
|
330
|
+
}),
|
|
331
|
+
coinB: swapResult.coinOut,
|
|
332
|
+
amountA: new decimal_js_1.Decimal(0),
|
|
333
|
+
amountB: new decimal_js_1.Decimal(swapResult.amountOut.toString()),
|
|
334
|
+
address: params.address,
|
|
335
|
+
poolName: params.poolName,
|
|
336
|
+
});
|
|
282
337
|
}
|
|
283
338
|
else {
|
|
284
|
-
const
|
|
285
|
-
|
|
339
|
+
const [coinB] = params.tx.splitCoins(params.coinObject, [
|
|
340
|
+
params.inputCoinAmount.toString(),
|
|
286
341
|
]);
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
: "
|
|
291
|
-
|
|
342
|
+
await deposit({
|
|
343
|
+
tx: params.tx,
|
|
344
|
+
coinA: params.tx.moveCall({
|
|
345
|
+
target: "0x2::coin::zero",
|
|
346
|
+
typeArguments: [params.coinTypeA],
|
|
347
|
+
arguments: [],
|
|
348
|
+
}),
|
|
349
|
+
coinB: coinB,
|
|
350
|
+
amountA: new decimal_js_1.Decimal(0),
|
|
351
|
+
amountB: new decimal_js_1.Decimal(params.inputCoinAmount.toString()),
|
|
352
|
+
address: params.address,
|
|
353
|
+
poolName: params.poolName,
|
|
354
|
+
});
|
|
292
355
|
}
|
|
356
|
+
params.tx.transferObjects([params.coinObject], params.address);
|
|
293
357
|
}
|
|
294
|
-
async function
|
|
295
|
-
if (
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
358
|
+
async function handleSecondAmountZero(params) {
|
|
359
|
+
if (params.isInputA) {
|
|
360
|
+
const [coinA] = params.tx.splitCoins(params.coinObject, [
|
|
361
|
+
params.inputCoinAmount.toString(),
|
|
362
|
+
]);
|
|
363
|
+
await deposit({
|
|
364
|
+
tx: params.tx,
|
|
365
|
+
coinA,
|
|
366
|
+
coinB: params.tx.moveCall({
|
|
367
|
+
target: "0x2::coin::zero",
|
|
368
|
+
typeArguments: [params.coinTypeB],
|
|
369
|
+
arguments: [],
|
|
370
|
+
}),
|
|
371
|
+
amountA: new decimal_js_1.Decimal(params.inputCoinAmount.toString()),
|
|
372
|
+
amountB: new decimal_js_1.Decimal(0),
|
|
373
|
+
address: params.address,
|
|
374
|
+
poolName: params.poolName,
|
|
375
|
+
});
|
|
309
376
|
}
|
|
310
377
|
else {
|
|
311
|
-
const
|
|
312
|
-
|
|
313
|
-
maps_js_1.poolInfo[poolName].parentPoolId,
|
|
378
|
+
const [toSwap] = params.tx.splitCoins(params.coinObject, [
|
|
379
|
+
params.inputCoinAmount.toString(),
|
|
314
380
|
]);
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
381
|
+
const swapResult = await zapSwap({
|
|
382
|
+
tx: params.tx,
|
|
383
|
+
address: params.address,
|
|
384
|
+
poolName: params.poolName,
|
|
385
|
+
slippage: params.slippage,
|
|
386
|
+
tokenIn: params.coinTypeB,
|
|
387
|
+
tokenOut: params.coinTypeA,
|
|
388
|
+
amountIn: params.inputCoinAmount.toString(),
|
|
389
|
+
coinIn: toSwap,
|
|
390
|
+
});
|
|
391
|
+
await deposit({
|
|
392
|
+
tx: params.tx,
|
|
393
|
+
coinA: swapResult.coinOut,
|
|
394
|
+
coinB: params.tx.moveCall({
|
|
395
|
+
target: "0x2::coin::zero",
|
|
396
|
+
typeArguments: [params.coinTypeB],
|
|
397
|
+
arguments: [],
|
|
398
|
+
}),
|
|
399
|
+
amountA: new decimal_js_1.Decimal(swapResult.amountOut.toString()),
|
|
400
|
+
amountB: new decimal_js_1.Decimal(0),
|
|
401
|
+
address: params.address,
|
|
402
|
+
poolName: params.poolName,
|
|
403
|
+
});
|
|
326
404
|
}
|
|
405
|
+
params.tx.transferObjects([params.coinObject], params.address);
|
|
327
406
|
}
|
|
328
|
-
async function
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
407
|
+
async function deposit(params) {
|
|
408
|
+
// fee charge
|
|
409
|
+
const feePercentage = 0;
|
|
410
|
+
if (feePercentage > 0) {
|
|
411
|
+
const amountAFee = ((Number(params.amountA) * feePercentage) / 100).toFixed(0);
|
|
412
|
+
const amountBFee = ((Number(params.amountB) * feePercentage) / 100).toFixed(0);
|
|
413
|
+
const [feeCoinA] = params.tx.splitCoins(params.coinA, [amountAFee]);
|
|
414
|
+
const [feeCoinB] = params.tx.splitCoins(params.coinB, [amountBFee]);
|
|
415
|
+
params.tx.transferObjects([feeCoinA, feeCoinB], (0, constants_js_1.getConf)().FEE_ADDRESS);
|
|
416
|
+
// Removing fee amounts from amounts
|
|
417
|
+
params.amountA = params.amountA.sub(amountAFee);
|
|
418
|
+
params.amountB = params.amountB.sub(amountBFee);
|
|
419
|
+
}
|
|
420
|
+
const pool1 = maps_js_1.doubleAssetPoolCoinMap[params.poolName].coin1;
|
|
421
|
+
const pool2 = maps_js_1.doubleAssetPoolCoinMap[params.poolName].coin2;
|
|
422
|
+
const receipt = await (0, getReceipts_js_1.getReceipts)(params.poolName, params.address, false);
|
|
423
|
+
let depositCoinA;
|
|
424
|
+
let depositCoinB;
|
|
425
|
+
if (!params.amountA.eq(0) && !params.amountB.eq(0)) {
|
|
426
|
+
// Conditional deposit calls based on pool and protocol
|
|
427
|
+
let amounts = await (0, deposit_js_1.getAmounts)(params.poolName, true, params.amountA.toString(), false);
|
|
428
|
+
if (amounts[0] > params.amountA.toString() ||
|
|
429
|
+
amounts[1] > params.amountB.toString()) {
|
|
430
|
+
amounts = await (0, deposit_js_1.getAmounts)(params.poolName, false, params.amountB.toString(), false);
|
|
431
|
+
}
|
|
432
|
+
[depositCoinA] = params.tx.splitCoins(params.coinA, [amounts[0]]);
|
|
433
|
+
[depositCoinB] = params.tx.splitCoins(params.coinB, [amounts[1]]);
|
|
434
|
+
params.tx.transferObjects([params.coinA, params.coinB], params.address);
|
|
332
435
|
}
|
|
333
436
|
else {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
437
|
+
[depositCoinA, depositCoinB] = [params.coinA, params.coinB];
|
|
438
|
+
}
|
|
439
|
+
let someReceipt;
|
|
440
|
+
if (receipt.length == 0) {
|
|
441
|
+
[someReceipt] = params.tx.moveCall({
|
|
442
|
+
target: `0x1::option::none`,
|
|
443
|
+
typeArguments: [maps_js_1.poolInfo[params.poolName].receiptType],
|
|
444
|
+
arguments: [],
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
else {
|
|
448
|
+
[someReceipt] = params.tx.moveCall({
|
|
449
|
+
target: `0x1::option::some`,
|
|
450
|
+
typeArguments: [receipt[0].content.type],
|
|
451
|
+
arguments: [params.tx.object(receipt[0].objectId)],
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
if (maps_js_1.poolInfo[params.poolName].parentProtocolName === "CETUS") {
|
|
455
|
+
if (pool1 === "CETUS" && pool2 === "SUI") {
|
|
456
|
+
params.tx = await depositCetusSuiTxb(params.tx, someReceipt, params.poolName, depositCoinA, depositCoinB);
|
|
457
|
+
}
|
|
458
|
+
else if (pool2 === "SUI") {
|
|
459
|
+
params.tx = await depositCetusAlphaSuiTxb(params.tx, someReceipt, params.poolName, depositCoinA, depositCoinB);
|
|
460
|
+
}
|
|
461
|
+
else {
|
|
462
|
+
params.tx = await depositCetusTxb(params.tx, someReceipt, params.poolName, depositCoinA, depositCoinB);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
else if (maps_js_1.poolInfo[params.poolName].parentProtocolName === "BLUEFIN") {
|
|
466
|
+
if (params.poolName === "BLUEFIN-NAVX-VSUI" ||
|
|
467
|
+
params.poolName === "BLUEFIN-ALPHA-USDC" ||
|
|
468
|
+
params.poolName === "BLUEFIN-BLUE-USDC") {
|
|
469
|
+
params.tx = await depositBluefinType2Txb(params.tx, someReceipt, params.poolName, depositCoinA, depositCoinB);
|
|
470
|
+
}
|
|
471
|
+
else if (pool1 === "SUI") {
|
|
472
|
+
params.tx = await depositBluefinSuiFirstTxb(params.tx, someReceipt, params.poolName, depositCoinA, depositCoinB);
|
|
473
|
+
}
|
|
474
|
+
else if (pool2 === "SUI") {
|
|
475
|
+
params.tx = await depositBluefinSuiSecondTxb(params.tx, someReceipt, params.poolName, depositCoinA, depositCoinB);
|
|
476
|
+
}
|
|
477
|
+
else if (pool1 === "STSUI" || pool2 === "STSUI") {
|
|
478
|
+
params.tx = await depositBluefinStsuiTxb(params.tx, someReceipt, params.poolName, depositCoinA, depositCoinB);
|
|
479
|
+
}
|
|
480
|
+
else {
|
|
481
|
+
params.tx = await depositBluefinType1Txb(params.tx, someReceipt, params.poolName, depositCoinA, depositCoinB);
|
|
482
|
+
}
|
|
351
483
|
}
|
|
352
|
-
return {
|
|
353
|
-
tx: txb,
|
|
354
|
-
coinOut: coin,
|
|
355
|
-
};
|
|
356
484
|
}
|
|
357
485
|
const depositCetusTxb = async (txb, someReceipt, poolName, depositCoinA, depositCoinB) => {
|
|
358
486
|
const poolinfo = maps_js_1.poolInfo[poolName];
|
|
@@ -459,16 +587,456 @@ const depositBluefinSuiFirstTxb = async (txb, someReceipt, poolName, depositCoin
|
|
|
459
587
|
const pool2 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin2;
|
|
460
588
|
if (poolName === "BLUEFIN-SUI-USDC") {
|
|
461
589
|
txb.moveCall({
|
|
462
|
-
target: `${poolinfo.packageId}::alphafi_bluefin_sui_first_pool::user_deposit_v2`,
|
|
590
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_first_pool::user_deposit_v2`,
|
|
591
|
+
typeArguments: [
|
|
592
|
+
coins_js_1.coinsList[pool1].type,
|
|
593
|
+
coins_js_1.coinsList[pool2].type,
|
|
594
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
595
|
+
coins_js_1.coinsList["SUI"].type,
|
|
596
|
+
],
|
|
597
|
+
arguments: [
|
|
598
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
599
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
600
|
+
someReceipt,
|
|
601
|
+
txb.object(poolinfo.poolId),
|
|
602
|
+
depositCoinA,
|
|
603
|
+
depositCoinB,
|
|
604
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
605
|
+
txb.object(poolinfo.investorId),
|
|
606
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
607
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
608
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_USDC_POOL),
|
|
609
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
610
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
611
|
+
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
612
|
+
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
613
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
614
|
+
],
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
else if (poolName === "BLUEFIN-SUI-BUCK") {
|
|
618
|
+
txb.moveCall({
|
|
619
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_first_pool::user_deposit_v2`,
|
|
620
|
+
typeArguments: [
|
|
621
|
+
coins_js_1.coinsList[pool1].type,
|
|
622
|
+
coins_js_1.coinsList[pool2].type,
|
|
623
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
624
|
+
coins_js_1.coinsList["SUI"].type,
|
|
625
|
+
],
|
|
626
|
+
arguments: [
|
|
627
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
628
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
629
|
+
someReceipt,
|
|
630
|
+
txb.object(poolinfo.poolId),
|
|
631
|
+
depositCoinA,
|
|
632
|
+
depositCoinB,
|
|
633
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
634
|
+
txb.object(poolinfo.investorId),
|
|
635
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
636
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
637
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_BUCK_POOL),
|
|
638
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
639
|
+
txb.object(maps_js_1.cetusPoolMap["BUCK-SUI"]),
|
|
640
|
+
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
641
|
+
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
642
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
643
|
+
],
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
else if (poolName === "BLUEFIN-SUI-AUSD") {
|
|
647
|
+
txb.moveCall({
|
|
648
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_first_pool::user_deposit_v2`,
|
|
649
|
+
typeArguments: [
|
|
650
|
+
coins_js_1.coinsList[pool1].type,
|
|
651
|
+
coins_js_1.coinsList[pool2].type,
|
|
652
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
653
|
+
coins_js_1.coinsList["SUI"].type,
|
|
654
|
+
],
|
|
655
|
+
arguments: [
|
|
656
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
657
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
658
|
+
someReceipt,
|
|
659
|
+
txb.object(poolinfo.poolId),
|
|
660
|
+
depositCoinA,
|
|
661
|
+
depositCoinB,
|
|
662
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
663
|
+
txb.object(poolinfo.investorId),
|
|
664
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
665
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
666
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_AUSD_POOL),
|
|
667
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
668
|
+
txb.object(maps_js_1.cetusPoolMap["AUSD-SUI"]),
|
|
669
|
+
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
670
|
+
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
671
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
672
|
+
],
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
else if (poolName === "BLUEFIN-AUTOBALANCE-SUI-USDC") {
|
|
676
|
+
txb.moveCall({
|
|
677
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_first_pool::collect_reward`,
|
|
678
|
+
typeArguments: [
|
|
679
|
+
coins_js_1.coinsList[pool1].type,
|
|
680
|
+
coins_js_1.coinsList[pool2].type,
|
|
681
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
682
|
+
],
|
|
683
|
+
arguments: [
|
|
684
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_BLUEFIN_AUTOBALANCE_VERSION),
|
|
685
|
+
txb.object(poolinfo.poolId),
|
|
686
|
+
txb.object(poolinfo.investorId),
|
|
687
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
688
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
689
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_USDC_POOL),
|
|
690
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
691
|
+
],
|
|
692
|
+
});
|
|
693
|
+
txb.moveCall({
|
|
694
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_first_pool::collect_reward`,
|
|
695
|
+
typeArguments: [
|
|
696
|
+
coins_js_1.coinsList[pool1].type,
|
|
697
|
+
coins_js_1.coinsList[pool2].type,
|
|
698
|
+
coins_js_1.coinsList["STSUI"].type,
|
|
699
|
+
],
|
|
700
|
+
arguments: [
|
|
701
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_BLUEFIN_AUTOBALANCE_VERSION),
|
|
702
|
+
txb.object(poolinfo.poolId),
|
|
703
|
+
txb.object(poolinfo.investorId),
|
|
704
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
705
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
706
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_USDC_POOL),
|
|
707
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
708
|
+
],
|
|
709
|
+
});
|
|
710
|
+
txb.moveCall({
|
|
711
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_first_pool::user_deposit_v4`,
|
|
712
|
+
typeArguments: [coins_js_1.coinsList[pool1].type, coins_js_1.coinsList[pool2].type],
|
|
713
|
+
arguments: [
|
|
714
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_BLUEFIN_AUTOBALANCE_VERSION),
|
|
715
|
+
someReceipt,
|
|
716
|
+
txb.object(poolinfo.poolId),
|
|
717
|
+
depositCoinA,
|
|
718
|
+
depositCoinB,
|
|
719
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
720
|
+
txb.object(poolinfo.investorId),
|
|
721
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
722
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_USDC_POOL),
|
|
723
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
724
|
+
],
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
else if (poolName === "BLUEFIN-AUTOBALANCE-SUI-LBTC") {
|
|
728
|
+
txb.moveCall({
|
|
729
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_first_pool::collect_reward`,
|
|
730
|
+
typeArguments: [
|
|
731
|
+
coins_js_1.coinsList[pool1].type,
|
|
732
|
+
coins_js_1.coinsList[pool2].type,
|
|
733
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
734
|
+
],
|
|
735
|
+
arguments: [
|
|
736
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_BLUEFIN_AUTOBALANCE_VERSION),
|
|
737
|
+
txb.object(poolinfo.poolId),
|
|
738
|
+
txb.object(poolinfo.investorId),
|
|
739
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
740
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
741
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_USDC_POOL),
|
|
742
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
743
|
+
],
|
|
744
|
+
});
|
|
745
|
+
txb.moveCall({
|
|
746
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_first_pool::collect_reward`,
|
|
747
|
+
typeArguments: [
|
|
748
|
+
coins_js_1.coinsList[pool1].type,
|
|
749
|
+
coins_js_1.coinsList[pool2].type,
|
|
750
|
+
coins_js_1.coinsList["STSUI"].type,
|
|
751
|
+
],
|
|
752
|
+
arguments: [
|
|
753
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_BLUEFIN_AUTOBALANCE_VERSION),
|
|
754
|
+
txb.object(poolinfo.poolId),
|
|
755
|
+
txb.object(poolinfo.investorId),
|
|
756
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
757
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
758
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_USDC_POOL),
|
|
759
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
760
|
+
],
|
|
761
|
+
});
|
|
762
|
+
txb.moveCall({
|
|
763
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_first_pool::user_deposit_v4`,
|
|
764
|
+
typeArguments: [coins_js_1.coinsList[pool1].type, coins_js_1.coinsList[pool2].type],
|
|
765
|
+
arguments: [
|
|
766
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_BLUEFIN_AUTOBALANCE_VERSION),
|
|
767
|
+
someReceipt,
|
|
768
|
+
txb.object(poolinfo.poolId),
|
|
769
|
+
depositCoinA,
|
|
770
|
+
depositCoinB,
|
|
771
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
772
|
+
txb.object(poolinfo.investorId),
|
|
773
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
774
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_LBTC_POOL),
|
|
775
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
776
|
+
],
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
return txb;
|
|
780
|
+
};
|
|
781
|
+
const depositBluefinType1Txb = async (txb, someReceipt, poolName, depositCoinA, depositCoinB) => {
|
|
782
|
+
const poolinfo = maps_js_1.poolInfo[poolName];
|
|
783
|
+
const pool1 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin1;
|
|
784
|
+
const pool2 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin2;
|
|
785
|
+
if (poolName === "BLUEFIN-USDT-USDC") {
|
|
786
|
+
txb.moveCall({
|
|
787
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_investor::collect_and_swap_rewards_to_token_b_bluefin`,
|
|
788
|
+
typeArguments: [
|
|
789
|
+
coins_js_1.coinsList[maps_js_1.doubleAssetPoolCoinMap[poolName].coin1].type,
|
|
790
|
+
coins_js_1.coinsList[maps_js_1.doubleAssetPoolCoinMap[poolName].coin2].type,
|
|
791
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
792
|
+
coins_js_1.coinsList["SUI"].type,
|
|
793
|
+
],
|
|
794
|
+
arguments: [
|
|
795
|
+
txb.object(poolinfo.investorId),
|
|
796
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
797
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
798
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_USDT_USDC_POOL),
|
|
799
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
800
|
+
txb.object(maps_js_1.bluefinPoolMap["SUI-USDC"]),
|
|
801
|
+
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
802
|
+
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
803
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
804
|
+
],
|
|
805
|
+
});
|
|
806
|
+
txb.moveCall({
|
|
807
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::user_deposit_v2`,
|
|
808
|
+
typeArguments: [
|
|
809
|
+
coins_js_1.coinsList[pool1].type,
|
|
810
|
+
coins_js_1.coinsList[pool2].type,
|
|
811
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
812
|
+
coins_js_1.coinsList["SUI"].type,
|
|
813
|
+
],
|
|
814
|
+
arguments: [
|
|
815
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
816
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
817
|
+
someReceipt,
|
|
818
|
+
txb.object(poolinfo.poolId),
|
|
819
|
+
depositCoinA,
|
|
820
|
+
depositCoinB,
|
|
821
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
822
|
+
txb.object(poolinfo.investorId),
|
|
823
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
824
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
825
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_USDT_USDC_POOL),
|
|
826
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
827
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-USDT"]),
|
|
828
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
829
|
+
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
830
|
+
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
831
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
832
|
+
],
|
|
833
|
+
});
|
|
834
|
+
}
|
|
835
|
+
else if (poolName === "BLUEFIN-AUSD-USDC") {
|
|
836
|
+
txb.moveCall({
|
|
837
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_investor::collect_and_swap_rewards_to_token_b_bluefin`,
|
|
838
|
+
typeArguments: [
|
|
839
|
+
coins_js_1.coinsList[maps_js_1.doubleAssetPoolCoinMap[poolName].coin1].type,
|
|
840
|
+
coins_js_1.coinsList[maps_js_1.doubleAssetPoolCoinMap[poolName].coin2].type,
|
|
841
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
842
|
+
coins_js_1.coinsList["SUI"].type,
|
|
843
|
+
],
|
|
844
|
+
arguments: [
|
|
845
|
+
txb.object(poolinfo.investorId),
|
|
846
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
847
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
848
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_AUSD_USDC_POOL),
|
|
849
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
850
|
+
txb.object(maps_js_1.bluefinPoolMap["SUI-USDC"]),
|
|
851
|
+
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
852
|
+
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
853
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
854
|
+
],
|
|
855
|
+
});
|
|
856
|
+
txb.moveCall({
|
|
857
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::user_deposit_v2`,
|
|
858
|
+
typeArguments: [
|
|
859
|
+
coins_js_1.coinsList[pool1].type,
|
|
860
|
+
coins_js_1.coinsList[pool2].type,
|
|
861
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
862
|
+
coins_js_1.coinsList["SUI"].type,
|
|
863
|
+
],
|
|
864
|
+
arguments: [
|
|
865
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
866
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
867
|
+
someReceipt,
|
|
868
|
+
txb.object(poolinfo.poolId),
|
|
869
|
+
depositCoinA,
|
|
870
|
+
depositCoinB,
|
|
871
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
872
|
+
txb.object(poolinfo.investorId),
|
|
873
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
874
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
875
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_AUSD_USDC_POOL),
|
|
876
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
877
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-AUSD"]),
|
|
878
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
879
|
+
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
880
|
+
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
881
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
882
|
+
],
|
|
883
|
+
});
|
|
884
|
+
}
|
|
885
|
+
else if (poolName === "BLUEFIN-WBTC-USDC") {
|
|
886
|
+
txb.moveCall({
|
|
887
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_investor::collect_and_swap_rewards_to_token_b_bluefin`,
|
|
888
|
+
typeArguments: [
|
|
889
|
+
coins_js_1.coinsList[maps_js_1.doubleAssetPoolCoinMap[poolName].coin1].type,
|
|
890
|
+
coins_js_1.coinsList[maps_js_1.doubleAssetPoolCoinMap[poolName].coin2].type,
|
|
891
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
892
|
+
coins_js_1.coinsList["SUI"].type,
|
|
893
|
+
],
|
|
894
|
+
arguments: [
|
|
895
|
+
txb.object(poolinfo.investorId),
|
|
896
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
897
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
898
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_WBTC_USDC_POOL),
|
|
899
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
900
|
+
txb.object(maps_js_1.bluefinPoolMap["SUI-USDC"]),
|
|
901
|
+
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
902
|
+
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
903
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
904
|
+
],
|
|
905
|
+
});
|
|
906
|
+
txb.moveCall({
|
|
907
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::user_deposit_v2`,
|
|
908
|
+
typeArguments: [
|
|
909
|
+
coins_js_1.coinsList[pool1].type,
|
|
910
|
+
coins_js_1.coinsList[pool2].type,
|
|
911
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
912
|
+
coins_js_1.coinsList["SUI"].type,
|
|
913
|
+
],
|
|
914
|
+
arguments: [
|
|
915
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
916
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
917
|
+
someReceipt,
|
|
918
|
+
txb.object(poolinfo.poolId),
|
|
919
|
+
depositCoinA,
|
|
920
|
+
depositCoinB,
|
|
921
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
922
|
+
txb.object(poolinfo.investorId),
|
|
923
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
924
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
925
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_WBTC_USDC_POOL),
|
|
926
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
927
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-WBTC"]),
|
|
928
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
929
|
+
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
930
|
+
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
931
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
932
|
+
],
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
else if (poolName === "BLUEFIN-SEND-USDC") {
|
|
936
|
+
txb.moveCall({
|
|
937
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_investor::collect_and_swap_rewards_to_token_b_bluefin`,
|
|
938
|
+
typeArguments: [
|
|
939
|
+
coins_js_1.coinsList[maps_js_1.doubleAssetPoolCoinMap[poolName].coin1].type,
|
|
940
|
+
coins_js_1.coinsList[maps_js_1.doubleAssetPoolCoinMap[poolName].coin2].type,
|
|
941
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
942
|
+
coins_js_1.coinsList["SUI"].type,
|
|
943
|
+
],
|
|
944
|
+
arguments: [
|
|
945
|
+
txb.object(poolinfo.investorId),
|
|
946
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
947
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
948
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SEND_USDC_POOL),
|
|
949
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
950
|
+
txb.object(maps_js_1.bluefinPoolMap["SUI-USDC"]),
|
|
951
|
+
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
952
|
+
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
953
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
954
|
+
],
|
|
955
|
+
});
|
|
956
|
+
txb.moveCall({
|
|
957
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::user_deposit_v2`,
|
|
958
|
+
typeArguments: [
|
|
959
|
+
coins_js_1.coinsList[pool1].type,
|
|
960
|
+
coins_js_1.coinsList[pool2].type,
|
|
961
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
962
|
+
coins_js_1.coinsList["SUI"].type,
|
|
963
|
+
],
|
|
964
|
+
arguments: [
|
|
965
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
966
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
967
|
+
someReceipt,
|
|
968
|
+
txb.object(poolinfo.poolId),
|
|
969
|
+
depositCoinA,
|
|
970
|
+
depositCoinB,
|
|
971
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
972
|
+
txb.object(poolinfo.investorId),
|
|
973
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
974
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
975
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SEND_USDC_POOL),
|
|
976
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
977
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SEND"]),
|
|
978
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
979
|
+
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
980
|
+
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
981
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
982
|
+
],
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
else if (poolName === "BLUEFIN-STSUI-USDC") {
|
|
986
|
+
txb.moveCall({
|
|
987
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::user_deposit`,
|
|
988
|
+
typeArguments: [
|
|
989
|
+
coins_js_1.coinsList[pool1].type,
|
|
990
|
+
coins_js_1.coinsList[pool2].type,
|
|
991
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
992
|
+
coins_js_1.coinsList["SUI"].type,
|
|
993
|
+
],
|
|
994
|
+
arguments: [
|
|
995
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
996
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
997
|
+
someReceipt,
|
|
998
|
+
txb.object(poolinfo.poolId),
|
|
999
|
+
depositCoinA,
|
|
1000
|
+
depositCoinB,
|
|
1001
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
1002
|
+
txb.object(poolinfo.investorId),
|
|
1003
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
1004
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
1005
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_STSUI_USDC_POOL),
|
|
1006
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
1007
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-STSUI"]),
|
|
1008
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
1009
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
1010
|
+
],
|
|
1011
|
+
});
|
|
1012
|
+
}
|
|
1013
|
+
else if (poolName === "BLUEFIN-AUTOBALANCE-USDT-USDC") {
|
|
1014
|
+
txb.moveCall({
|
|
1015
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::collect_and_swap_trade_fee`,
|
|
1016
|
+
typeArguments: [
|
|
1017
|
+
coins_js_1.coinsList[pool1].type,
|
|
1018
|
+
coins_js_1.coinsList[pool2].type,
|
|
1019
|
+
coins_js_1.coinsList["SUI"].type,
|
|
1020
|
+
],
|
|
1021
|
+
arguments: [
|
|
1022
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_BLUEFIN_AUTOBALANCE_VERSION),
|
|
1023
|
+
txb.object(poolinfo.investorId),
|
|
1024
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
1025
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_USDT_USDC_POOL),
|
|
1026
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_USDC_POOL),
|
|
1027
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
1028
|
+
],
|
|
1029
|
+
});
|
|
1030
|
+
txb.moveCall({
|
|
1031
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::user_deposit_v2`,
|
|
463
1032
|
typeArguments: [
|
|
464
|
-
coins_js_1.coinsList[
|
|
465
|
-
coins_js_1.coinsList[
|
|
1033
|
+
coins_js_1.coinsList["USDT"].type,
|
|
1034
|
+
coins_js_1.coinsList["USDC"].type,
|
|
466
1035
|
coins_js_1.coinsList["BLUE"].type,
|
|
467
1036
|
coins_js_1.coinsList["SUI"].type,
|
|
468
1037
|
],
|
|
469
1038
|
arguments: [
|
|
470
|
-
txb.object((0, constants_js_1.getConf)().
|
|
471
|
-
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
1039
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_BLUEFIN_AUTOBALANCE_VERSION),
|
|
472
1040
|
someReceipt,
|
|
473
1041
|
txb.object(poolinfo.poolId),
|
|
474
1042
|
depositCoinA,
|
|
@@ -477,8 +1045,9 @@ const depositBluefinSuiFirstTxb = async (txb, someReceipt, poolName, depositCoin
|
|
|
477
1045
|
txb.object(poolinfo.investorId),
|
|
478
1046
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
479
1047
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
480
|
-
txb.object((0, constants_js_1.getConf)().
|
|
1048
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_USDT_USDC_POOL),
|
|
481
1049
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
1050
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-USDT"]),
|
|
482
1051
|
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
483
1052
|
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
484
1053
|
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
@@ -486,38 +1055,29 @@ const depositBluefinSuiFirstTxb = async (txb, someReceipt, poolName, depositCoin
|
|
|
486
1055
|
],
|
|
487
1056
|
});
|
|
488
1057
|
}
|
|
489
|
-
else if (poolName === "BLUEFIN-
|
|
1058
|
+
else if (poolName === "BLUEFIN-SUIUSDT-USDC") {
|
|
490
1059
|
txb.moveCall({
|
|
491
|
-
target: `${poolinfo.packageId}::
|
|
1060
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_investor::collect_and_swap_rewards_to_token_b_bluefin`,
|
|
492
1061
|
typeArguments: [
|
|
493
|
-
coins_js_1.coinsList[
|
|
494
|
-
coins_js_1.coinsList[
|
|
1062
|
+
coins_js_1.coinsList[maps_js_1.doubleAssetPoolCoinMap[poolName].coin1].type,
|
|
1063
|
+
coins_js_1.coinsList[maps_js_1.doubleAssetPoolCoinMap[poolName].coin2].type,
|
|
495
1064
|
coins_js_1.coinsList["BLUE"].type,
|
|
496
1065
|
coins_js_1.coinsList["SUI"].type,
|
|
497
1066
|
],
|
|
498
1067
|
arguments: [
|
|
499
|
-
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
500
|
-
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
501
|
-
someReceipt,
|
|
502
|
-
txb.object(poolinfo.poolId),
|
|
503
|
-
depositCoinA,
|
|
504
|
-
depositCoinB,
|
|
505
|
-
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
506
1068
|
txb.object(poolinfo.investorId),
|
|
1069
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
507
1070
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
508
|
-
txb.object((0, constants_js_1.getConf)().
|
|
509
|
-
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_BUCK_POOL),
|
|
1071
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUIUSDT_USDC_POOL),
|
|
510
1072
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
511
|
-
txb.object(maps_js_1.
|
|
1073
|
+
txb.object(maps_js_1.bluefinPoolMap["SUI-USDC"]),
|
|
512
1074
|
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
513
1075
|
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
514
1076
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
515
1077
|
],
|
|
516
1078
|
});
|
|
517
|
-
}
|
|
518
|
-
else if (poolName === "BLUEFIN-SUI-AUSD") {
|
|
519
1079
|
txb.moveCall({
|
|
520
|
-
target: `${poolinfo.packageId}::
|
|
1080
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::user_deposit_v2`,
|
|
521
1081
|
typeArguments: [
|
|
522
1082
|
coins_js_1.coinsList[pool1].type,
|
|
523
1083
|
coins_js_1.coinsList[pool2].type,
|
|
@@ -535,21 +1095,38 @@ const depositBluefinSuiFirstTxb = async (txb, someReceipt, poolName, depositCoin
|
|
|
535
1095
|
txb.object(poolinfo.investorId),
|
|
536
1096
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
537
1097
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
538
|
-
txb.object((0, constants_js_1.getConf)().
|
|
1098
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUIUSDT_USDC_POOL),
|
|
539
1099
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
540
|
-
txb.object(maps_js_1.cetusPoolMap["
|
|
1100
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUIUSDT"]),
|
|
1101
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
541
1102
|
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
542
1103
|
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
543
1104
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
544
1105
|
],
|
|
545
1106
|
});
|
|
546
1107
|
}
|
|
547
|
-
else if (poolName === "BLUEFIN-AUTOBALANCE-
|
|
1108
|
+
else if (poolName === "BLUEFIN-AUTOBALANCE-SUIUSDT-USDC") {
|
|
548
1109
|
txb.moveCall({
|
|
549
|
-
target: `${poolinfo.packageId}::
|
|
1110
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::collect_and_swap_trade_fee`,
|
|
550
1111
|
typeArguments: [
|
|
551
1112
|
coins_js_1.coinsList[pool1].type,
|
|
552
1113
|
coins_js_1.coinsList[pool2].type,
|
|
1114
|
+
coins_js_1.coinsList["SUI"].type,
|
|
1115
|
+
],
|
|
1116
|
+
arguments: [
|
|
1117
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_BLUEFIN_AUTOBALANCE_VERSION),
|
|
1118
|
+
txb.object(poolinfo.investorId),
|
|
1119
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
1120
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUIUSDT_USDC_POOL),
|
|
1121
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_USDC_POOL),
|
|
1122
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
1123
|
+
],
|
|
1124
|
+
});
|
|
1125
|
+
txb.moveCall({
|
|
1126
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::user_deposit_v2`,
|
|
1127
|
+
typeArguments: [
|
|
1128
|
+
coins_js_1.coinsList["SUIUSDT"].type,
|
|
1129
|
+
coins_js_1.coinsList["USDC"].type,
|
|
553
1130
|
coins_js_1.coinsList["BLUE"].type,
|
|
554
1131
|
coins_js_1.coinsList["SUI"].type,
|
|
555
1132
|
],
|
|
@@ -563,8 +1140,9 @@ const depositBluefinSuiFirstTxb = async (txb, someReceipt, poolName, depositCoin
|
|
|
563
1140
|
txb.object(poolinfo.investorId),
|
|
564
1141
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
565
1142
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
566
|
-
txb.object((0, constants_js_1.getConf)().
|
|
1143
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUIUSDT_USDC_POOL),
|
|
567
1144
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
1145
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUIUSDT"]),
|
|
568
1146
|
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
569
1147
|
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
570
1148
|
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
@@ -572,24 +1150,17 @@ const depositBluefinSuiFirstTxb = async (txb, someReceipt, poolName, depositCoin
|
|
|
572
1150
|
],
|
|
573
1151
|
});
|
|
574
1152
|
}
|
|
575
|
-
|
|
576
|
-
};
|
|
577
|
-
const depositBluefinType1Txb = async (txb, someReceipt, poolName, depositCoinA, depositCoinB) => {
|
|
578
|
-
const poolinfo = maps_js_1.poolInfo[poolName];
|
|
579
|
-
const pool1 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin1;
|
|
580
|
-
const pool2 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin2;
|
|
581
|
-
if (poolName === "BLUEFIN-USDT-USDC") {
|
|
1153
|
+
else if (poolName === "BLUEFIN-AUTOBALANCE-DEEP-BLUE") {
|
|
582
1154
|
txb.moveCall({
|
|
583
1155
|
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::user_deposit_v2`,
|
|
584
1156
|
typeArguments: [
|
|
585
|
-
coins_js_1.coinsList[
|
|
586
|
-
coins_js_1.coinsList[
|
|
1157
|
+
coins_js_1.coinsList["DEEP"].type,
|
|
1158
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
587
1159
|
coins_js_1.coinsList["BLUE"].type,
|
|
588
1160
|
coins_js_1.coinsList["SUI"].type,
|
|
589
1161
|
],
|
|
590
1162
|
arguments: [
|
|
591
|
-
txb.object((0, constants_js_1.getConf)().
|
|
592
|
-
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
1163
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_BLUEFIN_AUTOBALANCE_VERSION),
|
|
593
1164
|
someReceipt,
|
|
594
1165
|
txb.object(poolinfo.poolId),
|
|
595
1166
|
depositCoinA,
|
|
@@ -598,28 +1169,43 @@ const depositBluefinType1Txb = async (txb, someReceipt, poolName, depositCoinA,
|
|
|
598
1169
|
txb.object(poolinfo.investorId),
|
|
599
1170
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
600
1171
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
601
|
-
txb.object((0, constants_js_1.getConf)().
|
|
1172
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_DEEP_BLUE_POOL),
|
|
602
1173
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
603
|
-
txb.object(maps_js_1.cetusPoolMap["
|
|
604
|
-
txb.object(maps_js_1.cetusPoolMap["
|
|
1174
|
+
txb.object(maps_js_1.cetusPoolMap["BLUE-DEEP"]),
|
|
1175
|
+
txb.object(maps_js_1.cetusPoolMap["BLUE-SUI"]),
|
|
605
1176
|
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
606
1177
|
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
607
1178
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
608
1179
|
],
|
|
609
1180
|
});
|
|
610
1181
|
}
|
|
611
|
-
else if (poolName === "BLUEFIN-
|
|
1182
|
+
else if (poolName === "BLUEFIN-AUTOBALANCE-WAL-USDC") {
|
|
612
1183
|
txb.moveCall({
|
|
613
|
-
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::
|
|
1184
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::collect_and_swap_trade_fee`,
|
|
614
1185
|
typeArguments: [
|
|
615
1186
|
coins_js_1.coinsList[pool1].type,
|
|
616
1187
|
coins_js_1.coinsList[pool2].type,
|
|
1188
|
+
coins_js_1.coinsList["SUI"].type,
|
|
1189
|
+
],
|
|
1190
|
+
arguments: [
|
|
1191
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_BLUEFIN_AUTOBALANCE_VERSION),
|
|
1192
|
+
txb.object(poolinfo.investorId),
|
|
1193
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
1194
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_WAL_USDC_POOL),
|
|
1195
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_USDC_POOL),
|
|
1196
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
1197
|
+
],
|
|
1198
|
+
});
|
|
1199
|
+
txb.moveCall({
|
|
1200
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::user_deposit_v2`,
|
|
1201
|
+
typeArguments: [
|
|
1202
|
+
coins_js_1.coinsList["WAL"].type,
|
|
1203
|
+
coins_js_1.coinsList["USDC"].type,
|
|
617
1204
|
coins_js_1.coinsList["BLUE"].type,
|
|
618
1205
|
coins_js_1.coinsList["SUI"].type,
|
|
619
1206
|
],
|
|
620
1207
|
arguments: [
|
|
621
|
-
txb.object((0, constants_js_1.getConf)().
|
|
622
|
-
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
1208
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_BLUEFIN_AUTOBALANCE_VERSION),
|
|
623
1209
|
someReceipt,
|
|
624
1210
|
txb.object(poolinfo.poolId),
|
|
625
1211
|
depositCoinA,
|
|
@@ -628,9 +1214,9 @@ const depositBluefinType1Txb = async (txb, someReceipt, poolName, depositCoinA,
|
|
|
628
1214
|
txb.object(poolinfo.investorId),
|
|
629
1215
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
630
1216
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
631
|
-
txb.object((0, constants_js_1.getConf)().
|
|
1217
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_WAL_USDC_POOL),
|
|
632
1218
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
633
|
-
txb.object(maps_js_1.cetusPoolMap["USDC-
|
|
1219
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-WAL"]),
|
|
634
1220
|
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
635
1221
|
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
636
1222
|
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
@@ -638,47 +1224,40 @@ const depositBluefinType1Txb = async (txb, someReceipt, poolName, depositCoinA,
|
|
|
638
1224
|
],
|
|
639
1225
|
});
|
|
640
1226
|
}
|
|
641
|
-
else if (poolName === "BLUEFIN-
|
|
1227
|
+
else if (poolName === "BLUEFIN-SUIBTC-USDC") {
|
|
642
1228
|
txb.moveCall({
|
|
643
|
-
target: `${poolinfo.packageId}::
|
|
1229
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_investor::collect_and_swap_rewards_to_token_b_bluefin`,
|
|
644
1230
|
typeArguments: [
|
|
645
|
-
coins_js_1.coinsList[
|
|
646
|
-
coins_js_1.coinsList[
|
|
1231
|
+
coins_js_1.coinsList[maps_js_1.doubleAssetPoolCoinMap[poolName].coin1].type,
|
|
1232
|
+
coins_js_1.coinsList[maps_js_1.doubleAssetPoolCoinMap[poolName].coin2].type,
|
|
647
1233
|
coins_js_1.coinsList["BLUE"].type,
|
|
648
1234
|
coins_js_1.coinsList["SUI"].type,
|
|
1235
|
+
coins_js_1.coinsList["DEEP"].type,
|
|
649
1236
|
],
|
|
650
1237
|
arguments: [
|
|
651
|
-
txb.object((0, constants_js_1.getConf)().
|
|
652
|
-
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
653
|
-
someReceipt,
|
|
654
|
-
txb.object(poolinfo.poolId),
|
|
655
|
-
depositCoinA,
|
|
656
|
-
depositCoinB,
|
|
657
|
-
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
1238
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_BLUEFIN_V2_VERSION),
|
|
658
1239
|
txb.object(poolinfo.investorId),
|
|
659
1240
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
660
|
-
txb.object((0, constants_js_1.getConf)().
|
|
661
|
-
txb.object((0, constants_js_1.getConf)().BLUEFIN_WBTC_USDC_POOL),
|
|
1241
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUIBTC_USDC_POOL),
|
|
662
1242
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
663
|
-
txb.object(
|
|
664
|
-
txb.object(maps_js_1.
|
|
1243
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_DEEP_SUI_POOL),
|
|
1244
|
+
txb.object(maps_js_1.bluefinPoolMap["SUI-USDC"]),
|
|
665
1245
|
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
666
1246
|
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
667
1247
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
668
1248
|
],
|
|
669
1249
|
});
|
|
670
|
-
}
|
|
671
|
-
else if (poolName === "BLUEFIN-SEND-USDC") {
|
|
672
1250
|
txb.moveCall({
|
|
673
|
-
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::
|
|
1251
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::user_deposit`,
|
|
674
1252
|
typeArguments: [
|
|
675
1253
|
coins_js_1.coinsList[pool1].type,
|
|
676
1254
|
coins_js_1.coinsList[pool2].type,
|
|
677
1255
|
coins_js_1.coinsList["BLUE"].type,
|
|
678
1256
|
coins_js_1.coinsList["SUI"].type,
|
|
1257
|
+
coins_js_1.coinsList["DEEP"].type,
|
|
679
1258
|
],
|
|
680
1259
|
arguments: [
|
|
681
|
-
txb.object((0, constants_js_1.getConf)().
|
|
1260
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_BLUEFIN_V2_VERSION),
|
|
682
1261
|
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
683
1262
|
someReceipt,
|
|
684
1263
|
txb.object(poolinfo.poolId),
|
|
@@ -688,9 +1267,10 @@ const depositBluefinType1Txb = async (txb, someReceipt, poolName, depositCoinA,
|
|
|
688
1267
|
txb.object(poolinfo.investorId),
|
|
689
1268
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
690
1269
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
691
|
-
txb.object((0, constants_js_1.getConf)().
|
|
1270
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUIBTC_USDC_POOL),
|
|
692
1271
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
693
|
-
txb.object(
|
|
1272
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_DEEP_SUI_POOL),
|
|
1273
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUIBTC"]),
|
|
694
1274
|
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
695
1275
|
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
696
1276
|
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
@@ -698,7 +1278,29 @@ const depositBluefinType1Txb = async (txb, someReceipt, poolName, depositCoinA,
|
|
|
698
1278
|
],
|
|
699
1279
|
});
|
|
700
1280
|
}
|
|
701
|
-
else if (poolName === "BLUEFIN-
|
|
1281
|
+
else if (poolName === "BLUEFIN-LBTC-SUIBTC") {
|
|
1282
|
+
txb.moveCall({
|
|
1283
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_investor::collect_and_swap_rewards_to_token_b_bluefin`,
|
|
1284
|
+
typeArguments: [
|
|
1285
|
+
coins_js_1.coinsList[maps_js_1.doubleAssetPoolCoinMap[poolName].coin1].type,
|
|
1286
|
+
coins_js_1.coinsList[maps_js_1.doubleAssetPoolCoinMap[poolName].coin2].type,
|
|
1287
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
1288
|
+
coins_js_1.coinsList["SUI"].type,
|
|
1289
|
+
coins_js_1.coinsList["DEEP"].type,
|
|
1290
|
+
],
|
|
1291
|
+
arguments: [
|
|
1292
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_BLUEFIN_V2_VERSION),
|
|
1293
|
+
txb.object(poolinfo.investorId),
|
|
1294
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
1295
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_LBTC_SUIBTC_POOL),
|
|
1296
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
1297
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_DEEP_SUI_POOL),
|
|
1298
|
+
txb.object(maps_js_1.bluefinPoolMap["SUI-SUIBTC"]),
|
|
1299
|
+
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
1300
|
+
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
1301
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
1302
|
+
],
|
|
1303
|
+
});
|
|
702
1304
|
txb.moveCall({
|
|
703
1305
|
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::user_deposit`,
|
|
704
1306
|
typeArguments: [
|
|
@@ -706,9 +1308,10 @@ const depositBluefinType1Txb = async (txb, someReceipt, poolName, depositCoinA,
|
|
|
706
1308
|
coins_js_1.coinsList[pool2].type,
|
|
707
1309
|
coins_js_1.coinsList["BLUE"].type,
|
|
708
1310
|
coins_js_1.coinsList["SUI"].type,
|
|
1311
|
+
coins_js_1.coinsList["DEEP"].type,
|
|
709
1312
|
],
|
|
710
1313
|
arguments: [
|
|
711
|
-
txb.object((0, constants_js_1.getConf)().
|
|
1314
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_BLUEFIN_V2_VERSION),
|
|
712
1315
|
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
713
1316
|
someReceipt,
|
|
714
1317
|
txb.object(poolinfo.poolId),
|
|
@@ -718,44 +1321,38 @@ const depositBluefinType1Txb = async (txb, someReceipt, poolName, depositCoinA,
|
|
|
718
1321
|
txb.object(poolinfo.investorId),
|
|
719
1322
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
720
1323
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
721
|
-
txb.object((0, constants_js_1.getConf)().
|
|
1324
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_LBTC_SUIBTC_POOL),
|
|
722
1325
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
723
|
-
txb.object(
|
|
724
|
-
txb.object(maps_js_1.cetusPoolMap["
|
|
1326
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_DEEP_SUI_POOL),
|
|
1327
|
+
txb.object(maps_js_1.cetusPoolMap["SUIBTC-LBTC"]),
|
|
1328
|
+
txb.object(maps_js_1.cetusPoolMap["SUIBTC-SUI"]),
|
|
1329
|
+
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
1330
|
+
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
725
1331
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
726
1332
|
],
|
|
727
1333
|
});
|
|
728
1334
|
}
|
|
729
|
-
else if (poolName === "BLUEFIN-
|
|
1335
|
+
else if (poolName === "BLUEFIN-WAL-USDC") {
|
|
730
1336
|
txb.moveCall({
|
|
731
|
-
target: `${poolinfo.packageId}::
|
|
1337
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_investor::collect_and_swap_rewards_to_token_b_bluefin`,
|
|
732
1338
|
typeArguments: [
|
|
733
|
-
coins_js_1.coinsList[
|
|
734
|
-
coins_js_1.coinsList[
|
|
1339
|
+
coins_js_1.coinsList[maps_js_1.doubleAssetPoolCoinMap[poolName].coin1].type,
|
|
1340
|
+
coins_js_1.coinsList[maps_js_1.doubleAssetPoolCoinMap[poolName].coin2].type,
|
|
735
1341
|
coins_js_1.coinsList["BLUE"].type,
|
|
736
1342
|
coins_js_1.coinsList["SUI"].type,
|
|
737
1343
|
],
|
|
738
1344
|
arguments: [
|
|
739
|
-
txb.object((0, constants_js_1.getConf)().ALPHA_BLUEFIN_AUTOBALANCE_VERSION),
|
|
740
|
-
someReceipt,
|
|
741
|
-
txb.object(poolinfo.poolId),
|
|
742
|
-
depositCoinA,
|
|
743
|
-
depositCoinB,
|
|
744
|
-
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
745
1345
|
txb.object(poolinfo.investorId),
|
|
1346
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
746
1347
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
747
|
-
txb.object((0, constants_js_1.getConf)().
|
|
748
|
-
txb.object((0, constants_js_1.getConf)().BLUEFIN_USDT_USDC_POOL),
|
|
1348
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_WAL_USDC_POOL),
|
|
749
1349
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
750
|
-
txb.object(maps_js_1.
|
|
751
|
-
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
1350
|
+
txb.object(maps_js_1.bluefinPoolMap["SUI-USDC"]),
|
|
752
1351
|
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
753
1352
|
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
754
1353
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
755
1354
|
],
|
|
756
1355
|
});
|
|
757
|
-
}
|
|
758
|
-
else if (poolName === "BLUEFIN-SUIUSDT-USDC") {
|
|
759
1356
|
txb.moveCall({
|
|
760
1357
|
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::user_deposit_v2`,
|
|
761
1358
|
typeArguments: [
|
|
@@ -775,9 +1372,9 @@ const depositBluefinType1Txb = async (txb, someReceipt, poolName, depositCoinA,
|
|
|
775
1372
|
txb.object(poolinfo.investorId),
|
|
776
1373
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
777
1374
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
778
|
-
txb.object((0, constants_js_1.getConf)().
|
|
1375
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_WAL_USDC_POOL),
|
|
779
1376
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
780
|
-
txb.object(maps_js_1.cetusPoolMap["USDC-
|
|
1377
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-WAL"]),
|
|
781
1378
|
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
782
1379
|
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
783
1380
|
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
@@ -785,41 +1382,28 @@ const depositBluefinType1Txb = async (txb, someReceipt, poolName, depositCoinA,
|
|
|
785
1382
|
],
|
|
786
1383
|
});
|
|
787
1384
|
}
|
|
788
|
-
else if (poolName === "BLUEFIN-AUTOBALANCE-SUIUSDT-USDC") {
|
|
1385
|
+
else if (poolName === "BLUEFIN-AUTOBALANCE-SUIUSDT-USDC-ZERO-ZERO") {
|
|
789
1386
|
txb.moveCall({
|
|
790
|
-
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::
|
|
1387
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::collect_and_swap_trade_fee`,
|
|
791
1388
|
typeArguments: [
|
|
792
|
-
coins_js_1.coinsList[
|
|
793
|
-
coins_js_1.coinsList[
|
|
794
|
-
coins_js_1.coinsList["BLUE"].type,
|
|
1389
|
+
coins_js_1.coinsList[pool1].type,
|
|
1390
|
+
coins_js_1.coinsList[pool2].type,
|
|
795
1391
|
coins_js_1.coinsList["SUI"].type,
|
|
796
1392
|
],
|
|
797
1393
|
arguments: [
|
|
798
1394
|
txb.object((0, constants_js_1.getConf)().ALPHA_BLUEFIN_AUTOBALANCE_VERSION),
|
|
799
|
-
someReceipt,
|
|
800
|
-
txb.object(poolinfo.poolId),
|
|
801
|
-
depositCoinA,
|
|
802
|
-
depositCoinB,
|
|
803
|
-
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
804
1395
|
txb.object(poolinfo.investorId),
|
|
805
1396
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
806
|
-
txb.object((0, constants_js_1.getConf)().
|
|
807
|
-
txb.object((0, constants_js_1.getConf)().
|
|
808
|
-
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
809
|
-
txb.object(maps_js_1.cetusPoolMap["USDC-SUIUSDT"]),
|
|
810
|
-
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
811
|
-
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
812
|
-
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
1397
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUIUSDT_USDC_ZERO_ZERO_POOL),
|
|
1398
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_USDC_POOL),
|
|
813
1399
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
814
1400
|
],
|
|
815
1401
|
});
|
|
816
|
-
}
|
|
817
|
-
else if (poolName === "BLUEFIN-AUTOBALANCE-DEEP-BLUE") {
|
|
818
1402
|
txb.moveCall({
|
|
819
1403
|
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::user_deposit_v2`,
|
|
820
1404
|
typeArguments: [
|
|
821
|
-
coins_js_1.coinsList["
|
|
822
|
-
coins_js_1.coinsList["
|
|
1405
|
+
coins_js_1.coinsList["SUIUSDT"].type,
|
|
1406
|
+
coins_js_1.coinsList["USDC"].type,
|
|
823
1407
|
coins_js_1.coinsList["BLUE"].type,
|
|
824
1408
|
coins_js_1.coinsList["SUI"].type,
|
|
825
1409
|
],
|
|
@@ -833,10 +1417,10 @@ const depositBluefinType1Txb = async (txb, someReceipt, poolName, depositCoinA,
|
|
|
833
1417
|
txb.object(poolinfo.investorId),
|
|
834
1418
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
835
1419
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
836
|
-
txb.object((0, constants_js_1.getConf)().
|
|
837
|
-
txb.object((0, constants_js_1.getConf)().
|
|
838
|
-
txb.object(maps_js_1.cetusPoolMap["
|
|
839
|
-
txb.object(maps_js_1.cetusPoolMap["
|
|
1420
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUIUSDT_USDC_ZERO_ZERO_POOL),
|
|
1421
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
1422
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUIUSDT"]),
|
|
1423
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
840
1424
|
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
841
1425
|
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
842
1426
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
@@ -1106,7 +1690,7 @@ const depositBluefinSuiSecondTxb = async (txb, someReceipt, poolName, depositCoi
|
|
|
1106
1690
|
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
1107
1691
|
txb.object(poolinfo.investorId),
|
|
1108
1692
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
1109
|
-
txb.object(
|
|
1693
|
+
txb.object(poolinfo.parentPoolId),
|
|
1110
1694
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
1111
1695
|
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
1112
1696
|
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
@@ -1193,7 +1777,7 @@ const depositBluefinStsuiTxb = async (txb, someReceipt, poolName, depositCoinA,
|
|
|
1193
1777
|
txb.object(poolinfo.investorId),
|
|
1194
1778
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
1195
1779
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
1196
|
-
txb.object((0, constants_js_1.getConf)().
|
|
1780
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_STSUI_USDC_ZERO_ONE_POOL),
|
|
1197
1781
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
1198
1782
|
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
1199
1783
|
txb.object(maps_js_1.bluefinPoolMap["SUI-USDC"]),
|
|
@@ -1229,7 +1813,7 @@ const depositBluefinStsuiTxb = async (txb, someReceipt, poolName, depositCoinA,
|
|
|
1229
1813
|
txb.object(maps_js_1.bluefinPoolMap["SUI-ALPHA"]),
|
|
1230
1814
|
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
1231
1815
|
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
1232
|
-
txb.pure.bool(
|
|
1816
|
+
txb.pure.bool(true),
|
|
1233
1817
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
1234
1818
|
],
|
|
1235
1819
|
});
|
|
@@ -1259,7 +1843,7 @@ const depositBluefinStsuiTxb = async (txb, someReceipt, poolName, depositCoinA,
|
|
|
1259
1843
|
txb.object(maps_js_1.bluefinPoolMap["SUI-WSOL"]),
|
|
1260
1844
|
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
1261
1845
|
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
1262
|
-
txb.pure.bool(
|
|
1846
|
+
txb.pure.bool(true),
|
|
1263
1847
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
1264
1848
|
],
|
|
1265
1849
|
});
|
|
@@ -1289,7 +1873,7 @@ const depositBluefinStsuiTxb = async (txb, someReceipt, poolName, depositCoinA,
|
|
|
1289
1873
|
txb.object(maps_js_1.bluefinPoolMap["SUI-ETH"]),
|
|
1290
1874
|
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
1291
1875
|
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
1292
|
-
txb.pure.bool(
|
|
1876
|
+
txb.pure.bool(true),
|
|
1293
1877
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
1294
1878
|
],
|
|
1295
1879
|
});
|
|
@@ -1319,7 +1903,7 @@ const depositBluefinStsuiTxb = async (txb, someReceipt, poolName, depositCoinA,
|
|
|
1319
1903
|
txb.object(maps_js_1.bluefinPoolMap["SUI-BUCK"]),
|
|
1320
1904
|
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
1321
1905
|
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
1322
|
-
txb.pure.bool(
|
|
1906
|
+
txb.pure.bool(true),
|
|
1323
1907
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
1324
1908
|
],
|
|
1325
1909
|
});
|
|
@@ -1354,80 +1938,36 @@ const depositBluefinStsuiTxb = async (txb, someReceipt, poolName, depositCoinA,
|
|
|
1354
1938
|
],
|
|
1355
1939
|
});
|
|
1356
1940
|
}
|
|
1941
|
+
else if (poolName === "BLUEFIN-WAL-STSUI") {
|
|
1942
|
+
txb.moveCall({
|
|
1943
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_stsui_second_pool::user_deposit`,
|
|
1944
|
+
typeArguments: [
|
|
1945
|
+
coins_js_1.coinsList[pool1].type,
|
|
1946
|
+
coins_js_1.coinsList[pool2].type,
|
|
1947
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
1948
|
+
],
|
|
1949
|
+
arguments: [
|
|
1950
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_STSUI_VERSION),
|
|
1951
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
1952
|
+
someReceipt,
|
|
1953
|
+
txb.object(poolinfo.poolId),
|
|
1954
|
+
depositCoinA,
|
|
1955
|
+
depositCoinB,
|
|
1956
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
1957
|
+
txb.object(poolinfo.investorId),
|
|
1958
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
1959
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
1960
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_WAL_STSUI_POOL),
|
|
1961
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
1962
|
+
txb.object(maps_js_1.cetusPoolMap["WAL-SUI"]),
|
|
1963
|
+
txb.object(maps_js_1.bluefinPoolMap["SUI-WAL"]),
|
|
1964
|
+
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
1965
|
+
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
1966
|
+
txb.pure.bool(true),
|
|
1967
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
1968
|
+
],
|
|
1969
|
+
});
|
|
1970
|
+
}
|
|
1357
1971
|
return txb;
|
|
1358
1972
|
};
|
|
1359
|
-
async function getZapAmounts(inputCoinAmount, inputCoinName, poolName, slippage, address, ignoreCache) {
|
|
1360
|
-
const coinTypeA = maps_js_1.doubleAssetPoolCoinMap[poolName].coin1;
|
|
1361
|
-
const coinTypeB = maps_js_1.doubleAssetPoolCoinMap[poolName].coin2;
|
|
1362
|
-
const swapObjectA = coins_js_1.coinsList[coinTypeA];
|
|
1363
|
-
const swapObjectB = coins_js_1.coinsList[coinTypeB];
|
|
1364
|
-
const inputObject = coins_js_1.coinsList[inputCoinName];
|
|
1365
|
-
const amounts = await (0, deposit_js_1.getAmounts)(poolName, true, "100000001");
|
|
1366
|
-
const amount1 = Number(amounts[0]);
|
|
1367
|
-
const amount2 = Number(amounts[1]);
|
|
1368
|
-
const swapGateway = new _7k_js_1.SevenKGateway();
|
|
1369
|
-
const swapOptions = {
|
|
1370
|
-
pair: {
|
|
1371
|
-
coinA: swapObjectA,
|
|
1372
|
-
coinB: swapObjectB,
|
|
1373
|
-
},
|
|
1374
|
-
senderAddress: address,
|
|
1375
|
-
inAmount: new bn_js_1.default(amount1),
|
|
1376
|
-
slippage: slippage,
|
|
1377
|
-
};
|
|
1378
|
-
const ratioQuote = await zapGetQuote(swapGateway, swapOptions, poolName);
|
|
1379
|
-
if (!ratioQuote) {
|
|
1380
|
-
console.error(`Error geting quote for zap`);
|
|
1381
|
-
return undefined;
|
|
1382
|
-
}
|
|
1383
|
-
const amount1InCoinType2 = Number(ratioQuote);
|
|
1384
|
-
const totalAmount = amount2 + amount1InCoinType2;
|
|
1385
|
-
const inputAmountToType1 = Math.floor((inputCoinAmount * amount1InCoinType2) / totalAmount);
|
|
1386
|
-
const inputAmountToType2 = Math.floor((inputCoinAmount * amount2) / totalAmount);
|
|
1387
|
-
let amountA, amountB;
|
|
1388
|
-
const swapOptionsI2A = {
|
|
1389
|
-
pair: {
|
|
1390
|
-
coinA: inputObject,
|
|
1391
|
-
coinB: swapObjectA,
|
|
1392
|
-
},
|
|
1393
|
-
senderAddress: address,
|
|
1394
|
-
inAmount: new bn_js_1.default(inputAmountToType1),
|
|
1395
|
-
slippage: slippage,
|
|
1396
|
-
};
|
|
1397
|
-
const swapOptionsI2B = {
|
|
1398
|
-
pair: {
|
|
1399
|
-
coinA: inputObject,
|
|
1400
|
-
coinB: swapObjectB,
|
|
1401
|
-
},
|
|
1402
|
-
senderAddress: address,
|
|
1403
|
-
inAmount: new bn_js_1.default(inputAmountToType2),
|
|
1404
|
-
slippage: slippage,
|
|
1405
|
-
};
|
|
1406
|
-
if (inputCoinName === coinTypeA) {
|
|
1407
|
-
amountA = inputAmountToType1.toString();
|
|
1408
|
-
amountB = await zapGetQuote(swapGateway, swapOptionsI2B, poolName);
|
|
1409
|
-
}
|
|
1410
|
-
else if (inputCoinName === coinTypeB) {
|
|
1411
|
-
amountA = await zapGetQuote(swapGateway, swapOptionsI2A, poolName);
|
|
1412
|
-
amountB = inputAmountToType2.toString();
|
|
1413
|
-
}
|
|
1414
|
-
else {
|
|
1415
|
-
amountA = await zapGetQuote(swapGateway, swapOptionsI2A, poolName);
|
|
1416
|
-
amountB = await zapGetQuote(swapGateway, swapOptionsI2B, poolName);
|
|
1417
|
-
}
|
|
1418
|
-
if (amountA && amountB) {
|
|
1419
|
-
const [coin1Price, coin2Price] = await (0, prices_js_1.getLatestPrices)([
|
|
1420
|
-
`${swapObjectA.name}/USD`,
|
|
1421
|
-
`${swapObjectB.name}/USD`,
|
|
1422
|
-
], ignoreCache);
|
|
1423
|
-
const coin1InUSD = Number(amountA) * Number(coin1Price);
|
|
1424
|
-
const coin2InUSD = Number(amountB) * Number(coin2Price);
|
|
1425
|
-
return [
|
|
1426
|
-
amountA.toString(),
|
|
1427
|
-
coin1InUSD.toString(),
|
|
1428
|
-
amountB.toString(),
|
|
1429
|
-
coin2InUSD.toString(),
|
|
1430
|
-
];
|
|
1431
|
-
}
|
|
1432
|
-
}
|
|
1433
1973
|
//# sourceMappingURL=zapDeposit.js.map
|