@imtbl/sdk 0.39.0 → 0.39.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blockchain_data.js +1 -1
- package/dist/browser/checkout/sdk.js +6 -6
- package/dist/browser/checkout/widgets.js +61 -58
- package/dist/checkout.js +510 -787
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +11 -11
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +512 -789
- package/dist/index.js +515 -792
- package/dist/passport.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import { walletContracts } from '@0xsequence/abi';
|
|
|
14
14
|
import { v1 } from '@0xsequence/core';
|
|
15
15
|
import FormData$2 from 'form-data';
|
|
16
16
|
import { Seaport as Seaport$1 } from '@opensea/seaport-js';
|
|
17
|
-
import { parseUnits
|
|
17
|
+
import { parseUnits } from '@ethersproject/units';
|
|
18
18
|
import { BigNumber as BigNumber$2 } from '@ethersproject/bignumber';
|
|
19
19
|
import detectEthereumProvider from '@metamask/detect-provider';
|
|
20
20
|
import * as Uniswap from '@uniswap/sdk-core';
|
|
@@ -4234,7 +4234,7 @@ class MultiRollupApiClients {
|
|
|
4234
4234
|
}
|
|
4235
4235
|
|
|
4236
4236
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
4237
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.39.
|
|
4237
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.39.1' };
|
|
4238
4238
|
const createConfig = ({ basePath, headers, }) => {
|
|
4239
4239
|
if (!basePath.trim()) {
|
|
4240
4240
|
throw Error('basePath can not be empty');
|
|
@@ -4294,7 +4294,7 @@ class APIError extends Error {
|
|
|
4294
4294
|
|
|
4295
4295
|
/* eslint-disable implicit-arrow-linebreak */
|
|
4296
4296
|
const defaultHeaders = {
|
|
4297
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.39.
|
|
4297
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.39.1',
|
|
4298
4298
|
};
|
|
4299
4299
|
/**
|
|
4300
4300
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -4733,7 +4733,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
4733
4733
|
chainID,
|
|
4734
4734
|
coreContractAddress,
|
|
4735
4735
|
registrationContractAddress,
|
|
4736
|
-
sdkVersion: 'ts-immutable-sdk-0.39.
|
|
4736
|
+
sdkVersion: 'ts-immutable-sdk-0.39.1',
|
|
4737
4737
|
});
|
|
4738
4738
|
/**
|
|
4739
4739
|
* Sets `sdkVersion` at the time of build
|
|
@@ -13697,7 +13697,7 @@ async function depositEth({ signers: { ethSigner }, deposit, config, }) {
|
|
|
13697
13697
|
const data = {
|
|
13698
13698
|
decimals: 18,
|
|
13699
13699
|
};
|
|
13700
|
-
const amount = parseUnits
|
|
13700
|
+
const amount = parseUnits(deposit.amount, 'wei');
|
|
13701
13701
|
const imxConfig = config.immutableXConfig;
|
|
13702
13702
|
const depositsApi = new DepositsApi(imxConfig.apiConfiguration);
|
|
13703
13703
|
const encodingApi = new EncodingApi(imxConfig.apiConfiguration);
|
|
@@ -13760,7 +13760,7 @@ async function depositERC20({ signers: { ethSigner }, deposit, config, }) {
|
|
|
13760
13760
|
decimals,
|
|
13761
13761
|
token_address: deposit.tokenAddress,
|
|
13762
13762
|
};
|
|
13763
|
-
const amount = parseUnits
|
|
13763
|
+
const amount = parseUnits(deposit.amount, 0); // 0 to always use undecimalized value
|
|
13764
13764
|
// Approve whether an amount of token from an account can be spent by a third-party account
|
|
13765
13765
|
const tokenContract = Contracts.IERC20.connect(deposit.tokenAddress, ethSigner);
|
|
13766
13766
|
const approveTransaction = await tokenContract.populateTransaction.approve(ethConfiguration.coreContractAddress, amount);
|
|
@@ -20867,7 +20867,7 @@ var require$$0 = /*@__PURE__*/getAugmentedNamespace(_nodeResolve_empty$1);
|
|
|
20867
20867
|
var bnExports = bn.exports;
|
|
20868
20868
|
var BN$1 = /*@__PURE__*/getDefaultExportFromCjs(bnExports);
|
|
20869
20869
|
|
|
20870
|
-
const version$
|
|
20870
|
+
const version$b = "logger/5.7.0";
|
|
20871
20871
|
|
|
20872
20872
|
let _permanentCensorErrors = false;
|
|
20873
20873
|
let _censorErrors = false;
|
|
@@ -21182,7 +21182,7 @@ class Logger {
|
|
|
21182
21182
|
}
|
|
21183
21183
|
static globalLogger() {
|
|
21184
21184
|
if (!_globalLogger) {
|
|
21185
|
-
_globalLogger = new Logger(version$
|
|
21185
|
+
_globalLogger = new Logger(version$b);
|
|
21186
21186
|
}
|
|
21187
21187
|
return _globalLogger;
|
|
21188
21188
|
}
|
|
@@ -21218,9 +21218,9 @@ class Logger {
|
|
|
21218
21218
|
Logger.errors = ErrorCode;
|
|
21219
21219
|
Logger.levels = LogLevel;
|
|
21220
21220
|
|
|
21221
|
-
const version$
|
|
21221
|
+
const version$a = "bytes/5.7.0";
|
|
21222
21222
|
|
|
21223
|
-
const logger$
|
|
21223
|
+
const logger$e = new Logger(version$a);
|
|
21224
21224
|
///////////////////////////////
|
|
21225
21225
|
function isHexable(value) {
|
|
21226
21226
|
return !!(value.toHexString);
|
|
@@ -21267,7 +21267,7 @@ function arrayify(value, options) {
|
|
|
21267
21267
|
options = {};
|
|
21268
21268
|
}
|
|
21269
21269
|
if (typeof (value) === "number") {
|
|
21270
|
-
logger$
|
|
21270
|
+
logger$e.checkSafeUint53(value, "invalid arrayify value");
|
|
21271
21271
|
const result = [];
|
|
21272
21272
|
while (value) {
|
|
21273
21273
|
result.unshift(value & 0xff);
|
|
@@ -21294,7 +21294,7 @@ function arrayify(value, options) {
|
|
|
21294
21294
|
hex += "0";
|
|
21295
21295
|
}
|
|
21296
21296
|
else {
|
|
21297
|
-
logger$
|
|
21297
|
+
logger$e.throwArgumentError("hex data is odd-length", "value", value);
|
|
21298
21298
|
}
|
|
21299
21299
|
}
|
|
21300
21300
|
const result = [];
|
|
@@ -21306,7 +21306,7 @@ function arrayify(value, options) {
|
|
|
21306
21306
|
if (isBytes(value)) {
|
|
21307
21307
|
return addSlice(new Uint8Array(value));
|
|
21308
21308
|
}
|
|
21309
|
-
return logger$
|
|
21309
|
+
return logger$e.throwArgumentError("invalid arrayify value", "value", value);
|
|
21310
21310
|
}
|
|
21311
21311
|
function concat(items) {
|
|
21312
21312
|
const objects = items.map(item => arrayify(item));
|
|
@@ -21349,7 +21349,7 @@ function hexlify(value, options) {
|
|
|
21349
21349
|
options = {};
|
|
21350
21350
|
}
|
|
21351
21351
|
if (typeof (value) === "number") {
|
|
21352
|
-
logger$
|
|
21352
|
+
logger$e.checkSafeUint53(value, "invalid hexlify value");
|
|
21353
21353
|
let hex = "";
|
|
21354
21354
|
while (value) {
|
|
21355
21355
|
hex = HexCharacters[value & 0xf] + hex;
|
|
@@ -21385,7 +21385,7 @@ function hexlify(value, options) {
|
|
|
21385
21385
|
value += "0";
|
|
21386
21386
|
}
|
|
21387
21387
|
else {
|
|
21388
|
-
logger$
|
|
21388
|
+
logger$e.throwArgumentError("hex data is odd-length", "value", value);
|
|
21389
21389
|
}
|
|
21390
21390
|
}
|
|
21391
21391
|
return value.toLowerCase();
|
|
@@ -21398,7 +21398,7 @@ function hexlify(value, options) {
|
|
|
21398
21398
|
}
|
|
21399
21399
|
return result;
|
|
21400
21400
|
}
|
|
21401
|
-
return logger$
|
|
21401
|
+
return logger$e.throwArgumentError("invalid hexlify value", "value", value);
|
|
21402
21402
|
}
|
|
21403
21403
|
/*
|
|
21404
21404
|
function unoddify(value: BytesLike | Hexable | number): BytesLike | Hexable | number {
|
|
@@ -21422,7 +21422,7 @@ function hexDataSlice(data, offset, endOffset) {
|
|
|
21422
21422
|
data = hexlify(data);
|
|
21423
21423
|
}
|
|
21424
21424
|
else if (!isHexString(data) || (data.length % 2)) {
|
|
21425
|
-
logger$
|
|
21425
|
+
logger$e.throwArgumentError("invalid hexData", "value", data);
|
|
21426
21426
|
}
|
|
21427
21427
|
offset = 2 + 2 * offset;
|
|
21428
21428
|
if (endOffset != null) {
|
|
@@ -21442,10 +21442,10 @@ function hexZeroPad(value, length) {
|
|
|
21442
21442
|
value = hexlify(value);
|
|
21443
21443
|
}
|
|
21444
21444
|
else if (!isHexString(value)) {
|
|
21445
|
-
logger$
|
|
21445
|
+
logger$e.throwArgumentError("invalid hex string", "value", value);
|
|
21446
21446
|
}
|
|
21447
21447
|
if (value.length > 2 * length + 2) {
|
|
21448
|
-
logger$
|
|
21448
|
+
logger$e.throwArgumentError("value out of range", "value", arguments[1]);
|
|
21449
21449
|
}
|
|
21450
21450
|
while (value.length < 2 * length + 2) {
|
|
21451
21451
|
value = "0x0" + value.substring(2);
|
|
@@ -21453,26 +21453,18 @@ function hexZeroPad(value, length) {
|
|
|
21453
21453
|
return value;
|
|
21454
21454
|
}
|
|
21455
21455
|
|
|
21456
|
-
const version$
|
|
21456
|
+
const version$9 = "bignumber/5.7.0";
|
|
21457
21457
|
|
|
21458
21458
|
var BN = BN$1.BN;
|
|
21459
|
-
const logger$
|
|
21460
|
-
const _constructorGuard$
|
|
21459
|
+
const logger$d = new Logger(version$9);
|
|
21460
|
+
const _constructorGuard$1 = {};
|
|
21461
21461
|
const MAX_SAFE = 0x1fffffffffffff;
|
|
21462
|
-
function isBigNumberish(value) {
|
|
21463
|
-
return (value != null) && (BigNumber.isBigNumber(value) ||
|
|
21464
|
-
(typeof (value) === "number" && (value % 1) === 0) ||
|
|
21465
|
-
(typeof (value) === "string" && !!value.match(/^-?[0-9]+$/)) ||
|
|
21466
|
-
isHexString(value) ||
|
|
21467
|
-
(typeof (value) === "bigint") ||
|
|
21468
|
-
isBytes(value));
|
|
21469
|
-
}
|
|
21470
21462
|
// Only warn about passing 10 into radix once
|
|
21471
21463
|
let _warnedToStringRadix = false;
|
|
21472
21464
|
class BigNumber {
|
|
21473
21465
|
constructor(constructorGuard, hex) {
|
|
21474
|
-
if (constructorGuard !== _constructorGuard$
|
|
21475
|
-
logger$
|
|
21466
|
+
if (constructorGuard !== _constructorGuard$1) {
|
|
21467
|
+
logger$d.throwError("cannot call constructor directly; use BigNumber.from", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
21476
21468
|
operation: "new (BigNumber)"
|
|
21477
21469
|
});
|
|
21478
21470
|
}
|
|
@@ -21501,7 +21493,7 @@ class BigNumber {
|
|
|
21501
21493
|
div(other) {
|
|
21502
21494
|
const o = BigNumber.from(other);
|
|
21503
21495
|
if (o.isZero()) {
|
|
21504
|
-
throwFault
|
|
21496
|
+
throwFault("division-by-zero", "div");
|
|
21505
21497
|
}
|
|
21506
21498
|
return toBigNumber(toBN(this).div(toBN(other)));
|
|
21507
21499
|
}
|
|
@@ -21511,53 +21503,53 @@ class BigNumber {
|
|
|
21511
21503
|
mod(other) {
|
|
21512
21504
|
const value = toBN(other);
|
|
21513
21505
|
if (value.isNeg()) {
|
|
21514
|
-
throwFault
|
|
21506
|
+
throwFault("division-by-zero", "mod");
|
|
21515
21507
|
}
|
|
21516
21508
|
return toBigNumber(toBN(this).umod(value));
|
|
21517
21509
|
}
|
|
21518
21510
|
pow(other) {
|
|
21519
21511
|
const value = toBN(other);
|
|
21520
21512
|
if (value.isNeg()) {
|
|
21521
|
-
throwFault
|
|
21513
|
+
throwFault("negative-power", "pow");
|
|
21522
21514
|
}
|
|
21523
21515
|
return toBigNumber(toBN(this).pow(value));
|
|
21524
21516
|
}
|
|
21525
21517
|
and(other) {
|
|
21526
21518
|
const value = toBN(other);
|
|
21527
21519
|
if (this.isNegative() || value.isNeg()) {
|
|
21528
|
-
throwFault
|
|
21520
|
+
throwFault("unbound-bitwise-result", "and");
|
|
21529
21521
|
}
|
|
21530
21522
|
return toBigNumber(toBN(this).and(value));
|
|
21531
21523
|
}
|
|
21532
21524
|
or(other) {
|
|
21533
21525
|
const value = toBN(other);
|
|
21534
21526
|
if (this.isNegative() || value.isNeg()) {
|
|
21535
|
-
throwFault
|
|
21527
|
+
throwFault("unbound-bitwise-result", "or");
|
|
21536
21528
|
}
|
|
21537
21529
|
return toBigNumber(toBN(this).or(value));
|
|
21538
21530
|
}
|
|
21539
21531
|
xor(other) {
|
|
21540
21532
|
const value = toBN(other);
|
|
21541
21533
|
if (this.isNegative() || value.isNeg()) {
|
|
21542
|
-
throwFault
|
|
21534
|
+
throwFault("unbound-bitwise-result", "xor");
|
|
21543
21535
|
}
|
|
21544
21536
|
return toBigNumber(toBN(this).xor(value));
|
|
21545
21537
|
}
|
|
21546
21538
|
mask(value) {
|
|
21547
21539
|
if (this.isNegative() || value < 0) {
|
|
21548
|
-
throwFault
|
|
21540
|
+
throwFault("negative-width", "mask");
|
|
21549
21541
|
}
|
|
21550
21542
|
return toBigNumber(toBN(this).maskn(value));
|
|
21551
21543
|
}
|
|
21552
21544
|
shl(value) {
|
|
21553
21545
|
if (this.isNegative() || value < 0) {
|
|
21554
|
-
throwFault
|
|
21546
|
+
throwFault("negative-width", "shl");
|
|
21555
21547
|
}
|
|
21556
21548
|
return toBigNumber(toBN(this).shln(value));
|
|
21557
21549
|
}
|
|
21558
21550
|
shr(value) {
|
|
21559
21551
|
if (this.isNegative() || value < 0) {
|
|
21560
|
-
throwFault
|
|
21552
|
+
throwFault("negative-width", "shr");
|
|
21561
21553
|
}
|
|
21562
21554
|
return toBigNumber(toBN(this).shrn(value));
|
|
21563
21555
|
}
|
|
@@ -21587,7 +21579,7 @@ class BigNumber {
|
|
|
21587
21579
|
return toBN(this).toNumber();
|
|
21588
21580
|
}
|
|
21589
21581
|
catch (error) {
|
|
21590
|
-
throwFault
|
|
21582
|
+
throwFault("overflow", "toNumber", this.toString());
|
|
21591
21583
|
}
|
|
21592
21584
|
return null;
|
|
21593
21585
|
}
|
|
@@ -21596,7 +21588,7 @@ class BigNumber {
|
|
|
21596
21588
|
return BigInt(this.toString());
|
|
21597
21589
|
}
|
|
21598
21590
|
catch (e) { }
|
|
21599
|
-
return logger$
|
|
21591
|
+
return logger$d.throwError("this platform does not support BigInt", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
21600
21592
|
value: this.toString()
|
|
21601
21593
|
});
|
|
21602
21594
|
}
|
|
@@ -21606,14 +21598,14 @@ class BigNumber {
|
|
|
21606
21598
|
if (arguments[0] === 10) {
|
|
21607
21599
|
if (!_warnedToStringRadix) {
|
|
21608
21600
|
_warnedToStringRadix = true;
|
|
21609
|
-
logger$
|
|
21601
|
+
logger$d.warn("BigNumber.toString does not accept any parameters; base-10 is assumed");
|
|
21610
21602
|
}
|
|
21611
21603
|
}
|
|
21612
21604
|
else if (arguments[0] === 16) {
|
|
21613
|
-
logger$
|
|
21605
|
+
logger$d.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()", Logger.errors.UNEXPECTED_ARGUMENT, {});
|
|
21614
21606
|
}
|
|
21615
21607
|
else {
|
|
21616
|
-
logger$
|
|
21608
|
+
logger$d.throwError("BigNumber.toString does not accept parameters", Logger.errors.UNEXPECTED_ARGUMENT, {});
|
|
21617
21609
|
}
|
|
21618
21610
|
}
|
|
21619
21611
|
return toBN(this).toString(10);
|
|
@@ -21630,19 +21622,19 @@ class BigNumber {
|
|
|
21630
21622
|
}
|
|
21631
21623
|
if (typeof (value) === "string") {
|
|
21632
21624
|
if (value.match(/^-?0x[0-9a-f]+$/i)) {
|
|
21633
|
-
return new BigNumber(_constructorGuard$
|
|
21625
|
+
return new BigNumber(_constructorGuard$1, toHex(value));
|
|
21634
21626
|
}
|
|
21635
21627
|
if (value.match(/^-?[0-9]+$/)) {
|
|
21636
|
-
return new BigNumber(_constructorGuard$
|
|
21628
|
+
return new BigNumber(_constructorGuard$1, toHex(new BN(value)));
|
|
21637
21629
|
}
|
|
21638
|
-
return logger$
|
|
21630
|
+
return logger$d.throwArgumentError("invalid BigNumber string", "value", value);
|
|
21639
21631
|
}
|
|
21640
21632
|
if (typeof (value) === "number") {
|
|
21641
21633
|
if (value % 1) {
|
|
21642
|
-
throwFault
|
|
21634
|
+
throwFault("underflow", "BigNumber.from", value);
|
|
21643
21635
|
}
|
|
21644
21636
|
if (value >= MAX_SAFE || value <= -MAX_SAFE) {
|
|
21645
|
-
throwFault
|
|
21637
|
+
throwFault("overflow", "BigNumber.from", value);
|
|
21646
21638
|
}
|
|
21647
21639
|
return BigNumber.from(String(value));
|
|
21648
21640
|
}
|
|
@@ -21675,7 +21667,7 @@ class BigNumber {
|
|
|
21675
21667
|
}
|
|
21676
21668
|
}
|
|
21677
21669
|
}
|
|
21678
|
-
return logger$
|
|
21670
|
+
return logger$d.throwArgumentError("invalid BigNumber value", "value", value);
|
|
21679
21671
|
}
|
|
21680
21672
|
static isBigNumber(value) {
|
|
21681
21673
|
return !!(value && value._isBigNumber);
|
|
@@ -21693,7 +21685,7 @@ function toHex(value) {
|
|
|
21693
21685
|
value = value.substring(1);
|
|
21694
21686
|
// Cannot have multiple negative signs (e.g. "--0x04")
|
|
21695
21687
|
if (value[0] === "-") {
|
|
21696
|
-
logger$
|
|
21688
|
+
logger$d.throwArgumentError("invalid hex", "value", value);
|
|
21697
21689
|
}
|
|
21698
21690
|
// Call toHex on the positive component
|
|
21699
21691
|
value = toHex(value);
|
|
@@ -21732,373 +21724,19 @@ function toBN(value) {
|
|
|
21732
21724
|
}
|
|
21733
21725
|
return new BN(hex.substring(2), 16);
|
|
21734
21726
|
}
|
|
21735
|
-
function throwFault
|
|
21727
|
+
function throwFault(fault, operation, value) {
|
|
21736
21728
|
const params = { fault: fault, operation: operation };
|
|
21737
21729
|
if (value != null) {
|
|
21738
21730
|
params.value = value;
|
|
21739
21731
|
}
|
|
21740
|
-
return logger$
|
|
21732
|
+
return logger$d.throwError(fault, Logger.errors.NUMERIC_FAULT, params);
|
|
21741
21733
|
}
|
|
21742
21734
|
// value should have no prefix
|
|
21743
21735
|
function _base36To16(value) {
|
|
21744
21736
|
return (new BN(value, 36)).toString(16);
|
|
21745
21737
|
}
|
|
21746
21738
|
|
|
21747
|
-
const
|
|
21748
|
-
const _constructorGuard$1 = {};
|
|
21749
|
-
const Zero$1 = BigNumber.from(0);
|
|
21750
|
-
const NegativeOne$1 = BigNumber.from(-1);
|
|
21751
|
-
function throwFault(message, fault, operation, value) {
|
|
21752
|
-
const params = { fault: fault, operation: operation };
|
|
21753
|
-
if (value !== undefined) {
|
|
21754
|
-
params.value = value;
|
|
21755
|
-
}
|
|
21756
|
-
return logger$e.throwError(message, Logger.errors.NUMERIC_FAULT, params);
|
|
21757
|
-
}
|
|
21758
|
-
// Constant to pull zeros from for multipliers
|
|
21759
|
-
let zeros = "0";
|
|
21760
|
-
while (zeros.length < 256) {
|
|
21761
|
-
zeros += zeros;
|
|
21762
|
-
}
|
|
21763
|
-
// Returns a string "1" followed by decimal "0"s
|
|
21764
|
-
function getMultiplier(decimals) {
|
|
21765
|
-
if (typeof (decimals) !== "number") {
|
|
21766
|
-
try {
|
|
21767
|
-
decimals = BigNumber.from(decimals).toNumber();
|
|
21768
|
-
}
|
|
21769
|
-
catch (e) { }
|
|
21770
|
-
}
|
|
21771
|
-
if (typeof (decimals) === "number" && decimals >= 0 && decimals <= 256 && !(decimals % 1)) {
|
|
21772
|
-
return ("1" + zeros.substring(0, decimals));
|
|
21773
|
-
}
|
|
21774
|
-
return logger$e.throwArgumentError("invalid decimal size", "decimals", decimals);
|
|
21775
|
-
}
|
|
21776
|
-
function formatFixed(value, decimals) {
|
|
21777
|
-
if (decimals == null) {
|
|
21778
|
-
decimals = 0;
|
|
21779
|
-
}
|
|
21780
|
-
const multiplier = getMultiplier(decimals);
|
|
21781
|
-
// Make sure wei is a big number (convert as necessary)
|
|
21782
|
-
value = BigNumber.from(value);
|
|
21783
|
-
const negative = value.lt(Zero$1);
|
|
21784
|
-
if (negative) {
|
|
21785
|
-
value = value.mul(NegativeOne$1);
|
|
21786
|
-
}
|
|
21787
|
-
let fraction = value.mod(multiplier).toString();
|
|
21788
|
-
while (fraction.length < multiplier.length - 1) {
|
|
21789
|
-
fraction = "0" + fraction;
|
|
21790
|
-
}
|
|
21791
|
-
// Strip training 0
|
|
21792
|
-
fraction = fraction.match(/^([0-9]*[1-9]|0)(0*)/)[1];
|
|
21793
|
-
const whole = value.div(multiplier).toString();
|
|
21794
|
-
if (multiplier.length === 1) {
|
|
21795
|
-
value = whole;
|
|
21796
|
-
}
|
|
21797
|
-
else {
|
|
21798
|
-
value = whole + "." + fraction;
|
|
21799
|
-
}
|
|
21800
|
-
if (negative) {
|
|
21801
|
-
value = "-" + value;
|
|
21802
|
-
}
|
|
21803
|
-
return value;
|
|
21804
|
-
}
|
|
21805
|
-
function parseFixed(value, decimals) {
|
|
21806
|
-
if (decimals == null) {
|
|
21807
|
-
decimals = 0;
|
|
21808
|
-
}
|
|
21809
|
-
const multiplier = getMultiplier(decimals);
|
|
21810
|
-
if (typeof (value) !== "string" || !value.match(/^-?[0-9.]+$/)) {
|
|
21811
|
-
logger$e.throwArgumentError("invalid decimal value", "value", value);
|
|
21812
|
-
}
|
|
21813
|
-
// Is it negative?
|
|
21814
|
-
const negative = (value.substring(0, 1) === "-");
|
|
21815
|
-
if (negative) {
|
|
21816
|
-
value = value.substring(1);
|
|
21817
|
-
}
|
|
21818
|
-
if (value === ".") {
|
|
21819
|
-
logger$e.throwArgumentError("missing value", "value", value);
|
|
21820
|
-
}
|
|
21821
|
-
// Split it into a whole and fractional part
|
|
21822
|
-
const comps = value.split(".");
|
|
21823
|
-
if (comps.length > 2) {
|
|
21824
|
-
logger$e.throwArgumentError("too many decimal points", "value", value);
|
|
21825
|
-
}
|
|
21826
|
-
let whole = comps[0], fraction = comps[1];
|
|
21827
|
-
if (!whole) {
|
|
21828
|
-
whole = "0";
|
|
21829
|
-
}
|
|
21830
|
-
if (!fraction) {
|
|
21831
|
-
fraction = "0";
|
|
21832
|
-
}
|
|
21833
|
-
// Trim trailing zeros
|
|
21834
|
-
while (fraction[fraction.length - 1] === "0") {
|
|
21835
|
-
fraction = fraction.substring(0, fraction.length - 1);
|
|
21836
|
-
}
|
|
21837
|
-
// Check the fraction doesn't exceed our decimals size
|
|
21838
|
-
if (fraction.length > multiplier.length - 1) {
|
|
21839
|
-
throwFault("fractional component exceeds decimals", "underflow", "parseFixed");
|
|
21840
|
-
}
|
|
21841
|
-
// If decimals is 0, we have an empty string for fraction
|
|
21842
|
-
if (fraction === "") {
|
|
21843
|
-
fraction = "0";
|
|
21844
|
-
}
|
|
21845
|
-
// Fully pad the string with zeros to get to wei
|
|
21846
|
-
while (fraction.length < multiplier.length - 1) {
|
|
21847
|
-
fraction += "0";
|
|
21848
|
-
}
|
|
21849
|
-
const wholeValue = BigNumber.from(whole);
|
|
21850
|
-
const fractionValue = BigNumber.from(fraction);
|
|
21851
|
-
let wei = (wholeValue.mul(multiplier)).add(fractionValue);
|
|
21852
|
-
if (negative) {
|
|
21853
|
-
wei = wei.mul(NegativeOne$1);
|
|
21854
|
-
}
|
|
21855
|
-
return wei;
|
|
21856
|
-
}
|
|
21857
|
-
class FixedFormat {
|
|
21858
|
-
constructor(constructorGuard, signed, width, decimals) {
|
|
21859
|
-
if (constructorGuard !== _constructorGuard$1) {
|
|
21860
|
-
logger$e.throwError("cannot use FixedFormat constructor; use FixedFormat.from", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
21861
|
-
operation: "new FixedFormat"
|
|
21862
|
-
});
|
|
21863
|
-
}
|
|
21864
|
-
this.signed = signed;
|
|
21865
|
-
this.width = width;
|
|
21866
|
-
this.decimals = decimals;
|
|
21867
|
-
this.name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals);
|
|
21868
|
-
this._multiplier = getMultiplier(decimals);
|
|
21869
|
-
Object.freeze(this);
|
|
21870
|
-
}
|
|
21871
|
-
static from(value) {
|
|
21872
|
-
if (value instanceof FixedFormat) {
|
|
21873
|
-
return value;
|
|
21874
|
-
}
|
|
21875
|
-
if (typeof (value) === "number") {
|
|
21876
|
-
value = `fixed128x${value}`;
|
|
21877
|
-
}
|
|
21878
|
-
let signed = true;
|
|
21879
|
-
let width = 128;
|
|
21880
|
-
let decimals = 18;
|
|
21881
|
-
if (typeof (value) === "string") {
|
|
21882
|
-
if (value === "fixed") ;
|
|
21883
|
-
else if (value === "ufixed") {
|
|
21884
|
-
signed = false;
|
|
21885
|
-
}
|
|
21886
|
-
else {
|
|
21887
|
-
const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);
|
|
21888
|
-
if (!match) {
|
|
21889
|
-
logger$e.throwArgumentError("invalid fixed format", "format", value);
|
|
21890
|
-
}
|
|
21891
|
-
signed = (match[1] !== "u");
|
|
21892
|
-
width = parseInt(match[2]);
|
|
21893
|
-
decimals = parseInt(match[3]);
|
|
21894
|
-
}
|
|
21895
|
-
}
|
|
21896
|
-
else if (value) {
|
|
21897
|
-
const check = (key, type, defaultValue) => {
|
|
21898
|
-
if (value[key] == null) {
|
|
21899
|
-
return defaultValue;
|
|
21900
|
-
}
|
|
21901
|
-
if (typeof (value[key]) !== type) {
|
|
21902
|
-
logger$e.throwArgumentError("invalid fixed format (" + key + " not " + type + ")", "format." + key, value[key]);
|
|
21903
|
-
}
|
|
21904
|
-
return value[key];
|
|
21905
|
-
};
|
|
21906
|
-
signed = check("signed", "boolean", signed);
|
|
21907
|
-
width = check("width", "number", width);
|
|
21908
|
-
decimals = check("decimals", "number", decimals);
|
|
21909
|
-
}
|
|
21910
|
-
if (width % 8) {
|
|
21911
|
-
logger$e.throwArgumentError("invalid fixed format width (not byte aligned)", "format.width", width);
|
|
21912
|
-
}
|
|
21913
|
-
if (decimals > 80) {
|
|
21914
|
-
logger$e.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals);
|
|
21915
|
-
}
|
|
21916
|
-
return new FixedFormat(_constructorGuard$1, signed, width, decimals);
|
|
21917
|
-
}
|
|
21918
|
-
}
|
|
21919
|
-
class FixedNumber {
|
|
21920
|
-
constructor(constructorGuard, hex, value, format) {
|
|
21921
|
-
if (constructorGuard !== _constructorGuard$1) {
|
|
21922
|
-
logger$e.throwError("cannot use FixedNumber constructor; use FixedNumber.from", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
21923
|
-
operation: "new FixedFormat"
|
|
21924
|
-
});
|
|
21925
|
-
}
|
|
21926
|
-
this.format = format;
|
|
21927
|
-
this._hex = hex;
|
|
21928
|
-
this._value = value;
|
|
21929
|
-
this._isFixedNumber = true;
|
|
21930
|
-
Object.freeze(this);
|
|
21931
|
-
}
|
|
21932
|
-
_checkFormat(other) {
|
|
21933
|
-
if (this.format.name !== other.format.name) {
|
|
21934
|
-
logger$e.throwArgumentError("incompatible format; use fixedNumber.toFormat", "other", other);
|
|
21935
|
-
}
|
|
21936
|
-
}
|
|
21937
|
-
addUnsafe(other) {
|
|
21938
|
-
this._checkFormat(other);
|
|
21939
|
-
const a = parseFixed(this._value, this.format.decimals);
|
|
21940
|
-
const b = parseFixed(other._value, other.format.decimals);
|
|
21941
|
-
return FixedNumber.fromValue(a.add(b), this.format.decimals, this.format);
|
|
21942
|
-
}
|
|
21943
|
-
subUnsafe(other) {
|
|
21944
|
-
this._checkFormat(other);
|
|
21945
|
-
const a = parseFixed(this._value, this.format.decimals);
|
|
21946
|
-
const b = parseFixed(other._value, other.format.decimals);
|
|
21947
|
-
return FixedNumber.fromValue(a.sub(b), this.format.decimals, this.format);
|
|
21948
|
-
}
|
|
21949
|
-
mulUnsafe(other) {
|
|
21950
|
-
this._checkFormat(other);
|
|
21951
|
-
const a = parseFixed(this._value, this.format.decimals);
|
|
21952
|
-
const b = parseFixed(other._value, other.format.decimals);
|
|
21953
|
-
return FixedNumber.fromValue(a.mul(b).div(this.format._multiplier), this.format.decimals, this.format);
|
|
21954
|
-
}
|
|
21955
|
-
divUnsafe(other) {
|
|
21956
|
-
this._checkFormat(other);
|
|
21957
|
-
const a = parseFixed(this._value, this.format.decimals);
|
|
21958
|
-
const b = parseFixed(other._value, other.format.decimals);
|
|
21959
|
-
return FixedNumber.fromValue(a.mul(this.format._multiplier).div(b), this.format.decimals, this.format);
|
|
21960
|
-
}
|
|
21961
|
-
floor() {
|
|
21962
|
-
const comps = this.toString().split(".");
|
|
21963
|
-
if (comps.length === 1) {
|
|
21964
|
-
comps.push("0");
|
|
21965
|
-
}
|
|
21966
|
-
let result = FixedNumber.from(comps[0], this.format);
|
|
21967
|
-
const hasFraction = !comps[1].match(/^(0*)$/);
|
|
21968
|
-
if (this.isNegative() && hasFraction) {
|
|
21969
|
-
result = result.subUnsafe(ONE.toFormat(result.format));
|
|
21970
|
-
}
|
|
21971
|
-
return result;
|
|
21972
|
-
}
|
|
21973
|
-
ceiling() {
|
|
21974
|
-
const comps = this.toString().split(".");
|
|
21975
|
-
if (comps.length === 1) {
|
|
21976
|
-
comps.push("0");
|
|
21977
|
-
}
|
|
21978
|
-
let result = FixedNumber.from(comps[0], this.format);
|
|
21979
|
-
const hasFraction = !comps[1].match(/^(0*)$/);
|
|
21980
|
-
if (!this.isNegative() && hasFraction) {
|
|
21981
|
-
result = result.addUnsafe(ONE.toFormat(result.format));
|
|
21982
|
-
}
|
|
21983
|
-
return result;
|
|
21984
|
-
}
|
|
21985
|
-
// @TODO: Support other rounding algorithms
|
|
21986
|
-
round(decimals) {
|
|
21987
|
-
if (decimals == null) {
|
|
21988
|
-
decimals = 0;
|
|
21989
|
-
}
|
|
21990
|
-
// If we are already in range, we're done
|
|
21991
|
-
const comps = this.toString().split(".");
|
|
21992
|
-
if (comps.length === 1) {
|
|
21993
|
-
comps.push("0");
|
|
21994
|
-
}
|
|
21995
|
-
if (decimals < 0 || decimals > 80 || (decimals % 1)) {
|
|
21996
|
-
logger$e.throwArgumentError("invalid decimal count", "decimals", decimals);
|
|
21997
|
-
}
|
|
21998
|
-
if (comps[1].length <= decimals) {
|
|
21999
|
-
return this;
|
|
22000
|
-
}
|
|
22001
|
-
const factor = FixedNumber.from("1" + zeros.substring(0, decimals), this.format);
|
|
22002
|
-
const bump = BUMP.toFormat(this.format);
|
|
22003
|
-
return this.mulUnsafe(factor).addUnsafe(bump).floor().divUnsafe(factor);
|
|
22004
|
-
}
|
|
22005
|
-
isZero() {
|
|
22006
|
-
return (this._value === "0.0" || this._value === "0");
|
|
22007
|
-
}
|
|
22008
|
-
isNegative() {
|
|
22009
|
-
return (this._value[0] === "-");
|
|
22010
|
-
}
|
|
22011
|
-
toString() { return this._value; }
|
|
22012
|
-
toHexString(width) {
|
|
22013
|
-
if (width == null) {
|
|
22014
|
-
return this._hex;
|
|
22015
|
-
}
|
|
22016
|
-
if (width % 8) {
|
|
22017
|
-
logger$e.throwArgumentError("invalid byte width", "width", width);
|
|
22018
|
-
}
|
|
22019
|
-
const hex = BigNumber.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString();
|
|
22020
|
-
return hexZeroPad(hex, width / 8);
|
|
22021
|
-
}
|
|
22022
|
-
toUnsafeFloat() { return parseFloat(this.toString()); }
|
|
22023
|
-
toFormat(format) {
|
|
22024
|
-
return FixedNumber.fromString(this._value, format);
|
|
22025
|
-
}
|
|
22026
|
-
static fromValue(value, decimals, format) {
|
|
22027
|
-
// If decimals looks more like a format, and there is no format, shift the parameters
|
|
22028
|
-
if (format == null && decimals != null && !isBigNumberish(decimals)) {
|
|
22029
|
-
format = decimals;
|
|
22030
|
-
decimals = null;
|
|
22031
|
-
}
|
|
22032
|
-
if (decimals == null) {
|
|
22033
|
-
decimals = 0;
|
|
22034
|
-
}
|
|
22035
|
-
if (format == null) {
|
|
22036
|
-
format = "fixed";
|
|
22037
|
-
}
|
|
22038
|
-
return FixedNumber.fromString(formatFixed(value, decimals), FixedFormat.from(format));
|
|
22039
|
-
}
|
|
22040
|
-
static fromString(value, format) {
|
|
22041
|
-
if (format == null) {
|
|
22042
|
-
format = "fixed";
|
|
22043
|
-
}
|
|
22044
|
-
const fixedFormat = FixedFormat.from(format);
|
|
22045
|
-
const numeric = parseFixed(value, fixedFormat.decimals);
|
|
22046
|
-
if (!fixedFormat.signed && numeric.lt(Zero$1)) {
|
|
22047
|
-
throwFault("unsigned value cannot be negative", "overflow", "value", value);
|
|
22048
|
-
}
|
|
22049
|
-
let hex = null;
|
|
22050
|
-
if (fixedFormat.signed) {
|
|
22051
|
-
hex = numeric.toTwos(fixedFormat.width).toHexString();
|
|
22052
|
-
}
|
|
22053
|
-
else {
|
|
22054
|
-
hex = numeric.toHexString();
|
|
22055
|
-
hex = hexZeroPad(hex, fixedFormat.width / 8);
|
|
22056
|
-
}
|
|
22057
|
-
const decimal = formatFixed(numeric, fixedFormat.decimals);
|
|
22058
|
-
return new FixedNumber(_constructorGuard$1, hex, decimal, fixedFormat);
|
|
22059
|
-
}
|
|
22060
|
-
static fromBytes(value, format) {
|
|
22061
|
-
if (format == null) {
|
|
22062
|
-
format = "fixed";
|
|
22063
|
-
}
|
|
22064
|
-
const fixedFormat = FixedFormat.from(format);
|
|
22065
|
-
if (arrayify(value).length > fixedFormat.width / 8) {
|
|
22066
|
-
throw new Error("overflow");
|
|
22067
|
-
}
|
|
22068
|
-
let numeric = BigNumber.from(value);
|
|
22069
|
-
if (fixedFormat.signed) {
|
|
22070
|
-
numeric = numeric.fromTwos(fixedFormat.width);
|
|
22071
|
-
}
|
|
22072
|
-
const hex = numeric.toTwos((fixedFormat.signed ? 0 : 1) + fixedFormat.width).toHexString();
|
|
22073
|
-
const decimal = formatFixed(numeric, fixedFormat.decimals);
|
|
22074
|
-
return new FixedNumber(_constructorGuard$1, hex, decimal, fixedFormat);
|
|
22075
|
-
}
|
|
22076
|
-
static from(value, format) {
|
|
22077
|
-
if (typeof (value) === "string") {
|
|
22078
|
-
return FixedNumber.fromString(value, format);
|
|
22079
|
-
}
|
|
22080
|
-
if (isBytes(value)) {
|
|
22081
|
-
return FixedNumber.fromBytes(value, format);
|
|
22082
|
-
}
|
|
22083
|
-
try {
|
|
22084
|
-
return FixedNumber.fromValue(value, 0, format);
|
|
22085
|
-
}
|
|
22086
|
-
catch (error) {
|
|
22087
|
-
// Allow NUMERIC_FAULT to bubble up
|
|
22088
|
-
if (error.code !== Logger.errors.INVALID_ARGUMENT) {
|
|
22089
|
-
throw error;
|
|
22090
|
-
}
|
|
22091
|
-
}
|
|
22092
|
-
return logger$e.throwArgumentError("invalid FixedNumber value", "value", value);
|
|
22093
|
-
}
|
|
22094
|
-
static isFixedNumber(value) {
|
|
22095
|
-
return !!(value && value._isFixedNumber);
|
|
22096
|
-
}
|
|
22097
|
-
}
|
|
22098
|
-
const ONE = FixedNumber.from(1);
|
|
22099
|
-
const BUMP = FixedNumber.from("0.5");
|
|
22100
|
-
|
|
22101
|
-
const version$9 = "properties/5.7.0";
|
|
21739
|
+
const version$8 = "properties/5.7.0";
|
|
22102
21740
|
|
|
22103
21741
|
var __awaiter$3 = function (thisArg, _arguments, P, generator) {
|
|
22104
21742
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -22109,7 +21747,7 @@ var __awaiter$3 = function (thisArg, _arguments, P, generator) {
|
|
|
22109
21747
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
22110
21748
|
});
|
|
22111
21749
|
};
|
|
22112
|
-
const logger$
|
|
21750
|
+
const logger$c = new Logger(version$8);
|
|
22113
21751
|
function defineReadOnly(object, name, value) {
|
|
22114
21752
|
Object.defineProperty(object, name, {
|
|
22115
21753
|
enumerable: true,
|
|
@@ -22177,7 +21815,7 @@ function _isFrozen(object) {
|
|
|
22177
21815
|
}
|
|
22178
21816
|
return true;
|
|
22179
21817
|
}
|
|
22180
|
-
return logger$
|
|
21818
|
+
return logger$c.throwArgumentError(`Cannot deepCopy ${typeof (object)}`, "object", object);
|
|
22181
21819
|
}
|
|
22182
21820
|
// Returns a new copy of object, such that no properties may be replaced.
|
|
22183
21821
|
// New properties may be added only to objects.
|
|
@@ -22200,7 +21838,7 @@ function _deepCopy(object) {
|
|
|
22200
21838
|
}
|
|
22201
21839
|
return result;
|
|
22202
21840
|
}
|
|
22203
|
-
return logger$
|
|
21841
|
+
return logger$c.throwArgumentError(`Cannot deepCopy ${typeof (object)}`, "object", object);
|
|
22204
21842
|
}
|
|
22205
21843
|
function deepCopy(object) {
|
|
22206
21844
|
return _deepCopy(object);
|
|
@@ -22213,9 +21851,9 @@ class Description {
|
|
|
22213
21851
|
}
|
|
22214
21852
|
}
|
|
22215
21853
|
|
|
22216
|
-
const version$
|
|
21854
|
+
const version$7 = "abi/5.7.0";
|
|
22217
21855
|
|
|
22218
|
-
const logger$
|
|
21856
|
+
const logger$b = new Logger(version$7);
|
|
22219
21857
|
const _constructorGuard = {};
|
|
22220
21858
|
let ModifiersBytes = { calldata: true, memory: true, storage: true };
|
|
22221
21859
|
let ModifiersNest = { calldata: true, memory: true };
|
|
@@ -22236,7 +21874,7 @@ function checkModifier(type, name) {
|
|
|
22236
21874
|
}
|
|
22237
21875
|
}
|
|
22238
21876
|
if (ModifiersBytes[name] || name === "payable") {
|
|
22239
|
-
logger$
|
|
21877
|
+
logger$b.throwArgumentError("invalid modifier", "name", name);
|
|
22240
21878
|
}
|
|
22241
21879
|
return false;
|
|
22242
21880
|
}
|
|
@@ -22244,7 +21882,7 @@ function checkModifier(type, name) {
|
|
|
22244
21882
|
function parseParamType(param, allowIndexed) {
|
|
22245
21883
|
let originalParam = param;
|
|
22246
21884
|
function throwError(i) {
|
|
22247
|
-
logger$
|
|
21885
|
+
logger$b.throwArgumentError(`unexpected character at position ${i}`, "param", param);
|
|
22248
21886
|
}
|
|
22249
21887
|
param = param.replace(/\s/g, " ");
|
|
22250
21888
|
function newNode(parent) {
|
|
@@ -22383,7 +22021,7 @@ function parseParamType(param, allowIndexed) {
|
|
|
22383
22021
|
}
|
|
22384
22022
|
}
|
|
22385
22023
|
if (node.parent) {
|
|
22386
|
-
logger$
|
|
22024
|
+
logger$b.throwArgumentError("unexpected eof", "param", param);
|
|
22387
22025
|
}
|
|
22388
22026
|
delete parent.state;
|
|
22389
22027
|
if (node.name === "indexed") {
|
|
@@ -22421,7 +22059,7 @@ const paramTypeArray = new RegExp(/^(.*)\[([0-9]*)\]$/);
|
|
|
22421
22059
|
class ParamType {
|
|
22422
22060
|
constructor(constructorGuard, params) {
|
|
22423
22061
|
if (constructorGuard !== _constructorGuard) {
|
|
22424
|
-
logger$
|
|
22062
|
+
logger$b.throwError("use fromString", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
22425
22063
|
operation: "new ParamType()"
|
|
22426
22064
|
});
|
|
22427
22065
|
}
|
|
@@ -22456,7 +22094,7 @@ class ParamType {
|
|
|
22456
22094
|
format = FormatTypes.sighash;
|
|
22457
22095
|
}
|
|
22458
22096
|
if (!FormatTypes[format]) {
|
|
22459
|
-
logger$
|
|
22097
|
+
logger$b.throwArgumentError("invalid format type", "format", format);
|
|
22460
22098
|
}
|
|
22461
22099
|
if (format === FormatTypes.json) {
|
|
22462
22100
|
let result = {
|
|
@@ -22536,7 +22174,7 @@ function parseParams(value, allowIndex) {
|
|
|
22536
22174
|
class Fragment {
|
|
22537
22175
|
constructor(constructorGuard, params) {
|
|
22538
22176
|
if (constructorGuard !== _constructorGuard) {
|
|
22539
|
-
logger$
|
|
22177
|
+
logger$b.throwError("use a static from method", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
22540
22178
|
operation: "new Fragment()"
|
|
22541
22179
|
});
|
|
22542
22180
|
}
|
|
@@ -22571,7 +22209,7 @@ class Fragment {
|
|
|
22571
22209
|
// @TODO: Something? Maybe return a FunctionFragment? A custom DefaultFunctionFragment?
|
|
22572
22210
|
return null;
|
|
22573
22211
|
}
|
|
22574
|
-
return logger$
|
|
22212
|
+
return logger$b.throwArgumentError("invalid fragment object", "value", value);
|
|
22575
22213
|
}
|
|
22576
22214
|
static fromString(value) {
|
|
22577
22215
|
// Make sure the "returns" is surrounded by a space and all whitespace is exactly one space
|
|
@@ -22590,7 +22228,7 @@ class Fragment {
|
|
|
22590
22228
|
else if (value.split(" ")[0] === "error") {
|
|
22591
22229
|
return ErrorFragment.fromString(value.substring(5).trim());
|
|
22592
22230
|
}
|
|
22593
|
-
return logger$
|
|
22231
|
+
return logger$b.throwArgumentError("unsupported fragment", "value", value);
|
|
22594
22232
|
}
|
|
22595
22233
|
static isFragment(value) {
|
|
22596
22234
|
return !!(value && value._isFragment);
|
|
@@ -22602,7 +22240,7 @@ class EventFragment extends Fragment {
|
|
|
22602
22240
|
format = FormatTypes.sighash;
|
|
22603
22241
|
}
|
|
22604
22242
|
if (!FormatTypes[format]) {
|
|
22605
|
-
logger$
|
|
22243
|
+
logger$b.throwArgumentError("invalid format type", "format", format);
|
|
22606
22244
|
}
|
|
22607
22245
|
if (format === FormatTypes.json) {
|
|
22608
22246
|
return JSON.stringify({
|
|
@@ -22635,7 +22273,7 @@ class EventFragment extends Fragment {
|
|
|
22635
22273
|
return value;
|
|
22636
22274
|
}
|
|
22637
22275
|
if (value.type !== "event") {
|
|
22638
|
-
logger$
|
|
22276
|
+
logger$b.throwArgumentError("invalid event object", "value", value);
|
|
22639
22277
|
}
|
|
22640
22278
|
const params = {
|
|
22641
22279
|
name: verifyIdentifier(value.name),
|
|
@@ -22648,7 +22286,7 @@ class EventFragment extends Fragment {
|
|
|
22648
22286
|
static fromString(value) {
|
|
22649
22287
|
let match = value.match(regexParen);
|
|
22650
22288
|
if (!match) {
|
|
22651
|
-
logger$
|
|
22289
|
+
logger$b.throwArgumentError("invalid event string", "value", value);
|
|
22652
22290
|
}
|
|
22653
22291
|
let anonymous = false;
|
|
22654
22292
|
match[3].split(" ").forEach((modifier) => {
|
|
@@ -22659,7 +22297,7 @@ class EventFragment extends Fragment {
|
|
|
22659
22297
|
case "":
|
|
22660
22298
|
break;
|
|
22661
22299
|
default:
|
|
22662
|
-
logger$
|
|
22300
|
+
logger$b.warn("unknown modifier: " + modifier);
|
|
22663
22301
|
}
|
|
22664
22302
|
});
|
|
22665
22303
|
return EventFragment.fromObject({
|
|
@@ -22678,10 +22316,10 @@ function parseGas(value, params) {
|
|
|
22678
22316
|
let comps = value.split("@");
|
|
22679
22317
|
if (comps.length !== 1) {
|
|
22680
22318
|
if (comps.length > 2) {
|
|
22681
|
-
logger$
|
|
22319
|
+
logger$b.throwArgumentError("invalid human-readable ABI signature", "value", value);
|
|
22682
22320
|
}
|
|
22683
22321
|
if (!comps[1].match(/^[0-9]+$/)) {
|
|
22684
|
-
logger$
|
|
22322
|
+
logger$b.throwArgumentError("invalid human-readable ABI signature gas", "value", value);
|
|
22685
22323
|
}
|
|
22686
22324
|
params.gas = BigNumber.from(comps[1]);
|
|
22687
22325
|
return comps[0];
|
|
@@ -22734,14 +22372,14 @@ function verifyState(value) {
|
|
|
22734
22372
|
result.constant = (result.stateMutability === "view" || result.stateMutability === "pure");
|
|
22735
22373
|
if (value.constant != null) {
|
|
22736
22374
|
if ((!!value.constant) !== result.constant) {
|
|
22737
|
-
logger$
|
|
22375
|
+
logger$b.throwArgumentError("cannot have constant function with mutability " + result.stateMutability, "value", value);
|
|
22738
22376
|
}
|
|
22739
22377
|
}
|
|
22740
22378
|
// Set (and check things are consistent) the payable property
|
|
22741
22379
|
result.payable = (result.stateMutability === "payable");
|
|
22742
22380
|
if (value.payable != null) {
|
|
22743
22381
|
if ((!!value.payable) !== result.payable) {
|
|
22744
|
-
logger$
|
|
22382
|
+
logger$b.throwArgumentError("cannot have payable function with mutability " + result.stateMutability, "value", value);
|
|
22745
22383
|
}
|
|
22746
22384
|
}
|
|
22747
22385
|
}
|
|
@@ -22749,7 +22387,7 @@ function verifyState(value) {
|
|
|
22749
22387
|
result.payable = !!value.payable;
|
|
22750
22388
|
// If payable we can assume non-constant; otherwise we can't assume
|
|
22751
22389
|
if (value.constant == null && !result.payable && value.type !== "constructor") {
|
|
22752
|
-
logger$
|
|
22390
|
+
logger$b.throwArgumentError("unable to determine stateMutability", "value", value);
|
|
22753
22391
|
}
|
|
22754
22392
|
result.constant = !!value.constant;
|
|
22755
22393
|
if (result.constant) {
|
|
@@ -22759,7 +22397,7 @@ function verifyState(value) {
|
|
|
22759
22397
|
result.stateMutability = (result.payable ? "payable" : "nonpayable");
|
|
22760
22398
|
}
|
|
22761
22399
|
if (result.payable && result.constant) {
|
|
22762
|
-
logger$
|
|
22400
|
+
logger$b.throwArgumentError("cannot have constant payable function", "value", value);
|
|
22763
22401
|
}
|
|
22764
22402
|
}
|
|
22765
22403
|
else if (value.constant != null) {
|
|
@@ -22768,7 +22406,7 @@ function verifyState(value) {
|
|
|
22768
22406
|
result.stateMutability = (result.constant ? "view" : "payable");
|
|
22769
22407
|
}
|
|
22770
22408
|
else if (value.type !== "constructor") {
|
|
22771
|
-
logger$
|
|
22409
|
+
logger$b.throwArgumentError("unable to determine stateMutability", "value", value);
|
|
22772
22410
|
}
|
|
22773
22411
|
return result;
|
|
22774
22412
|
}
|
|
@@ -22778,7 +22416,7 @@ class ConstructorFragment extends Fragment {
|
|
|
22778
22416
|
format = FormatTypes.sighash;
|
|
22779
22417
|
}
|
|
22780
22418
|
if (!FormatTypes[format]) {
|
|
22781
|
-
logger$
|
|
22419
|
+
logger$b.throwArgumentError("invalid format type", "format", format);
|
|
22782
22420
|
}
|
|
22783
22421
|
if (format === FormatTypes.json) {
|
|
22784
22422
|
return JSON.stringify({
|
|
@@ -22790,7 +22428,7 @@ class ConstructorFragment extends Fragment {
|
|
|
22790
22428
|
});
|
|
22791
22429
|
}
|
|
22792
22430
|
if (format === FormatTypes.sighash) {
|
|
22793
|
-
logger$
|
|
22431
|
+
logger$b.throwError("cannot format a constructor for sighash", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
22794
22432
|
operation: "format(sighash)"
|
|
22795
22433
|
});
|
|
22796
22434
|
}
|
|
@@ -22811,11 +22449,11 @@ class ConstructorFragment extends Fragment {
|
|
|
22811
22449
|
return value;
|
|
22812
22450
|
}
|
|
22813
22451
|
if (value.type !== "constructor") {
|
|
22814
|
-
logger$
|
|
22452
|
+
logger$b.throwArgumentError("invalid constructor object", "value", value);
|
|
22815
22453
|
}
|
|
22816
22454
|
let state = verifyState(value);
|
|
22817
22455
|
if (state.constant) {
|
|
22818
|
-
logger$
|
|
22456
|
+
logger$b.throwArgumentError("constructor cannot be constant", "value", value);
|
|
22819
22457
|
}
|
|
22820
22458
|
const params = {
|
|
22821
22459
|
name: null,
|
|
@@ -22832,7 +22470,7 @@ class ConstructorFragment extends Fragment {
|
|
|
22832
22470
|
value = parseGas(value, params);
|
|
22833
22471
|
let parens = value.match(regexParen);
|
|
22834
22472
|
if (!parens || parens[1].trim() !== "constructor") {
|
|
22835
|
-
logger$
|
|
22473
|
+
logger$b.throwArgumentError("invalid constructor string", "value", value);
|
|
22836
22474
|
}
|
|
22837
22475
|
params.inputs = parseParams(parens[2].trim(), false);
|
|
22838
22476
|
parseModifiers(parens[3].trim(), params);
|
|
@@ -22848,7 +22486,7 @@ class FunctionFragment extends ConstructorFragment {
|
|
|
22848
22486
|
format = FormatTypes.sighash;
|
|
22849
22487
|
}
|
|
22850
22488
|
if (!FormatTypes[format]) {
|
|
22851
|
-
logger$
|
|
22489
|
+
logger$b.throwArgumentError("invalid format type", "format", format);
|
|
22852
22490
|
}
|
|
22853
22491
|
if (format === FormatTypes.json) {
|
|
22854
22492
|
return JSON.stringify({
|
|
@@ -22896,7 +22534,7 @@ class FunctionFragment extends ConstructorFragment {
|
|
|
22896
22534
|
return value;
|
|
22897
22535
|
}
|
|
22898
22536
|
if (value.type !== "function") {
|
|
22899
|
-
logger$
|
|
22537
|
+
logger$b.throwArgumentError("invalid function object", "value", value);
|
|
22900
22538
|
}
|
|
22901
22539
|
let state = verifyState(value);
|
|
22902
22540
|
const params = {
|
|
@@ -22916,11 +22554,11 @@ class FunctionFragment extends ConstructorFragment {
|
|
|
22916
22554
|
value = parseGas(value, params);
|
|
22917
22555
|
let comps = value.split(" returns ");
|
|
22918
22556
|
if (comps.length > 2) {
|
|
22919
|
-
logger$
|
|
22557
|
+
logger$b.throwArgumentError("invalid function string", "value", value);
|
|
22920
22558
|
}
|
|
22921
22559
|
let parens = comps[0].match(regexParen);
|
|
22922
22560
|
if (!parens) {
|
|
22923
|
-
logger$
|
|
22561
|
+
logger$b.throwArgumentError("invalid function signature", "value", value);
|
|
22924
22562
|
}
|
|
22925
22563
|
params.name = parens[1].trim();
|
|
22926
22564
|
if (params.name) {
|
|
@@ -22932,7 +22570,7 @@ class FunctionFragment extends ConstructorFragment {
|
|
|
22932
22570
|
if (comps.length > 1) {
|
|
22933
22571
|
let returns = comps[1].match(regexParen);
|
|
22934
22572
|
if (returns[1].trim() != "" || returns[3].trim() != "") {
|
|
22935
|
-
logger$
|
|
22573
|
+
logger$b.throwArgumentError("unexpected tokens", "value", value);
|
|
22936
22574
|
}
|
|
22937
22575
|
params.outputs = parseParams(returns[2], false);
|
|
22938
22576
|
}
|
|
@@ -22950,7 +22588,7 @@ class FunctionFragment extends ConstructorFragment {
|
|
|
22950
22588
|
function checkForbidden(fragment) {
|
|
22951
22589
|
const sig = fragment.format();
|
|
22952
22590
|
if (sig === "Error(string)" || sig === "Panic(uint256)") {
|
|
22953
|
-
logger$
|
|
22591
|
+
logger$b.throwArgumentError(`cannot specify user defined ${sig} error`, "fragment", fragment);
|
|
22954
22592
|
}
|
|
22955
22593
|
return fragment;
|
|
22956
22594
|
}
|
|
@@ -22960,7 +22598,7 @@ class ErrorFragment extends Fragment {
|
|
|
22960
22598
|
format = FormatTypes.sighash;
|
|
22961
22599
|
}
|
|
22962
22600
|
if (!FormatTypes[format]) {
|
|
22963
|
-
logger$
|
|
22601
|
+
logger$b.throwArgumentError("invalid format type", "format", format);
|
|
22964
22602
|
}
|
|
22965
22603
|
if (format === FormatTypes.json) {
|
|
22966
22604
|
return JSON.stringify({
|
|
@@ -22987,7 +22625,7 @@ class ErrorFragment extends Fragment {
|
|
|
22987
22625
|
return value;
|
|
22988
22626
|
}
|
|
22989
22627
|
if (value.type !== "error") {
|
|
22990
|
-
logger$
|
|
22628
|
+
logger$b.throwArgumentError("invalid error object", "value", value);
|
|
22991
22629
|
}
|
|
22992
22630
|
const params = {
|
|
22993
22631
|
type: value.type,
|
|
@@ -23000,7 +22638,7 @@ class ErrorFragment extends Fragment {
|
|
|
23000
22638
|
let params = { type: "error" };
|
|
23001
22639
|
let parens = value.match(regexParen);
|
|
23002
22640
|
if (!parens) {
|
|
23003
|
-
logger$
|
|
22641
|
+
logger$b.throwArgumentError("invalid error signature", "value", value);
|
|
23004
22642
|
}
|
|
23005
22643
|
params.name = parens[1].trim();
|
|
23006
22644
|
if (params.name) {
|
|
@@ -23028,7 +22666,7 @@ function verifyType(type) {
|
|
|
23028
22666
|
const regexIdentifier = new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");
|
|
23029
22667
|
function verifyIdentifier(value) {
|
|
23030
22668
|
if (!value || !value.match(regexIdentifier)) {
|
|
23031
|
-
logger$
|
|
22669
|
+
logger$b.throwArgumentError(`invalid identifier "${value}"`, "value", value);
|
|
23032
22670
|
}
|
|
23033
22671
|
return value;
|
|
23034
22672
|
}
|
|
@@ -23052,7 +22690,7 @@ function splitNesting(value) {
|
|
|
23052
22690
|
else if (c === ")") {
|
|
23053
22691
|
depth--;
|
|
23054
22692
|
if (depth === -1) {
|
|
23055
|
-
logger$
|
|
22693
|
+
logger$b.throwArgumentError("unbalanced parenthesis", "value", value);
|
|
23056
22694
|
}
|
|
23057
22695
|
}
|
|
23058
22696
|
}
|
|
@@ -23063,7 +22701,7 @@ function splitNesting(value) {
|
|
|
23063
22701
|
return result;
|
|
23064
22702
|
}
|
|
23065
22703
|
|
|
23066
|
-
const logger$
|
|
22704
|
+
const logger$a = new Logger(version$7);
|
|
23067
22705
|
function checkResultErrors(result) {
|
|
23068
22706
|
// Find the first error (if any)
|
|
23069
22707
|
const errors = [];
|
|
@@ -23094,7 +22732,7 @@ class Coder {
|
|
|
23094
22732
|
this.dynamic = dynamic;
|
|
23095
22733
|
}
|
|
23096
22734
|
_throwError(message, value) {
|
|
23097
|
-
logger$
|
|
22735
|
+
logger$a.throwArgumentError(message, this.localName, value);
|
|
23098
22736
|
}
|
|
23099
22737
|
}
|
|
23100
22738
|
class Writer {
|
|
@@ -23128,7 +22766,7 @@ class Writer {
|
|
|
23128
22766
|
_getValue(value) {
|
|
23129
22767
|
let bytes = arrayify(BigNumber.from(value));
|
|
23130
22768
|
if (bytes.length > this.wordSize) {
|
|
23131
|
-
logger$
|
|
22769
|
+
logger$a.throwError("value out-of-bounds", Logger.errors.BUFFER_OVERRUN, {
|
|
23132
22770
|
length: this.wordSize,
|
|
23133
22771
|
offset: bytes.length
|
|
23134
22772
|
});
|
|
@@ -23182,7 +22820,7 @@ class Reader {
|
|
|
23182
22820
|
alignedLength = length;
|
|
23183
22821
|
}
|
|
23184
22822
|
else {
|
|
23185
|
-
logger$
|
|
22823
|
+
logger$a.throwError("data out-of-bounds", Logger.errors.BUFFER_OVERRUN, {
|
|
23186
22824
|
length: this._data.length,
|
|
23187
22825
|
offset: this._offset + alignedLength
|
|
23188
22826
|
});
|
|
@@ -23866,9 +23504,9 @@ function keccak256(data) {
|
|
|
23866
23504
|
return '0x' + sha3.keccak_256(arrayify(data));
|
|
23867
23505
|
}
|
|
23868
23506
|
|
|
23869
|
-
const version$
|
|
23507
|
+
const version$6 = "rlp/5.7.0";
|
|
23870
23508
|
|
|
23871
|
-
const logger$
|
|
23509
|
+
const logger$9 = new Logger(version$6);
|
|
23872
23510
|
function arrayifyInteger(value) {
|
|
23873
23511
|
const result = [];
|
|
23874
23512
|
while (value) {
|
|
@@ -23892,7 +23530,7 @@ function _encode(object) {
|
|
|
23892
23530
|
return length.concat(payload);
|
|
23893
23531
|
}
|
|
23894
23532
|
if (!isBytesLike(object)) {
|
|
23895
|
-
logger$
|
|
23533
|
+
logger$9.throwArgumentError("RLP object must be BytesLike", "object", object);
|
|
23896
23534
|
}
|
|
23897
23535
|
const data = Array.prototype.slice.call(arrayify(object));
|
|
23898
23536
|
if (data.length === 1 && data[0] <= 0x7f) {
|
|
@@ -23910,12 +23548,12 @@ function encode(object) {
|
|
|
23910
23548
|
return hexlify(_encode(object));
|
|
23911
23549
|
}
|
|
23912
23550
|
|
|
23913
|
-
const version$
|
|
23551
|
+
const version$5 = "address/5.7.0";
|
|
23914
23552
|
|
|
23915
|
-
const logger$
|
|
23553
|
+
const logger$8 = new Logger(version$5);
|
|
23916
23554
|
function getChecksumAddress(address) {
|
|
23917
23555
|
if (!isHexString(address, 20)) {
|
|
23918
|
-
logger$
|
|
23556
|
+
logger$8.throwArgumentError("invalid address", "address", address);
|
|
23919
23557
|
}
|
|
23920
23558
|
address = address.toLowerCase();
|
|
23921
23559
|
const chars = address.substring(2).split("");
|
|
@@ -23971,7 +23609,7 @@ function ibanChecksum(address) {
|
|
|
23971
23609
|
function getAddress(address) {
|
|
23972
23610
|
let result = null;
|
|
23973
23611
|
if (typeof (address) !== "string") {
|
|
23974
|
-
logger$
|
|
23612
|
+
logger$8.throwArgumentError("invalid address", "address", address);
|
|
23975
23613
|
}
|
|
23976
23614
|
if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {
|
|
23977
23615
|
// Missing the 0x prefix
|
|
@@ -23981,14 +23619,14 @@ function getAddress(address) {
|
|
|
23981
23619
|
result = getChecksumAddress(address);
|
|
23982
23620
|
// It is a checksummed address with a bad checksum
|
|
23983
23621
|
if (address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && result !== address) {
|
|
23984
|
-
logger$
|
|
23622
|
+
logger$8.throwArgumentError("bad address checksum", "address", address);
|
|
23985
23623
|
}
|
|
23986
23624
|
// Maybe ICAP? (we only support direct mode)
|
|
23987
23625
|
}
|
|
23988
23626
|
else if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {
|
|
23989
23627
|
// It is an ICAP address with a bad checksum
|
|
23990
23628
|
if (address.substring(2, 4) !== ibanChecksum(address)) {
|
|
23991
|
-
logger$
|
|
23629
|
+
logger$8.throwArgumentError("bad icap checksum", "address", address);
|
|
23992
23630
|
}
|
|
23993
23631
|
result = _base36To16(address.substring(4));
|
|
23994
23632
|
while (result.length < 40) {
|
|
@@ -23997,7 +23635,7 @@ function getAddress(address) {
|
|
|
23997
23635
|
result = getChecksumAddress("0x" + result);
|
|
23998
23636
|
}
|
|
23999
23637
|
else {
|
|
24000
|
-
logger$
|
|
23638
|
+
logger$8.throwArgumentError("invalid address", "address", address);
|
|
24001
23639
|
}
|
|
24002
23640
|
return result;
|
|
24003
23641
|
}
|
|
@@ -24016,7 +23654,7 @@ function getContractAddress(transaction) {
|
|
|
24016
23654
|
from = getAddress(transaction.from);
|
|
24017
23655
|
}
|
|
24018
23656
|
catch (error) {
|
|
24019
|
-
logger$
|
|
23657
|
+
logger$8.throwArgumentError("missing from address", "transaction", transaction);
|
|
24020
23658
|
}
|
|
24021
23659
|
const nonce = stripZeros(arrayify(BigNumber.from(transaction.nonce).toHexString()));
|
|
24022
23660
|
return getAddress(hexDataSlice(keccak256(encode([from, nonce])), 12));
|
|
@@ -24060,7 +23698,7 @@ class AnonymousCoder extends Coder {
|
|
|
24060
23698
|
}
|
|
24061
23699
|
}
|
|
24062
23700
|
|
|
24063
|
-
const logger$
|
|
23701
|
+
const logger$7 = new Logger(version$7);
|
|
24064
23702
|
function pack(writer, coders, values) {
|
|
24065
23703
|
let arrayValues = null;
|
|
24066
23704
|
if (Array.isArray(values)) {
|
|
@@ -24071,14 +23709,14 @@ function pack(writer, coders, values) {
|
|
|
24071
23709
|
arrayValues = coders.map((coder) => {
|
|
24072
23710
|
const name = coder.localName;
|
|
24073
23711
|
if (!name) {
|
|
24074
|
-
logger$
|
|
23712
|
+
logger$7.throwError("cannot encode object for signature with missing names", Logger.errors.INVALID_ARGUMENT, {
|
|
24075
23713
|
argument: "values",
|
|
24076
23714
|
coder: coder,
|
|
24077
23715
|
value: values
|
|
24078
23716
|
});
|
|
24079
23717
|
}
|
|
24080
23718
|
if (unique[name]) {
|
|
24081
|
-
logger$
|
|
23719
|
+
logger$7.throwError("cannot encode object for signature with duplicate names", Logger.errors.INVALID_ARGUMENT, {
|
|
24082
23720
|
argument: "values",
|
|
24083
23721
|
coder: coder,
|
|
24084
23722
|
value: values
|
|
@@ -24089,10 +23727,10 @@ function pack(writer, coders, values) {
|
|
|
24089
23727
|
});
|
|
24090
23728
|
}
|
|
24091
23729
|
else {
|
|
24092
|
-
logger$
|
|
23730
|
+
logger$7.throwArgumentError("invalid tuple value", "tuple", values);
|
|
24093
23731
|
}
|
|
24094
23732
|
if (coders.length !== arrayValues.length) {
|
|
24095
|
-
logger$
|
|
23733
|
+
logger$7.throwArgumentError("types/value length mismatch", "tuple", values);
|
|
24096
23734
|
}
|
|
24097
23735
|
let staticWriter = new Writer(writer.wordSize);
|
|
24098
23736
|
let dynamicWriter = new Writer(writer.wordSize);
|
|
@@ -24233,7 +23871,7 @@ class ArrayCoder extends Coder {
|
|
|
24233
23871
|
count = value.length;
|
|
24234
23872
|
writer.writeValue(value.length);
|
|
24235
23873
|
}
|
|
24236
|
-
logger$
|
|
23874
|
+
logger$7.checkArgumentCount(value.length, count, "coder array" + (this.localName ? (" " + this.localName) : ""));
|
|
24237
23875
|
let coders = [];
|
|
24238
23876
|
for (let i = 0; i < value.length; i++) {
|
|
24239
23877
|
coders.push(this.coder);
|
|
@@ -24250,7 +23888,7 @@ class ArrayCoder extends Coder {
|
|
|
24250
23888
|
// bytes as a link to the data). This could use a much
|
|
24251
23889
|
// tighter bound, but we are erroring on the side of safety.
|
|
24252
23890
|
if (count * 32 > reader._data.length) {
|
|
24253
|
-
logger$
|
|
23891
|
+
logger$7.throwError("insufficient data length", Logger.errors.BUFFER_OVERRUN, {
|
|
24254
23892
|
length: reader._data.length,
|
|
24255
23893
|
count: count
|
|
24256
23894
|
});
|
|
@@ -24346,6 +23984,8 @@ class NullCoder extends Coder {
|
|
|
24346
23984
|
}
|
|
24347
23985
|
}
|
|
24348
23986
|
|
|
23987
|
+
const AddressZero = "0x0000000000000000000000000000000000000000";
|
|
23988
|
+
|
|
24349
23989
|
const NegativeOne = ( /*#__PURE__*/BigNumber.from(-1));
|
|
24350
23990
|
const Zero = ( /*#__PURE__*/BigNumber.from(0));
|
|
24351
23991
|
const One = ( /*#__PURE__*/BigNumber.from(1));
|
|
@@ -24389,9 +24029,9 @@ class NumberCoder extends Coder {
|
|
|
24389
24029
|
}
|
|
24390
24030
|
}
|
|
24391
24031
|
|
|
24392
|
-
const version$
|
|
24032
|
+
const version$4 = "strings/5.7.0";
|
|
24393
24033
|
|
|
24394
|
-
const logger$
|
|
24034
|
+
const logger$6 = new Logger(version$4);
|
|
24395
24035
|
///////////////////////////////
|
|
24396
24036
|
var UnicodeNormalizationForm;
|
|
24397
24037
|
(function (UnicodeNormalizationForm) {
|
|
@@ -24429,7 +24069,7 @@ var Utf8ErrorReason;
|
|
|
24429
24069
|
Utf8ErrorReason["OVERLONG"] = "overlong representation";
|
|
24430
24070
|
})(Utf8ErrorReason || (Utf8ErrorReason = {}));
|
|
24431
24071
|
function errorFunc(reason, offset, bytes, output, badCodepoint) {
|
|
24432
|
-
return logger$
|
|
24072
|
+
return logger$6.throwArgumentError(`invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes);
|
|
24433
24073
|
}
|
|
24434
24074
|
function ignoreFunc(reason, offset, bytes, output, badCodepoint) {
|
|
24435
24075
|
// If there is an invalid prefix (including stray continuation), skip any additional continuation bytes
|
|
@@ -24555,7 +24195,7 @@ function getUtf8CodePoints(bytes, onError) {
|
|
|
24555
24195
|
// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array
|
|
24556
24196
|
function toUtf8Bytes(str, form = UnicodeNormalizationForm.current) {
|
|
24557
24197
|
if (form != UnicodeNormalizationForm.current) {
|
|
24558
|
-
logger$
|
|
24198
|
+
logger$6.checkNormalize();
|
|
24559
24199
|
str = str.normalize(form);
|
|
24560
24200
|
}
|
|
24561
24201
|
let result = [];
|
|
@@ -24671,7 +24311,7 @@ class TupleCoder extends Coder {
|
|
|
24671
24311
|
}
|
|
24672
24312
|
}
|
|
24673
24313
|
|
|
24674
|
-
const logger$
|
|
24314
|
+
const logger$5 = new Logger(version$7);
|
|
24675
24315
|
const paramTypeBytes = new RegExp(/^bytes([0-9]*)$/);
|
|
24676
24316
|
const paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/);
|
|
24677
24317
|
class AbiCoder {
|
|
@@ -24702,7 +24342,7 @@ class AbiCoder {
|
|
|
24702
24342
|
if (match) {
|
|
24703
24343
|
let size = parseInt(match[2] || "256");
|
|
24704
24344
|
if (size === 0 || size > 256 || (size % 8) !== 0) {
|
|
24705
|
-
logger$
|
|
24345
|
+
logger$5.throwArgumentError("invalid " + match[1] + " bit length", "param", param);
|
|
24706
24346
|
}
|
|
24707
24347
|
return new NumberCoder(size / 8, (match[1] === "int"), param.name);
|
|
24708
24348
|
}
|
|
@@ -24711,11 +24351,11 @@ class AbiCoder {
|
|
|
24711
24351
|
if (match) {
|
|
24712
24352
|
let size = parseInt(match[1]);
|
|
24713
24353
|
if (size === 0 || size > 32) {
|
|
24714
|
-
logger$
|
|
24354
|
+
logger$5.throwArgumentError("invalid bytes length", "param", param);
|
|
24715
24355
|
}
|
|
24716
24356
|
return new FixedBytesCoder(size, param.name);
|
|
24717
24357
|
}
|
|
24718
|
-
return logger$
|
|
24358
|
+
return logger$5.throwArgumentError("invalid type", "type", param.type);
|
|
24719
24359
|
}
|
|
24720
24360
|
_getWordSize() { return 32; }
|
|
24721
24361
|
_getReader(data, allowLoose) {
|
|
@@ -24731,7 +24371,7 @@ class AbiCoder {
|
|
|
24731
24371
|
}
|
|
24732
24372
|
encode(types, values) {
|
|
24733
24373
|
if (types.length !== values.length) {
|
|
24734
|
-
logger$
|
|
24374
|
+
logger$5.throwError("types/values length mismatch", Logger.errors.INVALID_ARGUMENT, {
|
|
24735
24375
|
count: { types: types.length, values: values.length },
|
|
24736
24376
|
value: { types: types, values: values }
|
|
24737
24377
|
});
|
|
@@ -24754,7 +24394,7 @@ function id(text) {
|
|
|
24754
24394
|
return keccak256(toUtf8Bytes(text));
|
|
24755
24395
|
}
|
|
24756
24396
|
|
|
24757
|
-
const logger$
|
|
24397
|
+
const logger$4 = new Logger(version$7);
|
|
24758
24398
|
class LogDescription extends Description {
|
|
24759
24399
|
}
|
|
24760
24400
|
class TransactionDescription extends Description {
|
|
@@ -24811,7 +24451,7 @@ class Interface {
|
|
|
24811
24451
|
switch (fragment.type) {
|
|
24812
24452
|
case "constructor":
|
|
24813
24453
|
if (this.deploy) {
|
|
24814
|
-
logger$
|
|
24454
|
+
logger$4.warn("duplicate definition - constructor");
|
|
24815
24455
|
return;
|
|
24816
24456
|
}
|
|
24817
24457
|
//checkNames(fragment, "input", fragment.inputs);
|
|
@@ -24834,7 +24474,7 @@ class Interface {
|
|
|
24834
24474
|
}
|
|
24835
24475
|
let signature = fragment.format();
|
|
24836
24476
|
if (bucket[signature]) {
|
|
24837
|
-
logger$
|
|
24477
|
+
logger$4.warn("duplicate definition - " + signature);
|
|
24838
24478
|
return;
|
|
24839
24479
|
}
|
|
24840
24480
|
bucket[signature] = fragment;
|
|
@@ -24853,7 +24493,7 @@ class Interface {
|
|
|
24853
24493
|
format = FormatTypes.full;
|
|
24854
24494
|
}
|
|
24855
24495
|
if (format === FormatTypes.sighash) {
|
|
24856
|
-
logger$
|
|
24496
|
+
logger$4.throwArgumentError("interface does not support formatting sighash", "format", format);
|
|
24857
24497
|
}
|
|
24858
24498
|
const abi = this.fragments.map((fragment) => fragment.format(format));
|
|
24859
24499
|
// We need to re-bundle the JSON fragments a bit
|
|
@@ -24883,24 +24523,24 @@ class Interface {
|
|
|
24883
24523
|
return this.functions[name];
|
|
24884
24524
|
}
|
|
24885
24525
|
}
|
|
24886
|
-
logger$
|
|
24526
|
+
logger$4.throwArgumentError("no matching function", "sighash", nameOrSignatureOrSighash);
|
|
24887
24527
|
}
|
|
24888
24528
|
// It is a bare name, look up the function (will return null if ambiguous)
|
|
24889
24529
|
if (nameOrSignatureOrSighash.indexOf("(") === -1) {
|
|
24890
24530
|
const name = nameOrSignatureOrSighash.trim();
|
|
24891
24531
|
const matching = Object.keys(this.functions).filter((f) => (f.split("(" /* fix:) */)[0] === name));
|
|
24892
24532
|
if (matching.length === 0) {
|
|
24893
|
-
logger$
|
|
24533
|
+
logger$4.throwArgumentError("no matching function", "name", name);
|
|
24894
24534
|
}
|
|
24895
24535
|
else if (matching.length > 1) {
|
|
24896
|
-
logger$
|
|
24536
|
+
logger$4.throwArgumentError("multiple matching functions", "name", name);
|
|
24897
24537
|
}
|
|
24898
24538
|
return this.functions[matching[0]];
|
|
24899
24539
|
}
|
|
24900
24540
|
// Normalize the signature and lookup the function
|
|
24901
24541
|
const result = this.functions[FunctionFragment.fromString(nameOrSignatureOrSighash).format()];
|
|
24902
24542
|
if (!result) {
|
|
24903
|
-
logger$
|
|
24543
|
+
logger$4.throwArgumentError("no matching function", "signature", nameOrSignatureOrSighash);
|
|
24904
24544
|
}
|
|
24905
24545
|
return result;
|
|
24906
24546
|
}
|
|
@@ -24913,24 +24553,24 @@ class Interface {
|
|
|
24913
24553
|
return this.events[name];
|
|
24914
24554
|
}
|
|
24915
24555
|
}
|
|
24916
|
-
logger$
|
|
24556
|
+
logger$4.throwArgumentError("no matching event", "topichash", topichash);
|
|
24917
24557
|
}
|
|
24918
24558
|
// It is a bare name, look up the function (will return null if ambiguous)
|
|
24919
24559
|
if (nameOrSignatureOrTopic.indexOf("(") === -1) {
|
|
24920
24560
|
const name = nameOrSignatureOrTopic.trim();
|
|
24921
24561
|
const matching = Object.keys(this.events).filter((f) => (f.split("(" /* fix:) */)[0] === name));
|
|
24922
24562
|
if (matching.length === 0) {
|
|
24923
|
-
logger$
|
|
24563
|
+
logger$4.throwArgumentError("no matching event", "name", name);
|
|
24924
24564
|
}
|
|
24925
24565
|
else if (matching.length > 1) {
|
|
24926
|
-
logger$
|
|
24566
|
+
logger$4.throwArgumentError("multiple matching events", "name", name);
|
|
24927
24567
|
}
|
|
24928
24568
|
return this.events[matching[0]];
|
|
24929
24569
|
}
|
|
24930
24570
|
// Normalize the signature and lookup the function
|
|
24931
24571
|
const result = this.events[EventFragment.fromString(nameOrSignatureOrTopic).format()];
|
|
24932
24572
|
if (!result) {
|
|
24933
|
-
logger$
|
|
24573
|
+
logger$4.throwArgumentError("no matching event", "signature", nameOrSignatureOrTopic);
|
|
24934
24574
|
}
|
|
24935
24575
|
return result;
|
|
24936
24576
|
}
|
|
@@ -24944,24 +24584,24 @@ class Interface {
|
|
|
24944
24584
|
return this.errors[name];
|
|
24945
24585
|
}
|
|
24946
24586
|
}
|
|
24947
|
-
logger$
|
|
24587
|
+
logger$4.throwArgumentError("no matching error", "sighash", nameOrSignatureOrSighash);
|
|
24948
24588
|
}
|
|
24949
24589
|
// It is a bare name, look up the function (will return null if ambiguous)
|
|
24950
24590
|
if (nameOrSignatureOrSighash.indexOf("(") === -1) {
|
|
24951
24591
|
const name = nameOrSignatureOrSighash.trim();
|
|
24952
24592
|
const matching = Object.keys(this.errors).filter((f) => (f.split("(" /* fix:) */)[0] === name));
|
|
24953
24593
|
if (matching.length === 0) {
|
|
24954
|
-
logger$
|
|
24594
|
+
logger$4.throwArgumentError("no matching error", "name", name);
|
|
24955
24595
|
}
|
|
24956
24596
|
else if (matching.length > 1) {
|
|
24957
|
-
logger$
|
|
24597
|
+
logger$4.throwArgumentError("multiple matching errors", "name", name);
|
|
24958
24598
|
}
|
|
24959
24599
|
return this.errors[matching[0]];
|
|
24960
24600
|
}
|
|
24961
24601
|
// Normalize the signature and lookup the function
|
|
24962
24602
|
const result = this.errors[FunctionFragment.fromString(nameOrSignatureOrSighash).format()];
|
|
24963
24603
|
if (!result) {
|
|
24964
|
-
logger$
|
|
24604
|
+
logger$4.throwArgumentError("no matching error", "signature", nameOrSignatureOrSighash);
|
|
24965
24605
|
}
|
|
24966
24606
|
return result;
|
|
24967
24607
|
}
|
|
@@ -25004,7 +24644,7 @@ class Interface {
|
|
|
25004
24644
|
}
|
|
25005
24645
|
const bytes = arrayify(data);
|
|
25006
24646
|
if (hexlify(bytes.slice(0, 4)) !== this.getSighash(fragment)) {
|
|
25007
|
-
logger$
|
|
24647
|
+
logger$4.throwArgumentError(`data signature does not match error ${fragment.name}.`, "data", hexlify(bytes));
|
|
25008
24648
|
}
|
|
25009
24649
|
return this._decodeParams(fragment.inputs, bytes.slice(4));
|
|
25010
24650
|
}
|
|
@@ -25024,7 +24664,7 @@ class Interface {
|
|
|
25024
24664
|
}
|
|
25025
24665
|
const bytes = arrayify(data);
|
|
25026
24666
|
if (hexlify(bytes.slice(0, 4)) !== this.getSighash(functionFragment)) {
|
|
25027
|
-
logger$
|
|
24667
|
+
logger$4.throwArgumentError(`data signature does not match function ${functionFragment.name}.`, "data", hexlify(bytes));
|
|
25028
24668
|
}
|
|
25029
24669
|
return this._decodeParams(functionFragment.inputs, bytes.slice(4));
|
|
25030
24670
|
}
|
|
@@ -25085,7 +24725,7 @@ class Interface {
|
|
|
25085
24725
|
break;
|
|
25086
24726
|
}
|
|
25087
24727
|
}
|
|
25088
|
-
return logger$
|
|
24728
|
+
return logger$4.throwError("call revert exception" + message, Logger.errors.CALL_EXCEPTION, {
|
|
25089
24729
|
method: functionFragment.format(),
|
|
25090
24730
|
data: hexlify(data), errorArgs, errorName, errorSignature, reason
|
|
25091
24731
|
});
|
|
@@ -25103,7 +24743,7 @@ class Interface {
|
|
|
25103
24743
|
eventFragment = this.getEvent(eventFragment);
|
|
25104
24744
|
}
|
|
25105
24745
|
if (values.length > eventFragment.inputs.length) {
|
|
25106
|
-
logger$
|
|
24746
|
+
logger$4.throwError("too many arguments for " + eventFragment.format(), Logger.errors.UNEXPECTED_ARGUMENT, {
|
|
25107
24747
|
argument: "values",
|
|
25108
24748
|
value: values
|
|
25109
24749
|
});
|
|
@@ -25135,7 +24775,7 @@ class Interface {
|
|
|
25135
24775
|
let param = eventFragment.inputs[index];
|
|
25136
24776
|
if (!param.indexed) {
|
|
25137
24777
|
if (value != null) {
|
|
25138
|
-
logger$
|
|
24778
|
+
logger$4.throwArgumentError("cannot filter non-indexed parameters; must be null", ("contract." + param.name), value);
|
|
25139
24779
|
}
|
|
25140
24780
|
return;
|
|
25141
24781
|
}
|
|
@@ -25143,7 +24783,7 @@ class Interface {
|
|
|
25143
24783
|
topics.push(null);
|
|
25144
24784
|
}
|
|
25145
24785
|
else if (param.baseType === "array" || param.baseType === "tuple") {
|
|
25146
|
-
logger$
|
|
24786
|
+
logger$4.throwArgumentError("filtering with tuples or arrays not supported", ("contract." + param.name), value);
|
|
25147
24787
|
}
|
|
25148
24788
|
else if (Array.isArray(value)) {
|
|
25149
24789
|
topics.push(value.map((value) => encodeTopic(param, value)));
|
|
@@ -25169,7 +24809,7 @@ class Interface {
|
|
|
25169
24809
|
topics.push(this.getEventTopic(eventFragment));
|
|
25170
24810
|
}
|
|
25171
24811
|
if (values.length !== eventFragment.inputs.length) {
|
|
25172
|
-
logger$
|
|
24812
|
+
logger$4.throwArgumentError("event arguments/values mismatch", "values", values);
|
|
25173
24813
|
}
|
|
25174
24814
|
eventFragment.inputs.forEach((param, index) => {
|
|
25175
24815
|
const value = values[index];
|
|
@@ -25206,7 +24846,7 @@ class Interface {
|
|
|
25206
24846
|
if (topics != null && !eventFragment.anonymous) {
|
|
25207
24847
|
let topicHash = this.getEventTopic(eventFragment);
|
|
25208
24848
|
if (!isHexString(topics[0], 32) || topics[0].toLowerCase() !== topicHash) {
|
|
25209
|
-
logger$
|
|
24849
|
+
logger$4.throwError("fragment/topic mismatch", Logger.errors.INVALID_ARGUMENT, { argument: "topics[0]", expected: topicHash, value: topics[0] });
|
|
25210
24850
|
}
|
|
25211
24851
|
topics = topics.slice(1);
|
|
25212
24852
|
}
|
|
@@ -25351,7 +24991,7 @@ class Interface {
|
|
|
25351
24991
|
}
|
|
25352
24992
|
}
|
|
25353
24993
|
|
|
25354
|
-
const version$
|
|
24994
|
+
const version$3 = "abstract-provider/5.7.0";
|
|
25355
24995
|
|
|
25356
24996
|
var __awaiter$2 = function (thisArg, _arguments, P, generator) {
|
|
25357
24997
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -25362,12 +25002,12 @@ var __awaiter$2 = function (thisArg, _arguments, P, generator) {
|
|
|
25362
25002
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
25363
25003
|
});
|
|
25364
25004
|
};
|
|
25365
|
-
const logger$
|
|
25005
|
+
const logger$3 = new Logger(version$3);
|
|
25366
25006
|
///////////////////////////////
|
|
25367
25007
|
// Exported Abstracts
|
|
25368
25008
|
class Provider {
|
|
25369
25009
|
constructor() {
|
|
25370
|
-
logger$
|
|
25010
|
+
logger$3.checkAbstract(new.target, Provider);
|
|
25371
25011
|
defineReadOnly(this, "_isProvider", true);
|
|
25372
25012
|
}
|
|
25373
25013
|
getFeeData() {
|
|
@@ -25405,7 +25045,7 @@ class Provider {
|
|
|
25405
25045
|
}
|
|
25406
25046
|
}
|
|
25407
25047
|
|
|
25408
|
-
const version$
|
|
25048
|
+
const version$2 = "abstract-signer/5.7.0";
|
|
25409
25049
|
|
|
25410
25050
|
var __awaiter$1 = function (thisArg, _arguments, P, generator) {
|
|
25411
25051
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -25416,7 +25056,7 @@ var __awaiter$1 = function (thisArg, _arguments, P, generator) {
|
|
|
25416
25056
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
25417
25057
|
});
|
|
25418
25058
|
};
|
|
25419
|
-
const logger$
|
|
25059
|
+
const logger$2 = new Logger(version$2);
|
|
25420
25060
|
const allowedTransactionKeys = [
|
|
25421
25061
|
"accessList", "ccipReadEnabled", "chainId", "customData", "data", "from", "gasLimit", "gasPrice", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "to", "type", "value"
|
|
25422
25062
|
];
|
|
@@ -25429,7 +25069,7 @@ class Signer {
|
|
|
25429
25069
|
///////////////////
|
|
25430
25070
|
// Sub-classes MUST call super
|
|
25431
25071
|
constructor() {
|
|
25432
|
-
logger$
|
|
25072
|
+
logger$2.checkAbstract(new.target, Signer);
|
|
25433
25073
|
defineReadOnly(this, "_isSigner", true);
|
|
25434
25074
|
}
|
|
25435
25075
|
///////////////////
|
|
@@ -25508,7 +25148,7 @@ class Signer {
|
|
|
25508
25148
|
checkTransaction(transaction) {
|
|
25509
25149
|
for (const key in transaction) {
|
|
25510
25150
|
if (allowedTransactionKeys.indexOf(key) === -1) {
|
|
25511
|
-
logger$
|
|
25151
|
+
logger$2.throwArgumentError("invalid transaction key: " + key, "transaction", transaction);
|
|
25512
25152
|
}
|
|
25513
25153
|
}
|
|
25514
25154
|
const tx = shallowCopy(transaction);
|
|
@@ -25522,7 +25162,7 @@ class Signer {
|
|
|
25522
25162
|
this.getAddress()
|
|
25523
25163
|
]).then((result) => {
|
|
25524
25164
|
if (result[0].toLowerCase() !== result[1].toLowerCase()) {
|
|
25525
|
-
logger$
|
|
25165
|
+
logger$2.throwArgumentError("from address mismatch", "transaction", transaction);
|
|
25526
25166
|
}
|
|
25527
25167
|
return result[0];
|
|
25528
25168
|
});
|
|
@@ -25546,7 +25186,7 @@ class Signer {
|
|
|
25546
25186
|
}
|
|
25547
25187
|
const address = yield this.resolveName(to);
|
|
25548
25188
|
if (address == null) {
|
|
25549
|
-
logger$
|
|
25189
|
+
logger$2.throwArgumentError("provided ENS name resolves to null", "tx.to", to);
|
|
25550
25190
|
}
|
|
25551
25191
|
return address;
|
|
25552
25192
|
}));
|
|
@@ -25556,10 +25196,10 @@ class Signer {
|
|
|
25556
25196
|
// Do not allow mixing pre-eip-1559 and eip-1559 properties
|
|
25557
25197
|
const hasEip1559 = (tx.maxFeePerGas != null || tx.maxPriorityFeePerGas != null);
|
|
25558
25198
|
if (tx.gasPrice != null && (tx.type === 2 || hasEip1559)) {
|
|
25559
|
-
logger$
|
|
25199
|
+
logger$2.throwArgumentError("eip-1559 transaction do not support gasPrice", "transaction", transaction);
|
|
25560
25200
|
}
|
|
25561
25201
|
else if ((tx.type === 0 || tx.type === 1) && hasEip1559) {
|
|
25562
|
-
logger$
|
|
25202
|
+
logger$2.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas", "transaction", transaction);
|
|
25563
25203
|
}
|
|
25564
25204
|
if ((tx.type === 2 || tx.type == null) && (tx.maxFeePerGas != null && tx.maxPriorityFeePerGas != null)) {
|
|
25565
25205
|
// Fully-formed EIP-1559 transaction (skip getFeeData)
|
|
@@ -25603,7 +25243,7 @@ class Signer {
|
|
|
25603
25243
|
// Network doesn't support EIP-1559...
|
|
25604
25244
|
// ...but they are trying to use EIP-1559 properties
|
|
25605
25245
|
if (hasEip1559) {
|
|
25606
|
-
logger$
|
|
25246
|
+
logger$2.throwError("network does not support EIP-1559", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
25607
25247
|
operation: "populateTransaction"
|
|
25608
25248
|
});
|
|
25609
25249
|
}
|
|
@@ -25616,7 +25256,7 @@ class Signer {
|
|
|
25616
25256
|
}
|
|
25617
25257
|
else {
|
|
25618
25258
|
// getFeeData has failed us.
|
|
25619
|
-
logger$
|
|
25259
|
+
logger$2.throwError("failed to get consistent fee data", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
25620
25260
|
operation: "signer.getFeeData"
|
|
25621
25261
|
});
|
|
25622
25262
|
}
|
|
@@ -25640,7 +25280,7 @@ class Signer {
|
|
|
25640
25280
|
if (forwardErrors.indexOf(error.code) >= 0) {
|
|
25641
25281
|
throw error;
|
|
25642
25282
|
}
|
|
25643
|
-
return logger$
|
|
25283
|
+
return logger$2.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", Logger.errors.UNPREDICTABLE_GAS_LIMIT, {
|
|
25644
25284
|
error: error,
|
|
25645
25285
|
tx: tx
|
|
25646
25286
|
});
|
|
@@ -25655,7 +25295,7 @@ class Signer {
|
|
|
25655
25295
|
this.getChainId()
|
|
25656
25296
|
]).then((results) => {
|
|
25657
25297
|
if (results[1] !== 0 && results[0] !== results[1]) {
|
|
25658
|
-
logger$
|
|
25298
|
+
logger$2.throwArgumentError("chainId address mismatch", "transaction", transaction);
|
|
25659
25299
|
}
|
|
25660
25300
|
return results[0];
|
|
25661
25301
|
});
|
|
@@ -25667,7 +25307,7 @@ class Signer {
|
|
|
25667
25307
|
// Sub-classes SHOULD leave these alone
|
|
25668
25308
|
_checkProvider(operation) {
|
|
25669
25309
|
if (!this.provider) {
|
|
25670
|
-
logger$
|
|
25310
|
+
logger$2.throwError("missing provider", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
25671
25311
|
operation: (operation || "_checkProvider")
|
|
25672
25312
|
});
|
|
25673
25313
|
}
|
|
@@ -25687,7 +25327,7 @@ class VoidSigner extends Signer {
|
|
|
25687
25327
|
}
|
|
25688
25328
|
_fail(message, operation) {
|
|
25689
25329
|
return Promise.resolve().then(() => {
|
|
25690
|
-
logger$
|
|
25330
|
+
logger$2.throwError(message, Logger.errors.UNSUPPORTED_OPERATION, { operation: operation });
|
|
25691
25331
|
});
|
|
25692
25332
|
}
|
|
25693
25333
|
signMessage(message) {
|
|
@@ -25704,9 +25344,9 @@ class VoidSigner extends Signer {
|
|
|
25704
25344
|
}
|
|
25705
25345
|
}
|
|
25706
25346
|
|
|
25707
|
-
const version$
|
|
25347
|
+
const version$1 = "transactions/5.7.0";
|
|
25708
25348
|
|
|
25709
|
-
const logger$
|
|
25349
|
+
const logger$1 = new Logger(version$1);
|
|
25710
25350
|
var TransactionTypes;
|
|
25711
25351
|
(function (TransactionTypes) {
|
|
25712
25352
|
TransactionTypes[TransactionTypes["legacy"] = 0] = "legacy";
|
|
@@ -25718,7 +25358,7 @@ function accessSetify(addr, storageKeys) {
|
|
|
25718
25358
|
address: getAddress(addr),
|
|
25719
25359
|
storageKeys: (storageKeys || []).map((storageKey, index) => {
|
|
25720
25360
|
if (hexDataLength(storageKey) !== 32) {
|
|
25721
|
-
logger$
|
|
25361
|
+
logger$1.throwArgumentError("invalid access list storageKey", `accessList[${addr}:${index}]`, storageKey);
|
|
25722
25362
|
}
|
|
25723
25363
|
return storageKey.toLowerCase();
|
|
25724
25364
|
})
|
|
@@ -25729,7 +25369,7 @@ function accessListify(value) {
|
|
|
25729
25369
|
return value.map((set, index) => {
|
|
25730
25370
|
if (Array.isArray(set)) {
|
|
25731
25371
|
if (set.length > 2) {
|
|
25732
|
-
logger$
|
|
25372
|
+
logger$1.throwArgumentError("access list expected to be [ address, storageKeys[] ]", `value[${index}]`, set);
|
|
25733
25373
|
}
|
|
25734
25374
|
return accessSetify(set[0], set[1]);
|
|
25735
25375
|
}
|
|
@@ -25747,7 +25387,7 @@ function accessListify(value) {
|
|
|
25747
25387
|
return result;
|
|
25748
25388
|
}
|
|
25749
25389
|
|
|
25750
|
-
const version
|
|
25390
|
+
const version = "contracts/5.7.0";
|
|
25751
25391
|
|
|
25752
25392
|
var __awaiter = function (thisArg, _arguments, P, generator) {
|
|
25753
25393
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -25758,12 +25398,12 @@ var __awaiter = function (thisArg, _arguments, P, generator) {
|
|
|
25758
25398
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
25759
25399
|
});
|
|
25760
25400
|
};
|
|
25761
|
-
const logger
|
|
25401
|
+
const logger = new Logger(version);
|
|
25762
25402
|
function resolveName(resolver, nameOrPromise) {
|
|
25763
25403
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25764
25404
|
const name = yield nameOrPromise;
|
|
25765
25405
|
if (typeof (name) !== "string") {
|
|
25766
|
-
logger
|
|
25406
|
+
logger.throwArgumentError("invalid address or ENS name", "name", name);
|
|
25767
25407
|
}
|
|
25768
25408
|
// If it is already an address, just use it (after adding checksum)
|
|
25769
25409
|
try {
|
|
@@ -25771,13 +25411,13 @@ function resolveName(resolver, nameOrPromise) {
|
|
|
25771
25411
|
}
|
|
25772
25412
|
catch (error) { }
|
|
25773
25413
|
if (!resolver) {
|
|
25774
|
-
logger
|
|
25414
|
+
logger.throwError("a provider or signer is needed to resolve ENS names", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
25775
25415
|
operation: "resolveName"
|
|
25776
25416
|
});
|
|
25777
25417
|
}
|
|
25778
25418
|
const address = yield resolver.resolveName(name);
|
|
25779
25419
|
if (address == null) {
|
|
25780
|
-
logger
|
|
25420
|
+
logger.throwArgumentError("resolver or addr is not configured for ENS name", "name", name);
|
|
25781
25421
|
}
|
|
25782
25422
|
return address;
|
|
25783
25423
|
});
|
|
@@ -25798,7 +25438,7 @@ function resolveAddresses(resolver, value, paramType) {
|
|
|
25798
25438
|
}
|
|
25799
25439
|
if (paramType.baseType === "array") {
|
|
25800
25440
|
if (!Array.isArray(value)) {
|
|
25801
|
-
return Promise.reject(logger
|
|
25441
|
+
return Promise.reject(logger.makeError("invalid value for array", Logger.errors.INVALID_ARGUMENT, {
|
|
25802
25442
|
argument: "value",
|
|
25803
25443
|
value
|
|
25804
25444
|
}));
|
|
@@ -25816,7 +25456,7 @@ function populateTransaction(contract, fragment, args) {
|
|
|
25816
25456
|
overrides = shallowCopy(args.pop());
|
|
25817
25457
|
}
|
|
25818
25458
|
// Make sure the parameter count matches
|
|
25819
|
-
logger
|
|
25459
|
+
logger.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract");
|
|
25820
25460
|
// Populate "from" override (allow promises)
|
|
25821
25461
|
if (contract.signer) {
|
|
25822
25462
|
if (overrides.from) {
|
|
@@ -25827,7 +25467,7 @@ function populateTransaction(contract, fragment, args) {
|
|
|
25827
25467
|
signer: contract.signer.getAddress()
|
|
25828
25468
|
}).then((check) => __awaiter(this, void 0, void 0, function* () {
|
|
25829
25469
|
if (getAddress(check.signer) !== check.override) {
|
|
25830
|
-
logger
|
|
25470
|
+
logger.throwError("Contract with a Signer cannot override from", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
25831
25471
|
operation: "overrides.from"
|
|
25832
25472
|
});
|
|
25833
25473
|
}
|
|
@@ -25905,7 +25545,7 @@ function populateTransaction(contract, fragment, args) {
|
|
|
25905
25545
|
if (ro.value) {
|
|
25906
25546
|
const roValue = BigNumber.from(ro.value);
|
|
25907
25547
|
if (!roValue.isZero() && !fragment.payable) {
|
|
25908
|
-
logger
|
|
25548
|
+
logger.throwError("non-payable method cannot override value", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
25909
25549
|
operation: "overrides.value",
|
|
25910
25550
|
value: overrides.value
|
|
25911
25551
|
});
|
|
@@ -25934,7 +25574,7 @@ function populateTransaction(contract, fragment, args) {
|
|
|
25934
25574
|
// typo or using an unsupported key.
|
|
25935
25575
|
const leftovers = Object.keys(overrides).filter((key) => (overrides[key] != null));
|
|
25936
25576
|
if (leftovers.length) {
|
|
25937
|
-
logger
|
|
25577
|
+
logger.throwError(`cannot override ${leftovers.map((l) => JSON.stringify(l)).join(",")}`, Logger.errors.UNSUPPORTED_OPERATION, {
|
|
25938
25578
|
operation: "overrides",
|
|
25939
25579
|
overrides: leftovers
|
|
25940
25580
|
});
|
|
@@ -25952,7 +25592,7 @@ function buildEstimate(contract, fragment) {
|
|
|
25952
25592
|
return function (...args) {
|
|
25953
25593
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25954
25594
|
if (!signerOrProvider) {
|
|
25955
|
-
logger
|
|
25595
|
+
logger.throwError("estimate require a provider or signer", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
25956
25596
|
operation: "estimateGas"
|
|
25957
25597
|
});
|
|
25958
25598
|
}
|
|
@@ -26041,7 +25681,7 @@ function buildSend(contract, fragment) {
|
|
|
26041
25681
|
return function (...args) {
|
|
26042
25682
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26043
25683
|
if (!contract.signer) {
|
|
26044
|
-
logger
|
|
25684
|
+
logger.throwError("sending a transaction requires a signer", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
26045
25685
|
operation: "sendTransaction"
|
|
26046
25686
|
});
|
|
26047
25687
|
}
|
|
@@ -26140,7 +25780,7 @@ class FragmentRunningEvent extends RunningEvent {
|
|
|
26140
25780
|
let topic = contractInterface.getEventTopic(fragment);
|
|
26141
25781
|
if (topics) {
|
|
26142
25782
|
if (topic !== topics[0]) {
|
|
26143
|
-
logger
|
|
25783
|
+
logger.throwArgumentError("topic mismatch", "topics", topics);
|
|
26144
25784
|
}
|
|
26145
25785
|
filter.topics = topics.slice();
|
|
26146
25786
|
}
|
|
@@ -26222,7 +25862,7 @@ class BaseContract {
|
|
|
26222
25862
|
defineReadOnly(this, "signer", null);
|
|
26223
25863
|
}
|
|
26224
25864
|
else {
|
|
26225
|
-
logger
|
|
25865
|
+
logger.throwArgumentError("invalid signer or provider", "signerOrProvider", signerOrProvider);
|
|
26226
25866
|
}
|
|
26227
25867
|
defineReadOnly(this, "callStatic", {});
|
|
26228
25868
|
defineReadOnly(this, "estimateGas", {});
|
|
@@ -26250,14 +25890,14 @@ class BaseContract {
|
|
|
26250
25890
|
defineReadOnly(this.filters, name, this.filters[filters[0]]);
|
|
26251
25891
|
}
|
|
26252
25892
|
else {
|
|
26253
|
-
logger
|
|
25893
|
+
logger.warn(`Duplicate definition of ${name} (${filters.join(", ")})`);
|
|
26254
25894
|
}
|
|
26255
25895
|
});
|
|
26256
25896
|
}
|
|
26257
25897
|
defineReadOnly(this, "_runningEvents", {});
|
|
26258
25898
|
defineReadOnly(this, "_wrappedEmits", {});
|
|
26259
25899
|
if (addressOrName == null) {
|
|
26260
|
-
logger
|
|
25900
|
+
logger.throwArgumentError("invalid contract address or ENS name", "addressOrName", addressOrName);
|
|
26261
25901
|
}
|
|
26262
25902
|
defineReadOnly(this, "address", addressOrName);
|
|
26263
25903
|
if (this.provider) {
|
|
@@ -26269,7 +25909,7 @@ class BaseContract {
|
|
|
26269
25909
|
}
|
|
26270
25910
|
catch (error) {
|
|
26271
25911
|
// Without a provider, we cannot use ENS names
|
|
26272
|
-
logger
|
|
25912
|
+
logger.throwError("provider is required to use ENS name as contract address", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
26273
25913
|
operation: "new Contract"
|
|
26274
25914
|
});
|
|
26275
25915
|
}
|
|
@@ -26283,7 +25923,7 @@ class BaseContract {
|
|
|
26283
25923
|
// Check that the signature is unique; if not the ABI generation has
|
|
26284
25924
|
// not been cleaned or may be incorrectly generated
|
|
26285
25925
|
if (uniqueSignatures[signature]) {
|
|
26286
|
-
logger
|
|
25926
|
+
logger.warn(`Duplicate ABI entry for ${JSON.stringify(signature)}`);
|
|
26287
25927
|
return;
|
|
26288
25928
|
}
|
|
26289
25929
|
uniqueSignatures[signature] = true;
|
|
@@ -26372,7 +26012,7 @@ class BaseContract {
|
|
|
26372
26012
|
// Otherwise, poll for our code to be deployed
|
|
26373
26013
|
this._deployedPromise = this.provider.getCode(this.address, blockTag).then((code) => {
|
|
26374
26014
|
if (code === "0x") {
|
|
26375
|
-
logger
|
|
26015
|
+
logger.throwError("contract not deployed", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
26376
26016
|
contractAddress: this.address,
|
|
26377
26017
|
operation: "getDeployed"
|
|
26378
26018
|
});
|
|
@@ -26389,14 +26029,14 @@ class BaseContract {
|
|
|
26389
26029
|
// estimateDeploy(bytecode: string, ...args): Promise<BigNumber>
|
|
26390
26030
|
fallback(overrides) {
|
|
26391
26031
|
if (!this.signer) {
|
|
26392
|
-
logger
|
|
26032
|
+
logger.throwError("sending a transactions require a signer", Logger.errors.UNSUPPORTED_OPERATION, { operation: "sendTransaction(fallback)" });
|
|
26393
26033
|
}
|
|
26394
26034
|
const tx = shallowCopy(overrides || {});
|
|
26395
26035
|
["from", "to"].forEach(function (key) {
|
|
26396
26036
|
if (tx[key] == null) {
|
|
26397
26037
|
return;
|
|
26398
26038
|
}
|
|
26399
|
-
logger
|
|
26039
|
+
logger.throwError("cannot override " + key, Logger.errors.UNSUPPORTED_OPERATION, { operation: key });
|
|
26400
26040
|
});
|
|
26401
26041
|
tx.to = this.resolvedAddress;
|
|
26402
26042
|
return this.deployed().then(() => {
|
|
@@ -26499,7 +26139,7 @@ class BaseContract {
|
|
|
26499
26139
|
}
|
|
26500
26140
|
_addEventListener(runningEvent, listener, once) {
|
|
26501
26141
|
if (!this.provider) {
|
|
26502
|
-
logger
|
|
26142
|
+
logger.throwError("events require a provider or a signer with a provider", Logger.errors.UNSUPPORTED_OPERATION, { operation: "once" });
|
|
26503
26143
|
}
|
|
26504
26144
|
runningEvent.addListener(listener, once);
|
|
26505
26145
|
// Track this running event and its listeners (may already be there; but no hard in updating)
|
|
@@ -26539,7 +26179,7 @@ class BaseContract {
|
|
|
26539
26179
|
const filter = shallowCopy(runningEvent.filter);
|
|
26540
26180
|
if (typeof (fromBlockOrBlockhash) === "string" && isHexString(fromBlockOrBlockhash, 32)) {
|
|
26541
26181
|
if (toBlock != null) {
|
|
26542
|
-
logger
|
|
26182
|
+
logger.throwArgumentError("cannot specify toBlock with blockhash", "toBlock", toBlock);
|
|
26543
26183
|
}
|
|
26544
26184
|
filter.blockHash = fromBlockOrBlockhash;
|
|
26545
26185
|
}
|
|
@@ -26629,31 +26269,6 @@ class BaseContract {
|
|
|
26629
26269
|
class Contract extends BaseContract {
|
|
26630
26270
|
}
|
|
26631
26271
|
|
|
26632
|
-
const version = "units/5.7.0";
|
|
26633
|
-
|
|
26634
|
-
const logger = new Logger(version);
|
|
26635
|
-
const names = [
|
|
26636
|
-
"wei",
|
|
26637
|
-
"kwei",
|
|
26638
|
-
"mwei",
|
|
26639
|
-
"gwei",
|
|
26640
|
-
"szabo",
|
|
26641
|
-
"finney",
|
|
26642
|
-
"ether",
|
|
26643
|
-
];
|
|
26644
|
-
function parseUnits(value, unitName) {
|
|
26645
|
-
if (typeof (value) !== "string") {
|
|
26646
|
-
logger.throwArgumentError("value must be a string", "value", value);
|
|
26647
|
-
}
|
|
26648
|
-
if (typeof (unitName) === "string") {
|
|
26649
|
-
const index = names.indexOf(unitName);
|
|
26650
|
-
if (index !== -1) {
|
|
26651
|
-
unitName = 3 * index;
|
|
26652
|
-
}
|
|
26653
|
-
}
|
|
26654
|
-
return parseFixed(value, (unitName != null) ? unitName : 18);
|
|
26655
|
-
}
|
|
26656
|
-
|
|
26657
26272
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
26658
26273
|
/**
|
|
26659
26274
|
* @constant {string} ETH_SEPOLIA_CHAIN_ID - The chain ID for the Ethereum Sepolia testnet (EIP-155 compatible format).
|
|
@@ -26675,6 +26290,10 @@ const ZKEVM_TESTNET_CHAIN_ID = '13473';
|
|
|
26675
26290
|
* @constant {string} ZKEVM_MAINNET_CHAIN_ID - The chain ID for the zkEVM mainnet (EIP-155 compatible format).
|
|
26676
26291
|
*/
|
|
26677
26292
|
const ZKEVM_MAINNET_CHAIN_ID = '13371'; // @TODO confirm this is still correct
|
|
26293
|
+
/**
|
|
26294
|
+
* @constant {string} CHILD_CHAIN_NATIVE_TOKEN_ADDRESS - Address of the native token on the child chain.
|
|
26295
|
+
*/
|
|
26296
|
+
const ETHEREUM_NATIVE_TOKEN_ADDRESS = '0x0000000000000000000000000000000000000eee';
|
|
26678
26297
|
/**
|
|
26679
26298
|
* @constant {BridgeInstance} ETH_SEPOLIA_TO_ZKEVM_DEVNET - A bridge instance configuration for bridging between
|
|
26680
26299
|
* the Ethereum Sepolia testnet and the zkEVM devnet.
|
|
@@ -29014,6 +28633,7 @@ var BridgeErrorType;
|
|
|
29014
28633
|
BridgeErrorType["AXELAR_GAS_ESTIMATE_FAILED"] = "AXELAR_GAS_ESTIMATE_FAILED";
|
|
29015
28634
|
BridgeErrorType["INVALID_RECIPIENT"] = "INVALID_RECIPIENT";
|
|
29016
28635
|
BridgeErrorType["FLOW_RATE_ERROR"] = "FLOW_RATE_ERROR";
|
|
28636
|
+
BridgeErrorType["INVALID_FLOWRATE_INDEX"] = "INVALID_FLOWRATE_INDEX";
|
|
29017
28637
|
})(BridgeErrorType || (BridgeErrorType = {}));
|
|
29018
28638
|
/**
|
|
29019
28639
|
* Represents a custom error for bridge operations.
|
|
@@ -30953,6 +30573,7 @@ class TokenBridge {
|
|
|
30953
30573
|
}, BridgeErrorType.INTERNAL_ERROR);
|
|
30954
30574
|
}
|
|
30955
30575
|
const flowRatePromises = [];
|
|
30576
|
+
const flowRateLengthPromises = [];
|
|
30956
30577
|
const flowRatePromisesReceivers = [];
|
|
30957
30578
|
for (let i = 0, l = statusResponses.length; i < l; i++) {
|
|
30958
30579
|
let metaStatus;
|
|
@@ -31000,26 +30621,40 @@ class TokenBridge {
|
|
|
31000
30621
|
...txItem,
|
|
31001
30622
|
token: decodedData[1],
|
|
31002
30623
|
sender: decodedData[2],
|
|
31003
|
-
|
|
30624
|
+
recipient: decodedData[3],
|
|
31004
30625
|
amount: decodedData[4],
|
|
31005
30626
|
};
|
|
31006
30627
|
}
|
|
31007
|
-
let flowRatePromiseIndex;
|
|
30628
|
+
let flowRatePromiseIndex = flowRatePromisesReceivers.findIndex((el) => el === txItem.recipient);
|
|
31008
30629
|
if (metaStatus === StatusResponse.COMPLETE
|
|
31009
|
-
&& isWithdraw && txItem.
|
|
30630
|
+
&& isWithdraw && txItem.recipient) {
|
|
31010
30631
|
// consolidate the calls we have to make to the flow rate by receiver
|
|
31011
|
-
if (
|
|
31012
|
-
|
|
31013
|
-
flowRatePromisesReceivers.push(txItem.receiver);
|
|
30632
|
+
if (flowRatePromiseIndex === -1) {
|
|
30633
|
+
flowRatePromisesReceivers.push(txItem.recipient);
|
|
31014
30634
|
flowRatePromiseIndex = flowRatePromisesReceivers.length - 1;
|
|
31015
30635
|
}
|
|
31016
|
-
else {
|
|
31017
|
-
flowRatePromiseIndex = flowRatePromisesReceivers.findIndex((el) => el === txItem.receiver);
|
|
31018
|
-
}
|
|
31019
30636
|
txItem.data.flowRatePromiseIndex = flowRatePromiseIndex;
|
|
31020
30637
|
}
|
|
31021
30638
|
txStatusResponse.transactions.push(txItem);
|
|
31022
30639
|
} // for
|
|
30640
|
+
for (const flowRateReceiver of flowRatePromisesReceivers) {
|
|
30641
|
+
flowRateLengthPromises.push(rootBridge.getPendingWithdrawalsLength(flowRateReceiver));
|
|
30642
|
+
}
|
|
30643
|
+
let flowRateLengthResponses = [];
|
|
30644
|
+
try {
|
|
30645
|
+
flowRateLengthResponses = await Promise.all(flowRateLengthPromises);
|
|
30646
|
+
}
|
|
30647
|
+
catch (err) {
|
|
30648
|
+
throw new BridgeError(`Failed to fetch the Flow Rate pending lengths with the reason: ${err}`, BridgeErrorType.FLOW_RATE_ERROR);
|
|
30649
|
+
}
|
|
30650
|
+
for (let i = 0, l = flowRatePromisesReceivers.length; i < l; i++) {
|
|
30651
|
+
const indices = [];
|
|
30652
|
+
const indicesLength = flowRateLengthResponses[i].toNumber();
|
|
30653
|
+
for (let j = 0; j < indicesLength; j++) {
|
|
30654
|
+
indices.push(j);
|
|
30655
|
+
}
|
|
30656
|
+
flowRatePromises.push(rootBridge.getPendingWithdrawals(flowRatePromisesReceivers[i], indices));
|
|
30657
|
+
}
|
|
31023
30658
|
let flowRateResponses = [];
|
|
31024
30659
|
if (flowRatePromises.length > 0) {
|
|
31025
30660
|
try {
|
|
@@ -31054,33 +30689,49 @@ class TokenBridge {
|
|
|
31054
30689
|
* @throws {BridgeError} - If an error occurs during the query, a BridgeError will be thrown with a specific error type.
|
|
31055
30690
|
* @dev this SDK method is currently stubbed
|
|
31056
30691
|
*/
|
|
31057
|
-
async getFlowRateInfo(req
|
|
31058
|
-
|
|
31059
|
-
|
|
30692
|
+
async getFlowRateInfo(req) {
|
|
30693
|
+
if (!req.tokens || req.tokens.length === 0) {
|
|
30694
|
+
throw new BridgeError(`invalid tokens array ${req.tokens}`, BridgeErrorType.INVALID_TOKEN);
|
|
30695
|
+
}
|
|
30696
|
+
const rootBridge = await withBridgeError(async () => {
|
|
30697
|
+
const contract = new Contract(this.config.bridgeContracts.rootERC20BridgeFlowRate, ROOT_ERC20_BRIDGE_FLOW_RATE, this.config.rootProvider);
|
|
30698
|
+
return contract;
|
|
30699
|
+
}, BridgeErrorType.INTERNAL_ERROR);
|
|
30700
|
+
const contractPromises = [];
|
|
30701
|
+
contractPromises.push(rootBridge.withdrawalQueueActivated());
|
|
30702
|
+
contractPromises.push(rootBridge.withdrawalDelay());
|
|
30703
|
+
for (let token of req.tokens) {
|
|
30704
|
+
if (token.toUpperCase() === 'NATIVE') {
|
|
30705
|
+
token = ETHEREUM_NATIVE_TOKEN_ADDRESS;
|
|
30706
|
+
}
|
|
30707
|
+
contractPromises.push(rootBridge.flowRateBuckets(token));
|
|
30708
|
+
}
|
|
30709
|
+
let contractPromisesRes;
|
|
30710
|
+
try {
|
|
30711
|
+
contractPromisesRes = await Promise.all(contractPromises);
|
|
30712
|
+
}
|
|
30713
|
+
catch (err) {
|
|
30714
|
+
throw new BridgeError('unable to query contract for flowrate info', BridgeErrorType.INTERNAL_ERROR);
|
|
30715
|
+
}
|
|
30716
|
+
const tokensRes = {};
|
|
30717
|
+
// @note it's i + 2 because the first 2 promises are not token buckets
|
|
30718
|
+
for (let i = 0, l = req.tokens.length; i < l; i++) {
|
|
30719
|
+
tokensRes[req.tokens[i]] = {
|
|
30720
|
+
capacity: contractPromisesRes[i + 2].capacity,
|
|
30721
|
+
depth: contractPromisesRes[i + 2].depth,
|
|
30722
|
+
refillTime: contractPromisesRes[i + 2].refillTime.toNumber(),
|
|
30723
|
+
refillRate: contractPromisesRes[i + 2].refillRate,
|
|
30724
|
+
};
|
|
30725
|
+
}
|
|
31060
30726
|
// Return the token mappings
|
|
31061
30727
|
return {
|
|
31062
|
-
withdrawalQueueActivated:
|
|
31063
|
-
withdrawalDelay:
|
|
31064
|
-
tokens:
|
|
31065
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
31066
|
-
NATIVE: {
|
|
31067
|
-
capacity: parseUnits('10', 18).toString(),
|
|
31068
|
-
depth: parseUnits('10', 18).toString(),
|
|
31069
|
-
refillTime: 1701227629,
|
|
31070
|
-
refillRate: parseUnits('10', 18).toString(),
|
|
31071
|
-
},
|
|
31072
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
31073
|
-
'0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF': {
|
|
31074
|
-
capacity: parseUnits('10', 18).toString(),
|
|
31075
|
-
depth: parseUnits('10', 18).toString(),
|
|
31076
|
-
refillTime: 1701227629,
|
|
31077
|
-
refillRate: parseUnits('10', 18).toString(),
|
|
31078
|
-
},
|
|
31079
|
-
},
|
|
30728
|
+
withdrawalQueueActivated: contractPromisesRes[0],
|
|
30729
|
+
withdrawalDelay: contractPromisesRes[1].toNumber(),
|
|
30730
|
+
tokens: tokensRes,
|
|
31080
30731
|
};
|
|
31081
30732
|
}
|
|
31082
30733
|
/**
|
|
31083
|
-
*
|
|
30734
|
+
* Fetches the pending withdrawals for a given address.
|
|
31084
30735
|
*
|
|
31085
30736
|
* @param {PendingWithdrawalsRequest} req - The request object containing the reciever address.
|
|
31086
30737
|
* @returns {Promise<PendingWithdrawalsResponse>} - A promise that resolves to an object containing the child token address.
|
|
@@ -31089,25 +30740,46 @@ class TokenBridge {
|
|
|
31089
30740
|
*/
|
|
31090
30741
|
async getPendingWithdrawals(req) {
|
|
31091
30742
|
// eslint-disable-next-line no-console
|
|
31092
|
-
|
|
31093
|
-
|
|
31094
|
-
|
|
31095
|
-
|
|
31096
|
-
|
|
31097
|
-
|
|
31098
|
-
|
|
31099
|
-
|
|
31100
|
-
|
|
31101
|
-
|
|
31102
|
-
{
|
|
31103
|
-
canWithdraw: false,
|
|
31104
|
-
withdrawer: '0xEac347177DbA4a190B632C7d9b8da2AbfF57c772',
|
|
31105
|
-
token: '0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF',
|
|
31106
|
-
amount: parseUnits('2', 18).toString(),
|
|
31107
|
-
timeoutStart: 1698416029,
|
|
31108
|
-
timeoutEnd: 1698502429,
|
|
31109
|
-
}],
|
|
30743
|
+
if (!req.recipient) {
|
|
30744
|
+
throw new BridgeError(`invalid recipient ${req.recipient}`, BridgeErrorType.INVALID_RECIPIENT);
|
|
30745
|
+
}
|
|
30746
|
+
const rootBridge = await withBridgeError(async () => {
|
|
30747
|
+
const contract = new Contract(this.config.bridgeContracts.rootERC20BridgeFlowRate, ROOT_ERC20_BRIDGE_FLOW_RATE, this.config.rootProvider);
|
|
30748
|
+
return contract;
|
|
30749
|
+
}, BridgeErrorType.INTERNAL_ERROR);
|
|
30750
|
+
const pendingLength = await rootBridge.getPendingWithdrawalsLength(req.recipient);
|
|
30751
|
+
const pendingWithdrawals = {
|
|
30752
|
+
pending: [],
|
|
31110
30753
|
};
|
|
30754
|
+
if (pendingLength.toNumber() === 0) {
|
|
30755
|
+
return pendingWithdrawals;
|
|
30756
|
+
}
|
|
30757
|
+
const indices = [];
|
|
30758
|
+
for (let i = 0; i < pendingLength.toNumber(); i++) {
|
|
30759
|
+
indices.push(i);
|
|
30760
|
+
}
|
|
30761
|
+
const pending = await rootBridge.getPendingWithdrawals(req.recipient, indices);
|
|
30762
|
+
const timestampNow = Math.floor(Date.now() / 1000);
|
|
30763
|
+
const withdrawalDelay = await rootBridge.withdrawalDelay();
|
|
30764
|
+
for (let i = 0, l = pending.length; i < l; i++) {
|
|
30765
|
+
const timeoutEnd = pending[i].timestamp.add(withdrawalDelay).toNumber();
|
|
30766
|
+
if (timeoutEnd > timestampNow) {
|
|
30767
|
+
pendingWithdrawals.pending[i] = {
|
|
30768
|
+
canWithdraw: false,
|
|
30769
|
+
};
|
|
30770
|
+
}
|
|
30771
|
+
else {
|
|
30772
|
+
pendingWithdrawals.pending[i] = {
|
|
30773
|
+
canWithdraw: true,
|
|
30774
|
+
};
|
|
30775
|
+
}
|
|
30776
|
+
pendingWithdrawals.pending[i].withdrawer = pending[i].withdrawer;
|
|
30777
|
+
pendingWithdrawals.pending[i].token = pending[i].token;
|
|
30778
|
+
pendingWithdrawals.pending[i].amount = pending[i].amount;
|
|
30779
|
+
pendingWithdrawals.pending[i].timeoutStart = pending[i].timestamp.toNumber();
|
|
30780
|
+
pendingWithdrawals.pending[i].timeoutEnd = timeoutEnd;
|
|
30781
|
+
}
|
|
30782
|
+
return pendingWithdrawals;
|
|
31111
30783
|
}
|
|
31112
30784
|
/**
|
|
31113
30785
|
* Retrieves the unsigned flow rate withdrawal transaction
|
|
@@ -31119,12 +30791,54 @@ class TokenBridge {
|
|
|
31119
30791
|
*/
|
|
31120
30792
|
async getFlowRateWithdrawTx(req) {
|
|
31121
30793
|
// eslint-disable-next-line no-console
|
|
31122
|
-
|
|
30794
|
+
if (!req.recipient) {
|
|
30795
|
+
throw new BridgeError(`invalid recipient ${req.recipient}`, BridgeErrorType.INVALID_RECIPIENT);
|
|
30796
|
+
}
|
|
30797
|
+
if (req.index < 0) {
|
|
30798
|
+
throw new BridgeError(`invalid index ${req.index}`, BridgeErrorType.INVALID_FLOWRATE_INDEX);
|
|
30799
|
+
}
|
|
30800
|
+
const rootBridge = await withBridgeError(async () => {
|
|
30801
|
+
const contract = new Contract(this.config.bridgeContracts.rootERC20BridgeFlowRate, ROOT_ERC20_BRIDGE_FLOW_RATE, this.config.rootProvider);
|
|
30802
|
+
return contract;
|
|
30803
|
+
}, BridgeErrorType.INTERNAL_ERROR);
|
|
30804
|
+
const pending = await rootBridge.getPendingWithdrawals(req.recipient, [req.index]);
|
|
30805
|
+
if (pending[0].withdrawer === AddressZero
|
|
30806
|
+
|| pending[0].token === AddressZero
|
|
30807
|
+
|| pending[0].amount === BigNumber.from(0)
|
|
30808
|
+
|| pending[0].timestamp === BigNumber.from(0)) {
|
|
30809
|
+
throw new BridgeError(`pending withdrawal not found for ${req.recipient} at index ${req.index}`, BridgeErrorType.FLOW_RATE_ERROR);
|
|
30810
|
+
}
|
|
30811
|
+
const withdrawalDelay = await rootBridge.withdrawalDelay();
|
|
30812
|
+
const timeoutEnd = pending[0].timestamp.add(withdrawalDelay).toNumber();
|
|
30813
|
+
const timestampNow = Math.floor(Date.now() / 1000);
|
|
30814
|
+
if (timeoutEnd > timestampNow) {
|
|
30815
|
+
return {
|
|
30816
|
+
pendingWithdrawal: {
|
|
30817
|
+
canWithdraw: false,
|
|
30818
|
+
withdrawer: pending[0].withdrawer,
|
|
30819
|
+
token: pending[0].token,
|
|
30820
|
+
amount: pending[0].amount,
|
|
30821
|
+
timeoutStart: pending[0].timestamp.toNumber(),
|
|
30822
|
+
timeoutEnd,
|
|
30823
|
+
},
|
|
30824
|
+
unsignedTx: null,
|
|
30825
|
+
};
|
|
30826
|
+
}
|
|
30827
|
+
const data = await withBridgeError(async () => rootBridge.interface.encodeFunctionData('finaliseQueuedWithdrawal', [req.recipient, req.index]), BridgeErrorType.INTERNAL_ERROR);
|
|
31123
30828
|
return {
|
|
30829
|
+
pendingWithdrawal: {
|
|
30830
|
+
canWithdraw: true,
|
|
30831
|
+
withdrawer: pending[0].withdrawer,
|
|
30832
|
+
token: pending[0].token,
|
|
30833
|
+
amount: pending[0].amount,
|
|
30834
|
+
timeoutStart: pending[0].timestamp.toNumber(),
|
|
30835
|
+
timeoutEnd,
|
|
30836
|
+
},
|
|
31124
30837
|
unsignedTx: {
|
|
31125
|
-
data
|
|
31126
|
-
to:
|
|
30838
|
+
data,
|
|
30839
|
+
to: this.config.bridgeContracts.rootERC20BridgeFlowRate,
|
|
31127
30840
|
value: 0,
|
|
30841
|
+
chainId: parseInt(this.config.bridgeInstance.rootChainID, 10),
|
|
31128
30842
|
},
|
|
31129
30843
|
};
|
|
31130
30844
|
}
|
|
@@ -31178,17 +30892,26 @@ const CONTRACTS_FOR_BRIDGE = new Map()
|
|
|
31178
30892
|
.set(ETH_SEPOLIA_TO_ZKEVM_DEVNET, {
|
|
31179
30893
|
rootERC20BridgeFlowRate: '0x0',
|
|
31180
30894
|
childERC20Bridge: '0x0',
|
|
31181
|
-
|
|
30895
|
+
rootChainIMX: '0x0',
|
|
30896
|
+
rootChainWrappedETH: '0x0',
|
|
30897
|
+
childChainWrappedETH: '0x0',
|
|
30898
|
+
childChainWrappedIMX: '0x0',
|
|
31182
30899
|
})
|
|
31183
30900
|
.set(ETH_SEPOLIA_TO_ZKEVM_TESTNET, {
|
|
31184
30901
|
rootERC20BridgeFlowRate: '0x0D3C59c779Fd552C27b23F723E80246c840100F5',
|
|
31185
30902
|
childERC20Bridge: '0x0D3C59c779Fd552C27b23F723E80246c840100F5',
|
|
31186
|
-
|
|
30903
|
+
rootChainIMX: '0xe2629e08f4125d14e446660028bD98ee60EE69F2',
|
|
30904
|
+
rootChainWrappedETH: '0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9',
|
|
30905
|
+
childChainWrappedETH: '0xe9E96d1aad82562b7588F03f49aD34186f996478',
|
|
30906
|
+
childChainWrappedIMX: '0x1CcCa691501174B4A623CeDA58cC8f1a76dc3439',
|
|
31187
30907
|
})
|
|
31188
30908
|
.set(ETH_MAINNET_TO_ZKEVM_MAINNET, {
|
|
31189
|
-
rootERC20BridgeFlowRate: '
|
|
31190
|
-
childERC20Bridge: '
|
|
31191
|
-
|
|
30909
|
+
rootERC20BridgeFlowRate: '0xBa5E35E26Ae59c7aea6F029B68c6460De2d13eB6',
|
|
30910
|
+
childERC20Bridge: '0xBa5E35E26Ae59c7aea6F029B68c6460De2d13eB6',
|
|
30911
|
+
rootChainIMX: '0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF',
|
|
30912
|
+
rootChainWrappedETH: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
|
30913
|
+
childChainWrappedETH: '0x52a6c53869ce09a731cd772f245b97a4401d3348',
|
|
30914
|
+
childChainWrappedIMX: '0x3a0c2ba54d6cbd3121f01b96dfd20e99d1696c9d',
|
|
31192
30915
|
});
|
|
31193
30916
|
/**
|
|
31194
30917
|
* Represents the configuration for a bridge between two chains.
|
|
@@ -31551,134 +31274,6 @@ class ERC20__factory {
|
|
|
31551
31274
|
/* tslint:disable */
|
|
31552
31275
|
/* eslint-disable */
|
|
31553
31276
|
const _abi$2 = [
|
|
31554
|
-
{
|
|
31555
|
-
inputs: [],
|
|
31556
|
-
name: "getCurrentBlockTimestamp",
|
|
31557
|
-
outputs: [
|
|
31558
|
-
{
|
|
31559
|
-
internalType: "uint256",
|
|
31560
|
-
name: "timestamp",
|
|
31561
|
-
type: "uint256",
|
|
31562
|
-
},
|
|
31563
|
-
],
|
|
31564
|
-
stateMutability: "view",
|
|
31565
|
-
type: "function",
|
|
31566
|
-
},
|
|
31567
|
-
{
|
|
31568
|
-
inputs: [
|
|
31569
|
-
{
|
|
31570
|
-
internalType: "address",
|
|
31571
|
-
name: "addr",
|
|
31572
|
-
type: "address",
|
|
31573
|
-
},
|
|
31574
|
-
],
|
|
31575
|
-
name: "getEthBalance",
|
|
31576
|
-
outputs: [
|
|
31577
|
-
{
|
|
31578
|
-
internalType: "uint256",
|
|
31579
|
-
name: "balance",
|
|
31580
|
-
type: "uint256",
|
|
31581
|
-
},
|
|
31582
|
-
],
|
|
31583
|
-
stateMutability: "view",
|
|
31584
|
-
type: "function",
|
|
31585
|
-
},
|
|
31586
|
-
{
|
|
31587
|
-
inputs: [
|
|
31588
|
-
{
|
|
31589
|
-
components: [
|
|
31590
|
-
{
|
|
31591
|
-
internalType: "address",
|
|
31592
|
-
name: "target",
|
|
31593
|
-
type: "address",
|
|
31594
|
-
},
|
|
31595
|
-
{
|
|
31596
|
-
internalType: "uint256",
|
|
31597
|
-
name: "gasLimit",
|
|
31598
|
-
type: "uint256",
|
|
31599
|
-
},
|
|
31600
|
-
{
|
|
31601
|
-
internalType: "bytes",
|
|
31602
|
-
name: "callData",
|
|
31603
|
-
type: "bytes",
|
|
31604
|
-
},
|
|
31605
|
-
],
|
|
31606
|
-
internalType: "struct UniswapInterfaceMulticall.Call[]",
|
|
31607
|
-
name: "calls",
|
|
31608
|
-
type: "tuple[]",
|
|
31609
|
-
},
|
|
31610
|
-
],
|
|
31611
|
-
name: "multicall",
|
|
31612
|
-
outputs: [
|
|
31613
|
-
{
|
|
31614
|
-
internalType: "uint256",
|
|
31615
|
-
name: "blockNumber",
|
|
31616
|
-
type: "uint256",
|
|
31617
|
-
},
|
|
31618
|
-
{
|
|
31619
|
-
components: [
|
|
31620
|
-
{
|
|
31621
|
-
internalType: "bool",
|
|
31622
|
-
name: "success",
|
|
31623
|
-
type: "bool",
|
|
31624
|
-
},
|
|
31625
|
-
{
|
|
31626
|
-
internalType: "uint256",
|
|
31627
|
-
name: "gasUsed",
|
|
31628
|
-
type: "uint256",
|
|
31629
|
-
},
|
|
31630
|
-
{
|
|
31631
|
-
internalType: "bytes",
|
|
31632
|
-
name: "returnData",
|
|
31633
|
-
type: "bytes",
|
|
31634
|
-
},
|
|
31635
|
-
],
|
|
31636
|
-
internalType: "struct UniswapInterfaceMulticall.Result[]",
|
|
31637
|
-
name: "returnData",
|
|
31638
|
-
type: "tuple[]",
|
|
31639
|
-
},
|
|
31640
|
-
],
|
|
31641
|
-
stateMutability: "nonpayable",
|
|
31642
|
-
type: "function",
|
|
31643
|
-
},
|
|
31644
|
-
];
|
|
31645
|
-
const _bytecode$2 = "0x608060405234801561001057600080fd5b50610567806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80630f28c97d146100465780631749e1e3146100645780634d2301cc14610085575b600080fd5b61004e610098565b60405161005b919061041f565b60405180910390f35b6100776100723660046102a7565b61009c565b60405161005b929190610428565b61004e610093366004610286565b610220565b4290565b8051439060609067ffffffffffffffff811180156100b957600080fd5b506040519080825280602002602001820160405280156100f357816020015b6100e061023a565b8152602001906001900390816100d85790505b50905060005b835181101561021a57600080600086848151811061011357fe5b60200260200101516000015187858151811061012b57fe5b60200260200101516020015188868151811061014357fe5b60200260200101516040015192509250925060005a90506000808573ffffffffffffffffffffffffffffffffffffffff1685856040516101839190610403565b60006040518083038160008787f1925050503d80600081146101c1576040519150601f19603f3d011682016040523d82523d6000602084013e6101c6565b606091505b509150915060005a8403905060405180606001604052808415158152602001828152602001838152508989815181106101fb57fe5b60200260200101819052505050505050505080806001019150506100f9565b50915091565b73ffffffffffffffffffffffffffffffffffffffff163190565b604051806060016040528060001515815260200160008152602001606081525090565b803573ffffffffffffffffffffffffffffffffffffffff8116811461028157600080fd5b919050565b600060208284031215610297578081fd5b6102a08261025d565b9392505050565b600060208083850312156102b9578182fd5b823567ffffffffffffffff808211156102d0578384fd5b818501915085601f8301126102e3578384fd5b8135818111156102ef57fe5b6102fc8485830201610506565b81815284810190848601875b848110156103f457813587017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0606081838f03011215610346578a8bfd5b60408051606081018181108b8211171561035c57fe5b8252610369848d0161025d565b8152818401358c82015260608401358a811115610384578d8efd5b8085019450508e603f850112610398578c8dfd5b8b8401358a8111156103a657fe5b6103b68d85601f84011601610506565b93508084528f838287010111156103cb578d8efd5b808386018e86013783018c018d9052908101919091528552509287019290870190600101610308565b50909998505050505050505050565b6000825161041581846020870161052a565b9190910192915050565b90815260200190565b600060408083018584526020828186015281865180845260609350838701915083838202880101838901875b838110156104f6578983037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa001855281518051151584528681015187850152880151888401889052805188850181905260806104b582828801858c0161052a565b96880196601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01694909401909301925090850190600101610454565b50909a9950505050505050505050565b60405181810167ffffffffffffffff8111828210171561052257fe5b604052919050565b60005b8381101561054557818101518382015260200161052d565b83811115610554576000848401525b5050505056fea164736f6c6343000706000a";
|
|
31646
|
-
const isSuperArgs$2 = (xs) => xs.length > 1;
|
|
31647
|
-
class Multicall__factory extends ContractFactory {
|
|
31648
|
-
constructor(...args) {
|
|
31649
|
-
if (isSuperArgs$2(args)) {
|
|
31650
|
-
super(...args);
|
|
31651
|
-
}
|
|
31652
|
-
else {
|
|
31653
|
-
super(_abi$2, _bytecode$2, args[0]);
|
|
31654
|
-
}
|
|
31655
|
-
}
|
|
31656
|
-
deploy(overrides) {
|
|
31657
|
-
return super.deploy(overrides || {});
|
|
31658
|
-
}
|
|
31659
|
-
getDeployTransaction(overrides) {
|
|
31660
|
-
return super.getDeployTransaction(overrides || {});
|
|
31661
|
-
}
|
|
31662
|
-
attach(address) {
|
|
31663
|
-
return super.attach(address);
|
|
31664
|
-
}
|
|
31665
|
-
connect(signer) {
|
|
31666
|
-
return super.connect(signer);
|
|
31667
|
-
}
|
|
31668
|
-
static bytecode = _bytecode$2;
|
|
31669
|
-
static abi = _abi$2;
|
|
31670
|
-
static createInterface() {
|
|
31671
|
-
return new utils$2.Interface(_abi$2);
|
|
31672
|
-
}
|
|
31673
|
-
static connect(address, signerOrProvider) {
|
|
31674
|
-
return new Contract$1(address, _abi$2, signerOrProvider);
|
|
31675
|
-
}
|
|
31676
|
-
}
|
|
31677
|
-
|
|
31678
|
-
/* Autogenerated file. Do not edit manually. */
|
|
31679
|
-
/* tslint:disable */
|
|
31680
|
-
/* eslint-disable */
|
|
31681
|
-
const _abi$1 = [
|
|
31682
31277
|
{
|
|
31683
31278
|
inputs: [
|
|
31684
31279
|
{
|
|
@@ -31962,7 +31557,7 @@ const _abi$1 = [
|
|
|
31962
31557
|
type: "uint256",
|
|
31963
31558
|
},
|
|
31964
31559
|
],
|
|
31965
|
-
internalType: "struct
|
|
31560
|
+
internalType: "struct IImmutableSwapProxy.SecondaryFeeParams[]",
|
|
31966
31561
|
name: "secondaryFees",
|
|
31967
31562
|
type: "tuple[]",
|
|
31968
31563
|
},
|
|
@@ -32035,7 +31630,7 @@ const _abi$1 = [
|
|
|
32035
31630
|
type: "uint256",
|
|
32036
31631
|
},
|
|
32037
31632
|
],
|
|
32038
|
-
internalType: "struct
|
|
31633
|
+
internalType: "struct IImmutableSwapProxy.SecondaryFeeParams[]",
|
|
32039
31634
|
name: "secondaryFees",
|
|
32040
31635
|
type: "tuple[]",
|
|
32041
31636
|
},
|
|
@@ -32093,7 +31688,7 @@ const _abi$1 = [
|
|
|
32093
31688
|
type: "uint256",
|
|
32094
31689
|
},
|
|
32095
31690
|
],
|
|
32096
|
-
internalType: "struct
|
|
31691
|
+
internalType: "struct IImmutableSwapProxy.SecondaryFeeParams[]",
|
|
32097
31692
|
name: "secondaryFees",
|
|
32098
31693
|
type: "tuple[]",
|
|
32099
31694
|
},
|
|
@@ -32144,7 +31739,7 @@ const _abi$1 = [
|
|
|
32144
31739
|
outputs: [
|
|
32145
31740
|
{
|
|
32146
31741
|
internalType: "uint256",
|
|
32147
|
-
name: "",
|
|
31742
|
+
name: "amountIn",
|
|
32148
31743
|
type: "uint256",
|
|
32149
31744
|
},
|
|
32150
31745
|
],
|
|
@@ -32166,7 +31761,7 @@ const _abi$1 = [
|
|
|
32166
31761
|
type: "uint256",
|
|
32167
31762
|
},
|
|
32168
31763
|
],
|
|
32169
|
-
internalType: "struct
|
|
31764
|
+
internalType: "struct IImmutableSwapProxy.SecondaryFeeParams[]",
|
|
32170
31765
|
name: "secondaryFees",
|
|
32171
31766
|
type: "tuple[]",
|
|
32172
31767
|
},
|
|
@@ -32202,7 +31797,7 @@ const _abi$1 = [
|
|
|
32202
31797
|
outputs: [
|
|
32203
31798
|
{
|
|
32204
31799
|
internalType: "uint256",
|
|
32205
|
-
name: "",
|
|
31800
|
+
name: "amountIn",
|
|
32206
31801
|
type: "uint256",
|
|
32207
31802
|
},
|
|
32208
31803
|
],
|
|
@@ -32444,15 +32039,15 @@ const _abi$1 = [
|
|
|
32444
32039
|
type: "receive",
|
|
32445
32040
|
},
|
|
32446
32041
|
];
|
|
32447
|
-
const _bytecode$1 = "0x60806040523480156200001157600080fd5b50604051620031e1380380620031e183398101604081905262000034916200015c565b6001805460ff191690556200004b6000846200009e565b600180546001600160a01b039384166101008102610100600160a81b03199092169190911790915560038054929093166001600160a01b03199283161790925560028054909116909117905550620001a6565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166200013b576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620000fa3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b80516001600160a01b03811681146200015757600080fd5b919050565b6000806000606084860312156200017257600080fd5b6200017d846200013f565b92506200018d602085016200013f565b91506200019d604085016200013f565b90509250925092565b61302b80620001b66000396000f3fe6080604052600436106101175760003560e01c806358e81a50116100a05780638456cb59116100645780638456cb59146102c457806391d14854146102d9578063a217fddf146102f9578063ac9650d81461030e578063d547741f1461032e57600080fd5b806358e81a50146102465780635ae401dc146102595780635c975abb146102795780635ebca7991461029157806368742da6146102a457600080fd5b80632f2ff15d116100e75780632f2ff15d146101cb57806336568abe146101eb578063383ebb0b1461020b5780633f4ba83a1461021e5780635640f6591461023357600080fd5b80620fa9fb1461012357806301ffc9a714610145578063116944b21461017a578063248a9ca31461019b57600080fd5b3661011e57005b600080fd5b34801561012f57600080fd5b5061014361013e3660046127c3565b61034e565b005b34801561015157600080fd5b506101656101603660046127fc565b61041a565b60405190151581526020015b60405180910390f35b61018d61018836600461298d565b610451565b604051908152602001610171565b3480156101a757600080fd5b5061018d6101b63660046129e2565b60009081526020819052604090206001015490565b3480156101d757600080fd5b506101436101e63660046129fb565b6106d3565b3480156101f757600080fd5b506101436102063660046129fb565b6106f8565b61018d610219366004612ae3565b61077b565b34801561022a57600080fd5b50610143610ae7565b61018d610241366004612ae3565b610b37565b61018d61025436600461298d565b610db2565b61026c610267366004612b8f565b6110e4565b6040516101719190612c2a565b34801561028557600080fd5b5060015460ff16610165565b61014361029f3660046129e2565b611119565b3480156102b057600080fd5b506101436102bf366004612c8c565b611266565b3480156102d057600080fd5b506101436112e1565b3480156102e557600080fd5b506101656102f43660046129fb565b61132f565b34801561030557600080fd5b5061018d600081565b34801561031a57600080fd5b5061026c610329366004612ca9565b611358565b34801561033a57600080fd5b506101436103493660046129fb565b61144c565b6103787f7a8dc26796a1e50e6e190b70259f58f6a4edd5b22280ceecc82b687b8e9828693361132f565b610394576040516282b42960e81b815260040160405180910390fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156103db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ff9190612cea565b90506104156001600160a01b0383168483611471565b505050565b60006001600160e01b03198216637965db0b60e01b148061044b57506301ffc9a760e01b6001600160e01b03198316145b92915050565b600061045f60015460ff1690565b1561047d5760405163ab35696f60e01b815260040160405180910390fd5b61048a82606001516114d4565b6104a75760405163519bdea760e01b815260040160405180910390fd5b4780156105e757826080015181146104d2576040516342f7487960e11b815260040160405180910390fd5b60035483516001600160a01b03908116911614610502576040516324d0121760e01b815260040160405180910390fd5b61056283608001518686808060200260200160405190810160405280939291908181526020016000905b828210156105585761054960408302860136819003810190612d03565b8152602001906001019061052c565b50505050506114fa565b608084018190526001546040516304e45aaf60e01b81526101009091046001600160a01b0316916304e45aaf9161059d908790600401612d5a565b60206040518083038185885af11580156105bb573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906105e09190612cea565b91506106cb565b61064c836000015184608001518787808060200260200160405190810160405280939291908181526020016000905b828210156106425761063360408302860136819003810190612d03565b81526020019060010190610616565b505050505061154c565b60808401526001546040516304e45aaf60e01b81526101009091046001600160a01b0316906304e45aaf90610685908690600401612d5a565b6020604051808303816000875af11580156106a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c89190612cea565b91505b509392505050565b6000828152602081905260409020600101546106ee816115a9565b61041583836115b3565b6001600160a01b038116331461076d5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6107778282611637565b5050565b600061078960015460ff1690565b156107a75760405163ab35696f60e01b815260040160405180910390fd5b6107b482602001516114d4565b6107d15760405163519bdea760e01b815260040160405180910390fd5b60006107e0836000015161169c565b9050478015610992576003546001600160a01b03838116911614610817576040516324d0121760e01b815260040160405180910390fd5b8360600151811461083b576040516342f7487960e11b815260040160405180910390fd5b60008061089e86606001518989808060200260200160405190810160405280939291908181526020016000905b828210156108945761088560408302860136819003810190612d03565b81526020019060010190610868565b50505050506116ca565b606088018190526001546040516304dc09a360e11b81529294509092506000916101009091046001600160a01b0316906309b813469084906108e4908b90600401612e00565b60206040518083038185885af1158015610902573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906109279190612cea565b905061098681848b8b808060200260200160405190810160405280939291908181526020016000905b8282101561097c5761096d60408302860136819003810190612d03565b81526020019060010190610950565b505050505061171d565b95505050505050610ae0565b6000806109f68487606001518a8a808060200260200160405190810160405280939291908181526020016000905b828210156109ec576109dd60408302860136819003810190612d03565b815260200190600101906109c0565b5050505050611811565b606088018190526001546040516304dc09a360e11b81529294509092506000916101009091046001600160a01b0316906309b8134690610a3a908a90600401612e00565b6020604051808303816000875af1158015610a59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7d9190612cea565b90506109868582858c8c808060200260200160405190810160405280939291908181526020016000905b82821015610ad357610ac460408302860136819003810190612d03565b81526020019060010190610aa7565b505050505061186b565b50505b9392505050565b610b117fe7276a2a84d8de556657ec9cf93a55a7d66f096e529d0582ed08e9e2208b92b53361132f565b610b2d576040516282b42960e81b815260040160405180910390fd5b610b356118c7565b565b6000610b4560015460ff1690565b15610b635760405163ab35696f60e01b815260040160405180910390fd5b610b7082602001516114d4565b610b8d5760405163519bdea760e01b815260040160405180910390fd5b6000610b9c8360000151611919565b9050478015610cd25783604001518114610bc9576040516342f7487960e11b815260040160405180910390fd5b6003546001600160a01b03838116911614610bf7576040516324d0121760e01b815260040160405180910390fd5b610c4d84604001518787808060200260200160405190810160405280939291908181526020016000905b8282101561055857610c3e60408302860136819003810190612d03565b81526020019060010190610c21565b6040858101829052600154905163b858183f60e01b81526101009091046001600160a01b03169163b858183f91610c88908890600401612e00565b60206040518083038185885af1158015610ca6573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ccb9190612cea565b9250610add565b610d298285604001518888808060200260200160405190810160405280939291908181526020016000905b8282101561064257610d1a60408302860136819003810190612d03565b81526020019060010190610cfd565b604085810191909152600154905163b858183f60e01b81526101009091046001600160a01b03169063b858183f90610d65908790600401612e00565b6020604051808303816000875af1158015610d84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da89190612cea565b9695505050505050565b6000610dc060015460ff1690565b15610dde5760405163ab35696f60e01b815260040160405180910390fd5b610deb82606001516114d4565b610e085760405163519bdea760e01b815260040160405180910390fd5b478015610fa55760035483516001600160a01b03908116911614610e3f576040516324d0121760e01b815260040160405180910390fd5b8260a001518114610e63576040516342f7487960e11b815260040160405180910390fd5b600080610ebc8560a001518888808060200260200160405190810160405280939291908181526020016000905b8282101561089457610ead60408302860136819003810190612d03565b81526020019060010190610e90565b60a08701819052600154604051635023b4df60e01b81529294509092506000916101009091046001600160a01b031690635023b4df908490610f02908a90600401612d5a565b60206040518083038185885af1158015610f20573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f459190612cea565b9050610f9a81848a8a808060200260200160405190810160405280939291908181526020016000905b8282101561097c57610f8b60408302860136819003810190612d03565b81526020019060010190610f6e565b945050505050610ae0565b60008061100385600001518660a001518989808060200260200160405190810160405280939291908181526020016000905b828210156109ec57610ff460408302860136819003810190612d03565b81526020019060010190610fd7565b60a08701819052600154604051635023b4df60e01b81529294509092506000916101009091046001600160a01b031690635023b4df90611047908990600401612d5a565b6020604051808303816000875af1158015611066573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061108a9190612cea565b9050610f9a866000015182858b8b808060200260200160405190810160405280939291908181526020016000905b82821015610ad3576110d560408302860136819003810190612d03565b815260200190600101906110b8565b6060834211156111075760405163387b2e5560e11b815260040160405180910390fd5b6111118383611358565b949350505050565b6003546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015611162573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111869190612cea565b9050818110156111cc5760405162461bcd60e51b8152602060048201526011602482015270092dce6eaccccd2c6d2cadce840ae929ab607b1b6044820152606401610764565b801561077757600354604051632e1a7d4d60e01b8152600481018390526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b15801561121857600080fd5b505af115801561122c573d6000803e3d6000fd5b50505050600061123c3383611925565b905080610415576040516342fb4ceb60e11b81526004810184905260248101839052604401610764565b6112907f7a8dc26796a1e50e6e190b70259f58f6a4edd5b22280ceecc82b687b8e9828693361132f565b6112ac576040516282b42960e81b815260040160405180910390fd5b47156112de5760006112be8247611925565b90508061077757604051633398652560e11b815260040160405180910390fd5b50565b61130b7ffcb9fcbfa83b897fb2d5cf4b58962164105c1e71489a37ef3ae0db3fdce576f63361132f565b611327576040516282b42960e81b815260040160405180910390fd5b610b356119cf565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6060816001600160401b038111156113725761137261286a565b6040519080825280602002602001820160405280156113a557816020015b60608152602001906001900390816113905790505b50905060005b8281101561144557611415308585848181106113c9576113c9612e13565b90506020028101906113db9190612e29565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611a0a92505050565b82828151811061142757611427612e13565b6020026020010181905250808061143d90612e85565b9150506113ab565b5092915050565b600082815260208190526040902060010154611467816115a9565b6104158383611637565b6040516001600160a01b03831660248201526044810182905261041590849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611a2f565b60006001600160a01b03821633148061044b57506001600160a01b038216301492915050565b600061150582611b04565b506000806115138585611b77565b90925090506115228286612e9e565b945061152d81611ca0565b600354611543906001600160a01b031686611d7f565b50929392505050565b600061155782611b04565b506000806115658585611b77565b90925090506115748286612e9e565b94506115808682611e7c565b6115956001600160a01b038716333088611f85565b61159f8686611d7f565b5092949350505050565b6112de8133611fc3565b6115bd828261132f565b610777576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556115f33390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b611641828261132f565b15610777576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600080601483516116ad9190612e9e565b905060006116bd8483601461201c565b9050611111816000612129565b60008060006116d884611b04565b905060006116e882612710612eb1565b90506116f7866127108361218e565b600354909350611710906001600160a01b031684611d7f565b85935050505b9250929050565b600080600061172c8685611b77565b9150915061173981611ca0565b600260009054906101000a90046001600160a01b03166001600160a01b03166312210e8a6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561178957600080fd5b505af115801561179d573d6000803e3d6000fd5b5050505060008287876117b09190612e9e565b6117ba9190612e9e565b604051909150600090339083156108fc0290849084818181858888f193505050509050806117fb576040516382e4f46960e01b815260040160405180910390fd5b6118058489612eb1565b98975050505050505050565b600080600061181f84611b04565b9050600061182f82612710612eb1565b905061183e866127108361218e565b925061184a8784611d7f565b61185f6001600160a01b038816333089611f85565b50939590945092505050565b600080600061187a8685611b77565b9150915061188887826121ce565b6118b233836118978989612e9e565b6118a19190612e9e565b6001600160a01b038a169190611471565b6118bc8287612eb1565b979650505050505050565b6118cf6122d5565b6001805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600061044b8282612129565b6000814710156119775760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610764565b6040516001600160a01b038416908390600081818185875af1925050503d80600081146119c0576040519150601f19603f3d011682016040523d82523d6000602084013e6119c5565b606091505b5090949350505050565b6119d761231e565b6001805460ff1916811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258336118fc565b6060610ae08383604051806060016040528060278152602001612fcf60279139612364565b6000611a84826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166123d29092919063ffffffff16565b9050805160001480611aa5575080806020019051810190611aa59190612ec4565b6104155760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610764565b6000805b8251811015611b4e57828181518110611b2357611b23612e13565b60200260200101516020015182611b3a9190612eb1565b915080611b4681612e85565b915050611b08565b506103e8811115611b725760405163cd4e616760e01b815260040160405180910390fd5b919050565b6000606082516001600160401b03811115611b9457611b9461286a565b604051908082528060200260200182016040528015611bd957816020015b6040805180820190915260008082526020820152815260200190600190039081611bb25790505b50905060005b8351811015611c98576000611c1e858381518110611bff57611bff612e13565b602002602001015160200151612710886123e19092919063ffffffff16565b90506040518060400160405280868481518110611c3d57611c3d612e13565b6020026020010151600001516001600160a01b0316815260200182815250838381518110611c6d57611c6d612e13565b6020908102919091010152611c828185612eb1565b9350508080611c9090612e85565b915050611bdf565b509250929050565b60005b8151811015610777576000828281518110611cc057611cc0612e13565b602002602001015190506000611cde82600001518360200151611925565b905080611d1557815160208301516040516208c3b360e61b81526001600160a01b0390921660048301526024820152604401610764565b81600001516001600160a01b0316336001600160a01b03167fe0e765ab26c1caf691c510426951246128b96830e49cc81d8c093fd551abac358460200151604051611d6291815260200190565b60405180910390a350508080611d7790612e85565b915050611ca3565b600154604051636eb1769f60e11b81523060048201526001600160a01b0361010090920482166024820152829184169063dd62ed3e90604401602060405180830381865afa158015611dd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611df99190612cea565b10156107775760015460405163095ea7b360e01b81526101009091046001600160a01b039081166004830152600019602483015283169063095ea7b3906044016020604051808303816000875af1158015611e58573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104159190612ec4565b60005b815181101561041557611ee233838381518110611e9e57611e9e612e13565b602002602001015160000151848481518110611ebc57611ebc612e13565b602002602001015160200151866001600160a01b0316611f85909392919063ffffffff16565b818181518110611ef457611ef4612e13565b6020026020010151600001516001600160a01b0316336001600160a01b0316846001600160a01b03167f1f9a9fdac86b6ca3c5300bec0b61555cded1f1a234378602dcca6c27085eac8e858581518110611f5057611f50612e13565b602002602001015160200151604051611f6b91815260200190565b60405180910390a480611f7d81612e85565b915050611e7f565b6040516001600160a01b0380851660248301528316604482015260648101829052611fbd9085906323b872dd60e01b9060840161149d565b50505050565b611fcd828261132f565b61077757611fda81612483565b611fe5836020612495565b604051602001611ff6929190612ee6565b60408051601f198184030181529082905262461bcd60e51b825261076491600401612f5b565b60608161202a81601f612eb1565b10156120695760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606401610764565b6120738284612eb1565b845110156120b75760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606401610764565b6060821580156120d65760405191506000825260208201604052612120565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561210f5780518352602092830192016120f7565b5050858452601f01601f1916604052505b50949350505050565b6000612136826014612eb1565b8351101561217e5760405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b6044820152606401610764565b500160200151600160601b900490565b600061219b8484846123e1565b9050600082806121ad576121ad612f6e565b8486091115610ae05760001981106121c457600080fd5b6001019392505050565b60005b8151811015610415576122328282815181106121ef576121ef612e13565b60200260200101516000015183838151811061220d5761220d612e13565b602002602001015160200151856001600160a01b03166114719092919063ffffffff16565b81818151811061224457612244612e13565b6020026020010151600001516001600160a01b0316336001600160a01b0316846001600160a01b03167f1f9a9fdac86b6ca3c5300bec0b61555cded1f1a234378602dcca6c27085eac8e8585815181106122a0576122a0612e13565b6020026020010151602001516040516122bb91815260200190565b60405180910390a4806122cd81612e85565b9150506121d1565b60015460ff16610b355760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610764565b60015460ff1615610b355760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610764565b6060600080856001600160a01b0316856040516123819190612f84565b600060405180830381855af49150503d80600081146123bc576040519150601f19603f3d011682016040523d82523d6000602084013e6123c1565b606091505b5091509150610da886838387612630565b606061111184846000856126a9565b6000838302816000198587098281108382030391505080841161240357600080fd5b8060000361241657508290049050610ae0565b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b606061044b6001600160a01b03831660145b606060006124a4836002612fa0565b6124af906002612eb1565b6001600160401b038111156124c6576124c661286a565b6040519080825280601f01601f1916602001820160405280156124f0576020820181803683370190505b509050600360fc1b8160008151811061250b5761250b612e13565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061253a5761253a612e13565b60200101906001600160f81b031916908160001a905350600061255e846002612fa0565b612569906001612eb1565b90505b60018111156125e1576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061259d5761259d612e13565b1a60f81b8282815181106125b3576125b3612e13565b60200101906001600160f81b031916908160001a90535060049490941c936125da81612fb7565b905061256c565b508315610ae05760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610764565b6060831561269f578251600003612698576001600160a01b0385163b6126985760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610764565b5081611111565b6111118383612779565b60608247101561270a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610764565b600080866001600160a01b031685876040516127269190612f84565b60006040518083038185875af1925050503d8060008114612763576040519150601f19603f3d011682016040523d82523d6000602084013e612768565b606091505b50915091506118bc87838387612630565b8151156127895781518083602001fd5b8060405162461bcd60e51b81526004016107649190612f5b565b6001600160a01b03811681146112de57600080fd5b8035611b72816127a3565b600080604083850312156127d657600080fd5b82356127e1816127a3565b915060208301356127f1816127a3565b809150509250929050565b60006020828403121561280e57600080fd5b81356001600160e01b031981168114610ae057600080fd5b60008083601f84011261283857600080fd5b5081356001600160401b0381111561284f57600080fd5b6020830191508360208260061b850101111561171657600080fd5b634e487b7160e01b600052604160045260246000fd5b60405160e081016001600160401b03811182821017156128a2576128a261286a565b60405290565b604051608081016001600160401b03811182821017156128a2576128a261286a565b604051601f8201601f191681016001600160401b03811182821017156128f2576128f261286a565b604052919050565b600060e0828403121561290c57600080fd5b612914612880565b90508135612921816127a3565b81526020820135612931816127a3565b6020820152604082013562ffffff8116811461294c57600080fd5b604082015261295d606083016127b8565b60608201526080820135608082015260a082013560a082015261298260c083016127b8565b60c082015292915050565b600080600061010084860312156129a357600080fd5b83356001600160401b038111156129b957600080fd5b6129c586828701612826565b90945092506129d9905085602086016128fa565b90509250925092565b6000602082840312156129f457600080fd5b5035919050565b60008060408385031215612a0e57600080fd5b8235915060208301356127f1816127a3565b600060808284031215612a3257600080fd5b612a3a6128a8565b905081356001600160401b0380821115612a5357600080fd5b818401915084601f830112612a6757600080fd5b8135602082821115612a7b57612a7b61286a565b612a8d601f8301601f191682016128ca565b92508183528681838601011115612aa357600080fd5b81818501828501376000818385010152828552612ac18187016127b8565b8186015250505050604082013560408201526060820135606082015292915050565b600080600060408486031215612af857600080fd5b83356001600160401b0380821115612b0f57600080fd5b612b1b87838801612826565b90955093506020860135915080821115612b3457600080fd5b50612b4186828701612a20565b9150509250925092565b60008083601f840112612b5d57600080fd5b5081356001600160401b03811115612b7457600080fd5b6020830191508360208260051b850101111561171657600080fd5b600080600060408486031215612ba457600080fd5b8335925060208401356001600160401b03811115612bc157600080fd5b612bcd86828701612b4b565b9497909650939450505050565b60005b83811015612bf5578181015183820152602001612bdd565b50506000910152565b60008151808452612c16816020860160208601612bda565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612c7f57603f19888603018452612c6d858351612bfe565b94509285019290850190600101612c51565b5092979650505050505050565b600060208284031215612c9e57600080fd5b8135610ae0816127a3565b60008060208385031215612cbc57600080fd5b82356001600160401b03811115612cd257600080fd5b612cde85828601612b4b565b90969095509350505050565b600060208284031215612cfc57600080fd5b5051919050565b600060408284031215612d1557600080fd5b604051604081018181106001600160401b0382111715612d3757612d3761286a565b6040528235612d45816127a3565b81526020928301359281019290925250919050565b60e0810161044b828480516001600160a01b03908116835260208083015182169084015260408083015162ffffff16908401526060808301518216908401526080808301519084015260a0828101519084015260c09182015116910152565b6000815160808452612dce6080850182612bfe565b6020848101516001600160a01b0316908601526040808501519086015260609384015193909401929092525090919050565b602081526000610ae06020830184612db9565b634e487b7160e01b600052603260045260246000fd5b6000808335601e19843603018112612e4057600080fd5b8301803591506001600160401b03821115612e5a57600080fd5b60200191503681900382131561171657600080fd5b634e487b7160e01b600052601160045260246000fd5b600060018201612e9757612e97612e6f565b5060010190565b8181038181111561044b5761044b612e6f565b8082018082111561044b5761044b612e6f565b600060208284031215612ed657600080fd5b81518015158114610ae057600080fd5b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612f1e816017850160208801612bda565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612f4f816028840160208801612bda565b01602801949350505050565b602081526000610ae06020830184612bfe565b634e487b7160e01b600052601260045260246000fd5b60008251612f96818460208701612bda565b9190910192915050565b808202811582820484141761044b5761044b612e6f565b600081612fc657612fc6612e6f565b50600019019056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122060463b8c42f8b619093981b0f594938e67042d40ad9d5eadd4922e9bc3000dde64736f6c63430008130033";
|
|
32448
|
-
const isSuperArgs$
|
|
32449
|
-
class
|
|
32042
|
+
const _bytecode$2 = "0x60806040523480156200001157600080fd5b50604051620034dd380380620034dd83398101604081905262000034916200015c565b6001805460ff191690556200004b6000846200009e565b600180546001600160a01b039384166101008102610100600160a81b03199092169190911790915560038054929093166001600160a01b03199283161790925560028054909116909117905550620001a6565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166200013b576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620000fa3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b80516001600160a01b03811681146200015757600080fd5b919050565b6000806000606084860312156200017257600080fd5b6200017d846200013f565b92506200018d602085016200013f565b91506200019d604085016200013f565b90509250925092565b61332780620001b66000396000f3fe6080604052600436106101175760003560e01c806358e81a50116100a05780638456cb59116100645780638456cb59146102c457806391d14854146102d9578063a217fddf146102f9578063ac9650d81461030e578063d547741f1461032e57600080fd5b806358e81a50146102465780635ae401dc146102595780635c975abb146102795780635ebca7991461029157806368742da6146102a457600080fd5b80632f2ff15d116100e75780632f2ff15d146101cb57806336568abe146101eb578063383ebb0b1461020b5780633f4ba83a1461021e5780635640f6591461023357600080fd5b80620fa9fb1461012357806301ffc9a714610145578063116944b21461017a578063248a9ca31461019b57600080fd5b3661011e57005b600080fd5b34801561012f57600080fd5b5061014361013e366004612ab8565b61034e565b005b34801561015157600080fd5b50610165610160366004612af1565b61041a565b60405190151581526020015b60405180910390f35b61018d610188366004612c89565b610451565b604051908152602001610171565b3480156101a757600080fd5b5061018d6101b6366004612cde565b60009081526020819052604090206001015490565b3480156101d757600080fd5b506101436101e6366004612cf7565b610771565b3480156101f757600080fd5b50610143610206366004612cf7565b610796565b61018d610219366004612ddf565b610819565b34801561022a57600080fd5b50610143610b86565b61018d610241366004612ddf565b610bd6565b61018d610254366004612c89565b610ee4565b61026c610267366004612e8b565b61121e565b6040516101719190612f26565b34801561028557600080fd5b5060015460ff16610165565b61014361029f366004612cde565b611255565b3480156102b057600080fd5b506101436102bf366004612f88565b6113ad565b3480156102d057600080fd5b50610143611428565b3480156102e557600080fd5b506101656102f4366004612cf7565b611476565b34801561030557600080fd5b5061018d600081565b34801561031a57600080fd5b5061026c610329366004612fa5565b61149f565b34801561033a57600080fd5b50610143610349366004612cf7565b611593565b6103787f7a8dc26796a1e50e6e190b70259f58f6a4edd5b22280ceecc82b687b8e98286933611476565b610394576040516282b42960e81b815260040160405180910390fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156103db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ff9190612fe6565b90506104156001600160a01b03831684836115b8565b505050565b60006001600160e01b03198216637965db0b60e01b148061044b57506301ffc9a760e01b6001600160e01b03198316145b92915050565b600061045f60015460ff1690565b1561047d5760405163ab35696f60e01b815260040160405180910390fd5b61048a826060015161161b565b6104a75760405163519bdea760e01b815260040160405180910390fd5b608082015134801561065a57836080015181146104d7576040516342f7487960e11b815260040160405180910390fd5b60035484516001600160a01b03908116911614610507576040516324d0121760e01b815260040160405180910390fd5b60008061056f866000015187608001518a8a808060200260200160405190810160405280939291908181526020016000905b828210156105655761055660408302860136819003810190612fff565b81526020019060010190610539565b5050505050611641565b608088018290526001546040516304e45aaf60e01b815292945090925061010090046001600160a01b0316906304e45aaf9084906105b1908a90600401613056565b60206040518083038185885af11580156105cf573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906105f49190612fe6565b945061065384828a8a808060200260200160405190810160405280939291908181526020016000905b828210156106495761063a60408302860136819003810190612fff565b8152602001906001019061061d565b5050505050611679565b5050610768565b6000806106b8866000015187608001518a8a808060200260200160405190810160405280939291908181526020016000905b82821015610565576106a960408302860136819003810190612fff565b8152602001906001019061068c565b60808801829052875191935091506106db906001600160a01b031633308561170c565b6001546040516304e45aaf60e01b81526101009091046001600160a01b0316906304e45aaf9061070f908990600401613056565b6020604051808303816000875af115801561072e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107529190612fe6565b9450610765866000015185838b8b61174a565b50505b50509392505050565b60008281526020819052604090206001015461078c8161184b565b6104158383611855565b6001600160a01b038116331461080b5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b61081582826118d9565b5050565b600061082760015460ff1690565b156108455760405163ab35696f60e01b815260040160405180910390fd5b610852826020015161161b565b61086f5760405163519bdea760e01b815260040160405180910390fd5b600061087e836000015161193e565b606084015190915034908115610a30576003546001600160a01b038481169116146108bc576040516324d0121760e01b815260040160405180910390fd5b846060015182146108e0576040516342f7487960e11b815260040160405180910390fd5b600061094286606001518989808060200260200160405190810160405280939291908181526020016000905b828210156109385761092960408302860136819003810190612fff565b8152602001906001019061090c565b5050505050611974565b606087018190526001546040516304dc09a360e11b81529192506000916101009091046001600160a01b0316906309b81346908490610985908b906004016130fc565b60206040518083038185885af11580156109a3573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906109c89190612fe6565b9050610a2781848b8b808060200260200160405190810160405280939291908181526020016000905b82821015610a1d57610a0e60408302860136819003810190612fff565b815260200190600101906109f1565b50505050506119c3565b95505050610b7c565b6000610a938487606001518a8a808060200260200160405190810160405280939291908181526020016000905b82821015610a8957610a7a60408302860136819003810190612fff565b81526020019060010190610a5d565b5050505050611aab565b606087018190526001546040516304dc09a360e11b81529192506000916101009091046001600160a01b0316906309b8134690610ad4908a906004016130fc565b6020604051808303816000875af1158015610af3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b179190612fe6565b9050610b778582858c8c808060200260200160405190810160405280939291908181526020016000905b82821015610b6d57610b5e60408302860136819003810190612fff565b81526020019060010190610b41565b5050505050611b03565b955050505b5050509392505050565b610bb07fe7276a2a84d8de556657ec9cf93a55a7d66f096e529d0582ed08e9e2208b92b533611476565b610bcc576040516282b42960e81b815260040160405180910390fd5b610bd4611b57565b565b6000610be460015460ff1690565b15610c025760405163ab35696f60e01b815260040160405180910390fd5b610c0f826020015161161b565b610c2c5760405163519bdea760e01b815260040160405180910390fd5b6000610c3b8360000151611ba9565b6040840151909150348015610dd75784604001518114610c6e576040516342f7487960e11b815260040160405180910390fd5b6003546001600160a01b03848116911614610c9c576040516324d0121760e01b815260040160405180910390fd5b600080610cf68588604001518b8b808060200260200160405190810160405280939291908181526020016000905b8282101561056557610ce760408302860136819003810190612fff565b81526020019060010190610cca565b6040898101839052600154905163b858183f60e01b815292945090925061010090046001600160a01b03169063b858183f908490610d38908b906004016130fc565b60206040518083038185885af1158015610d56573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610d7b9190612fe6565b9550610dd084828b8b808060200260200160405190810160405280939291908181526020016000905b8282101561064957610dc160408302860136819003810190612fff565b81526020019060010190610da4565b5050610b7c565b600080610e318588604001518b8b808060200260200160405190810160405280939291908181526020016000905b8282101561056557610e2260408302860136819003810190612fff565b81526020019060010190610e05565b604089018290529092509050610e526001600160a01b03861633308561170c565b60015460405163b858183f60e01b81526101009091046001600160a01b03169063b858183f90610e86908a906004016130fc565b6020604051808303816000875af1158015610ea5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ec99190612fe6565b9550610ed88585838c8c61174a565b50505050509392505050565b6000610ef260015460ff1690565b15610f105760405163ab35696f60e01b815260040160405180910390fd5b610f1d826060015161161b565b610f3a5760405163519bdea760e01b815260040160405180910390fd5b60a0820151349081156110d75760035484516001600160a01b03908116911614610f77576040516324d0121760e01b815260040160405180910390fd5b8360a001518214610f9b576040516342f7487960e11b815260040160405180910390fd5b6000610ff38560a001518888808060200260200160405190810160405280939291908181526020016000905b8282101561093857610fe460408302860136819003810190612fff565b81526020019060010190610fc7565b60a08601819052600154604051635023b4df60e01b81529192506000916101009091046001600160a01b031690635023b4df908490611036908a90600401613056565b60206040518083038185885af1158015611054573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906110799190612fe6565b90506110ce81848a8a808060200260200160405190810160405280939291908181526020016000905b82821015610a1d576110bf60408302860136819003810190612fff565b815260200190600101906110a2565b94505050610768565b600061113485600001518660a001518989808060200260200160405190810160405280939291908181526020016000905b82821015610a895761112560408302860136819003810190612fff565b81526020019060010190611108565b60a08601819052600154604051635023b4df60e01b81529192506000916101009091046001600160a01b031690635023b4df90611175908990600401613056565b6020604051808303816000875af1158015611194573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111b89190612fe6565b9050611212866000015182858b8b808060200260200160405190810160405280939291908181526020016000905b82821015610b6d5761120360408302860136819003810190612fff565b815260200190600101906111e6565b98975050505050505050565b6060834211156112415760405163387b2e5560e11b815260040160405180910390fd5b61124b838361149f565b90505b9392505050565b60015460ff16156112795760405163ab35696f60e01b815260040160405180910390fd5b6003546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa1580156112c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112e69190612fe6565b905081811015611313576040516342fb4ceb60e11b81526004810183905260248101829052604401610802565b801561081557600354604051632e1a7d4d60e01b8152600481018390526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b15801561135f57600080fd5b505af1158015611373573d6000803e3d6000fd5b5050505060006113833383611bb5565b905080610415576040516342fb4ceb60e11b81526004810184905260248101839052604401610802565b6113d77f7a8dc26796a1e50e6e190b70259f58f6a4edd5b22280ceecc82b687b8e98286933611476565b6113f3576040516282b42960e81b815260040160405180910390fd5b47156114255760006114058247611bb5565b90508061081557604051633398652560e11b815260040160405180910390fd5b50565b6114527ffcb9fcbfa83b897fb2d5cf4b58962164105c1e71489a37ef3ae0db3fdce576f633611476565b61146e576040516282b42960e81b815260040160405180910390fd5b610bd4611c5f565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6060816001600160401b038111156114b9576114b9612b66565b6040519080825280602002602001820160405280156114ec57816020015b60608152602001906001900390816114d75790505b50905060005b8281101561158c5761155c308585848181106115105761151061310f565b90506020028101906115229190613125565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611c9a92505050565b82828151811061156e5761156e61310f565b6020026020010181905250808061158490613181565b9150506114f2565b5092915050565b6000828152602081905260409020600101546115ae8161184b565b61041583836118d9565b6040516001600160a01b03831660248201526044810182905261041590849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611cbf565b60006001600160a01b03821633148061044b57506001600160a01b038216301492915050565b60008061164d83611d94565b506116588484611e07565b509050611665818561319a565b91506116718583611f30565b935093915050565b600061168361202d565b905060006116928583866120a4565b90506000806116a18386611e07565b915091506116ae816120d0565b8315611703576000826116c1858a61319a565b6116cb919061319a565b905080156117015760006116df3383611bb5565b9050806116ff576040516382e4f46960e01b815260040160405180910390fd5b505b505b50505050505050565b6040516001600160a01b03808516602483015283166044820152606481018290526117449085906323b872dd60e01b906084016115e4565b50505050565b6040516370a0823160e01b81523060048201526000906001600160a01b038716906370a0823190602401602060405180830381865afa158015611791573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117b59190612fe6565b905060006117c48683876120a4565b90506000611824828686808060200260200160405190810160405280939291908181526020016000905b8282101561181a5761180b60408302860136819003810190612fff565b815260200190600101906117ee565b5050505050611e07565b91505061183188826121af565b8215611701576117016001600160a01b03891633856115b8565b61142581336122b8565b61185f8282611476565b610815576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556118953390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6118e38282611476565b15610815576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000806014835161194f919061319a565b9050600061195f84836014612311565b905061196c81600061241e565b949350505050565b60008061198083611d94565b90506000611990826127106131ad565b905060006119a18661271084612483565b6003549091506119ba906001600160a01b031682611f30565b95945050505050565b60008060006119d28685611e07565b915091506119df816120d0565b600260009054906101000a90046001600160a01b03166001600160a01b03166312210e8a6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611a2f57600080fd5b505af1158015611a43573d6000803e3d6000fd5b505050506000828787611a56919061319a565b611a60919061319a565b90508015611a96576000611a743383611bb5565b905080611a94576040516382e4f46960e01b815260040160405180910390fd5b505b611aa083886131ad565b979650505050505050565b600080611ab783611d94565b90506000611ac7826127106131ad565b90506000611ad88661271084612483565b9050611ae48782611f30565b611af96001600160a01b03881633308961170c565b9695505050505050565b6000806000611b128685611e07565b91509150611b2087826124c3565b600082611b2d888861319a565b611b37919061319a565b9050611b4d6001600160a01b03891633836115b8565b61121283886131ad565b611b5f6125ca565b6001805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600061044b828261241e565b600081471015611c075760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610802565b6040516001600160a01b038416908390600081818185875af1925050503d8060008114611c50576040519150601f19603f3d011682016040523d82523d6000602084013e611c55565b606091505b5090949350505050565b611c67612613565b6001805460ff1916811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833611b8c565b606061124e83836040518060600160405280602781526020016132cb60279139612659565b6000611d14826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166126c79092919063ffffffff16565b9050805160001480611d35575080806020019051810190611d3591906131c0565b6104155760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610802565b6000805b8251811015611dde57828181518110611db357611db361310f565b60200260200101516020015182611dca91906131ad565b915080611dd681613181565b915050611d98565b506103e8811115611e025760405163cd4e616760e01b815260040160405180910390fd5b919050565b6000606082516001600160401b03811115611e2457611e24612b66565b604051908082528060200260200182016040528015611e6957816020015b6040805180820190915260008082526020820152815260200190600190039081611e425790505b50905060005b8351811015611f28576000611eae858381518110611e8f57611e8f61310f565b602002602001015160200151612710886126d69092919063ffffffff16565b90506040518060400160405280868481518110611ecd57611ecd61310f565b6020026020010151600001516001600160a01b0316815260200182815250838381518110611efd57611efd61310f565b6020908102919091010152611f1281856131ad565b9350508080611f2090613181565b915050611e6f565b509250929050565b600154604051636eb1769f60e11b81523060048201526001600160a01b0361010090920482166024820152829184169063dd62ed3e90604401602060405180830381865afa158015611f86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611faa9190612fe6565b10156108155760015460405163095ea7b360e01b81526101009091046001600160a01b039081166004830152600019602483015283169063095ea7b3906044016020604051808303816000875af1158015612009573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041591906131c0565b60025460408051630910874560e11b8152905160009247926001600160a01b03909116916312210e8a91600480820192879290919082900301818387803b15801561207757600080fd5b505af115801561208b573d6000803e3d6000fd5b5047925061209d91508390508261319a565b9250505090565b600082156120c857816120b7848661319a565b6120c1919061319a565b905061124e565b509192915050565b60005b81518110156108155760008282815181106120f0576120f061310f565b60200260200101519050600061210e82600001518360200151611bb5565b90508061214557815160208301516040516208c3b360e61b81526001600160a01b0390921660048301526024820152604401610802565b81600001516001600160a01b0316336001600160a01b03167fe0e765ab26c1caf691c510426951246128b96830e49cc81d8c093fd551abac35846020015160405161219291815260200190565b60405180910390a3505080806121a790613181565b9150506120d3565b60005b815181101561041557612215338383815181106121d1576121d161310f565b6020026020010151600001518484815181106121ef576121ef61310f565b602002602001015160200151866001600160a01b031661170c909392919063ffffffff16565b8181815181106122275761222761310f565b6020026020010151600001516001600160a01b0316336001600160a01b0316846001600160a01b03167f1f9a9fdac86b6ca3c5300bec0b61555cded1f1a234378602dcca6c27085eac8e8585815181106122835761228361310f565b60200260200101516020015160405161229e91815260200190565b60405180910390a4806122b081613181565b9150506121b2565b6122c28282611476565b610815576122cf81612778565b6122da83602061278a565b6040516020016122eb9291906131e2565b60408051601f198184030181529082905262461bcd60e51b825261080291600401613257565b60608161231f81601f6131ad565b101561235e5760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606401610802565b61236882846131ad565b845110156123ac5760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606401610802565b6060821580156123cb5760405191506000825260208201604052612415565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156124045780518352602092830192016123ec565b5050858452601f01601f1916604052505b50949350505050565b600061242b8260146131ad565b835110156124735760405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b6044820152606401610802565b500160200151600160601b900490565b60006124908484846126d6565b9050600082806124a2576124a261326a565b848609111561124e5760001981106124b957600080fd5b6001019392505050565b60005b8151811015610415576125278282815181106124e4576124e461310f565b6020026020010151600001518383815181106125025761250261310f565b602002602001015160200151856001600160a01b03166115b89092919063ffffffff16565b8181815181106125395761253961310f565b6020026020010151600001516001600160a01b0316336001600160a01b0316846001600160a01b03167f1f9a9fdac86b6ca3c5300bec0b61555cded1f1a234378602dcca6c27085eac8e8585815181106125955761259561310f565b6020026020010151602001516040516125b091815260200190565b60405180910390a4806125c281613181565b9150506124c6565b60015460ff16610bd45760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610802565b60015460ff1615610bd45760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610802565b6060600080856001600160a01b0316856040516126769190613280565b600060405180830381855af49150503d80600081146126b1576040519150601f19603f3d011682016040523d82523d6000602084013e6126b6565b606091505b5091509150611af986838387612925565b606061124b848460008561299e565b600083830281600019858709828110838203039150508084116126f857600080fd5b8060000361270b5750829004905061124e565b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b606061044b6001600160a01b03831660145b6060600061279983600261329c565b6127a49060026131ad565b6001600160401b038111156127bb576127bb612b66565b6040519080825280601f01601f1916602001820160405280156127e5576020820181803683370190505b509050600360fc1b816000815181106128005761280061310f565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061282f5761282f61310f565b60200101906001600160f81b031916908160001a905350600061285384600261329c565b61285e9060016131ad565b90505b60018111156128d6576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106128925761289261310f565b1a60f81b8282815181106128a8576128a861310f565b60200101906001600160f81b031916908160001a90535060049490941c936128cf816132b3565b9050612861565b50831561124e5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610802565b6060831561299457825160000361298d576001600160a01b0385163b61298d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610802565b508161196c565b61196c8383612a6e565b6060824710156129ff5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610802565b600080866001600160a01b03168587604051612a1b9190613280565b60006040518083038185875af1925050503d8060008114612a58576040519150601f19603f3d011682016040523d82523d6000602084013e612a5d565b606091505b5091509150611aa087838387612925565b815115612a7e5781518083602001fd5b8060405162461bcd60e51b81526004016108029190613257565b6001600160a01b038116811461142557600080fd5b8035611e0281612a98565b60008060408385031215612acb57600080fd5b8235612ad681612a98565b91506020830135612ae681612a98565b809150509250929050565b600060208284031215612b0357600080fd5b81356001600160e01b03198116811461124e57600080fd5b60008083601f840112612b2d57600080fd5b5081356001600160401b03811115612b4457600080fd5b6020830191508360208260061b8501011115612b5f57600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b60405160e081016001600160401b0381118282101715612b9e57612b9e612b66565b60405290565b604051608081016001600160401b0381118282101715612b9e57612b9e612b66565b604051601f8201601f191681016001600160401b0381118282101715612bee57612bee612b66565b604052919050565b600060e08284031215612c0857600080fd5b612c10612b7c565b90508135612c1d81612a98565b81526020820135612c2d81612a98565b6020820152604082013562ffffff81168114612c4857600080fd5b6040820152612c5960608301612aad565b60608201526080820135608082015260a082013560a0820152612c7e60c08301612aad565b60c082015292915050565b60008060006101008486031215612c9f57600080fd5b83356001600160401b03811115612cb557600080fd5b612cc186828701612b1b565b9094509250612cd590508560208601612bf6565b90509250925092565b600060208284031215612cf057600080fd5b5035919050565b60008060408385031215612d0a57600080fd5b823591506020830135612ae681612a98565b600060808284031215612d2e57600080fd5b612d36612ba4565b905081356001600160401b0380821115612d4f57600080fd5b818401915084601f830112612d6357600080fd5b8135602082821115612d7757612d77612b66565b612d89601f8301601f19168201612bc6565b92508183528681838601011115612d9f57600080fd5b81818501828501376000818385010152828552612dbd818701612aad565b8186015250505050604082013560408201526060820135606082015292915050565b600080600060408486031215612df457600080fd5b83356001600160401b0380821115612e0b57600080fd5b612e1787838801612b1b565b90955093506020860135915080821115612e3057600080fd5b50612e3d86828701612d1c565b9150509250925092565b60008083601f840112612e5957600080fd5b5081356001600160401b03811115612e7057600080fd5b6020830191508360208260051b8501011115612b5f57600080fd5b600080600060408486031215612ea057600080fd5b8335925060208401356001600160401b03811115612ebd57600080fd5b612ec986828701612e47565b9497909650939450505050565b60005b83811015612ef1578181015183820152602001612ed9565b50506000910152565b60008151808452612f12816020860160208601612ed6565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612f7b57603f19888603018452612f69858351612efa565b94509285019290850190600101612f4d565b5092979650505050505050565b600060208284031215612f9a57600080fd5b813561124e81612a98565b60008060208385031215612fb857600080fd5b82356001600160401b03811115612fce57600080fd5b612fda85828601612e47565b90969095509350505050565b600060208284031215612ff857600080fd5b5051919050565b60006040828403121561301157600080fd5b604051604081018181106001600160401b038211171561303357613033612b66565b604052823561304181612a98565b81526020928301359281019290925250919050565b60e0810161044b828480516001600160a01b03908116835260208083015182169084015260408083015162ffffff16908401526060808301518216908401526080808301519084015260a0828101519084015260c09182015116910152565b60008151608084526130ca6080850182612efa565b6020848101516001600160a01b0316908601526040808501519086015260609384015193909401929092525090919050565b60208152600061124e60208301846130b5565b634e487b7160e01b600052603260045260246000fd5b6000808335601e1984360301811261313c57600080fd5b8301803591506001600160401b0382111561315657600080fd5b602001915036819003821315612b5f57600080fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016131935761319361316b565b5060010190565b8181038181111561044b5761044b61316b565b8082018082111561044b5761044b61316b565b6000602082840312156131d257600080fd5b8151801515811461124e57600080fd5b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161321a816017850160208801612ed6565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161324b816028840160208801612ed6565b01602801949350505050565b60208152600061124e6020830184612efa565b634e487b7160e01b600052601260045260246000fd5b60008251613292818460208701612ed6565b9190910192915050565b808202811582820484141761044b5761044b61316b565b6000816132c2576132c261316b565b50600019019056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220162c0f9d1b47c666f486fc65c7c7502bb0e7378e3166be6f93d98943154831c364736f6c63430008130033";
|
|
32043
|
+
const isSuperArgs$2 = (xs) => xs.length > 1;
|
|
32044
|
+
class ImmutableSwapProxy__factory extends ContractFactory {
|
|
32450
32045
|
constructor(...args) {
|
|
32451
|
-
if (isSuperArgs$
|
|
32046
|
+
if (isSuperArgs$2(args)) {
|
|
32452
32047
|
super(...args);
|
|
32453
32048
|
}
|
|
32454
32049
|
else {
|
|
32455
|
-
super(_abi$
|
|
32050
|
+
super(_abi$2, _bytecode$2, args[0]);
|
|
32456
32051
|
}
|
|
32457
32052
|
}
|
|
32458
32053
|
deploy(_admin, _uniRouter, _wimx, overrides) {
|
|
@@ -32467,6 +32062,134 @@ class SecondaryFee__factory extends ContractFactory {
|
|
|
32467
32062
|
connect(signer) {
|
|
32468
32063
|
return super.connect(signer);
|
|
32469
32064
|
}
|
|
32065
|
+
static bytecode = _bytecode$2;
|
|
32066
|
+
static abi = _abi$2;
|
|
32067
|
+
static createInterface() {
|
|
32068
|
+
return new utils$2.Interface(_abi$2);
|
|
32069
|
+
}
|
|
32070
|
+
static connect(address, signerOrProvider) {
|
|
32071
|
+
return new Contract$1(address, _abi$2, signerOrProvider);
|
|
32072
|
+
}
|
|
32073
|
+
}
|
|
32074
|
+
|
|
32075
|
+
/* Autogenerated file. Do not edit manually. */
|
|
32076
|
+
/* tslint:disable */
|
|
32077
|
+
/* eslint-disable */
|
|
32078
|
+
const _abi$1 = [
|
|
32079
|
+
{
|
|
32080
|
+
inputs: [],
|
|
32081
|
+
name: "getCurrentBlockTimestamp",
|
|
32082
|
+
outputs: [
|
|
32083
|
+
{
|
|
32084
|
+
internalType: "uint256",
|
|
32085
|
+
name: "timestamp",
|
|
32086
|
+
type: "uint256",
|
|
32087
|
+
},
|
|
32088
|
+
],
|
|
32089
|
+
stateMutability: "view",
|
|
32090
|
+
type: "function",
|
|
32091
|
+
},
|
|
32092
|
+
{
|
|
32093
|
+
inputs: [
|
|
32094
|
+
{
|
|
32095
|
+
internalType: "address",
|
|
32096
|
+
name: "addr",
|
|
32097
|
+
type: "address",
|
|
32098
|
+
},
|
|
32099
|
+
],
|
|
32100
|
+
name: "getEthBalance",
|
|
32101
|
+
outputs: [
|
|
32102
|
+
{
|
|
32103
|
+
internalType: "uint256",
|
|
32104
|
+
name: "balance",
|
|
32105
|
+
type: "uint256",
|
|
32106
|
+
},
|
|
32107
|
+
],
|
|
32108
|
+
stateMutability: "view",
|
|
32109
|
+
type: "function",
|
|
32110
|
+
},
|
|
32111
|
+
{
|
|
32112
|
+
inputs: [
|
|
32113
|
+
{
|
|
32114
|
+
components: [
|
|
32115
|
+
{
|
|
32116
|
+
internalType: "address",
|
|
32117
|
+
name: "target",
|
|
32118
|
+
type: "address",
|
|
32119
|
+
},
|
|
32120
|
+
{
|
|
32121
|
+
internalType: "uint256",
|
|
32122
|
+
name: "gasLimit",
|
|
32123
|
+
type: "uint256",
|
|
32124
|
+
},
|
|
32125
|
+
{
|
|
32126
|
+
internalType: "bytes",
|
|
32127
|
+
name: "callData",
|
|
32128
|
+
type: "bytes",
|
|
32129
|
+
},
|
|
32130
|
+
],
|
|
32131
|
+
internalType: "struct UniswapInterfaceMulticall.Call[]",
|
|
32132
|
+
name: "calls",
|
|
32133
|
+
type: "tuple[]",
|
|
32134
|
+
},
|
|
32135
|
+
],
|
|
32136
|
+
name: "multicall",
|
|
32137
|
+
outputs: [
|
|
32138
|
+
{
|
|
32139
|
+
internalType: "uint256",
|
|
32140
|
+
name: "blockNumber",
|
|
32141
|
+
type: "uint256",
|
|
32142
|
+
},
|
|
32143
|
+
{
|
|
32144
|
+
components: [
|
|
32145
|
+
{
|
|
32146
|
+
internalType: "bool",
|
|
32147
|
+
name: "success",
|
|
32148
|
+
type: "bool",
|
|
32149
|
+
},
|
|
32150
|
+
{
|
|
32151
|
+
internalType: "uint256",
|
|
32152
|
+
name: "gasUsed",
|
|
32153
|
+
type: "uint256",
|
|
32154
|
+
},
|
|
32155
|
+
{
|
|
32156
|
+
internalType: "bytes",
|
|
32157
|
+
name: "returnData",
|
|
32158
|
+
type: "bytes",
|
|
32159
|
+
},
|
|
32160
|
+
],
|
|
32161
|
+
internalType: "struct UniswapInterfaceMulticall.Result[]",
|
|
32162
|
+
name: "returnData",
|
|
32163
|
+
type: "tuple[]",
|
|
32164
|
+
},
|
|
32165
|
+
],
|
|
32166
|
+
stateMutability: "nonpayable",
|
|
32167
|
+
type: "function",
|
|
32168
|
+
},
|
|
32169
|
+
];
|
|
32170
|
+
const _bytecode$1 = "0x608060405234801561001057600080fd5b50610567806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80630f28c97d146100465780631749e1e3146100645780634d2301cc14610085575b600080fd5b61004e610098565b60405161005b919061041f565b60405180910390f35b6100776100723660046102a7565b61009c565b60405161005b929190610428565b61004e610093366004610286565b610220565b4290565b8051439060609067ffffffffffffffff811180156100b957600080fd5b506040519080825280602002602001820160405280156100f357816020015b6100e061023a565b8152602001906001900390816100d85790505b50905060005b835181101561021a57600080600086848151811061011357fe5b60200260200101516000015187858151811061012b57fe5b60200260200101516020015188868151811061014357fe5b60200260200101516040015192509250925060005a90506000808573ffffffffffffffffffffffffffffffffffffffff1685856040516101839190610403565b60006040518083038160008787f1925050503d80600081146101c1576040519150601f19603f3d011682016040523d82523d6000602084013e6101c6565b606091505b509150915060005a8403905060405180606001604052808415158152602001828152602001838152508989815181106101fb57fe5b60200260200101819052505050505050505080806001019150506100f9565b50915091565b73ffffffffffffffffffffffffffffffffffffffff163190565b604051806060016040528060001515815260200160008152602001606081525090565b803573ffffffffffffffffffffffffffffffffffffffff8116811461028157600080fd5b919050565b600060208284031215610297578081fd5b6102a08261025d565b9392505050565b600060208083850312156102b9578182fd5b823567ffffffffffffffff808211156102d0578384fd5b818501915085601f8301126102e3578384fd5b8135818111156102ef57fe5b6102fc8485830201610506565b81815284810190848601875b848110156103f457813587017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0606081838f03011215610346578a8bfd5b60408051606081018181108b8211171561035c57fe5b8252610369848d0161025d565b8152818401358c82015260608401358a811115610384578d8efd5b8085019450508e603f850112610398578c8dfd5b8b8401358a8111156103a657fe5b6103b68d85601f84011601610506565b93508084528f838287010111156103cb578d8efd5b808386018e86013783018c018d9052908101919091528552509287019290870190600101610308565b50909998505050505050505050565b6000825161041581846020870161052a565b9190910192915050565b90815260200190565b600060408083018584526020828186015281865180845260609350838701915083838202880101838901875b838110156104f6578983037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa001855281518051151584528681015187850152880151888401889052805188850181905260806104b582828801858c0161052a565b96880196601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01694909401909301925090850190600101610454565b50909a9950505050505050505050565b60405181810167ffffffffffffffff8111828210171561052257fe5b604052919050565b60005b8381101561054557818101518382015260200161052d565b83811115610554576000848401525b5050505056fea164736f6c6343000706000a";
|
|
32171
|
+
const isSuperArgs$1 = (xs) => xs.length > 1;
|
|
32172
|
+
class Multicall__factory extends ContractFactory {
|
|
32173
|
+
constructor(...args) {
|
|
32174
|
+
if (isSuperArgs$1(args)) {
|
|
32175
|
+
super(...args);
|
|
32176
|
+
}
|
|
32177
|
+
else {
|
|
32178
|
+
super(_abi$1, _bytecode$1, args[0]);
|
|
32179
|
+
}
|
|
32180
|
+
}
|
|
32181
|
+
deploy(overrides) {
|
|
32182
|
+
return super.deploy(overrides || {});
|
|
32183
|
+
}
|
|
32184
|
+
getDeployTransaction(overrides) {
|
|
32185
|
+
return super.getDeployTransaction(overrides || {});
|
|
32186
|
+
}
|
|
32187
|
+
attach(address) {
|
|
32188
|
+
return super.attach(address);
|
|
32189
|
+
}
|
|
32190
|
+
connect(signer) {
|
|
32191
|
+
return super.connect(signer);
|
|
32192
|
+
}
|
|
32470
32193
|
static bytecode = _bytecode$1;
|
|
32471
32194
|
static abi = _abi$1;
|
|
32472
32195
|
static createInterface() {
|
|
@@ -34285,14 +34008,14 @@ function buildSinglePoolSwap(tokenIn, tokenOut, recipient, trade, route, amountI
|
|
|
34285
34008
|
}
|
|
34286
34009
|
return calldatas;
|
|
34287
34010
|
}
|
|
34288
|
-
function buildSinglePoolSwapWithFees(recipient, trade, route, amountIn, amountOut, secondaryFees,
|
|
34011
|
+
function buildSinglePoolSwapWithFees(recipient, trade, route, amountIn, amountOut, secondaryFees, swapProxyContract, tokenOut) {
|
|
34289
34012
|
const secondaryFeeValues = secondaryFees.map((fee) => ({
|
|
34290
34013
|
feeBasisPoints: fee.basisPoints,
|
|
34291
34014
|
recipient: fee.recipient,
|
|
34292
34015
|
}));
|
|
34293
34016
|
const calldatas = [];
|
|
34294
34017
|
if (trade.tradeType === Uniswap.TradeType.EXACT_INPUT) {
|
|
34295
|
-
calldatas.push(
|
|
34018
|
+
calldatas.push(swapProxyContract.encodeFunctionData('exactInputSingleWithSecondaryFee', [
|
|
34296
34019
|
secondaryFeeValues,
|
|
34297
34020
|
{
|
|
34298
34021
|
tokenIn: route.tokenPath[0].address,
|
|
@@ -34306,7 +34029,7 @@ function buildSinglePoolSwapWithFees(recipient, trade, route, amountIn, amountOu
|
|
|
34306
34029
|
]));
|
|
34307
34030
|
}
|
|
34308
34031
|
if (trade.tradeType === Uniswap.TradeType.EXACT_OUTPUT) {
|
|
34309
|
-
calldatas.push(
|
|
34032
|
+
calldatas.push(swapProxyContract.encodeFunctionData('exactOutputSingleWithSecondaryFee', [
|
|
34310
34033
|
secondaryFeeValues,
|
|
34311
34034
|
{
|
|
34312
34035
|
tokenIn: route.tokenPath[0].address,
|
|
@@ -34322,7 +34045,7 @@ function buildSinglePoolSwapWithFees(recipient, trade, route, amountIn, amountOu
|
|
|
34322
34045
|
const shouldUnwrapTokens = isNative(tokenOut);
|
|
34323
34046
|
if (shouldUnwrapTokens) {
|
|
34324
34047
|
// Unwrap the output token if the user specified a native token as the output
|
|
34325
|
-
calldatas.push(
|
|
34048
|
+
calldatas.push(swapProxyContract.encodeFunctionData('unwrapNativeToken', [amountOut]));
|
|
34326
34049
|
}
|
|
34327
34050
|
return calldatas;
|
|
34328
34051
|
}
|
|
@@ -34364,7 +34087,7 @@ function buildMultiPoolSwap(tokenIn, tokenOut, recipient, trade, route, amountIn
|
|
|
34364
34087
|
}
|
|
34365
34088
|
return calldatas;
|
|
34366
34089
|
}
|
|
34367
|
-
function buildMultiPoolSwapWithFees(recipient, trade, route, amountIn, amountOut, secondaryFees,
|
|
34090
|
+
function buildMultiPoolSwapWithFees(recipient, trade, route, amountIn, amountOut, secondaryFees, swapProxyContract, tokenOut) {
|
|
34368
34091
|
const path = encodeRouteToPath(route, trade.tradeType === Uniswap.TradeType.EXACT_OUTPUT);
|
|
34369
34092
|
const secondaryFeeValues = secondaryFees.map((fee) => ({
|
|
34370
34093
|
feeBasisPoints: fee.basisPoints,
|
|
@@ -34372,7 +34095,7 @@ function buildMultiPoolSwapWithFees(recipient, trade, route, amountIn, amountOut
|
|
|
34372
34095
|
}));
|
|
34373
34096
|
const calldatas = [];
|
|
34374
34097
|
if (trade.tradeType === Uniswap.TradeType.EXACT_INPUT) {
|
|
34375
|
-
calldatas.push(
|
|
34098
|
+
calldatas.push(swapProxyContract.encodeFunctionData('exactInputWithSecondaryFee', [
|
|
34376
34099
|
secondaryFeeValues,
|
|
34377
34100
|
{
|
|
34378
34101
|
path,
|
|
@@ -34383,7 +34106,7 @@ function buildMultiPoolSwapWithFees(recipient, trade, route, amountIn, amountOut
|
|
|
34383
34106
|
]));
|
|
34384
34107
|
}
|
|
34385
34108
|
if (trade.tradeType === Uniswap.TradeType.EXACT_OUTPUT) {
|
|
34386
|
-
calldatas.push(
|
|
34109
|
+
calldatas.push(swapProxyContract.encodeFunctionData('exactOutputWithSecondaryFee', [
|
|
34387
34110
|
secondaryFeeValues,
|
|
34388
34111
|
{
|
|
34389
34112
|
path,
|
|
@@ -34396,7 +34119,7 @@ function buildMultiPoolSwapWithFees(recipient, trade, route, amountIn, amountOut
|
|
|
34396
34119
|
const shouldUnwrapTokens = isNative(tokenOut);
|
|
34397
34120
|
if (shouldUnwrapTokens) {
|
|
34398
34121
|
// Unwrap the output token if the user specified a native token as the output
|
|
34399
|
-
calldatas.push(
|
|
34122
|
+
calldatas.push(swapProxyContract.encodeFunctionData('unwrapNativeToken', [amountOut]));
|
|
34400
34123
|
}
|
|
34401
34124
|
return calldatas;
|
|
34402
34125
|
}
|
|
@@ -34407,14 +34130,14 @@ function buildMultiPoolSwapWithFees(recipient, trade, route, amountIn, amountOut
|
|
|
34407
34130
|
* @param fromAddress The address of the user
|
|
34408
34131
|
* @param trade The trade to be executed
|
|
34409
34132
|
* @param secondaryFees Secondary fees to be applied to the swap
|
|
34410
|
-
* @param
|
|
34133
|
+
* @param swapProxyContract The SecondaryFee contract interface
|
|
34411
34134
|
* @param routerContract The SwapRouter02 contract interface
|
|
34412
34135
|
* @param paymentsContract The PaymentsExtended contract interface
|
|
34413
34136
|
* @param maximumAmountIn The maximum amount of tokenIn to be swapped
|
|
34414
34137
|
* @param minimumAmountOut The minimum amount of tokenOut to be received
|
|
34415
34138
|
* @returns calldatas that make up the swap transaction
|
|
34416
34139
|
*/
|
|
34417
|
-
function buildSwapParameters(tokenIn, tokenOut, recipient, trade, secondaryFees,
|
|
34140
|
+
function buildSwapParameters(tokenIn, tokenOut, recipient, trade, secondaryFees, swapProxyContract, routerContract, paymentsContract, maximumAmountIn, minimumAmountOut) {
|
|
34418
34141
|
// @dev we don't support multiple swaps in a single transaction
|
|
34419
34142
|
// there will always be only one swap in the trade regardless of the trade type
|
|
34420
34143
|
const { route } = trade.swaps[0];
|
|
@@ -34422,22 +34145,22 @@ function buildSwapParameters(tokenIn, tokenOut, recipient, trade, secondaryFees,
|
|
|
34422
34145
|
const hasSecondaryFees = secondaryFees.length > 0;
|
|
34423
34146
|
if (isSinglePoolSwap) {
|
|
34424
34147
|
if (hasSecondaryFees) {
|
|
34425
|
-
return buildSinglePoolSwapWithFees(recipient, trade, route, maximumAmountIn, minimumAmountOut, secondaryFees,
|
|
34148
|
+
return buildSinglePoolSwapWithFees(recipient, trade, route, maximumAmountIn, minimumAmountOut, secondaryFees, swapProxyContract, tokenOut);
|
|
34426
34149
|
}
|
|
34427
34150
|
return buildSinglePoolSwap(tokenIn, tokenOut, recipient, trade, route, maximumAmountIn, minimumAmountOut, routerContract, paymentsContract);
|
|
34428
34151
|
}
|
|
34429
34152
|
if (hasSecondaryFees) {
|
|
34430
|
-
return buildMultiPoolSwapWithFees(recipient, trade, route, maximumAmountIn, minimumAmountOut, secondaryFees,
|
|
34153
|
+
return buildMultiPoolSwapWithFees(recipient, trade, route, maximumAmountIn, minimumAmountOut, secondaryFees, swapProxyContract, tokenOut);
|
|
34431
34154
|
}
|
|
34432
34155
|
return buildMultiPoolSwap(tokenIn, tokenOut, recipient, trade, route, maximumAmountIn, minimumAmountOut, routerContract, paymentsContract);
|
|
34433
34156
|
}
|
|
34434
34157
|
function createSwapCallParameters(tokenIn, tokenOut, trade, recipient, swapOptions, secondaryFees, maximumAmountIn, minimumAmountOut) {
|
|
34435
|
-
const
|
|
34158
|
+
const swapProxyContract = ImmutableSwapProxy__factory.createInterface();
|
|
34436
34159
|
const routerContract = SwapRouter.INTERFACE;
|
|
34437
34160
|
const paymentsContract = PaymentsExtended.INTERFACE;
|
|
34438
|
-
const calldatas = buildSwapParameters(tokenIn, tokenOut, recipient, trade, secondaryFees,
|
|
34161
|
+
const calldatas = buildSwapParameters(tokenIn, tokenOut, recipient, trade, secondaryFees, swapProxyContract, routerContract, paymentsContract, maximumAmountIn, minimumAmountOut);
|
|
34439
34162
|
// Create the multicall transaction using the calldatas generated above
|
|
34440
|
-
return
|
|
34163
|
+
return swapProxyContract.encodeFunctionData(multicallWithDeadlineFunctionSignature, [
|
|
34441
34164
|
swapOptions.deadlineOrPreviousBlockhash,
|
|
34442
34165
|
calldatas,
|
|
34443
34166
|
]);
|
|
@@ -34630,7 +34353,7 @@ class Exchange {
|
|
|
34630
34353
|
wrappedNativeToken;
|
|
34631
34354
|
secondaryFees;
|
|
34632
34355
|
nativeTokenService;
|
|
34633
|
-
|
|
34356
|
+
swapProxyContractAddress;
|
|
34634
34357
|
routerContractAddress;
|
|
34635
34358
|
constructor(configuration) {
|
|
34636
34359
|
const config = new ExchangeConfiguration(configuration);
|
|
@@ -34640,7 +34363,7 @@ class Exchange {
|
|
|
34640
34363
|
this.nativeTokenService = new NativeTokenService(this.nativeToken, this.wrappedNativeToken);
|
|
34641
34364
|
this.secondaryFees = config.secondaryFees;
|
|
34642
34365
|
this.routerContractAddress = config.chain.contracts.peripheryRouter;
|
|
34643
|
-
this.
|
|
34366
|
+
this.swapProxyContractAddress = config.chain.contracts.secondaryFee;
|
|
34644
34367
|
this.provider = new ethers.providers.StaticJsonRpcProvider({
|
|
34645
34368
|
url: config.chain.rpcUrl,
|
|
34646
34369
|
skipFetchSetup: true,
|
|
@@ -34666,8 +34389,8 @@ class Exchange {
|
|
|
34666
34389
|
if (this.secondaryFees.length === 0) {
|
|
34667
34390
|
return [];
|
|
34668
34391
|
}
|
|
34669
|
-
const
|
|
34670
|
-
if (await
|
|
34392
|
+
const swapProxyContract = ImmutableSwapProxy__factory.connect(this.swapProxyContractAddress, provider);
|
|
34393
|
+
if (await swapProxyContract.paused()) {
|
|
34671
34394
|
// Do not use secondary fees if the contract is paused
|
|
34672
34395
|
return [];
|
|
34673
34396
|
}
|
|
@@ -34704,11 +34427,11 @@ class Exchange {
|
|
|
34704
34427
|
// Quotes will always use ERC20s. If the user-specified token is Native, we use the Wrapped Native Token pool
|
|
34705
34428
|
const ourQuote = await this.router.findOptimalRoute(ourQuoteReqAmount, this.nativeTokenService.maybeWrapToken(otherToken), tradeType, maxHops);
|
|
34706
34429
|
const adjustedQuote = adjustQuoteWithFees(ourQuote, amountSpecified, fees, this.nativeTokenService);
|
|
34707
|
-
const swap = getSwap(tokenIn, tokenOut, adjustedQuote, fromAddress, slippagePercent, deadline, this.routerContractAddress, this.
|
|
34430
|
+
const swap = getSwap(tokenIn, tokenOut, adjustedQuote, fromAddress, slippagePercent, deadline, this.routerContractAddress, this.swapProxyContractAddress, gasPrice, secondaryFees);
|
|
34708
34431
|
const { quotedAmount, quotedAmountWithMaxSlippage } = prepareUserQuote(this.nativeTokenService, adjustedQuote, slippagePercent, otherToken);
|
|
34709
34432
|
const preparedApproval = prepareApproval(tradeType, amountSpecified, quotedAmountWithMaxSlippage, {
|
|
34710
34433
|
routerAddress: this.routerContractAddress,
|
|
34711
|
-
secondaryFeeAddress: this.
|
|
34434
|
+
secondaryFeeAddress: this.swapProxyContractAddress,
|
|
34712
34435
|
}, secondaryFees);
|
|
34713
34436
|
// preparedApproval always uses the tokenIn address because we are always selling the tokenIn
|
|
34714
34437
|
const approval = preparedApproval
|
|
@@ -35683,7 +35406,7 @@ const GAS_OVERRIDES = {
|
|
|
35683
35406
|
maxPriorityFeePerGas: BigNumber$1.from(101e9),
|
|
35684
35407
|
};
|
|
35685
35408
|
|
|
35686
|
-
const SDK_VERSION_MARKER = '0.39.
|
|
35409
|
+
const SDK_VERSION_MARKER = '0.39.1';
|
|
35687
35410
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
35688
35411
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
35689
35412
|
|