diff --git a/packages/adapters/subgraph/.graphclientrc.yml b/packages/adapters/subgraph/.graphclientrc.yml index ca31c432c4..ec70b0a34c 100644 --- a/packages/adapters/subgraph/.graphclientrc.yml +++ b/packages/adapters/subgraph/.graphclientrc.yml @@ -353,7 +353,17 @@ sources: - name: Connext_Mainnet handler: graphql: - strategy: fallback + strategy: highestValue + strategyConfig: + selectionSet: | + { + _meta { + block { + number + } + } + } + value: "_meta.block.number" sources: - endpoint: "https://gateway.thegraph.com/api/{env.GRAPH_API_KEY}/subgraphs/id/DfD1tZSmDtjCGC2LeYEQbVzj9j8kNqKAQEsYL27Vg6Sw" retry: 2 @@ -373,7 +383,17 @@ sources: - name: Connext_Optimism handler: graphql: - strategy: fallback + strategy: highestValue + strategyConfig: + selectionSet: | + { + _meta { + block { + number + } + } + } + value: "_meta.block.number" sources: - endpoint: https://api.thegraph.com/subgraphs/name/connext/amarok-runtime-v0-optimism retry: 2 @@ -393,7 +413,17 @@ sources: - name: Connext_Polygon handler: graphql: - strategy: fallback + strategy: highestValue + strategyConfig: + selectionSet: | + { + _meta { + block { + number + } + } + } + value: "_meta.block.number" sources: - endpoint: "https://gateway.thegraph.com/api/{env.GRAPH_API_KEY}/subgraphs/id/6NccoNRo22DgB7oCHaG7U5MxvfYXcCERRN1oVtCWm32x" retry: 5 @@ -413,7 +443,17 @@ sources: - name: Connext_ArbitrumOne handler: graphql: - strategy: fallback + strategy: highestValue + strategyConfig: + selectionSet: | + { + _meta { + block { + number + } + } + } + value: "_meta.block.number" sources: - endpoint: "https://gateway.thegraph.com/api/{env.GRAPH_API_KEY}/subgraphs/id/DNQfRxJou184r5YagTz9HUQST5URsY2WdYkegH9Rrdkf" retry: 5 @@ -433,7 +473,17 @@ sources: - name: Connext_Bnb handler: graphql: - strategy: fallback + strategy: highestValue + strategyConfig: + selectionSet: | + { + _meta { + block { + number + } + } + } + value: "_meta.block.number" sources: - endpoint: https://api.thegraph.com/subgraphs/name/connext/amarok-runtime-v0-bnb retry: 2 @@ -453,7 +503,17 @@ sources: - name: Connext_Xdai handler: graphql: - strategy: fallback + strategy: highestValue + strategyConfig: + selectionSet: | + { + _meta { + block { + number + } + } + } + value: "_meta.block.number" sources: - endpoint: "https://gateway.thegraph.com/api/{env.GRAPH_API_KEY}/subgraphs/id/EdS5b1Zbw8A5KHs4JRnWDKdM5K2Hnq97UuE8RG9b61Ey" retry: 2 diff --git a/packages/agents/sdk/CHANGELOG.md b/packages/agents/sdk/CHANGELOG.md index 5a68c62139..0f38849c02 100644 --- a/packages/agents/sdk/CHANGELOG.md +++ b/packages/agents/sdk/CHANGELOG.md @@ -2,10 +2,6 @@ ## Next Release -## v2.1.3-alpha.1 - -- `updateSlippage`: Fix decimal parsing - ## v2.1.2 - `options`: SDK takes passed in provider diff --git a/packages/agents/sdk/package.json b/packages/agents/sdk/package.json index 6af0475e10..a6e0afbb8d 100644 --- a/packages/agents/sdk/package.json +++ b/packages/agents/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@connext/sdk-core", - "version": "2.1.3-alpha.1", + "version": "2.1.2", "description": "Client-side package for interacting with the Connext protocol", "author": "Connext", "license": "MIT", diff --git a/packages/agents/sdk/src/sdkBase.ts b/packages/agents/sdk/src/sdkBase.ts index ffa9446148..11c49afab4 100644 --- a/packages/agents/sdk/src/sdkBase.ts +++ b/packages/agents/sdk/src/sdkBase.ts @@ -485,7 +485,10 @@ export class SdkBase extends SdkShared { canonicalId: transfer.canonical_id, }; - const data = this.contracts.connext.encodeFunctionData("forceUpdateSlippage", [transferInfo, _newSlippage]); + const data = this.contracts.connext.encodeFunctionData("forceUpdateSlippage", [ + transferInfo, + utils.parseUnits(_newSlippage), + ]); const txRequest = { to: ConnextContractAddress, diff --git a/packages/agents/sdk/src/sdkPool.ts b/packages/agents/sdk/src/sdkPool.ts index 156a0ca7a3..118a324199 100644 --- a/packages/agents/sdk/src/sdkPool.ts +++ b/packages/agents/sdk/src/sdkPool.ts @@ -211,13 +211,8 @@ export class SdkPool extends SdkShared { * @param originTokenAddress - The address of the token to be bridged from origin. * @param amount - The amount of the origin token to bridge, in the origin token's native decimal precision. * @param receiveLocal - (optional) Whether the desired destination token is the local asset ("nextAsset"). - * @param checkFastLiquidity - (optional) Check for fast liquidity availability. False will assume fast liquidity is available. - * @returns - * - amountReceived: Estimated amount received in the decimal precision of the final destination token. - * - originSlippage: Slippage for the origin swap (0 if no swap) in BPS. Negative values indicate positive slippage. - * - destinationSlippage: Slippage for the destination swap (0 if no swap) in BPS. Negative values indicate positive slippage. - * - routerFee: Fee taken by the router in the amount of the local origin asset. - * - isFastPath: Boolean indicating if the fast liquidity path is available. + * @param checkFastLiquidity - (optional) Whether to check for fast liquidity availability. + * @returns Estimated amount received for local/adopted assets, if applicable, in their native decimal precisions. */ async calculateAmountReceived( originDomain: string, @@ -253,18 +248,10 @@ export class SdkPool extends SdkShared { throw new Error("Origin token cannot be bridged to any token on this destination domain"); } - /** - * ------------------------------------ - * Origin-side calculations - * ------------------------------------ - */ - - let originAmountReceived = amount; - let originSlippage = BigNumber.from(0); - // Swap IFF supplied origin token is an adopted asset + let originAmountReceived = amount; if (!isNextAsset && originPool) { - const originAmountReceivedAfterSwap = await this.calculateSwapLocal( + originAmountReceived = await this.calculateSwapLocal( originDomain, originPool, _originTokenAddress, @@ -272,103 +259,56 @@ export class SdkPool extends SdkShared { originPool.local.index, amount, ); - - // Pool assets may have different decimals - const originLocalDecimals = originPool.local.decimals; - const originAdoptedDecimals = originPool.adopted.decimals; - - // Convert decimals to the higher precision - const higherPrecisionDecimals = Math.max(originLocalDecimals, originAdoptedDecimals); - const originAmountReceivedConverted = BigNumber.from(originAmountReceived).mul( - BigNumber.from(10).pow(higherPrecisionDecimals - originAdoptedDecimals), - ); - const originAmountReceivedAfterSwapConverted = originAmountReceivedAfterSwap.mul( - BigNumber.from(10).pow(higherPrecisionDecimals - originLocalDecimals), - ); - - originSlippage = BigNumber.from( - originAmountReceivedConverted - .sub(originAmountReceivedAfterSwapConverted ?? originAmountReceivedConverted) - .mul(10000) - .div(originAmountReceivedConverted), - ); - - // Convert origin amount received post-swap to the local decimal precision - originAmountReceived = originAmountReceivedAfterSwapConverted.div( - BigNumber.from(10).pow(higherPrecisionDecimals - originLocalDecimals), - ); } - /** - * ------------------------------------ - * Router / fast liquidity calculations - * ------------------------------------ - */ - - // Determine if fast liquidity is available (pre-destination-swap amount) - let isFastPath = true; - if (checkFastLiquidity) { - const activeLiquidity = await this.getActiveLiquidity(destinationDomain, destinationAssetData.local); - if (activeLiquidity?.length > 0) { - const total_balance: string = activeLiquidity[0].total_balance.toString(); - isFastPath = BigNumber.from(this.scientificToBigInt(total_balance)).mul(70).div(100).gt(originAmountReceived); - } - } - - // Subtract router fee if fast liquidity is available + const originSlippage = BigNumber.from(amount).sub(originAmountReceived).mul(10000).div(amount); const feeBps = BigNumber.from(+DEFAULT_ROUTER_FEE * 100); const routerFee = BigNumber.from(originAmountReceived).mul(feeBps).div(10000); - if (isFastPath) { - originAmountReceived = BigNumber.from(originAmountReceived).sub(routerFee); - } - - /** - * ------------------------------------ - * Destination-side calculations - * ------------------------------------ - */ const destinationPool = await this.getPool(destinationDomain, destinationAssetData.local); - let destinationAmountReceived = originAmountReceived; - let destinationSlippage = BigNumber.from(0); + const destinationAmount = BigNumber.from(originAmountReceived).sub(routerFee); + let destinationAmountReceived = destinationAmount; + + const promises: Promise[] = []; // Swap IFF desired destination token is an adopted asset if (!receiveLocal && destinationPool) { - const destinationAmountReceivedAfterSwap = await this.calculateSwapLocal( - destinationDomain, - destinationPool, - destinationAssetData.local, - destinationPool.local.index, - destinationPool.adopted.index, - destinationAmountReceived, + promises.push( + this.calculateSwapLocal( + destinationDomain, + destinationPool, + destinationAssetData.local, + destinationPool.local.index, + destinationPool.adopted.index, + destinationAmount, + ), ); + } else { + promises.push(Promise.resolve(undefined)); + } - // Pool assets may have different decimals - const destinationLocalDecimals = destinationPool.local.decimals; - const destinationAdoptedDecimals = destinationPool.adopted.decimals; - - // Convert decimals to the higher precision - const higherPrecisionDecimals = Math.max(destinationLocalDecimals, destinationAdoptedDecimals); - const destinationAmountReceivedConverted = BigNumber.from(destinationAmountReceived).mul( - BigNumber.from(10).pow(higherPrecisionDecimals - destinationLocalDecimals), - ); - const destinationAmountReceivedAfterSwapConverted = destinationAmountReceivedAfterSwap.mul( - BigNumber.from(10).pow(higherPrecisionDecimals - destinationAdoptedDecimals), - ); + // Determine if fast liquidity is available (pre-destination-swap amount) + if (checkFastLiquidity) { + promises.push(this.getActiveLiquidity(destinationDomain, destinationAssetData.local)); + } - destinationSlippage = BigNumber.from( - destinationAmountReceivedConverted - .sub(destinationAmountReceivedAfterSwapConverted ?? destinationAmountReceivedConverted) - .mul(10000) - .div(destinationAmountReceivedConverted), - ); + const [destinationAmountReceivedSwap, activeLiquidity] = await Promise.all(promises); + destinationAmountReceived = destinationAmountReceivedSwap ?? destinationAmountReceived; - // Convert destination amount received post-swap to the adopted decimal precision - destinationAmountReceived = destinationAmountReceivedAfterSwapConverted.div( - BigNumber.from(10).pow(higherPrecisionDecimals - destinationAdoptedDecimals), - ); + // Default true, set to false if fast liquidity is not available + let isFastPath = true; + if (activeLiquidity?.length > 0) { + const total_balance: string = activeLiquidity[0].total_balance.toString(); + isFastPath = BigNumber.from(this.scientificToBigInt(total_balance)).mul(70).div(100).gt(destinationAmount); } + const destinationSlippage = BigNumber.from( + destinationAmount + .sub(destinationAmountReceived ?? destinationAmount) + .mul(10000) + .div(destinationAmount), + ); + return { amountReceived: destinationAmountReceived, originSlippage, diff --git a/packages/agents/sdk/test/sdkPool.spec.ts b/packages/agents/sdk/test/sdkPool.spec.ts index ad0546acdb..98dfeaa54f 100644 --- a/packages/agents/sdk/test/sdkPool.spec.ts +++ b/packages/agents/sdk/test/sdkPool.spec.ts @@ -505,7 +505,7 @@ describe("SdkPool", () => { stub(sdkPool, "getPool").onCall(0).resolves(undefined).onCall(1).resolves(undefined); const originAmount = BigNumber.from(100_000); - const originSlippage = "0"; // 0% in BPS + const originSlippage = "0"; // 10% in BPS const destinationSlippage = "0"; // 0% in BPS stub(sdkPool, "getCanonicalTokenId").resolves([mockAssetData.canonical_domain, mockAssetData.canonical_id]); @@ -523,77 +523,32 @@ describe("SdkPool", () => { expect(res.destinationSlippage.toString()).to.equal(destinationSlippage); }); - it("happy: should work with local origin asset and adopted destination asset, 6 and 18 decimals respectively", async () => { - const localAsset6Decimals = { ...localAsset, decimals: 6 }; - const adoptedAsset18Decimals = { ...adoptedAsset, decimals: 18 }; - const mockPoolDifferentDecimals = { - ...mockPool, - local: localAsset6Decimals, - adopted: adoptedAsset18Decimals, - }; - - // return destination pool - stub(sdkPool, "getPool").onCall(0).resolves(undefined).onCall(1).resolves(mockPoolDifferentDecimals); - - const originAmount = BigNumber.from(100_000); - const originSlippage = "0"; // 0% in BPS - - const originAmountAfterRouterFee = originAmount.sub(originAmount.mul(feeBps).div(10000)); // router takes 0.05% - - const destinationAmountAfterSwap = originAmountAfterRouterFee.mul(9).div(10); // assume swap ate 10%; - const destinationAmountAfterSwapConverted = destinationAmountAfterSwap.mul(BigNumber.from(10).pow(12)); // to 18 decimals - const destinationSlippage = "1000"; // 10% in BPS - - stub(sdkPool, "calculateSwapLocal") - .onCall(0) // swap once for destination pool - .resolves(destinationAmountAfterSwapConverted); - stub(sdkPool, "getCanonicalTokenId").resolves([mockAssetData.canonical_domain, mockAssetData.canonical_id]); - stub(sdkPool, "getAssetsDataByDomainAndKey").resolves(mockAssetData); - - const res = await sdkPool.calculateAmountReceived( - mockPoolDifferentDecimals.domainId, - mockPoolDifferentDecimals.domainId, - mockPoolDifferentDecimals.local.address, - originAmount, - ); - - expect(res.originSlippage.toString()).to.equal(originSlippage); - expect(res.destinationSlippage.toString()).to.equal(destinationSlippage); - }); - - it("happy: should work with adopted origin asset and local destination asset, 18 and 6 decimals respectively", async () => { - const localAsset6Decimals = { ...localAsset, decimals: 6 }; - const adoptedAsset18Decimals = { ...adoptedAsset, decimals: 18 }; - const mockPoolDifferentDecimals = { - ...mockPool, - local: localAsset6Decimals, - adopted: adoptedAsset18Decimals, + it("happy: should work with 6 decimals local asset and 18 decimals adopted asset", async () => { + const pool: Pool = { + domainId: mock.domain.A, + name: "TSTB Pool", + symbol: "TSTB-TSTA", + local: localAsset, + adopted: adoptedAsset, + lpTokenAddress: utils.formatBytes32String("asdf"), + canonicalHash: utils.formatBytes32String("13337"), + swapFee: "4000000", + balances: [BigNumber.from("706924186329"), BigNumber.from("749171899882428175742051")], + decimals: [6, 18], + invariant: BigNumber.from("1456093034430419725194080"), + initialA: BigNumber.from("20000"), + initialATime: 0, + futureA: BigNumber.from("20000"), + futureATime: 0, + currentA: BigNumber.from("20000"), + adminFee: "0", }; - // return origin pool - stub(sdkPool, "getPool").onCall(0).resolves(mockPoolDifferentDecimals).onCall(1).resolves(undefined); - - const originAmount = BigNumber.from(10).pow(18); - const originAmountAfterSwap = originAmount.mul(9).div(10); // assume swap ate 10% - const originAmountAfterSwapConverted = originAmountAfterSwap.div(BigNumber.from(10).pow(12)); // to 6 decimals - const originSlippage = "1000"; // 10% in BPS - const destinationSlippage = "0"; // 0% in BPS + const originAmount = BigNumber.from(1_000); + const receivedAmount = originAmount.mul(BigNumber.from(10).pow(12)).mul(9).div(10); // assume swap ate 10% - stub(sdkPool, "calculateSwapLocal") - .onCall(0) // swap once for origin pool - .resolves(originAmountAfterSwapConverted); - stub(sdkPool, "getCanonicalTokenId").resolves([mockAssetData.canonical_domain, mockAssetData.canonical_id]); - stub(sdkPool, "getAssetsDataByDomainAndKey").resolves(mockAssetData); - - const res = await sdkPool.calculateAmountReceived( - mockPoolDifferentDecimals.domainId, - mockPoolDifferentDecimals.domainId, - mockPoolDifferentDecimals.adopted.address, - originAmount, - ); - - expect(res.originSlippage.toString()).to.equal(originSlippage); - expect(res.destinationSlippage.toString()).to.equal(destinationSlippage); + const res = await sdkPool.calculateSwapLocal(mock.domain.A, pool, pool.local.address, 0, 1, originAmount); + expect(res.gt(receivedAmount)).to.equal(true); }); }); diff --git a/packages/deployments/contracts/src/cli/init/config/mainnet/production.ts b/packages/deployments/contracts/src/cli/init/config/mainnet/production.ts index c296e6ace6..c660a78b14 100644 --- a/packages/deployments/contracts/src/cli/init/config/mainnet/production.ts +++ b/packages/deployments/contracts/src/cli/init/config/mainnet/production.ts @@ -230,21 +230,6 @@ export const MAINNET_PRODUCTION_INIT_CONFIG: InitConfig = { local: "0x49000f5e208349D2fA678263418e21365208E498", adopted: "0x49000f5e208349D2fA678263418e21365208E498", }, - // polygon - "1886350457": { - local: "0x0000000000000000000000000000000000000000", - adopted: "0x0000000000000000000000000000000000000000", - }, - // bnb - "6450786": { - local: "0x0000000000000000000000000000000000000000", - adopted: "0x0000000000000000000000000000000000000000", - }, - // gnosis - "6778479": { - local: "0x0000000000000000000000000000000000000000", - adopted: "0x0000000000000000000000000000000000000000", - }, }, }, { @@ -266,21 +251,6 @@ export const MAINNET_PRODUCTION_INIT_CONFIG: InitConfig = { local: "0x303241e2B3b4aeD0bb0F8623e7442368FED8Faf3", adopted: "0x303241e2B3b4aeD0bb0F8623e7442368FED8Faf3", }, - // polygon - "1886350457": { - local: "0x0000000000000000000000000000000000000000", - adopted: "0x0000000000000000000000000000000000000000", - }, - // bnb - "6450786": { - local: "0x0000000000000000000000000000000000000000", - adopted: "0x0000000000000000000000000000000000000000", - }, - // gnosis - "6778479": { - local: "0x0000000000000000000000000000000000000000", - adopted: "0x0000000000000000000000000000000000000000", - }, }, }, { @@ -320,58 +290,6 @@ export const MAINNET_PRODUCTION_INIT_CONFIG: InitConfig = { }, }, }, - { - name: "BTRST", - canonical: { - domain: "6648936", - address: "0x799ebfABE77a6E34311eeEe9825190B9ECe32824", - decimals: 18, - cap: utils.parseUnits("10000000", 18).toString(), - }, - representations: { - /// POLYGON - "1886350457": { - local: "0x8C92DC2B9D6A8A567c7Bd80C5db7a1eDA4fA9A91", - adopted: "0x8C92DC2B9D6A8A567c7Bd80C5db7a1eDA4fA9A91", - }, - }, - }, - { - name: "NEXT", - canonical: { - domain: "6648936", - address: "0x58b9cB810A68a7f3e1E4f8Cb45D1B9B3c79705E8", - decimals: 18, - cap: utils.parseUnits("500000000", 18).toString(), - }, - representations: { - // optimism - "1869640809": { - local: "0x58b9cB810A68a7f3e1E4f8Cb45D1B9B3c79705E8", - adopted: "0x58b9cB810A68a7f3e1E4f8Cb45D1B9B3c79705E8", - }, - // arbitrum one - "1634886255": { - local: "0x58b9cB810A68a7f3e1E4f8Cb45D1B9B3c79705E8", - adopted: "0x58b9cB810A68a7f3e1E4f8Cb45D1B9B3c79705E8", - }, - // polygon - "1886350457": { - local: "0x58b9cB810A68a7f3e1E4f8Cb45D1B9B3c79705E8", - adopted: "0x58b9cB810A68a7f3e1E4f8Cb45D1B9B3c79705E8", - }, - // bsc - "6450786": { - local: "0x58b9cB810A68a7f3e1E4f8Cb45D1B9B3c79705E8", - adopted: "0x58b9cB810A68a7f3e1E4f8Cb45D1B9B3c79705E8", - }, - // gnosis - "6778479": { - local: "0x58b9cB810A68a7f3e1E4f8Cb45D1B9B3c79705E8", - adopted: "0x58b9cB810A68a7f3e1E4f8Cb45D1B9B3c79705E8", - }, - }, - }, ], agents: { relayerFeeVaults: { @@ -387,8 +305,6 @@ export const MAINNET_PRODUCTION_INIT_CONFIG: InitConfig = { }, routers: { allowlist: [ - "0x76cf58ce587bc928fcc5ad895555fd040e06c61a", // BTRST - "0x5d527765252003AceE6545416F6a9C8D15ae8402", // 01node "0x49a9E7ec76Bc8fDF658d09557305170d9F01D2fA", // BlockTech 3 "0x6273c0965A1dB4F8A6277d490B4fD48715a42b96", // Xocalatl "0x9584Eb0356a380b25D7ED2C14c54De58a25f2581", // Mike Nai diff --git a/packages/deployments/contracts/src/cli/init/config/testnet/production.ts b/packages/deployments/contracts/src/cli/init/config/testnet/production.ts index fc2b08a923..007545aa04 100644 --- a/packages/deployments/contracts/src/cli/init/config/testnet/production.ts +++ b/packages/deployments/contracts/src/cli/init/config/testnet/production.ts @@ -132,31 +132,11 @@ export const TESTNET_PRODUCTION_INIT_CONFIG: InitConfig = { }, }, }, - { - name: "ALCX", - canonical: { - domain: "1735353714", - address: "0x303241e2B3b4aeD0bb0F8623e7442368FED8Faf3", - decimals: 18, - }, - representations: { - /// ARBITRUM-GOERLI - "1734439522": { - local: "0x49000f5e208349D2fA678263418e21365208E498", - adopted: "0x49000f5e208349D2fA678263418e21365208E498", - }, - /// OPTIMISM-GOERLI - "1735356532": { - local: "0x49000f5e208349D2fA678263418e21365208E498", - adopted: "0x49000f5e208349D2fA678263418e21365208E498", - }, - }, - }, { name: "xDappRadar", canonical: { domain: "1735353714", - address: "0x4c781E4D22cfaAdA520cAe4aF9097C5ecf9C3A71", + address: "0x369e5C58F6c09c1CE947CA313f03c0d558B77b3e", decimals: 18, }, representations: { @@ -166,9 +146,9 @@ export const TESTNET_PRODUCTION_INIT_CONFIG: InitConfig = { adopted: "0xb6932c8363354df7620a7a7bF3a933A253015cA3", }, /// MUMBAI - "9991": { - local: "0x3fC9473d9dF84887D483A93a8d207f90D9bE63C4", - adopted: "0x3fC9473d9dF84887D483A93a8d207f90D9bE63C4", + "9991": { + local: "0x3fC9473d9dF84887D483A93a8d207f90D9bE63C4", + adopted: "0x3fC9473d9dF84887D483A93a8d207f90D9bE63C4", }, }, }, @@ -187,66 +167,79 @@ export const TESTNET_PRODUCTION_INIT_CONFIG: InitConfig = { }, }, }, - { - name: "xTokenFrontend", - canonical: { - domain: "1735353714", - address: "0x6984384D6abE16221769BD9400de72b8F4Aa572C", - decimals: 18, - }, - representations: { - /// ARBITRUM-GOERLI - "1734439522": { - local: "0x7E9D498a970B7786ea923Fb8643FBbF62Efa5037", - adopted: "0x7E9D498a970B7786ea923Fb8643FBbF62Efa5037", - }, - /// OPTIMISM-GOERLI - "1735356532": { - local: "0xf5f1424dD3B78f64B18A085C8D7AEa5E124bf168", - adopted: "0xf5f1424dD3B78f64B18A085C8D7AEa5E124bf168", - }, - }, - }, - { - name: "xMonoTest", - canonical: { - domain: "1735353714", - address: "0x026dD7034AD81D2BEEc7F9d77DC5fDd6f55BaEF3", - decimals: 18, - }, - representations: { - /// MUMBAI - "9991": { - local: "0x026dD7034AD81D2BEEc7F9d77DC5fDd6f55BaEF3", - adopted: "0x026dD7034AD81D2BEEc7F9d77DC5fDd6f55BaEF3", - }, - }, - }, - { - name: "NEXT", - canonical: { - domain: "1735353714", - address: "0x61E0589e12395c06F6A72e5B31f803e47185FC81", - decimals: 18, - }, - representations: { - /// OPTIMISM-GOERLI - "1735356532": { - local: "0x61E0589e12395c06F6A72e5B31f803e47185FC81", - adopted: "0x61E0589e12395c06F6A72e5B31f803e47185FC81", - }, - /// MUMBAI - "9991": { - local: "0x61E0589e12395c06F6A72e5B31f803e47185FC81", - adopted: "0x61E0589e12395c06F6A72e5B31f803e47185FC81", - }, - /// ARBITRUM-GOERLI - "1734439522": { - local: "0x61E0589e12395c06F6A72e5B31f803e47185FC81", - adopted: "0x61E0589e12395c06F6A72e5B31f803e47185FC81", - }, - }, - }, + // { + // name: "WETH", + // canonical: { + // domain: "1735353714", + // address: "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6", + // decimals: 18, + // }, + // representations: { + // "1735356532": { + // local: "0x39B061B7e41DE8B721f9aEcEB6b3f17ECB7ba63E", + // adopted: "0x74c6FD7D2Bc6a8F0Ebd7D78321A95471b8C2B806", + // }, + // "9991": { + // local: "0x1E5341E4b7ed5D0680d9066aac0396F0b1bD1E69", + // adopted: "0xFD2AB41e083c75085807c4A65C0A14FDD93d55A9", + // }, + // /// ARBITRUM-GOERLI + // "1734439522": { + // adopted: "0x1346786E6A5e07b90184a1Ba58E55444b99DC4A2", + // }, + // /// ZKSYNC-TEST + // "2053862260": { + // local: "0xbef9DE2c456895cdafB0ecB764d2DedFF58ed157", + // adopted: "0xbef9DE2c456895cdafB0ecB764d2DedFF58ed157", + // }, + // /// CONSENSYS-ZKEVM-TEST + // "1668247156": { + // local: "0xB706319D37b945727E71ae0d4353699d19112576", + // adopted: "0xB706319D37b945727E71ae0d4353699d19112576", + // }, + // /// POLYGON-ZKEVM-TEST + // "1887071092": { + // adopted: "0xeE589e91401066068AF129B0005aC3EF69E3fdB4", + // }, + // }, + // }, + // { + // name: "HARD", + // canonical: { + // domain: "1735353714", + // address: "0x5c8279211C48abb8b2c104b493561e1EcFB9a595", + // decimals: 18, + // cap: utils.parseUnits("10000000", 18).toString(), + // }, + // representations: { + // /// OPTIMISM-GOERLI + // "1735356532": { + // adopted: "0x1956831c14d2e193386159837644F193D12b2755", + // local: "0x1956831c14d2e193386159837644F193D12b2755", + // }, + // /// MUMBAI + // "9991": { + // adopted: "0xfA2F9cE589b30F1E4C8Bf20BcB496032087baaF0", + // local: "0xfA2F9cE589b30F1E4C8Bf20BcB496032087baaF0", + // }, + // /// ARBITRUM-GOERLI + // "1734439522": { + // adopted: "0x0000000000000000000000000000000000000000", + // }, + // /// ZKSYNC-TEST + // "2053862260": { + // adopted: "0x0000000000000000000000000000000000000000", + // }, + // /// CONSENSYS-ZKEVM-TEST + // "1668247156": { + // adopted: "0x0000000000000000000000000000000000000000", + // }, + // /// POLYGON-ZKEVM-TEST + // "1887071092": { + // adopted: "0x0000000000000000000000000000000000000000", + // }, + // }, + // }, ], agents: { relayerFeeVaults: { @@ -256,13 +249,6 @@ export const TESTNET_PRODUCTION_INIT_CONFIG: InitConfig = { "1634886255": "0xade09131C6f43fe22C2CbABb759636C43cFc181e", "6450786": "0xade09131C6f43fe22C2CbABb759636C43cFc181e", "6778479": "0xade09131C6f43fe22C2CbABb759636C43cFc181e", - "1735353714": "0xade09131C6f43fe22C2CbABb759636C43cFc181e", - "1735356532": "0xade09131C6f43fe22C2CbABb759636C43cFc181e", - "1734439522": "0xade09131C6f43fe22C2CbABb759636C43cFc181e", - "9991": "0xade09131C6f43fe22C2CbABb759636C43cFc181e", - "2053862260": "0xade09131C6f43fe22C2CbABb759636C43cFc181e", - "1668247156": "0xade09131C6f43fe22C2CbABb759636C43cFc181e", - "1887071092": "0xade09131C6f43fe22C2CbABb759636C43cFc181e", }, watchers: { allowlist: ["0x2cfBF3D40F71ceed2997cACbafE9D31e630860CB", "0x54BAA998771639628ffC0206c3b916c466b79c89"], diff --git a/packages/deployments/contracts/src/cli/init/helpers/assets.ts b/packages/deployments/contracts/src/cli/init/helpers/assets.ts index 8d476efa79..0c06e19043 100644 --- a/packages/deployments/contracts/src/cli/init/helpers/assets.ts +++ b/packages/deployments/contracts/src/cli/init/helpers/assets.ts @@ -81,7 +81,6 @@ export const setupAsset = async (args: { // Set up all the representational assets on their respective domains. for (const [domain, representation] of Object.entries(asset.representations)) { - if (!representation) continue; const stableswapPool = constants.AddressZero; const network = networks.find((n) => n.domain === domain); diff --git a/packages/deployments/contracts/src/cli/init/init.ts b/packages/deployments/contracts/src/cli/init/init.ts index 31517472cb..6ca46ff82a 100644 --- a/packages/deployments/contracts/src/cli/init/init.ts +++ b/packages/deployments/contracts/src/cli/init/init.ts @@ -102,8 +102,7 @@ export const sanitizeAndInit = async () => { const assetDomains = [asset.canonical.domain].concat(Object.keys(asset.representations)); const configuredDomains = domains.filter((domain) => assetDomains.includes(domain)); - const isSubset = configuredDomains.every((item) => domains.includes(item)); - if (!isSubset) { + if (JSON.stringify(configuredDomains.sort()) != JSON.stringify(domains.sort())) { throw new Error( `Not configured asset domains, asset: ${asset.name}, canonical: (${asset.canonical.domain}, ${ asset.canonical.address @@ -387,7 +386,6 @@ export const initProtocol = async (protocol: ProtocolStack, apply: boolean, stag if (!adopteds[key]) { adopteds[key] = []; } - if (!value) return; value.adopted === constants.AddressZero ? "" : adopteds[key].push(value.adopted); if (!value.local) { return; @@ -543,7 +541,7 @@ export const initProtocol = async (protocol: ProtocolStack, apply: boolean, stag // TODO: Blacklist/remove sequencers. } - /// MARK - Routers + // /// MARK - Routers if (protocol.agents.routers) { if (protocol.agents.routers.allowlist) { console.log("\n\nWHITELIST ROUTERS");