@broxus/js-core
Version:
MobX-based JavaScript Core library
862 lines (861 loc) • 32.7 kB
JavaScript
/**
* **DexStablePool ABI v2.7**
*
* This ABI is used for interacting with the `DexStablePool` contract on the TVM blockchain.
* @see [DexStablePool](https://github.com/broxus/flatqube-contracts/blob/master/build/DexStablePool.abi.json)
*/
export const DexStablePoolAbi = {
'ABI version': 2,
version: '2.7',
header: ['pubkey', 'time', 'expire'],
functions: [
{
name: 'constructor',
inputs: [],
outputs: [],
},
{
name: 'getRoot',
inputs: [{ name: 'answerId', type: 'uint32' }],
outputs: [{ name: 'dex_root', type: 'address' }],
},
{
name: 'getTokenRoots',
inputs: [{ name: 'answerId', type: 'uint32' }],
outputs: [
{ name: 'roots', type: 'address[]' },
{ name: 'lp', type: 'address' },
],
},
{
name: 'getTokenWallets',
inputs: [{ name: 'answerId', type: 'uint32' }],
outputs: [
{ name: 'token_wallets', type: 'address[]' },
{ name: 'lp', type: 'address' },
],
},
{
name: 'getVersion',
inputs: [{ name: 'answerId', type: 'uint32' }],
outputs: [{ name: 'version', type: 'uint32' }],
},
{
name: 'getVault',
inputs: [{ name: 'answerId', type: 'uint32' }],
outputs: [{ name: 'value0', type: 'address' }],
},
{
name: 'getPoolType',
inputs: [{ name: 'answerId', type: 'uint32' }],
outputs: [{ name: 'value0', type: 'uint8' }],
},
{
name: 'getAccumulatedFees',
inputs: [{ name: 'answerId', type: 'uint32' }],
outputs: [{ name: 'accumulatedFees', type: 'uint128[]' }],
},
{
name: 'getFeeParams',
inputs: [{ name: 'answerId', type: 'uint32' }],
outputs: [
{
components: [
{ name: 'denominator', type: 'uint128' },
{ name: 'pool_numerator', type: 'uint128' },
{ name: 'beneficiary_numerator', type: 'uint128' },
{ name: 'referrer_numerator', type: 'uint128' },
{ name: 'beneficiary', type: 'address' },
{ name: 'threshold', type: 'map(address,uint128)' },
{ name: 'referrer_threshold', type: 'map(address,uint128)' },
],
name: 'value0',
type: 'tuple',
},
],
},
{
name: 'getAmplificationCoefficient',
inputs: [{ name: 'answerId', type: 'uint32' }],
outputs: [
{
components: [
{ name: 'value', type: 'uint128' },
{ name: 'precision', type: 'uint128' },
],
name: 'value0',
type: 'tuple',
},
],
},
{
name: 'isActive',
inputs: [{ name: 'answerId', type: 'uint32' }],
outputs: [{ name: 'value0', type: 'bool' }],
},
{
name: 'getBalances',
inputs: [{ name: 'answerId', type: 'uint32' }],
outputs: [
{
components: [
{ name: 'balances', type: 'uint128[]' },
{ name: 'lp_supply', type: 'uint128' },
],
name: 'value0',
type: 'tuple',
},
],
},
{
name: 'setActive',
inputs: [
{ name: '_newActive', type: 'bool' },
{ name: '_remainingGasTo', type: 'address' },
],
outputs: [],
},
{
name: 'setAmplificationCoefficient',
inputs: [
{
components: [
{ name: 'value', type: 'uint128' },
{ name: 'precision', type: 'uint128' },
],
name: '_A',
type: 'tuple',
},
{ name: 'send_gas_to', type: 'address' },
],
outputs: [],
},
{
name: 'setFeeParams',
inputs: [
{
components: [
{ name: 'denominator', type: 'uint128' },
{ name: 'pool_numerator', type: 'uint128' },
{ name: 'beneficiary_numerator', type: 'uint128' },
{ name: 'referrer_numerator', type: 'uint128' },
{ name: 'beneficiary', type: 'address' },
{ name: 'threshold', type: 'map(address,uint128)' },
{ name: 'referrer_threshold', type: 'map(address,uint128)' },
],
name: 'params',
type: 'tuple',
},
{ name: 'send_gas_to', type: 'address' },
],
outputs: [],
},
{
name: 'withdrawBeneficiaryFee',
inputs: [{ name: 'send_gas_to', type: 'address' }],
outputs: [],
},
{
name: 'buildExchangePayload',
inputs: [
{ name: 'id', type: 'uint64' },
{ name: 'deploy_wallet_grams', type: 'uint128' },
{ name: 'expected_amount', type: 'uint128' },
{ name: 'outcoming', type: 'address' },
{ name: 'recipient', type: 'address' },
{ name: 'referrer', type: 'address' },
{ name: 'success_payload', type: 'optional(cell)' },
{ name: 'cancel_payload', type: 'optional(cell)' },
{ name: 'toNative', type: 'optional(bool)' },
],
outputs: [{ name: 'value0', type: 'cell' }],
},
{
name: 'buildDepositLiquidityPayload',
inputs: [
{ name: 'id', type: 'uint64' },
{ name: 'deploy_wallet_grams', type: 'uint128' },
{ name: 'expected_amount', type: 'uint128' },
{ name: 'recipient', type: 'address' },
{ name: 'referrer', type: 'address' },
{ name: 'success_payload', type: 'optional(cell)' },
{ name: 'cancel_payload', type: 'optional(cell)' },
],
outputs: [{ name: 'value0', type: 'cell' }],
},
{
name: 'buildWithdrawLiquidityPayload',
inputs: [
{ name: 'id', type: 'uint64' },
{ name: 'deploy_wallet_grams', type: 'uint128' },
{ name: 'expected_amounts', type: 'uint128[]' },
{ name: 'recipient', type: 'address' },
{ name: 'referrer', type: 'address' },
{ name: 'success_payload', type: 'optional(cell)' },
{ name: 'cancel_payload', type: 'optional(cell)' },
{ name: 'to_native', type: 'optional(bool)' },
],
outputs: [{ name: 'value0', type: 'cell' }],
},
{
name: 'buildWithdrawLiquidityOneCoinPayload',
inputs: [
{ name: 'id', type: 'uint64' },
{ name: 'deploy_wallet_grams', type: 'uint128' },
{ name: 'expected_amount', type: 'uint128' },
{ name: 'outcoming', type: 'address' },
{ name: 'recipient', type: 'address' },
{ name: 'referrer', type: 'address' },
{ name: 'success_payload', type: 'optional(cell)' },
{ name: 'cancel_payload', type: 'optional(cell)' },
{ name: 'to_native', type: 'optional(bool)' },
],
outputs: [{ name: 'value0', type: 'cell' }],
},
{
name: 'buildCrossPairExchangePayload',
inputs: [
{ name: 'id', type: 'uint64' },
{ name: 'deployWalletGrams', type: 'uint128' },
{ name: 'expectedAmount', type: 'uint128' },
{ name: 'outcoming', type: 'address' },
{ name: 'nextStepIndices', type: 'uint32[]' },
{
components: [
{ name: 'amount', type: 'uint128' },
{ name: 'roots', type: 'address[]' },
{ name: 'outcoming', type: 'address' },
{ name: 'numerator', type: 'uint128' },
{ name: 'nextStepIndices', type: 'uint32[]' },
],
name: 'steps',
type: 'tuple[]',
},
{ name: 'recipient', type: 'address' },
{ name: 'referrer', type: 'address' },
{ name: 'success_payload', type: 'optional(cell)' },
{ name: 'cancel_payload', type: 'optional(cell)' },
{ name: 'to_native', type: 'optional(bool)' },
],
outputs: [{ name: 'value0', type: 'cell' }],
},
{
name: 'onAcceptTokensTransfer',
inputs: [
{ name: 'token_root', type: 'address' },
{ name: 'tokens_amount', type: 'uint128' },
{ name: 'sender_address', type: 'address' },
{ name: 'sender_wallet', type: 'address' },
{ name: 'original_gas_to', type: 'address' },
{ name: 'payload', type: 'cell' },
],
outputs: [],
},
{
name: 'expectedDepositLiquidityV2',
inputs: [
{ name: 'answerId', type: 'uint32' },
{ name: 'amounts', type: 'uint128[]' },
],
outputs: [
{
components: [
{ name: 'old_balances', type: 'uint128[]' },
{ name: 'amounts', type: 'uint128[]' },
{ name: 'lp_reward', type: 'uint128' },
{ name: 'result_balances', type: 'uint128[]' },
{ name: 'invariant', type: 'uint128' },
{ name: 'differences', type: 'uint128[]' },
{ name: 'sell', type: 'bool[]' },
{ name: 'pool_fees', type: 'uint128[]' },
{ name: 'beneficiary_fees', type: 'uint128[]' },
],
name: 'value0',
type: 'tuple',
},
],
},
{
name: 'expectedDepositLiquidityOneCoin',
inputs: [
{ name: 'answerId', type: 'uint32' },
{ name: 'spent_token_root', type: 'address' },
{ name: 'amount', type: 'uint128' },
],
outputs: [
{
components: [
{ name: 'old_balances', type: 'uint128[]' },
{ name: 'amounts', type: 'uint128[]' },
{ name: 'lp_reward', type: 'uint128' },
{ name: 'result_balances', type: 'uint128[]' },
{ name: 'invariant', type: 'uint128' },
{ name: 'differences', type: 'uint128[]' },
{ name: 'sell', type: 'bool[]' },
{ name: 'pool_fees', type: 'uint128[]' },
{ name: 'beneficiary_fees', type: 'uint128[]' },
],
name: 'value0',
type: 'tuple',
},
],
},
{
name: 'depositLiquidity',
inputs: [
{ name: 'call_id', type: 'uint64' },
{
components: [
{ name: 'amount', type: 'uint128' },
{ name: 'root', type: 'address' },
],
name: '_operations',
type: 'tuple[]',
},
{
components: [
{ name: 'amount', type: 'uint128' },
{ name: 'root', type: 'address' },
],
name: '_expected',
type: 'tuple',
},
{ name: 'auto_change', type: 'bool' },
{ name: 'account_owner', type: 'address' },
{ name: 'value5', type: 'uint32' },
{ name: 'send_gas_to', type: 'address' },
{ name: 'referrer', type: 'address' },
],
outputs: [],
},
{
name: 'expectedDepositSpendAmount',
inputs: [
{ name: 'answerId', type: 'uint32' },
{ name: 'lp_amount', type: 'uint128' },
{ name: 'spent_token_root', type: 'address' },
],
outputs: [
{ name: 'tokens_amount', type: 'uint128' },
{ name: 'expected_fee', type: 'uint128' },
],
},
{
name: 'expectedWithdrawLiquidity',
inputs: [
{ name: 'answerId', type: 'uint32' },
{ name: 'lp_amount', type: 'uint128' },
],
outputs: [
{
components: [
{ name: 'lp_amount', type: 'uint128' },
{ name: 'old_balances', type: 'uint128[]' },
{ name: 'amounts', type: 'uint128[]' },
{ name: 'result_balances', type: 'uint128[]' },
{ name: 'invariant', type: 'uint128' },
{ name: 'differences', type: 'uint128[]' },
{ name: 'sell', type: 'bool[]' },
{ name: 'pool_fees', type: 'uint128[]' },
{ name: 'beneficiary_fees', type: 'uint128[]' },
],
name: 'value0',
type: 'tuple',
},
],
},
{
name: 'expectedOneCoinWithdrawalSpendAmount',
inputs: [
{ name: 'answerId', type: 'uint32' },
{ name: 'receive_amount', type: 'uint128' },
{ name: 'receive_token_root', type: 'address' },
],
outputs: [
{ name: 'lp', type: 'uint128' },
{ name: 'expected_fee', type: 'uint128' },
],
},
{
name: 'expectedWithdrawLiquidityOneCoin',
inputs: [
{ name: 'answerId', type: 'uint32' },
{ name: 'lp_amount', type: 'uint128' },
{ name: 'outcoming', type: 'address' },
],
outputs: [
{
components: [
{ name: 'lp_amount', type: 'uint128' },
{ name: 'old_balances', type: 'uint128[]' },
{ name: 'amounts', type: 'uint128[]' },
{ name: 'result_balances', type: 'uint128[]' },
{ name: 'invariant', type: 'uint128' },
{ name: 'differences', type: 'uint128[]' },
{ name: 'sell', type: 'bool[]' },
{ name: 'pool_fees', type: 'uint128[]' },
{ name: 'beneficiary_fees', type: 'uint128[]' },
],
name: 'value0',
type: 'tuple',
},
],
},
{
name: 'withdrawLiquidity',
inputs: [
{ name: 'call_id', type: 'uint64' },
{
components: [
{ name: 'amount', type: 'uint128' },
{ name: 'root', type: 'address' },
],
name: '_operation',
type: 'tuple',
},
{
components: [
{ name: 'amount', type: 'uint128' },
{ name: 'root', type: 'address' },
],
name: '_expected',
type: 'tuple[]',
},
{ name: 'account_owner', type: 'address' },
{ name: 'value4', type: 'uint32' },
{ name: 'send_gas_to', type: 'address' },
],
outputs: [],
},
{
name: 'expectedExchange',
inputs: [
{ name: 'answerId', type: 'uint32' },
{ name: 'amount', type: 'uint128' },
{ name: 'spent_token_root', type: 'address' },
{ name: 'receive_token_root', type: 'address' },
],
outputs: [
{ name: 'expected_amount', type: 'uint128' },
{ name: 'expected_fee', type: 'uint128' },
],
},
{
name: 'expectedSpendAmount',
inputs: [
{ name: 'answerId', type: 'uint32' },
{ name: 'receive_amount', type: 'uint128' },
{ name: 'receive_token_root', type: 'address' },
{ name: 'spent_token_root', type: 'address' },
],
outputs: [
{ name: 'expected_amount', type: 'uint128' },
{ name: 'expected_fee', type: 'uint128' },
],
},
{
name: 'exchange',
inputs: [
{ name: 'call_id', type: 'uint64' },
{
components: [
{ name: 'amount', type: 'uint128' },
{ name: 'root', type: 'address' },
],
name: '_operation',
type: 'tuple',
},
{
components: [
{ name: 'amount', type: 'uint128' },
{ name: 'root', type: 'address' },
],
name: '_expected',
type: 'tuple',
},
{ name: 'account_owner', type: 'address' },
{ name: 'value4', type: 'uint32' },
{ name: 'send_gas_to', type: 'address' },
],
outputs: [],
},
{
name: 'crossPoolExchange',
inputs: [
{ name: 'id', type: 'uint64' },
{ name: 'value1', type: 'uint32' },
{ name: 'value2', type: 'uint8' },
{ name: 'prev_pool_token_roots', type: 'address[]' },
{ name: 'op', type: 'uint8' },
{ name: 'spent_token_root', type: 'address' },
{ name: 'spent_amount', type: 'uint128' },
{ name: 'sender_address', type: 'address' },
{ name: 'recipient', type: 'address' },
{ name: 'referrer', type: 'address' },
{ name: 'toNative', type: 'bool' },
{ name: 'original_gas_to', type: 'address' },
{ name: 'deploy_wallet_grams', type: 'uint128' },
{ name: 'payload', type: 'cell' },
{ name: 'notify_success', type: 'bool' },
{ name: 'success_payload', type: 'cell' },
{ name: 'notify_cancel', type: 'bool' },
{ name: 'cancel_payload', type: 'cell' },
],
outputs: [],
},
{
name: 'checkPair',
inputs: [
{ name: 'account_owner', type: 'address' },
{ name: 'value1', type: 'uint32' },
],
outputs: [],
},
{
name: 'upgrade',
inputs: [
{ name: 'code', type: 'cell' },
{ name: 'new_version', type: 'uint32' },
{ name: 'new_type', type: 'uint8' },
{ name: 'send_gas_to', type: 'address' },
],
outputs: [],
},
{
name: 'onTokenWallet',
inputs: [{ name: 'wallet', type: 'address' }],
outputs: [],
},
{
name: 'onTokenDecimals',
inputs: [{ name: '_decimals', type: 'uint8' }],
outputs: [],
},
{
name: 'liquidityTokenRootDeployed',
inputs: [
{ name: 'lp_root_', type: 'address' },
{ name: 'send_gas_to', type: 'address' },
],
outputs: [],
},
{
name: 'liquidityTokenRootNotDeployed',
inputs: [
{ name: 'value0', type: 'address' },
{ name: 'send_gas_to', type: 'address' },
],
outputs: [],
},
{
name: 'getVirtualPrice',
inputs: [{ name: 'answerId', type: 'uint32' }],
outputs: [{ name: 'value0', type: 'optional(uint256)' }],
},
{
name: 'getPriceImpact',
inputs: [
{ name: 'amount', type: 'uint128' },
{ name: 'spent_token_root', type: 'address' },
{ name: 'receive_token_root', type: 'address' },
{ name: 'price_amount', type: 'uint128' },
],
outputs: [{ name: 'value0', type: 'optional(uint256)' }],
},
{
name: 'getDepositPriceImpact',
inputs: [
{ name: 'amount', type: 'uint128' },
{ name: 'spent_token_root', type: 'address' },
{ name: 'price_amount', type: 'uint128' },
],
outputs: [{ name: 'value0', type: 'optional(uint256)' }],
},
{
name: 'getWithdrawalPriceImpact',
inputs: [
{ name: 'amount', type: 'uint128' },
{ name: 'receive_token_root', type: 'address' },
{ name: 'price_amount', type: 'uint128' },
],
outputs: [{ name: 'value0', type: 'optional(uint256)' }],
},
{
name: 'getPlatformCode',
inputs: [{ name: 'answerId', type: 'uint32' }],
outputs: [{ name: 'value0', type: 'cell' }],
},
],
getters: [],
events: [
{
name: 'AmplificationCoefficientUpdated',
inputs: [
{
components: [
{ name: 'value', type: 'uint128' },
{ name: 'precision', type: 'uint128' },
],
name: 'A',
type: 'tuple',
},
],
outputs: [],
},
{
name: 'DepositLiquidityV2',
inputs: [
{ name: 'sender', type: 'address' },
{ name: 'owner', type: 'address' },
{
components: [
{ name: 'amount', type: 'uint128' },
{ name: 'root', type: 'address' },
],
name: 'tokens',
type: 'tuple[]',
},
{
components: [
{ name: 'feeTokenRoot', type: 'address' },
{ name: 'pool_fee', type: 'uint128' },
{ name: 'beneficiary_fee', type: 'uint128' },
{ name: 'beneficiary', type: 'address' },
],
name: 'fees',
type: 'tuple[]',
},
{
components: [
{ name: 'amount', type: 'uint128' },
{ name: 'root', type: 'address' },
],
name: 'spent_differences',
type: 'tuple[]',
},
{
components: [
{ name: 'amount', type: 'uint128' },
{ name: 'root', type: 'address' },
],
name: 'receive_differences',
type: 'tuple[]',
},
{ name: 'lp', type: 'uint128' },
],
outputs: [],
},
{
name: 'WithdrawLiquidityV2',
inputs: [
{ name: 'sender', type: 'address' },
{ name: 'owner', type: 'address' },
{ name: 'lp', type: 'uint128' },
{
components: [
{ name: 'amount', type: 'uint128' },
{ name: 'root', type: 'address' },
],
name: 'tokens',
type: 'tuple[]',
},
{
components: [
{ name: 'feeTokenRoot', type: 'address' },
{ name: 'pool_fee', type: 'uint128' },
{ name: 'beneficiary_fee', type: 'uint128' },
{ name: 'beneficiary', type: 'address' },
],
name: 'fees',
type: 'tuple[]',
},
{
components: [
{ name: 'amount', type: 'uint128' },
{ name: 'root', type: 'address' },
],
name: 'spent_differences',
type: 'tuple[]',
},
{
components: [
{ name: 'amount', type: 'uint128' },
{ name: 'root', type: 'address' },
],
name: 'receive_differences',
type: 'tuple[]',
},
],
outputs: [],
},
{
name: 'PoolCodeUpgraded',
inputs: [
{ name: 'version', type: 'uint32' },
{ name: 'pool_type', type: 'uint8' },
],
outputs: [],
},
{
name: 'ActiveStatusUpdated',
inputs: [
{ name: 'current', type: 'bool' },
{ name: 'previous', type: 'bool' },
],
outputs: [],
},
{
name: 'FeesParamsUpdated',
inputs: [
{
components: [
{ name: 'denominator', type: 'uint128' },
{ name: 'pool_numerator', type: 'uint128' },
{ name: 'beneficiary_numerator', type: 'uint128' },
{ name: 'referrer_numerator', type: 'uint128' },
{ name: 'beneficiary', type: 'address' },
{ name: 'threshold', type: 'map(address,uint128)' },
{ name: 'referrer_threshold', type: 'map(address,uint128)' },
],
name: 'params',
type: 'tuple',
},
],
outputs: [],
},
{
name: 'DepositLiquidity',
inputs: [
{ name: 'sender', type: 'address' },
{ name: 'owner', type: 'address' },
{
components: [
{ name: 'amount', type: 'uint128' },
{ name: 'root', type: 'address' },
],
name: 'tokens',
type: 'tuple[]',
},
{ name: 'lp', type: 'uint128' },
],
outputs: [],
},
{
name: 'WithdrawLiquidity',
inputs: [
{ name: 'sender', type: 'address' },
{ name: 'owner', type: 'address' },
{ name: 'lp', type: 'uint128' },
{
components: [
{ name: 'amount', type: 'uint128' },
{ name: 'root', type: 'address' },
],
name: 'tokens',
type: 'tuple[]',
},
],
outputs: [],
},
{
name: 'Exchange',
inputs: [
{ name: 'sender', type: 'address' },
{ name: 'recipient', type: 'address' },
{ name: 'spentTokenRoot', type: 'address' },
{ name: 'spentAmount', type: 'uint128' },
{ name: 'receiveTokenRoot', type: 'address' },
{ name: 'receiveAmount', type: 'uint128' },
{
components: [
{ name: 'feeTokenRoot', type: 'address' },
{ name: 'pool_fee', type: 'uint128' },
{ name: 'beneficiary_fee', type: 'uint128' },
{ name: 'beneficiary', type: 'address' },
],
name: 'fees',
type: 'tuple[]',
},
],
outputs: [],
},
{
name: 'ReferrerFees',
inputs: [
{
components: [
{ name: 'amount', type: 'uint128' },
{ name: 'root', type: 'address' },
],
name: 'fees',
type: 'tuple[]',
},
],
outputs: [],
},
{
name: 'Sync',
inputs: [
{ name: 'reserves', type: 'uint128[]' },
{ name: 'lp_supply', type: 'uint128' },
],
outputs: [],
},
],
fields: [
{ init: true, name: '_pubkey', type: 'fixedbytes32' },
{ init: false, name: '_timestamp', type: 'uint64' },
{ init: false, name: '_constructorFlag', type: 'bool' },
{ init: false, name: 'platform_code', type: 'cell' },
{ init: false, name: 'root', type: 'address' },
{ init: false, name: 'vault', type: 'address' },
{ init: false, name: 'active', type: 'bool' },
{ init: false, name: 'current_version', type: 'uint32' },
{
components: [
{ name: 'root', type: 'address' },
{ name: 'wallet', type: 'address' },
{ name: 'balance', type: 'uint128' },
{ name: 'decimals', type: 'uint8' },
{ name: 'accumulatedFee', type: 'uint128' },
{ name: 'rate', type: 'uint256' },
{ name: 'precisionMul', type: 'uint256' },
{ name: 'decimalsLoaded', type: 'bool' },
{ name: 'initialized', type: 'bool' },
],
init: false,
name: 'tokenData',
type: 'tuple[]',
},
{ init: false, name: 'tokenIndex', type: 'map(address,uint8)' },
{ init: false, name: 'PRECISION', type: 'uint256' },
{ init: false, name: 'MAX_DECIMALS', type: 'uint8' },
{ init: false, name: 'lp_root', type: 'address' },
{ init: false, name: 'lp_wallet', type: 'address' },
{ init: false, name: 'lp_supply', type: 'uint128' },
{
components: [
{ name: 'denominator', type: 'uint128' },
{ name: 'pool_numerator', type: 'uint128' },
{ name: 'beneficiary_numerator', type: 'uint128' },
{ name: 'referrer_numerator', type: 'uint128' },
{ name: 'beneficiary', type: 'address' },
{ name: 'threshold', type: 'map(address,uint128)' },
{ name: 'referrer_threshold', type: 'map(address,uint128)' },
],
init: false,
name: 'fee',
type: 'tuple',
},
{
components: [
{ name: 'value', type: 'uint128' },
{ name: 'precision', type: 'uint128' },
],
init: false,
name: 'A',
type: 'tuple',
},
{ init: false, name: 'N_COINS', type: 'uint8' },
],
};