Skip to content

Commit

Permalink
Merge branch 'main' of github.com:hyperlane-xyz/hyperlane-monorepo in…
Browse files Browse the repository at this point in the history
…to dan/multicall
  • Loading branch information
daniel-savu committed Apr 30, 2024
2 parents ed973db + 3a08e31 commit ed01d43
Show file tree
Hide file tree
Showing 43 changed files with 2,350 additions and 317 deletions.
7 changes: 7 additions & 0 deletions .changeset/cool-readers-kiss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@hyperlane-xyz/sdk': minor
---

Added RPC `concurrency` property to `ChainMetadata`.
Added `CrudModule` abstraction and related types.
Removed `Fuel` ProtocolType.
5 changes: 5 additions & 0 deletions .changeset/eight-cherries-develop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/sdk': minor
---

Add EvmERC20WarpRouterReader to derive WarpConfig from TokenRouter address
8 changes: 4 additions & 4 deletions rust/config/mainnet_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@
"from": 2496427
},
"interchainGasPaymaster": "0xB3fCcD379ad66CED0c91028520C64226611A48c9",
"interchainSecurityModule": "0xfeBe2fB33d203B43D763f119874574c33326d545",
"interchainSecurityModule": "0x0986f6D82A47045788b0ce8EF68f6C0D77726854",
"mailbox": "0x3a867fCfFeC2B790970eeBDC9023E75B0a172aa7",
"merkleTreeHook": "0xC9B8ea6230d6687a4b13fD3C0b8f0Ec607B26465",
"name": "blast",
Expand Down Expand Up @@ -432,7 +432,7 @@
"from": 18422581
},
"interchainGasPaymaster": "0x9e6B1022bE9BBF5aFd152483DAD9b88911bC8611",
"interchainSecurityModule": "0x43Ce4Eb4aE3585dDe9Ac6967Db5b06f7f6764C8a",
"interchainSecurityModule": "0xB42b88243F749F47697F01Ae1cbBCA9d4763902a",
"mailbox": "0xc005dc82818d67AF737725bD4bf75435d065D239",
"merkleTreeHook": "0x48e6c30B97748d1e2e03bf3e9FbE3890ca5f8CCA",
"name": "ethereum",
Expand Down Expand Up @@ -637,7 +637,7 @@
"from": 437300
},
"interchainGasPaymaster": "0x0D63128D887159d63De29497dfa45AFc7C699AE4",
"interchainSecurityModule": "0xDEed16fe4b1c9b2a93483EDFf34C77A9b57D31Ff",
"interchainSecurityModule": "0xEda7cCD2A8CF717dc997D0002e363e4D10bF5c0d",
"isTestnet": false,
"mailbox": "0x3a464f746D23Ab22155710f44dB16dcA53e0775E",
"merkleTreeHook": "0x149db7afD694722747035d5AEC7007ccb6F8f112",
Expand Down Expand Up @@ -782,7 +782,7 @@
"contractAddressBytes": 32,
"domainId": "1853125230",
"gasPrice": {
"amount": "0.57",
"amount": "0.0053",
"denom": "untrn"
},
"grpcUrls": [
Expand Down
2 changes: 1 addition & 1 deletion typescript/infra/config/environments/mainnet3/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const hyperlaneContextAgentChainConfig: AgentChainConfig = {
[Chains.ethereum]: true,
// At the moment, we only relay between Neutron and Manta Pacific on the neutron context.
[Chains.neutron]: false,
[Chains.mantapacific]: false,
[Chains.mantapacific]: true,
[Chains.mode]: true,
[Chains.moonbeam]: true,
[Chains.optimism]: true,
Expand Down
1,012 changes: 915 additions & 97 deletions typescript/infra/config/environments/mainnet3/core/verification.json

Large diffs are not rendered by default.

40 changes: 0 additions & 40 deletions typescript/infra/config/environments/mainnet3/gas-oracle.ts

This file was deleted.

100 changes: 80 additions & 20 deletions typescript/infra/config/environments/mainnet3/gasPrices.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,82 @@
{
"ancient8": "1",
"arbitrum": "0.1",
"avalanche": "43.212830197",
"blast": "0.1",
"bsc": "1.350070319",
"celo": "10.0",
"ethereum": "26.346912847",
"mantapacific": "0.100000057",
"mode": "0.1",
"moonbeam": "125.0",
"optimism": "0.003225814",
"polygon": "61.601287856",
"gnosis": "1.852997796",
"base": "0.0010003",
"scroll": "0.46",
"polygonzkevm": "3.95",
"inevm": "0.1",
"viction": "0.25",
"neutron": "0.1",
"injective": "0.1"
"arbitrum": {
"amount": "0.01",
"decimals": 9
},
"ancient8": {
"amount": "0.001000252",
"decimals": 9
},
"avalanche": {
"amount": "43.212830197",
"decimals": 9
},
"base": {
"amount": "0.116871685",
"decimals": 9
},
"blast": {
"amount": "0.1",
"decimals": 9
},
"bsc": {
"amount": "5.0",
"decimals": 9
},
"celo": {
"amount": "10.0",
"decimals": 9
},
"ethereum": {
"amount": "26.346912847",
"decimals": 9
},
"mantapacific": {
"amount": "0.100163166",
"decimals": 9
},
"mode": {
"amount": "0.1",
"decimals": 9
},
"moonbeam": {
"amount": "125.0",
"decimals": 9
},
"optimism": {
"amount": "0.061126811",
"decimals": 9
},
"polygon": {
"amount": "101.76455238",
"decimals": 9
},
"gnosis": {
"amount": "3.236596353",
"decimals": 9
},
"scroll": {
"amount": "1.3231",
"decimals": 9
},
"polygonzkevm": {
"amount": "3.95",
"decimals": 9
},
"inevm": {
"amount": "0.1",
"decimals": 9
},
"viction": {
"amount": "0.25",
"decimals": 9
},
"neutron": {
"amount": "0.0053",
"decimals": 1
},
"injective": {
"amount": "700000000",
"decimals": 1
}
}
38 changes: 37 additions & 1 deletion typescript/infra/config/environments/mainnet3/igp.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
import { BigNumber, ethers } from 'ethers';

import {
ChainMap,
ChainName,
IgpConfig,
TOKEN_EXCHANGE_RATE_DECIMALS,
defaultMultisigConfigs,
multisigIsmVerificationCost,
} from '@hyperlane-xyz/sdk';
import { exclude, objMap } from '@hyperlane-xyz/utils';

import {
AllStorageGasOracleConfigs,
getAllStorageGasOracleConfigs,
getTokenExchangeRateFromValues,
} from '../../../src/config/gas-oracle.js';

import {
MainnetChains,
ethereumChainNames,
supportedChainNames,
} from './chains.js';
import { storageGasOracleConfig } from './gas-oracle.js';
import gasPrices from './gasPrices.json';
import { DEPLOYER, owners } from './owners.js';
import rawTokenPrices from './tokenPrices.json';

const tokenPrices: ChainMap<string> = rawTokenPrices;

const FOREIGN_DEFAULT_OVERHEAD = 600_000; // cosmwasm warp route somewhat arbitrarily chosen

Expand All @@ -24,6 +37,29 @@ const remoteOverhead = (remote: MainnetChains) =>
)
: FOREIGN_DEFAULT_OVERHEAD; // non-ethereum overhead

// Gets the exchange rate of the remote quoted in local tokens
function getTokenExchangeRate(local: ChainName, remote: ChainName): BigNumber {
const localValue = ethers.utils.parseUnits(
tokenPrices[local],
TOKEN_EXCHANGE_RATE_DECIMALS,
);
const remoteValue = ethers.utils.parseUnits(
tokenPrices[remote],
TOKEN_EXCHANGE_RATE_DECIMALS,
);

return getTokenExchangeRateFromValues(local, localValue, remote, remoteValue);
}

const storageGasOracleConfig: AllStorageGasOracleConfigs =
getAllStorageGasOracleConfigs(
supportedChainNames,
gasPrices,
getTokenExchangeRate,
(local) => parseFloat(tokenPrices[local]),
(local) => remoteOverhead(local as MainnetChains),
);

export const igp: ChainMap<IgpConfig> = objMap(owners, (local, owner) => ({
...owner,
ownerOverrides: {
Expand Down
13 changes: 7 additions & 6 deletions typescript/infra/config/environments/mainnet3/owners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,13 @@ export const owners: ChainMap<OwnableConfig> = Object.fromEntries(
ethereumChainNames.map((local) => [
local,
{
owner: safes[local] ?? DEPLOYER,
ownerOverrides: {
proxyAdmin: timelocks[local] ?? safes[local] ?? DEPLOYER,
validatorAnnounce: DEPLOYER, // unused
testRecipient: DEPLOYER,
},
owner: DEPLOYER,
// owner: safes[local] ?? DEPLOYER,
// ownerOverrides: {
// proxyAdmin: timelocks[local] ?? safes[local] ?? DEPLOYER,
// validatorAnnounce: DEPLOYER, // unused
// testRecipient: DEPLOYER,
// },
},
]),
);
40 changes: 20 additions & 20 deletions typescript/infra/config/environments/mainnet3/tokenPrices.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"ancient8": "2914.61",
"arbitrum": "2914.61",
"avalanche": "35.71",
"bsc": "373.19",
"blast": "2914.61",
"celo": "0.772619",
"ethereum": "2914.61",
"mantapacific": "2914.61",
"mode": "2914.61",
"moonbeam": "0.419658",
"optimism": "2914.61",
"polygon": "0.982687",
"gnosis": "1.012",
"base": "2914.61",
"scroll": "2914.61",
"polygonzkevm": "2914.61",
"inevm": "32.77",
"viction": "0.750231",
"neutron": "1.76",
"injective": "32.77"
"arbitrum": "3174.87",
"ancient8": "3174.87",
"avalanche": "38.39",
"base": "3174.87",
"blast": "3174.87",
"bsc": "609.32",
"celo": "0.860923",
"ethereum": "3174.87",
"mantapacific": "3174.87",
"mode": "3174.87",
"moonbeam": "0.338118",
"optimism": "3174.87",
"polygon": "0.730041",
"gnosis": "0.993981",
"scroll": "3174.87",
"polygonzkevm": "3174.87",
"inevm": "28.12",
"viction": "0.775722",
"neutron": "0.842639",
"injective": "28.12"
}
21 changes: 14 additions & 7 deletions typescript/infra/config/environments/test/gas-oracle.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import { BigNumber, ethers } from 'ethers';

import { ChainMap, ChainName } from '@hyperlane-xyz/sdk';
import {
ChainMap,
ChainName,
TOKEN_EXCHANGE_RATE_DECIMALS,
} from '@hyperlane-xyz/sdk';

import {
AllStorageGasOracleConfigs,
TOKEN_EXCHANGE_RATE_DECIMALS,
GasPriceConfig,
getAllStorageGasOracleConfigs,
} from '../../../src/config/gas-oracle.js';

Expand All @@ -14,12 +18,15 @@ const TEST_TOKEN_EXCHANGE_RATE = ethers.utils.parseUnits(
'1',
TOKEN_EXCHANGE_RATE_DECIMALS,
);
const TEST_GAS_PRICE = ethers.utils.parseUnits('2', 'gwei');
const TEST_GAS_PRICE_CONFIG: GasPriceConfig = {
amount: '2',
decimals: 9, // gwei
};

const gasPrices: ChainMap<BigNumber> = {
test1: TEST_GAS_PRICE,
test2: TEST_GAS_PRICE,
test3: TEST_GAS_PRICE,
const gasPrices: ChainMap<GasPriceConfig> = {
test1: TEST_GAS_PRICE_CONFIG,
test2: TEST_GAS_PRICE_CONFIG,
test3: TEST_GAS_PRICE_CONFIG,
};

function getTokenExchangeRate(
Expand Down
13 changes: 10 additions & 3 deletions typescript/infra/config/environments/testnet4/gas-oracle.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import { BigNumber, ethers } from 'ethers';

import { ChainMap, ChainName } from '@hyperlane-xyz/sdk';
import {
ChainMap,
ChainName,
TOKEN_EXCHANGE_RATE_DECIMALS,
} from '@hyperlane-xyz/sdk';
import { objMap } from '@hyperlane-xyz/utils';

import {
AllStorageGasOracleConfigs,
TOKEN_EXCHANGE_RATE_DECIMALS,
getAllStorageGasOracleConfigs,
getTokenExchangeRateFromValues,
} from '../../../src/config/gas-oracle.js';
Expand Down Expand Up @@ -69,6 +73,9 @@ function getTokenExchangeRate(local: ChainName, remote: ChainName): BigNumber {
export const storageGasOracleConfig: AllStorageGasOracleConfigs =
getAllStorageGasOracleConfigs(
supportedChainNames,
gasPrices,
objMap(gasPrices, (_, gasPrice) => ({
amount: gasPrice.toString(),
decimals: 1,
})),
getTokenExchangeRate,
);
Loading

0 comments on commit ed01d43

Please sign in to comment.