Skip to content

Commit a9a1fb7

Browse files
authored
Add deployment files of optimism goerli + fix bugs (#364)
1 parent 044a867 commit a9a1fb7

14 files changed

+8530
-1688
lines changed

ethereum/.env.cluster.mainnet

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
WORMHOLE_BRIDGE_ADDRESS=0xa5f208e072434bC67592E4C49C1B991BA79BCA46
21
SOLANA_CHAIN_ID=0x1
32
SOLANA_EMITTER=0x6bb14509a612f01fbbc4cffeebd4bbfb492a86df717ebe92eb6df432a3f00a25
43
PYTHNET_CHAIN_ID=0x1a

ethereum/.env.cluster.testnet

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
WORMHOLE_BRIDGE_ADDRESS=0xBd07292de7b505a4E803CEe286184f7Acf908F5e
21
SOLANA_CHAIN_ID=0x1
32
SOLANA_EMITTER=0xf346195ac02f37d60d4db8ffa6ef74cb1be3550047543a4a9ee9acf4d78697b0
43
PYTHNET_CHAIN_ID=0x1a

ethereum/.env.prod.optimism_goerli

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Mumbai is Polygon testnet network
2+
3+
MIGRATIONS_DIR=./migrations/prod
4+
MIGRATIONS_NETWORK=optimism_goerli
5+
WORMHOLE_CHAIN_NAME=optimism
6+
CLUSTER=testnet
7+
VALID_TIME_PERIOD_SECONDS=60

ethereum/.env.template

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ WORMHOLE_CHAIN_NAME= # ethereum, defined in https://github.com/wormhole-foundati
1313
CLUSTER= #mainnet/testnet The configs below are read from the cluster file
1414

1515
# Pyth Migrations # Example Format. If deployed on mainnet/testnet it is available in env.cluster.{cluster}
16-
WORMHOLE_BRIDGE_ADDRESS # 0x68605AD7b15c732a30b1BbC62BE8F2A509D74b4D (only if wormhole exists)
1716
SOLANA_CHAIN_ID= # 0x1
1817
SOLANA_EMITTER= # 0xf346195ac02f37d60d4db8ffa6ef74cb1be3550047543a4a9ee9acf4d78697b0
1918
PYTHNET_CHAIN_ID= # 0x1a
Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
{
2+
"manifestVersion": "3.2",
3+
"proxies": [
4+
{
5+
"address": "0xff1a0f4744e8582DF1aE09D5611b887B6a12925C",
6+
"txHash": "0x89c663594a3d7468ab799b75b6424586c6bc150720584a952d8610165ba6c302",
7+
"kind": "uups"
8+
}
9+
],
10+
"impls": {
11+
"4668cc132635455aee5bae29a5a10e6705f120d1a86872391fd048b22c3f4c1e": {
12+
"address": "0xB2eeb93D778c364E7E2274D6299e2aa0c2Bea090",
13+
"txHash": "0x7231242ffd6a4bc25e06cfc3656353f80e75d4a0af21401856df83c731493def",
14+
"layout": {
15+
"storage": [
16+
{
17+
"contract": "Initializable",
18+
"label": "_initialized",
19+
"type": "t_bool",
20+
"src": "../@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:39"
21+
},
22+
{
23+
"contract": "Initializable",
24+
"label": "_initializing",
25+
"type": "t_bool",
26+
"src": "../@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:44"
27+
},
28+
{
29+
"contract": "ContextUpgradeable",
30+
"label": "__gap",
31+
"type": "t_array(t_uint256)50_storage",
32+
"src": "../@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36"
33+
},
34+
{
35+
"contract": "OwnableUpgradeable",
36+
"label": "_owner",
37+
"type": "t_address",
38+
"src": "../@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22"
39+
},
40+
{
41+
"contract": "OwnableUpgradeable",
42+
"label": "__gap",
43+
"type": "t_array(t_uint256)49_storage",
44+
"src": "../@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:87"
45+
},
46+
{
47+
"contract": "ERC1967UpgradeUpgradeable",
48+
"label": "__gap",
49+
"type": "t_array(t_uint256)50_storage",
50+
"src": "../@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol:211"
51+
},
52+
{
53+
"contract": "UUPSUpgradeable",
54+
"label": "__gap",
55+
"type": "t_array(t_uint256)50_storage",
56+
"src": "../@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol:107"
57+
},
58+
{
59+
"contract": "PythState",
60+
"label": "_state",
61+
"type": "t_struct(State)5213_storage",
62+
"src": "../project:/contracts/pyth/PythState.sol:50"
63+
}
64+
],
65+
"types": {
66+
"t_struct(State)5213_storage": {
67+
"label": "struct PythStorage.State",
68+
"members": [
69+
{
70+
"label": "wormhole",
71+
"type": "t_address"
72+
},
73+
{
74+
"label": "_deprecatedPyth2WormholeChainId",
75+
"type": "t_uint16"
76+
},
77+
{
78+
"label": "_deprecatedPyth2WormholeEmitter",
79+
"type": "t_bytes32"
80+
},
81+
{
82+
"label": "_deprecatedLatestPriceInfo",
83+
"type": "t_mapping(t_bytes32,t_struct(PriceInfo)5039_storage)"
84+
},
85+
{
86+
"label": "validDataSources",
87+
"type": "t_array(t_struct(DataSource)5044_storage)dyn_storage"
88+
},
89+
{
90+
"label": "isValidDataSource",
91+
"type": "t_mapping(t_bytes32,t_bool)"
92+
},
93+
{
94+
"label": "singleUpdateFeeInWei",
95+
"type": "t_uint256"
96+
},
97+
{
98+
"label": "validTimePeriodSeconds",
99+
"type": "t_uint256"
100+
},
101+
{
102+
"label": "governanceDataSource",
103+
"type": "t_struct(DataSource)5044_storage"
104+
},
105+
{
106+
"label": "lastExecutedGovernanceSequence",
107+
"type": "t_uint64"
108+
},
109+
{
110+
"label": "latestPriceInfo",
111+
"type": "t_mapping(t_bytes32,t_struct(PriceInfo)5039_storage)"
112+
},
113+
{
114+
"label": "governanceDataSourceIndex",
115+
"type": "t_uint32"
116+
}
117+
]
118+
},
119+
"t_address": {
120+
"label": "address"
121+
},
122+
"t_uint16": {
123+
"label": "uint16"
124+
},
125+
"t_bytes32": {
126+
"label": "bytes32"
127+
},
128+
"t_mapping(t_bytes32,t_struct(PriceInfo)5039_storage)": {
129+
"label": "mapping(bytes32 => struct PythInternalStructs.PriceInfo)"
130+
},
131+
"t_struct(PriceInfo)5039_storage": {
132+
"label": "struct PythInternalStructs.PriceInfo",
133+
"members": [
134+
{
135+
"label": "attestationTime",
136+
"type": "t_uint256"
137+
},
138+
{
139+
"label": "arrivalTime",
140+
"type": "t_uint256"
141+
},
142+
{
143+
"label": "arrivalBlock",
144+
"type": "t_uint256"
145+
},
146+
{
147+
"label": "priceFeed",
148+
"type": "t_struct(PriceFeed)2424_storage"
149+
}
150+
]
151+
},
152+
"t_array(t_struct(DataSource)5044_storage)dyn_storage": {
153+
"label": "struct PythInternalStructs.DataSource[]"
154+
},
155+
"t_struct(DataSource)5044_storage": {
156+
"label": "struct PythInternalStructs.DataSource",
157+
"members": [
158+
{
159+
"label": "chainId",
160+
"type": "t_uint16"
161+
},
162+
{
163+
"label": "emitterAddress",
164+
"type": "t_bytes32"
165+
}
166+
]
167+
},
168+
"t_mapping(t_bytes32,t_bool)": {
169+
"label": "mapping(bytes32 => bool)"
170+
},
171+
"t_bool": {
172+
"label": "bool"
173+
},
174+
"t_uint256": {
175+
"label": "uint256"
176+
},
177+
"t_uint64": {
178+
"label": "uint64"
179+
},
180+
"t_uint32": {
181+
"label": "uint32"
182+
},
183+
"t_struct(PriceFeed)2424_storage": {
184+
"label": "struct PythStructs.PriceFeed",
185+
"members": [
186+
{
187+
"label": "id",
188+
"type": "t_bytes32"
189+
},
190+
{
191+
"label": "price",
192+
"type": "t_struct(Price)2415_storage"
193+
},
194+
{
195+
"label": "emaPrice",
196+
"type": "t_struct(Price)2415_storage"
197+
}
198+
]
199+
},
200+
"t_struct(Price)2415_storage": {
201+
"label": "struct PythStructs.Price",
202+
"members": [
203+
{
204+
"label": "price",
205+
"type": "t_int64"
206+
},
207+
{
208+
"label": "conf",
209+
"type": "t_uint64"
210+
},
211+
{
212+
"label": "expo",
213+
"type": "t_int32"
214+
},
215+
{
216+
"label": "publishTime",
217+
"type": "t_uint256"
218+
}
219+
]
220+
},
221+
"t_int64": {
222+
"label": "int64"
223+
},
224+
"t_int32": {
225+
"label": "int32"
226+
},
227+
"t_array(t_uint256)50_storage": {
228+
"label": "uint256[50]"
229+
},
230+
"t_array(t_uint256)49_storage": {
231+
"label": "uint256[49]"
232+
}
233+
}
234+
}
235+
}
236+
}
237+
}

ethereum/migrations/prod/10_pyth_make_interface_simpler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const governance = require("@pythnetwork/xc-governance-sdk");
66
const PythUpgradable = artifacts.require("PythUpgradable");
77
const wormholeChainName = process.env.WORMHOLE_CHAIN_NAME;
88

9-
const { deployProxyImpl } = require('@openzeppelin/truffle-upgrades/dist/utils');
9+
const { upgradeProxy } = require("@openzeppelin/truffle-upgrades");
1010
const { assert } = require('chai');
1111

1212
/**

ethereum/migrations/prod/12_pyth_set_fee_1_wei.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const { assert } = require("chai");
21
const governance = require("@pythnetwork/xc-governance-sdk");
32
const assertVaaPayloadEquals = require("../../scripts/assertVaaPayloadEquals");
43
const { assert } = require("chai");

ethereum/migrations/prod/2_deploy_pyth.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,28 @@ loadEnv("../../");
33

44
const PythUpgradable = artifacts.require("PythUpgradable");
55

6-
const wormholeBridgeAddress = process.env.WORMHOLE_BRIDGE_ADDRESS;
76
const pyth2WormholeChainId = process.env.SOLANA_CHAIN_ID;
87
const pyth2WormholeEmitter = process.env.SOLANA_EMITTER;
98

109
const { deployProxy } = require("@openzeppelin/truffle-upgrades");
1110
const tdr = require('truffle-deploy-registry');
11+
const { CONTRACTS } = require('@certusone/wormhole-sdk');
12+
const { assert } = require("chai");
1213

13-
console.log("Wormhole bridge address: " + wormholeBridgeAddress)
1414
console.log("pyth2WormholeEmitter: " + pyth2WormholeEmitter)
1515
console.log("pyth2WormholeChainId: " + pyth2WormholeChainId)
1616

1717
module.exports = async function (deployer, network) {
18+
const cluster = process.env.CLUSTER;
19+
const chainName = process.env.WORMHOLE_CHAIN_NAME;
20+
21+
assert(cluster !== undefined && chainName !== undefined);
22+
23+
const wormholeBridgeAddress = CONTRACTS[cluster.toUpperCase()][chainName].core;
24+
assert(wormholeBridgeAddress !== undefined);
25+
26+
console.log("Wormhole bridge address: " + wormholeBridgeAddress)
27+
1828
// Deploy the proxy. This will return an instance of PythUpgradable,
1929
// with the address field corresponding to the fronting ERC1967Proxy.
2030
let proxyInstance = await deployProxy(PythUpgradable,

ethereum/migrations/prod/3_pyth_multiple_emitters.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
const loadEnv = require("../../scripts/loadEnv");
22
loadEnv("../../");
33

4-
if (process.env.CLUSTER !== undefined) {
5-
dotenv.config({ path: `../../.env.cluster.${process.env.CLUSTER}`});
6-
}
7-
84
const PythUpgradable = artifacts.require("PythUpgradable");
95

106
const { upgradeProxy } = require("@openzeppelin/truffle-upgrades");

ethereum/migrations/prod/4_pyth_add_events_and_update_fee.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
const loadEnv = require("../../scripts/loadEnv");
22
loadEnv("../../");
33

4-
if (process.env.CLUSTER !== undefined) {
5-
dotenv.config({ path: `../../.env.cluster.${process.env.CLUSTER}`});
6-
}
7-
84
const PythUpgradable = artifacts.require("PythUpgradable");
95

106
const { upgradeProxy } = require("@openzeppelin/truffle-upgrades");

0 commit comments

Comments
 (0)