Add deployment files of optimism goerli + fix bugs (#364)

This commit is contained in:
Ali Behjati 2022-10-27 20:01:14 +02:00 committed by GitHub
parent 044a867e11
commit a9a1fb7b5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 8518 additions and 1676 deletions

View File

@ -1,4 +1,3 @@
WORMHOLE_BRIDGE_ADDRESS=0xa5f208e072434bC67592E4C49C1B991BA79BCA46
SOLANA_CHAIN_ID=0x1
SOLANA_EMITTER=0x6bb14509a612f01fbbc4cffeebd4bbfb492a86df717ebe92eb6df432a3f00a25
PYTHNET_CHAIN_ID=0x1a

View File

@ -1,4 +1,3 @@
WORMHOLE_BRIDGE_ADDRESS=0xBd07292de7b505a4E803CEe286184f7Acf908F5e
SOLANA_CHAIN_ID=0x1
SOLANA_EMITTER=0xf346195ac02f37d60d4db8ffa6ef74cb1be3550047543a4a9ee9acf4d78697b0
PYTHNET_CHAIN_ID=0x1a

View File

@ -0,0 +1,7 @@
# Mumbai is Polygon testnet network
MIGRATIONS_DIR=./migrations/prod
MIGRATIONS_NETWORK=optimism_goerli
WORMHOLE_CHAIN_NAME=optimism
CLUSTER=testnet
VALID_TIME_PERIOD_SECONDS=60

View File

@ -13,7 +13,6 @@ WORMHOLE_CHAIN_NAME= # ethereum, defined in https://github.com/wormhole-foundati
CLUSTER= #mainnet/testnet The configs below are read from the cluster file
# Pyth Migrations # Example Format. If deployed on mainnet/testnet it is available in env.cluster.{cluster}
WORMHOLE_BRIDGE_ADDRESS # 0x68605AD7b15c732a30b1BbC62BE8F2A509D74b4D (only if wormhole exists)
SOLANA_CHAIN_ID= # 0x1
SOLANA_EMITTER= # 0xf346195ac02f37d60d4db8ffa6ef74cb1be3550047543a4a9ee9acf4d78697b0
PYTHNET_CHAIN_ID= # 0x1a

View File

@ -0,0 +1,237 @@
{
"manifestVersion": "3.2",
"proxies": [
{
"address": "0xff1a0f4744e8582DF1aE09D5611b887B6a12925C",
"txHash": "0x89c663594a3d7468ab799b75b6424586c6bc150720584a952d8610165ba6c302",
"kind": "uups"
}
],
"impls": {
"4668cc132635455aee5bae29a5a10e6705f120d1a86872391fd048b22c3f4c1e": {
"address": "0xB2eeb93D778c364E7E2274D6299e2aa0c2Bea090",
"txHash": "0x7231242ffd6a4bc25e06cfc3656353f80e75d4a0af21401856df83c731493def",
"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)5213_storage",
"src": "../project:/contracts/pyth/PythState.sol:50"
}
],
"types": {
"t_struct(State)5213_storage": {
"label": "struct PythStorage.State",
"members": [
{
"label": "wormhole",
"type": "t_address"
},
{
"label": "_deprecatedPyth2WormholeChainId",
"type": "t_uint16"
},
{
"label": "_deprecatedPyth2WormholeEmitter",
"type": "t_bytes32"
},
{
"label": "_deprecatedLatestPriceInfo",
"type": "t_mapping(t_bytes32,t_struct(PriceInfo)5039_storage)"
},
{
"label": "validDataSources",
"type": "t_array(t_struct(DataSource)5044_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)5044_storage"
},
{
"label": "lastExecutedGovernanceSequence",
"type": "t_uint64"
},
{
"label": "latestPriceInfo",
"type": "t_mapping(t_bytes32,t_struct(PriceInfo)5039_storage)"
},
{
"label": "governanceDataSourceIndex",
"type": "t_uint32"
}
]
},
"t_address": {
"label": "address"
},
"t_uint16": {
"label": "uint16"
},
"t_bytes32": {
"label": "bytes32"
},
"t_mapping(t_bytes32,t_struct(PriceInfo)5039_storage)": {
"label": "mapping(bytes32 => struct PythInternalStructs.PriceInfo)"
},
"t_struct(PriceInfo)5039_storage": {
"label": "struct PythInternalStructs.PriceInfo",
"members": [
{
"label": "attestationTime",
"type": "t_uint256"
},
{
"label": "arrivalTime",
"type": "t_uint256"
},
{
"label": "arrivalBlock",
"type": "t_uint256"
},
{
"label": "priceFeed",
"type": "t_struct(PriceFeed)2424_storage"
}
]
},
"t_array(t_struct(DataSource)5044_storage)dyn_storage": {
"label": "struct PythInternalStructs.DataSource[]"
},
"t_struct(DataSource)5044_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_uint32": {
"label": "uint32"
},
"t_struct(PriceFeed)2424_storage": {
"label": "struct PythStructs.PriceFeed",
"members": [
{
"label": "id",
"type": "t_bytes32"
},
{
"label": "price",
"type": "t_struct(Price)2415_storage"
},
{
"label": "emaPrice",
"type": "t_struct(Price)2415_storage"
}
]
},
"t_struct(Price)2415_storage": {
"label": "struct PythStructs.Price",
"members": [
{
"label": "price",
"type": "t_int64"
},
{
"label": "conf",
"type": "t_uint64"
},
{
"label": "expo",
"type": "t_int32"
},
{
"label": "publishTime",
"type": "t_uint256"
}
]
},
"t_int64": {
"label": "int64"
},
"t_int32": {
"label": "int32"
},
"t_array(t_uint256)50_storage": {
"label": "uint256[50]"
},
"t_array(t_uint256)49_storage": {
"label": "uint256[49]"
}
}
}
}
}
}

View File

@ -6,7 +6,7 @@ const governance = require("@pythnetwork/xc-governance-sdk");
const PythUpgradable = artifacts.require("PythUpgradable");
const wormholeChainName = process.env.WORMHOLE_CHAIN_NAME;
const { deployProxyImpl } = require('@openzeppelin/truffle-upgrades/dist/utils');
const { upgradeProxy } = require("@openzeppelin/truffle-upgrades");
const { assert } = require('chai');
/**

View File

@ -1,4 +1,3 @@
const { assert } = require("chai");
const governance = require("@pythnetwork/xc-governance-sdk");
const assertVaaPayloadEquals = require("../../scripts/assertVaaPayloadEquals");
const { assert } = require("chai");

View File

@ -3,18 +3,28 @@ loadEnv("../../");
const PythUpgradable = artifacts.require("PythUpgradable");
const wormholeBridgeAddress = process.env.WORMHOLE_BRIDGE_ADDRESS;
const pyth2WormholeChainId = process.env.SOLANA_CHAIN_ID;
const pyth2WormholeEmitter = process.env.SOLANA_EMITTER;
const { deployProxy } = require("@openzeppelin/truffle-upgrades");
const tdr = require('truffle-deploy-registry');
const { CONTRACTS } = require('@certusone/wormhole-sdk');
const { assert } = require("chai");
console.log("Wormhole bridge address: " + wormholeBridgeAddress)
console.log("pyth2WormholeEmitter: " + pyth2WormholeEmitter)
console.log("pyth2WormholeChainId: " + pyth2WormholeChainId)
module.exports = async function (deployer, network) {
const cluster = process.env.CLUSTER;
const chainName = process.env.WORMHOLE_CHAIN_NAME;
assert(cluster !== undefined && chainName !== undefined);
const wormholeBridgeAddress = CONTRACTS[cluster.toUpperCase()][chainName].core;
assert(wormholeBridgeAddress !== undefined);
console.log("Wormhole bridge address: " + wormholeBridgeAddress)
// Deploy the proxy. This will return an instance of PythUpgradable,
// with the address field corresponding to the fronting ERC1967Proxy.
let proxyInstance = await deployProxy(PythUpgradable,

View File

@ -1,10 +1,6 @@
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
if (process.env.CLUSTER !== undefined) {
dotenv.config({ path: `../../.env.cluster.${process.env.CLUSTER}`});
}
const PythUpgradable = artifacts.require("PythUpgradable");
const { upgradeProxy } = require("@openzeppelin/truffle-upgrades");

View File

@ -1,10 +1,6 @@
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
if (process.env.CLUSTER !== undefined) {
dotenv.config({ path: `../../.env.cluster.${process.env.CLUSTER}`});
}
const PythUpgradable = artifacts.require("PythUpgradable");
const { upgradeProxy } = require("@openzeppelin/truffle-upgrades");

View File

@ -0,0 +1,11 @@
[
{
"contractName": "Migrations",
"address": "0x1c6Cd107fB71768FBc46F8B6180Eec155C03eEb5"
},
{
"contractName": "PythUpgradable",
"address": "0xff1a0f4744e8582DF1aE09D5611b887B6a12925C",
"transactionHash": "0x89c663594a3d7468ab799b75b6424586c6bc150720584a952d8610165ba6c302"
}
]

File diff suppressed because it is too large Load Diff

View File

@ -28,6 +28,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@certusone/wormhole-sdk": "^0.8.0",
"@certusone/wormhole-sdk-wasm": "^0.0.1",
"@openzeppelin/contracts": "^4.5.0",
"@openzeppelin/contracts-upgradeable": "^4.5.2",
@ -35,6 +36,7 @@
"@pythnetwork/xc-governance-sdk": "file:../third_party/pyth/xc-governance-sdk-js",
"dotenv": "^10.0.0",
"elliptic": "^6.5.2",
"ethers": "^5.6.8",
"ganache-cli": "^6.12.1",
"jsonfile": "^4.0.0",
"solc": "^0.8.4",

View File

@ -172,6 +172,15 @@ module.exports = {
},
network_id: 10,
},
optimism_goerli: {
provider: () => {
return new HDWalletProvider(
process.env.MNEMONIC,
"https://opt-goerli.g.alchemy.com/v2/demo"
);
},
network_id: 420,
},
fantom: {
provider: () => {
return new HDWalletProvider(