Tilt : Deploy with forge instead of truffle (#3877)
* Tilt: Deploy with Forge instead of Truffle * Move shell scripts
This commit is contained in:
parent
b0f1bd06ea
commit
db9f33a816
|
@ -54,7 +54,7 @@ spec:
|
|||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- "cd ../../ethereum && npm run migrate && npx truffle exec scripts/deploy_test_token.js && npx truffle exec scripts/register_all_chains.js && cd ../relayer/ethereum && npm run deploy-relayers-evm1 && nc -lkn 2000"
|
||||
- "cd ../../ethereum && CHAIN_ID=2 NETWORK=devnet ./sh/devnetInitialization.sh && cd ../relayer/ethereum && npm run deploy-relayers-evm1 && nc -lkn 2000"
|
||||
readinessProbe:
|
||||
periodSeconds: 1
|
||||
failureThreshold: 300
|
||||
|
|
|
@ -55,7 +55,7 @@ spec:
|
|||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- "cd ../../ethereum && sed -i 's/CHAIN_ID=0x2/CHAIN_ID=0x4/g;s/EVM_CHAIN_ID=1337/EVM_CHAIN_ID=1397/g' .env && npm run migrate && npx truffle exec scripts/deploy_test_token.js && npx truffle exec scripts/register_all_chains.js && cd ../relayer/ethereum && sed -i 's/CHAIN_ID=0x2/CHAIN_ID=0x4/g;s/EVM_CHAIN_ID=1337/EVM_CHAIN_ID=1397/g' .env && npm run deploy-relayers-evm2 && nc -lkn 2000"
|
||||
- "cd ../../ethereum && sed -i 's/CHAIN_ID=0x2/CHAIN_ID=0x4/g;s/EVM_CHAIN_ID=1337/EVM_CHAIN_ID=1397/g' .env && NETWORK=devnet ./sh/devnetInitialization.sh && cd ../relayer/ethereum && npm run deploy-relayers-evm2 && nc -lkn 2000"
|
||||
readinessProbe:
|
||||
periodSeconds: 1
|
||||
failureThreshold: 300
|
||||
|
|
|
@ -13,6 +13,8 @@ RUN curl -L https://foundry.paradigm.xyz | bash
|
|||
RUN $HOME/.foundry/bin/foundryup
|
||||
RUN ls $HOME/.foundry/bin
|
||||
|
||||
RUN apt-get -y install jq
|
||||
|
||||
# Run as user, otherwise, npx explodes.
|
||||
RUN mv /root/.foundry/bin/anvil /bin/anvil
|
||||
RUN mv /root/.foundry/bin/forge /bin/forge
|
||||
|
|
|
@ -49,11 +49,7 @@ build: forge_dependencies node_modules ${SOURCE_FILES}
|
|||
|
||||
|
||||
flattened/%.sol: contracts/%.sol node_modules
|
||||
@mkdir -p $(dir $@)
|
||||
# We remove the license (SPDX) lines and ABIEncoderV2 lines because they
|
||||
# break compilation in the flattened file if there are multiple conflicting
|
||||
# declarations.
|
||||
npx truffle-flattener $< | grep -v SPDX | grep -v ABIEncoderV2 > $@
|
||||
./sh/flatten.sh
|
||||
|
||||
.PHONY: flattened
|
||||
flattened: $(patsubst contracts/%, flattened/%, $(FLATTEN_FILES))
|
||||
|
|
|
@ -30,25 +30,25 @@ ethereum$ ln -s env/.env.blast.testnet .env
|
|||
#### Deploy the Core contract
|
||||
|
||||
```shell
|
||||
ethereum$ MNEMONIC=<redacted> ./forge-scripts/deployCoreBridge.sh
|
||||
ethereum$ MNEMONIC=<redacted> ./sh/deployCoreBridge.sh
|
||||
```
|
||||
|
||||
#### Deploy the TokenBridge contract
|
||||
|
||||
```shell
|
||||
ethereum$ MNEMONIC=<redacted> WORMHOLE_ADDRESS=<from_the_previous_command> ./forge-scripts/deployTokenBridge.sh
|
||||
ethereum$ MNEMONIC=<redacted> WORMHOLE_ADDRESS=<from_the_previous_command> ./sh/deployTokenBridge.sh
|
||||
```
|
||||
|
||||
#### Deploy the Core Shutdown contract
|
||||
|
||||
```shell
|
||||
ethereum$ MNEMONIC=<redacted> ./forge-scripts/deployCoreShutdown.sh
|
||||
ethereum$ MNEMONIC=<redacted> ./sh/deployCoreShutdown.sh
|
||||
```
|
||||
|
||||
#### Deploy the TokenBridge Shutdown contract
|
||||
|
||||
```shell
|
||||
ethereum$ MNEMONIC=<redacted> ./forge-scripts/deployTokenBridgeShutdown.sh
|
||||
ethereum$ MNEMONIC=<redacted> ./sh/deployTokenBridgeShutdown.sh
|
||||
```
|
||||
|
||||
#### Generate Flattened Source
|
||||
|
@ -56,7 +56,7 @@ ethereum$ MNEMONIC=<redacted> ./forge-scripts/deployTokenBridgeShutdown.sh
|
|||
To generated the flattened source files to verify the contracts using the explorer UI
|
||||
|
||||
```shell
|
||||
ethereum$ ./forge-scripts/flatten.sh
|
||||
ethereum$ ./sh/flatten.sh
|
||||
```
|
||||
|
||||
This will put the flattened files in `ethereum/flattened`.
|
||||
|
@ -64,14 +64,14 @@ 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
|
||||
ethereum$ MNEMONIC= ./sh/upgrade.sh testnet Core blast
|
||||
ethereum$ MNEMONIC= ./sh/upgrade.sh testnet TokenBridge blast
|
||||
```
|
||||
|
||||
#### Registering Other Chains on a New TokenBridge
|
||||
|
||||
```shell
|
||||
ethereum$ MNEMONIC= ./forge-scripts/registerAllChainsOnTokenBridge.sh.sh testnet blast
|
||||
ethereum$ MNEMONIC= ./sh/registerAllChainsOnTokenBridge.sh.sh testnet blast
|
||||
```
|
||||
|
||||
### Deploying using Truffle (deprecated)
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
|
||||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity ^0.8.4;
|
||||
import {Implementation} from "../contracts/Implementation.sol";
|
||||
import {Setup} from "../contracts/Setup.sol";
|
||||
import "forge-std/Script.sol";
|
||||
|
||||
contract DeployDummyContract is Script {
|
||||
function run(uint256 num) public {
|
||||
vm.startBroadcast();
|
||||
for(uint256 i=0; i<num; i++) {
|
||||
deploy();
|
||||
}
|
||||
vm.stopBroadcast();
|
||||
}
|
||||
function deploy() internal {
|
||||
Setup setup = new Setup();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity ^0.8.4;
|
||||
import {NFTBridgeImplementation} from "../contracts/nft/NFTBridgeImplementation.sol";
|
||||
import {NFTBridgeSetup} from "../contracts/nft/NFTBridgeSetup.sol";
|
||||
import {NFTImplementation} from "../contracts/nft/token/NFTImplementation.sol";
|
||||
import {NFTBridgeEntrypoint} from "../contracts/nft/NFTBridgeEntrypoint.sol";
|
||||
import "forge-std/Script.sol";
|
||||
|
||||
contract DeployNFTBridge is Script {
|
||||
NFTImplementation nftImpl;
|
||||
NFTBridgeSetup nftBridgeSetup;
|
||||
NFTBridgeImplementation nftBridgeImpl;
|
||||
|
||||
function dryRun(
|
||||
uint16 chainId,
|
||||
uint16 governanceChainId,
|
||||
bytes32 governanceContract,
|
||||
uint8 finality,
|
||||
uint256 evmChainId,
|
||||
address wormhole
|
||||
) public {
|
||||
_deploy(
|
||||
chainId,
|
||||
governanceChainId,
|
||||
governanceContract,
|
||||
finality,
|
||||
evmChainId,
|
||||
wormhole
|
||||
);
|
||||
}
|
||||
|
||||
function run(
|
||||
uint16 chainId,
|
||||
uint16 governanceChainId,
|
||||
bytes32 governanceContract,
|
||||
uint8 finality,
|
||||
uint256 evmChainId,
|
||||
address wormhole
|
||||
)
|
||||
public
|
||||
returns (
|
||||
address deployedAddress,
|
||||
address nftImplementationAddress,
|
||||
address setupAddress,
|
||||
address implementationAddress
|
||||
)
|
||||
{
|
||||
vm.startBroadcast();
|
||||
(
|
||||
deployedAddress,
|
||||
nftImplementationAddress,
|
||||
setupAddress,
|
||||
implementationAddress
|
||||
) = _deploy(
|
||||
chainId,
|
||||
governanceChainId,
|
||||
governanceContract,
|
||||
finality,
|
||||
evmChainId,
|
||||
wormhole
|
||||
);
|
||||
vm.stopBroadcast();
|
||||
}
|
||||
|
||||
function _deploy(
|
||||
uint16 chainId,
|
||||
uint16 governanceChainId,
|
||||
bytes32 governanceContract,
|
||||
uint8 finality,
|
||||
uint256 evmChainId,
|
||||
address wormhole
|
||||
)
|
||||
internal
|
||||
returns (
|
||||
address deployedAddress,
|
||||
address nftImplementationAddress,
|
||||
address setupAddress,
|
||||
address implementationAddress
|
||||
)
|
||||
{
|
||||
nftImpl = new NFTImplementation();
|
||||
nftBridgeSetup = new NFTBridgeSetup();
|
||||
nftBridgeImpl = new NFTBridgeImplementation();
|
||||
|
||||
NFTBridgeEntrypoint nftBridge = new NFTBridgeEntrypoint(
|
||||
address(nftBridgeSetup),
|
||||
abi.encodeWithSignature(
|
||||
"setup(address,uint16,address,uint16,bytes32,address,uint8,uint256)",
|
||||
address(nftBridgeImpl),
|
||||
chainId,
|
||||
wormhole,
|
||||
governanceChainId,
|
||||
governanceContract,
|
||||
address(nftImpl),
|
||||
finality,
|
||||
evmChainId
|
||||
)
|
||||
);
|
||||
|
||||
return (
|
||||
address(nftBridge),
|
||||
address(nftImpl),
|
||||
address(nftBridgeSetup),
|
||||
address(nftBridgeImpl)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity ^0.8.4;
|
||||
import {ERC20PresetMinterPauser} from "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol";
|
||||
import {ERC721PresetMinterPauserAutoId} from "@openzeppelin/contracts/token/ERC721/presets/ERC721PresetMinterPauserAutoId.sol";
|
||||
import {MockWETH9} from "../contracts/bridge/mock/MockWETH9.sol";
|
||||
import {TokenImplementation} from "../contracts/bridge/token/TokenImplementation.sol";
|
||||
import "forge-std/Script.sol";
|
||||
|
||||
contract DeployTestToken is Script {
|
||||
function dryRun() public {
|
||||
_deploy();
|
||||
}
|
||||
|
||||
function run()
|
||||
public
|
||||
returns (
|
||||
address deployedTokenAddress,
|
||||
address deployedNFTaddress,
|
||||
address deployedWETHaddress,
|
||||
address deployedAccountantTokenAddress
|
||||
)
|
||||
{
|
||||
vm.startBroadcast();
|
||||
(
|
||||
deployedTokenAddress,
|
||||
deployedNFTaddress,
|
||||
deployedWETHaddress,
|
||||
deployedAccountantTokenAddress
|
||||
) = _deploy();
|
||||
vm.stopBroadcast();
|
||||
}
|
||||
|
||||
function _deploy()
|
||||
internal
|
||||
returns (
|
||||
address deployedTokenAddress,
|
||||
address deployedNFTaddress,
|
||||
address deployedWETHaddress,
|
||||
address deployedAccountantTokenAddress
|
||||
)
|
||||
{
|
||||
address[] memory accounts = new address[](13);
|
||||
accounts[0] = 0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1;
|
||||
accounts[1] = 0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0;
|
||||
accounts[2] = 0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b;
|
||||
accounts[3] = 0xE11BA2b4D45Eaed5996Cd0823791E0C93114882d;
|
||||
accounts[4] = 0xd03ea8624C8C5987235048901fB614fDcA89b117;
|
||||
accounts[5] = 0x95cED938F7991cd0dFcb48F0a06a40FA1aF46EBC;
|
||||
accounts[6] = 0x3E5e9111Ae8eB78Fe1CC3bb8915d5D461F3Ef9A9;
|
||||
accounts[7] = 0x28a8746e75304c0780E011BEd21C72cD78cd535E;
|
||||
accounts[8] = 0xACa94ef8bD5ffEE41947b4585a84BdA5a3d3DA6E;
|
||||
accounts[9] = 0x1dF62f291b2E969fB0849d99D9Ce41e2F137006e;
|
||||
accounts[10] = 0x610Bb1573d1046FCb8A70Bbbd395754cD57C2b60;
|
||||
accounts[11] = 0x855FA758c77D68a04990E992aA4dcdeF899F654A;
|
||||
accounts[12] = 0xfA2435Eacf10Ca62ae6787ba2fB044f8733Ee843;
|
||||
|
||||
ERC20PresetMinterPauser token = new ERC20PresetMinterPauser(
|
||||
"Ethereum Test Token",
|
||||
"TKN"
|
||||
);
|
||||
console.log("Token deployed at: ", address(token));
|
||||
|
||||
// mint 1000 units
|
||||
token.mint(accounts[0], 1_000_000_000_000_000_000_000);
|
||||
|
||||
ERC721PresetMinterPauserAutoId nft = new ERC721PresetMinterPauserAutoId(
|
||||
unicode"Not an APE🐒",
|
||||
unicode"APE🐒",
|
||||
"https://cloudflare-ipfs.com/ipfs/QmeSjSinHpPnmXmspMjwiXyN6zS4E9zccariGR3jxcaWtq/"
|
||||
);
|
||||
|
||||
nft.mint(accounts[0]);
|
||||
nft.mint(accounts[0]);
|
||||
|
||||
console.log("NFT deployed at: ", address(nft));
|
||||
|
||||
MockWETH9 mockWeth = new MockWETH9();
|
||||
|
||||
console.log("WETH token deployed at: ", address(mockWeth));
|
||||
|
||||
for(uint16 i=2; i<11; i++) {
|
||||
token.mint(accounts[i], 1_000_000_000_000_000_000_000);
|
||||
}
|
||||
|
||||
ERC20PresetMinterPauser accountantToken = new ERC20PresetMinterPauser(
|
||||
"Accountant Test Token",
|
||||
"GA"
|
||||
);
|
||||
|
||||
console.log(
|
||||
"Accountant test token deployed at: ",
|
||||
address(accountantToken)
|
||||
);
|
||||
|
||||
// mint 1000 units
|
||||
accountantToken.mint(accounts[9], 1_000_000_000_000_000_000_000);
|
||||
|
||||
return (
|
||||
address(token),
|
||||
address(nft),
|
||||
address(mockWeth),
|
||||
address(accountantToken)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
|
||||
|
||||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity ^0.8.4;
|
||||
import {INFTBridge} from "../contracts/nft/interfaces/INFTBridge.sol";
|
||||
import "forge-std/Script.sol";
|
||||
|
||||
contract RegisterChainsNFTBridge is Script {
|
||||
// DryRun - Register chains
|
||||
// dry run: forge script RegisterChainsNFTBridge --sig "dryRun(address,bytes[])" --rpc-url $RPC
|
||||
function dryRun(address nftBridge, bytes[] memory registrationVaas) public {
|
||||
_registerChains(nftBridge, registrationVaas);
|
||||
}
|
||||
// Register chains
|
||||
// forge script RegisterChainsNFTBridge --sig "run(address,bytes[])" --rpc-url $RPC --private-key $RAW_PRIVATE_KEY --broadcast
|
||||
function run(address nftBridge, bytes[] memory registrationVaas) public {
|
||||
vm.startBroadcast();
|
||||
_registerChains(nftBridge, registrationVaas);
|
||||
vm.stopBroadcast();
|
||||
}
|
||||
|
||||
function _registerChains(address nftBridge, bytes[] memory registrationVaas) internal {
|
||||
INFTBridge nftBridgeContract = INFTBridge(nftBridge);
|
||||
uint256 len = registrationVaas.length;
|
||||
for(uint256 i=0; i<len; i++) {
|
||||
nftBridgeContract.registerChain(registrationVaas[i]);
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -35,7 +35,6 @@
|
|||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@certusone/wormhole-sdk": "^0.9.11",
|
||||
"@typechain/ethers-v5": "^10.2.0",
|
||||
"dotenv": "^10.0.0",
|
||||
"elliptic": "^6.5.2",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
# MNEMONIC=<redacted> ./forge-scripts/deployCoreBridge.sh
|
||||
# MNEMONIC=<redacted> ./sh/deployCoreBridge.sh
|
||||
|
||||
. .env
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
# MNEMONIC=<redacted> ./forge-scripts/deployCoreShutdown.sh
|
||||
# MNEMONIC=<redacted> ./sh/deployCoreShutdown.sh
|
||||
|
||||
. .env
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
[[ -z $MNEMONIC ]] && { echo "Missing MNEMONIC"; exit 1; }
|
||||
[[ -z $RPC_URL ]] && { echo "Missing RPC_URL"; exit 1; }
|
||||
[[ -z $NUM_RUNS ]] && { echo "Missing NUM_RUNS"; exit 1; }
|
||||
|
||||
# Deploy dummy contract(s) to match devnet addresses in Anvil to what they originally were in Ganache
|
||||
# (the addresses depend on the number of contracts that have been previously deployed, and the wallet address, I believe!)
|
||||
|
||||
forge script ./forge-scripts/DeployDummyContract.s.sol:DeployDummyContract \
|
||||
--sig "run(uint256)" $NUM_RUNS \
|
||||
--rpc-url "$RPC_URL" \
|
||||
--private-key "$MNEMONIC" \
|
||||
--broadcast
|
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
|
||||
# MNEMONIC=<redacted> WORMHOLE_ADDRESS=<from_the_previous_command> ./sh/deployNFTBridge.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/DeployNFTBridge.s.sol:DeployNFTBridge \
|
||||
--sig "run(uint16,uint16,bytes32,uint8,uint256,address)" $INIT_CHAIN_ID $INIT_GOV_CHAIN_ID $INIT_GOV_CONTRACT $BRIDGE_INIT_FINALITY $INIT_EVM_CHAIN_ID $WORMHOLE_ADDRESS \
|
||||
--rpc-url "$RPC_URL" \
|
||||
--private-key "$MNEMONIC" \
|
||||
--broadcast
|
||||
|
||||
returnInfo=$(cat ./broadcast/DeployNFTBridge.s.sol/$INIT_EVM_CHAIN_ID/run-latest.json)
|
||||
# Extract the address values from 'returnInfo'
|
||||
NFT_BRIDGE_ADDRESS=$(jq -r '.returns.deployedAddress.value' <<< "$returnInfo")
|
||||
NFT_IMPLEMENTATION_ADDRESS=$(jq -r '.returns.nftImplementationAddress.value' <<< "$returnInfo")
|
||||
NFT_BRIDGE_SETUP_ADDRESS=$(jq -r '.returns.setupAddress.value' <<< "$returnInfo")
|
||||
NFT_BRIDGE_IMPLEMENTATION_ADDRESS=$(jq -r '.returns.implementationAddress.value' <<< "$returnInfo")
|
||||
|
||||
echo "-- NFTBridge Addresses ----------------------------------------------------~~"
|
||||
echo "| NFT Implementation address | $NFT_IMPLEMENTATION_ADDRESS |"
|
||||
echo "| NFTBridgeSetup address | $NFT_BRIDGE_SETUP_ADDRESS |"
|
||||
echo "| NFTBridgeImplementation address | $NFT_BRIDGE_IMPLEMENTATION_ADDRESS |"
|
||||
echo "| NFTBridge address | $NFT_BRIDGE_ADDRESS |"
|
||||
echo "-----------------------------------------------------------------------------"
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
# MNEMONIC=<redacted> WORMHOLE_ADDRESS=<from_the_previous_command> ./forge-scripts/deployTokenBridge.sh
|
||||
# MNEMONIC=<redacted> WORMHOLE_ADDRESS=<from_the_previous_command> ./sh/deployTokenBridge.sh
|
||||
|
||||
. .env
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
# MNEMONIC=<redacted> ./forge-scripts/deployTokenBridgeShutdown.sh
|
||||
# MNEMONIC=<redacted> ./sh/deployTokenBridgeShutdown.sh
|
||||
|
||||
. .env
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ "$DEV" != "True" ]; then
|
||||
if [ $CHAIN_ID -eq 4 ]; then
|
||||
RPC_URL='http://localhost:8545'
|
||||
else
|
||||
RPC_URL='http://localhost:8545'
|
||||
fi
|
||||
else
|
||||
if [ $CHAIN_ID -eq 4 ]; then
|
||||
RPC_URL='http://localhost:8545'
|
||||
else
|
||||
RPC_URL='http://localhost:8545'
|
||||
fi
|
||||
fi
|
||||
|
||||
# Load the environment variables from .env
|
||||
if [ -f .env ]; then
|
||||
source .env
|
||||
else
|
||||
echo "The .env file does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MNEMONIC=0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d
|
||||
NETWORK='devnet'
|
||||
|
||||
npm run build:forge
|
||||
|
||||
NUM_RUNS=2 source ./sh/deployDummyContract.sh
|
||||
|
||||
echo "Deploying WORMHOLE_CORE"
|
||||
source ./sh/deployCoreBridge.sh
|
||||
returnInfo=$(cat ./broadcast/DeployCore.s.sol/$INIT_EVM_CHAIN_ID/run-latest.json)
|
||||
WORMHOLE_ADDRESS=$(jq -r '.returns.deployedAddress.value' <<< "$returnInfo")
|
||||
echo "WORMHOLE_ADDRESS: ${WORMHOLE_ADDRESS}"
|
||||
|
||||
NUM_RUNS=1 source ./sh/deployDummyContract.sh
|
||||
|
||||
echo "Deploying TOKEN_BRIDGE"
|
||||
source ./sh/deployTokenBridge.sh
|
||||
returnInfo=$(cat ./broadcast/DeployTokenBridge.s.sol/$INIT_EVM_CHAIN_ID/run-latest.json)
|
||||
TOKEN_BRIDGE_ADDRESS=$(jq -r '.returns.deployedAddress.value' <<< "$returnInfo")
|
||||
echo "TOKEN_BRIDGE_ADDRESS: $TOKEN_BRIDGE_ADDRESS"
|
||||
|
||||
NUM_RUNS=1 source ./sh/deployDummyContract.sh
|
||||
|
||||
echo "Deploying NFT_BRIDGE"
|
||||
source ./sh/deployNFTBridge.sh
|
||||
returnInfo=$(cat ./broadcast/DeployNFTBridge.s.sol/$INIT_EVM_CHAIN_ID/run-latest.json)
|
||||
NFT_BRIDGE_ADDRESS=$(jq -r '.returns.deployedAddress.value' <<< "$returnInfo")
|
||||
echo "NFT_BRIDGE_ADDRESS: $NFT_BRIDGE_ADDRESS"
|
||||
|
||||
NUM_RUNS=17 source ./sh/deployDummyContract.sh
|
||||
|
||||
echo "Deploying test tokens"
|
||||
forge script ./forge-scripts/DeployTestToken.s.sol:DeployTestToken --rpc-url $RPC_URL --private-key $MNEMONIC --broadcast
|
||||
echo "Done deploying test tokens"
|
||||
|
||||
# Registration of chains
|
||||
token_bridge_registration_vaas_arr=()
|
||||
nft_bridge_registration_vaas_arr=()
|
||||
while IFS= read -r line; do
|
||||
# Use a regular expression to match the desired pattern
|
||||
if [[ "$line" =~ ^REGISTER_.*_TOKEN_BRIDGE_VAA=([^[:space:]]+) ]]; then
|
||||
token_bridge_registration_vaas_arr+=("0x${BASH_REMATCH[1]}")
|
||||
fi
|
||||
if [[ "$line" =~ ^REGISTER_.*_NFT_BRIDGE_VAA=([^[:space:]]+) ]]; then
|
||||
nft_bridge_registration_vaas_arr+=("0x${BASH_REMATCH[1]}")
|
||||
fi
|
||||
done < ".env"
|
||||
|
||||
TOKEN_BRIDGE_REGISTRATION_VAAS="[$(IFS=','; echo "${token_bridge_registration_vaas_arr[*]}")]";
|
||||
NFT_BRIDGE_REGISTRATION_VAAS="[$(IFS=','; echo "${nft_bridge_registration_vaas_arr[*]}")]";
|
||||
|
||||
echo "Registering chains on token bridge"
|
||||
echo "TOKEN_BRIDGE_REGISTRATION_VAAS: $TOKEN_BRIDGE_REGISTRATION_VAAS"
|
||||
source "./sh/registerChainsTokenBridge.sh"
|
||||
echo "Done registering chains on token bridge"
|
||||
|
||||
echo "Registering chains on nft bridge"
|
||||
echo "NFT_BRIDGE_REGISTRATION_VAAS: $NFT_BRIDGE_REGISTRATION_VAAS"
|
||||
source "./sh/registerChainsNFTBridge.sh"
|
||||
echo "Done registering chains on nft bridge"
|
|
@ -6,7 +6,7 @@
|
|||
# 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
|
||||
# MNEMONIC=<redacted> ./sh/registerAllChainsOnTokenBridge.sh testnet blast
|
||||
|
||||
if [ $# != 2 ]; then
|
||||
echo "Usage: $0 testnet blast" >&2
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
# MNEMONIC=<redacted> ./sh/registerChainsNFTBridge.sh
|
||||
|
||||
. .env
|
||||
|
||||
[[ -z $MNEMONIC ]] && { echo "Missing MNEMONIC"; exit 1; }
|
||||
[[ -z $RPC_URL ]] && { echo "Missing RPC_URL"; exit 1; }
|
||||
[[ -z $NFT_BRIDGE_ADDRESS ]] && { echo "Missing NFT_BRIDGE_ADDRESS"; exit 1; }
|
||||
[[ -z $NFT_BRIDGE_REGISTRATION_VAAS ]] && { echo "Missing NFT_BRIDGE_REGISTRATION_VAAS"; exit 1; }
|
||||
|
||||
forge script ./forge-scripts/RegisterChainsNFTBridge.s.sol:RegisterChainsNFTBridge \
|
||||
--sig "run(address,bytes[])" $NFT_BRIDGE_ADDRESS $NFT_BRIDGE_REGISTRATION_VAAS \
|
||||
--rpc-url $RPC_URL \
|
||||
--private-key $MNEMONIC \
|
||||
--broadcast
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
# MNEMONIC=<redacted> ./sh/registerChainsTokenBridge.sh
|
||||
|
||||
. .env
|
||||
|
||||
[[ -z $MNEMONIC ]] && { echo "Missing MNEMONIC"; exit 1; }
|
||||
[[ -z $RPC_URL ]] && { echo "Missing RPC_URL"; exit 1; }
|
||||
[[ -z $TOKEN_BRIDGE_ADDRESS ]] && { echo "Missing TOKEN_BRIDGE_ADDRESS"; exit 1; }
|
||||
[[ -z $TOKEN_BRIDGE_REGISTRATION_VAAS ]] && { echo "Missing TOKEN_BRIDGE_REGISTRATION_VAAS"; exit 1; }
|
||||
|
||||
forge script ./forge-scripts/RegisterChainsTokenBridge.s.sol:RegisterChainsTokenBridge \
|
||||
--sig "run(address,bytes[])" $TOKEN_BRIDGE_ADDRESS $TOKEN_BRIDGE_REGISTRATION_VAAS \
|
||||
--rpc-url $RPC_URL \
|
||||
--private-key $MNEMONIC \
|
||||
--broadcast
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
#MNEMONIC= ./forge-scripts/upgrade.sh testnet Core blast
|
||||
#MNEMONIC= ./sh/upgrade.sh testnet Core blast
|
||||
|
||||
set -euo pipefail
|
||||
|
Loading…
Reference in New Issue