@imtbl/sdk 0.8.0-alpha → 0.11.0-alpha

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.
@@ -1,9 +1,9 @@
1
- import { ethers, ContractFactory, utils, Contract as Contract$1, BigNumber as BigNumber$2, providers, constants } from 'ethers';
1
+ import { ethers, ContractFactory, utils, Contract as Contract$1, BigNumber as BigNumber$1, providers, constants } from 'ethers';
2
2
  import { Web3Provider, JsonRpcProvider } from '@ethersproject/providers';
3
3
  import $7v2Z6$metamaskdetectprovider from '@metamask/detect-provider';
4
- import { Token, TradeType, CurrencyAmount, Percent } from '@uniswap/sdk-core';
4
+ import { Token, TradeType, Percent, CurrencyAmount } from '@uniswap/sdk-core';
5
5
  import assert from 'assert';
6
- import { BigNumber as BigNumber$1 } from '@ethersproject/bignumber';
6
+ import { BigNumber as BigNumber$2 } from '@ethersproject/bignumber';
7
7
  import { FeeAmount, Route, SwapQuoter, Pool, Trade, toHex as toHex$1, encodeRouteToPath } from '@uniswap/v3-sdk';
8
8
  import { keccak256 as keccak256$1 } from '@ethersproject/solidity';
9
9
  import { SwapRouter } from '@uniswap/router-sdk';
@@ -4050,10 +4050,10 @@ class BigNumber {
4050
4050
  Object.freeze(this);
4051
4051
  }
4052
4052
  fromTwos(value) {
4053
- return toBigNumber$1(toBN(this).fromTwos(value));
4053
+ return toBigNumber(toBN(this).fromTwos(value));
4054
4054
  }
4055
4055
  toTwos(value) {
4056
- return toBigNumber$1(toBN(this).toTwos(value));
4056
+ return toBigNumber(toBN(this).toTwos(value));
4057
4057
  }
4058
4058
  abs() {
4059
4059
  if (this._hex[0] === "-") {
@@ -4062,73 +4062,73 @@ class BigNumber {
4062
4062
  return this;
4063
4063
  }
4064
4064
  add(other) {
4065
- return toBigNumber$1(toBN(this).add(toBN(other)));
4065
+ return toBigNumber(toBN(this).add(toBN(other)));
4066
4066
  }
4067
4067
  sub(other) {
4068
- return toBigNumber$1(toBN(this).sub(toBN(other)));
4068
+ return toBigNumber(toBN(this).sub(toBN(other)));
4069
4069
  }
4070
4070
  div(other) {
4071
4071
  const o = BigNumber.from(other);
4072
4072
  if (o.isZero()) {
4073
4073
  throwFault("division-by-zero", "div");
4074
4074
  }
4075
- return toBigNumber$1(toBN(this).div(toBN(other)));
4075
+ return toBigNumber(toBN(this).div(toBN(other)));
4076
4076
  }
4077
4077
  mul(other) {
4078
- return toBigNumber$1(toBN(this).mul(toBN(other)));
4078
+ return toBigNumber(toBN(this).mul(toBN(other)));
4079
4079
  }
4080
4080
  mod(other) {
4081
4081
  const value = toBN(other);
4082
4082
  if (value.isNeg()) {
4083
4083
  throwFault("division-by-zero", "mod");
4084
4084
  }
4085
- return toBigNumber$1(toBN(this).umod(value));
4085
+ return toBigNumber(toBN(this).umod(value));
4086
4086
  }
4087
4087
  pow(other) {
4088
4088
  const value = toBN(other);
4089
4089
  if (value.isNeg()) {
4090
4090
  throwFault("negative-power", "pow");
4091
4091
  }
4092
- return toBigNumber$1(toBN(this).pow(value));
4092
+ return toBigNumber(toBN(this).pow(value));
4093
4093
  }
4094
4094
  and(other) {
4095
4095
  const value = toBN(other);
4096
4096
  if (this.isNegative() || value.isNeg()) {
4097
4097
  throwFault("unbound-bitwise-result", "and");
4098
4098
  }
4099
- return toBigNumber$1(toBN(this).and(value));
4099
+ return toBigNumber(toBN(this).and(value));
4100
4100
  }
4101
4101
  or(other) {
4102
4102
  const value = toBN(other);
4103
4103
  if (this.isNegative() || value.isNeg()) {
4104
4104
  throwFault("unbound-bitwise-result", "or");
4105
4105
  }
4106
- return toBigNumber$1(toBN(this).or(value));
4106
+ return toBigNumber(toBN(this).or(value));
4107
4107
  }
4108
4108
  xor(other) {
4109
4109
  const value = toBN(other);
4110
4110
  if (this.isNegative() || value.isNeg()) {
4111
4111
  throwFault("unbound-bitwise-result", "xor");
4112
4112
  }
4113
- return toBigNumber$1(toBN(this).xor(value));
4113
+ return toBigNumber(toBN(this).xor(value));
4114
4114
  }
4115
4115
  mask(value) {
4116
4116
  if (this.isNegative() || value < 0) {
4117
4117
  throwFault("negative-width", "mask");
4118
4118
  }
4119
- return toBigNumber$1(toBN(this).maskn(value));
4119
+ return toBigNumber(toBN(this).maskn(value));
4120
4120
  }
4121
4121
  shl(value) {
4122
4122
  if (this.isNegative() || value < 0) {
4123
4123
  throwFault("negative-width", "shl");
4124
4124
  }
4125
- return toBigNumber$1(toBN(this).shln(value));
4125
+ return toBigNumber(toBN(this).shln(value));
4126
4126
  }
4127
4127
  shr(value) {
4128
4128
  if (this.isNegative() || value < 0) {
4129
4129
  throwFault("negative-width", "shr");
4130
4130
  }
4131
- return toBigNumber$1(toBN(this).shrn(value));
4131
+ return toBigNumber(toBN(this).shrn(value));
4132
4132
  }
4133
4133
  eq(other) {
4134
4134
  return toBN(this).eq(toBN(other));
@@ -4291,7 +4291,7 @@ function toHex(value) {
4291
4291
  }
4292
4292
  return value;
4293
4293
  }
4294
- function toBigNumber$1(value) {
4294
+ function toBigNumber(value) {
4295
4295
  return BigNumber.from(toHex(value));
4296
4296
  }
4297
4297
  function toBN(value) {
@@ -12784,7 +12784,7 @@ const getERC20AmountToApprove = async (provider, ownerAddress, tokenAddress, tok
12784
12784
  throw new ApproveError(`failed to get allowance: ${message}`);
12785
12785
  }
12786
12786
  // get the amount that needs to be approved
12787
- const requiredAmount = BigNumber$1.from(tokenAmount).sub(allowance);
12787
+ const requiredAmount = BigNumber$2.from(tokenAmount).sub(allowance);
12788
12788
  if (requiredAmount.isNegative() || requiredAmount.isZero()) {
12789
12789
  throw new AlreadyApprovedError(tokenAmount.toString(), tokenAddress, spenderAddress);
12790
12790
  }
@@ -12831,7 +12831,7 @@ const prepareApproval = (tradeType, amountSpecified, amountWithSlippage, routing
12831
12831
  const getApproveTransaction = async (provider, ownerAddress, tokenAddress, tokenAmount, spenderAddress) => {
12832
12832
  let amountToApprove;
12833
12833
  try {
12834
- amountToApprove = await getERC20AmountToApprove(provider, ownerAddress, tokenAddress, BigNumber$1.from(tokenAmount), spenderAddress);
12834
+ amountToApprove = await getERC20AmountToApprove(provider, ownerAddress, tokenAddress, BigNumber$2.from(tokenAmount), spenderAddress);
12835
12835
  }
12836
12836
  catch (e) {
12837
12837
  if (e instanceof AlreadyApprovedError) {
@@ -12864,70 +12864,6 @@ const getApproval = async (nativeToken, provider, ownerAddress, tokenAddress, pr
12864
12864
  };
12865
12865
  };
12866
12866
 
12867
- const quoteReturnMapping = {
12868
- // eslint-disable-next-line @typescript-eslint/naming-convention
12869
- '0xcdca1753': ['uint256', 'uint160[]', 'uint32[]', 'uint256'],
12870
- // eslint-disable-next-line @typescript-eslint/naming-convention
12871
- '0xc6a5026a': ['uint256', 'uint160', 'uint32', 'uint256'],
12872
- // eslint-disable-next-line @typescript-eslint/naming-convention
12873
- '0x2f80bb1d': ['uint256', 'uint160[]', 'uint32[]', 'uint256'],
12874
- // eslint-disable-next-line @typescript-eslint/naming-convention
12875
- '0xbd21704a': ['uint256', 'uint160', 'uint32', 'uint256'],
12876
- };
12877
- /**
12878
- * Returns true if poolA is equivalent to poolB
12879
- * @param poolA one of the two pools
12880
- * @param poolB the other pool
12881
- */
12882
- function poolEquals(poolA, poolB) {
12883
- return (poolA === poolB
12884
- || (poolA.token0.equals(poolB.token0)
12885
- && poolA.token1.equals(poolB.token1)
12886
- && poolA.fee === poolB.fee));
12887
- }
12888
- async function getERC20Decimals(tokenAddress, provider) {
12889
- const decimalsFunctionSig = ethers.utils.id('decimals()').substring(0, 10);
12890
- try {
12891
- const decimalsResult = await provider.call({
12892
- to: tokenAddress,
12893
- data: decimalsFunctionSig,
12894
- });
12895
- return parseInt(decimalsResult, 16);
12896
- }
12897
- catch (e) {
12898
- const message = e instanceof Error ? e.message : 'Unknown Error';
12899
- throw new ProviderCallError(`failed to get ERC20 decimals: ${message}`);
12900
- }
12901
- }
12902
- /**
12903
- * Based on https://github.com/ethers-io/ethers.js/blob/main/src.ts/address/checks.ts#L51
12904
- */
12905
- function isValidNonZeroAddress(address) {
12906
- if (address === ethers.constants.AddressZero) {
12907
- return false;
12908
- }
12909
- try {
12910
- ethers.utils.getAddress(address);
12911
- return true;
12912
- }
12913
- catch (error) {
12914
- return false;
12915
- }
12916
- }
12917
- const tokenInfoToUniswapToken = (tokenInfo) => new Token(tokenInfo.chainId, tokenInfo.address, tokenInfo.decimals, tokenInfo.symbol, tokenInfo.name);
12918
- const uniswapTokenToTokenInfo = (token) => ({
12919
- chainId: token.chainId,
12920
- address: token.address,
12921
- decimals: token.decimals,
12922
- symbol: token.symbol,
12923
- name: token.name,
12924
- });
12925
- const toBigNumber = (amount) => (ethers.BigNumber.from(amount.multiply(amount.decimalScale).toExact()));
12926
- const newAmount = (amount, token) => ({
12927
- value: amount,
12928
- token,
12929
- });
12930
-
12931
12867
  // slippageToPercent takes the slippage as a percentage (e.g. 0.1) and
12932
12868
  // converts it to the Uniswap equivalent type
12933
12869
  const slippageToFraction = (slippage) => {
@@ -12947,17 +12883,11 @@ const slippageToFraction = (slippage) => {
12947
12883
  return new Percent(numerator, denominator);
12948
12884
  };
12949
12885
 
12950
- function getQuoteAmountFromTradeType(tradeInfo, tokenInfo) {
12886
+ function getQuoteAmountFromTradeType(tradeInfo) {
12951
12887
  if (tradeInfo.tradeType === TradeType.EXACT_INPUT) {
12952
- return {
12953
- token: tokenInfo,
12954
- value: tradeInfo.amountOut,
12955
- };
12888
+ return tradeInfo.amountOut;
12956
12889
  }
12957
- return {
12958
- token: tokenInfo,
12959
- value: tradeInfo.amountIn,
12960
- };
12890
+ return tradeInfo.amountIn;
12961
12891
  }
12962
12892
  function applySlippage(tradeType, amount, slippage) {
12963
12893
  const slippageTolerance = slippageToFraction(slippage);
@@ -12966,8 +12896,8 @@ function applySlippage(tradeType, amount, slippage) {
12966
12896
  const amountWithSlippage = maybeInverted.multiply(amount.toString()).quotient;
12967
12897
  return ethers.BigNumber.from(amountWithSlippage.toString());
12968
12898
  }
12969
- function prepareUserQuote(otherCurrency, tradeInfo, slippage, fees) {
12970
- const resultToken = otherCurrency.wrapped;
12899
+ function prepareUserQuote(otherToken, tradeInfo, slippage, fees) {
12900
+ const resultToken = otherToken.wrapped;
12971
12901
  const tokenInfo = {
12972
12902
  chainId: resultToken.chainId,
12973
12903
  address: resultToken.address,
@@ -12975,7 +12905,7 @@ function prepareUserQuote(otherCurrency, tradeInfo, slippage, fees) {
12975
12905
  symbol: resultToken.symbol,
12976
12906
  name: resultToken.name,
12977
12907
  };
12978
- const quote = getQuoteAmountFromTradeType(tradeInfo, tokenInfo);
12908
+ const quote = getQuoteAmountFromTradeType(tradeInfo);
12979
12909
  const amountWithSlippage = applySlippage(tradeInfo.tradeType, quote.value, slippage);
12980
12910
  return {
12981
12911
  amount: quote,
@@ -12992,8 +12922,8 @@ function getOurQuoteReqAmount(amount, fees, tradeType) {
12992
12922
  // For an exact output swap, we do not need to subtract fees from the given amount
12993
12923
  return amount;
12994
12924
  }
12995
- fees.addAmount(toBigNumber(amount));
12996
- return CurrencyAmount.fromRawAmount(amount.currency, fees.amountLessFees().toString());
12925
+ fees.addAmount(amount);
12926
+ return fees.amountLessFees();
12997
12927
  }
12998
12928
 
12999
12929
  // 0.1% default slippage
@@ -13145,6 +13075,11 @@ class Multicall__factory extends ContractFactory {
13145
13075
  const _abi$1 = [
13146
13076
  {
13147
13077
  inputs: [
13078
+ {
13079
+ internalType: "address",
13080
+ name: "_admin",
13081
+ type: "address",
13082
+ },
13148
13083
  {
13149
13084
  internalType: "address",
13150
13085
  name: "_uniRouter",
@@ -13185,36 +13120,92 @@ const _abi$1 = [
13185
13120
  name: "FeeTaken",
13186
13121
  type: "event",
13187
13122
  },
13123
+ {
13124
+ anonymous: false,
13125
+ inputs: [
13126
+ {
13127
+ indexed: false,
13128
+ internalType: "address",
13129
+ name: "account",
13130
+ type: "address",
13131
+ },
13132
+ ],
13133
+ name: "Paused",
13134
+ type: "event",
13135
+ },
13188
13136
  {
13189
13137
  anonymous: false,
13190
13138
  inputs: [
13139
+ {
13140
+ indexed: true,
13141
+ internalType: "bytes32",
13142
+ name: "role",
13143
+ type: "bytes32",
13144
+ },
13145
+ {
13146
+ indexed: true,
13147
+ internalType: "bytes32",
13148
+ name: "previousAdminRole",
13149
+ type: "bytes32",
13150
+ },
13151
+ {
13152
+ indexed: true,
13153
+ internalType: "bytes32",
13154
+ name: "newAdminRole",
13155
+ type: "bytes32",
13156
+ },
13157
+ ],
13158
+ name: "RoleAdminChanged",
13159
+ type: "event",
13160
+ },
13161
+ {
13162
+ anonymous: false,
13163
+ inputs: [
13164
+ {
13165
+ indexed: true,
13166
+ internalType: "bytes32",
13167
+ name: "role",
13168
+ type: "bytes32",
13169
+ },
13191
13170
  {
13192
13171
  indexed: true,
13193
13172
  internalType: "address",
13194
- name: "previousOwner",
13173
+ name: "account",
13195
13174
  type: "address",
13196
13175
  },
13197
13176
  {
13198
13177
  indexed: true,
13199
13178
  internalType: "address",
13200
- name: "newOwner",
13179
+ name: "sender",
13201
13180
  type: "address",
13202
13181
  },
13203
13182
  ],
13204
- name: "OwnershipTransferred",
13183
+ name: "RoleGranted",
13205
13184
  type: "event",
13206
13185
  },
13207
13186
  {
13208
13187
  anonymous: false,
13209
13188
  inputs: [
13210
13189
  {
13211
- indexed: false,
13190
+ indexed: true,
13191
+ internalType: "bytes32",
13192
+ name: "role",
13193
+ type: "bytes32",
13194
+ },
13195
+ {
13196
+ indexed: true,
13212
13197
  internalType: "address",
13213
13198
  name: "account",
13214
13199
  type: "address",
13215
13200
  },
13201
+ {
13202
+ indexed: true,
13203
+ internalType: "address",
13204
+ name: "sender",
13205
+ type: "address",
13206
+ },
13216
13207
  ],
13217
- name: "Paused",
13208
+ name: "RoleRevoked",
13218
13209
  type: "event",
13219
13210
  },
13220
13211
  {
@@ -13235,9 +13226,9 @@ const _abi$1 = [
13235
13226
  name: "BASIS_POINT_PRECISION",
13236
13227
  outputs: [
13237
13228
  {
13238
- internalType: "uint16",
13229
+ internalType: "uint256",
13239
13230
  name: "",
13240
- type: "uint16",
13231
+ type: "uint256",
13241
13232
  },
13242
13233
  ],
13243
13234
  stateMutability: "view",
@@ -13245,7 +13236,20 @@ const _abi$1 = [
13245
13236
  },
13246
13237
  {
13247
13238
  inputs: [],
13248
- name: "MAX_SERVICE_FEE",
13239
+ name: "DEFAULT_ADMIN_ROLE",
13240
+ outputs: [
13241
+ {
13242
+ internalType: "bytes32",
13243
+ name: "",
13244
+ type: "bytes32",
13245
+ },
13246
+ ],
13247
+ stateMutability: "view",
13248
+ type: "function",
13249
+ },
13250
+ {
13251
+ inputs: [],
13252
+ name: "FEE_BASIS_POINTS_MAXIMUM",
13249
13253
  outputs: [
13250
13254
  {
13251
13255
  internalType: "uint16",
@@ -13256,6 +13260,45 @@ const _abi$1 = [
13256
13260
  stateMutability: "view",
13257
13261
  type: "function",
13258
13262
  },
13263
+ {
13264
+ inputs: [],
13265
+ name: "PAUSE",
13266
+ outputs: [
13267
+ {
13268
+ internalType: "bytes32",
13269
+ name: "",
13270
+ type: "bytes32",
13271
+ },
13272
+ ],
13273
+ stateMutability: "view",
13274
+ type: "function",
13275
+ },
13276
+ {
13277
+ inputs: [],
13278
+ name: "UNPAUSE",
13279
+ outputs: [
13280
+ {
13281
+ internalType: "bytes32",
13282
+ name: "",
13283
+ type: "bytes32",
13284
+ },
13285
+ ],
13286
+ stateMutability: "view",
13287
+ type: "function",
13288
+ },
13289
+ {
13290
+ inputs: [],
13291
+ name: "WITHDRAW",
13292
+ outputs: [
13293
+ {
13294
+ internalType: "bytes32",
13295
+ name: "",
13296
+ type: "bytes32",
13297
+ },
13298
+ ],
13299
+ stateMutability: "view",
13300
+ type: "function",
13301
+ },
13259
13302
  {
13260
13303
  inputs: [
13261
13304
  {
@@ -13266,13 +13309,13 @@ const _abi$1 = [
13266
13309
  type: "address",
13267
13310
  },
13268
13311
  {
13269
- internalType: "uint16",
13270
- name: "feePrcntBasisPoints",
13271
- type: "uint16",
13312
+ internalType: "uint256",
13313
+ name: "feeBasisPoints",
13314
+ type: "uint256",
13272
13315
  },
13273
13316
  ],
13274
- internalType: "struct ISecondaryFee.ServiceFeeParams[]",
13275
- name: "serviceFee",
13317
+ internalType: "struct ISecondaryFee.SecondaryFeeParams[]",
13318
+ name: "secondaryFees",
13276
13319
  type: "tuple[]",
13277
13320
  },
13278
13321
  {
@@ -13314,11 +13357,11 @@ const _abi$1 = [
13314
13357
  },
13315
13358
  ],
13316
13359
  internalType: "struct IV3SwapRouter.ExactInputSingleParams",
13317
- name: "params",
13360
+ name: "swapParams",
13318
13361
  type: "tuple",
13319
13362
  },
13320
13363
  ],
13321
- name: "exactInputSingleWithServiceFee",
13364
+ name: "exactInputSingleWithSecondaryFee",
13322
13365
  outputs: [
13323
13366
  {
13324
13367
  internalType: "uint256",
@@ -13339,13 +13382,13 @@ const _abi$1 = [
13339
13382
  type: "address",
13340
13383
  },
13341
13384
  {
13342
- internalType: "uint16",
13343
- name: "feePrcntBasisPoints",
13344
- type: "uint16",
13385
+ internalType: "uint256",
13386
+ name: "feeBasisPoints",
13387
+ type: "uint256",
13345
13388
  },
13346
13389
  ],
13347
- internalType: "struct ISecondaryFee.ServiceFeeParams[]",
13348
- name: "serviceFee",
13390
+ internalType: "struct ISecondaryFee.SecondaryFeeParams[]",
13391
+ name: "secondaryFees",
13349
13392
  type: "tuple[]",
13350
13393
  },
13351
13394
  {
@@ -13372,11 +13415,11 @@ const _abi$1 = [
13372
13415
  },
13373
13416
  ],
13374
13417
  internalType: "struct IV3SwapRouter.ExactInputParams",
13375
- name: "params",
13418
+ name: "swapParams",
13376
13419
  type: "tuple",
13377
13420
  },
13378
13421
  ],
13379
- name: "exactInputWithServiceFee",
13422
+ name: "exactInputWithSecondaryFee",
13380
13423
  outputs: [
13381
13424
  {
13382
13425
  internalType: "uint256",
@@ -13397,13 +13440,13 @@ const _abi$1 = [
13397
13440
  type: "address",
13398
13441
  },
13399
13442
  {
13400
- internalType: "uint16",
13401
- name: "feePrcntBasisPoints",
13402
- type: "uint16",
13443
+ internalType: "uint256",
13444
+ name: "feeBasisPoints",
13445
+ type: "uint256",
13403
13446
  },
13404
13447
  ],
13405
- internalType: "struct ISecondaryFee.ServiceFeeParams[]",
13406
- name: "serviceFee",
13448
+ internalType: "struct ISecondaryFee.SecondaryFeeParams[]",
13449
+ name: "secondaryFees",
13407
13450
  type: "tuple[]",
13408
13451
  },
13409
13452
  {
@@ -13445,15 +13488,15 @@ const _abi$1 = [
13445
13488
  },
13446
13489
  ],
13447
13490
  internalType: "struct IV3SwapRouter.ExactOutputSingleParams",
13448
- name: "params",
13491
+ name: "swapParams",
13449
13492
  type: "tuple",
13450
13493
  },
13451
13494
  ],
13452
- name: "exactOutputSingleWithServiceFee",
13495
+ name: "exactOutputSingleWithSecondaryFee",
13453
13496
  outputs: [
13454
13497
  {
13455
13498
  internalType: "uint256",
13456
- name: "amountIn",
13499
+ name: "",
13457
13500
  type: "uint256",
13458
13501
  },
13459
13502
  ],
@@ -13470,13 +13513,13 @@ const _abi$1 = [
13470
13513
  type: "address",
13471
13514
  },
13472
13515
  {
13473
- internalType: "uint16",
13474
- name: "feePrcntBasisPoints",
13475
- type: "uint16",
13516
+ internalType: "uint256",
13517
+ name: "feeBasisPoints",
13518
+ type: "uint256",
13476
13519
  },
13477
13520
  ],
13478
- internalType: "struct ISecondaryFee.ServiceFeeParams[]",
13479
- name: "serviceFee",
13521
+ internalType: "struct ISecondaryFee.SecondaryFeeParams[]",
13522
+ name: "secondaryFees",
13480
13523
  type: "tuple[]",
13481
13524
  },
13482
13525
  {
@@ -13503,21 +13546,82 @@ const _abi$1 = [
13503
13546
  },
13504
13547
  ],
13505
13548
  internalType: "struct IV3SwapRouter.ExactOutputParams",
13506
- name: "params",
13549
+ name: "swapParams",
13507
13550
  type: "tuple",
13508
13551
  },
13509
13552
  ],
13510
- name: "exactOutputWithServiceFee",
13553
+ name: "exactOutputWithSecondaryFee",
13511
13554
  outputs: [
13512
13555
  {
13513
13556
  internalType: "uint256",
13514
- name: "amountIn",
13557
+ name: "",
13515
13558
  type: "uint256",
13516
13559
  },
13517
13560
  ],
13518
13561
  stateMutability: "payable",
13519
13562
  type: "function",
13520
13563
  },
13564
+ {
13565
+ inputs: [
13566
+ {
13567
+ internalType: "bytes32",
13568
+ name: "role",
13569
+ type: "bytes32",
13570
+ },
13571
+ ],
13572
+ name: "getRoleAdmin",
13573
+ outputs: [
13574
+ {
13575
+ internalType: "bytes32",
13576
+ name: "",
13577
+ type: "bytes32",
13578
+ },
13579
+ ],
13580
+ stateMutability: "view",
13581
+ type: "function",
13582
+ },
13583
+ {
13584
+ inputs: [
13585
+ {
13586
+ internalType: "bytes32",
13587
+ name: "role",
13588
+ type: "bytes32",
13589
+ },
13590
+ {
13591
+ internalType: "address",
13592
+ name: "account",
13593
+ type: "address",
13594
+ },
13595
+ ],
13596
+ name: "grantRole",
13597
+ outputs: [],
13598
+ stateMutability: "nonpayable",
13599
+ type: "function",
13600
+ },
13601
+ {
13602
+ inputs: [
13603
+ {
13604
+ internalType: "bytes32",
13605
+ name: "role",
13606
+ type: "bytes32",
13607
+ },
13608
+ {
13609
+ internalType: "address",
13610
+ name: "account",
13611
+ type: "address",
13612
+ },
13613
+ ],
13614
+ name: "hasRole",
13615
+ outputs: [
13616
+ {
13617
+ internalType: "bool",
13618
+ name: "",
13619
+ type: "bool",
13620
+ },
13621
+ ],
13622
+ stateMutability: "view",
13623
+ type: "function",
13624
+ },
13521
13625
  {
13522
13626
  inputs: [
13523
13627
  {
@@ -13561,19 +13665,6 @@ const _abi$1 = [
13561
13665
  stateMutability: "nonpayable",
13562
13666
  type: "function",
13563
13667
  },
13564
- {
13565
- inputs: [],
13566
- name: "owner",
13567
- outputs: [
13568
- {
13569
- internalType: "address",
13570
- name: "",
13571
- type: "address",
13572
- },
13573
- ],
13574
- stateMutability: "view",
13575
- type: "function",
13576
- },
13577
13668
  {
13578
13669
  inputs: [],
13579
13670
  name: "pause",
@@ -13595,25 +13686,60 @@ const _abi$1 = [
13595
13686
  type: "function",
13596
13687
  },
13597
13688
  {
13598
- inputs: [],
13599
- name: "renounceOwnership",
13689
+ inputs: [
13690
+ {
13691
+ internalType: "bytes32",
13692
+ name: "role",
13693
+ type: "bytes32",
13694
+ },
13695
+ {
13696
+ internalType: "address",
13697
+ name: "account",
13698
+ type: "address",
13699
+ },
13700
+ ],
13701
+ name: "renounceRole",
13600
13702
  outputs: [],
13601
13703
  stateMutability: "nonpayable",
13602
13704
  type: "function",
13603
13705
  },
13604
13706
  {
13605
13707
  inputs: [
13708
+ {
13709
+ internalType: "bytes32",
13710
+ name: "role",
13711
+ type: "bytes32",
13712
+ },
13606
13713
  {
13607
13714
  internalType: "address",
13608
- name: "newOwner",
13715
+ name: "account",
13609
13716
  type: "address",
13610
13717
  },
13611
13718
  ],
13612
- name: "transferOwnership",
13719
+ name: "revokeRole",
13613
13720
  outputs: [],
13614
13721
  stateMutability: "nonpayable",
13615
13722
  type: "function",
13616
13723
  },
13724
+ {
13725
+ inputs: [
13726
+ {
13727
+ internalType: "bytes4",
13728
+ name: "interfaceId",
13729
+ type: "bytes4",
13730
+ },
13731
+ ],
13732
+ name: "supportsInterface",
13733
+ outputs: [
13734
+ {
13735
+ internalType: "bool",
13736
+ name: "",
13737
+ type: "bool",
13738
+ },
13739
+ ],
13740
+ stateMutability: "view",
13741
+ type: "function",
13742
+ },
13617
13743
  {
13618
13744
  inputs: [],
13619
13745
  name: "uniswapRouter",
@@ -13634,8 +13760,26 @@ const _abi$1 = [
13634
13760
  stateMutability: "nonpayable",
13635
13761
  type: "function",
13636
13762
  },
13763
+ {
13764
+ inputs: [
13765
+ {
13766
+ internalType: "address",
13767
+ name: "to",
13768
+ type: "address",
13769
+ },
13770
+ {
13771
+ internalType: "address",
13772
+ name: "erc20",
13773
+ type: "address",
13774
+ },
13775
+ ],
13776
+ name: "withdrawFunds",
13777
+ outputs: [],
13778
+ stateMutability: "nonpayable",
13779
+ type: "function",
13780
+ },
13637
13781
  ];
13638
- const _bytecode$1 = "0x60806040523480156200001157600080fd5b5060405162002123380380620021238339810160408190526200003491620000c2565b6200003f3362000072565b6000805460ff60a01b19169055600180546001600160a01b0319166001600160a01b0392909216919091179055620000f4565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208284031215620000d557600080fd5b81516001600160a01b0381168114620000ed57600080fd5b9392505050565b61201f80620001046000396000f3fe6080604052600436106100e85760003560e01c8063735de9f71161008a578063ac9650d811610059578063ac9650d814610243578063d9a6f70514610263578063ed921d3c14610279578063f2fde38b1461028c57600080fd5b8063735de9f7146101c5578063742ac944146101fd5780638456cb59146102105780638da5cb5b1461022557600080fd5b80633f4ba83a116100c65780633f4ba83a1461014f5780635ae401dc146101665780635c975abb14610186578063715018a6146101b057600080fd5b80631411734e146100ed57806314d90e1b146101135780631fd168ff1461013c575b600080fd5b6101006100fb366004611a14565b6102ac565b6040519081526020015b60405180910390f35b34801561011f57600080fd5b506101296103e881565b60405161ffff909116815260200161010a565b61010061014a366004611a14565b61040a565b34801561015b57600080fd5b5061016461057a565b005b610179610174366004611ac0565b61058c565b60405161010a9190611b5b565b34801561019257600080fd5b50600054600160a01b900460ff16604051901515815260200161010a565b3480156101bc57600080fd5b506101646105e2565b3480156101d157600080fd5b506001546101e5906001600160a01b031681565b6040516001600160a01b03909116815260200161010a565b61010061020b366004611c50565b6105f4565b34801561021c57600080fd5b50610164610731565b34801561023157600080fd5b506000546001600160a01b03166101e5565b34801561024f57600080fd5b5061017961025e366004611ca5565b610741565b34801561026f57600080fd5b5061012961271081565b610100610287366004611c50565b610836565b34801561029857600080fd5b506101646102a7366004611ce6565b61095e565b60208101516000906001600160a01b031633148015906102d9575060208201516001600160a01b03163014155b156102ff5760405162461bcd60e51b81526004016102f690611d03565b60405180910390fd5b600061030e83600001516109d7565b905060008061037983866040015187602001518a8a808060200260200160405190810160405280939291908181526020016000905b8282101561036f5761036060408302860136819003810190611d50565b81526020019060010190610343565b50505050506109e3565b60408088018390526001600160a01b0380831660208a0152600154915163b858183f60e01b8152939550919350169063b858183f906103bc908890600401611dfc565b6020604051808303816000875af11580156103db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ff9190611e0f565b979650505050505050565b6040810151815160009190829061042090610ac4565b9050600061043185600001516109d7565b90506000806000806104a4868a606001518b604001518c602001518f8f808060200260200160405190810160405280939291908181526020016000905b8282101561049a5761048b60408302860136819003810190611d50565b8152602001906001019061046e565b5050505050610af2565b9350935093509350838960400181815250508289602001906001600160a01b031690816001600160a01b031681525050600160009054906101000a90046001600160a01b03166001600160a01b03166309b813468a6040518263ffffffff1660e01b81526004016105159190611dfc565b6020604051808303816000875af1158015610534573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105589190611e0f565b975061056c8787878c604001518587610bd3565b505050505050509392505050565b610582610e16565b61058a610e70565b565b6060834211156105d05760405162461bcd60e51b815260206004820152600f60248201526e111958591b1a5b99481c185cdcd959608a1b60448201526064016102f6565b6105da8383610741565b949350505050565b6105ea610e16565b61058a6000610ec5565b60608101516000906001600160a01b03163314801590610621575060608201516001600160a01b03163014155b1561063e5760405162461bcd60e51b81526004016102f690611d03565b6000806106a18460000151856080015186606001518989808060200260200160405190810160405280939291908181526020016000905b8282101561036f5761069260408302860136819003810190611d50565b81526020019060010190610675565b608086018290526001600160a01b0380821660608801526001546040516304e45aaf60e01b815293955091935016906304e45aaf906106e4908790600401611e28565b6020604051808303816000875af1158015610703573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107279190611e0f565b9695505050505050565b610739610e16565b61058a610f15565b6060816001600160401b0381111561075b5761075b61189c565b60405190808252806020026020018201604052801561078e57816020015b60608152602001906001900390816107795790505b50905060005b8281101561082e576107fe308585848181106107b2576107b2611e87565b90506020028101906107c49190611e9d565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610f5892505050565b82828151811061081057610810611e87565b6020026020010181905250808061082690611ef9565b915050610794565b505b92915050565b600080826080015190506000806000806108ab87600001518860a0015189608001518a606001518d8d808060200260200160405190810160405280939291908181526020016000905b8282101561049a5761089c60408302860136819003810190611d50565b8152602001906001019061087f565b60808b018490526001600160a01b0380841660608d0152600154604051635023b4df60e01b815295995093975091955093501690635023b4df906108f3908a90600401611e28565b6020604051808303816000875af1158015610912573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109369190611e0f565b955061095285886000015189602001518a608001518587610bd3565b50505050509392505050565b610966610e16565b6001600160a01b0381166109cb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102f6565b6109d481610ec5565b50565b60006108308282610f84565b600080548190600160a01b900460ff16610a2257600080610a048786610fe9565b9092509050610a138288611f12565b9650610a1f88826111c6565b50505b6040516323b872dd60e01b8152336004820152306024820152604481018690526001600160a01b038716906323b872dd906064016020604051808303816000875af1158015610a75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a999190611f25565b50610aa48686611341565b306001600160a01b03851603610ab8573393505b50929491935090915050565b60008060148351610ad59190611f12565b90506000610ae584836014611438565b90506105da816000610f84565b6000806060818082610b0e60005460ff600160a01b9091041690565b610b2e57610b1c8988610fe9565b9092509050610b2b828a611f47565b98505b6001600160a01b0388163014610b42573097505b610b4c8b8b611341565b6040516323b872dd60e01b8152336004820152306024820152604481018b90526001600160a01b038c16906323b872dd906064016020604051808303816000875af1158015610b9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc39190611f25565b50979a9699509697505050505050565b600054600160a01b900460ff16610bee57610bee8482611545565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610c35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c599190611e0f565b9050610c658385611f12565b811015610cb45760405162461bcd60e51b815260206004820181905260248201527f696e636f72726563742066656520616d6f756e7420646973747269627574656460448201526064016102f6565b60405163a9059cbb60e01b8152336004820152602481018890526001600160a01b0386169063a9059cbb906044016020604051808303816000875af1158015610d01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d259190611f25565b506040516370a0823160e01b81523060048201526000906001600160a01b038816906370a0823190602401602060405180830381865afa158015610d6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d919190611e0f565b90508015610e0c5760405163a9059cbb60e01b8152336004820152602481018290526001600160a01b0388169063a9059cbb906044016020604051808303816000875af1158015610de6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0a9190611f25565b505b5050505050505050565b6000546001600160a01b0316331461058a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102f6565b610e786116b4565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610f1d611704565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610ea83390565b6060610f7d8383604051806060016040528060278152602001611fc360279139611751565b9392505050565b6000610f91826014611f47565b83511015610fd95760405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b60448201526064016102f6565b500160200151600160601b900490565b6000606081805b845181101561103a5784818151811061100b5761100b611e87565b60200260200101516020015161ffff16826110269190611f47565b91508061103281611ef9565b915050610ff0565b506103e881111561108d5760405162461bcd60e51b815260206004820152601d60248201527f5365727669636520666565203e204d41585f534552564943455f46454500000060448201526064016102f6565b60008085516001600160401b038111156110a9576110a961189c565b6040519080825280602002602001820160405280156110ee57816020015b60408051808201909152600080825260208201528152602001906001900390816110c75790505b50905060005b86518110156111b757600061271061ffff1688838151811061111857611118611e87565b60200260200101516020015161ffff168a6111339190611f5a565b61113d9190611f71565b9050604051806040016040528089848151811061115c5761115c611e87565b6020026020010151600001516001600160a01b031681526020018281525083838151811061118c5761118c611e87565b60209081029190910101526111a18185611f47565b93505080806111af90611ef9565b9150506110f4565b509093509150505b9250929050565b60005b815181101561133c57826001600160a01b03166323b872dd338484815181106111f4576111f4611e87565b60200260200101516000015185858151811061121257611212611e87565b60209081029190910181015101516040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af1158015611274573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112989190611f25565b508181815181106112ab576112ab611e87565b6020026020010151600001516001600160a01b0316336001600160a01b0316846001600160a01b03167f1f9a9fdac86b6ca3c5300bec0b61555cded1f1a234378602dcca6c27085eac8e85858151811061130757611307611e87565b60200260200101516020015160405161132291815260200190565b60405180910390a48061133481611ef9565b9150506111c9565b505050565b600154604051636eb1769f60e11b81523060048201526001600160a01b039182166024820152829184169063dd62ed3e90604401602060405180830381865afa158015611392573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b69190611e0f565b10156114345760015460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529083169063095ea7b3906044016020604051808303816000875af1158015611410573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061133c9190611f25565b5050565b60608161144681601f611f47565b10156114855760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b60448201526064016102f6565b61148f8284611f47565b845110156114d35760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b60448201526064016102f6565b6060821580156114f2576040519150600082526020820160405261153c565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561152b578051835260209283019201611513565b5050858452601f01601f1916604052505b50949350505050565b60005b815181101561133c57826001600160a01b031663a9059cbb83838151811061157257611572611e87565b60200260200101516000015184848151811061159057611590611e87565b6020026020010151602001516040518363ffffffff1660e01b81526004016115cd9291906001600160a01b03929092168252602082015260400190565b6020604051808303816000875af11580156115ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116109190611f25565b5081818151811061162357611623611e87565b6020026020010151600001516001600160a01b0316336001600160a01b0316846001600160a01b03167f1f9a9fdac86b6ca3c5300bec0b61555cded1f1a234378602dcca6c27085eac8e85858151811061167f5761167f611e87565b60200260200101516020015160405161169a91815260200190565b60405180910390a4806116ac81611ef9565b915050611548565b600054600160a01b900460ff1661058a5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016102f6565b600054600160a01b900460ff161561058a5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016102f6565b6060600080856001600160a01b03168560405161176e9190611f93565b600060405180830381855af49150503d80600081146117a9576040519150601f19603f3d011682016040523d82523d6000602084013e6117ae565b606091505b50915091506107278683838760608315611829578251600003611822576001600160a01b0385163b6118225760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016102f6565b50816105da565b6105da838381511561183e5781518083602001fd5b8060405162461bcd60e51b81526004016102f69190611faf565b60008083601f84011261186a57600080fd5b5081356001600160401b0381111561188157600080fd5b6020830191508360208260061b85010111156111bf57600080fd5b634e487b7160e01b600052604160045260246000fd5b604051608081016001600160401b03811182821017156118d4576118d461189c565b60405290565b60405160e081016001600160401b03811182821017156118d4576118d461189c565b604051601f8201601f191681016001600160401b03811182821017156119245761192461189c565b604052919050565b6001600160a01b03811681146109d457600080fd5b803561194c8161192c565b919050565b60006080828403121561196357600080fd5b61196b6118b2565b905081356001600160401b038082111561198457600080fd5b818401915084601f83011261199857600080fd5b81356020828211156119ac576119ac61189c565b6119be601f8301601f191682016118fc565b925081835286818386010111156119d457600080fd5b818185018285013760008183850101528285526119f2818701611941565b8186015250505050604082013560408201526060820135606082015292915050565b600080600060408486031215611a2957600080fd5b83356001600160401b0380821115611a4057600080fd5b611a4c87838801611858565b90955093506020860135915080821115611a6557600080fd5b50611a7286828701611951565b9150509250925092565b60008083601f840112611a8e57600080fd5b5081356001600160401b03811115611aa557600080fd5b6020830191508360208260051b85010111156111bf57600080fd5b600080600060408486031215611ad557600080fd5b8335925060208401356001600160401b03811115611af257600080fd5b611afe86828701611a7c565b9497909650939450505050565b60005b83811015611b26578181015183820152602001611b0e565b50506000910152565b60008151808452611b47816020860160208601611b0b565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015611bb057603f19888603018452611b9e858351611b2f565b94509285019290850190600101611b82565b5092979650505050505050565b600060e08284031215611bcf57600080fd5b611bd76118da565b90508135611be48161192c565b81526020820135611bf48161192c565b6020820152604082013562ffffff81168114611c0f57600080fd5b6040820152611c2060608301611941565b60608201526080820135608082015260a082013560a0820152611c4560c08301611941565b60c082015292915050565b60008060006101008486031215611c6657600080fd5b83356001600160401b03811115611c7c57600080fd5b611c8886828701611858565b9094509250611c9c90508560208601611bbd565b90509250925092565b60008060208385031215611cb857600080fd5b82356001600160401b03811115611cce57600080fd5b611cda85828601611a7c565b90969095509350505050565b600060208284031215611cf857600080fd5b8135610f7d8161192c565b6020808252602d908201527f726563697069656e74206d757374206265206d73672e73656e646572206f722060408201526c1d1a1a5cc818dbdb9d1c9858dd609a1b606082015260800190565b600060408284031215611d6257600080fd5b604051604081018181106001600160401b0382111715611d8457611d8461189c565b6040528235611d928161192c565b8152602083013561ffff81168114611da957600080fd5b60208201529392505050565b6000815160808452611dca6080850182611b2f565b6020848101516001600160a01b0316908601526040808501519086015260609384015193909401929092525090919050565b602081526000610f7d6020830184611db5565b600060208284031215611e2157600080fd5b5051919050565b60e08101610830828480516001600160a01b03908116835260208083015182169084015260408083015162ffffff16908401526060808301518216908401526080808301519084015260a0828101519084015260c09182015116910152565b634e487b7160e01b600052603260045260246000fd5b6000808335601e19843603018112611eb457600080fd5b8301803591506001600160401b03821115611ece57600080fd5b6020019150368190038213156111bf57600080fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611f0b57611f0b611ee3565b5060010190565b8181038181111561083057610830611ee3565b600060208284031215611f3757600080fd5b81518015158114610f7d57600080fd5b8082018082111561083057610830611ee3565b808202811582820484141761083057610830611ee3565b600082611f8e57634e487b7160e01b600052601260045260246000fd5b500490565b60008251611fa5818460208701611b0b565b9190910192915050565b602081526000610f7d6020830184611b2f56fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212203925f97cd63c2e61736a2a442ff1d4bf966f453350e9df354a849229f69092cf64736f6c63430008130033";
13782
+ const _bytecode$1 = "0x60806040523480156200001157600080fd5b506040516200278438038062002784833981016040819052620000349162000136565b6001805460ff191690556200004b60008362000078565b600180546001600160a01b0390921661010002610100600160a81b0319909216919091179055506200016e565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1662000115576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620000d43390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b80516001600160a01b03811681146200013157600080fd5b919050565b600080604083850312156200014a57600080fd5b620001558362000119565b9150620001656020840162000119565b90509250929050565b612606806200017e6000396000f3fe60806040526004361061013f5760003560e01c80635ae401dc116100b657806393751f631161006f57806393751f631461038c578063a217fddf146103b5578063ac9650d8146103ca578063d547741f146103ea578063d9a6f7051461040a578063e65fad971461042057600080fd5b80635ae401dc146102ae5780635c975abb146102ce578063735de9f7146102e65780638456cb59146103235780638f3914661461033857806391d148541461036c57600080fd5b80632f2ff15d116101085780632f2ff15d1461022057806336568abe14610240578063383ebb0b146102605780633f4ba83a146102735780635640f6591461028857806358e81a501461029b57600080fd5b80620fa9fb1461014457806301ffc9a714610166578063116944b21461019b57806316ba7197146101bc578063248a9ca3146101f0575b600080fd5b34801561015057600080fd5b5061016461015f366004611db4565b610454565b005b34801561017257600080fd5b50610186610181366004611ded565b61050d565b60405190151581526020015b60405180910390f35b6101ae6101a9366004611f85565b610544565b604051908152602001610192565b3480156101c857600080fd5b506101ae7f7a8dc26796a1e50e6e190b70259f58f6a4edd5b22280ceecc82b687b8e98286981565b3480156101fc57600080fd5b506101ae61020b366004611fda565b60009081526020819052604090206001015490565b34801561022c57600080fd5b5061016461023b366004611ff3565b610634565b34801561024c57600080fd5b5061016461025b366004611ff3565b610659565b6101ae61026e3660046120db565b6106dc565b34801561027f57600080fd5b5061016461084c565b6101ae6102963660046120db565b610889565b6101ae6102a9366004611f85565b61097f565b6102c16102bc366004612187565b610ad0565b6040516101929190612222565b3480156102da57600080fd5b5060015460ff16610186565b3480156102f257600080fd5b5060015461030b9061010090046001600160a01b031681565b6040516001600160a01b039091168152602001610192565b34801561032f57600080fd5b50610164610b1e565b34801561034457600080fd5b506101ae7fe7276a2a84d8de556657ec9cf93a55a7d66f096e529d0582ed08e9e2208b92b581565b34801561037857600080fd5b50610186610387366004611ff3565b610b59565b34801561039857600080fd5b506103a26103e881565b60405161ffff9091168152602001610192565b3480156103c157600080fd5b506101ae600081565b3480156103d657600080fd5b506102c16103e5366004612284565b610b82565b3480156103f657600080fd5b50610164610405366004611ff3565b610c76565b34801561041657600080fd5b506101ae61271081565b34801561042c57600080fd5b506101ae7ffcb9fcbfa83b897fb2d5cf4b58962164105c1e71489a37ef3ae0db3fdce576f681565b61047e7f7a8dc26796a1e50e6e190b70259f58f6a4edd5b22280ceecc82b687b8e98286933610b59565b61048757600080fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156104ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f291906122c5565b90506105086001600160a01b0383168483610c9b565b505050565b60006001600160e01b03198216637965db0b60e01b148061053e57506301ffc9a760e01b6001600160e01b03198316145b92915050565b60006105b08260000151836080015184606001518787808060200260200160405190810160405280939291908181526020016000905b828210156105a657610597604083028601368190038101906122de565b8152602001906001019061057a565b5050505050610cfe565b60808301526001546040516304e45aaf60e01b81526101009091046001600160a01b0316906304e45aaf906105e9908590600401612335565b6020604051808303816000875af1158015610608573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061062c91906122c5565b949350505050565b60008281526020819052604090206001015461064f81610dbf565b6105088383610dcc565b6001600160a01b03811633146106ce5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6106d88282610e50565b5050565b6000806106ec8360000151610eb5565b905060008061075783866060015187602001518a8a808060200260200160405190810160405280939291908181526020016000905b8282101561074d5761073e604083028601368190038101906122de565b81526020019060010190610721565b5050505050610ee3565b606087018190526001546040516304dc09a360e11b81529294509092506000916101009091046001600160a01b0316906309b813469061079b9089906004016123db565b6020604051808303816000875af11580156107ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107de91906122c5565b905061083e8482858b8b808060200260200160405190810160405280939291908181526020016000905b8282101561083457610825604083028601368190038101906122de565b81526020019060010190610808565b5050505050610f96565b9450505050505b9392505050565b6108767fe7276a2a84d8de556657ec9cf93a55a7d66f096e529d0582ed08e9e2208b92b533610b59565b61087f57600080fd5b610887610ff7565b565b6000806108998360000151611049565b90506108f781846040015185602001518888808060200260200160405190810160405280939291908181526020016000905b828210156105a6576108e8604083028601368190038101906122de565b815260200190600101906108cb565b604084810191909152600154905163b858183f60e01b81526101009091046001600160a01b03169063b858183f906109339086906004016123db565b6020604051808303816000875af1158015610952573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097691906122c5565b95945050505050565b60008060006109e484600001518560a0015186606001518989808060200260200160405190810160405280939291908181526020016000905b8282101561074d576109d5604083028601368190038101906122de565b815260200190600101906109b8565b60a08601819052600154604051635023b4df60e01b81529294509092506000916101009091046001600160a01b031690635023b4df90610a28908890600401612335565b6020604051808303816000875af1158015610a47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6b91906122c5565b9050610ac5856000015182858a8a808060200260200160405190810160405280939291908181526020016000905b8282101561083457610ab6604083028601368190038101906122de565b81526020019060010190610a99565b979650505050505050565b606083421115610b145760405162461bcd60e51b815260206004820152600f60248201526e111958591b1a5b99481c185cdcd959608a1b60448201526064016106c5565b61062c8383610b82565b610b487ffcb9fcbfa83b897fb2d5cf4b58962164105c1e71489a37ef3ae0db3fdce576f633610b59565b610b5157600080fd5b610887611055565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6060816001600160401b03811115610b9c57610b9c611e62565b604051908082528060200260200182016040528015610bcf57816020015b6060815260200190600190039081610bba5790505b50905060005b82811015610c6f57610c3f30858584818110610bf357610bf36123ee565b9050602002810190610c059190612404565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061109092505050565b828281518110610c5157610c516123ee565b60200260200101819052508080610c6790612460565b915050610bd5565b5092915050565b600082815260208190526040902060010154610c9181610dbf565b6105088383610e50565b6040516001600160a01b03831660248201526044810182905261050890849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526110b5565b60006001600160a01b0383163314610d585760405162461bcd60e51b815260206004820181905260248201527f73776170526563697069656e74206d757374206265206d73672e73656e64657260448201526064016106c5565b60015460ff16610d9757610d6b8261118a565b50600080610d79868561123d565b9092509050610d888287612479565b9550610d948782611366565b50505b610dac6001600160a01b03861633308761146f565b610db685856114ad565b50919392505050565b610dc981336115aa565b50565b610dd68282610b59565b6106d8576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610e0c3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610e5a8282610b59565b156106d8576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60008060148351610ec69190612479565b90506000610ed684836014611603565b905061062c816000611710565b6000806001600160a01b0384163314610f3e5760405162461bcd60e51b815260206004820181905260248201527f73776170526563697069656e74206d757374206265206d73672e73656e64657260448201526064016106c5565b6000610f498461118a565b90506000610f598261271061248c565b9050610f688761271083611775565b9250610f7488846114ad565b610f896001600160a01b03891633308a61146f565b5094969095509350505050565b6000806000610fa5868561123d565b91509150610fb560015460ff1690565b610fc357610fc387826117b5565b610fed3383610fd28989612479565b610fdc9190612479565b6001600160a01b038a169190610c9b565b610ac5828761248c565b610fff6118bc565b6001805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600061053e8282611710565b61105d611905565b6001805460ff1916811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2583361102c565b606061084583836040518060600160405280602781526020016125aa6027913961194b565b600061110a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166119c39092919063ffffffff16565b905080516000148061112b57508080602001905181019061112b919061249f565b6105085760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016106c5565b6000805b82518110156111d4578281815181106111a9576111a96123ee565b602002602001015160200151826111c0919061248c565b9150806111cc81612460565b91505061118e565b506103e88111156112385760405162461bcd60e51b815260206004820152602860248201527f5365636f6e6461727920666565203e204645455f42415349535f504f494e54536044820152675f4d4158494d554d60c01b60648201526084016106c5565b919050565b6000606082516001600160401b0381111561125a5761125a611e62565b60405190808252806020026020018201604052801561129f57816020015b60408051808201909152600080825260208201528152602001906001900390816112785790505b50905060005b835181101561135e5760006112e48583815181106112c5576112c56123ee565b602002602001015160200151612710886119d29092919063ffffffff16565b90506040518060400160405280868481518110611303576113036123ee565b6020026020010151600001516001600160a01b0316815260200182815250838381518110611333576113336123ee565b6020908102919091010152611348818561248c565b935050808061135690612460565b9150506112a5565b509250929050565b60005b8151811015610508576113cc33838381518110611388576113886123ee565b6020026020010151600001518484815181106113a6576113a66123ee565b602002602001015160200151866001600160a01b031661146f909392919063ffffffff16565b8181815181106113de576113de6123ee565b6020026020010151600001516001600160a01b0316336001600160a01b0316846001600160a01b03167f1f9a9fdac86b6ca3c5300bec0b61555cded1f1a234378602dcca6c27085eac8e85858151811061143a5761143a6123ee565b60200260200101516020015160405161145591815260200190565b60405180910390a48061146781612460565b915050611369565b6040516001600160a01b03808516602483015283166044820152606481018290526114a79085906323b872dd60e01b90608401610cc7565b50505050565b600154604051636eb1769f60e11b81523060048201526001600160a01b0361010090920482166024820152829184169063dd62ed3e90604401602060405180830381865afa158015611503573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061152791906122c5565b10156106d85760015460405163095ea7b360e01b81526101009091046001600160a01b039081166004830152600019602483015283169063095ea7b3906044016020604051808303816000875af1158015611586573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610508919061249f565b6115b48282610b59565b6106d8576115c181611a74565b6115cc836020611a86565b6040516020016115dd9291906124c1565b60408051601f198184030181529082905262461bcd60e51b82526106c591600401612536565b60608161161181601f61248c565b10156116505760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b60448201526064016106c5565b61165a828461248c565b8451101561169e5760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b60448201526064016106c5565b6060821580156116bd5760405191506000825260208201604052611707565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156116f65780518352602092830192016116de565b5050858452601f01601f1916604052505b50949350505050565b600061171d82601461248c565b835110156117655760405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b60448201526064016106c5565b500160200151600160601b900490565b60006117828484846119d2565b90506000828061179457611794612549565b84860911156108455760001981106117ab57600080fd5b6001019392505050565b60005b8151811015610508576118198282815181106117d6576117d66123ee565b6020026020010151600001518383815181106117f4576117f46123ee565b602002602001015160200151856001600160a01b0316610c9b9092919063ffffffff16565b81818151811061182b5761182b6123ee565b6020026020010151600001516001600160a01b0316336001600160a01b0316846001600160a01b03167f1f9a9fdac86b6ca3c5300bec0b61555cded1f1a234378602dcca6c27085eac8e858581518110611887576118876123ee565b6020026020010151602001516040516118a291815260200190565b60405180910390a4806118b481612460565b9150506117b8565b60015460ff166108875760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016106c5565b60015460ff16156108875760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016106c5565b6060600080856001600160a01b031685604051611968919061255f565b600060405180830381855af49150503d80600081146119a3576040519150601f19603f3d011682016040523d82523d6000602084013e6119a8565b606091505b50915091506119b986838387611c21565b9695505050505050565b606061062c8484600085611c9a565b600083830281600019858709828110838203039150508084116119f457600080fd5b80600003611a0757508290049050610845565b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b606061053e6001600160a01b03831660145b60606000611a9583600261257b565b611aa090600261248c565b6001600160401b03811115611ab757611ab7611e62565b6040519080825280601f01601f191660200182016040528015611ae1576020820181803683370190505b509050600360fc1b81600081518110611afc57611afc6123ee565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110611b2b57611b2b6123ee565b60200101906001600160f81b031916908160001a9053506000611b4f84600261257b565b611b5a90600161248c565b90505b6001811115611bd2576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611b8e57611b8e6123ee565b1a60f81b828281518110611ba457611ba46123ee565b60200101906001600160f81b031916908160001a90535060049490941c93611bcb81612592565b9050611b5d565b5083156108455760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016106c5565b60608315611c90578251600003611c89576001600160a01b0385163b611c895760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106c5565b508161062c565b61062c8383611d6a565b606082471015611cfb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016106c5565b600080866001600160a01b03168587604051611d17919061255f565b60006040518083038185875af1925050503d8060008114611d54576040519150601f19603f3d011682016040523d82523d6000602084013e611d59565b606091505b5091509150610ac587838387611c21565b815115611d7a5781518083602001fd5b8060405162461bcd60e51b81526004016106c59190612536565b6001600160a01b0381168114610dc957600080fd5b803561123881611d94565b60008060408385031215611dc757600080fd5b8235611dd281611d94565b91506020830135611de281611d94565b809150509250929050565b600060208284031215611dff57600080fd5b81356001600160e01b03198116811461084557600080fd5b60008083601f840112611e2957600080fd5b5081356001600160401b03811115611e4057600080fd5b6020830191508360208260061b8501011115611e5b57600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b60405160e081016001600160401b0381118282101715611e9a57611e9a611e62565b60405290565b604051608081016001600160401b0381118282101715611e9a57611e9a611e62565b604051601f8201601f191681016001600160401b0381118282101715611eea57611eea611e62565b604052919050565b600060e08284031215611f0457600080fd5b611f0c611e78565b90508135611f1981611d94565b81526020820135611f2981611d94565b6020820152604082013562ffffff81168114611f4457600080fd5b6040820152611f5560608301611da9565b60608201526080820135608082015260a082013560a0820152611f7a60c08301611da9565b60c082015292915050565b60008060006101008486031215611f9b57600080fd5b83356001600160401b03811115611fb157600080fd5b611fbd86828701611e17565b9094509250611fd190508560208601611ef2565b90509250925092565b600060208284031215611fec57600080fd5b5035919050565b6000806040838503121561200657600080fd5b823591506020830135611de281611d94565b60006080828403121561202a57600080fd5b612032611ea0565b905081356001600160401b038082111561204b57600080fd5b818401915084601f83011261205f57600080fd5b813560208282111561207357612073611e62565b612085601f8301601f19168201611ec2565b9250818352868183860101111561209b57600080fd5b818185018285013760008183850101528285526120b9818701611da9565b8186015250505050604082013560408201526060820135606082015292915050565b6000806000604084860312156120f057600080fd5b83356001600160401b038082111561210757600080fd5b61211387838801611e17565b9095509350602086013591508082111561212c57600080fd5b5061213986828701612018565b9150509250925092565b60008083601f84011261215557600080fd5b5081356001600160401b0381111561216c57600080fd5b6020830191508360208260051b8501011115611e5b57600080fd5b60008060006040848603121561219c57600080fd5b8335925060208401356001600160401b038111156121b957600080fd5b6121c586828701612143565b9497909650939450505050565b60005b838110156121ed5781810151838201526020016121d5565b50506000910152565b6000815180845261220e8160208601602086016121d2565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561227757603f198886030184526122658583516121f6565b94509285019290850190600101612249565b5092979650505050505050565b6000806020838503121561229757600080fd5b82356001600160401b038111156122ad57600080fd5b6122b985828601612143565b90969095509350505050565b6000602082840312156122d757600080fd5b5051919050565b6000604082840312156122f057600080fd5b604051604081018181106001600160401b038211171561231257612312611e62565b604052823561232081611d94565b81526020928301359281019290925250919050565b60e0810161053e828480516001600160a01b03908116835260208083015182169084015260408083015162ffffff16908401526060808301518216908401526080808301519084015260a0828101519084015260c09182015116910152565b60008151608084526123a960808501826121f6565b6020848101516001600160a01b0316908601526040808501519086015260609384015193909401929092525090919050565b6020815260006108456020830184612394565b634e487b7160e01b600052603260045260246000fd5b6000808335601e1984360301811261241b57600080fd5b8301803591506001600160401b0382111561243557600080fd5b602001915036819003821315611e5b57600080fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016124725761247261244a565b5060010190565b8181038181111561053e5761053e61244a565b8082018082111561053e5761053e61244a565b6000602082840312156124b157600080fd5b8151801515811461084557600080fd5b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516124f98160178501602088016121d2565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161252a8160288401602088016121d2565b01602801949350505050565b60208152600061084560208301846121f6565b634e487b7160e01b600052601260045260246000fd5b600082516125718184602087016121d2565b9190910192915050565b808202811582820484141761053e5761053e61244a565b6000816125a1576125a161244a565b50600019019056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220c75a7db1b170ff1ce6888f2940825a25db3ebb624d8b84bd3f2372ebae2de1d464736f6c63430008130033";
13639
13783
  const isSuperArgs$1 = (xs) => xs.length > 1;
13640
13784
  class SecondaryFee__factory extends ContractFactory {
13641
13785
  constructor(...args) {
@@ -13646,11 +13790,11 @@ class SecondaryFee__factory extends ContractFactory {
13646
13790
  super(_abi$1, _bytecode$1, args[0]);
13647
13791
  }
13648
13792
  }
13649
- deploy(_uniRouter, overrides) {
13650
- return super.deploy(_uniRouter, overrides || {});
13793
+ deploy(_admin, _uniRouter, overrides) {
13794
+ return super.deploy(_admin, _uniRouter, overrides || {});
13651
13795
  }
13652
- getDeployTransaction(_uniRouter, overrides) {
13653
- return super.getDeployTransaction(_uniRouter, overrides || {});
13796
+ getDeployTransaction(_admin, _uniRouter, overrides) {
13797
+ return super.getDeployTransaction(_admin, _uniRouter, overrides || {});
13654
13798
  }
13655
13799
  attach(address) {
13656
13800
  return super.attach(address);
@@ -14707,7 +14851,7 @@ async function multicallSingleCallDataMultipleContracts(multicallContract, funct
14707
14851
  calls.push({
14708
14852
  target: address,
14709
14853
  callData,
14710
- gasLimit: BigNumber$2.from('1000000'),
14854
+ gasLimit: BigNumber$1.from('1000000'),
14711
14855
  });
14712
14856
  }
14713
14857
  });
@@ -14736,10 +14880,87 @@ const getCallData = (methodName, contractInterface) => {
14736
14880
  return fragment ? contractInterface?.encodeFunctionData(fragment) : undefined;
14737
14881
  };
14738
14882
 
14883
+ const quoteReturnMapping = {
14884
+ // eslint-disable-next-line @typescript-eslint/naming-convention
14885
+ '0xcdca1753': ['uint256', 'uint160[]', 'uint32[]', 'uint256'],
14886
+ // eslint-disable-next-line @typescript-eslint/naming-convention
14887
+ '0xc6a5026a': ['uint256', 'uint160', 'uint32', 'uint256'],
14888
+ // eslint-disable-next-line @typescript-eslint/naming-convention
14889
+ '0x2f80bb1d': ['uint256', 'uint160[]', 'uint32[]', 'uint256'],
14890
+ // eslint-disable-next-line @typescript-eslint/naming-convention
14891
+ '0xbd21704a': ['uint256', 'uint160', 'uint32', 'uint256'],
14892
+ };
14893
+ /**
14894
+ * Returns true if poolA is equivalent to poolB
14895
+ * @param poolA one of the two pools
14896
+ * @param poolB the other pool
14897
+ */
14898
+ function poolEquals(poolA, poolB) {
14899
+ return (poolA === poolB
14900
+ || (poolA.token0.equals(poolB.token0)
14901
+ && poolA.token1.equals(poolB.token1)
14902
+ && poolA.fee === poolB.fee));
14903
+ }
14904
+ async function getERC20Decimals(tokenAddress, provider) {
14905
+ const decimalsFunctionSig = ethers.utils.id('decimals()').substring(0, 10);
14906
+ try {
14907
+ const decimalsResult = await provider.call({
14908
+ to: tokenAddress,
14909
+ data: decimalsFunctionSig,
14910
+ });
14911
+ return parseInt(decimalsResult, 16);
14912
+ }
14913
+ catch (e) {
14914
+ const message = e instanceof Error ? e.message : 'Unknown Error';
14915
+ throw new ProviderCallError(`failed to get ERC20 decimals: ${message}`);
14916
+ }
14917
+ }
14918
+ /**
14919
+ * Based on https://github.com/ethers-io/ethers.js/blob/main/src.ts/address/checks.ts#L51
14920
+ */
14921
+ function isValidNonZeroAddress(address) {
14922
+ if (address === ethers.constants.AddressZero) {
14923
+ return false;
14924
+ }
14925
+ try {
14926
+ ethers.utils.getAddress(address);
14927
+ return true;
14928
+ }
14929
+ catch (error) {
14930
+ return false;
14931
+ }
14932
+ }
14933
+ const tokenInfoToUniswapToken = (tokenInfo) => new Token(tokenInfo.chainId, tokenInfo.address, tokenInfo.decimals, tokenInfo.symbol, tokenInfo.name);
14934
+ const uniswapTokenToTokenInfo = (token) => ({
14935
+ chainId: token.chainId,
14936
+ address: token.address,
14937
+ decimals: token.decimals,
14938
+ symbol: token.symbol,
14939
+ name: token.name,
14940
+ });
14941
+ const toCurrencyAmount = (amount) => {
14942
+ const token = tokenInfoToUniswapToken(amount.token);
14943
+ return CurrencyAmount.fromRawAmount(token, amount.value.toString());
14944
+ };
14945
+ const newAmount = (amount, token) => ({
14946
+ value: amount,
14947
+ token,
14948
+ });
14949
+ const addAmount = (a, b) => {
14950
+ if (a.token.address !== b.token.address)
14951
+ throw new Error('Token mismatch');
14952
+ return { value: a.value.add(b.value), token: a.token };
14953
+ };
14954
+ const subtractAmount = (a, b) => {
14955
+ if (a.token.address !== b.token.address)
14956
+ throw new Error('Token mismatch');
14957
+ return { value: a.value.sub(b.value), token: a.token };
14958
+ };
14959
+
14739
14960
  const amountIndex = 0;
14740
14961
  const gasEstimateIndex = 3;
14741
14962
  async function getQuotesForRoutes(multicallContract, quoterContractAddress, routes, amountSpecified, tradeType) {
14742
- const callData = routes.map((route) => SwapQuoter.quoteCallParameters(route, amountSpecified, tradeType, {
14963
+ const callData = routes.map((route) => SwapQuoter.quoteCallParameters(route, toCurrencyAmount(amountSpecified), tradeType, {
14743
14964
  useQuoterV2: true,
14744
14965
  }).calldata);
14745
14966
  let quoteResults;
@@ -14765,27 +14986,26 @@ async function getQuotesForRoutes(multicallContract, quoterContractAddress, rout
14765
14986
  // eslint-disable-next-line no-continue
14766
14987
  continue;
14767
14988
  }
14768
- let decodedQuoteResult;
14769
14989
  try {
14770
- decodedQuoteResult = ethers.utils.defaultAbiCoder.decode(returnTypes, quoteResults.returnData[i].returnData);
14990
+ const decodedQuoteResult = ethers.utils.defaultAbiCoder.decode(returnTypes, quoteResults.returnData[i].returnData);
14991
+ if (decodedQuoteResult) {
14992
+ // The 0th element in each decoded data is going to be the amountOut or amountIn.
14993
+ const quoteAmount = decodedQuoteResult[amountIndex];
14994
+ if (!(quoteAmount instanceof BigNumber$1))
14995
+ throw new Error('Expected BigNumber');
14996
+ decodedQuoteResults.push({
14997
+ route: routes[i],
14998
+ amountIn: tradeType === TradeType.EXACT_INPUT ? amountSpecified : newAmount(quoteAmount, routes[i].input),
14999
+ amountOut: tradeType === TradeType.EXACT_INPUT ? newAmount(quoteAmount, routes[i].output) : amountSpecified,
15000
+ gasEstimate: ethers.BigNumber.from(decodedQuoteResult[gasEstimateIndex]),
15001
+ });
15002
+ }
14771
15003
  }
14772
15004
  catch {
14773
15005
  // Failed to get the quote for this particular route
14774
15006
  // Other quotes for routes may still succeed, so do nothing
14775
15007
  // and continue processing
14776
15008
  }
14777
- // TODO: ideally this is already a big number as we don't need a CurrencyAmount at this level
14778
- const amountSpecifiedBigNumber = toBigNumber(amountSpecified);
14779
- if (decodedQuoteResult) {
14780
- // The 0th element in each decoded data is going to be the amountOut or amountIn.
14781
- const quoteAmount = decodedQuoteResult[amountIndex];
14782
- decodedQuoteResults.push({
14783
- route: routes[i],
14784
- amountIn: tradeType === TradeType.EXACT_INPUT ? amountSpecifiedBigNumber : quoteAmount,
14785
- amountOut: tradeType === TradeType.EXACT_INPUT ? quoteAmount : amountSpecifiedBigNumber,
14786
- gasEstimate: ethers.BigNumber.from(decodedQuoteResult[gasEstimateIndex]),
14787
- });
14788
- }
14789
15009
  }
14790
15010
  return decodedQuoteResults;
14791
15011
  }
@@ -14921,10 +15141,10 @@ class Router {
14921
15141
  this.routingTokens = routingTokens;
14922
15142
  this.routingContracts = routingContracts;
14923
15143
  }
14924
- async findOptimalRoute(amountSpecified, otherCurrency, tradeType, maxHops = 2) {
14925
- const [currencyIn, currencyOut] = this.determineERC20InAndERC20Out(tradeType, amountSpecified, otherCurrency);
15144
+ async findOptimalRoute(amountSpecified, otherToken, tradeType, maxHops = 2) {
15145
+ const [tokenIn, tokenOut] = this.determineERC20InAndERC20Out(tradeType, amountSpecified, otherToken);
14926
15146
  const multicallContract = Multicall__factory.connect(this.routingContracts.multicallAddress, this.provider);
14927
- const erc20Pair = [currencyIn.wrapped, currencyOut.wrapped];
15147
+ const erc20Pair = [tokenIn, tokenOut];
14928
15148
  // Get all pools and use these to get all possible routes.
14929
15149
  const pools = await fetchValidPools(multicallContract, erc20Pair, this.routingTokens, this.routingContracts.factoryAddress);
14930
15150
  const noValidPools = pools.length === 0;
@@ -14934,7 +15154,7 @@ class Router {
14934
15154
  // Get all the possible routes from the given pools
14935
15155
  // TODO: Fix used before defined error
14936
15156
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
14937
- const routes = generateAllAcyclicPaths(currencyIn, currencyOut, pools, maxHops, [], [], currencyIn);
15157
+ const routes = generateAllAcyclicPaths(tokenIn, tokenOut, pools, maxHops, [], [], tokenIn);
14938
15158
  const noValidRoute = routes.length === 0;
14939
15159
  if (noValidRoute) {
14940
15160
  throw new NoRoutesAvailableError();
@@ -14944,9 +15164,7 @@ class Router {
14944
15164
  return {
14945
15165
  route,
14946
15166
  amountIn,
14947
- tokenIn: currencyIn,
14948
15167
  amountOut,
14949
- tokenOut: currencyOut,
14950
15168
  tradeType,
14951
15169
  gasEstimate,
14952
15170
  };
@@ -14982,7 +15200,7 @@ class Router {
14982
15200
  bestQuoteForAmountIn(quotes) {
14983
15201
  let bestQuote = quotes[0];
14984
15202
  for (let i = 1; i < quotes.length; i++) {
14985
- if (quotes[i].amountOut.gt(bestQuote.amountOut)) {
15203
+ if (quotes[i].amountOut.value.gt(bestQuote.amountOut.value)) {
14986
15204
  bestQuote = quotes[i];
14987
15205
  }
14988
15206
  }
@@ -14992,48 +15210,49 @@ class Router {
14992
15210
  bestQuoteForAmountOut(quotes) {
14993
15211
  let bestQuote = quotes[0];
14994
15212
  for (let i = 1; i < quotes.length; i++) {
14995
- if (quotes[i].amountIn.lt(bestQuote.amountIn)) {
15213
+ if (quotes[i].amountIn.value.lt(bestQuote.amountIn.value)) {
14996
15214
  bestQuote = quotes[i];
14997
15215
  }
14998
15216
  }
14999
15217
  return bestQuote;
15000
15218
  }
15001
15219
  // eslint-disable-next-line class-methods-use-this
15002
- determineERC20InAndERC20Out(tradeType, amountSpecified, otherCurrency) {
15220
+ determineERC20InAndERC20Out(tradeType, amountSpecified, otherToken) {
15003
15221
  // If the trade type is EXACT INPUT then we have specified the amount for the tokenIn
15004
15222
  return tradeType === TradeType.EXACT_INPUT
15005
- ? [amountSpecified?.currency, otherCurrency]
15006
- : [otherCurrency, amountSpecified?.currency];
15223
+ ? [amountSpecified.token, otherToken]
15224
+ : [otherToken, amountSpecified.token];
15007
15225
  }
15008
15226
  }
15009
- const generateAllAcyclicPaths = (currencyIn, // the currency we start with
15010
- currencyOut, // the currency we want to end up with
15227
+ const generateAllAcyclicPaths = (tokenIn, // the currency we start with
15228
+ tokenOut, // the currency we want to end up with
15011
15229
  pools, // list of all available pools
15012
15230
  maxHops, // the maximum number of pools that can be traversed
15013
15231
  currentRoute = [], // list of pools already traversed
15014
15232
  routes = [], // list of all routes found so far
15015
- startCurrencyIn = currencyIn) => {
15016
- const tokenIn = currencyIn.wrapped;
15017
- const tokenOut = currencyOut.wrapped;
15233
+ startTokenIn = tokenIn) => {
15234
+ const currencyIn = new Token(tokenIn.chainId, tokenIn.address, tokenIn.decimals);
15235
+ const currencyOut = new Token(tokenOut.chainId, tokenOut.address, tokenOut.decimals);
15236
+ const startCurrencyIn = new Token(startTokenIn.chainId, startTokenIn.address, startTokenIn.decimals);
15018
15237
  for (const pool of pools) {
15019
15238
  // if the pool doesn't have the tokenIn or if it has already been traversed,
15020
15239
  // skip to the next pool
15021
- const poolHasTokenIn = pool.involvesToken(tokenIn);
15240
+ const poolHasTokenIn = pool.involvesToken(currencyIn);
15022
15241
  const poolHasCycle = currentRoute.find((pathPool) => poolEquals(pool, pathPool));
15023
15242
  // eslint-disable-next-line no-continue
15024
15243
  if (!poolHasTokenIn || poolHasCycle)
15025
15244
  continue;
15026
15245
  // get the output token of the pool
15027
- const outputToken = pool.token0.equals(tokenIn) ? pool.token1 : pool.token0;
15246
+ const outputToken = pool.token0.equals(currencyIn) ? pool.token1 : pool.token0;
15028
15247
  // if we have found a route to the target currency, add it to the list of routes
15029
- const routeFound = outputToken.equals(tokenOut);
15248
+ const routeFound = outputToken.equals(currencyOut);
15030
15249
  if (routeFound) {
15031
15250
  routes.push(new Route([...currentRoute, pool], startCurrencyIn, currencyOut));
15032
15251
  }
15033
15252
  else if (maxHops > 1) {
15034
15253
  // otherwise, if we haven't exceeded the maximum number of pools that can be traversed,
15035
15254
  // recursively call this function with the output token as the new starting currency
15036
- generateAllAcyclicPaths(outputToken, currencyOut, pools, maxHops - 1, [...currentRoute, pool], routes, startCurrencyIn);
15255
+ generateAllAcyclicPaths(outputToken, tokenOut, pools, maxHops - 1, [...currentRoute, pool], routes, startTokenIn);
15037
15256
  }
15038
15257
  }
15039
15258
  return routes;
@@ -15041,39 +15260,38 @@ startCurrencyIn = currencyIn) => {
15041
15260
 
15042
15261
  class Fees {
15043
15262
  secondaryFees;
15044
- token;
15045
- amount = ethers.BigNumber.from(0);
15263
+ amount;
15046
15264
  constructor(secondaryFees, token) {
15047
15265
  this.secondaryFees = secondaryFees;
15048
- this.token = token;
15266
+ this.amount = { token, value: BigNumber$1.from(0) };
15049
15267
  }
15050
15268
  addAmount(amount) {
15051
- this.amount = this.amount.add(amount);
15269
+ this.amount = addAmount(this.amount, amount);
15052
15270
  }
15053
15271
  amountWithFeesApplied() {
15054
- return this.amount.add(this.total());
15272
+ return addAmount(this.amount, this.total());
15055
15273
  }
15056
15274
  amountLessFees() {
15057
- return this.amount.sub(this.total());
15275
+ return subtractAmount(this.amount, this.total());
15058
15276
  }
15059
15277
  withAmounts() {
15060
15278
  return this.secondaryFees.map((fee) => {
15061
- const feeAmount = this.amount
15062
- .mul(fee.feeBasisPoints)
15279
+ const feeAmount = this.amount.value
15280
+ .mul(fee.basisPoints)
15063
15281
  .div(BASIS_POINT_PRECISION);
15064
15282
  return {
15065
15283
  ...fee,
15066
- amount: newAmount(feeAmount, this.token),
15284
+ amount: newAmount(feeAmount, this.amount.token),
15067
15285
  };
15068
15286
  });
15069
15287
  }
15070
15288
  total() {
15071
- let totalFees = ethers.BigNumber.from(0);
15072
- for (let i = 0; i < this.secondaryFees.length; i++) {
15073
- const feeAmount = this.amount
15074
- .mul(this.secondaryFees[i].feeBasisPoints)
15289
+ let totalFees = newAmount(BigNumber$1.from(0), this.amount.token);
15290
+ for (const fee of this.secondaryFees) {
15291
+ const feeAmount = this.amount.value
15292
+ .mul(fee.basisPoints)
15075
15293
  .div(BASIS_POINT_PRECISION);
15076
- totalFees = totalFees.add(feeAmount);
15294
+ totalFees = addAmount(totalFees, newAmount(feeAmount, this.amount.token));
15077
15295
  }
15078
15296
  return totalFees;
15079
15297
  }
@@ -15097,11 +15315,11 @@ const zeroNativeCurrencyValue = '0x00';
15097
15315
  const multicallWithDeadlineFunctionSignature = 'multicall(uint256,bytes[])';
15098
15316
  function buildSwapParametersForSinglePoolSwap(fromAddress, trade, route, amountIn, amountOut, secondaryFees, secondaryFeeContract) {
15099
15317
  const secondaryFeeValues = secondaryFees.map((fee) => ({
15100
- feePrcntBasisPoints: fee.feeBasisPoints,
15101
- recipient: fee.feeRecipient,
15318
+ feeBasisPoints: fee.basisPoints,
15319
+ recipient: fee.recipient,
15102
15320
  }));
15103
15321
  if (trade.tradeType === TradeType.EXACT_INPUT) {
15104
- return secondaryFeeContract.encodeFunctionData('exactInputSingleWithServiceFee', [secondaryFeeValues, {
15322
+ return secondaryFeeContract.encodeFunctionData('exactInputSingleWithSecondaryFee', [secondaryFeeValues, {
15105
15323
  tokenIn: route.tokenPath[0].address,
15106
15324
  tokenOut: route.tokenPath[1].address,
15107
15325
  fee: route.pools[0].fee,
@@ -15111,7 +15329,7 @@ function buildSwapParametersForSinglePoolSwap(fromAddress, trade, route, amountI
15111
15329
  sqrtPriceLimitX96: 0,
15112
15330
  }]);
15113
15331
  }
15114
- return secondaryFeeContract.encodeFunctionData('exactOutputSingleWithServiceFee', [secondaryFeeValues, {
15332
+ return secondaryFeeContract.encodeFunctionData('exactOutputSingleWithSecondaryFee', [secondaryFeeValues, {
15115
15333
  tokenIn: route.tokenPath[0].address,
15116
15334
  tokenOut: route.tokenPath[1].address,
15117
15335
  fee: route.pools[0].fee,
@@ -15124,18 +15342,18 @@ function buildSwapParametersForSinglePoolSwap(fromAddress, trade, route, amountI
15124
15342
  function buildSwapParametersForMultiPoolSwap(fromAddress, trade, route, amountIn, amountOut, secondaryFees, secondaryFeeContract) {
15125
15343
  const path = encodeRouteToPath(route, trade.tradeType === TradeType.EXACT_OUTPUT);
15126
15344
  const secondaryFeeValues = secondaryFees.map((fee) => ({
15127
- feePrcntBasisPoints: fee.feeBasisPoints,
15128
- recipient: fee.feeRecipient,
15345
+ feeBasisPoints: fee.basisPoints,
15346
+ recipient: fee.recipient,
15129
15347
  }));
15130
15348
  if (trade.tradeType === TradeType.EXACT_INPUT) {
15131
- return secondaryFeeContract.encodeFunctionData('exactInputWithServiceFee', [secondaryFeeValues, {
15349
+ return secondaryFeeContract.encodeFunctionData('exactInputWithSecondaryFee', [secondaryFeeValues, {
15132
15350
  path,
15133
15351
  recipient: fromAddress,
15134
15352
  amountIn,
15135
15353
  amountOutMinimum: amountOut,
15136
15354
  }]);
15137
15355
  }
15138
- return secondaryFeeContract.encodeFunctionData('exactOutputWithServiceFee', [secondaryFeeValues, {
15356
+ return secondaryFeeContract.encodeFunctionData('exactOutputWithSecondaryFee', [secondaryFeeValues, {
15139
15357
  path,
15140
15358
  recipient: fromAddress,
15141
15359
  amountInMaximum: amountIn,
@@ -15171,8 +15389,8 @@ function createSwapParameters(adjustedQuote, fromAddress, slippage, deadline, se
15171
15389
  // Create an unchecked trade to be used in generating swap parameters.
15172
15390
  const uncheckedTrade = Trade.createUncheckedTrade({
15173
15391
  route: adjustedQuote.route,
15174
- inputAmount: CurrencyAmount.fromRawAmount(adjustedQuote.tokenIn, adjustedQuote.amountIn.toString()),
15175
- outputAmount: CurrencyAmount.fromRawAmount(adjustedQuote.tokenOut, adjustedQuote.amountOut.toString()),
15392
+ inputAmount: toCurrencyAmount(adjustedQuote.amountIn),
15393
+ outputAmount: toCurrencyAmount(adjustedQuote.amountOut),
15176
15394
  tradeType: adjustedQuote.tradeType,
15177
15395
  });
15178
15396
  const slippageTolerance = slippageToFraction(slippage);
@@ -15210,8 +15428,6 @@ function prepareSwap(ourQuote, amountSpecified, fees) {
15210
15428
  return {
15211
15429
  gasEstimate: ourQuote.gasEstimate,
15212
15430
  route: ourQuote.route,
15213
- tokenIn: ourQuote.tokenIn,
15214
- tokenOut: ourQuote.tokenOut,
15215
15431
  amountIn: fees.amountWithFeesApplied(),
15216
15432
  amountOut: amountSpecified,
15217
15433
  tradeType: ourQuote.tradeType,
@@ -15220,8 +15436,6 @@ function prepareSwap(ourQuote, amountSpecified, fees) {
15220
15436
  return {
15221
15437
  gasEstimate: ourQuote.gasEstimate,
15222
15438
  route: ourQuote.route,
15223
- tokenIn: ourQuote.tokenIn,
15224
- tokenOut: ourQuote.tokenOut,
15225
15439
  amountIn: amountSpecified,
15226
15440
  amountOut: ourQuote.amountOut,
15227
15441
  tradeType: ourQuote.tradeType,
@@ -15234,7 +15448,7 @@ const CONTRACTS_FOR_CHAIN_ID = {
15234
15448
  coreFactory: '0x8AC26EfCbf5D700b37A27aA00E6934e6904e7B8e',
15235
15449
  quoterV2: '0x0Afe6F5f4DC34461A801420634239FFaD50A2e44',
15236
15450
  peripheryRouter: '0x87854A7D4b9BaC3D37f4516A1Ac7F36fB5ad539f',
15237
- secondaryFee: '0x8dBE1f0900C5e92ad87A54521902a33ba1598C51',
15451
+ secondaryFee: '0x5893A5c7bc615Dfd36D7383366d00FFFca5f7178',
15238
15452
  },
15239
15453
  };
15240
15454
  const SUPPORTED_SANDBOX_CHAINS = {
@@ -15267,13 +15481,13 @@ function validateOverrides(overrides) {
15267
15481
  function validateSecondaryFees(secondaryFees) {
15268
15482
  let totalSecondaryFeeBasisPoints = 0;
15269
15483
  for (const secondaryFee of secondaryFees) {
15270
- if (!isValidNonZeroAddress(secondaryFee.feeRecipient)) {
15271
- throw new InvalidConfigurationError(`Invalid secondary fee recipient address: ${secondaryFee.feeRecipient}`);
15484
+ if (!isValidNonZeroAddress(secondaryFee.recipient)) {
15485
+ throw new InvalidConfigurationError(`Invalid secondary fee recipient address: ${secondaryFee.recipient}`);
15272
15486
  }
15273
- if (secondaryFee.feeBasisPoints < 0 || secondaryFee.feeBasisPoints > MAX_SECONDARY_FEE_BASIS_POINTS) {
15274
- throw new InvalidConfigurationError(`Invalid secondary fee basis points: ${secondaryFee.feeBasisPoints}`);
15487
+ if (secondaryFee.basisPoints < 0 || secondaryFee.basisPoints > MAX_SECONDARY_FEE_BASIS_POINTS) {
15488
+ throw new InvalidConfigurationError(`Invalid secondary fee basis points: ${secondaryFee.basisPoints}`);
15275
15489
  }
15276
- totalSecondaryFeeBasisPoints += secondaryFee.feeBasisPoints;
15490
+ totalSecondaryFeeBasisPoints += secondaryFee.basisPoints;
15277
15491
  }
15278
15492
  if (totalSecondaryFeeBasisPoints > MAX_SECONDARY_FEE_BASIS_POINTS) {
15279
15493
  throw new InvalidConfigurationError(`Invalid total secondary fee basis points: ${totalSecondaryFeeBasisPoints}`);
@@ -15343,12 +15557,24 @@ class Exchange {
15343
15557
  assert(slippagePercent <= 50, new InvalidSlippageError('slippage percent must be less than or equal to 50'));
15344
15558
  assert(slippagePercent >= 0, new InvalidSlippageError('slippage percent must be greater than or equal to 0'));
15345
15559
  }
15560
+ async getSecondaryFees() {
15561
+ if (this.secondaryFees.length === 0) {
15562
+ return [];
15563
+ }
15564
+ const secondaryFeeContract = SecondaryFee__factory.connect(this.router.routingContracts.secondaryFeeAddress, this.provider);
15565
+ if (await secondaryFeeContract.paused()) {
15566
+ // Do not use secondary fees if the contract is paused
15567
+ return [];
15568
+ }
15569
+ return this.secondaryFees;
15570
+ }
15346
15571
  async getUnsignedSwapTx(fromAddress, tokenInAddress, tokenOutAddress, amount, slippagePercent, maxHops, deadline, tradeType) {
15347
15572
  Exchange.validate(tokenInAddress, tokenOutAddress, maxHops, slippagePercent, fromAddress);
15348
15573
  // get the decimals of the tokens that will be swapped
15349
- const [tokenInDecimals, tokenOutDecimals] = await Promise.all([
15574
+ const [tokenInDecimals, tokenOutDecimals, secondaryFees] = await Promise.all([
15350
15575
  getERC20Decimals(tokenInAddress, this.provider),
15351
15576
  getERC20Decimals(tokenOutAddress, this.provider),
15577
+ this.getSecondaryFees(),
15352
15578
  ]);
15353
15579
  const tokenIn = new Token(this.chainId, tokenInAddress, tokenInDecimals);
15354
15580
  const tokenOut = new Token(this.chainId, tokenOutAddress, tokenOutDecimals);
@@ -15356,22 +15582,24 @@ class Exchange {
15356
15582
  let amountSpecified;
15357
15583
  let otherToken;
15358
15584
  if (tradeType === TradeType.EXACT_INPUT) {
15359
- amountSpecified = CurrencyAmount.fromRawAmount(tokenIn, amount.toString());
15585
+ amountSpecified = newAmount(amount, tokenIn);
15360
15586
  otherToken = tokenOut;
15361
15587
  }
15362
15588
  else {
15363
- amountSpecified = CurrencyAmount.fromRawAmount(tokenOut, amount.toString());
15589
+ amountSpecified = newAmount(amount, tokenOut);
15364
15590
  otherToken = tokenIn;
15365
15591
  }
15366
- const fees = new Fees(this.secondaryFees, uniswapTokenToTokenInfo(tokenIn));
15592
+ const fees = new Fees(secondaryFees, uniswapTokenToTokenInfo(tokenIn));
15367
15593
  const ourQuoteReqAmount = getOurQuoteReqAmount(amountSpecified, fees, tradeType);
15368
- const ourQuote = await this.router.findOptimalRoute(ourQuoteReqAmount, otherToken, tradeType, maxHops);
15369
- // get gas details
15370
- const gasPrice = await fetchGasPrice(this.provider);
15371
- const adjustedQuote = prepareSwap(ourQuote, amount, fees);
15372
- const swap = getSwap(this.nativeToken, adjustedQuote, fromAddress, slippagePercent, deadline, this.router.routingContracts.peripheryRouterAddress, this.router.routingContracts.secondaryFeeAddress, gasPrice, this.secondaryFees);
15594
+ // get quote and gas details
15595
+ const [ourQuote, gasPrice] = await Promise.all([
15596
+ this.router.findOptimalRoute(ourQuoteReqAmount, otherToken, tradeType, maxHops),
15597
+ fetchGasPrice(this.provider),
15598
+ ]);
15599
+ const adjustedQuote = prepareSwap(ourQuote, amountSpecified, fees);
15600
+ const swap = getSwap(this.nativeToken, adjustedQuote, fromAddress, slippagePercent, deadline, this.router.routingContracts.peripheryRouterAddress, this.router.routingContracts.secondaryFeeAddress, gasPrice, secondaryFees);
15373
15601
  const userQuote = prepareUserQuote(otherToken, adjustedQuote, slippagePercent, fees);
15374
- const preparedApproval = prepareApproval(tradeType, amount, userQuote.amountWithMaxSlippage.value, this.router.routingContracts, this.secondaryFees);
15602
+ const preparedApproval = prepareApproval(tradeType, amount, userQuote.amountWithMaxSlippage.value, this.router.routingContracts, secondaryFees);
15375
15603
  // we always use the tokenIn address because we are always selling the tokenIn
15376
15604
  const approval = await getApproval(this.nativeToken, this.provider, fromAddress, tokenInAddress, preparedApproval, gasPrice);
15377
15605
  return {
@@ -15876,6 +16104,28 @@ class OrdersService {
15876
16104
  },
15877
16105
  });
15878
16106
  }
16107
+ /**
16108
+ * Retrieve fulfillment data for orders
16109
+ * Retrieve signed fulfillment data based on the list of order IDs and corresponding fees.
16110
+ * @returns any Successful response
16111
+ * @throws ApiError
16112
+ */
16113
+ fulfillmentData({ chainName, requestBody, }) {
16114
+ return this.httpRequest.request({
16115
+ method: 'POST',
16116
+ url: '/v1/chains/{chain_name}/orders/fulfillment-data',
16117
+ path: {
16118
+ 'chain_name': chainName,
16119
+ },
16120
+ body: requestBody,
16121
+ mediaType: 'application/json',
16122
+ errors: {
16123
+ 400: `Bad Request (400)`,
16124
+ 404: `The specified resource was not found (404)`,
16125
+ 500: `Internal Server Error (500)`,
16126
+ },
16127
+ });
16128
+ }
15879
16129
  }
15880
16130
 
15881
16131
  class OrderBookClient {
@@ -15883,7 +16133,7 @@ class OrderBookClient {
15883
16133
  request;
15884
16134
  constructor(config, HttpRequest = AxiosHttpRequest) {
15885
16135
  this.request = new HttpRequest({
15886
- BASE: config?.BASE ?? 'https://api.dev.immutable.com',
16136
+ BASE: config?.BASE ?? 'https://api.sandbox.immutable.com',
15887
16137
  VERSION: config?.VERSION ?? '1.0.0',
15888
16138
  WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false,
15889
16139
  CREDENTIALS: config?.CREDENTIALS ?? 'include',
@@ -15952,7 +16202,7 @@ var ActionType;
15952
16202
  // TODO: Resolve these from seaport-js.
15953
16203
  // There is some bundling issue that is preventing this from working
15954
16204
  const SEAPORT_CONTRACT_NAME = 'ImmutableSeaport';
15955
- const SEAPORT_CONTRACT_VERSION_V1_4 = '1.4';
16205
+ // export const SEAPORT_CONTRACT_VERSION_V1_4 = '1.4';
15956
16206
  const SEAPORT_CONTRACT_VERSION_V1_5 = '1.5';
15957
16207
  const EIP_712_ORDER_TYPE = {
15958
16208
  OrderComponents: [
@@ -16018,7 +16268,7 @@ var BasicOrderRouteType;
16018
16268
  function getOrderComponentsFromMessage(orderMessage) {
16019
16269
  const data = JSON.parse(orderMessage);
16020
16270
  const orderComponents = data.message;
16021
- orderComponents.salt = BigNumber$2.from(orderComponents.salt).toHexString();
16271
+ orderComponents.salt = BigNumber$1.from(orderComponents.salt).toHexString();
16022
16272
  return orderComponents;
16023
16273
  }
16024
16274
 
@@ -16142,7 +16392,7 @@ class Seaport {
16142
16392
  orderHash: this.getSeaportLib().getOrderHash(orderComponents),
16143
16393
  };
16144
16394
  }
16145
- async fulfillOrder(order, account) {
16395
+ async fulfillOrder(order, account, extraData) {
16146
16396
  const orderComponents = await this.mapImmutableOrderToSeaportOrderComponents(order);
16147
16397
  const seaportLib = this.getSeaportLib(order);
16148
16398
  const { actions: seaportActions } = await seaportLib.fulfillOrders({
@@ -16152,7 +16402,7 @@ class Seaport {
16152
16402
  parameters: orderComponents,
16153
16403
  signature: order.signature,
16154
16404
  },
16155
- extraData: order.protocol_data.operator_signature,
16405
+ extraData,
16156
16406
  }],
16157
16407
  });
16158
16408
  const fulfillmentActions = [];
@@ -16220,7 +16470,7 @@ class Seaport {
16220
16470
  const { chainId } = await this.provider.getNetwork();
16221
16471
  const domainData = {
16222
16472
  name: SEAPORT_CONTRACT_NAME,
16223
- version: SEAPORT_CONTRACT_VERSION_V1_4,
16473
+ version: SEAPORT_CONTRACT_VERSION_V1_5,
16224
16474
  chainId,
16225
16475
  verifyingContract: this.seaportContractAddress,
16226
16476
  };
@@ -16232,10 +16482,10 @@ class Seaport {
16232
16482
  }
16233
16483
  getSeaportLib(order) {
16234
16484
  const seaportAddress = order?.protocol_data?.seaport_address ?? this.seaportContractAddress;
16235
- let seaportVersion = SEAPORT_CONTRACT_VERSION_V1_4;
16236
- if (order?.protocol_data?.seaport_version === SEAPORT_CONTRACT_VERSION_V1_5) {
16237
- seaportVersion = SEAPORT_CONTRACT_VERSION_V1_5;
16238
- }
16485
+ const seaportVersion = SEAPORT_CONTRACT_VERSION_V1_5;
16486
+ // if (order?.protocol_data?.seaport_version === SEAPORT_CONTRACT_VERSION_V1_5) {
16487
+ // seaportVersion = SEAPORT_CONTRACT_VERSION_V1_5;
16488
+ // }
16239
16489
  return this.seaportLibFactory.create(seaportVersion, seaportAddress);
16240
16490
  }
16241
16491
  }
@@ -16249,6 +16499,12 @@ class ImmutableApiClient {
16249
16499
  this.chainName = chainName;
16250
16500
  this.seaportAddress = seaportAddress;
16251
16501
  }
16502
+ async fulfillmentData(requests) {
16503
+ return this.orderbookService.fulfillmentData({
16504
+ chainName: this.chainName,
16505
+ requestBody: requests,
16506
+ });
16507
+ }
16252
16508
  async getListing(listingId) {
16253
16509
  return this.orderbookService.getListing({
16254
16510
  chainName: this.chainName,
@@ -16304,7 +16560,7 @@ class ImmutableApiClient {
16304
16560
  order_type: CreateOrderProtocolData.order_type.FULL_RESTRICTED,
16305
16561
  zone_address: orderComponents.zone,
16306
16562
  seaport_address: this.seaportAddress,
16307
- seaport_version: SEAPORT_CONTRACT_VERSION_V1_4,
16563
+ seaport_version: SEAPORT_CONTRACT_VERSION_V1_5,
16308
16564
  counter: orderComponents.counter.toString(),
16309
16565
  },
16310
16566
  salt: orderComponents.salt,
@@ -16345,9 +16601,9 @@ function getOrderbookConfig(environment) {
16345
16601
  switch (environment) {
16346
16602
  case Environment$1.SANDBOX:
16347
16603
  return {
16348
- seaportContractAddress: '0x410000346E270aDbC89b2b688177d3AE76348dE9',
16349
- zoneContractAddress: '0x979C2aCA989A56554Eb63E01e576E3179Cdad5A0',
16350
- apiEndpoint: 'https://order-book-mr.sandbox.imtbl.com',
16604
+ seaportContractAddress: '0x7Fb7Da6De152597830eD16361633e362A2F59410',
16605
+ zoneContractAddress: '0x63441cBfBd15Dd8f5E92598E535661Ac5aCB808E',
16606
+ apiEndpoint: 'https://api.sandbox.immutable.com',
16351
16607
  chainName: TESTNET_CHAIN_NAME,
16352
16608
  provider: new providers.JsonRpcProvider('https://rpc.testnet.immutable.com'),
16353
16609
  };
@@ -17295,7 +17551,7 @@ class SeaportLibFactory {
17295
17551
  this.provider = provider;
17296
17552
  }
17297
17553
  create(orderSeaportVersion, orderSeaportAddress) {
17298
- const seaportVersion = orderSeaportVersion ?? SEAPORT_CONTRACT_VERSION_V1_4;
17554
+ const seaportVersion = orderSeaportVersion ?? SEAPORT_CONTRACT_VERSION_V1_5;
17299
17555
  const seaportContractAddress = orderSeaportAddress ?? this.defaultSeaportContractAddress;
17300
17556
  return new Seaport$1(this.provider, {
17301
17557
  seaportVersion,
@@ -17334,6 +17590,13 @@ class Orderbook {
17334
17590
  const seaportLibFactory = new SeaportLibFactory(this.orderbookConfig.seaportContractAddress, this.orderbookConfig.provider);
17335
17591
  this.seaport = new Seaport(seaportLibFactory, this.orderbookConfig.provider, this.orderbookConfig.seaportContractAddress, this.orderbookConfig.zoneContractAddress);
17336
17592
  }
17593
+ /**
17594
+ * Return the configuration for the orderbook module.
17595
+ * @return {OrderbookModuleConfiguration} The configuration for the orderbook module.
17596
+ */
17597
+ config() {
17598
+ return this.orderbookConfig;
17599
+ }
17337
17600
  /**
17338
17601
  * Get an order by ID
17339
17602
  * @param {string} listingId - The listingId to find.
@@ -17385,11 +17648,20 @@ class Orderbook {
17385
17648
  * @return {FulfillOrderResponse} Approval and fulfilment transactions.
17386
17649
  */
17387
17650
  async fulfillOrder(listingId, takerAddress) {
17388
- const orderResult = await this.apiClient.getListing(listingId);
17389
- if (orderResult.result.status !== OrderStatus.ACTIVE) {
17390
- throw new Error(`Cannot fulfil order that is not active. Current status: ${orderResult.result.status}`);
17651
+ const fulfillmentDataRes = await this.apiClient.fulfillmentData([{
17652
+ order_id: listingId,
17653
+ // fee: takerFee,
17654
+ fee: undefined,
17655
+ }]);
17656
+ if (fulfillmentDataRes.result.length !== 1) {
17657
+ throw new Error('unexpected fulfillment data result length');
17391
17658
  }
17392
- return this.seaport.fulfillOrder(orderResult.result, takerAddress);
17659
+ const extraData = fulfillmentDataRes.result[0].extra_data;
17660
+ const orderResult = fulfillmentDataRes.result[0].order;
17661
+ if (orderResult.status !== OrderStatus.ACTIVE) {
17662
+ throw new Error(`Cannot fulfil order that is not active. Current status: ${orderResult.status}`);
17663
+ }
17664
+ return this.seaport.fulfillOrder(orderResult, takerAddress, extraData);
17393
17665
  }
17394
17666
  /**
17395
17667
  * Get an unsigned cancel order transaction. Orders can only be cancelled by
@@ -17476,17 +17748,6 @@ const $762782b6c862d954$export$db5daa1b5156ccfe = [
17476
17748
  ];
17477
17749
 
17478
17750
 
17479
- var $aa144554f9ef124b$export$1fc8f52ad1810e52;
17480
- (function(ItemType) {
17481
- ItemType["NATIVE"] = "NATIVE";
17482
- ItemType["ERC20"] = "ERC20";
17483
- ItemType["ERC721"] = "ERC721";
17484
- })($aa144554f9ef124b$export$1fc8f52ad1810e52 || ($aa144554f9ef124b$export$1fc8f52ad1810e52 = {}));
17485
- var $aa144554f9ef124b$export$537fa3efd10ed435;
17486
- (function(GasTokenType) {
17487
- GasTokenType["NATIVE"] = "NATIVE";
17488
- GasTokenType["ERC20"] = "ERC20";
17489
- })($aa144554f9ef124b$export$537fa3efd10ed435 || ($aa144554f9ef124b$export$537fa3efd10ed435 = {}));
17490
17751
 
17491
17752
 
17492
17753
  /**
@@ -17570,8 +17831,8 @@ var $4f91c5f280efe242$export$a75605c67ea83a5a;
17570
17831
 
17571
17832
  var $e768639828688ca3$export$2d7a51a18d87e21d;
17572
17833
  (function(WalletProviderName) {
17573
- WalletProviderName["METAMASK"] = "metamask";
17574
17834
  WalletProviderName["PASSPORT"] = "passport";
17835
+ WalletProviderName["METAMASK"] = "metamask";
17575
17836
  })($e768639828688ca3$export$2d7a51a18d87e21d || ($e768639828688ca3$export$2d7a51a18d87e21d = {}));
17576
17837
  const $e768639828688ca3$export$44dde05038008549 = {
17577
17838
  allowMistmatchedChainId: false,
@@ -17694,6 +17955,31 @@ const $d85ad1457a3f1a83$export$3a9ebede6a150274 = new Map([
17694
17955
  ]);
17695
17956
 
17696
17957
 
17958
+ var $4b58188d47aafe8d$export$1fc8f52ad1810e52;
17959
+ (function(ItemType) {
17960
+ ItemType["NATIVE"] = "NATIVE";
17961
+ ItemType["ERC20"] = "ERC20";
17962
+ ItemType["ERC721"] = "ERC721";
17963
+ })($4b58188d47aafe8d$export$1fc8f52ad1810e52 || ($4b58188d47aafe8d$export$1fc8f52ad1810e52 = {}));
17964
+ var $4b58188d47aafe8d$export$65c64e46348ee3c1;
17965
+ (function(TransactionOrGasType) {
17966
+ TransactionOrGasType["TRANSACTION"] = "TRANSACTION";
17967
+ TransactionOrGasType["GAS"] = "GAS";
17968
+ })($4b58188d47aafe8d$export$65c64e46348ee3c1 || ($4b58188d47aafe8d$export$65c64e46348ee3c1 = {}));
17969
+ var $4b58188d47aafe8d$export$537fa3efd10ed435;
17970
+ (function(GasTokenType) {
17971
+ GasTokenType["NATIVE"] = "NATIVE";
17972
+ GasTokenType["ERC20"] = "ERC20";
17973
+ })($4b58188d47aafe8d$export$537fa3efd10ed435 || ($4b58188d47aafe8d$export$537fa3efd10ed435 = {}));
17974
+ var $4b58188d47aafe8d$export$5d3b0ad129b9b98e;
17975
+ (function(TransactionRequirementType) {
17976
+ TransactionRequirementType["GAS"] = "GAS";
17977
+ TransactionRequirementType["NATIVE"] = "NATIVE";
17978
+ TransactionRequirementType["ERC20"] = "ERC20";
17979
+ TransactionRequirementType["ERC721"] = "ERC721";
17980
+ })($4b58188d47aafe8d$export$5d3b0ad129b9b98e || ($4b58188d47aafe8d$export$5d3b0ad129b9b98e = {}));
17981
+
17982
+
17697
17983
 
17698
17984
 
17699
17985
  /**
@@ -18028,9 +18314,13 @@ async function $5c763be0b0b81038$var$getMetaMaskProvider() {
18028
18314
  if (!provider || !provider.request) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("No MetaMask provider installed.", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).METAMASK_PROVIDER_ERROR);
18029
18315
  return new (Web3Provider)(provider);
18030
18316
  }
18031
- async function $5c763be0b0b81038$export$500fbc0cd14cdbaa(walletProviderName) {
18317
+ async function $5c763be0b0b81038$export$500fbc0cd14cdbaa(walletProviderName, passport) {
18032
18318
  let provider = null;
18033
18319
  switch(walletProviderName){
18320
+ case ($e768639828688ca3$export$2d7a51a18d87e21d).PASSPORT:
18321
+ if (passport) provider = new (Web3Provider)(passport.connectEvm());
18322
+ else throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Passport not provided", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).DEFAULT_PROVIDER_ERROR);
18323
+ break;
18034
18324
  case ($e768639828688ca3$export$2d7a51a18d87e21d).METAMASK:
18035
18325
  provider = await $5c763be0b0b81038$var$getMetaMaskProvider();
18036
18326
  break;
@@ -18128,7 +18418,7 @@ const $dbe95599a4661140$export$8e0e7ffc78696d30 = async (web3Provider, transacti
18128
18418
 
18129
18419
  const $570856c68db0bd36$var$GAS_LIMIT = 140000;
18130
18420
  const $570856c68db0bd36$var$doesChainSupportEIP1559 = (feeData)=>!!feeData.maxFeePerGas && !!feeData.maxPriorityFeePerGas;
18131
- const $570856c68db0bd36$var$getGasPriceInWei = (feeData)=>$570856c68db0bd36$var$doesChainSupportEIP1559(feeData) ? (BigNumber$2).from(feeData.maxFeePerGas).add((BigNumber$2).from(feeData.maxPriorityFeePerGas)) : feeData.gasPrice && (BigNumber$2).from(feeData.gasPrice);
18421
+ const $570856c68db0bd36$var$getGasPriceInWei = (feeData)=>$570856c68db0bd36$var$doesChainSupportEIP1559(feeData) ? (BigNumber$1).from(feeData.maxFeePerGas).add((BigNumber$1).from(feeData.maxPriorityFeePerGas)) : feeData.gasPrice && (BigNumber$1).from(feeData.gasPrice);
18132
18422
  const $570856c68db0bd36$var$getGasEstimates = async (provider)=>{
18133
18423
  const txnGasLimitInWei = $570856c68db0bd36$var$GAS_LIMIT; // todo: fetch gasLimit from bridgeSDK when they add new fn
18134
18424
  const feeData = await provider.getFeeData();
@@ -18362,13 +18652,13 @@ async function $2e7bf45a7c9a9570$var$swapGasEstimator(config) {
18362
18652
  try {
18363
18653
  const exchange = await $67fc622a2b913d5f$export$7cf6178417769841(chainId, config);
18364
18654
  // Create a fake transaction to get the gas from the quote
18365
- const { swap: swap } = await exchange.getUnsignedSwapTxFromAmountIn($2e7bf45a7c9a9570$var$DUMMY_WALLET_ADDRESS, inAddress, outAddress, (0, BigNumber$2).from((0, utils).parseUnits("1", $2e7bf45a7c9a9570$var$DEFAULT_TOKEN_DECIMALS)));
18655
+ const { swap: swap } = await exchange.getUnsignedSwapTxFromAmountIn($2e7bf45a7c9a9570$var$DUMMY_WALLET_ADDRESS, inAddress, outAddress, (0, BigNumber$1).from((0, utils).parseUnits("1", $2e7bf45a7c9a9570$var$DEFAULT_TOKEN_DECIMALS)));
18366
18656
  if (swap.gasFeeEstimate === null) return {
18367
18657
  gasEstimateType: (0, $de275b98d2b651c3$export$788b1fd17f3dad84).SWAP,
18368
18658
  gasFee: {}
18369
18659
  };
18370
18660
  let estimatedAmount;
18371
- if (swap.gasFeeEstimate.value) estimatedAmount = (0, BigNumber$2).from(swap.gasFeeEstimate.value);
18661
+ if (swap.gasFeeEstimate.value) estimatedAmount = (0, BigNumber$1).from(swap.gasFeeEstimate.value);
18372
18662
  return {
18373
18663
  gasEstimateType: (0, $de275b98d2b651c3$export$788b1fd17f3dad84).SWAP,
18374
18664
  gasFee: {
@@ -18410,20 +18700,19 @@ async function $2e7bf45a7c9a9570$export$942c8de7174809fc(params, readOnlyProvide
18410
18700
 
18411
18701
  const $c147333b1f360629$export$92589613aaa38e1f = 300000;
18412
18702
  const $c147333b1f360629$export$dea9ce0e9bb2441c = "0x474989C4D25DD41B0B9b1ECb4643B9Fe25f83B19";
18413
- const $c147333b1f360629$export$5baee63457fa7911 = (type, amount, contractAddress)=>{
18703
+ const $c147333b1f360629$export$4249179755829904 = (type, contractAddress, amount)=>{
18414
18704
  switch(type){
18415
- case ($aa144554f9ef124b$export$1fc8f52ad1810e52).ERC20:
18416
- case ($aa144554f9ef124b$export$1fc8f52ad1810e52).ERC721:
18705
+ case ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20:
18417
18706
  return {
18418
18707
  type: type,
18419
18708
  amount: amount,
18420
18709
  contractAddress: contractAddress,
18421
- approvalContractAddress: $c147333b1f360629$export$dea9ce0e9bb2441c
18710
+ spenderAddress: $c147333b1f360629$export$dea9ce0e9bb2441c
18422
18711
  };
18423
- case ($aa144554f9ef124b$export$1fc8f52ad1810e52).NATIVE:
18712
+ case ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE:
18424
18713
  default:
18425
18714
  return {
18426
- type: ($aa144554f9ef124b$export$1fc8f52ad1810e52).NATIVE,
18715
+ type: ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE,
18427
18716
  amount: amount
18428
18717
  };
18429
18718
  }
@@ -18439,20 +18728,16 @@ const $c147333b1f360629$export$7f8e2b98eca5a7f0 = async (config, provider, order
18439
18728
  message: err.message
18440
18729
  });
18441
18730
  }
18442
- let amount = (BigNumber$2).from("0");
18443
- let type = ($aa144554f9ef124b$export$1fc8f52ad1810e52).NATIVE;
18731
+ let amount = (BigNumber$1).from("0");
18732
+ let type = ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE;
18444
18733
  let contractAddress = "";
18445
18734
  const buyArray = order.result.buy;
18446
18735
  if (buyArray.length > 0) switch(buyArray[0].item_type){
18447
18736
  case "NATIVE":
18448
- type = ($aa144554f9ef124b$export$1fc8f52ad1810e52).NATIVE;
18737
+ type = ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE;
18449
18738
  break;
18450
18739
  case "ERC20":
18451
- type = ($aa144554f9ef124b$export$1fc8f52ad1810e52).ERC20;
18452
- contractAddress = buyArray[0].contract_address;
18453
- break;
18454
- case "ERC721":
18455
- type = ($aa144554f9ef124b$export$1fc8f52ad1810e52).ERC721;
18740
+ type = ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20;
18456
18741
  contractAddress = buyArray[0].contract_address;
18457
18742
  break;
18458
18743
  default:
@@ -18461,20 +18746,20 @@ const $c147333b1f360629$export$7f8e2b98eca5a7f0 = async (config, provider, order
18461
18746
  });
18462
18747
  }
18463
18748
  buyArray.forEach((item)=>{
18464
- amount = amount.add((BigNumber$2).from(item.start_amount));
18749
+ if (item.item_type !== ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC721) amount = amount.add((BigNumber$1).from(item.start_amount));
18465
18750
  });
18466
18751
  const feeArray = order.result.fees;
18467
18752
  feeArray.forEach((item)=>{
18468
- amount = amount.add((BigNumber$2).from(item.amount));
18753
+ amount = amount.add((BigNumber$1).from(item.amount));
18469
18754
  });
18470
- const requirements = [
18471
- $c147333b1f360629$export$5baee63457fa7911(type, amount, contractAddress)
18755
+ const itemRequirements = [
18756
+ $c147333b1f360629$export$4249179755829904(type, contractAddress, amount)
18472
18757
  ];
18473
18758
  return {
18474
- requirements: requirements,
18475
- gas: {
18476
- type: ($aa144554f9ef124b$export$537fa3efd10ed435).NATIVE,
18477
- limit: (BigNumber$2).from($c147333b1f360629$export$92589613aaa38e1f)
18759
+ itemRequirements: itemRequirements,
18760
+ gasToken: {
18761
+ type: ($4b58188d47aafe8d$export$537fa3efd10ed435).NATIVE,
18762
+ limit: (BigNumber$1).from($c147333b1f360629$export$92589613aaa38e1f)
18478
18763
  }
18479
18764
  };
18480
18765
  };
@@ -18484,6 +18769,45 @@ const $c147333b1f360629$export$7f8e2b98eca5a7f0 = async (config, provider, order
18484
18769
 
18485
18770
 
18486
18771
 
18772
+ const $0e7419077c373b24$export$9e073f9ada8c81e6 = async (provider, itemRequirements, transactionOrGasAmount)=>{
18773
+ // eslint-disable-next-line no-console
18774
+ console.log(provider, itemRequirements, transactionOrGasAmount);
18775
+ return {
18776
+ sufficient: true,
18777
+ transactionRequirements: [
18778
+ {
18779
+ type: ($4b58188d47aafe8d$export$5d3b0ad129b9b98e).GAS,
18780
+ sufficient: true,
18781
+ required: {
18782
+ balance: (BigNumber$1).from(0),
18783
+ formattedBalance: "0",
18784
+ token: {
18785
+ name: "IMX",
18786
+ symbol: "IMX",
18787
+ address: "0x0",
18788
+ decimals: 18
18789
+ }
18790
+ },
18791
+ current: {
18792
+ balance: (BigNumber$1).from(1),
18793
+ formattedBalance: "1",
18794
+ token: {
18795
+ name: "IMX",
18796
+ symbol: "IMX",
18797
+ address: "0x0",
18798
+ decimals: 18
18799
+ }
18800
+ }
18801
+ }
18802
+ ]
18803
+ };
18804
+ };
18805
+
18806
+
18807
+
18808
+
18809
+
18810
+
18487
18811
 
18488
18812
 
18489
18813
  async function $0e0060cb42e136d2$export$339cb2be73677b30(config, existingReadOnlyProviders) {
@@ -18522,7 +18846,7 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
18522
18846
  * @param {CreateProviderParams} params - The parameters for creating the provider.
18523
18847
  * @returns {Promise<CreateProviderResult>} A promise that resolves to the created provider.
18524
18848
  */ async createProvider(params) {
18525
- return await $5c763be0b0b81038$export$500fbc0cd14cdbaa(params.walletProvider);
18849
+ return await $5c763be0b0b81038$export$500fbc0cd14cdbaa(params.walletProvider, params.passport);
18526
18850
  }
18527
18851
  /**
18528
18852
  * Checks if a wallet is connected to the specified provider.
@@ -18623,12 +18947,23 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
18623
18947
  * Determines the requirements for performing a buy.
18624
18948
  * @param {BuyParams} params - The parameters for the buy.
18625
18949
  */ async buy(params) {
18950
+ if (this.config.isProduction) throw new Error("This endpoint is not currently available.");
18626
18951
  // eslint-disable-next-line no-console
18627
18952
  console.warn("This endpoint is currently under construction.");
18628
18953
  const web3Provider = await $bb88265fe45a0393$export$9e1fd9cc88c637a0(this.config, params.provider);
18629
18954
  await $c147333b1f360629$export$7f8e2b98eca5a7f0(this.config, web3Provider, params.orderId);
18630
18955
  }
18631
18956
  /**
18957
+ * Determines the transaction requirements to complete a purchase.
18958
+ * @params {SmartCheckoutParams} params - The parameters for smart checkout.
18959
+ */ async smartCheckout(params) {
18960
+ if (this.config.isProduction) throw new Error("This endpoint is not currently available.");
18961
+ // eslint-disable-next-line no-console
18962
+ console.warn("This endpoint is currently under construction.");
18963
+ const web3Provider = await $bb88265fe45a0393$export$9e1fd9cc88c637a0(this.config, params.provider);
18964
+ await $0e7419077c373b24$export$9e073f9ada8c81e6(web3Provider, params.itemRequirements, params.transactionOrGasAmount);
18965
+ }
18966
+ /**
18632
18967
  * Checks if the given object is a Web3 provider.
18633
18968
  * @param {Web3Provider} web3Provider - The object to check.
18634
18969
  * @returns {boolean} - True if the object is a Web3 provider, false otherwise.