From 2efd512d3626a4b2ac9706fccea21b110ba4ffa5 Mon Sep 17 00:00:00 2001 From: Daniel Chew Date: Wed, 21 Dec 2022 02:02:59 +0800 Subject: [PATCH] [eth] Deploy to arbitrum-testnet (#436) * add arbitrum-testnet contract * Fix format issues Co-authored-by: Ali Behjati --- ethereum/.env.prod.arbitrum_testnet | 5 + ethereum/.openzeppelin/unknown-421613.json | 367 +++++++++++++++++++++ ethereum/Deploying.md | 3 +- ethereum/README.md | 2 +- ethereum/networks/421613.json | 16 + ethereum/truffle-config.js | 9 + 6 files changed, 400 insertions(+), 2 deletions(-) create mode 100644 ethereum/.env.prod.arbitrum_testnet create mode 100644 ethereum/.openzeppelin/unknown-421613.json create mode 100644 ethereum/networks/421613.json diff --git a/ethereum/.env.prod.arbitrum_testnet b/ethereum/.env.prod.arbitrum_testnet new file mode 100644 index 00000000..7eb49431 --- /dev/null +++ b/ethereum/.env.prod.arbitrum_testnet @@ -0,0 +1,5 @@ +MIGRATIONS_DIR=./migrations/prod +MIGRATIONS_NETWORK=arbitrum_testnet +WORMHOLE_CHAIN_NAME=arbitrum +CLUSTER=testnet +VALID_TIME_PERIOD_SECONDS=60 diff --git a/ethereum/.openzeppelin/unknown-421613.json b/ethereum/.openzeppelin/unknown-421613.json new file mode 100644 index 00000000..ed598a72 --- /dev/null +++ b/ethereum/.openzeppelin/unknown-421613.json @@ -0,0 +1,367 @@ +{ + "manifestVersion": "3.2", + "proxies": [ + { + "address": "0xff1a0f4744e8582DF1aE09D5611b887B6a12925C", + "txHash": "0x6607a105ce4026177c4a2876df0d5965c895b4664be76733e2c791e323aafd0e", + "kind": "uups" + }, + { + "address": "0x939C0e902FF5B3F7BA666Cc8F6aC75EE76d3f900", + "txHash": "0x6524ab2ded6d40c74fd5a008a84813c196325a2baca64bcb989528acef499b31", + "kind": "uups" + } + ], + "impls": { + "fd85319df5664c4344cfee5e5680ccc4a692989c690fefaf0d6f65f782b5459f": { + "address": "0xB2eeb93D778c364E7E2274D6299e2aa0c2Bea090", + "txHash": "0x768858ddc4ac5c791413d202ba10e91c0c83625457528bb59dc4df82b3e1260a", + "layout": { + "storage": [ + { + "contract": "Initializable", + "label": "_initialized", + "type": "t_bool", + "src": "../@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:39" + }, + { + "contract": "Initializable", + "label": "_initializing", + "type": "t_bool", + "src": "../@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:44" + }, + { + "contract": "ContextUpgradeable", + "label": "__gap", + "type": "t_array(t_uint256)50_storage", + "src": "../@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36" + }, + { + "contract": "OwnableUpgradeable", + "label": "_owner", + "type": "t_address", + "src": "../@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22" + }, + { + "contract": "OwnableUpgradeable", + "label": "__gap", + "type": "t_array(t_uint256)49_storage", + "src": "../@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:87" + }, + { + "contract": "ERC1967UpgradeUpgradeable", + "label": "__gap", + "type": "t_array(t_uint256)50_storage", + "src": "../@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol:211" + }, + { + "contract": "UUPSUpgradeable", + "label": "__gap", + "type": "t_array(t_uint256)50_storage", + "src": "../@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol:107" + }, + { + "contract": "PythState", + "label": "_state", + "type": "t_struct(State)5849_storage", + "src": "../project:/contracts/pyth/PythState.sol:45" + } + ], + "types": { + "t_struct(State)5849_storage": { + "label": "struct PythStorage.State", + "members": [ + { + "label": "wormhole", + "type": "t_address" + }, + { + "label": "_deprecatedPyth2WormholeChainId", + "type": "t_uint16" + }, + { + "label": "_deprecatedPyth2WormholeEmitter", + "type": "t_bytes32" + }, + { + "label": "_deprecatedLatestPriceInfoV1", + "type": "t_mapping(t_bytes32,t_struct(DeprecatedPriceInfoV1)4485_storage)" + }, + { + "label": "validDataSources", + "type": "t_array(t_struct(DataSource)5703_storage)dyn_storage" + }, + { + "label": "isValidDataSource", + "type": "t_mapping(t_bytes32,t_bool)" + }, + { + "label": "singleUpdateFeeInWei", + "type": "t_uint256" + }, + { + "label": "validTimePeriodSeconds", + "type": "t_uint256" + }, + { + "label": "governanceDataSource", + "type": "t_struct(DataSource)5703_storage" + }, + { + "label": "lastExecutedGovernanceSequence", + "type": "t_uint64" + }, + { + "label": "_deprecatedLatestPriceInfoV2", + "type": "t_mapping(t_bytes32,t_struct(DeprecatedPriceInfoV2)4513_storage)" + }, + { + "label": "governanceDataSourceIndex", + "type": "t_uint32" + }, + { + "label": "latestPriceInfo", + "type": "t_mapping(t_bytes32,t_struct(PriceInfo)5698_storage)" + } + ] + }, + "t_address": { + "label": "address" + }, + "t_uint16": { + "label": "uint16" + }, + "t_bytes32": { + "label": "bytes32" + }, + "t_mapping(t_bytes32,t_struct(DeprecatedPriceInfoV1)4485_storage)": { + "label": "mapping(bytes32 => struct PythDeprecatedStructs.DeprecatedPriceInfoV1)" + }, + "t_struct(DeprecatedPriceInfoV1)4485_storage": { + "label": "struct PythDeprecatedStructs.DeprecatedPriceInfoV1", + "members": [ + { + "label": "attestationTime", + "type": "t_uint256" + }, + { + "label": "arrivalTime", + "type": "t_uint256" + }, + { + "label": "arrivalBlock", + "type": "t_uint256" + }, + { + "label": "priceFeed", + "type": "t_struct(DeprecatedPriceFeedV1)4475_storage" + } + ] + }, + "t_array(t_struct(DataSource)5703_storage)dyn_storage": { + "label": "struct PythInternalStructs.DataSource[]" + }, + "t_struct(DataSource)5703_storage": { + "label": "struct PythInternalStructs.DataSource", + "members": [ + { + "label": "chainId", + "type": "t_uint16" + }, + { + "label": "emitterAddress", + "type": "t_bytes32" + } + ] + }, + "t_mapping(t_bytes32,t_bool)": { + "label": "mapping(bytes32 => bool)" + }, + "t_bool": { + "label": "bool" + }, + "t_uint256": { + "label": "uint256" + }, + "t_uint64": { + "label": "uint64" + }, + "t_mapping(t_bytes32,t_struct(DeprecatedPriceInfoV2)4513_storage)": { + "label": "mapping(bytes32 => struct PythDeprecatedStructs.DeprecatedPriceInfoV2)" + }, + "t_struct(DeprecatedPriceInfoV2)4513_storage": { + "label": "struct PythDeprecatedStructs.DeprecatedPriceInfoV2", + "members": [ + { + "label": "attestationTime", + "type": "t_uint256" + }, + { + "label": "arrivalTime", + "type": "t_uint256" + }, + { + "label": "arrivalBlock", + "type": "t_uint256" + }, + { + "label": "priceFeed", + "type": "t_struct(DeprecatedPriceFeedV2)4503_storage" + } + ] + }, + "t_uint32": { + "label": "uint32" + }, + "t_mapping(t_bytes32,t_struct(PriceInfo)5698_storage)": { + "label": "mapping(bytes32 => struct PythInternalStructs.PriceInfo)" + }, + "t_struct(PriceInfo)5698_storage": { + "label": "struct PythInternalStructs.PriceInfo", + "members": [ + { + "label": "publishTime", + "type": "t_uint64" + }, + { + "label": "expo", + "type": "t_int32" + }, + { + "label": "price", + "type": "t_int64" + }, + { + "label": "conf", + "type": "t_uint64" + }, + { + "label": "emaPrice", + "type": "t_int64" + }, + { + "label": "emaConf", + "type": "t_uint64" + } + ] + }, + "t_struct(DeprecatedPriceFeedV1)4475_storage": { + "label": "struct PythDeprecatedStructs.DeprecatedPriceFeedV1", + "members": [ + { + "label": "id", + "type": "t_bytes32" + }, + { + "label": "productId", + "type": "t_bytes32" + }, + { + "label": "price", + "type": "t_int64" + }, + { + "label": "conf", + "type": "t_uint64" + }, + { + "label": "expo", + "type": "t_int32" + }, + { + "label": "status", + "type": "t_enum(DeprecatedPriceStatusV1)4445" + }, + { + "label": "maxNumPublishers", + "type": "t_uint32" + }, + { + "label": "numPublishers", + "type": "t_uint32" + }, + { + "label": "emaPrice", + "type": "t_int64" + }, + { + "label": "emaConf", + "type": "t_uint64" + }, + { + "label": "publishTime", + "type": "t_uint64" + }, + { + "label": "prevPrice", + "type": "t_int64" + }, + { + "label": "prevConf", + "type": "t_uint64" + }, + { + "label": "prevPublishTime", + "type": "t_uint64" + } + ] + }, + "t_struct(DeprecatedPriceFeedV2)4503_storage": { + "label": "struct PythDeprecatedStructs.DeprecatedPriceFeedV2", + "members": [ + { + "label": "id", + "type": "t_bytes32" + }, + { + "label": "price", + "type": "t_struct(DeprecatedPriceV2)4494_storage" + }, + { + "label": "emaPrice", + "type": "t_struct(DeprecatedPriceV2)4494_storage" + } + ] + }, + "t_int32": { + "label": "int32" + }, + "t_int64": { + "label": "int64" + }, + "t_enum(DeprecatedPriceStatusV1)4445": { + "label": "enum PythDeprecatedStructs.DeprecatedPriceStatusV1", + "members": ["UNKNOWN", "TRADING", "HALTED", "AUCTION"] + }, + "t_struct(DeprecatedPriceV2)4494_storage": { + "label": "struct PythDeprecatedStructs.DeprecatedPriceV2", + "members": [ + { + "label": "price", + "type": "t_int64" + }, + { + "label": "conf", + "type": "t_uint64" + }, + { + "label": "expo", + "type": "t_int32" + }, + { + "label": "publishTime", + "type": "t_uint256" + } + ] + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]" + } + } + } + } + } +} diff --git a/ethereum/Deploying.md b/ethereum/Deploying.md index dd12131c..3fb5c8ea 100644 --- a/ethereum/Deploying.md +++ b/ethereum/Deploying.md @@ -10,7 +10,8 @@ This is the deployment process: # 2. Export the secret recovery phrase for the deployment account. export MNEMONIC=$(cat path/to/mnemonic) -# 3. Make sure that third_party/pyth/multisig-wh-message-builder/keys/key.json + +# 3. If you are modifying an existing contract, make sure that third_party/pyth/multisig-wh-message-builder/keys/key.json # has the proper operational key for interacting with the multisig. Please follow # the corresponding notion doc for more information about the keys. diff --git a/ethereum/README.md b/ethereum/README.md index 181e1c42..a22c2547 100644 --- a/ethereum/README.md +++ b/ethereum/README.md @@ -10,7 +10,7 @@ Run the following command to install required dependencies for the contract: # xc-governance-sdk-js is a local dependency that should be built # it is used in deployment (truffle migrations) to generate/sanity check # the governance VAAs -pushd third_party/pyth/xc-governance-sdk-js && npm ci && popd +pushd ../third_party/pyth/xc-governance-sdk-js && npm ci && popd npm ci ``` diff --git a/ethereum/networks/421613.json b/ethereum/networks/421613.json new file mode 100644 index 00000000..91e71fcb --- /dev/null +++ b/ethereum/networks/421613.json @@ -0,0 +1,16 @@ +[ + { + "contractName": "Migrations", + "address": "0x1c6Cd107fB71768FBc46F8B6180Eec155C03eEb5" + }, + { + "contractName": "PythUpgradable", + "address": "0xff1a0f4744e8582DF1aE09D5611b887B6a12925C", + "transactionHash": "0x6607a105ce4026177c4a2876df0d5965c895b4664be76733e2c791e323aafd0e" + }, + { + "contractName": "PythUpgradable", + "address": "0x939C0e902FF5B3F7BA666Cc8F6aC75EE76d3f900", + "transactionHash": "0x6524ab2ded6d40c74fd5a008a84813c196325a2baca64bcb989528acef499b31" + } +] diff --git a/ethereum/truffle-config.js b/ethereum/truffle-config.js index eeb647dc..e47fa71c 100644 --- a/ethereum/truffle-config.js +++ b/ethereum/truffle-config.js @@ -166,6 +166,15 @@ module.exports = { }, network_id: 42161, }, + arbitrum_testnet: { + provider: () => { + return new HDWalletProvider( + process.env.MNEMONIC, + "https://goerli-rollup.arbitrum.io/rpc" + ); + }, + network_id: 421613, + }, optimism: { provider: () => { return new HDWalletProvider(