tilt: register aptos on other chains
This commit is contained in:
parent
12b855f3b1
commit
3877f6f3c3
|
@ -11,6 +11,7 @@ RUN if [ -e /certs/cert.pem ]; then cp /certs/cert.pem /etc/pki/tls/certs/ca-bun
|
|||
# fetch scripts/guardian-set-init.sh deps
|
||||
RUN dnf -y install jq
|
||||
RUN dnf -y install make
|
||||
RUN dnf -y install findutils
|
||||
|
||||
# fetch clients/** deps
|
||||
RUN curl -fsSL https://rpm.nodesource.com/setup_16.x | bash - && dnf -y install nodejs
|
||||
|
|
|
@ -223,6 +223,8 @@ const contract_registrations = {
|
|||
process.env.REGISTER_NEAR_TOKEN_BRIDGE_VAA,
|
||||
// Wormhole Chain
|
||||
process.env.REGISTER_WORMCHAIN_TOKEN_BRIDGE_VAA,
|
||||
// APTOS
|
||||
process.env.REGISTER_APTOS_TOKEN_BRIDGE_VAA,
|
||||
],
|
||||
};
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ spec:
|
|||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- "npm run migrate && npx truffle exec scripts/deploy_test_token.js && npm run deploy-batched-vaa-sender && npx truffle exec scripts/register_solana_chain.js && npx truffle exec scripts/register_terra_chain.js && npx truffle exec scripts/register_terra2_chain.js && npx truffle exec scripts/register_bsc_chain.js && npx truffle exec scripts/register_algo_chain.js && npx truffle exec scripts/register_near_chain.js && npx truffle exec scripts/register_worm_chain.js && nc -lkp 2000 0.0.0.0"
|
||||
- "npm run migrate && npx truffle exec scripts/deploy_test_token.js && npm run deploy-batched-vaa-sender && npx truffle exec scripts/register_solana_chain.js && npx truffle exec scripts/register_terra_chain.js && npx truffle exec scripts/register_terra2_chain.js && npx truffle exec scripts/register_bsc_chain.js && npx truffle exec scripts/register_algo_chain.js && npx truffle exec scripts/register_near_chain.js && npx truffle exec scripts/register_worm_chain.js && npx truffle exec scripts/register_aptos_chain.js && nc -lkp 2000 0.0.0.0"
|
||||
readinessProbe:
|
||||
periodSeconds: 1
|
||||
failureThreshold: 300
|
||||
|
|
|
@ -55,7 +55,7 @@ spec:
|
|||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- "sed -i 's/CHAIN_ID=0x2/CHAIN_ID=0x4/g;s/EVM_CHAIN_ID=1/EVM_CHAIN_ID=1397/g' .env && npm run migrate && npx truffle exec scripts/deploy_test_token.js && npx truffle exec scripts/register_solana_chain.js && npx truffle exec scripts/register_terra_chain.js && npx truffle exec scripts/register_terra2_chain.js && npx truffle exec scripts/register_eth_chain.js && npx truffle exec scripts/register_algo_chain.js && npx truffle exec scripts/register_near_chain.js && npx truffle exec scripts/register_worm_chain.js && nc -lkp 2000 0.0.0.0"
|
||||
- "sed -i 's/CHAIN_ID=0x2/CHAIN_ID=0x4/g;s/EVM_CHAIN_ID=1/EVM_CHAIN_ID=1397/g' .env && npm run migrate && npx truffle exec scripts/deploy_test_token.js && npx truffle exec scripts/register_solana_chain.js && npx truffle exec scripts/register_terra_chain.js && npx truffle exec scripts/register_terra2_chain.js && npx truffle exec scripts/register_eth_chain.js && npx truffle exec scripts/register_algo_chain.js && npx truffle exec scripts/register_near_chain.js && npx truffle exec scripts/register_worm_chain.js && npx truffle exec scripts/register_aptos_chain.js && nc -lkp 2000 0.0.0.0"
|
||||
readinessProbe:
|
||||
periodSeconds: 1
|
||||
failureThreshold: 300
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
// run this script with truffle exec
|
||||
|
||||
const jsonfile = require("jsonfile");
|
||||
const TokenBridge = artifacts.require("TokenBridge");
|
||||
const TokenImplementation = artifacts.require("TokenImplementation");
|
||||
const BridgeImplementationFullABI = jsonfile.readFileSync(
|
||||
"../build/contracts/BridgeImplementation.json"
|
||||
).abi;
|
||||
const aptosTokenBridgeVAA = process.env.REGISTER_APTOS_TOKEN_BRIDGE_VAA;
|
||||
|
||||
module.exports = async function(callback) {
|
||||
try {
|
||||
const accounts = await web3.eth.getAccounts();
|
||||
const initialized = new web3.eth.Contract(
|
||||
BridgeImplementationFullABI,
|
||||
TokenBridge.address
|
||||
);
|
||||
|
||||
// Register the APTOS endpoint
|
||||
await initialized.methods
|
||||
.registerChain("0x" + aptosTokenBridgeVAA)
|
||||
.send({
|
||||
value: 0,
|
||||
from: accounts[0],
|
||||
gasLimit: 2000000,
|
||||
});
|
||||
|
||||
callback();
|
||||
} catch (e) {
|
||||
callback(e);
|
||||
}
|
||||
};
|
|
@ -245,6 +245,11 @@
|
|||
"tokenBridgeEmitterAddress": "wormhole1zugu6cajc4z7ue29g9wnes9a5ep9cs7yu7rn3z",
|
||||
"tokenBridgeNativeAddress": "wormhole1zugu6cajc4z7ue29g9wnes9a5ep9cs7yu7rn3z"
|
||||
}
|
||||
},
|
||||
"22": {
|
||||
"contracts": {
|
||||
"tokenBridgeEmitterAddress": "0000000000000000000000000000000000000000000000000000000000000001"
|
||||
}
|
||||
}
|
||||
},
|
||||
"gancheDefaults": [
|
||||
|
|
|
@ -37,6 +37,9 @@ function upsert_env_file {
|
|||
fi
|
||||
}
|
||||
|
||||
echo "# This file was auto-generated by $(basename $0). Do not modify by hand!" >> $ethFile
|
||||
echo "# This file was auto-generated by $(basename $0). Do not modify by hand!" >> $envFile
|
||||
|
||||
# assert jq exists before trying to use it
|
||||
if ! type -p jq; then
|
||||
echo "ERROR: jq is not installed"! >&2
|
||||
|
@ -88,6 +91,7 @@ algoTokenBridge=$(jq --raw-output '.chains."8".contracts.tokenBridgeEmitterAddre
|
|||
nearTokenBridge=$(jq --raw-output '.chains."15".contracts.tokenBridgeEmitterAddress' $addressesJson)
|
||||
terra2TokenBridge=$(jq --raw-output '.chains."18".contracts.tokenBridgeEmitterAddress' $addressesJson)
|
||||
wormchainTokenBridge=$(jq --raw-output '.chains."3104".contracts.tokenBridgeEmitterAddress' $addressesJson)
|
||||
aptosTokenBridge=$(jq --raw-output '.chains."22".contracts.tokenBridgeEmitterAddress' $addressesJson)
|
||||
|
||||
solNFTBridge=$(jq --raw-output '.chains."1".contracts.nftBridgeEmitterAddress' $addressesJson)
|
||||
ethNFTBridge=$(jq --raw-output '.chains."2".contracts.nftBridgeEmitterAddress' $addressesJson)
|
||||
|
@ -96,22 +100,23 @@ nearNFTBridge=$(jq --raw-output '.chains."15".contracts.nftBridgeEmitterAddress'
|
|||
|
||||
# 4) create token bridge registration VAAs
|
||||
# invoke CLI commands to create registration VAAs
|
||||
solTokenBridgeVAA=`echo $(node ./clients/js/build/main.js generate registration -m TokenBridge -c solana -a ${solTokenBridge} -g ${guardiansPrivateCSV}) | sed 's/secp256k1.*version//'`
|
||||
ethTokenBridgeVAA=`echo $(node ./clients/js/build/main.js generate registration -m TokenBridge -c ethereum -a ${ethTokenBridge} -g ${guardiansPrivateCSV} ) | sed 's/secp256k1.*version//'`
|
||||
terraTokenBridgeVAA=`echo $(node ./clients/js/build/main.js generate registration -m TokenBridge -c terra -a ${terraTokenBridge} -g ${guardiansPrivateCSV}) | sed 's/secp256k1.*version//'`
|
||||
bscTokenBridgeVAA=`echo $(node ./clients/js/build/main.js generate registration -m TokenBridge -c bsc -a ${bscTokenBridge} -g ${guardiansPrivateCSV}) | sed 's/secp256k1.*version//'`
|
||||
algoTokenBridgeVAA=`echo $(node ./clients/js/build/main.js generate registration -m TokenBridge -c algorand -a ${algoTokenBridge} -g ${guardiansPrivateCSV}) | sed 's/secp256k1.*version//'`
|
||||
nearTokenBridgeVAA=`echo $(node ./clients/js/build/main.js generate registration -m TokenBridge -c near -a ${nearTokenBridge} -g ${guardiansPrivateCSV}) | sed 's/secp256k1.*version//'`
|
||||
terra2TokenBridgeVAA=`echo $(node ./clients/js/build/main.js generate registration -m TokenBridge -c terra2 -a ${terra2TokenBridge} -g ${guardiansPrivateCSV}) | sed 's/secp256k1.*version//'`
|
||||
wormchainTokenBridgeVAA=`echo $(node ./clients/js/build/main.js generate registration -m TokenBridge -c wormholechain -a ${wormchainTokenBridge} -g ${guardiansPrivateCSV}) | sed 's/secp256k1.*version//'`
|
||||
solTokenBridgeVAA=$(node ./clients/js/build/main.js generate registration -m TokenBridge -c solana -a ${solTokenBridge} -g ${guardiansPrivateCSV})
|
||||
ethTokenBridgeVAA=$(node ./clients/js/build/main.js generate registration -m TokenBridge -c ethereum -a ${ethTokenBridge} -g ${guardiansPrivateCSV} )
|
||||
terraTokenBridgeVAA=$(node ./clients/js/build/main.js generate registration -m TokenBridge -c terra -a ${terraTokenBridge} -g ${guardiansPrivateCSV})
|
||||
bscTokenBridgeVAA=$(node ./clients/js/build/main.js generate registration -m TokenBridge -c bsc -a ${bscTokenBridge} -g ${guardiansPrivateCSV})
|
||||
algoTokenBridgeVAA=$(node ./clients/js/build/main.js generate registration -m TokenBridge -c algorand -a ${algoTokenBridge} -g ${guardiansPrivateCSV})
|
||||
nearTokenBridgeVAA=$(node ./clients/js/build/main.js generate registration -m TokenBridge -c near -a ${nearTokenBridge} -g ${guardiansPrivateCSV})
|
||||
terra2TokenBridgeVAA=$(node ./clients/js/build/main.js generate registration -m TokenBridge -c terra2 -a ${terra2TokenBridge} -g ${guardiansPrivateCSV})
|
||||
wormchainTokenBridgeVAA=$(node ./clients/js/build/main.js generate registration -m TokenBridge -c wormholechain -a ${wormchainTokenBridge} -g ${guardiansPrivateCSV})
|
||||
aptosTokenBridgeVAA=$(node ./clients/js/build/main.js generate registration -m TokenBridge -c aptos -a ${aptosTokenBridge} -g ${guardiansPrivateCSV})
|
||||
|
||||
|
||||
# 5) create nft bridge registration VAAs
|
||||
echo "generating contract registration VAAs for nft bridges"
|
||||
solNFTBridgeVAA=`echo $(node ./clients/js/build/main.js generate registration -m NFTBridge -c solana -a ${solNFTBridge} -g ${guardiansPrivateCSV}) | sed 's/secp256k1.*version//'`
|
||||
ethNFTBridgeVAA=`echo $(node ./clients/js/build/main.js generate registration -m NFTBridge -c ethereum -a ${ethNFTBridge} -g ${guardiansPrivateCSV}) | sed 's/secp256k1.*version//'`
|
||||
terraNFTBridgeVAA=`echo $(node ./clients/js/build/main.js generate registration -m NFTBridge -c terra -a ${terraNFTBridge} -g ${guardiansPrivateCSV}) | sed 's/secp256k1.*version//'`
|
||||
nearNFTBridgeVAA=`echo $(node ./clients/js/build/main.js generate registration -m NFTBridge -c near -a ${nearNFTBridge} -g ${guardiansPrivateCSV}) | sed 's/secp256k1.*version//'`
|
||||
solNFTBridgeVAA=$(node ./clients/js/build/main.js generate registration -m NFTBridge -c solana -a ${solNFTBridge} -g ${guardiansPrivateCSV})
|
||||
ethNFTBridgeVAA=$(node ./clients/js/build/main.js generate registration -m NFTBridge -c ethereum -a ${ethNFTBridge} -g ${guardiansPrivateCSV})
|
||||
terraNFTBridgeVAA=$(node ./clients/js/build/main.js generate registration -m NFTBridge -c terra -a ${terraNFTBridge} -g ${guardiansPrivateCSV})
|
||||
nearNFTBridgeVAA=$(node ./clients/js/build/main.js generate registration -m NFTBridge -c near -a ${nearNFTBridge} -g ${guardiansPrivateCSV})
|
||||
|
||||
|
||||
# 6) write the registration VAAs to env files
|
||||
|
@ -125,6 +130,7 @@ algoTokenBridge="REGISTER_ALGO_TOKEN_BRIDGE_VAA"
|
|||
terra2TokenBridge="REGISTER_TERRA2_TOKEN_BRIDGE_VAA"
|
||||
nearTokenBridge="REGISTER_NEAR_TOKEN_BRIDGE_VAA"
|
||||
wormchainTokenBridge="REGISTER_WORMCHAIN_TOKEN_BRIDGE_VAA"
|
||||
aptosTokenBridge="REGISTER_APTOS_TOKEN_BRIDGE_VAA"
|
||||
|
||||
solNFTBridge="REGISTER_SOL_NFT_BRIDGE_VAA"
|
||||
ethNFTBridge="REGISTER_ETH_NFT_BRIDGE_VAA"
|
||||
|
@ -168,9 +174,14 @@ upsert_env_file $envFile $algoTokenBridge $algoTokenBridgeVAA
|
|||
upsert_env_file $ethFile $terra2TokenBridge $terra2TokenBridgeVAA
|
||||
upsert_env_file $envFile $terra2TokenBridge $terra2TokenBridgeVAA
|
||||
|
||||
# aptos token bridge
|
||||
upsert_env_file $ethFile $aptosTokenBridge $aptosTokenBridgeVAA
|
||||
upsert_env_file $envFile $aptosTokenBridge $aptosTokenBridgeVAA
|
||||
|
||||
# near token bridge
|
||||
upsert_env_file $ethFile $nearTokenBridge $nearTokenBridgeVAA
|
||||
upsert_env_file $envFile $nearTokenBridge $nearTokenBridgeVAA
|
||||
|
||||
# near nft bridge
|
||||
upsert_env_file $ethFile $nearNFTBridge $nearNFTBridgeVAA
|
||||
upsert_env_file $envFile $nearNFTBridge $nearNFTBridgeVAA
|
||||
|
|
|
@ -94,18 +94,19 @@ retry token-bridge-client create-bridge "$nft_bridge_address" "$bridge_address"
|
|||
|
||||
# pass the chain registration VAAs sourced from .env to the client's execute-governance command:
|
||||
pushd /usr/src/clients/js
|
||||
make build
|
||||
# Register the Token Bridge Endpoint on ETH
|
||||
node build/main.js submit -c solana -n devnet "$REGISTER_ETH_TOKEN_BRIDGE_VAA"
|
||||
node build/main.js submit -c solana -n devnet "$REGISTER_TERRA_TOKEN_BRIDGE_VAA"
|
||||
node build/main.js submit -c solana -n devnet "$REGISTER_BSC_TOKEN_BRIDGE_VAA"
|
||||
node build/main.js submit -c solana -n devnet "$REGISTER_ALGO_TOKEN_BRIDGE_VAA"
|
||||
node build/main.js submit -c solana -n devnet "$REGISTER_TERRA2_TOKEN_BRIDGE_VAA"
|
||||
node build/main.js submit -c solana -n devnet "$REGISTER_NEAR_TOKEN_BRIDGE_VAA"
|
||||
node build/main.js submit -c solana -n devnet "$REGISTER_WORMCHAIN_TOKEN_BRIDGE_VAA"
|
||||
# Register the NFT Bridge Endpoint on ETH
|
||||
node build/main.js submit -c solana -n devnet "$REGISTER_ETH_NFT_BRIDGE_VAA"
|
||||
node build/main.js submit -c solana -n devnet "$REGISTER_TERRA_NFT_BRIDGE_VAA"
|
||||
make install
|
||||
|
||||
# next we get all the registration VAAs from the environment
|
||||
# if a new VAA is added, this will automatically pick it up
|
||||
VAAS=$(set | grep "REGISTER_.*_VAA" | grep -v SOL | cut -d '=' -f1)
|
||||
|
||||
# use 'worm' to submit each registration VAA
|
||||
for VAA in $VAAS
|
||||
do
|
||||
VAA=${!VAA}
|
||||
worm submit $VAA --chain solana --network devnet
|
||||
done
|
||||
echo "Registrations successful."
|
||||
popd
|
||||
|
||||
# Let k8s startup probe succeed
|
||||
|
|
|
@ -272,6 +272,8 @@ const contract_registrations = {
|
|||
process.env.REGISTER_NEAR_TOKEN_BRIDGE_VAA,
|
||||
// Wormhole Chain
|
||||
process.env.REGISTER_WORMCHAIN_TOKEN_BRIDGE_VAA,
|
||||
// APTOS
|
||||
process.env.REGISTER_APTOS_TOKEN_BRIDGE_VAA,
|
||||
],
|
||||
"nft_bridge.wasm": [
|
||||
// Solana
|
||||
|
|
Loading…
Reference in New Issue