Explorar el Código

[eth] Deploy to arbitrum-testnet (#436)

* add arbitrum-testnet contract

* Fix format issues

Co-authored-by: Ali Behjati <bahjatia@gmail.com>
Daniel Chew hace 2 años
padre
commit
2efd512d36

+ 5 - 0
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

+ 367 - 0
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]"
+          }
+        }
+      }
+    }
+  }
+}

+ 2 - 1
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.
 

+ 1 - 1
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
 ```
 

+ 16 - 0
ethereum/networks/421613.json

@@ -0,0 +1,16 @@
+[
+  {
+    "contractName": "Migrations",
+    "address": "0x1c6Cd107fB71768FBc46F8B6180Eec155C03eEb5"
+  },
+  {
+    "contractName": "PythUpgradable",
+    "address": "0xff1a0f4744e8582DF1aE09D5611b887B6a12925C",
+    "transactionHash": "0x6607a105ce4026177c4a2876df0d5965c895b4664be76733e2c791e323aafd0e"
+  },
+  {
+    "contractName": "PythUpgradable",
+    "address": "0x939C0e902FF5B3F7BA666Cc8F6aC75EE76d3f900",
+    "transactionHash": "0x6524ab2ded6d40c74fd5a008a84813c196325a2baca64bcb989528acef499b31"
+  }
+]

+ 9 - 0
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(