Ethereum: deploy with forge (#3862)
* eth: deploy with forge * Delete unused scripts * Support upgrade, bytecode verify and publish tool * Add script to register all chains on a new chain
This commit is contained in:
parent
a46bccaa9b
commit
f290df6b9b
|
@ -9,6 +9,7 @@
|
|||
/bitcoin/ @evan-gray
|
||||
/cosmwasm/ @nik-suri @kcsongor @a5-pickle
|
||||
/ethereum/ @a5-pickle @gator-boi @kcsongor
|
||||
/ethereum/env/ @a5-pickle @gator-boi @kcsongor @evan-gray @bruce-riley
|
||||
/relayer/ethereum @nonergodic @gator-boi
|
||||
/near/ @evan-gray @kcsongor
|
||||
/solana/ @kcsongor @a5-pickle
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
# Note: Please make sure the first column has the chain number in parens. You can comment out the line (with #) if a chain becomes obsolete.
|
||||
Solana (1) Testnet Token Bridge,01000000000100c0c64027377f27bb3ef676f2fd9c63a30a6d1bf904851656cad635601425191017308e3d0e605364c3a1a5305b722fd150bde1f869b74a8cbb686774c41a7c880100000001000000010001000000000000000000000000000000000000000000000000000000000000000400000000051a364b00000000000000000000000000000000000000000000546f6b656e42726964676501000000013b26409f8aaded3f5ddca184695aa6a0fa829b0c85caf84856324896d214ca98
|
||||
Goerli (2) Testnet Token Bridge,01000000000100b3644d45f6e442c913719ab546f4052c296bbf8c0541e41170b5f5c525cc52181ee42a40f34fa01f6b9256375e31de4e5c52e80cb7afebffb3e559fa70f6e5e400000000010000000100010000000000000000000000000000000000000000000000000000000000000004000000000369a27e00000000000000000000000000000000000000000000546f6b656e4272696467650100000002000000000000000000000000f890982f9310df57d00f659cf4fd87e65aded8d7
|
||||
Terra (3) Testnet Token Bridge,01000000000100f98926ea6a4e603985331c93ec48a3d21c4a8214e9e60013d94f9f29d0af19381d63124af52c21ce704fe64eda1c1ef8e1224db37342b6f70479f5f2a6e9715e000000000100000001000100000000000000000000000000000000000000000000000000000000000000040000000001ec910d00000000000000000000000000000000000000000000546f6b656e42726964676501000000030000000000000000000000000c32d68d8f22613f6b9511872dad35a59bfdf7f0
|
||||
BSC (4) Testnet Token Bridge,01000000000100e41b7eb99f0544ffa5041916edce298d2fc2a931f106b9dedb31ea02314332a24d8412e6a40f1147796f9e76dfd84639d5e92c81f4d6da91a8ce37d4747915c1000000000100000001000100000000000000000000000000000000000000000000000000000000000000040000000000e3ba2d00000000000000000000000000000000000000000000546f6b656e42726964676501000000040000000000000000000000009dcf9d205c9de35334d646bee44b2d2859712a09
|
||||
Polygon (5) Testnet Token Bridge,01000000000100324e4b59e60de68e084bad49264cb30765c0d4347c24b6fcfebe8839fcdae7a73426acd8f27e0c00e02caf4d61120558e360d3603c55d3630dd031279658e3980100000001000000010001000000000000000000000000000000000000000000000000000000000000000400000000002ff5b300000000000000000000000000000000000000000000546f6b656e4272696467650100000005000000000000000000000000377d55a7928c046e18eebb61977e714d2a76472a
|
||||
Avalanche (6) Testnet Token Bridge,01000000000100d365d561f960c16ab5e86a27c081e3d93a75753f63e13edaaf8bc928ab5f0cbc1b4e59136d72880d96bf265af781dcf437c9167bf885befde3eb6ef6091981e7000000000100000001000100000000000000000000000000000000000000000000000000000000000000040000000001733c8000000000000000000000000000000000000000000000546f6b656e427269646765010000000600000000000000000000000061e44e506ca5659e6c0bba9b678586fa2d729756
|
||||
Oasis (7) Testnet Token Bridge,01000000000100eb109d6208ea838e9ae9ef091f4dc4a4d66aa71bebd5788ed441394cebfc14be3f4ae94dfe7ed327597280712fbfeb6707d38aa5d0529f511ad2162564d2479200000000010000000100010000000000000000000000000000000000000000000000000000000000000004000000000190382d00000000000000000000000000000000000000000000546f6b656e427269646765010000000700000000000000000000000088d8004a9bdbfd9d28090a02010c19897a29605c
|
||||
Algorand (8) Testnet Token Bridge,010000000001006e90fe2a505f0d67b6ca6221a42f55957bf59201451ffbecbfa4a3416a8491c45e8bcaa18a3c422f5548d98db788f89ac6c8c89d1fe6334860baccc8fedb7c3400626a9eed41c71ee1000100000000000000000000000000000000000000000000000000000000000000040000000041c71ee120000000000000000000000000000000000000000000546f6b656e42726964676501000000086241ffdc032b693bfb8544858f0403dec86f2e1720af9f34f8d65fe574b6238c
|
||||
Aurora (9) (NEAR) Testnet Token Bridge,0100000000010096e79a229cdd3717f0b47bf7fb65b88202c4ec5fd9cc7d5f319cbe27b0f57d0c2292204c9df25e060e7e9632a54fefca88f1ca95c76ca083a07a68d59de9964701000000010000000100010000000000000000000000000000000000000000000000000000000000000004000000000227003a00000000000000000000000000000000000000000000546f6b656e4272696467650100000009000000000000000000000000d05ed3ad637b890d68a854d607eeaf11af456fba
|
||||
Fantom (10) Testnet Token Bridge,010000000001007bc5bdc2253a6deec065a6e573f7bdd363383b91210054d8ce7558d9b8185a60157370f56f35d03fc434ecf90fc652cf31b9b4a2a15eb43c5ad8a664356ef81e00000000010000000100010000000000000000000000000000000000000000000000000000000000000004000000000351c06c00000000000000000000000000000000000000000000546f6b656e427269646765010000000a000000000000000000000000599cea2204b4faecd584ab1f2b6aca137a0afbe8
|
||||
Karura (11) Testnet Token Bridge,01000000000100c01c50054de5f481bb5cd8b4e5d906d86c7307ba969a0f9f042e410b859528387040360954dc4fd4834d4f68dfea9067f3da3bb4af127f61e3ae04f7d216fc300100000001000000010001000000000000000000000000000000000000000000000000000000000000000400000000026bcc5b00000000000000000000000000000000000000000000546f6b656e427269646765010000000b000000000000000000000000d11de1f930ea1f7dd0290fe3a2e35b9c91aefb37
|
||||
Acala (12) Testnet Token Bridge,01000000000100595f3b02b450ea71724c09a4b1a071f67eafb1471e0bd0d03d506e11ceedc81d788dd57dc81927cb74970ad6389e369d0589682d176eff033fe140dae1035155000000000100000001000100000000000000000000000000000000000000000000000000000000000000040000000002a49e7a00000000000000000000000000000000000000000000546f6b656e427269646765010000000c000000000000000000000000eba00cbe08992edd08ed7793e07ad6063c807004
|
||||
Klaytn (13) Testnet Token Bridge,0100000000010018f4c45a9e8e0b6767d84bef689987dcdf86190500b92c82aa67df532a5719451b5a1897c342ae4fb851fc84c090624ab3070b485f54a07b9cf9e7645069c8cf010000000100000001000100000000000000000000000000000000000000000000000000000000000000040000000004df8a7400000000000000000000000000000000000000000000546f6b656e427269646765010000000d000000000000000000000000c7a13be098720840dea132d860fdfa030884b09a
|
||||
Celo (14) Testnet Token Bridge,010000000001008a8e90d7053e7f2056a637de9cf525e949a2a8834b9c3a8ac05b6106dd83756443493fcc75a88f4c6fcd9cf1121a7b5f51807f8a9e3e63cebdd47904f30de70d000000000100000001000100000000000000000000000000000000000000000000000000000000000000040000000001b0920b00000000000000000000000000000000000000000000546f6b656e427269646765010000000e00000000000000000000000005ca6037ec51f8b712ed2e6fa72219feae74e153
|
||||
Near (15) Testnet Token Bridge,010000000001004c49657df4c346b7f7f48e802ae42a5e9a4e8b1e26887f3989d8fca956ab7bd01b9a8b1bf73b1b890621e0e6a0790f6e70dc34e181090f8f761d1d02299a019b0000000001000000010001000000000000000000000000000000000000000000000000000000000000000400000000006948a500000000000000000000000000000000000000000000546f6b656e427269646765010000000fc2c0b6ecbbe9ecf91b2b7999f0264018ba68126c2e83bf413f59f712f3a1df55
|
||||
Moonbeam (16) Testnet Token Bridge,010000000001000f89d8382c4e3cc006f47cacbdc3778dc4538735beb4b3b16f1298ae5d3343b76a5a7f219cf164cb3d825d835171657853a5a6737d01e34b3cd185f7359ae981010000000100000001000100000000000000000000000000000000000000000000000000000000000000040000000005c65ed800000000000000000000000000000000000000000000546f6b656e4272696467650100000010000000000000000000000000bc976d4b9d57e57c3ca52e1fd136c45ff7955a96
|
||||
Terra 2 (18) Testnet Token Bridge,0100000000010012e2cdcc83e46393100a4db2e4ffd1d01fc9202fcf23355f45789f85a1d8329d6da5cfbe6571006e5f87f5ac38f2b153634f04fb7a115bdb066761c506a68416010000000100000001000100000000000000000000000000000000000000000000000000000000000000040000000002ef7f3d00000000000000000000000000000000000000000000546f6b656e4272696467650100000012c3d4c6c2bcba163de1defb7e8f505cdb40619eee4fa618678955e8790ae1448d
|
||||
Injective (19) Testnet Token Bridge,010000000001008bb0cbbfbd807ee77f797529f0434f16148c1d54e81c89eb45955410b3e35a76263aa4b7fa8e9ee2b054c78c7cd52c7e883d6d1740c9efb4c8991f8248a0fd64010000000100000001000100000000000000000000000000000000000000000000000000000000000000040000000002dd12ee00000000000000000000000000000000000000000000546f6b656e427269646765010000001300000000000000000000000003f3e7b2e363f51cf6e57ef85f43a2b91dbce501
|
||||
Sui (21) Testnet Token Bridge,0100000000010096b28cb12b0bc0f77384a33df52e548b8937b238e4f2b95b351f4b49e9427d2d2d6c993fde2d499d8470e910ca480bd1f8aa752d20e08d73d3b977bb46f927da01000000010000000100010000000000000000000000000000000000000000000000000000000000000004000000000114aa5200000000000000000000000000000000000000000000546f6b656e427269646765010000001540440411a170b4842ae7dee4f4a7b7a58bc0a98566e998850a7bb87bf5dc05b9
|
||||
Aptos (22) Testnet Token Bridge,01000000000100114e4745792d5eadefe026faf3ce31c91a1a2b32052af4a3f2592e27e5b862a042d4a367fb2487efc2ba187c9ebe95110f057077c5078354ca4c0a282748f363010000000100000001000100000000000000000000000000000000000000000000000000000000000000040000000002c9d5c900000000000000000000000000000000000000000000546f6b656e42726964676501000000160000000000000000000000000000000000000000000000000000000000000001
|
||||
Arbitrum (23) Testnet Token Bridge,01000000000100078f162b1034763cbf467c58f5f47a245492a0f80c3c1a74044c150c4028bc276aafc8d332fb126c0720e378611b978712b298b360c4c0058f651c9d608b7edd010000000100000001000100000000000000000000000000000000000000000000000000000000000000040000000004e5580600000000000000000000000000000000000000000000546f6b656e427269646765010000001700000000000000000000000023908a62110e21c04f3a4e011d24f901f911744a
|
||||
Optimism (24) Testnet Token Bridge,010000000001008cf247247da71cc40fd7746278134f02a60f83e6e6dbeefa376dab4a0ef79cdd4a7ccddda520ce2f55633ef089488ff195896c28a9b8ac6f0f1598dd6a3e3aec01000000010000000100010000000000000000000000000000000000000000000000000000000000000004000000000021104800000000000000000000000000000000000000000000546f6b656e4272696467650100000018000000000000000000000000c7a204bdbfe983fcd8d8e61d02b475d4073ff97e
|
||||
XPLA (28) Testnet Token Bridge,01000000000100a4e53102c8fe0934f8911911c48413de45d12a57ddfbd61292b45dbf6d301781342c8ec52e5802020c988589b84fa0a61fc85695fa5185d03bbfda32a10eca4e010000000100000001000100000000000000000000000000000000000000000000000000000000000000040000000000d7c24100000000000000000000000000000000000000000000546f6b656e427269646765010000001cb66da121bd3621c8d2604c08c82965640fe682d606af26a302ee09094f5e62cf
|
||||
Base (30) Testnet Token Bridge,010000000001000b058a5c4ee2f70c99c98ff148299fb1d0bf2ea773285b86f612227b18d16506331a00aa9203128a620d15b304a18a34c47826745923d48362cb11a5d428744900000000010000000100010000000000000000000000000000000000000000000000000000000000000004000000000441f0ba00000000000000000000000000000000000000000000546f6b656e427269646765010000001e000000000000000000000000a31aa3fdb7af7db93d18dda4e19f811342edf780
|
||||
Sei (32) Testnet Token Bridge,01000000000100fdf85e77898de4280297f0b57428fa889c7968b87fb5a58a49b07e37cbfa365808c697cb21f85e9e8f9c8ac8d1daf7e8374d18665669d71350cb98bbf501a15c01000000010000000100010000000000000000000000000000000000000000000000000000000000000004000000000125b79800000000000000000000000000000000000000000000546f6b656e42726964676501000000209328673cb5de3fd99974cefbbd90fea033f4c59a572abfd7e1a4eebcc5d18157
|
||||
Scroll (34) Testnet Token Bridge,01000000000100efd128e6357466cda719db53dfa13f08951ddf7920d7d0c6c184d12736a843af4e0c5308496c71c8ff4979bbcf34899028a9d35607ff3ae6cdea437b5388cc800000000001000000010001000000000000000000000000000000000000000000000000000000000000000400000000038e084c00000000000000000000000000000000000000000000546f6b656e427269646765010000002200000000000000000000000022427d90b7da3fa4642f7025a854c7254e4e45bf
|
||||
Mantle (35) Testnet Token Bridge,0100000000010045b9ee7eb1c3a2c4d3d9425eab5daa2b1087a50276bb7e660d870995e9ce9a3b474acffe7c5c041a9ae621f4d0a63952d3cc65dd949b251caa23aa3037de22fd0000000001000000010001000000000000000000000000000000000000000000000000000000000000000400000000051cc47800000000000000000000000000000000000000000000546f6b656e427269646765010000002300000000000000000000000075bfa155a9d7a3714b0861c8a8af0c4633c45b5d
|
||||
Blast (36) Testnet Token Bridge,0100000000010052b4615add1ca354feb81a7f90b70a0d7839f0ee136c20ddc32c749a3471649f2a8f2f00d821a869a3283806f2d709ca83655b21785dbb21e60f02f93355ca730100000001000000010001000000000000000000000000000000000000000000000000000000000000000400000000058d8b3600000000000000000000000000000000000000000000546f6b656e4272696467650100000024000000000000000000000000430855b4d43b8aeb9d2b9869b74d58dda79c0db2
|
||||
XLayer (37) Testnet Token Bridge,01000000000100c983babda02e84e346e49f823aa201d65c82e19c51cdfb555cc9aa2fa6809f4500f6344d86722b1a8023906d185c96bc9b4e332402ae2e05ec69d0d95c39ea81000000000100000001000100000000000000000000000000000000000000000000000000000000000000040000000005b1293100000000000000000000000000000000000000000000546f6b656e4272696467650100000025000000000000000000000000da91a06299bbf302091b053c6b9ef86eff0f930d
|
||||
Linea (38) Testnet Token Bridge,01000000000100411f65a20405ad0d85d6718a91bc16cf645a7eb7dbd29d4b2d0b9cc2d872dc01112cf96dc40c07ddf648325a5dcdba42c70612179126178e7fb9e9bcfef1cb4a01000000010000000100010000000000000000000000000000000000000000000000000000000000000004000000000183785600000000000000000000000000000000000000000000546f6b656e4272696467650100000026000000000000000000000000c7a204bdbfe983fcd8d8e61d02b475d4073ff97e
|
||||
Berachain (39) Testnet Token Bridge,01000000000100c19d35faa10139fef5b3244f120efb67ad22d2d9ece7d777bcb6e957506ba9f15e2e6fd91a18dcdd6bf434d96d624fd725f957437f2e86dfdcbb6d0e97f3eeb100000000010000000100010000000000000000000000000000000000000000000000000000000000000004000000000404250300000000000000000000000000000000000000000000546f6b656e4272696467650100000027000000000000000000000000a10f2ef61de1f19f586ab8b6f2eba89bace63f7a
|
||||
Gateway (3104) Testnet Token Bridge,01000000000100117d1c7a124a9e2e29d82b3803b825be7c8a1dc7f19013669f7d11d42d448aa72339fe3657e4bd156c5c28dd10e78aab3e06e9e76c4bbd38c81e057533d577c40000000000d09296c5000100000000000000000000000000000000000000000000000000000000000000049ea4b9942b23298c20000000000000000000000000000000000000000000546f6b656e4272696467650100000c20ef5251ea1e99ae48732800ccc7b83b57881232a73eb796b63b1d86ed2ea44e27
|
||||
Sepolia (10002) (Ethereum) Testnet Token Bridge,01000000000100a03841125d40e9df3cd80d027bc660191755587980e49f6a46e9baa1b5c3f6b46e51256c225bd242139ae11d3c84439acdc204a5f39a2e1acb750ae98bb759f1000000000100000001000100000000000000000000000000000000000000000000000000000000000000040000000005491ea100000000000000000000000000000000000000000000546f6b656e4272696467650100002712000000000000000000000000db5492265f6038831e89f495670ff909ade94bd9
|
||||
Arbitrum Sepolia (10003) Testnet Token Bridge,010000000001001b0fbbcc7a3e8c491dc25f0a611075513032fe444d8e6585153e6ae2cf8c7514152b050e95a3e0af11e5b2705b2efb717bec3cfaa3b1617ff623c14e61a69224000000000100000001000100000000000000000000000000000000000000000000000000000000000000040000000001b8de3c00000000000000000000000000000000000000000000546f6b656e4272696467650100002713000000000000000000000000c7a204bdbfe983fcd8d8e61d02b475d4073ff97e
|
||||
Base Sepolia (10004) Testnet Token Bridge,01000000000100f566687b49d64d3bb4be559565e5f8c52644b4a207a3ea225ee8db63387bd1f3594761b3707353b762be6a78b8b2859f2580ab81dab4724e2981e6382545781f010000000100000001000100000000000000000000000000000000000000000000000000000000000000040000000004c2529a00000000000000000000000000000000000000000000546f6b656e427269646765010000271400000000000000000000000086f55a04690fd7815a3d802bd587e83ea888b239
|
||||
Optimism Sepolia (10005) Testnet Token Bridge,01000000000100119921cd92fcf87098e01d5c2a27aa8ddd4d265b04fa4887e7a381d114ba76ad79d57898e2f3e987954d1dcd483b9bb85dc8a8a10051495856c515c7e8c31ea5010000000100000001000100000000000000000000000000000000000000000000000000000000000000040000000000ba9d3800000000000000000000000000000000000000000000546f6b656e427269646765010000271500000000000000000000000099737ec4b815d816c49a385943baf0380e75c0ac
|
||||
Holesky (10006) Testnet Token Bridge,01000000000100f9f1351de8fd6e93cf06b83311794366ab672bc531dd6a2c1bed4b1ff5c78aef426ad3eb13938655f7152204feb7518886e08a0932f640b1268a4bf0307b485200000000010000000100010000000000000000000000000000000000000000000000000000000000000004000000000536ec0700000000000000000000000000000000000000000000546f6b656e427269646765010000271600000000000000000000000076d093bbae4529a342080546cafeec4acba59ec6
|
||||
Polygon Sepolia (10007) Testnet Token Bridge,0100000000010003411ae66d74fc6a6908844cc9e76cd8b463c7b940943cea67ae3fd64cc647817792a9645d1fc7c2037a975da620d702487c509aee1b32bbbe0d6393071f1d87000000000100000001000100000000000000000000000000000000000000000000000000000000000000040000000005e23d3100000000000000000000000000000000000000000000546f6b656e4272696467650100002717000000000000000000000000c7a204bdbfe983fcd8d8e61d02b475d4073ff97e
|
|
|
@ -3,4 +3,5 @@ lib/*
|
|||
!lib/README.md
|
||||
flattened
|
||||
ethers-contracts
|
||||
build-forge/
|
||||
build-forge/
|
||||
broadcast/
|
|
@ -13,7 +13,68 @@ wrapped non-ETH assets that are currently held on ETH.
|
|||
To build the contracts:
|
||||
`make build`
|
||||
|
||||
### Deploying
|
||||
### Deploying using Forge
|
||||
|
||||
#### Create the ENV file
|
||||
|
||||
Before you can deploy the contracts, you need to create a file in `ethereum/env` with a name like `.env.blast` for mainnet
|
||||
or `.env.blast.testnet` for testnet. Substitute the appropriate chain name (as it will be in the worm client) and use the
|
||||
mentioned one as an example.
|
||||
|
||||
#### Create a symbolic link
|
||||
|
||||
```shell
|
||||
ethereum$ ln -s env/.env.blast.testnet .env
|
||||
```
|
||||
|
||||
#### Deploy the Core contract
|
||||
|
||||
```shell
|
||||
ethereum$ MNEMONIC=<redacted> ./forge-scripts/deployCoreBridge.sh
|
||||
```
|
||||
|
||||
#### Deploy the TokenBridge contract
|
||||
|
||||
```shell
|
||||
ethereum$ MNEMONIC=<redacted> WORMHOLE_ADDRESS=<from_the_previous_command> ./forge-scripts/deployTokenBridge.sh
|
||||
```
|
||||
|
||||
#### Deploy the Core Shutdown contract
|
||||
|
||||
```shell
|
||||
ethereum$ MNEMONIC=<redacted> ./forge-scripts/deployCoreShutdown.sh
|
||||
```
|
||||
|
||||
#### Deploy the TokenBridge Shutdown contract
|
||||
|
||||
```shell
|
||||
ethereum$ MNEMONIC=<redacted> ./forge-scripts/deployTokenBridgeShutdown.sh
|
||||
```
|
||||
|
||||
#### Generate Flattened Source
|
||||
|
||||
To generated the flattened source files to verify the contracts using the explorer UI
|
||||
|
||||
```shell
|
||||
ethereum$ ./forge-scripts/flatten.sh
|
||||
```
|
||||
|
||||
This will put the flattened files in `ethereum/flattened`.
|
||||
|
||||
#### Upgrade the Core or TokenBridge Implementation
|
||||
|
||||
```shell
|
||||
ethereum$ MNEMONIC= ./forge-scripts/upgrade.sh testnet Core blast
|
||||
ethereum$ MNEMONIC= ./forge-scripts/upgrade.sh testnet TokenBridge blast
|
||||
```
|
||||
|
||||
#### Registering Other Chains on a New TokenBridge
|
||||
|
||||
```shell
|
||||
ethereum$ MNEMONIC= ./forge-scripts/registerAllChainsOnTokenBridge.sh.sh testnet blast
|
||||
```
|
||||
|
||||
### Deploying using Truffle (deprecated)
|
||||
|
||||
To deploy the bridge on Ethereum you first need to compile all smart contracts:
|
||||
`npx truffle compile`
|
||||
|
@ -52,12 +113,11 @@ chain address of the recipient, `target_chain` is the id of the chain to transfe
|
|||
`lockETH(bytes32 recipient, uint8 target_chain)` is a convenience function to wrap the Ether sent with the function call
|
||||
and transfer it as described in `lockAssets`.
|
||||
|
||||
|
||||
### Forge
|
||||
|
||||
Some tests and scripts use [Foundry](https://getfoundry.sh/). It can be installed via the official installer, or by running
|
||||
|
||||
``` sh
|
||||
```sh
|
||||
wormhole/ethereum $ ../scripts/install-foundry
|
||||
```
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
# Blast testnet env
|
||||
# Rename to .env to use with truffle migrations
|
||||
|
||||
# Common config for forge deployment
|
||||
RPC_URL=https://blast-sepolia.drpc.org
|
||||
|
||||
# Wormhole Core Migrations
|
||||
INIT_SIGNERS=["0x13947Bd48b18E53fdAeEe77F3473391aC727C638"]
|
||||
INIT_CHAIN_ID=36
|
|
@ -0,0 +1,87 @@
|
|||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity ^0.8.4;
|
||||
import {Implementation} from "../contracts/Implementation.sol";
|
||||
import {Setup} from "../contracts/Setup.sol";
|
||||
import {Wormhole} from "../contracts/Wormhole.sol";
|
||||
import "forge-std/Script.sol";
|
||||
|
||||
contract DeployCore is Script {
|
||||
// DryRun - Deploy the system
|
||||
// dry run: forge script ./forge-scripts/DeployCore.s.sol:DeployCore --sig "dryRun()" --rpc-url $RPC
|
||||
function dryRun(
|
||||
address[] memory initialSigners,
|
||||
uint16 chainId,
|
||||
uint16 governanceChainId,
|
||||
bytes32 governanceContract,
|
||||
uint256 evmChainId
|
||||
) public {
|
||||
_deploy(
|
||||
initialSigners,
|
||||
chainId,
|
||||
governanceChainId,
|
||||
governanceContract,
|
||||
evmChainId
|
||||
);
|
||||
}
|
||||
|
||||
// Deploy the system
|
||||
function run(
|
||||
address[] memory initialSigners,
|
||||
uint16 chainId,
|
||||
uint16 governanceChainId,
|
||||
bytes32 governanceContract,
|
||||
uint256 evmChainId
|
||||
)
|
||||
public
|
||||
returns (
|
||||
address deployedAddress,
|
||||
address setupAddress,
|
||||
address implAddress
|
||||
)
|
||||
{
|
||||
vm.startBroadcast();
|
||||
(deployedAddress, setupAddress, implAddress) = _deploy(
|
||||
initialSigners,
|
||||
chainId,
|
||||
governanceChainId,
|
||||
governanceContract,
|
||||
evmChainId
|
||||
);
|
||||
vm.stopBroadcast();
|
||||
}
|
||||
|
||||
function _deploy(
|
||||
address[] memory initialSigners,
|
||||
uint16 chainId,
|
||||
uint16 governanceChainId,
|
||||
bytes32 governanceContract,
|
||||
uint256 evmChainId
|
||||
)
|
||||
internal
|
||||
returns (
|
||||
address deployedAddress,
|
||||
address setupAddress,
|
||||
address implAddress
|
||||
)
|
||||
{
|
||||
Implementation impl = new Implementation();
|
||||
Setup setup = new Setup();
|
||||
|
||||
bytes memory initData = abi.encodeWithSignature(
|
||||
"setup(address,address[],uint16,uint16,bytes32,uint256)",
|
||||
address(impl),
|
||||
initialSigners,
|
||||
chainId,
|
||||
governanceChainId,
|
||||
governanceContract,
|
||||
evmChainId
|
||||
);
|
||||
|
||||
Wormhole wormhole = new Wormhole(
|
||||
address(setup),
|
||||
initData
|
||||
);
|
||||
|
||||
return (address(wormhole), address(setup), address(impl));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
|
||||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity ^0.8.4;
|
||||
import {Implementation} from "../contracts/Implementation.sol";
|
||||
import "forge-std/Script.sol";
|
||||
|
||||
contract DeployCoreImplementationOnly is Script {
|
||||
// DryRun - Deploy the system
|
||||
function dryRun() public {
|
||||
_deploy();
|
||||
}
|
||||
// Deploy the system
|
||||
function run() public returns (address deployedAddress) {
|
||||
vm.startBroadcast();
|
||||
deployedAddress = _deploy();
|
||||
vm.stopBroadcast();
|
||||
}
|
||||
function _deploy() internal returns (address deployedAddress) {
|
||||
Implementation impl = new Implementation();
|
||||
|
||||
return address(impl);
|
||||
|
||||
// TODO: initialize?
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
|
||||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity ^0.8.4;
|
||||
import {Shutdown} from "../contracts/Shutdown.sol";
|
||||
import "forge-std/Script.sol";
|
||||
|
||||
contract DeployCoreShutdown is Script {
|
||||
// DryRun - Deploy the system
|
||||
function dryRun() public {
|
||||
_deploy();
|
||||
}
|
||||
// Deploy the system
|
||||
function run() public returns (address deployedAddress) {
|
||||
vm.startBroadcast();
|
||||
deployedAddress = _deploy();
|
||||
vm.stopBroadcast();
|
||||
}
|
||||
function _deploy() internal returns (address deployedAddress) {
|
||||
Shutdown shutdown = new Shutdown();
|
||||
|
||||
return address(shutdown);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
|
||||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity ^0.8.13;
|
||||
import {NFTBridgeShutdown} from "../contracts/nft/NFTBridgeShutdown.sol";
|
||||
import "forge-std/Script.sol";
|
||||
|
||||
contract DeployNFTBridgeShutdown is Script {
|
||||
// DryRun - Deploy the system
|
||||
function dryRun() public {
|
||||
_deploy();
|
||||
}
|
||||
// Deploy the system
|
||||
function run() public returns (address deployedAddress) {
|
||||
vm.startBroadcast();
|
||||
deployedAddress = _deploy();
|
||||
vm.stopBroadcast();
|
||||
}
|
||||
function _deploy() internal returns (address deployedAddress) {
|
||||
NFTBridgeShutdown shutdown = new NFTBridgeShutdown();
|
||||
|
||||
return address(shutdown);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity ^0.8.4;
|
||||
import {BridgeImplementation} from "../contracts/bridge/BridgeImplementation.sol";
|
||||
import {BridgeSetup} from "../contracts/bridge/BridgeSetup.sol";
|
||||
import {TokenImplementation} from "../contracts/bridge/token/TokenImplementation.sol";
|
||||
import {TokenBridge} from "../contracts/bridge/TokenBridge.sol";
|
||||
import "forge-std/Script.sol";
|
||||
|
||||
contract DeployTokenBridge is Script {
|
||||
TokenImplementation tokenImpl;
|
||||
BridgeSetup bridgeSetup;
|
||||
BridgeImplementation bridgeImpl;
|
||||
|
||||
function dryRun(
|
||||
uint16 chainId,
|
||||
uint16 governanceChainId,
|
||||
bytes32 governanceContract,
|
||||
address weth,
|
||||
uint8 finality,
|
||||
uint256 evmChainId,
|
||||
address wormhole
|
||||
) public {
|
||||
_deploy(
|
||||
chainId,
|
||||
governanceChainId,
|
||||
governanceContract,
|
||||
weth,
|
||||
finality,
|
||||
evmChainId,
|
||||
wormhole
|
||||
);
|
||||
}
|
||||
|
||||
function run(
|
||||
uint16 chainId,
|
||||
uint16 governanceChainId,
|
||||
bytes32 governanceContract,
|
||||
address weth,
|
||||
uint8 finality,
|
||||
uint256 evmChainId,
|
||||
address wormhole
|
||||
)
|
||||
public
|
||||
returns (
|
||||
address deployedAddress,
|
||||
address tokenImplementationAddress,
|
||||
address bridgeSetupAddress,
|
||||
address bridgeImplementationAddress
|
||||
)
|
||||
{
|
||||
vm.startBroadcast();
|
||||
(
|
||||
deployedAddress,
|
||||
tokenImplementationAddress,
|
||||
bridgeSetupAddress,
|
||||
bridgeImplementationAddress
|
||||
) = _deploy(
|
||||
chainId,
|
||||
governanceChainId,
|
||||
governanceContract,
|
||||
weth,
|
||||
finality,
|
||||
evmChainId,
|
||||
wormhole
|
||||
);
|
||||
vm.stopBroadcast();
|
||||
}
|
||||
|
||||
function _deploy(
|
||||
uint16 chainId,
|
||||
uint16 governanceChainId,
|
||||
bytes32 governanceContract,
|
||||
address weth,
|
||||
uint8 finality,
|
||||
uint256 evmChainId,
|
||||
address wormhole
|
||||
)
|
||||
internal
|
||||
returns (
|
||||
address deployedAddress,
|
||||
address tokenImplementationAddress,
|
||||
address bridgeSetupAddress,
|
||||
address bridgeImplementationAddress
|
||||
)
|
||||
{
|
||||
tokenImpl = new TokenImplementation();
|
||||
bridgeSetup = new BridgeSetup();
|
||||
bridgeImpl = new BridgeImplementation();
|
||||
|
||||
TokenBridge tokenBridge = new TokenBridge(
|
||||
address(bridgeSetup),
|
||||
abi.encodeWithSignature(
|
||||
"setup(address,uint16,address,uint16,bytes32,address,address,uint8,uint256)",
|
||||
address(bridgeImpl),
|
||||
chainId,
|
||||
wormhole,
|
||||
governanceChainId,
|
||||
governanceContract,
|
||||
address(tokenImpl),
|
||||
weth,
|
||||
finality,
|
||||
evmChainId
|
||||
)
|
||||
);
|
||||
|
||||
return (
|
||||
address(tokenBridge),
|
||||
address(tokenImpl),
|
||||
address(bridgeSetup),
|
||||
address(bridgeImpl)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
|
||||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity ^0.8.4;
|
||||
import {BridgeImplementation} from "../contracts/bridge/BridgeImplementation.sol";
|
||||
import "forge-std/Script.sol";
|
||||
|
||||
contract DeployTokenBridgeImplementationOnly is Script {
|
||||
// DryRun - Deploy the system
|
||||
function dryRun() public {
|
||||
_deploy();
|
||||
}
|
||||
// Deploy the system
|
||||
function run() public returns (address deployedAddress) {
|
||||
vm.startBroadcast();
|
||||
deployedAddress = _deploy();
|
||||
vm.stopBroadcast();
|
||||
}
|
||||
function _deploy() internal returns (address deployedAddress) {
|
||||
BridgeImplementation impl = new BridgeImplementation();
|
||||
|
||||
return address(impl);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
|
||||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity ^0.8.4;
|
||||
import {BridgeShutdown} from "../contracts/bridge/BridgeShutdown.sol";
|
||||
import "forge-std/Script.sol";
|
||||
|
||||
contract DeployTokenBridgeShutdown is Script {
|
||||
// DryRun - Deploy the system
|
||||
function dryRun() public {
|
||||
_deploy();
|
||||
}
|
||||
// Deploy the system
|
||||
function run() public returns (address deployedAddress) {
|
||||
vm.startBroadcast();
|
||||
deployedAddress = _deploy();
|
||||
vm.stopBroadcast();
|
||||
}
|
||||
function _deploy() internal returns (address deployedAddress) {
|
||||
BridgeShutdown shutdown = new BridgeShutdown();
|
||||
|
||||
return address(shutdown);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
|
||||
|
||||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity ^0.8.4;
|
||||
import {ITokenBridge} from "../contracts/bridge/interfaces/ITokenBridge.sol";
|
||||
import "forge-std/Script.sol";
|
||||
|
||||
contract RegisterChainsTokenBridge is Script {
|
||||
// DryRun - Register chains
|
||||
// dry run: forge script RegisterChainsTokenBridge --sig "dryRun(address,bytes[])" --rpc-url $RPC
|
||||
function dryRun(address tokenBridge, bytes[] memory registrationVaas) public {
|
||||
_registerChains(tokenBridge, registrationVaas);
|
||||
}
|
||||
// Register chains
|
||||
// forge script RegisterChainsTokenBridge --sig "run(address,bytes[])" --rpc-url $RPC --private-key $RAW_PRIVATE_KEY --broadcast
|
||||
function run(address tokenBridge, bytes[] memory registrationVaas) public {
|
||||
vm.startBroadcast();
|
||||
_registerChains(tokenBridge, registrationVaas);
|
||||
vm.stopBroadcast();
|
||||
}
|
||||
|
||||
function _registerChains(address tokenBridge, bytes[] memory registrationVaas) internal {
|
||||
ITokenBridge tokenBridgeContract = ITokenBridge(tokenBridge);
|
||||
uint256 len = registrationVaas.length;
|
||||
for(uint256 i=0; i<len; i++) {
|
||||
tokenBridgeContract.registerChain(registrationVaas[i]);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
|
||||
# MNEMONIC=<redacted> ./forge-scripts/deployCoreBridge.sh
|
||||
|
||||
. .env
|
||||
|
||||
[[ -z $INIT_SIGNERS ]] && { echo "Missing INIT_SIGNERS"; exit 1; }
|
||||
[[ -z $INIT_CHAIN_ID ]] && { echo "Missing INIT_CHAIN_ID"; exit 1; }
|
||||
[[ -z $INIT_GOV_CHAIN_ID ]] && { echo "Missing INIT_GOV_CHAIN_ID"; exit 1; }
|
||||
[[ -z $INIT_GOV_CONTRACT ]] && { echo "Missing INIT_GOV_CONTRACT"; exit 1; }
|
||||
[[ -z $INIT_EVM_CHAIN_ID ]] && { echo "Missing INIT_EVM_CHAIN_ID"; exit 1; }
|
||||
|
||||
[[ -z $MNEMONIC ]] && { echo "Missing MNEMONIC"; exit 1; }
|
||||
[[ -z $RPC_URL ]] && { echo "Missing RPC_URL"; exit 1; }
|
||||
|
||||
forge script ./forge-scripts/DeployCore.s.sol:DeployCore \
|
||||
--sig "run(address[],uint16,uint16,bytes32,uint256)" $INIT_SIGNERS $INIT_CHAIN_ID $INIT_GOV_CHAIN_ID $INIT_GOV_CONTRACT $INIT_EVM_CHAIN_ID \
|
||||
--rpc-url "$RPC_URL" \
|
||||
--private-key "$MNEMONIC" \
|
||||
--broadcast ${FORGE_ARGS}
|
||||
|
||||
returnInfo=$(cat ./broadcast/DeployCore.s.sol/$INIT_EVM_CHAIN_ID/run-latest.json)
|
||||
# Extract the address values from 'returnInfo'
|
||||
WORMHOLE_ADDRESS=$(jq -r '.returns.deployedAddress.value' <<< "$returnInfo")
|
||||
SETUP_ADDRESS=$(jq -r '.returns.setupAddress.value' <<< "$returnInfo")
|
||||
IMPLEMENTATION_ADDRESS=$(jq -r '.returns.implAddress.value' <<< "$returnInfo")
|
||||
|
||||
echo "-- Wormhole Core Addresses --------------------------------------------------"
|
||||
echo "| Setup address | $SETUP_ADDRESS |"
|
||||
echo "| Implementation address | $IMPLEMENTATION_ADDRESS |"
|
||||
echo "| Wormhole address | $WORMHOLE_ADDRESS |"
|
||||
echo "-----------------------------------------------------------------------------"
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
# MNEMONIC=<redacted> ./forge-scripts/deployCoreShutdown.sh
|
||||
|
||||
. .env
|
||||
|
||||
[[ -z $INIT_EVM_CHAIN_ID ]] && { echo "Missing INIT_EVM_CHAIN_ID"; exit 1; }
|
||||
|
||||
[[ -z $MNEMONIC ]] && { echo "Missing MNEMONIC"; exit 1; }
|
||||
[[ -z $RPC_URL ]] && { echo "Missing RPC_URL"; exit 1; }
|
||||
|
||||
forge script ./forge-scripts/DeployCoreShutdown.s.sol:DeployCoreShutdown \
|
||||
--rpc-url "$RPC_URL" \
|
||||
--private-key "$MNEMONIC" \
|
||||
--broadcast ${FORGE_ARGS}
|
||||
|
||||
returnInfo=$(cat ./broadcast/DeployCoreShutdown.s.sol/$INIT_EVM_CHAIN_ID/run-latest.json)
|
||||
# Extract the address values from 'returnInfo'
|
||||
SHUTDOWN_ADDRESS=$(jq -r '.returns.deployedAddress.value' <<< "$returnInfo")
|
||||
|
||||
echo "Wormhole Core Shutdown address: $SHUTDOWN_ADDRESS"
|
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
|
||||
# MNEMONIC=<redacted> WORMHOLE_ADDRESS=<from_the_previous_command> ./forge-scripts/deployTokenBridge.sh
|
||||
|
||||
. .env
|
||||
|
||||
[[ -z $INIT_EVM_CHAIN_ID ]] && { echo "Missing INIT_EVM_CHAIN_ID"; exit 1; }
|
||||
|
||||
[[ -z $BRIDGE_INIT_CHAIN_ID ]] && { echo "Missing BRIDGE_INIT_CHAIN_ID"; exit 1; }
|
||||
[[ -z $BRIDGE_INIT_GOV_CHAIN_ID ]] && { echo "Missing BRIDGE_INIT_GOV_CHAIN_ID"; exit 1; }
|
||||
[[ -z $BRIDGE_INIT_GOV_CONTRACT ]] && { echo "Missing BRIDGE_INIT_GOV_CONTRACT"; exit 1; }
|
||||
[[ -z $BRIDGE_INIT_WETH ]] && { echo "Missing BRIDGE_INIT_WETH"; exit 1; }
|
||||
[[ -z $BRIDGE_INIT_FINALITY ]] && { echo "Missing BRIDGE_INIT_FINALITY"; exit 1; }
|
||||
|
||||
[[ -z $WORMHOLE_ADDRESS ]] && { echo "Missing WORMHOLE_ADDRESS"; exit 1; }
|
||||
|
||||
[[ -z $MNEMONIC ]] && { echo "Missing MNEMONIC"; exit 1; }
|
||||
[[ -z $RPC_URL ]] && { echo "Missing RPC_URL"; exit 1; }
|
||||
|
||||
forge script ./forge-scripts/DeployTokenBridge.s.sol:DeployTokenBridge \
|
||||
--sig "run(uint16,uint16,bytes32,address,uint8,uint256,address)" $BRIDGE_INIT_CHAIN_ID $BRIDGE_INIT_GOV_CHAIN_ID $BRIDGE_INIT_GOV_CONTRACT $BRIDGE_INIT_WETH $BRIDGE_INIT_FINALITY $INIT_EVM_CHAIN_ID $WORMHOLE_ADDRESS \
|
||||
--rpc-url "$RPC_URL" \
|
||||
--private-key "$MNEMONIC" \
|
||||
--broadcast ${FORGE_ARGS}
|
||||
|
||||
returnInfo=$(cat ./broadcast/DeployTokenBridge.s.sol/$INIT_EVM_CHAIN_ID/run-latest.json)
|
||||
# Extract the address values from 'returnInfo'
|
||||
TOKEN_BRIDGE_ADDRESS=$(jq -r '.returns.deployedAddress.value' <<< "$returnInfo")
|
||||
TOKEN_IMPLEMENTATION_ADDRESS=$(jq -r '.returns.tokenImplementationAddress.value' <<< "$returnInfo")
|
||||
TOKEN_BRIDGE_SETUP_ADDRESS=$(jq -r '.returns.bridgeSetupAddress.value' <<< "$returnInfo")
|
||||
TOKEN_BRIDGE_IMPLEMENTATION_ADDRESS=$(jq -r '.returns.bridgeImplementationAddress.value' <<< "$returnInfo")
|
||||
|
||||
echo "-- TokenBridge Addresses ----------------------------------------------------"
|
||||
echo "| Token Implementation address | $TOKEN_IMPLEMENTATION_ADDRESS |"
|
||||
echo "| BridgeSetup address | $TOKEN_BRIDGE_SETUP_ADDRESS |"
|
||||
echo "| BridgeImplementation address | $TOKEN_BRIDGE_IMPLEMENTATION_ADDRESS |"
|
||||
echo "| TokenBridge address | $TOKEN_BRIDGE_ADDRESS |"
|
||||
echo "-----------------------------------------------------------------------------"
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
# MNEMONIC=<redacted> ./forge-scripts/deployTokenBridgeShutdown.sh
|
||||
|
||||
. .env
|
||||
|
||||
[[ -z $INIT_EVM_CHAIN_ID ]] && { echo "Missing INIT_EVM_CHAIN_ID"; exit 1; }
|
||||
|
||||
[[ -z $MNEMONIC ]] && { echo "Missing MNEMONIC"; exit 1; }
|
||||
[[ -z $RPC_URL ]] && { echo "Missing RPC_URL"; exit 1; }
|
||||
|
||||
forge script ./forge-scripts/DeployTokenBridgeShutdown.s.sol:DeployTokenBridgeShutdown \
|
||||
--rpc-url "$RPC_URL" \
|
||||
--private-key "$MNEMONIC" \
|
||||
--broadcast ${FORGE_ARGS}
|
||||
|
||||
returnInfo=$(cat ./broadcast/DeployTokenBridgeShutdown.s.sol/$INIT_EVM_CHAIN_ID/run-latest.json)
|
||||
# Extract the address values from 'returnInfo'
|
||||
SHUTDOWN_ADDRESS=$(jq -r '.returns.deployedAddress.value' <<< "$returnInfo")
|
||||
|
||||
echo "TokenBridge Shutdown address: $SHUTDOWN_ADDRESS"
|
|
@ -0,0 +1,17 @@
|
|||
rm -rf flattened
|
||||
mkdir flattened
|
||||
for fileName in \
|
||||
contracts/Wormhole.sol \
|
||||
contracts/Implementation.sol \
|
||||
contracts/bridge/token/Token.sol \
|
||||
contracts/bridge/token/TokenImplementation.sol \
|
||||
contracts/bridge/BridgeImplementation.sol \
|
||||
contracts/bridge/TokenBridge.sol \
|
||||
contracts/nft/token/NFTImplementation.sol \
|
||||
contracts/nft/NFTBridgeImplementation.sol \
|
||||
contracts/nft/NFTBridgeEntrypoint.sol
|
||||
do
|
||||
echo $fileName
|
||||
flattened=flattened/`basename $fileName`
|
||||
forge flatten --output $flattened $fileName
|
||||
done
|
|
@ -0,0 +1,105 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This script registers all the token bridges listed in the deployment file on the specified chain.
|
||||
|
||||
# Note that this script skips registering the specified chain on itself, but it does expect to
|
||||
# find a VAA for that chain in the CSV file (as a sanity check). Please be sure to generate
|
||||
# the registation VAA for this chain and add it to the file before running this script.
|
||||
|
||||
# MNEMONIC=<redacted> ./forge-scripts/registerAllChainsOnTokenBridge.sh testnet blast
|
||||
|
||||
if [ $# != 2 ]; then
|
||||
echo "Usage: $0 testnet blast" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[[ -z $MNEMONIC ]] && { echo "Missing MNEMONIC"; exit 1; }
|
||||
|
||||
network=$1
|
||||
chain=$2
|
||||
|
||||
# Figure out which file of VAAs to use.
|
||||
input_file=""
|
||||
case "$network" in
|
||||
mainnet)
|
||||
input_file="../deployments/mainnet/tokenBridgeVAAs.csv"
|
||||
;;
|
||||
testnet)
|
||||
input_file="../deployments/testnet/tokenBridgeVAAs.csv"
|
||||
;;
|
||||
*) echo "unknown network $network, must be testnet or mainnet" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Use the worm cli to get the chain parameters.
|
||||
if ! command -v worm &> /dev/null
|
||||
then
|
||||
echo "worm binary could not be found. See installation instructions in clients/js/README.md"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
chain_id=$(worm info chain-id "$chain")
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\nERROR: failed to look up the chain id for ${chain}, please make sure the worm binary is current!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rpc_url=$(worm info rpc "$network" "$chain")
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\nERROR: failed to look up the RPC for ${chain}, please make sure the worm binary is current!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
token_bridge_address=$(worm info contract "$network" "$chain" TokenBridge)
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\nERROR: failed to look up the token bridge address for ${chain}, please make sure the worm binary is current!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Build one long string of all the vaas in the input file.
|
||||
vaas=""
|
||||
found_us=0
|
||||
count=0
|
||||
while IFS= read -r line
|
||||
do
|
||||
# Skip comment lines.
|
||||
echo $line | grep "^#" > /dev/null
|
||||
if [ $? == 0 ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
tag=`echo $line | cut -d, -f1`
|
||||
vaa=`echo $line | cut -d, -f2`
|
||||
|
||||
# Skip this chain. (We don't want to register this chain on itself.)
|
||||
echo $tag | grep "(${chain_id})" > /dev/null
|
||||
if [ $? == 0 ]; then
|
||||
found_us=1
|
||||
continue
|
||||
fi
|
||||
|
||||
# The VAAs should be comma separated.
|
||||
if ! [ -z "${vaas}" ]; then
|
||||
vaas="${vaas},"
|
||||
fi
|
||||
|
||||
vaas="${vaas}0x${vaa}"
|
||||
count=$(($count+1))
|
||||
done < "$input_file"
|
||||
|
||||
if [ $found_us == 0 ]; then
|
||||
echo "ERROR: failed to find chain id ${chain_id} in ${input_file}, something is not right!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Make it look like an array.
|
||||
vaas="[${vaas}]"
|
||||
echo $vaas
|
||||
|
||||
echo "Submitting ${count} VAAs to ${network} ${chain} token bridge at address ${token_bridge_address} and rpc ${rpc_url}"
|
||||
forge script ./forge-scripts/RegisterChainsTokenBridge.s.sol:RegisterChainsTokenBridge \
|
||||
--sig "run(address,bytes[])" $token_bridge_address $vaas \
|
||||
--rpc-url $rpc_url \
|
||||
--private-key $MNEMONIC \
|
||||
--broadcast
|
|
@ -0,0 +1,82 @@
|
|||
#!/bin/bash
|
||||
|
||||
#MNEMONIC= ./forge-scripts/upgrade.sh testnet Core blast
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
network=$1
|
||||
module=$2
|
||||
chain=$3
|
||||
|
||||
SCRIPT=""
|
||||
verify_module=""
|
||||
case "$module" in
|
||||
Core)
|
||||
SCRIPT="DeployCoreImplementationOnly.s.sol:DeployCoreImplementationOnly"
|
||||
FILE="build-forge/Implementation.sol/Implementation.json"
|
||||
verify_module="core"
|
||||
;;
|
||||
TokenBridge)
|
||||
SCRIPT="DeployTokenBridgeImplementationOnly.s.sol:DeployTokenBridgeImplementationOnly"
|
||||
FILE="build-forge/BridgeImplementation.sol/BridgeImplementation.json"
|
||||
verify_module="token_bridge"
|
||||
;;
|
||||
NFTBridge)
|
||||
echo "NFT bridge is not currently supported" >&2
|
||||
exit 1
|
||||
;;
|
||||
*) echo "unknown module $module" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
ENV_FILE="env/.env.${chain}"
|
||||
if [ "$network" = testnet ]; then
|
||||
ENV_FILE="${ENV_FILE}.testnet"
|
||||
fi
|
||||
|
||||
if ! [ -f ./$ENV_FILE ]; then
|
||||
echo "Environment file \"${ENV_FILE}\" does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
. ./$ENV_FILE
|
||||
|
||||
[[ -z $INIT_EVM_CHAIN_ID ]] && { echo "Missing INIT_EVM_CHAIN_ID"; exit 1; }
|
||||
[[ -z $MNEMONIC ]] && { echo "Missing MNEMONIC"; exit 1; }
|
||||
|
||||
if [ -z ${RPC_URL+x} ]; then
|
||||
ret=0
|
||||
RPC_URL=$(worm info rpc "$network" "$chain" 2>/dev/null) || ret=$?
|
||||
if [ $ret != 0 ]; then
|
||||
echo "Missing RPC_URL and \"worm info rpc\" does not support this chain."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
ret=0
|
||||
implementation=$(worm evm info -c "$chain" -m "$module" -n "$network" -i 2>/dev/null) || ret=$?
|
||||
|
||||
if [ $ret != 0 ]; then
|
||||
printf "☐ %s %s: skipping (no deployment available)\n" "$chain" "$module"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ret=0
|
||||
(./verify -n "$network" -c "$chain" $FILE "$implementation" > /dev/null) || ret=$?
|
||||
|
||||
if [ $ret = 0 ]; then
|
||||
printf "✔ %s %s: skipping (implementation matches same bytecode)\n" "$chain" "$module"
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "Implementation: ${implementation}"
|
||||
echo "ret: ${ret}"
|
||||
|
||||
exit 0
|
||||
|
||||
|
||||
forge script ./forge-scripts/${SCRIPT} \
|
||||
--rpc-url "$RPC_URL" \
|
||||
--private-key "$MNEMONIC" \
|
||||
--broadcast --slow
|
|
@ -1,5 +1,5 @@
|
|||
[profile.default]
|
||||
solc_version = "0.8.19"
|
||||
solc_version = "0.8.4"
|
||||
optimizer = true
|
||||
optimizer_runs = 200
|
||||
via_ir = false
|
||||
|
@ -7,7 +7,7 @@ src = "contracts"
|
|||
# We put the tests into the forge-test directory (instead of test) so that
|
||||
# truffle doesn't try to build them
|
||||
test = "forge-test"
|
||||
evm_version = "london"
|
||||
evm_version = "istanbul"
|
||||
|
||||
out = 'build-forge'
|
||||
libs = ['lib', 'node_modules']
|
||||
|
@ -24,8 +24,4 @@ line_length = 100
|
|||
multiline_func_header = "params_first"
|
||||
# wrap_comments = true
|
||||
|
||||
|
||||
[profile.production]
|
||||
via_ir = true
|
||||
|
||||
# See more config options https://github.com/foundry-rs/foundry/tree/master/config
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
},
|
||||
"scripts": {
|
||||
"build:core": "truffle compile",
|
||||
"build:forge": "if [ \"$DEV\" = \"True\" ]; then forge build; else forge build --via-ir; fi",
|
||||
"build:forge": "forge build",
|
||||
"build": "npm run build:core && npm run build:forge && typechain --target=ethers-v5 --out-dir=./ethers-contracts \"build-forge/!(test).sol/*.json\"",
|
||||
"test": "npm run build:core && mkdir -p build/contracts && cp node_modules/@openzeppelin/contracts/build/contracts/* build/contracts/ && truffle test --network test --compile-none",
|
||||
"migrate": "npm run build:core && mkdir -p build/contracts && cp node_modules/@openzeppelin/contracts/build/contracts/* build/contracts/ && truffle migrate --to 4 --compile-none",
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
function usage() {
|
||||
cat <<EOF >&2
|
||||
Usage:
|
||||
|
@ -48,6 +46,16 @@ shift $((OPTIND - 1))
|
|||
json_file=$1
|
||||
contract_addr=$2
|
||||
|
||||
# See if they specified the forge output. Do this before we set the error handling flags because
|
||||
# this pipeline will intentionally fail if they are using the truffle build output.
|
||||
use_forge=""
|
||||
echo "$json_file" | grep "build-forge" > /dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
use_forge="true"
|
||||
fi
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# network and rpc flags are mutually exlusive
|
||||
[[ -n $network && -n $rpc ]] && usage
|
||||
|
||||
|
@ -71,7 +79,11 @@ fi
|
|||
deployed=$(mktemp)
|
||||
local=$(mktemp)
|
||||
|
||||
cat "$json_file" | jq -r .deployedBytecode > "$local"
|
||||
if [[ -z $use_forge ]]; then
|
||||
cat "$json_file" | jq -r .deployedBytecode > "$local"
|
||||
else
|
||||
cat "$json_file" | jq -r .deployedBytecode | jq -r .object > "$local"
|
||||
fi
|
||||
|
||||
ret=0
|
||||
# Grab bytecode from the JSON RPC using the eth_getCode method.
|
||||
|
|
|
@ -1,2 +1,5 @@
|
|||
/lib/
|
||||
/ethers-contracts/
|
||||
/broadcast/
|
||||
/build-forge/
|
||||
/cache/
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity ^0.8.4;
|
||||
import {PublishMsg} from "../contracts/PublishMsg.sol";
|
||||
import "forge-std/Script.sol";
|
||||
|
||||
contract DeployPublishMsg is Script {
|
||||
function dryRun(
|
||||
address wormhole
|
||||
) public {
|
||||
_deploy(
|
||||
wormhole
|
||||
);
|
||||
}
|
||||
|
||||
function run(
|
||||
address wormhole
|
||||
)
|
||||
public
|
||||
returns (
|
||||
address deployedAddress
|
||||
)
|
||||
{
|
||||
vm.startBroadcast();
|
||||
(
|
||||
deployedAddress
|
||||
) = _deploy(
|
||||
wormhole
|
||||
);
|
||||
vm.stopBroadcast();
|
||||
}
|
||||
|
||||
function _deploy(
|
||||
address wormhole
|
||||
)
|
||||
internal
|
||||
returns (
|
||||
address deployedAddress
|
||||
)
|
||||
{
|
||||
PublishMsg publishMsg = new PublishMsg(wormhole);
|
||||
|
||||
return (
|
||||
address(publishMsg)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
|
||||
forge install foundry-rs/forge-std@v1.5.5 --no-git --no-commit
|
||||
forge install openzeppelin/openzeppelin-contracts@0457042d93d9dfd760dbaa06a4d2f1216fdbe297 --no-git --no-commit
|
||||
rm contracts/DoubleTransfer.sol
|
||||
|
||||
# MNEMONIC= RPC_URL= EVM_CHAIN_ID= WORMHOLE_ADDRESS= ./forge-scripts/deployPublishMsg.sh
|
||||
|
||||
[[ -z $MNEMONIC ]] && { echo "Missing MNEMONIC"; exit 1; }
|
||||
[[ -z $RPC_URL ]] && { echo "Missing RPC_URL"; exit 1; }
|
||||
[[ -z $EVM_CHAIN_ID ]] && { echo "Missing EVM_CHAIN_ID"; exit 1; }
|
||||
[[ -z $WORMHOLE_ADDRESS ]] && { echo "Missing WORMHOLE_ADDRESS"; exit 1; }
|
||||
|
||||
forge script ./forge-scripts/DeployPublishMsg.s.sol:DeployPublishMsg \
|
||||
--sig "run(address)" $WORMHOLE_ADDRESS \
|
||||
--rpc-url "$RPC_URL" \
|
||||
--private-key "$MNEMONIC" \
|
||||
--verifier-url 'https://api.routescan.io/v2/network/testnet/evm/${EVM_CHAIN_ID}/etherscan' \
|
||||
--etherscan-api-key "verifyContract" \
|
||||
--broadcast
|
||||
|
||||
returnInfo=$(cat ./broadcast/DeployPublishMsg.s.sol/$EVM_CHAIN_ID/run-latest.json)
|
||||
# Extract the address values from 'returnInfo'
|
||||
PUBLISH_MSG_ADDRESS=$(jq -r '.returns.deployedAddress.value' <<< "$returnInfo")
|
||||
|
||||
echo "Deployed PublishMsg to ${PUBLISH_MSG_ADDRESS} using core at ${WORMHOLE_ADDRESS}."
|
Loading…
Reference in New Issue