@broxus/js-core
Version:
MobX-based JavaScript Core library
809 lines (808 loc) • 30.3 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DexPairAbi = void 0;
/**
* **DexPair ABI v2.7**
*
* This ABI is used for interacting with the `DexPair` contract on the TVM blockchain.
* @see [DexPair](https://github.com/broxus/flatqube-contracts/blob/master/build/DexPair.abi.json)
*/
exports.DexPairAbi = {
'ABI version': 2,
version: '2.7',
header: ['pubkey', 'time', 'expire'],
functions: [
{
name: 'constructor',
inputs: [],
outputs: [],
},
{
name: 'buildExchangePayload',
inputs: [
{ name: 'id', type: 'uint64' },
{ name: 'deploy_wallet_grams', type: 'uint128' },
{ name: 'expected_amount', type: 'uint128' },
],
outputs: [{ name: 'value0', type: 'cell' }],
},
{
name: 'buildExchangePayloadV2',
inputs: [
{ name: '_id', type: 'uint64' },
{ name: '_deployWalletGrams', type: 'uint128' },
{ name: '_expectedAmount', type: 'uint128' },
{ name: '_recipient', type: 'address' },
{ name: '_referrer', type: 'address' },
{ name: '_successPayload', type: 'optional(cell)' },
{ name: '_cancelPayload', 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' },
],
outputs: [{ name: 'value0', type: 'cell' }],
},
{
name: 'buildDepositLiquidityPayloadV2',
inputs: [
{ name: '_id', type: 'uint64' },
{ name: '_deployWalletGrams', type: 'uint128' },
{ name: '_expectedAmount', type: 'uint128' },
{ name: '_recipient', type: 'address' },
{ name: '_referrer', type: 'address' },
{ name: '_successPayload', type: 'optional(cell)' },
{ name: '_cancelPayload', type: 'optional(cell)' },
{ name: '_toNative', type: 'optional(bool)' },
],
outputs: [{ name: 'value0', type: 'cell' }],
},
{
name: 'buildWithdrawLiquidityPayload',
inputs: [
{ name: 'id', type: 'uint64' },
{ name: 'deploy_wallet_grams', type: 'uint128' },
],
outputs: [{ name: 'value0', type: 'cell' }],
},
{
name: 'buildWithdrawLiquidityPayloadV2',
inputs: [
{ name: '_id', type: 'uint64' },
{ name: '_deployWalletGrams', type: 'uint128' },
{ name: '_expectedLeftAmount', type: 'uint128' },
{ name: '_expectedRightAmount', type: 'uint128' },
{ name: '_recipient', type: 'address' },
{ name: '_referrer', type: 'address' },
{ name: '_successPayload', type: 'optional(cell)' },
{ name: '_cancelPayload', type: 'optional(cell)' },
{ name: '_toNative', type: 'optional(bool)' },
],
outputs: [{ name: 'value0', type: 'cell' }],
},
{
name: 'buildCrossPairExchangePayload',
inputs: [
{ name: 'id', type: 'uint64' },
{ name: 'deploy_wallet_grams', type: 'uint128' },
{ name: 'expected_amount', type: 'uint128' },
{
components: [
{ name: 'amount', type: 'uint128' },
{ name: 'root', type: 'address' },
],
name: 'steps',
type: 'tuple[]',
},
],
outputs: [{ name: 'value0', type: 'cell' }],
},
{
name: 'buildCrossPairExchangePayloadV2',
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: '_successPayload', type: 'optional(cell)' },
{ name: '_cancelPayload', type: 'optional(cell)' },
{ name: '_toNative', type: 'optional(bool)' },
],
outputs: [{ name: 'value0', type: 'cell' }],
},
{
name: 'expectedDepositLiquidity',
inputs: [
{ name: 'answerId', type: 'uint32' },
{ name: 'left_amount', type: 'uint128' },
{ name: 'right_amount', type: 'uint128' },
{ name: 'auto_change', type: 'bool' },
{ name: 'referrer', type: 'optional(address)' },
],
outputs: [
{
components: [
{ name: 'step_1_left_deposit', type: 'uint128' },
{ name: 'step_1_right_deposit', type: 'uint128' },
{ name: 'step_1_lp_reward', type: 'uint128' },
{ name: 'step_2_left_to_right', type: 'bool' },
{ name: 'step_2_right_to_left', type: 'bool' },
{ name: 'step_2_spent', type: 'uint128' },
{ name: 'step_2_fee', type: 'uint128' },
{ name: 'step_2_received', type: 'uint128' },
{ name: 'step_3_left_deposit', type: 'uint128' },
{ name: 'step_3_right_deposit', type: 'uint128' },
{ name: 'step_3_lp_reward', type: 'uint128' },
],
name: 'value0',
type: 'tuple',
},
],
},
{
name: 'depositLiquidity',
inputs: [
{ name: '_callId', 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: '_autoChange', type: 'bool' },
{ name: '_accountOwner', type: 'address' },
{ name: 'value5', type: 'uint32' },
{ name: '_remainingGasTo', type: 'address' },
{ name: '_referrer', type: 'address' },
],
outputs: [],
},
{
name: 'expectedWithdrawLiquidity',
inputs: [
{ name: 'answerId', type: 'uint32' },
{ name: 'lp_amount', type: 'uint128' },
],
outputs: [
{ name: 'expected_left_amount', type: 'uint128' },
{ name: 'expected_right_amount', type: 'uint128' },
],
},
{
name: 'withdrawLiquidity',
inputs: [
{ name: '_callId', 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: '_accountOwner', type: 'address' },
{ name: 'value4', type: 'uint32' },
{ name: '_remainingGasTo', type: 'address' },
],
outputs: [],
},
{
name: 'expectedExchange',
inputs: [
{ name: 'answerId', type: 'uint32' },
{ name: 'amount', type: 'uint128' },
{ name: 'spent_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' },
],
outputs: [
{ name: 'expected_amount', type: 'uint128' },
{ name: 'expected_fee', type: 'uint128' },
],
},
{
name: 'exchange',
inputs: [
{ name: '_callId', 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: '_accountOwner', type: 'address' },
{ name: 'value4', type: 'uint32' },
{ name: '_remainingGasTo', type: 'address' },
],
outputs: [],
},
{
name: 'crossPoolExchange',
inputs: [
{ name: '_id', type: 'uint64' },
{ name: 'value1', type: 'uint32' },
{ name: 'value2', type: 'uint8' },
{ name: '_prevPoolTokenRoots', type: 'address[]' },
{ name: '_op', type: 'uint8' },
{ name: '_spentTokenRoot', type: 'address' },
{ name: '_spentAmount', type: 'uint128' },
{ name: '_senderAddress', type: 'address' },
{ name: '_recipient', type: 'address' },
{ name: '_referrer', type: 'address' },
{ name: '_toNative', type: 'bool' },
{ name: '_remainingGasTo', type: 'address' },
{ name: '_deployWalletGrams', type: 'uint128' },
{ name: '_payload', type: 'cell' },
{ name: '_notifySuccess', type: 'bool' },
{ name: '_successPayload', type: 'cell' },
{ name: '_notifyCancel', type: 'bool' },
{ name: '_cancelPayload', type: 'cell' },
],
outputs: [],
},
{
name: 'onAcceptTokensTransfer',
inputs: [
{ name: '_tokenRoot', type: 'address' },
{ name: '_tokensAmount', type: 'uint128' },
{ name: '_senderAddress', type: 'address' },
{ name: '_senderWallet', type: 'address' },
{ name: '_remainingGasTo', type: 'address' },
{ name: '_payload', type: 'cell' },
],
outputs: [],
},
{
name: 'getRoot',
inputs: [{ name: 'answerId', type: 'uint32' }],
outputs: [{ name: 'dex_root', type: 'address' }],
},
{
name: 'getTokenRoots',
inputs: [{ name: 'answerId', type: 'uint32' }],
outputs: [
{ name: 'left', type: 'address' },
{ name: 'right', type: 'address' },
{ name: 'lp', type: 'address' },
],
},
{
name: 'getTokenWallets',
inputs: [{ name: 'answerId', type: 'uint32' }],
outputs: [
{ name: 'left', type: 'address' },
{ name: 'right', 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: 'getWeverVaultTokenRoot',
inputs: [{ name: 'answerId', type: 'uint32' }],
outputs: [{ name: 'value0', type: 'address' }],
},
{
name: 'getPoolType',
inputs: [{ name: 'answerId', type: 'uint32' }],
outputs: [{ name: 'value0', type: 'uint8' }],
},
{
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: 'getAccumulatedFees',
inputs: [{ name: 'answerId', type: 'uint32' }],
outputs: [{ name: 'accumulatedFees', type: 'uint128[]' }],
},
{
name: 'isActive',
inputs: [{ name: 'answerId', type: 'uint32' }],
outputs: [{ name: 'value0', type: 'bool' }],
},
{
name: 'getBalances',
inputs: [{ name: 'answerId', type: 'uint32' }],
outputs: [
{
components: [
{ name: 'lp_supply', type: 'uint128' },
{ name: 'left_balance', type: 'uint128' },
{ name: 'right_balance', type: 'uint128' },
],
name: 'value0',
type: 'tuple',
},
],
},
{
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: '_remainingGasTo', type: 'address' },
],
outputs: [],
},
{
name: 'setWeverVaultTokenRoot',
inputs: [{ name: '_newWeverVaultTokenRoot', type: 'address' }],
outputs: [],
},
{
name: 'withdrawBeneficiaryFee',
inputs: [{ name: 'send_gas_to', type: 'address' }],
outputs: [],
},
{
name: 'checkPair',
inputs: [
{ name: '_accountOwner', type: 'address' },
{ name: 'value1', type: 'uint32' },
],
outputs: [],
},
{
name: 'upgrade',
inputs: [
{ name: '_code', type: 'cell' },
{ name: '_newVersion', type: 'uint32' },
{ name: '_newType', type: 'uint8' },
{ name: '_remainingGasTo', type: 'address' },
],
outputs: [],
},
{
name: 'liquidityTokenRootDeployed',
inputs: [
{ name: '_lpRootAddress', type: 'address' },
{ name: '_remainingGasTo', type: 'address' },
],
outputs: [],
},
{
name: 'liquidityTokenRootNotDeployed',
inputs: [
{ name: 'value0', type: 'address' },
{ name: '_remainingGasTo', type: 'address' },
],
outputs: [],
},
{
name: 'onTokenWallet',
inputs: [{ name: '_wallet', type: 'address' }],
outputs: [],
},
{
name: 'setActive',
inputs: [
{ name: '_newActive', type: 'bool' },
{ name: '_remainingGasTo', type: 'address' },
],
outputs: [],
},
{
name: 'setOracleOptions',
inputs: [
{
components: [
{ name: 'minInterval', type: 'uint8' },
{ name: 'minRateDeltaNumerator', type: 'uint128' },
{ name: 'minRateDeltaDenominator', type: 'uint128' },
{ name: 'cardinality', type: 'uint16' },
],
name: '_newOptions',
type: 'tuple',
},
{ name: '_remainingGasTo', type: 'address' },
],
outputs: [],
},
{
name: 'getOracleOptions',
inputs: [{ name: 'answerId', type: 'uint32' }],
outputs: [
{
components: [
{ name: 'minInterval', type: 'uint8' },
{ name: 'minRateDeltaNumerator', type: 'uint128' },
{ name: 'minRateDeltaDenominator', type: 'uint128' },
{ name: 'cardinality', type: 'uint16' },
],
name: 'value0',
type: 'tuple',
},
],
},
{
name: 'removeLastNPoints',
inputs: [
{ name: '_count', type: 'uint16' },
{ name: '_remainingGasTo', type: 'address' },
],
outputs: [],
},
{
name: 'getObservation',
inputs: [
{ name: 'answerId', type: 'uint32' },
{ name: '_timestamp', type: 'uint32' },
],
outputs: [
{
components: [
{ name: 'timestamp', type: 'uint32' },
{ name: 'price0To1Cumulative', type: 'uint256' },
{ name: 'price1To0Cumulative', type: 'uint256' },
],
name: 'value0',
type: 'optional(tuple)',
},
],
},
{
name: 'observation',
inputs: [
{ name: '_timestamp', type: 'uint32' },
{ name: '_callbackTo', type: 'address' },
{ name: '_payload', type: 'cell' },
],
outputs: [],
},
{
name: 'getRate',
inputs: [
{ name: 'answerId', type: 'uint32' },
{ name: '_fromTimestamp', type: 'uint32' },
{ name: '_toTimestamp', type: 'uint32' },
],
outputs: [
{
components: [
{ name: 'price0To1', type: 'uint256' },
{ name: 'price1To0', type: 'uint256' },
{ name: 'fromTimestamp', type: 'uint32' },
{ name: 'toTimestamp', type: 'uint32' },
],
name: 'value0',
type: 'optional(tuple)',
},
{ name: 'value1', type: 'uint128[]' },
],
},
{
name: 'rate',
inputs: [
{ name: '_fromTimestamp', type: 'uint32' },
{ name: '_toTimestamp', type: 'uint32' },
{ name: '_callbackTo', type: 'address' },
{ name: '_payload', type: 'cell' },
],
outputs: [],
},
{
name: 'getExpectedAmountByTWAP',
inputs: [
{ name: 'answerId', type: 'uint32' },
{ name: '_amount', type: 'uint128' },
{ name: '_tokenRoot', type: 'address' },
{ name: '_fromTimestamp', type: 'uint32' },
{ name: '_toTimestamp', type: 'uint32' },
],
outputs: [{ name: 'value0', type: 'uint128' }],
},
{
name: 'getPlatformCode',
inputs: [{ name: 'answerId', type: 'uint32' }],
outputs: [{ name: 'value0', type: 'cell' }],
},
],
getters: [],
events: [
{
name: 'WeverVaultTokenRootUpdated',
inputs: [{ name: 'newWeverVaultTokenRoot', type: 'address' }],
outputs: [],
},
{
name: 'OracleInitialized',
inputs: [
{
components: [
{ name: 'timestamp', type: 'uint32' },
{ name: 'price0To1Cumulative', type: 'uint256' },
{ name: 'price1To0Cumulative', type: 'uint256' },
],
name: 'value0',
type: 'tuple',
},
],
outputs: [],
},
{
name: 'OracleUpdated',
inputs: [
{
components: [
{ name: 'timestamp', type: 'uint32' },
{ name: 'price0To1Cumulative', type: 'uint256' },
{ name: 'price1To0Cumulative', type: 'uint256' },
],
name: 'value0',
type: 'tuple',
},
],
outputs: [],
},
{
name: 'OracleOptionsUpdated',
inputs: [
{
components: [
{ name: 'minInterval', type: 'uint8' },
{ name: 'minRateDeltaNumerator', type: 'uint128' },
{ name: 'minRateDeltaDenominator', type: 'uint128' },
{ name: 'cardinality', type: 'uint16' },
],
name: 'value0',
type: 'tuple',
},
],
outputs: [],
},
{
name: 'PairCodeUpgraded',
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' },
{
components: [
{ name: 'price0To1Cumulative', type: 'uint256' },
{ name: 'price1To0Cumulative', type: 'uint256' },
],
init: false,
name: '_points',
type: 'map(uint32,tuple)',
},
{ init: false, name: '_length', type: 'uint16' },
{
components: [
{ name: 'minInterval', type: 'uint8' },
{ name: 'minRateDeltaNumerator', type: 'uint128' },
{ name: 'minRateDeltaDenominator', type: 'uint128' },
{ name: 'cardinality', type: 'uint16' },
],
init: false,
name: '_options',
type: 'tuple',
},
{ init: false, name: '_root', type: 'address' },
{ init: false, name: '_vault', type: 'address' },
{ init: false, name: '_active', type: 'bool' },
{ init: false, name: '_currentVersion', type: 'uint32' },
{
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',
},
{ init: false, name: '_typeToRootAddresses', type: 'map(uint8,address[])' },
{ init: false, name: '_typeToWalletAddresses', type: 'map(uint8,address[])' },
{ init: false, name: '_typeToReserves', type: 'map(uint8,uint128[])' },
{ init: false, name: '_weverVaultTokenRoot', type: 'address' },
],
};