Skip to content

Commit

Permalink
Merge pull request #9 from connext/4681-wormhole-updates
Browse files Browse the repository at this point in the history
4681 wormhole updates
  • Loading branch information
rhlsthrm authored Jul 12, 2023
2 parents e196453 + 946d6ff commit a8f6352
Show file tree
Hide file tree
Showing 8 changed files with 1,428 additions and 991 deletions.
4 changes: 2 additions & 2 deletions eth-sdk/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ export default defineConfig({
mainnet: {
relayerProxyHub: '0xcDbF9D438670D19d1Fb3954Abc8a13666b302b28',
arbitrumHubConnector: '0xd151C9ef49cE2d30B829a98A07767E3280F70961',
bnbHubConnector: '0xfaf539a73659feaec96ec7242f075be0445526a8',
bnbHubConnector: '0x69009c6f567590d8B469dbF4C8808e8ee32b8a45',
gnosisHubConnector: '0x245F757d660C3ec65416168690431076d58d6413',
},
arbitrumOne: {
spokeConnector: '0xFD81392229b6252cF761459d370C239Be3aFc54F',
},
bsc: {
spokeConnector: '0x126A99af70eC62921C07E67943aCF61bF304Ef55',
spokeConnector: '0xC667DE991c8B40C969f6996b4F6167851527c9f6',
},
goerli: {
relayerProxyHub: '0xe55162a662Abaf066D0fa6FFb720Dbe8Bc16342a',
Expand Down
21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,26 @@
},
"dependencies": {
"@arbitrum/sdk": "3.1.3",
"@connext/nxtp-adapters-subgraph": "^2.0.0-alpha.1",
"@connext/nxtp-utils": "^2.0.3",
"@eth-optimism/sdk": "^2.1.0",
"@flashbots/ethers-provider-bundle": "^0.6.2",
"@connext/nxtp-adapters-subgraph": "2.0.0",
"@connext/nxtp-utils": "2.0.4",
"@eth-optimism/sdk": "2.1.0",
"@flashbots/ethers-provider-bundle": "0.6.2",
"@keep3r-network/keeper-scripting-utils": "1.1.0",
"dotenv": "16.1.4",
"ethers": "5.6.9",
"interval-promise": "^1.4.0",
"interval-promise": "1.4.0",
"lodash.isequal": "4.5.0",
"undici": "5.22.1",
"zksync-web3": "^0.14.4"
"zksync-web3": "0.14.3"
},
"devDependencies": {
"@dethcrypto/eth-sdk": "0.3.4",
"@dethcrypto/eth-sdk-client": "0.1.6",
"@types/lodash.isequal": "4.5.6",
"husky": "^8.0.3",
"lint-staged": "^13.2.2",
"husky": "8.0.3",
"lint-staged": "13.2.3",
"ts-node": "10.9.1",
"typechain": "^8.2.0",
"typechain": "8.2.0",
"typescript": "5.1.3",
"xo": "0.54.2"
},
Expand All @@ -69,7 +69,8 @@
"new-cap": "off",
"no-await-in-loop": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"import/no-extraneous-dependencies": "warn"
"import/no-extraneous-dependencies": "warn",
"unicorn/prefer-top-level-await": "warn"
}
},
"packageManager": "[email protected]"
Expand Down
17 changes: 8 additions & 9 deletions src/helpers/propagate/arbitrum.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { L1ToL2MessageGasEstimator } from '@arbitrum/sdk/dist/lib/message/L1ToL2MessageGasEstimator';
import { getBaseFee } from '@arbitrum/sdk/dist/lib/utils/lib';
import { getArbitrumOneSdk, getMainnetSdk } from '@dethcrypto/eth-sdk-client';
import { BigNumber, constants, utils } from 'ethers';

import { type ExtraPropagateParameters, type InitialSetup } from 'src/utils/types';
import {L1ToL2MessageGasEstimator} from '@arbitrum/sdk/dist/lib/message/L1ToL2MessageGasEstimator';
import {getBaseFee} from '@arbitrum/sdk/dist/lib/utils/lib';
import {getArbitrumOneSdk, getMainnetSdk} from '@dethcrypto/eth-sdk-client';
import {BigNumber, constants, utils} from 'ethers';
import {type ExtraPropagateParameters, type InitialSetup} from 'src/utils/types';

// Example at https://github.com/OffchainLabs/arbitrum-tutorials/blob/master/packages/greeter/scripts/exec.js
export const getPropagateParameters = async ({ txSigner, arbProvider, provider }: InitialSetup): Promise<ExtraPropagateParameters> => {
export const getPropagateParameters = async ({txSigner, arbProvider, provider}: InitialSetup): Promise<ExtraPropagateParameters> => {
const mainnetSdk = getMainnetSdk(txSigner);

const arbSdk = getArbitrumOneSdk(arbProvider);
Expand All @@ -30,7 +29,7 @@ export const getPropagateParameters = async ({ txSigner, arbProvider, provider }
excessFeeRefundAddress: arbSdk.spokeConnector.address,
},
baseFee,
provider
provider,
);

const gasLimitForAutoRedeem = l1ToL2MessageGasParameters.gasLimit.mul(5);
Expand All @@ -42,5 +41,5 @@ export const getPropagateParameters = async ({ txSigner, arbProvider, provider }

const encodedData = utils.defaultAbiCoder.encode(['uint256', 'uint256', 'uint256'], [submissionPriceWei, maxGas, gasPriceBid]);

return { connector: '', fee: callValue, encodedData };
return {connector: '', fee: callValue, encodedData};
};
15 changes: 6 additions & 9 deletions src/helpers/propagate/bnb.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import {Contract} from 'ethers';
import {utils} from 'ethers';
import {getMainnetSdk} from '@dethcrypto/eth-sdk-client';

import {type ExtraPropagateParameters, type InitialSetup} from 'src/utils/types';

export const getPropagateParameters = async ({txSigner, provider}: InitialSetup): Promise<ExtraPropagateParameters> => {
const mainnetSdk = getMainnetSdk(txSigner);
const ambAddress = await mainnetSdk.bnbHubConnector.AMB();

const ambContract = new Contract(
ambAddress,
['function calcSrcFees(string calldata _appID, uint256 _toChainID, uint256 _dataLength) external view returns (uint256)'],
provider,
);
const fee = await ambContract.calcSrcFees('', 56, 32);
// See: https://github.com/connext/monorepo/blob/e28db100e55d28d8a9d509959d603f9ced58de25/packages/agents/lighthouse/src/tasks/propagate/helpers/bnb.ts#L54-L57
const gasLimit = '200000';
const fee = await mainnetSdk.bnbHubConnector.quoteEVMDeliveryPrice(gasLimit, ambAddress);
const encodedData = utils.defaultAbiCoder.encode(['uint256'], [gasLimit]);

return {connector: '', fee, encodedData: '0x'};
return {connector: '', fee: fee.toString(), encodedData};
};
1 change: 0 additions & 1 deletion src/helpers/propagate/gnosis.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {getMainnetSdk} from '@dethcrypto/eth-sdk-client';
import {Contract, utils} from 'ethers';

import {type ExtraPropagateParameters, type InitialSetup} from 'src/utils/types';

export const getPropagateParameters = async ({txSigner, provider}: InitialSetup): Promise<ExtraPropagateParameters> => {
Expand Down
1 change: 0 additions & 1 deletion src/helpers/propagate/zksync.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {BigNumber, Contract, utils} from 'ethers';
import {Provider} from 'zksync-web3';

import {type ExtraPropagateParameters, type InitialSetup} from 'src/utils/types';

const ZKSYNC_ABI = [
Expand Down
1 change: 0 additions & 1 deletion src/shared/run-propagate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type {BroadcastorProps} from '@keep3r-network/keeper-scripting-utils';
import {BlockListener} from '@keep3r-network/keeper-scripting-utils';
import {getChainData} from '@connext/nxtp-utils';
import {SubgraphReader} from '@connext/nxtp-adapters-subgraph';

import {type RelayerProxyHub} from '.dethcrypto/eth-sdk-client/esm/types/mainnet';
import {populateParametersForDomains} from '../utils/propagate';
import {type InitialSetup} from '../utils/types';
Expand Down
Loading

0 comments on commit a8f6352

Please sign in to comment.