[eth] Add set fee migration step + deployment process improvement (#346)

* Remove celo conf files as we are not there

* Remove some unused files

* Move common variables to cluster env
Also rename mainnet to ethereum

* Update migration scripts

* Remove ropsten, it's decommissioned

* Update template

* Create deployment script

* Add set fee migration step

* Comment out old upgrade process with good comments

* Address Tom comments

* Use a helper function for loading env
This commit is contained in:
Ali Behjati 2022-10-13 19:09:52 -05:00 committed by GitHub
parent 4b37fda80c
commit f7958e387f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
59 changed files with 227 additions and 370 deletions

View File

@ -1,16 +1,8 @@
MIGRATIONS_DIR=./migrations/prod
MIGRATIONS_NETWORK=celo
#Pyth
WORMHOLE_BRIDGE_ADDRESS=0xa321448d90d4e5b0A732867c18eA198e75CAC48E
WORMHOLE_BRIDGE_ADDRESS=0xa5f208e072434bC67592E4C49C1B991BA79BCA46
SOLANA_CHAIN_ID=0x1
SOLANA_EMITTER=0x6bb14509a612f01fbbc4cffeebd4bbfb492a86df717ebe92eb6df432a3f00a25
PYTHNET_CHAIN_ID=0x1a
PYTHNET_EMITTER=0xf8cd23c2ab91237730770bbea08d61005cdda0984348f3f6eecb559638c0bba0
VALID_TIME_PERIOD_SECONDS=60
GOVERNANCE_CHAIN_ID=0x1
GOVERNANCE_EMITTER=0x5635979a221c34931e32620b9293a463065555ea71fe97cd6237ade875b12e9e
WORMHOLE_CHAIN_NAME=celo

View File

@ -0,0 +1,10 @@
WORMHOLE_BRIDGE_ADDRESS=0xBd07292de7b505a4E803CEe286184f7Acf908F5e
SOLANA_CHAIN_ID=0x1
SOLANA_EMITTER=0xf346195ac02f37d60d4db8ffa6ef74cb1be3550047543a4a9ee9acf4d78697b0
PYTHNET_CHAIN_ID=0x1a
PYTHNET_EMITTER=0xa27839d641b07743c0cb5f68c51f8cd31d2c0762bec00dc6fcd25433ef1ab5b6
GOVERNANCE_CHAIN_ID=0x1
GOVERNANCE_EMITTER=0x63278d271099bfd491951b3e648f08b1c71631e4a53674ad43e8f9f98068c385
MIGRATION_12_SET_FEE_VAA=0x010000000001006c844a6f378ddc46842e61552db124bf384d7fb2410584cdc8f3be8cc864b2d169cd9640f23c72e80ac119f10614bb22570731ce9cd8999501cb9178ad7b27e80063471aea00000000000163278d271099bfd491951b3e648f08b1c71631e4a53674ad43e8f9f98068c3850000000000000006015054474d0103000000000000000000010000000000000000

View File

@ -1,16 +1,5 @@
MIGRATIONS_DIR=./migrations/prod
MIGRATIONS_NETWORK=arbitrum
#Pyth
WORMHOLE_BRIDGE_ADDRESS=0xa5f208e072434bC67592E4C49C1B991BA79BCA46
SOLANA_CHAIN_ID=0x1
SOLANA_EMITTER=0x6bb14509a612f01fbbc4cffeebd4bbfb492a86df717ebe92eb6df432a3f00a25
PYTHNET_CHAIN_ID=0x1a
PYTHNET_EMITTER=0xf8cd23c2ab91237730770bbea08d61005cdda0984348f3f6eecb559638c0bba0
VALID_TIME_PERIOD_SECONDS=60
GOVERNANCE_CHAIN_ID=0x1
GOVERNANCE_EMITTER=0x5635979a221c34931e32620b9293a463065555ea71fe97cd6237ade875b12e9e
WORMHOLE_CHAIN_NAME=arbitrum
CLUSTER=mainnet
VALID_TIME_PERIOD_SECONDS=60

View File

@ -1,16 +1,5 @@
MIGRATIONS_DIR=./migrations/prod
MIGRATIONS_NETWORK=aurora
#Pyth
WORMHOLE_BRIDGE_ADDRESS=0xa321448d90d4e5b0A732867c18eA198e75CAC48E
SOLANA_CHAIN_ID=0x1
SOLANA_EMITTER=0x6bb14509a612f01fbbc4cffeebd4bbfb492a86df717ebe92eb6df432a3f00a25
PYTHNET_CHAIN_ID=0x1a
PYTHNET_EMITTER=0xf8cd23c2ab91237730770bbea08d61005cdda0984348f3f6eecb559638c0bba0
VALID_TIME_PERIOD_SECONDS=60
GOVERNANCE_CHAIN_ID=0x1
GOVERNANCE_EMITTER=0x5635979a221c34931e32620b9293a463065555ea71fe97cd6237ade875b12e9e
WORMHOLE_CHAIN_NAME=aurora
CLUSTER=mainnet
VALID_TIME_PERIOD_SECONDS=60

View File

@ -1,16 +1,5 @@
MIGRATIONS_DIR=./migrations/prod
MIGRATIONS_NETWORK=aurora_testnet
#Pyth
WORMHOLE_BRIDGE_ADDRESS=0xBd07292de7b505a4E803CEe286184f7Acf908F5e
SOLANA_CHAIN_ID=0x1
SOLANA_EMITTER=0xf346195ac02f37d60d4db8ffa6ef74cb1be3550047543a4a9ee9acf4d78697b0
PYTHNET_CHAIN_ID=0x1a
PYTHNET_EMITTER=0xa27839d641b07743c0cb5f68c51f8cd31d2c0762bec00dc6fcd25433ef1ab5b6
VALID_TIME_PERIOD_SECONDS=60
GOVERNANCE_CHAIN_ID=0x1
GOVERNANCE_EMITTER=0x63278d271099bfd491951b3e648f08b1c71631e4a53674ad43e8f9f98068c385
WORMHOLE_CHAIN_NAME=aurora
CLUSTER=testnet
VALID_TIME_PERIOD_SECONDS=60

View File

@ -1,16 +1,5 @@
MIGRATIONS_DIR=./migrations/prod
MIGRATIONS_NETWORK=avalanche
#Pyth
WORMHOLE_BRIDGE_ADDRESS=0x54a8e5f9c4CbA08F9943965859F6c34eAF03E26c
SOLANA_CHAIN_ID=0x1
SOLANA_EMITTER=0x6bb14509a612f01fbbc4cffeebd4bbfb492a86df717ebe92eb6df432a3f00a25
PYTHNET_CHAIN_ID=0x1a
PYTHNET_EMITTER=0xf8cd23c2ab91237730770bbea08d61005cdda0984348f3f6eecb559638c0bba0
VALID_TIME_PERIOD_SECONDS=60
GOVERNANCE_CHAIN_ID=0x1
GOVERNANCE_EMITTER=0x5635979a221c34931e32620b9293a463065555ea71fe97cd6237ade875b12e9e
WORMHOLE_CHAIN_NAME=avalanche
CLUSTER=mainnet
VALID_TIME_PERIOD_SECONDS=60

View File

@ -1,16 +1,5 @@
MIGRATIONS_DIR=./migrations/prod
MIGRATIONS_NETWORK=bnb
#Pyth
WORMHOLE_BRIDGE_ADDRESS=0x98f3c9e6E3fAce36bAAd05FE09d375Ef1464288B
SOLANA_CHAIN_ID=0x1
SOLANA_EMITTER=0x6bb14509a612f01fbbc4cffeebd4bbfb492a86df717ebe92eb6df432a3f00a25
PYTHNET_CHAIN_ID=0x1a
PYTHNET_EMITTER=0xf8cd23c2ab91237730770bbea08d61005cdda0984348f3f6eecb559638c0bba0
VALID_TIME_PERIOD_SECONDS=60
GOVERNANCE_CHAIN_ID=0x1
GOVERNANCE_EMITTER=0x5635979a221c34931e32620b9293a463065555ea71fe97cd6237ade875b12e9e
WORMHOLE_CHAIN_NAME=bsc
CLUSTER=mainnet
VALID_TIME_PERIOD_SECONDS=60

View File

@ -1,16 +1,5 @@
MIGRATIONS_DIR=./migrations/prod
MIGRATIONS_NETWORK=bnb_testnet
#Pyth
WORMHOLE_BRIDGE_ADDRESS=0x68605AD7b15c732a30b1BbC62BE8F2A509D74b4D
SOLANA_CHAIN_ID=0x1
SOLANA_EMITTER=0xf346195ac02f37d60d4db8ffa6ef74cb1be3550047543a4a9ee9acf4d78697b0
PYTHNET_CHAIN_ID=0x1a
PYTHNET_EMITTER=0xa27839d641b07743c0cb5f68c51f8cd31d2c0762bec00dc6fcd25433ef1ab5b6
VALID_TIME_PERIOD_SECONDS=60
GOVERNANCE_CHAIN_ID=0x1
GOVERNANCE_EMITTER=0x63278d271099bfd491951b3e648f08b1c71631e4a53674ad43e8f9f98068c385
WORMHOLE_CHAIN_NAME=bsc
CLUSTER=testnet
VALID_TIME_PERIOD_SECONDS=60

View File

@ -1,16 +0,0 @@
MIGRATIONS_DIR=./migrations/prod
MIGRATIONS_NETWORK=celo_alfajores_testnet
#Pyth
WORMHOLE_BRIDGE_ADDRESS=0x88505117CA88e7dd2eC6EA1E13f0948db2D50D56
SOLANA_CHAIN_ID=0x1
SOLANA_EMITTER=0xf346195ac02f37d60d4db8ffa6ef74cb1be3550047543a4a9ee9acf4d78697b0
PYTHNET_CHAIN_ID=0x1a
PYTHNET_EMITTER=0xa27839d641b07743c0cb5f68c51f8cd31d2c0762bec00dc6fcd25433ef1ab5b6
VALID_TIME_PERIOD_SECONDS=60
GOVERNANCE_CHAIN_ID=0x1
GOVERNANCE_EMITTER=0x63278d271099bfd491951b3e648f08b1c71631e4a53674ad43e8f9f98068c385
WORMHOLE_CHAIN_NAME=celo

View File

@ -1,17 +1,6 @@
# Migrations Metadata
MIGRATIONS_DIR=./migrations/prod
MIGRATIONS_NETWORK=development
#Pyth
WORMHOLE_BRIDGE_ADDRESS=0x88505117CA88e7dd2eC6EA1E13f0948db2D50D56
SOLANA_CHAIN_ID=0x1
SOLANA_EMITTER=0xf346195ac02f37d60d4db8ffa6ef74cb1be3550047543a4a9ee9acf4d78697b0
PYTHNET_CHAIN_ID=0x1a
PYTHNET_EMITTER=0xa27839d641b07743c0cb5f68c51f8cd31d2c0762bec00dc6fcd25433ef1ab5b6
VALID_TIME_PERIOD_SECONDS=60
GOVERNANCE_CHAIN_ID=0x1
GOVERNANCE_EMITTER=0x63278d271099bfd491951b3e648f08b1c71631e4a53674ad43e8f9f98068c385
WORMHOLE_CHAIN_NAME=ethereum
CLUSTER=testnet
VALID_TIME_PERIOD_SECONDS=60

View File

@ -0,0 +1,5 @@
MIGRATIONS_DIR=./migrations/prod
MIGRATIONS_NETWORK=ethereum
WORMHOLE_CHAIN_NAME=ethereum
CLUSTER=mainnet
VALID_TIME_PERIOD_SECONDS=120

View File

@ -1,16 +1,5 @@
MIGRATIONS_DIR=./migrations/prod
MIGRATIONS_NETWORK=fantom
#Pyth
WORMHOLE_BRIDGE_ADDRESS=0x126783A6Cb203a3E35344528B26ca3a0489a1485
SOLANA_CHAIN_ID=0x1
SOLANA_EMITTER=0x6bb14509a612f01fbbc4cffeebd4bbfb492a86df717ebe92eb6df432a3f00a25
PYTHNET_CHAIN_ID=0x1a
PYTHNET_EMITTER=0xf8cd23c2ab91237730770bbea08d61005cdda0984348f3f6eecb559638c0bba0
VALID_TIME_PERIOD_SECONDS=60
GOVERNANCE_CHAIN_ID=0x1
GOVERNANCE_EMITTER=0x5635979a221c34931e32620b9293a463065555ea71fe97cd6237ade875b12e9e
WORMHOLE_CHAIN_NAME=fantom
CLUSTER=mainnet
VALID_TIME_PERIOD_SECONDS=60

View File

@ -1,16 +1,5 @@
MIGRATIONS_DIR=./migrations/prod
MIGRATIONS_NETWORK=fantom_testnet
#Pyth
WORMHOLE_BRIDGE_ADDRESS=0x1BB3B4119b7BA9dfad76B0545fb3F531383c3bB7
SOLANA_CHAIN_ID=0x1
SOLANA_EMITTER=0xf346195ac02f37d60d4db8ffa6ef74cb1be3550047543a4a9ee9acf4d78697b0
PYTHNET_CHAIN_ID=0x1a
PYTHNET_EMITTER=0xa27839d641b07743c0cb5f68c51f8cd31d2c0762bec00dc6fcd25433ef1ab5b6
VALID_TIME_PERIOD_SECONDS=60
GOVERNANCE_CHAIN_ID=0x1
GOVERNANCE_EMITTER=0x63278d271099bfd491951b3e648f08b1c71631e4a53674ad43e8f9f98068c385
WORMHOLE_CHAIN_NAME=fantom
CLUSTER=testnet
VALID_TIME_PERIOD_SECONDS=60

View File

@ -2,17 +2,6 @@
MIGRATIONS_DIR=./migrations/prod
MIGRATIONS_NETWORK=fuji
#Pyth
WORMHOLE_BRIDGE_ADDRESS=0x7bbcE28e64B3F8b84d876Ab298393c38ad7aac4C
SOLANA_CHAIN_ID=0x1
SOLANA_EMITTER=0xf346195ac02f37d60d4db8ffa6ef74cb1be3550047543a4a9ee9acf4d78697b0
PYTHNET_CHAIN_ID=0x1a
PYTHNET_EMITTER=0xa27839d641b07743c0cb5f68c51f8cd31d2c0762bec00dc6fcd25433ef1ab5b6
VALID_TIME_PERIOD_SECONDS=60
GOVERNANCE_CHAIN_ID=0x1
GOVERNANCE_EMITTER=0x63278d271099bfd491951b3e648f08b1c71631e4a53674ad43e8f9f98068c385
WORMHOLE_CHAIN_NAME=avalanche
CLUSTER=testnet
VALID_TIME_PERIOD_SECONDS=60

View File

@ -1,16 +1,5 @@
MIGRATIONS_DIR=./migrations/prod
MIGRATIONS_NETWORK=goerli
#Pyth
WORMHOLE_BRIDGE_ADDRESS=0x706abc4E45D419950511e474C7B9Ed348A4a716c
SOLANA_CHAIN_ID=0x1
SOLANA_EMITTER=0xf346195ac02f37d60d4db8ffa6ef74cb1be3550047543a4a9ee9acf4d78697b0
PYTHNET_CHAIN_ID=0x1a
PYTHNET_EMITTER=0xa27839d641b07743c0cb5f68c51f8cd31d2c0762bec00dc6fcd25433ef1ab5b6
VALID_TIME_PERIOD_SECONDS=120
GOVERNANCE_CHAIN_ID=0x1
GOVERNANCE_EMITTER=0x63278d271099bfd491951b3e648f08b1c71631e4a53674ad43e8f9f98068c385
WORMHOLE_CHAIN_NAME=ethereum
CLUSTER=testnet
VALID_TIME_PERIOD_SECONDS=120

View File

@ -1,16 +0,0 @@
MIGRATIONS_DIR=./migrations/prod
MIGRATIONS_NETWORK=mainnet
#Pyth
WORMHOLE_BRIDGE_ADDRESS=0x98f3c9e6E3fAce36bAAd05FE09d375Ef1464288B
SOLANA_CHAIN_ID=0x1
SOLANA_EMITTER=0x6bb14509a612f01fbbc4cffeebd4bbfb492a86df717ebe92eb6df432a3f00a25
PYTHNET_CHAIN_ID=0x1a
PYTHNET_EMITTER=0xf8cd23c2ab91237730770bbea08d61005cdda0984348f3f6eecb559638c0bba0
VALID_TIME_PERIOD_SECONDS=120
GOVERNANCE_CHAIN_ID=0x1
GOVERNANCE_EMITTER=0x5635979a221c34931e32620b9293a463065555ea71fe97cd6237ade875b12e9e
WORMHOLE_CHAIN_NAME=ethereum

View File

@ -2,17 +2,6 @@
MIGRATIONS_DIR=./migrations/prod
MIGRATIONS_NETWORK=mumbai
#Pyth
WORMHOLE_BRIDGE_ADDRESS=0x0CBE91CF822c73C2315FB05100C2F714765d5c20
SOLANA_CHAIN_ID=0x1
SOLANA_EMITTER=0xf346195ac02f37d60d4db8ffa6ef74cb1be3550047543a4a9ee9acf4d78697b0
PYTHNET_CHAIN_ID=0x1a
PYTHNET_EMITTER=0xa27839d641b07743c0cb5f68c51f8cd31d2c0762bec00dc6fcd25433ef1ab5b6
VALID_TIME_PERIOD_SECONDS=60
GOVERNANCE_CHAIN_ID=0x1
GOVERNANCE_EMITTER=0x63278d271099bfd491951b3e648f08b1c71631e4a53674ad43e8f9f98068c385
WORMHOLE_CHAIN_NAME=polygon
CLUSTER=testnet
VALID_TIME_PERIOD_SECONDS=60

View File

@ -1,16 +1,5 @@
MIGRATIONS_DIR=./migrations/prod
MIGRATIONS_NETWORK=optimism
#Pyth
WORMHOLE_BRIDGE_ADDRESS=0xEe91C335eab126dF5fDB3797EA9d6aD93aeC9722
SOLANA_CHAIN_ID=0x1
SOLANA_EMITTER=0x6bb14509a612f01fbbc4cffeebd4bbfb492a86df717ebe92eb6df432a3f00a25
PYTHNET_CHAIN_ID=0x1a
PYTHNET_EMITTER=0xf8cd23c2ab91237730770bbea08d61005cdda0984348f3f6eecb559638c0bba0
VALID_TIME_PERIOD_SECONDS=60
GOVERNANCE_CHAIN_ID=0x1
GOVERNANCE_EMITTER=0x5635979a221c34931e32620b9293a463065555ea71fe97cd6237ade875b12e9e
WORMHOLE_CHAIN_NAME=optimism
CLUSTER=mainnet
VALID_TIME_PERIOD_SECONDS=60

View File

@ -1,16 +1,5 @@
MIGRATIONS_DIR=./migrations/prod
MIGRATIONS_NETWORK=polygon
#Pyth
WORMHOLE_BRIDGE_ADDRESS=0x7A4B5a56256163F07b2C80A7cA55aBE66c4ec4d7
SOLANA_CHAIN_ID=0x1
SOLANA_EMITTER=0x6bb14509a612f01fbbc4cffeebd4bbfb492a86df717ebe92eb6df432a3f00a25
PYTHNET_CHAIN_ID=0x1a
PYTHNET_EMITTER=0xf8cd23c2ab91237730770bbea08d61005cdda0984348f3f6eecb559638c0bba0
VALID_TIME_PERIOD_SECONDS=60
GOVERNANCE_CHAIN_ID=0x1
GOVERNANCE_EMITTER=0x5635979a221c34931e32620b9293a463065555ea71fe97cd6237ade875b12e9e
WORMHOLE_CHAIN_NAME=polygon
CLUSTER=mainnet
VALID_TIME_PERIOD_SECONDS=60

View File

@ -1,16 +0,0 @@
MIGRATIONS_DIR=./migrations/prod
MIGRATIONS_NETWORK=ropsten
#Pyth
WORMHOLE_BRIDGE_ADDRESS=0x210c5F5e2AF958B4defFe715Dc621b7a3BA888c5
SOLANA_CHAIN_ID=0x1
SOLANA_EMITTER=0xf346195ac02f37d60d4db8ffa6ef74cb1be3550047543a4a9ee9acf4d78697b0
PYTHNET_CHAIN_ID=0x1a
PYTHNET_EMITTER=0xa27839d641b07743c0cb5f68c51f8cd31d2c0762bec00dc6fcd25433ef1ab5b6
VALID_TIME_PERIOD_SECONDS=120
GOVERNANCE_CHAIN_ID=0x1
GOVERNANCE_EMITTER=0x63278d271099bfd491951b3e648f08b1c71631e4a53674ad43e8f9f98068c385
WORMHOLE_CHAIN_NAME=ropsten

View File

@ -2,30 +2,21 @@
MIGRATIONS_DIR= # ./migrations/prod
MIGRATIONS_NETWORK= # xyz
# IF network needs it
INFURA_KEY=
# Verification
ETHERSCAN_KEY=
# Wormhole Receiver (if needed) # Example Format
INIT_SIGNERS= # ["0x0000000000000000000000000000000000000000"]
INIT_GOV_CHAIN_ID= # 0x1
INIT_GOV_CONTRACT= # 0x000000000000000000000000000000000000000000000000000000000000004
# Pyth Migrations # Example Format
WORMHOLE_BRIDGE_ADDRESS # 0x68605AD7b15c732a30b1BbC62BE8F2A509D74b4D (only if wormhole exists)
SOLANA_CHAIN_ID= # 0x1
SOLANA_EMITTER= # 0xf346195ac02f37d60d4db8ffa6ef74cb1be3550047543a4a9ee9acf4d78697b0
PYTHNET_CHAIN_ID= # 0x1a
PYTHNET_EMITTER= # 0xa27839d641b07743c0cb5f68c51f8cd31d2c0762bec00dc6fcd25433ef1ab5b6
# The duration that a price feed stored in the contract is considered to be
# valid, after this duration, the price feed is stale and will be invalid.
# This value should derive from Pyth to wormhole latency, and target chain blocktime and latency.
VALID_TIME_PERIOD_SECONDS= # 60
WORMHOLE_CHAIN_NAME= # ethereum, defined in https://github.com/wormhole-foundation/wormhole/blob/dev.v2/sdk/js/src/utils/consts.ts
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
PYTHNET_EMITTER= # 0xa27839d641b07743c0cb5f68c51f8cd31d2c0762bec00dc6fcd25433ef1ab5b6
GOVERNANCE_CHAIN_ID= # 0x1
GOVERNANCE_EMITTER= # 0x63278d271099bfd491951b3e648f08b1c71631e4a53674ad43e8f9f98068c385
WORMHOLE_CHAIN_NAME= # ethereum, defined in https://github.com/wormhole-foundation/wormhole/blob/dev.v2/sdk/js/src/utils/consts.ts

View File

@ -29,4 +29,4 @@ VALID_TIME_PERIOD_SECONDS=60
GOVERNANCE_CHAIN_ID=0x1
GOVERNANCE_EMITTER=0x0000000000000000000000000000000000000000000000000000000000001234
WORMHOLE_CHAIN_NAME=ethereum
WORMHOLE_CHAIN_NAME=ethereum

View File

@ -1,35 +0,0 @@
diff --git a/ethereum/contracts/bridge/Bridge.sol b/ethereum/contracts/bridge/Bridge.sol
index 3f06757f..6c70e6fa 100644
--- a/ethereum/contracts/bridge/Bridge.sol
+++ b/ethereum/contracts/bridge/Bridge.sol
@@ -58,7 +58,7 @@ contract Bridge is BridgeGovernance, ReentrancyGuard {
sequence = wormhole().publishMessage{
value : msg.value
- }(nonce, encoded, 15);
+ }(nonce, encoded, 1);
}
function wrapAndTransferETH(uint16 recipientChain, bytes32 recipient, uint256 arbiterFee, uint32 nonce) public payable returns (uint64 sequence) {
@@ -173,7 +173,7 @@ contract Bridge is BridgeGovernance, ReentrancyGuard {
sequence = wormhole().publishMessage{
value : callValue
- }(nonce, encoded, 15);
+ }(nonce, encoded, 1);
}
function updateWrapped(bytes memory encodedVm) external returns (address token) {
diff --git a/ethereum/contracts/nft/NFTBridge.sol b/ethereum/contracts/nft/NFTBridge.sol
index abf25a28..78f9a781 100644
--- a/ethereum/contracts/nft/NFTBridge.sol
+++ b/ethereum/contracts/nft/NFTBridge.sol
@@ -95,7 +95,7 @@ contract NFTBridge is NFTBridgeGovernance {
sequence = wormhole().publishMessage{
value : callValue
- }(nonce, encoded, 15);
+ }(nonce, encoded, 1);
}
function completeTransfer(bytes memory encodedVm) public {

View File

@ -8,35 +8,16 @@ This is the deployment process:
# The Secret Recovery Phrase for the wallet the contract will be deployed from.
export MNEMONIC=...
# Set the deploy commit hash in the contract (used for debugging purposes)
sed -i "s/__DEPLOY_COMMIT_HASH_PLACEHOLER__/$(git rev-parse HEAD)/g" ./contracts/pyth/Pyth.sol
# Ensure that we deploy a fresh build with up-to-date dependencies.
rm -rf build && npx truffle compile --all
# Merge the network addresses into the artifacts, if some contracts are already deployed.
npx apply-registry
# After doing the above steps, you can run the below commands per each network.
# Load the configuration environment variables for deploying your network. make sure to use right env file.
# If it is a new chain you are deploying to, create a new env file and commit it to the repo.
rm -f .env; ln -s .env.prod.xyz .env && set -o allexport && source .env set && set +o allexport
# Perform the migration step by step using `--to <migration file number>` argument. Some steps require a governance execution to be successful. //TODO the process.
# You might need to repeat the steps because of busy RPCs.
# Also, sometimes the gases are not adjusted. Please update them with the network
# explorer gas tracker.
# Tips in Troubleshooting section below can help in case of any error.
npx truffle migrate --network $MIGRATIONS_NETWORK --to <step>
# Some steps require executing a governance instruction to be successful, you can use the multisig message builder tool in
# `third_party/pyth` of this repo root to create multisig transaction and execute it to create the VAA.
# Then you can use the VAA (in hex) to execute the governance instruction. To do so, run:
$ npx apply-registry # apparently a deployProxyImpl messes up with correct address of proxy
$ npx truffle console --network $MIGRATIONS_NETWORK
> let p = await PythUpgradable.deployed()
> await p.executeGovernanceInstruction("<VAA in hex like: 0x123002342352>");
# Deploy the changes
# You might need to repeat this script because of busy RPCs. Repeating would not cause any problem even
# if the changes are already made. Also, sometimes the gases are not adjusted. Please update them with
# the network explorer gas tracker. Tips in Troubleshooting section below can help in case of any error.
./deploy.sh <network_a> <network_b> <...>
# Example: Deploying to some testnet networks
# ./deploy.sh bnb_testnet fantom_testnet mumbai
#
# Example: Deploying to some mainnet networks
# ./deploy.sh ethereum bnb avalanche
# Perform this in first time mainnet deployments with Wormhole Receiver. (Or when guardian sets are upgraded)
npm run receiver-submit-guardian-sets -- --network $MIGRATIONS_NETWORK

View File

@ -1,6 +0,0 @@
#!/usr/bin/env bash
# This script copies package{-lock}.json from a running container.
set -e
kubectl cp -c ganache eth-devnet-0:package.json package.json
kubectl cp -c ganache eth-devnet-0:package-lock.json package-lock.json

46
ethereum/deploy.sh Executable file
View File

@ -0,0 +1,46 @@
#!/bin/bash
#
# This script deploys changes to given networks. Usage:
# $ ./deploy.sh <network_a> <network_a> <...>
# Network names are defined in `truffle-config.js`.
#
# Example: Deploying to some testnet networks
# $ ./deploy.sh bnb_testnet fantom_testnet mumbai
#
# Example: Deploying to some mainnet networks
# $ ./deploy.sh ethereum bnb avalanche
set -euo pipefail
echo "=========== Compiling ==========="
echo "Replacing the deploy commit hash..."
# Set the deploy commit hash in the contract (used for debugging purposes)
sed -i "s/__DEPLOY_COMMIT_HASH_PLACEHOLER__/$(git rev-parse HEAD)/g" ./contracts/pyth/Pyth.sol
echo "Building the contract..."
# Ensure that we deploy a fresh build with up-to-date dependencies.
rm -rf build && npx truffle compile --all
echo "Adding network metadata to the contract"
# Merge the network addresses into the artifacts, if some contracts are already deployed.
npx apply-registry
while [[ $# -ne 0 ]]; do
NETWORK=$1
shift
echo "=========== Deploying to ${NETWORK} ==========="
# Load the configuration environment variables for deploying your network. make sure to use right env file.
# If it is a new chain you are deploying to, create a new env file and commit it to the repo.
rm -f .env; ln -s .env.prod.$NETWORK .env && set -o allexport && source .env set && set +o allexport
echo "Migrating..."
npx truffle migrate --network $MIGRATIONS_NETWORK
echo "Deployment to $NETWORK finished successfully"
done
echo "=========== Cleaning up ==========="
echo "Reverting back the deploy commit hash..."
sed -i "s/$(git rev-parse HEAD)/__DEPLOY_COMMIT_HASH_PLACEHOLER__/g" ./contracts/pyth/Pyth.sol

View File

@ -1,4 +1,5 @@
require('dotenv').config({ path: "../.env" });
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
const PythUpgradable = artifacts.require("PythUpgradable");
const governanceChainId = process.env.GOVERNANCE_CHAIN_ID;

View File

@ -1,4 +1,5 @@
require('dotenv').config({ path: "../.env" });
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
const PythUpgradable = artifacts.require("PythUpgradable");
const governanceChainId = process.env.GOVERNANCE_CHAIN_ID;

View File

@ -1,4 +1,5 @@
require("dotenv").config({ path: "../.env" });
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
const tdr = require('truffle-deploy-registry');

View File

@ -1,5 +1,5 @@
require('dotenv').config({ path: "../.env" });
const bs58 = require("bs58");
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
const PythUpgradable = artifacts.require("PythUpgradable");
const WormholeReceiver = artifacts.require("WormholeReceiver");

View File

@ -1,4 +1,5 @@
require("dotenv").config({ path: "../.env" });
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
const PythUpgradable = artifacts.require("PythUpgradable");

View File

@ -1,4 +1,5 @@
require('dotenv').config({ path: "../.env" });
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
const PythUpgradable = artifacts.require("PythUpgradable");

View File

@ -1,4 +1,5 @@
require('dotenv').config({ path: "../.env" });
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
const PythUpgradable = artifacts.require("PythUpgradable");

View File

@ -1,4 +1,5 @@
require('dotenv').config({ path: "../.env" });
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
const PythUpgradable = artifacts.require("PythUpgradable");
const validTimePeriodSeconds = Number(process.env.VALID_TIME_PERIOD_SECONDS);

View File

@ -1,4 +1,5 @@
require('dotenv').config({ path: "../.env" });
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
const PythUpgradable = artifacts.require("PythUpgradable");

View File

@ -1,4 +1,5 @@
require('dotenv').config({ path: "../.env" });
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
const PythUpgradable = artifacts.require("PythUpgradable");

View File

@ -1,4 +1,5 @@
require('dotenv').config({ path: "../.env" });
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
const governance = require("@pythnetwork/xc-governance-sdk");
@ -18,13 +19,22 @@ module.exports = async function (deployer) {
assert(governance.CHAINS[wormholeChainName] !== undefined);
const proxy = await PythUpgradable.deployed();
const newImpl = (await deployProxyImpl(PythUpgradable, { deployer, unsafeSkipStorageCheck: true }, proxy.address)).impl;
console.log(`New implementation address is: ${newImpl}. Please sign and execute the following encoded ` +
`governance instruction to upgrade it.`);
await upgradeProxy(proxy.address, PythUpgradable, { deployer, unsafeSkipStorageCheck: true });
const instructionBuffer = new governance.EthereumUpgradeContractInstruction(
governance.CHAINS[wormholeChainName],
new governance.HexString20Bytes(newImpl)
).serialize();
console.log(`Governance instruction: 0x${instructionBuffer.toString('hex')}`);
// This step is not needed in new contracts as the contract up to this step is up to date.
// The code is left here to be an example of how to create a governance instruction for upgrade.
// If you wish to create an upgrade step, do it in 2 migration steps. First step should be like below
// that deploys a new contract and creates the governance instruction payload. Second step should
// take the VAA as an env variable and execute it.
// const proxy = await PythUpgradable.deployed();
// const newImpl = (await deployProxyImpl(PythUpgradable, { deployer, unsafeSkipStorageCheck: true }, proxy.address)).impl;
// console.log(`New implementation address is: ${newImpl}. Please sign and execute the following encoded ` +
// `governance instruction to upgrade it.`);
// const instructionBuffer = new governance.EthereumUpgradeContractInstruction(
// governance.CHAINS[wormholeChainName],
// new governance.HexString20Bytes(newImpl)
// ).serialize();
// console.log(`Governance instruction: 0x${instructionBuffer.toString('hex')}`);
}

View File

@ -1,4 +1,5 @@
require('dotenv').config({ path: "../.env" });
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
const PythUpgradable = artifacts.require("PythUpgradable");

View File

@ -0,0 +1,17 @@
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
const setFeeVaa = process.env.MIGRATION_12_SET_FEE_VAA;
console.log("Set fee vaa: ", setFeeVaa);
const PythUpgradable = artifacts.require("PythUpgradable");
/**
*
* This change:
* - Executes the VAA to set the fee to 1 wei
*/
module.exports = async function (_deployer) {
const proxy = await PythUpgradable.deployed();
await proxy.executeGovernanceInstruction(setFeeVaa);
}

View File

@ -1,5 +1,5 @@
require('dotenv').config({ path: "../.env" });
const bs58 = require("bs58");
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
const PythUpgradable = artifacts.require("PythUpgradable");

View File

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

View File

@ -1,4 +1,9 @@
require('dotenv').config({ path: "../.env" });
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
if (process.env.CLUSTER !== undefined) {
dotenv.config({ path: `../../.env.cluster.${process.env.CLUSTER}`});
}
const PythUpgradable = artifacts.require("PythUpgradable");

View File

@ -1,4 +1,5 @@
require('dotenv').config({ path: "../.env" });
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
const PythUpgradable = artifacts.require("PythUpgradable");

View File

@ -1,4 +1,5 @@
require('dotenv').config({ path: "../.env" });
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
const PythUpgradable = artifacts.require("PythUpgradable");
const validTimePeriodSeconds = Number(process.env.VALID_TIME_PERIOD_SECONDS);

View File

@ -1,4 +1,5 @@
require('dotenv').config({ path: "../.env" });
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
const PythUpgradable = artifacts.require("PythUpgradable");

View File

@ -1,4 +1,5 @@
require('dotenv').config({ path: "../.env" });
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
const PythUpgradable = artifacts.require("PythUpgradable");

View File

@ -1,4 +1,5 @@
require('dotenv').config({ path: "../.env" });
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
const PythUpgradable = artifacts.require("PythUpgradable");
const governanceChainId = process.env.GOVERNANCE_CHAIN_ID;

View File

@ -1,4 +1,5 @@
require('dotenv').config({ path: "../.env" });
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
const PythUpgradable = artifacts.require("PythUpgradable");
const governanceChainId = process.env.GOVERNANCE_CHAIN_ID;

View File

@ -1,4 +1,5 @@
require('dotenv').config({ path: "../.env" });
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
const governance = require("@pythnetwork/xc-governance-sdk");
const createLocalnetGovernanceVaa = require("../../scripts/createLocalnetGovernanceVaa");

View File

@ -1,4 +1,5 @@
require('dotenv').config({ path: "../.env" });
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
const Setup = artifacts.require("Setup");
const Implementation = artifacts.require("Implementation");

View File

@ -1,4 +1,6 @@
require('dotenv').config({ path: "../.env" });
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
const bs58 = require("bs58");
const PythUpgradable = artifacts.require("PythUpgradable");

View File

@ -1,4 +1,5 @@
require("dotenv").config({ path: "../.env" });
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
const PythUpgradable = artifacts.require("PythUpgradable");

View File

@ -1,4 +1,5 @@
require('dotenv').config({ path: "../.env" });
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
const PythUpgradable = artifacts.require("PythUpgradable");

View File

@ -1,4 +1,5 @@
require('dotenv').config({ path: "../.env" });
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
const PythUpgradable = artifacts.require("PythUpgradable");

View File

@ -1,4 +1,5 @@
require('dotenv').config({ path: "../.env" });
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
const PythUpgradable = artifacts.require("PythUpgradable");
const validTimePeriodSeconds = Number(process.env.VALID_TIME_PERIOD_SECONDS);

View File

@ -1,4 +1,5 @@
require('dotenv').config({ path: "../.env" });
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
const PythUpgradable = artifacts.require("PythUpgradable");

View File

@ -1,4 +1,5 @@
require('dotenv').config({ path: "../.env" });
const loadEnv = require("../../scripts/loadEnv");
loadEnv("../../");
const PythUpgradable = artifacts.require("PythUpgradable");
const governanceChainId = process.env.GOVERNANCE_CHAIN_ID;

View File

@ -0,0 +1,10 @@
const dotenv = require("dotenv");
var path = require('path');
module.exports = function loadEnv(rootPath) {
dotenv.config({ path: path.join(rootPath, ".env") });
if (process.env.CLUSTER !== undefined) {
dotenv.config({ path: path.join(rootPath,
`.env.cluster.${process.env.CLUSTER}`) });
}
}

View File

@ -9,7 +9,7 @@ module.exports = {
port: 8545,
network_id: "*",
},
mainnet: {
ethereum: {
provider: () =>
new HDWalletProvider(
process.env.MNEMONIC,
@ -151,6 +151,8 @@ module.exports = {
network_id: 0x4e454153,
gas: 10000000,
from: "0xC42e9476b0a458097087336e2395Dbf45B0BdC12", // public key
networkCheckTimeout: 1000000,
timeoutBlocks: 1000,
},
arbitrum: {
provider: () => {