rubic-sdk 4.29.4 → 4.29.5

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.
@@ -166321,12 +166321,14 @@ __webpack_require__.r(__webpack_exports__);
166321
166321
  /* harmony export */ getExternalId: () => (/* binding */ getExternalId),
166322
166322
  /* harmony export */ getInternalId: () => (/* binding */ getInternalId),
166323
166323
  /* harmony export */ getLogWithTimeout: () => (/* binding */ getLogWithTimeout),
166324
+ /* harmony export */ getMinAmount: () => (/* binding */ getMinAmount),
166324
166325
  /* harmony export */ getMulticall: () => (/* binding */ getMulticall),
166325
166326
  /* harmony export */ getRepresentation: () => (/* binding */ getRepresentation),
166326
166327
  /* harmony export */ getTradePriceImpact: () => (/* binding */ getTradePriceImpact),
166327
166328
  /* harmony export */ inputOutputComparator: () => (/* binding */ inputOutputComparator),
166328
166329
  /* harmony export */ isSynthesizeV2: () => (/* binding */ isSynthesizeV2),
166329
166330
  /* harmony export */ prepareTransactionRequest: () => (/* binding */ prepareTransactionRequest),
166331
+ /* harmony export */ splitSlippage: () => (/* binding */ splitSlippage),
166330
166332
  /* harmony export */ tokenEquals: () => (/* binding */ tokenEquals),
166331
166333
  /* harmony export */ tradeComparator: () => (/* binding */ tradeComparator),
166332
166334
  /* harmony export */ wrappedAmount: () => (/* binding */ wrappedAmount),
@@ -166451,7 +166453,7 @@ var FACTORY_ADDRESS = {
166451
166453
  // TODO
166452
166454
  [1313161554 /* AURORA_MAINNET */]: "0xc66F594268041dB60507F00703b152492fb176E7",
166453
166455
  [1313161555 /* AURORA_TESTNET */]: "0x60913758635b54e6C9685f92201A5704eEe74748",
166454
- [40 /* TELOS_MAINNET */]: "0x411172Dfcd5f68307656A1ff35520841C2F7fAec",
166456
+ [40 /* TELOS_MAINNET */]: "0xb630f53df13645bff0ef55eb44a8a490a7dd4514",
166455
166457
  [41 /* TELOS_TESTNET */]: "0x6db1D2C691DcdF4DA36d3497F68a63C7282a4a44",
166456
166458
  [8081 /* SHARDEUM_TESTNET_2 */]: "0x1DAcbaB28Decd115c8AA6F183877C71b942aE406",
166457
166459
  [2222 /* KAVA_MAINNET */]: "0xA138FAFc30f6Ec6980aAd22656F2F11C38B56a95",
@@ -166508,7 +166510,7 @@ var INIT_CODE_HASH = {
166508
166510
  // TODO
166509
166511
  [1313161554 /* AURORA_MAINNET */]: "0x754e1d90e536e4c1df81b7f030f47b4ca80c87120e145c294f098c83a6cb5ace",
166510
166512
  [1313161555 /* AURORA_TESTNET */]: "0x4a697f690d1f46e0f1a897a8662acae31ced3039b00c052392ed0bc179f9f28c",
166511
- [40 /* TELOS_MAINNET */]: "0x7d4b9bb0d5808344c0184aada7d10aae8f6b0cc8ceb5eba8dd084f63b8c32099",
166513
+ [40 /* TELOS_MAINNET */]: "0x73d5f9d3e0db97ca102c315a9a45dfebef394eae36edcce8853bcb1ee049a6dd",
166512
166514
  [41 /* TELOS_TESTNET */]: "0x4386561b28c0ca71b777ab3684458dd9f6c1b3b7fc609c5758f0f00a48625996",
166513
166515
  [8081 /* SHARDEUM_TESTNET_2 */]: "0x3bde95ed3dcb15c415ca128950d4807b9e3698b981ff73007c9d3c220a5b2f6f",
166514
166516
  [2222 /* KAVA_MAINNET */]: "0x851a56ac1b3682251d8341ad09c09bf45fca37af4451453063637d745a94fe1f",
@@ -170485,6 +170487,26 @@ var Field = /* @__PURE__ */ ((Field2) => {
170485
170487
 
170486
170488
  // src/crosschain/utils.ts
170487
170489
 
170490
+
170491
+ // src/crosschain/error.ts
170492
+ var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
170493
+ ErrorCode2[ErrorCode2["DEFAULT"] = 0] = "DEFAULT";
170494
+ ErrorCode2[ErrorCode2["NO_ROUTE"] = 1] = "NO_ROUTE";
170495
+ ErrorCode2[ErrorCode2["AMOUNT_TOO_LOW"] = 2] = "AMOUNT_TOO_LOW";
170496
+ ErrorCode2[ErrorCode2["AMOUNT_TOO_HIGH"] = 3] = "AMOUNT_TOO_HIGH";
170497
+ ErrorCode2[ErrorCode2["AMOUNT_LESS_THAN_FEE"] = 4] = "AMOUNT_LESS_THAN_FEE";
170498
+ ErrorCode2[ErrorCode2["NO_TRANSIT_TOKEN"] = 5] = "NO_TRANSIT_TOKEN";
170499
+ ErrorCode2[ErrorCode2["NO_TRANSIT_POOL"] = 6] = "NO_TRANSIT_POOL";
170500
+ return ErrorCode2;
170501
+ })(ErrorCode || {});
170502
+ var Error2 = class {
170503
+ constructor(message, code) {
170504
+ this.code = code || 0 /* DEFAULT */;
170505
+ this.message = message;
170506
+ }
170507
+ };
170508
+
170509
+ // src/crosschain/utils.ts
170488
170510
  var canOneInch = (chainId) => {
170489
170511
  return ONE_INCH_CHAINS.includes(chainId);
170490
170512
  };
@@ -170526,6 +170548,10 @@ function computeTradePriceBreakdown(trade, dexFee) {
170526
170548
  function basisPointsToPercent(num) {
170527
170549
  return new Percent(jsbi__WEBPACK_IMPORTED_MODULE_0___default().BigInt(Math.floor(num)), jsbi__WEBPACK_IMPORTED_MODULE_0___default().BigInt(1e4));
170528
170550
  }
170551
+ function getMinAmount(slippage, amount) {
170552
+ const slippageTolerance = basisPointsToPercent(slippage);
170553
+ return new Fraction(ONE).subtract(slippageTolerance).multiply(amount).quotient;
170554
+ }
170529
170555
  function computeSlippageAdjustedAmounts(trade, allowedSlippage) {
170530
170556
  const pct = basisPointsToPercent(allowedSlippage);
170531
170557
  return {
@@ -170539,7 +170565,7 @@ function calculatePriceImpact(tokenAmountIn, tokenAmountOut) {
170539
170565
  tokenAmountIn.token.decimals
170540
170566
  ).toString();
170541
170567
  if (typedValueParsed === "0") {
170542
- throw new Error("Cannot parse amountOut with decimals");
170568
+ throw new Error2("Cannot parse amountOut with decimals");
170543
170569
  }
170544
170570
  const amountIn = tokenAmountIn.raw;
170545
170571
  const amountOut = jsbi__WEBPACK_IMPORTED_MODULE_0___default().BigInt(typedValueParsed);
@@ -170547,7 +170573,7 @@ function calculatePriceImpact(tokenAmountIn, tokenAmountOut) {
170547
170573
  const value = jsbi__WEBPACK_IMPORTED_MODULE_0___default().divide(jsbi__WEBPACK_IMPORTED_MODULE_0___default().multiply(diff, BIPS_BASE), amountIn);
170548
170574
  return new Percent(value, BIPS_BASE);
170549
170575
  }
170550
- var GetLogTimeoutExceededError = class extends Error {
170576
+ var GetLogTimeoutExceededError = class extends Error2 {
170551
170577
  constructor(filter) {
170552
170578
  super(`Timed out waiting for logs matching filter: ${JSON.stringify(filter)}`);
170553
170579
  this.filter = filter;
@@ -170598,7 +170624,7 @@ var TELOS_MPC_ADDRESS = "0xDcB7d65b15436CE9B608864ACcff75871C6556FC";
170598
170624
  async function prepareTransactionRequest(transactionRequest, signer) {
170599
170625
  const { provider } = signer;
170600
170626
  if (!provider) {
170601
- throw new Error("Signer has no provider");
170627
+ throw new Error2("Signer has no provider");
170602
170628
  }
170603
170629
  const preparedTransactionRequest = { ...transactionRequest };
170604
170630
  let { from } = transactionRequest;
@@ -170618,7 +170644,7 @@ function getAllPairCombinations(tokenIn, tokenOut) {
170618
170644
  const chainId = tokenIn.chainId;
170619
170645
  const bases = BASES_TO_CHECK_TRADES_AGAINST[chainId];
170620
170646
  if (!bases) {
170621
- throw new Error("Bases not found");
170647
+ throw new Error2("Bases not found");
170622
170648
  }
170623
170649
  const basePairs = lodash_flatmap__WEBPACK_IMPORTED_MODULE_12___default()(
170624
170650
  bases,
@@ -170654,6 +170680,43 @@ function getAllPairCombinations(tokenIn, tokenOut) {
170654
170680
  return true;
170655
170681
  });
170656
170682
  }
170683
+ function splitSlippage(totalSlippage, hasTradeA, hasTradeC) {
170684
+ const MINIMUM_SLIPPAGE = 20;
170685
+ if (totalSlippage < MINIMUM_SLIPPAGE) {
170686
+ throw new Error2("Slippage cannot be less than 0.2%");
170687
+ }
170688
+ let swapsCount = 1;
170689
+ let extraSwapsCount = 0;
170690
+ if (hasTradeA) {
170691
+ extraSwapsCount += 1;
170692
+ }
170693
+ if (hasTradeC) {
170694
+ extraSwapsCount += 1;
170695
+ }
170696
+ swapsCount += extraSwapsCount;
170697
+ const slippage = Math.floor(totalSlippage / swapsCount);
170698
+ let aMul = 1;
170699
+ let cMul = 1;
170700
+ if (extraSwapsCount == 2) {
170701
+ aMul = 0.8;
170702
+ cMul = 1.2;
170703
+ }
170704
+ const MAX_STABLE_SLIPPAGE = 50;
170705
+ if (slippage > MAX_STABLE_SLIPPAGE) {
170706
+ const diff = slippage - MAX_STABLE_SLIPPAGE;
170707
+ const addition = extraSwapsCount > 0 ? diff / extraSwapsCount : 0;
170708
+ return {
170709
+ A: hasTradeA ? (slippage + addition) * aMul : 0,
170710
+ B: MAX_STABLE_SLIPPAGE,
170711
+ C: hasTradeC ? (slippage + addition) * cMul : 0
170712
+ };
170713
+ }
170714
+ return {
170715
+ A: hasTradeA ? slippage * aMul : 0,
170716
+ B: slippage,
170717
+ C: hasTradeC ? slippage * cMul : 0
170718
+ };
170719
+ }
170657
170720
 
170658
170721
  // src/crosschain/revertRequest.ts
170659
170722
 
@@ -193418,26 +193481,6 @@ Weth__factory.abi = _abi27;
193418
193481
 
193419
193482
  // src/crosschain/revertRequest.ts
193420
193483
 
193421
-
193422
- // src/crosschain/error.ts
193423
- var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
193424
- ErrorCode2[ErrorCode2["DEFAULT"] = 0] = "DEFAULT";
193425
- ErrorCode2[ErrorCode2["NO_ROUTE"] = 1] = "NO_ROUTE";
193426
- ErrorCode2[ErrorCode2["AMOUNT_TOO_LOW"] = 2] = "AMOUNT_TOO_LOW";
193427
- ErrorCode2[ErrorCode2["AMOUNT_TOO_HIGH"] = 3] = "AMOUNT_TOO_HIGH";
193428
- ErrorCode2[ErrorCode2["AMOUNT_LESS_THAN_FEE"] = 4] = "AMOUNT_LESS_THAN_FEE";
193429
- ErrorCode2[ErrorCode2["NO_TRANSIT_TOKEN"] = 5] = "NO_TRANSIT_TOKEN";
193430
- ErrorCode2[ErrorCode2["NO_TRANSIT_POOL"] = 6] = "NO_TRANSIT_POOL";
193431
- return ErrorCode2;
193432
- })(ErrorCode || {});
193433
- var Error2 = class {
193434
- constructor(message, code) {
193435
- this.code = code || 0 /* DEFAULT */;
193436
- this.message = message;
193437
- }
193438
- };
193439
-
193440
- // src/crosschain/revertRequest.ts
193441
193484
  var PendingRequestState = /* @__PURE__ */ ((PendingRequestState2) => {
193442
193485
  PendingRequestState2[PendingRequestState2["Default"] = 0] = "Default";
193443
193486
  PendingRequestState2[PendingRequestState2["Sent"] = 1] = "Sent";
@@ -194067,12 +194110,12 @@ async function getTradePriceImpact({
194067
194110
  }
194068
194111
  const multiplierPow = 18;
194069
194112
  const multiplier = ethers__WEBPACK_IMPORTED_MODULE_13__.BigNumber.from(10).pow(multiplierPow);
194070
- const spot = data[0].mul(multiplier).div(data[1]);
194113
+ const spot = data[1].mul(multiplier).div(data[0]);
194071
194114
  const inBn = ethers__WEBPACK_IMPORTED_MODULE_13__.BigNumber.from(tokenAmountIn.raw.toString()).mul(ethers__WEBPACK_IMPORTED_MODULE_13__.BigNumber.from(10).pow(tokenAmountOut.token.decimals));
194072
194115
  const outBn = ethers__WEBPACK_IMPORTED_MODULE_13__.BigNumber.from(tokenAmountOut.raw.toString()).mul(
194073
194116
  ethers__WEBPACK_IMPORTED_MODULE_13__.BigNumber.from(10).pow(tokenAmountIn.token.decimals)
194074
194117
  );
194075
- const real = outBn.mul(multiplier).div(inBn);
194118
+ const real = inBn.mul(multiplier).div(outBn);
194076
194119
  const impact = real.mul(multiplier).div(spot);
194077
194120
  const impactNumber = 1 - Number.parseFloat((0,_ethersproject_units__WEBPACK_IMPORTED_MODULE_14__.formatUnits)(impact, multiplierPow));
194078
194121
  return new Percent(parseInt(`${impactNumber * jsbi__WEBPACK_IMPORTED_MODULE_0___default().toNumber(BIPS_BASE)}`).toString(), BIPS_BASE);
@@ -194116,7 +194159,7 @@ var OneInchTrade = class {
194116
194159
  url.searchParams.set("amount", this.tokenAmountIn.raw.toString());
194117
194160
  url.searchParams.set("fromAddress", this.from);
194118
194161
  url.searchParams.set("destReceiver", this.to);
194119
- url.searchParams.set("slippage", this.slippage.toString());
194162
+ url.searchParams.set("slippage", (this.slippage / 100).toString());
194120
194163
  url.searchParams.set("disableEstimate", "true");
194121
194164
  url.searchParams.set("allowPartialFill", "false");
194122
194165
  url.searchParams.set("usePatching", "true");
@@ -194132,6 +194175,8 @@ var OneInchTrade = class {
194132
194175
  this.callData = tx.data;
194133
194176
  this.callDataOffset = this.getOffset(tx.data);
194134
194177
  this.amountOut = new TokenAmount(this.tokenOut, amountOutRaw);
194178
+ const amountOutMinRaw = getMinAmount(this.slippage, amountOutRaw);
194179
+ this.amountOutMin = new TokenAmount(this.tokenOut, amountOutMinRaw);
194135
194180
  this.route = [this.tokenAmountIn.token, this.tokenOut];
194136
194181
  this.priceImpact = await getTradePriceImpact({
194137
194182
  dataProvider: this.dataProvider,
@@ -194270,7 +194315,7 @@ var OpenOceanTrade = class {
194270
194315
  url.searchParams.set("outTokenAddress", toTokenAddress);
194271
194316
  url.searchParams.set("amount", this.tokenAmountIn.toFixed());
194272
194317
  url.searchParams.set("gasPrice", "5");
194273
- url.searchParams.set("slippage", this.slippage.toString());
194318
+ url.searchParams.set("slippage", (this.slippage / 100).toString());
194274
194319
  url.searchParams.set("account", this.to);
194275
194320
  url.searchParams.set("referrer", "0x3254aE00947e44B7fD03F50b93B9acFEd59F9620");
194276
194321
  const response = await isomorphic_unfetch__WEBPACK_IMPORTED_MODULE_10___default()(url.toString());
@@ -194282,6 +194327,8 @@ var OpenOceanTrade = class {
194282
194327
  this.routerAddress = to;
194283
194328
  this.callData = data;
194284
194329
  this.amountOut = new TokenAmount(this.tokenOut, outAmount);
194330
+ const amountOutMinRaw = getMinAmount(this.slippage, outAmount);
194331
+ this.amountOutMin = new TokenAmount(this.tokenOut, amountOutMinRaw);
194285
194332
  this.route = [this.tokenAmountIn.token, this.tokenOut];
194286
194333
  this.priceImpact = await this.getPriceImpact({
194287
194334
  tokenAmountIn: this.tokenAmountIn,
@@ -194421,6 +194468,10 @@ var AggregatorTrade = class {
194421
194468
  this.assertTradeInitialized();
194422
194469
  return this.trade.amountOut;
194423
194470
  }
194471
+ get amountOutMin() {
194472
+ this.assertTradeInitialized();
194473
+ return this.trade.amountOutMin;
194474
+ }
194424
194475
  get routerAddress() {
194425
194476
  this.assertTradeInitialized();
194426
194477
  return this.trade.routerAddress;
@@ -194441,8 +194492,9 @@ var AggregatorTrade = class {
194441
194492
 
194442
194493
  // src/crosschain/trade/omniTrade.ts
194443
194494
  var OmniTrade = class {
194444
- constructor(tokenAmountIn, tokenOut, slippage, deadline, symbiosis, to, omniPoolConfig) {
194495
+ constructor(tokenAmountIn, tokenAmountInMin, tokenOut, slippage, deadline, symbiosis, to, omniPoolConfig) {
194445
194496
  this.tokenAmountIn = tokenAmountIn;
194497
+ this.tokenAmountInMin = tokenAmountInMin;
194446
194498
  this.tokenOut = tokenOut;
194447
194499
  this.slippage = slippage;
194448
194500
  this.deadline = deadline;
@@ -194456,15 +194508,19 @@ var OmniTrade = class {
194456
194508
  this.route = [this.tokenAmountIn.token, this.tokenOut];
194457
194509
  const indexIn = this.symbiosis.getOmniPoolTokenIndex(this.omniPoolConfig, this.tokenAmountIn.token);
194458
194510
  const indexOut = this.symbiosis.getOmniPoolTokenIndex(this.omniPoolConfig, this.tokenOut);
194459
- const quoteFrom = await this.poolOracle.quoteFrom(indexIn, indexOut, this.tokenAmountIn.raw.toString());
194460
- this.amountOut = new TokenAmount(this.tokenOut, quoteFrom.actualToAmount.toString());
194461
- const slippageTolerance = basisPointsToPercent(this.slippage);
194462
- const slippageAdjustedAmountOut = new Fraction(ONE).add(slippageTolerance).invert().multiply(this.amountOut.raw).quotient;
194511
+ const quote = await this.poolOracle.quoteFrom(indexIn, indexOut, this.tokenAmountIn.raw.toString());
194512
+ let quoteMin = quote;
194513
+ if (!this.tokenAmountIn.equalTo(this.tokenAmountInMin)) {
194514
+ quoteMin = await this.poolOracle.quoteFrom(indexIn, indexOut, this.tokenAmountInMin.raw.toString());
194515
+ }
194516
+ this.amountOut = new TokenAmount(this.tokenOut, quote.actualToAmount.toString());
194517
+ const amountOutMinRaw = getMinAmount(this.slippage, quoteMin.actualToAmount.toString());
194518
+ this.amountOutMin = new TokenAmount(this.tokenOut, amountOutMinRaw);
194463
194519
  this.callData = this.pool.interface.encodeFunctionData("swap", [
194464
194520
  indexIn,
194465
194521
  indexOut,
194466
194522
  this.tokenAmountIn.raw.toString(),
194467
- slippageAdjustedAmountOut.toString(),
194523
+ amountOutMinRaw.toString(),
194468
194524
  this.to,
194469
194525
  this.deadline
194470
194526
  ]);
@@ -194511,11 +194567,12 @@ var UniLikeTrade = class _UniLikeTrade {
194511
194567
  }
194512
194568
  this.priceImpact = priceImpact;
194513
194569
  this.route = trade.route.path;
194514
- const amountOut = computeSlippageAdjustedAmounts(trade, this.slippage).OUTPUT;
194515
- if (!amountOut) {
194516
- throw new Error("Cannot compute amountOut");
194570
+ this.amountOut = trade.outputAmount;
194571
+ const amountOutMin = computeSlippageAdjustedAmounts(trade, this.slippage).OUTPUT;
194572
+ if (!amountOutMin) {
194573
+ throw new Error("Cannot compute amountOutMin");
194517
194574
  }
194518
- this.amountOut = amountOut;
194575
+ this.amountOutMin = amountOutMin;
194519
194576
  const { data, offset } = this.buildCallData(trade);
194520
194577
  this.callData = data;
194521
194578
  this.callDataOffset = offset;
@@ -194734,8 +194791,8 @@ var IzumiTrade = class {
194734
194791
  const impactBNJS = spotPriceBNJS.minus(bestOutputBNJS).div(bestOutputBNJS).negated();
194735
194792
  this.priceImpact = new Percent(impactBNJS.times(BIPS_BASE.toString()).toFixed(0).toString(), BIPS_BASE);
194736
194793
  this.amountOut = new TokenAmount(this.tokenOut, bestOutput.toString());
194737
- const slippageTolerance = basisPointsToPercent(this.slippage);
194738
- const minAcquired = new Fraction(ONE).add(slippageTolerance).invert().multiply(this.amountOut.raw).quotient;
194794
+ const minAcquired = getMinAmount(this.slippage, bestOutput.toString());
194795
+ this.amountOutMin = new TokenAmount(this.tokenOut, minAcquired.toString());
194739
194796
  const outputToken = tokens[tokens.length - 1];
194740
194797
  const finalRecipientAddress = this.to;
194741
194798
  const innerRecipientAddress = outputToken.isNative ? "0x0000000000000000000000000000000000000000" : finalRecipientAddress;
@@ -194872,6 +194929,59 @@ function getPriceDecimalEndByStart(route, points) {
194872
194929
  return decimalPriceEndByStart;
194873
194930
  }
194874
194931
 
194932
+ // src/crosschain/trade/wrapTrade.ts
194933
+ var UNWRAP_ADDRESSES = {
194934
+ [1101 /* POLYGON_ZK */]: "0x8a7F930003BedD63A1ebD99C5917FD6aE7E3dedf",
194935
+ [42170 /* ARBITRUM_NOVA */]: "0x8a7F930003BedD63A1ebD99C5917FD6aE7E3dedf",
194936
+ [59144 /* LINEA_MAINNET */]: "0xE75C7E85FE6ADd07077467064aD15847E6ba9877",
194937
+ [534353 /* SCROLL_TESTNET */]: "0x2135c0ab678F25E9cbB4BbBd55B68DE1E36D1E81",
194938
+ [534351 /* SCROLL_SEPOLIA */]: "0x41151CEfFB743650E14425c7749019E491Fd1987",
194939
+ [5 /* ETH_GOERLI */]: "0xc9Fd2AF244FEfb31A62A5A33B9D6261Cec2cb7aA",
194940
+ [8453 /* BASE_MAINNET */]: "0xd8db4fb1fEf63045A443202d506Bcf30ef404160"
194941
+ };
194942
+ var WrapTrade = class {
194943
+ constructor(tokenAmountIn, tokenOut, to) {
194944
+ this.tokenAmountIn = tokenAmountIn;
194945
+ this.tokenOut = tokenOut;
194946
+ this.to = to;
194947
+ this.tradeType = "wrap";
194948
+ this.priceImpact = new Percent("0");
194949
+ }
194950
+ static isSupported(tokenAmountIn, tokenOut) {
194951
+ const wrappedInToken = wrappedToken(tokenAmountIn.token);
194952
+ if (tokenAmountIn.token.isNative && wrappedInToken.equals(tokenOut)) {
194953
+ return true;
194954
+ }
194955
+ const unwrapAddress = UNWRAP_ADDRESSES[tokenAmountIn.token.chainId];
194956
+ const wrappedOutToken = wrappedToken(tokenOut);
194957
+ return !!unwrapAddress && tokenOut.isNative && wrappedOutToken.equals(tokenAmountIn.token);
194958
+ }
194959
+ async init() {
194960
+ const wethInterface = Weth__factory.createInterface();
194961
+ if (this.tokenAmountIn.token.isNative) {
194962
+ const wethToken = wrappedToken(this.tokenAmountIn.token);
194963
+ this.route = [this.tokenAmountIn.token, wethToken];
194964
+ this.amountOut = new TokenAmount(wethToken, this.tokenAmountIn.raw);
194965
+ this.amountOutMin = this.amountOut;
194966
+ this.routerAddress = wethToken.address;
194967
+ this.callData = wethInterface.encodeFunctionData("deposit");
194968
+ return this;
194969
+ }
194970
+ const unwrapperAddress = UNWRAP_ADDRESSES[this.tokenAmountIn.token.chainId];
194971
+ if (!unwrapperAddress) {
194972
+ throw new Error("Cannot unwrap on this network");
194973
+ }
194974
+ const unwrapperInterface = Unwrapper__factory.createInterface();
194975
+ this.route = [this.tokenAmountIn.token, this.tokenOut];
194976
+ this.amountOut = new TokenAmount(this.tokenOut, this.tokenAmountIn.raw);
194977
+ this.amountOutMin = this.amountOut;
194978
+ this.routerAddress = unwrapperAddress;
194979
+ this.callData = unwrapperInterface.encodeFunctionData("unwrap", [this.tokenAmountIn.raw.toString(), this.to]);
194980
+ this.callDataOffset = 4 + 32;
194981
+ return this;
194982
+ }
194983
+ };
194984
+
194875
194985
  // src/crosschain/revert.ts
194876
194986
  var RevertPending = class {
194877
194987
  constructor(symbiosis, request) {
@@ -195219,6 +195329,8 @@ var RevertPending = class {
195219
195329
  const to = this.symbiosis.metaRouter(this.omniPoolConfig.chainId).address;
195220
195330
  const omniTrade = new OmniTrade(
195221
195331
  amount,
195332
+ amount,
195333
+ // amountInMin
195222
195334
  tokenOut,
195223
195335
  this.slippage,
195224
195336
  this.deadline,
@@ -195369,9 +195481,10 @@ var DataProvider = class {
195369
195481
  // src/crosschain/transit.ts
195370
195482
 
195371
195483
  var Transit = class _Transit {
195372
- constructor(symbiosis, amountIn, tokenOut, transitTokenIn, transitTokenOut, slippage, deadline, omniPoolConfig, fee) {
195484
+ constructor(symbiosis, amountIn, amountInMin, tokenOut, transitTokenIn, transitTokenOut, slippage, deadline, omniPoolConfig, fee) {
195373
195485
  this.symbiosis = symbiosis;
195374
195486
  this.amountIn = amountIn;
195487
+ this.amountInMin = amountInMin;
195375
195488
  this.tokenOut = tokenOut;
195376
195489
  this.transitTokenIn = transitTokenIn;
195377
195490
  this.transitTokenOut = transitTokenOut;
@@ -195391,7 +195504,8 @@ var Transit = class _Transit {
195391
195504
  this.trade = await this.buildTrade();
195392
195505
  this.receiveSide = this.multicallRouter.address;
195393
195506
  this.callData = this.buildCalldata();
195394
- this.amountOut = this.getTradeAmountOut();
195507
+ this.amountOut = this.getTradeAmountOut(this.trade.amountOut);
195508
+ this.amountOutMin = this.getTradeAmountOut(this.trade.amountOutMin);
195395
195509
  this.route = this.trade.route;
195396
195510
  this.priceImpact = this.trade.priceImpact;
195397
195511
  this.symbiosis.validateSwapAmounts(this.getBridgeAmountIn());
@@ -195412,8 +195526,8 @@ var Transit = class _Transit {
195412
195526
  /**
195413
195527
  * Amount in stables coming out of the bridge
195414
195528
  */
195415
- getBridgeAmountOut() {
195416
- const amountOut = new TokenAmount(this.feeToken, this.amountIn.raw);
195529
+ getBridgeAmountOut(amount) {
195530
+ const amountOut = new TokenAmount(this.feeToken, amount.raw);
195417
195531
  if (!this.fee) {
195418
195532
  return amountOut;
195419
195533
  }
@@ -195459,20 +195573,20 @@ var Transit = class _Transit {
195459
195573
  this.symbiosis.metaRouter(this.omniPoolConfig.chainId).address
195460
195574
  ]);
195461
195575
  }
195462
- getTradeAmountIn() {
195576
+ getTradeAmountIn(amount) {
195463
195577
  if (this.direction === "burn") {
195464
- return this.amountIn;
195578
+ return amount;
195465
195579
  }
195466
- return this.getBridgeAmountOut();
195580
+ return this.getBridgeAmountOut(amount);
195467
195581
  }
195468
- getTradeAmountOut() {
195469
- if (!this.trade) {
195582
+ getTradeAmountOut(tradeAmountOut) {
195583
+ if (!tradeAmountOut) {
195470
195584
  throw new Error2("There is no trade");
195471
195585
  }
195472
195586
  if (this.direction === "mint" || this.isV2()) {
195473
- return this.trade.amountOut;
195587
+ return tradeAmountOut;
195474
195588
  }
195475
- const amountOut = new TokenAmount(this.transitTokenOut, this.trade.amountOut.raw);
195589
+ const amountOut = new TokenAmount(this.transitTokenOut, tradeAmountOut.raw);
195476
195590
  if (!this.fee) {
195477
195591
  return amountOut;
195478
195592
  }
@@ -195513,11 +195627,13 @@ var Transit = class _Transit {
195513
195627
  return rep;
195514
195628
  }
195515
195629
  async buildTrade() {
195516
- const tokenAmountIn = this.getTradeAmountIn();
195630
+ const tokenAmountIn = this.getTradeAmountIn(this.amountIn);
195631
+ const tokenAmountInMin = this.getTradeAmountIn(this.amountInMin);
195517
195632
  const tokenOut = this.getTradeTokenOut();
195518
195633
  const to = this.symbiosis.metaRouter(this.omniPoolConfig.chainId).address;
195519
195634
  const trade = new OmniTrade(
195520
195635
  tokenAmountIn,
195636
+ tokenAmountInMin,
195521
195637
  tokenOut,
195522
195638
  this.slippage,
195523
195639
  this.deadline,
@@ -195530,57 +195646,6 @@ var Transit = class _Transit {
195530
195646
  }
195531
195647
  };
195532
195648
 
195533
- // src/crosschain/trade/wrapTrade.ts
195534
- var UNWRAP_ADDRESSES = {
195535
- [1101 /* POLYGON_ZK */]: "0x8a7F930003BedD63A1ebD99C5917FD6aE7E3dedf",
195536
- [42170 /* ARBITRUM_NOVA */]: "0x8a7F930003BedD63A1ebD99C5917FD6aE7E3dedf",
195537
- [59144 /* LINEA_MAINNET */]: "0xE75C7E85FE6ADd07077467064aD15847E6ba9877",
195538
- [534353 /* SCROLL_TESTNET */]: "0x2135c0ab678F25E9cbB4BbBd55B68DE1E36D1E81",
195539
- [534351 /* SCROLL_SEPOLIA */]: "0x41151CEfFB743650E14425c7749019E491Fd1987",
195540
- [5 /* ETH_GOERLI */]: "0xc9Fd2AF244FEfb31A62A5A33B9D6261Cec2cb7aA",
195541
- [8453 /* BASE_MAINNET */]: "0xd8db4fb1fEf63045A443202d506Bcf30ef404160"
195542
- };
195543
- var WrapTrade = class {
195544
- constructor(tokenAmountIn, tokenOut, to) {
195545
- this.tokenAmountIn = tokenAmountIn;
195546
- this.tokenOut = tokenOut;
195547
- this.to = to;
195548
- this.tradeType = "wrap";
195549
- this.priceImpact = new Percent("0");
195550
- }
195551
- static isSupported(tokenAmountIn, tokenOut) {
195552
- const wrappedInToken = wrappedToken(tokenAmountIn.token);
195553
- if (tokenAmountIn.token.isNative && wrappedInToken.equals(tokenOut)) {
195554
- return true;
195555
- }
195556
- const unwrapAddress = UNWRAP_ADDRESSES[tokenAmountIn.token.chainId];
195557
- const wrappedOutToken = wrappedToken(tokenOut);
195558
- return !!unwrapAddress && tokenOut.isNative && wrappedOutToken.equals(tokenAmountIn.token);
195559
- }
195560
- async init() {
195561
- const wethInterface = Weth__factory.createInterface();
195562
- if (this.tokenAmountIn.token.isNative) {
195563
- const wethToken = wrappedToken(this.tokenAmountIn.token);
195564
- this.route = [this.tokenAmountIn.token, wethToken];
195565
- this.amountOut = new TokenAmount(wethToken, this.tokenAmountIn.raw);
195566
- this.routerAddress = wethToken.address;
195567
- this.callData = wethInterface.encodeFunctionData("deposit");
195568
- return this;
195569
- }
195570
- const unwrapperAddress = UNWRAP_ADDRESSES[this.tokenAmountIn.token.chainId];
195571
- if (!unwrapperAddress) {
195572
- throw new Error("Cannot unwrap on this network");
195573
- }
195574
- const unwrapperInterface = Unwrapper__factory.createInterface();
195575
- this.route = [this.tokenAmountIn.token, this.tokenOut];
195576
- this.amountOut = new TokenAmount(this.tokenOut, this.tokenAmountIn.raw);
195577
- this.routerAddress = unwrapperAddress;
195578
- this.callData = unwrapperInterface.encodeFunctionData("unwrap", [this.tokenAmountIn.raw.toString(), this.to]);
195579
- this.callDataOffset = 4 + 32;
195580
- return this;
195581
- }
195582
- };
195583
-
195584
195649
  // src/crosschain/baseSwapping.ts
195585
195650
  var BaseSwapping = class {
195586
195651
  constructor(symbiosis, omniPoolConfig) {
@@ -195625,7 +195690,6 @@ var BaseSwapping = class {
195625
195690
  const fee = await this.getFee(this.transit.feeToken);
195626
195691
  const feeV2 = this.transit.isV2() ? await this.getFeeV2() : void 0;
195627
195692
  this.feeV2 = feeV2;
195628
- const tokenAmountOutWithZeroFee = this.tokenAmountOut();
195629
195693
  this.transit = this.buildTransit(fee);
195630
195694
  await this.transit.init();
195631
195695
  if (!this.transitTokenOut.equals(tokenOut)) {
@@ -195641,11 +195705,15 @@ var BaseSwapping = class {
195641
195705
  const feeV2Base = ethers__WEBPACK_IMPORTED_MODULE_13__.BigNumber.from(feeV2.raw.toString()).mul(pow);
195642
195706
  crossChainFee = new TokenAmount(feeV2.token, feeBase.add(feeV2Base).div(pow).toString());
195643
195707
  }
195708
+ const tokenAmountOut = this.tokenAmountOut(feeV2);
195709
+ const tokenAmountOutMin = new TokenAmount(
195710
+ tokenAmountOut.token,
195711
+ jsbi__WEBPACK_IMPORTED_MODULE_0___default().divide(jsbi__WEBPACK_IMPORTED_MODULE_0___default().multiply(this.transit.amountOutMin.raw, tokenAmountOut.raw), this.transit.amountOut.raw)
195712
+ );
195644
195713
  return {
195645
195714
  fee: crossChainFee,
195646
- tokenAmountOut: this.tokenAmountOut(feeV2),
195647
- tokenAmountOutWithZeroFee,
195648
- // uses for calculation pure swap price except fee
195715
+ tokenAmountOut,
195716
+ tokenAmountOutMin,
195649
195717
  route: this.route,
195650
195718
  priceImpact: this.calculatePriceImpact(),
195651
195719
  amountInUsd: this.amountInUsd,
@@ -195656,27 +195724,9 @@ var BaseSwapping = class {
195656
195724
  };
195657
195725
  }
195658
195726
  buildDetailedSlippage(totalSlippage) {
195659
- const MINIMUM_SLIPPAGE = 20;
195660
- if (totalSlippage < MINIMUM_SLIPPAGE) {
195661
- throw new Error2("Slippage cannot be less than 0.2%");
195662
- }
195663
- let swapsCount = 1;
195664
- let extraSwapsCount = 0;
195665
- if (!this.transitTokenIn.equals(this.tokenAmountIn.token)) {
195666
- extraSwapsCount += 1;
195667
- }
195668
- if (!this.transitTokenOut.equals(this.tokenOut)) {
195669
- extraSwapsCount += 1;
195670
- }
195671
- swapsCount += extraSwapsCount;
195672
- const slippage = Math.floor(totalSlippage / swapsCount);
195673
- const MAX_STABLE_SLIPPAGE = 75;
195674
- if (slippage > MAX_STABLE_SLIPPAGE) {
195675
- const diff = slippage - MAX_STABLE_SLIPPAGE;
195676
- const addition = diff / extraSwapsCount;
195677
- return { A: slippage + addition, B: MAX_STABLE_SLIPPAGE, C: slippage + addition };
195678
- }
195679
- return { A: slippage, B: slippage, C: slippage };
195727
+ const hasTradeA = !this.transitTokenIn.equals(this.tokenAmountIn.token);
195728
+ const hasTradeC = !this.transitTokenOut.equals(this.tokenOut);
195729
+ return splitSlippage(totalSlippage, hasTradeA, hasTradeC);
195680
195730
  }
195681
195731
  approveTo() {
195682
195732
  return this.symbiosis.chainConfig(this.tokenAmountIn.token.chainId).metaRouterGateway;
@@ -195807,7 +195857,7 @@ var BaseSwapping = class {
195807
195857
  tokenOut,
195808
195858
  from,
195809
195859
  to,
195810
- slippage: this.slippage["A"] / 100,
195860
+ slippage: this.slippage["A"],
195811
195861
  symbiosis: this.symbiosis,
195812
195862
  dataProvider: this.dataProvider,
195813
195863
  clientId: this.symbiosis.clientId,
@@ -195838,9 +195888,12 @@ var BaseSwapping = class {
195838
195888
  return new UniLikeTrade(this.tokenAmountIn, tokenOut, to, this.slippage["A"], this.ttl, routerA, dexFee);
195839
195889
  }
195840
195890
  buildTransit(fee) {
195891
+ const amountIn = this.tradeA ? this.tradeA.amountOut : this.tokenAmountIn;
195892
+ const amountInMin = this.tradeA ? this.tradeA.amountOutMin : amountIn;
195841
195893
  return new Transit(
195842
195894
  this.symbiosis,
195843
- this.tradeA ? this.tradeA.amountOut : this.tokenAmountIn,
195895
+ amountIn,
195896
+ amountInMin,
195844
195897
  this.tokenOut,
195845
195898
  this.transitTokenIn,
195846
195899
  this.transitTokenOut,
@@ -195890,7 +195943,7 @@ var BaseSwapping = class {
195890
195943
  tokenOut: this.tokenOut,
195891
195944
  from,
195892
195945
  to: this.tradeCTo(),
195893
- slippage: this.slippage["C"] / 100,
195946
+ slippage: this.slippage["C"],
195894
195947
  symbiosis: this.symbiosis,
195895
195948
  dataProvider: this.dataProvider,
195896
195949
  clientId: this.symbiosis.clientId,
@@ -195905,7 +195958,7 @@ var BaseSwapping = class {
195905
195958
  this.tokenOut,
195906
195959
  from,
195907
195960
  this.tradeCTo(),
195908
- this.slippage["C"] / 100,
195961
+ this.slippage["C"],
195909
195962
  oracle,
195910
195963
  this.dataProvider,
195911
195964
  this.oneInchProtocols
@@ -196819,8 +196872,8 @@ var config = {
196819
196872
  ],
196820
196873
  router: "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
196821
196874
  dexFee: 30,
196822
- metaRouter: "0xE75C7E85FE6ADd07077467064aD15847E6ba9877",
196823
- metaRouterGateway: "0x25bEE8C21D1d0ec2852302fd7E674196EA298eC6",
196875
+ metaRouter: "0x1DCfbC3fA01b2a86bC3a3f43479cCe9E8D438Adc",
196876
+ metaRouterGateway: "0x0A0B7D1eea99e6189995432fec8172bB2dFFF847",
196824
196877
  bridge: "0x5523985926Aa12BA58DC5Ad00DDca99678D7227E",
196825
196878
  synthesis: "0x0000000000000000000000000000000000000000",
196826
196879
  portal: "0xb8f275fBf7A959F4BCE59999A2EF122A099e81A8",
@@ -196875,8 +196928,8 @@ var config = {
196875
196928
  ],
196876
196929
  router: "0x10ED43C718714eb63d5aA57B78B54704E256024E",
196877
196930
  dexFee: 25,
196878
- metaRouter: "0x81aB74A9f9d7457fF47dfD102e78A340cF72EC39",
196879
- metaRouterGateway: "0x79d930aBe53dd56B66Ed43f8f6a7C6a1b84655cA",
196931
+ metaRouter: "0x9A31bAC4b3B958C835C243800B474818D04393dd",
196932
+ metaRouterGateway: "0x83f71AabdDBb9F0E3B6462Cc7635b6fFAD0f2f2e",
196880
196933
  bridge: "0xb8f275fBf7A959F4BCE59999A2EF122A099e81A8",
196881
196934
  synthesis: "0x6B1bbd301782FF636601fC594Cd7Bfe74871bfaA",
196882
196935
  portal: "0x5Aa5f7f84eD0E5db0a4a85C3947eA16B53352FD4",
@@ -196965,8 +197018,8 @@ var config = {
196965
197018
  ],
196966
197019
  router: "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff",
196967
197020
  dexFee: 30,
196968
- metaRouter: "0xE75C7E85FE6ADd07077467064aD15847E6ba9877",
196969
- metaRouterGateway: "0x25bEE8C21D1d0ec2852302fd7E674196EA298eC6",
197021
+ metaRouter: "0xF951789c6A356BfbC3033648AA10b5Dd3e9d88C0",
197022
+ metaRouterGateway: "0x5d025432bcbe100354b5fb7b1a68d1641e677f6c",
196970
197023
  bridge: "0x5523985926Aa12BA58DC5Ad00DDca99678D7227E",
196971
197024
  synthesis: "0x0000000000000000000000000000000000000000",
196972
197025
  portal: "0xb8f275fBf7A959F4BCE59999A2EF122A099e81A8",
@@ -196997,10 +197050,10 @@ var config = {
196997
197050
  }
196998
197051
  }
196999
197052
  ],
197000
- router: "0xb9667Cf9A495A123b0C43B924f6c2244f42817BE",
197053
+ router: "0x9b1adec00a25fffd87a5bb17f61916e1c26f6844",
197001
197054
  dexFee: 25,
197002
- metaRouter: "0xcE8f24A58D85eD5c5A6824f7be1F8d4711A0eb4C",
197003
- metaRouterGateway: "0xAdB2d3b711Bb8d8Ea92ff70292c466140432c278",
197055
+ metaRouter: "0x7775b274f0c3fa919b756b22a4d9674e55927ab8",
197056
+ metaRouterGateway: "0xb52e582263c1d0189b3cc1402c1b7205b7f2e9ba",
197004
197057
  bridge: "0x5523985926Aa12BA58DC5Ad00DDca99678D7227E",
197005
197058
  synthesis: "0x1a039cE63AE35a67Bf0E9F6DbFaE969639D59eC8",
197006
197059
  portal: "0xb8f275fBf7A959F4BCE59999A2EF122A099e81A8",
@@ -197033,8 +197086,8 @@ var config = {
197033
197086
  ],
197034
197087
  router: "0xA7544C409d772944017BB95B99484B6E0d7B6388",
197035
197088
  dexFee: 30,
197036
- metaRouter: "0xcE8f24A58D85eD5c5A6824f7be1F8d4711A0eb4C",
197037
- metaRouterGateway: "0xAdB2d3b711Bb8d8Ea92ff70292c466140432c278",
197089
+ metaRouter: "0x88139ad1199e8c78a0804d4bebf4fbad89ef9d89",
197090
+ metaRouterGateway: "0x3a696f9201bafadfded7953933ab2832b38fc023",
197038
197091
  bridge: "0xda8057acB94905eb6025120cB2c38415Fd81BfEB",
197039
197092
  synthesis: "0x0000000000000000000000000000000000000000",
197040
197093
  portal: "0x292fC50e4eB66C3f6514b9E402dBc25961824D62",
@@ -197067,8 +197120,8 @@ var config = {
197067
197120
  ],
197068
197121
  router: "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",
197069
197122
  dexFee: 30,
197070
- metaRouter: "0xcE8f24A58D85eD5c5A6824f7be1F8d4711A0eb4C",
197071
- metaRouterGateway: "0xAdB2d3b711Bb8d8Ea92ff70292c466140432c278",
197123
+ metaRouter: "0xbbad2fe9558e55ebfa04b3b5bff0b6c4e2ffdd2c",
197124
+ metaRouterGateway: "0xda411e3b9047ae198dfb7448e97ca900fe793035",
197072
197125
  bridge: "0x5523985926Aa12BA58DC5Ad00DDca99678D7227E",
197073
197126
  synthesis: "0x0000000000000000000000000000000000000000",
197074
197127
  portal: "0xb8f275fBf7A959F4BCE59999A2EF122A099e81A8",
@@ -197203,8 +197256,8 @@ var config = {
197203
197256
  ],
197204
197257
  router: "0xD01319f4b65b79124549dE409D36F25e04B3e551",
197205
197258
  dexFee: 30,
197206
- metaRouter: "0xcE8f24A58D85eD5c5A6824f7be1F8d4711A0eb4C",
197207
- metaRouterGateway: "0xAdB2d3b711Bb8d8Ea92ff70292c466140432c278",
197259
+ metaRouter: "0xca506793A420E901BbCa8066be5661E3C52c84c2",
197260
+ metaRouterGateway: "0xd92ca299f1c2518e78e48c207b64591ba6e9b9a8",
197208
197261
  bridge: "0x5523985926Aa12BA58DC5Ad00DDca99678D7227E",
197209
197262
  synthesis: "0x0000000000000000000000000000000000000000",
197210
197263
  portal: "0x01A3c8E513B758EBB011F7AFaf6C37616c9C24d9",
@@ -197248,8 +197301,8 @@ var config = {
197248
197301
  ],
197249
197302
  router: "0x0000000000000000000000000000000000000000",
197250
197303
  dexFee: 0,
197251
- metaRouter: "0xcE8f24A58D85eD5c5A6824f7be1F8d4711A0eb4C",
197252
- metaRouterGateway: "0xAdB2d3b711Bb8d8Ea92ff70292c466140432c278",
197304
+ metaRouter: "0x1a039ce63ae35a67bf0e9f6dbfae969639d59ec8",
197305
+ metaRouterGateway: "0x1e4bf3cabd7707089138dd5a545b077413fa83fc",
197253
197306
  bridge: "0x5523985926Aa12BA58DC5Ad00DDca99678D7227E",
197254
197307
  synthesis: "0x0000000000000000000000000000000000000000",
197255
197308
  portal: "0x292fC50e4eB66C3f6514b9E402dBc25961824D62",
@@ -197293,8 +197346,8 @@ var config = {
197293
197346
  ],
197294
197347
  router: "0xEe01c0CD76354C383B8c7B4e65EA88D00B06f36f",
197295
197348
  dexFee: 30,
197296
- metaRouter: "0xcE8f24A58D85eD5c5A6824f7be1F8d4711A0eb4C",
197297
- metaRouterGateway: "0xAdB2d3b711Bb8d8Ea92ff70292c466140432c278",
197349
+ metaRouter: "0xf85fc807d05d3ab2309364226970aac57b4e1ea4",
197350
+ metaRouterGateway: "0xcd7c056b39ddfb568e451923abedb9b6a7aeb885",
197298
197351
  bridge: "0x5523985926Aa12BA58DC5Ad00DDca99678D7227E",
197299
197352
  synthesis: "0x0000000000000000000000000000000000000000",
197300
197353
  portal: "0x292fC50e4eB66C3f6514b9E402dBc25961824D62",
@@ -197383,8 +197436,8 @@ var config = {
197383
197436
  ],
197384
197437
  router: "0xc66149996d0263C0B42D3bC05e50Db88658106cE",
197385
197438
  dexFee: 30,
197386
- metaRouter: "0xcE8f24A58D85eD5c5A6824f7be1F8d4711A0eb4C",
197387
- metaRouterGateway: "0xAdB2d3b711Bb8d8Ea92ff70292c466140432c278",
197439
+ metaRouter: "0x8a7F930003BedD63A1ebD99C5917FD6aE7E3dedf",
197440
+ metaRouterGateway: "0xe6e5f3d264117e030c21920356641dbd5b3d660c",
197388
197441
  bridge: "0x5523985926Aa12BA58DC5Ad00DDca99678D7227E",
197389
197442
  synthesis: "0x0000000000000000000000000000000000000000",
197390
197443
  portal: "0x292fC50e4eB66C3f6514b9E402dBc25961824D62",
@@ -197428,8 +197481,8 @@ var config = {
197428
197481
  ],
197429
197482
  router: "0xDd0840118bF9CCCc6d67b2944ddDfbdb995955FD",
197430
197483
  dexFee: 30,
197431
- metaRouter: "0xcE8f24A58D85eD5c5A6824f7be1F8d4711A0eb4C",
197432
- metaRouterGateway: "0xAdB2d3b711Bb8d8Ea92ff70292c466140432c278",
197484
+ metaRouter: "0xA738e84fdE890Bc60b99AF7ccE43990E534304de",
197485
+ metaRouterGateway: "0x5074b7ca7162f793318b65d8becc5975df327c80",
197433
197486
  bridge: "0x5523985926Aa12BA58DC5Ad00DDca99678D7227E",
197434
197487
  synthesis: "0x0000000000000000000000000000000000000000",
197435
197488
  portal: "0x292fC50e4eB66C3f6514b9E402dBc25961824D62",
@@ -197945,6 +197998,146 @@ var config3 = {
197945
197998
  ]
197946
197999
  };
197947
198000
 
198001
+ // src/crosschain/config/xdao.ts
198002
+ var config4 = {
198003
+ advisor: {
198004
+ url: "https://api.xdao.symbiosis.finance/calculations"
198005
+ },
198006
+ omniPools: [
198007
+ {
198008
+ chainId: 56288,
198009
+ address: "0x566E412387AE3FaB8b5Aa3A77178B120BCfF5Af8",
198010
+ oracle: "0x851B43189de721dD94AbA767AAd9E6F6d6a95CCA"
198011
+ }
198012
+ ],
198013
+ chains: [
198014
+ {
198015
+ id: 1,
198016
+ rpc: "https://rpc.ankr.com/eth",
198017
+ filterBlockOffset: 2e3,
198018
+ waitForBlocksCount: 12,
198019
+ stables: [
198020
+ {
198021
+ name: "XDAO",
198022
+ address: "0x71eebA415A523F5C952Cc2f06361D5443545Ad28",
198023
+ symbol: "XDAO",
198024
+ decimals: 18,
198025
+ chainId: 1,
198026
+ icons: {
198027
+ large: "https://s2.coinmarketcap.com/static/img/coins/64x64/21760.png",
198028
+ small: "https://s2.coinmarketcap.com/static/img/coins/64x64/21760.png"
198029
+ }
198030
+ }
198031
+ ],
198032
+ router: "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
198033
+ dexFee: 30,
198034
+ metaRouter: "0x0f91052dc5B4baE53d0FeA5DAe561A117268f5d2",
198035
+ metaRouterGateway: "0x200a0fe876421DC49A26508e3Efd0a1008fD12B5",
198036
+ bridge: "0x7B4E28E7273aA8CB64C56fF191ebF43b64f409F9",
198037
+ synthesis: "0x0000000000000000000000000000000000000000",
198038
+ portal: "0x42Cd64f48496dDdfEfF8F3704df9175dbe20d325",
198039
+ fabric: "0x0000000000000000000000000000000000000000",
198040
+ multicallRouter: "0x49d3Fc00f3ACf80FABCb42D7681667B20F60889A",
198041
+ aavePool: "0x0000000000000000000000000000000000000000",
198042
+ aavePoolDataProvider: "0x0000000000000000000000000000000000000000",
198043
+ creamComptroller: "0x0000000000000000000000000000000000000000",
198044
+ creamCompoundLens: "0x0000000000000000000000000000000000000000",
198045
+ renGatewayRegistry: "0x0000000000000000000000000000000000000000",
198046
+ blocksPerYear: 0
198047
+ },
198048
+ {
198049
+ id: 56,
198050
+ rpc: "https://rpc.ankr.com/bsc",
198051
+ filterBlockOffset: 2e3,
198052
+ waitForBlocksCount: 20,
198053
+ stables: [
198054
+ {
198055
+ name: "XDAO",
198056
+ address: "0x71eebA415A523F5C952Cc2f06361D5443545Ad28",
198057
+ symbol: "XDAO",
198058
+ decimals: 18,
198059
+ chainId: 56,
198060
+ icons: {
198061
+ large: "https://s2.coinmarketcap.com/static/img/coins/64x64/21760.png",
198062
+ small: "https://s2.coinmarketcap.com/static/img/coins/64x64/21760.png"
198063
+ }
198064
+ }
198065
+ ],
198066
+ router: "0x10ED43C718714eb63d5aA57B78B54704E256024E",
198067
+ dexFee: 25,
198068
+ metaRouter: "0xbbA322c98601b707cFfb98092010e0b95d538bB7",
198069
+ metaRouterGateway: "0x346163578c731C0849F98f34fa61545Dd10eEbd5",
198070
+ bridge: "0xEE981B2459331AD268cc63CE6167b446AF4161f8",
198071
+ synthesis: "0x0000000000000000000000000000000000000000",
198072
+ portal: "0xb91d3060C90aac7c4c706aef2B37997b3b2a1DcF",
198073
+ fabric: "0x0000000000000000000000000000000000000000",
198074
+ multicallRouter: "0x44b5d0F16Ad55c4e7113310614745e8771b963bB",
198075
+ aavePool: "0x0000000000000000000000000000000000000000",
198076
+ aavePoolDataProvider: "0x0000000000000000000000000000000000000000",
198077
+ creamComptroller: "0x0000000000000000000000000000000000000000",
198078
+ creamCompoundLens: "0x0000000000000000000000000000000000000000",
198079
+ renGatewayRegistry: "0x0000000000000000000000000000000000000000",
198080
+ blocksPerYear: 0
198081
+ },
198082
+ {
198083
+ id: 137,
198084
+ rpc: "https://rpc.ankr.com/polygon",
198085
+ filterBlockOffset: 2e3,
198086
+ waitForBlocksCount: 60,
198087
+ stables: [
198088
+ {
198089
+ name: "XDAO",
198090
+ address: "0x71eebA415A523F5C952Cc2f06361D5443545Ad28",
198091
+ symbol: "XDAO",
198092
+ decimals: 18,
198093
+ chainId: 137,
198094
+ icons: {
198095
+ large: "https://s2.coinmarketcap.com/static/img/coins/64x64/21760.png",
198096
+ small: "https://s2.coinmarketcap.com/static/img/coins/64x64/21760.png"
198097
+ }
198098
+ }
198099
+ ],
198100
+ router: "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff",
198101
+ dexFee: 30,
198102
+ metaRouter: "0xb657f823fd8c4B94901e78b75481D5b39D59ec61",
198103
+ metaRouterGateway: "0x51d47A870cF9A8584f3FF850A50925E0CB930CD7",
198104
+ bridge: "0xfeC09BE39F82b13471D2e0E7d72e6ee589c631c6",
198105
+ synthesis: "0x0000000000000000000000000000000000000000",
198106
+ portal: "0x3338BE49A5f60e2593337919F9aD7098e9a7Dd7E",
198107
+ fabric: "0x0000000000000000000000000000000000000000",
198108
+ multicallRouter: "0xc5B61b9abC3C6229065cAD0e961aF585C5E0135c",
198109
+ aavePool: "0x0000000000000000000000000000000000000000",
198110
+ aavePoolDataProvider: "0x0000000000000000000000000000000000000000",
198111
+ creamComptroller: "0x0000000000000000000000000000000000000000",
198112
+ creamCompoundLens: "0x0000000000000000000000000000000000000000",
198113
+ renGatewayRegistry: "0x0000000000000000000000000000000000000000",
198114
+ blocksPerYear: 0
198115
+ },
198116
+ {
198117
+ id: 56288,
198118
+ rpc: "https://symbiosis.bnb.boba.network",
198119
+ filterBlockOffset: 3e3,
198120
+ waitForBlocksCount: 0,
198121
+ stables: [],
198122
+ router: "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",
198123
+ dexFee: 30,
198124
+ metaRouter: "0x906C9b4802AeC01d565b0412422224D1a2932D76",
198125
+ metaRouterGateway: "0x5F010D019e4D4f9b1CbA682e055A622BF76c0575",
198126
+ bridge: "0xe1f16F6C5cCbF9BA32E0fd1E668a133AFAe0f105",
198127
+ synthesis: "0xF818D26215BB22B79F8501530bd6d54FfE166735",
198128
+ portal: "0x0000000000000000000000000000000000000000",
198129
+ fabric: "0x6BB1864d4e5A58dfcD142d9f560bB6389742822E",
198130
+ multicallRouter: "0xcB28fbE3E9C0FEA62E0E63ff3f232CECfE555aD4",
198131
+ aavePool: "0x0000000000000000000000000000000000000000",
198132
+ aavePoolDataProvider: "0x0000000000000000000000000000000000000000",
198133
+ creamComptroller: "0x0000000000000000000000000000000000000000",
198134
+ creamCompoundLens: "0x0000000000000000000000000000000000000000",
198135
+ renGatewayRegistry: "0x0000000000000000000000000000000000000000",
198136
+ blocksPerYear: 0
198137
+ }
198138
+ ]
198139
+ };
198140
+
197948
198141
  // src/crosschain/zappingBeefy.ts
197949
198142
 
197950
198143
  var ZappingBeefy = class extends BaseSwapping {
@@ -199672,6 +199865,123 @@ var dev_default = {
199672
199865
  ]
199673
199866
  };
199674
199867
 
199868
+ // src/crosschain/config/cache/xdao.json
199869
+ var xdao_default = {
199870
+ omniPools: [
199871
+ {
199872
+ chainId: 56288,
199873
+ address: "0x566E412387AE3FaB8b5Aa3A77178B120BCfF5Af8",
199874
+ oracle: "0x851B43189de721dD94AbA767AAd9E6F6d6a95CCA",
199875
+ id: 0,
199876
+ tokens: [
199877
+ { index: 0, tokenId: 3 },
199878
+ { index: 1, tokenId: 4 },
199879
+ { index: 2, tokenId: 5 }
199880
+ ]
199881
+ }
199882
+ ],
199883
+ tokens: [
199884
+ {
199885
+ decimals: 18,
199886
+ symbol: "XDAO",
199887
+ name: "XDAO",
199888
+ chainId: 1,
199889
+ address: "0x71eebA415A523F5C952Cc2f06361D5443545Ad28",
199890
+ isNative: false,
199891
+ icons: {
199892
+ large: "https://s2.coinmarketcap.com/static/img/coins/64x64/21760.png",
199893
+ small: "https://s2.coinmarketcap.com/static/img/coins/64x64/21760.png"
199894
+ },
199895
+ deprecated: false,
199896
+ id: 0
199897
+ },
199898
+ {
199899
+ decimals: 18,
199900
+ symbol: "XDAO",
199901
+ name: "XDAO",
199902
+ chainId: 56,
199903
+ address: "0x71eebA415A523F5C952Cc2f06361D5443545Ad28",
199904
+ isNative: false,
199905
+ icons: {
199906
+ large: "https://s2.coinmarketcap.com/static/img/coins/64x64/21760.png",
199907
+ small: "https://s2.coinmarketcap.com/static/img/coins/64x64/21760.png"
199908
+ },
199909
+ deprecated: false,
199910
+ id: 1
199911
+ },
199912
+ {
199913
+ decimals: 18,
199914
+ symbol: "XDAO",
199915
+ name: "XDAO",
199916
+ chainId: 137,
199917
+ address: "0x71eebA415A523F5C952Cc2f06361D5443545Ad28",
199918
+ isNative: false,
199919
+ icons: {
199920
+ large: "https://s2.coinmarketcap.com/static/img/coins/64x64/21760.png",
199921
+ small: "https://s2.coinmarketcap.com/static/img/coins/64x64/21760.png"
199922
+ },
199923
+ deprecated: false,
199924
+ id: 2
199925
+ },
199926
+ {
199927
+ decimals: 18,
199928
+ symbol: "sXDAO",
199929
+ name: "Synthetic XDAO from Ethereum",
199930
+ chainId: 56288,
199931
+ address: "0x9D9D79E32fA6A7214Ad79702a36bD520c3c42915",
199932
+ isNative: false,
199933
+ icons: {
199934
+ large: "https://s2.coinmarketcap.com/static/img/coins/64x64/21760.png",
199935
+ small: "https://s2.coinmarketcap.com/static/img/coins/64x64/21760.png"
199936
+ },
199937
+ chainFromId: 1,
199938
+ deprecated: false,
199939
+ id: 3,
199940
+ originalId: 0
199941
+ },
199942
+ {
199943
+ decimals: 18,
199944
+ symbol: "sXDAO",
199945
+ name: "Synthetic XDAO from BSC",
199946
+ chainId: 56288,
199947
+ address: "0x263308d316F07815C077C017e9481994d0a0C6Fe",
199948
+ isNative: false,
199949
+ icons: {
199950
+ large: "https://s2.coinmarketcap.com/static/img/coins/64x64/21760.png",
199951
+ small: "https://s2.coinmarketcap.com/static/img/coins/64x64/21760.png"
199952
+ },
199953
+ chainFromId: 56,
199954
+ deprecated: false,
199955
+ id: 4,
199956
+ originalId: 1
199957
+ },
199958
+ {
199959
+ decimals: 18,
199960
+ symbol: "sXDAO",
199961
+ name: "Synthetic XDAO from Polygon",
199962
+ chainId: 56288,
199963
+ address: "0xeca9F12Ba3E5c2a822d1441C8FFD8C9A90659AF5",
199964
+ isNative: false,
199965
+ icons: {
199966
+ large: "https://s2.coinmarketcap.com/static/img/coins/64x64/21760.png",
199967
+ small: "https://s2.coinmarketcap.com/static/img/coins/64x64/21760.png"
199968
+ },
199969
+ chainFromId: 137,
199970
+ deprecated: false,
199971
+ id: 5,
199972
+ originalId: 2
199973
+ }
199974
+ ],
199975
+ thresholds: [
199976
+ { tokenId: 0, type: "Portal", value: "0" },
199977
+ { tokenId: 1, type: "Portal", value: "0" },
199978
+ { tokenId: 2, type: "Portal", value: "0" },
199979
+ { tokenId: 3, type: "Synthesis", value: "0" },
199980
+ { tokenId: 4, type: "Synthesis", value: "0" },
199981
+ { tokenId: 5, type: "Synthesis", value: "0" }
199982
+ ]
199983
+ };
199984
+
199675
199985
  // src/crosschain/config/cache/cache.ts
199676
199986
 
199677
199987
  var ConfigCache = class {
@@ -199682,6 +199992,8 @@ var ConfigCache = class {
199682
199992
  this.cache = testnet_default;
199683
199993
  } else if (configName === "dev") {
199684
199994
  this.cache = dev_default;
199995
+ } else if (configName === "xdao") {
199996
+ this.cache = xdao_default;
199685
199997
  } else {
199686
199998
  throw new Error2("Unknown config name");
199687
199999
  }
@@ -199810,13 +200122,15 @@ var ConfigCache = class {
199810
200122
 
199811
200123
  // src/crosschain/symbiosis.ts
199812
200124
  var Symbiosis = class {
199813
- constructor(config4, clientId, overrideConfig) {
199814
- if (config4 === "mainnet") {
200125
+ constructor(config5, clientId, overrideConfig) {
200126
+ if (config5 === "mainnet") {
199815
200127
  this.config = config;
199816
- } else if (config4 === "testnet") {
200128
+ } else if (config5 === "testnet") {
199817
200129
  this.config = config2;
199818
- } else if (config4 === "dev") {
200130
+ } else if (config5 === "dev") {
199819
200131
  this.config = config3;
200132
+ } else if (config5 === "xdao") {
200133
+ this.config = config4;
199820
200134
  } else {
199821
200135
  throw new Error2("Unknown config name");
199822
200136
  }
@@ -199829,7 +200143,7 @@ var Symbiosis = class {
199829
200143
  return chainConfig;
199830
200144
  });
199831
200145
  }
199832
- this.configCache = new ConfigCache(config4);
200146
+ this.configCache = new ConfigCache(config5);
199833
200147
  this.clientId = ethers__WEBPACK_IMPORTED_MODULE_19__.formatBytes32String(clientId);
199834
200148
  this.providers = new Map(
199835
200149
  this.config.chains.map((i) => {
@@ -199952,13 +200266,13 @@ var Symbiosis = class {
199952
200266
  const signerOrProvider = signer || this.getProvider(chainId);
199953
200267
  return MetaRouter__factory.connect(address, signerOrProvider);
199954
200268
  }
199955
- omniPool(config4, signer) {
199956
- const { address, chainId } = config4;
200269
+ omniPool(config5, signer) {
200270
+ const { address, chainId } = config5;
199957
200271
  const signerOrProvider = signer || this.getProvider(chainId);
199958
200272
  return OmniPool__factory.connect(address, signerOrProvider);
199959
200273
  }
199960
- omniPoolOracle(config4, signer) {
199961
- const { oracle, chainId } = config4;
200274
+ omniPoolOracle(config5, signer) {
200275
+ const { oracle, chainId } = config5;
199962
200276
  const signerOrProvider = signer || this.getProvider(chainId);
199963
200277
  return OmniPoolOracle__factory.connect(oracle, signerOrProvider);
199964
200278
  }
@@ -200023,12 +200337,12 @@ var Symbiosis = class {
200023
200337
  return this.chainConfig(chainId).dexFee;
200024
200338
  }
200025
200339
  chainConfig(chainId) {
200026
- const config4 = this.config.chains.find((item) => {
200340
+ const config5 = this.config.chains.find((item) => {
200027
200341
  return item.id === chainId;
200028
200342
  });
200029
- if (!config4)
200343
+ if (!config5)
200030
200344
  throw new Error2(`Could not config by given chainId: ${chainId}`);
200031
- return config4;
200345
+ return config5;
200032
200346
  }
200033
200347
  // === stables ===
200034
200348
  tokens() {
@@ -200067,8 +200381,8 @@ var Symbiosis = class {
200067
200381
  }
200068
200382
  return transitToken;
200069
200383
  }
200070
- getOmniPoolByConfig(config4) {
200071
- return this.configCache.getOmniPoolByConfig(config4);
200384
+ getOmniPoolByConfig(config5) {
200385
+ return this.configCache.getOmniPoolByConfig(config5);
200072
200386
  }
200073
200387
  getOmniPoolByToken(token) {
200074
200388
  return this.configCache.getOmniPoolByToken(token);