This repo contains the most recent EVM and Tron version of Allbridge Core smart contracts.
npmorpnpmto install all dependencies and Hardhat
npm install
npm run test
npm run test-fuzzy
In order to run the foundry tests, install Foundry:
Configure Slither
python3 -m venv venvsource ./venv/bin/activatepip3 install slither-analyzer
Run static analysis with
slither .
- Add to env file
NODE_URL,PRIVATE_KEY,VALIDATOR_ADDRESS,CHAIN_ID,WORMHOLE_CHAIN_ID,WORMHOLE_ADDRESS
Deploy:
npx hardhat run ./scripts/deploy/gas-oracle.ts --network goerlisetGAS_ORACLE_ADDRESSnpx hardhat run ./scripts/deploy/messenger.ts --network goerlisetMESSENGER_ADDRESSnpx hardhat run ./scripts/deploy/wormhole_messenger.ts --network goerlisetWORMHOLE_MESSENGER_ADDRESSnpx hardhat run ./scripts/deploy/bridge.ts --network goerlisetBRIDGE_ADDRESS- Optional deploy test token, check args inside :
npx hardhat run ./scripts/deploy/test-token.ts --network goerlisetTOKEN_ADDRESS npx hardhat run ./scripts/deploy/pool.ts --network goerlisetPOOL_ADDRESS
Config:
- Add pool liquidity:
npx hardhat run ./scripts/bridge/add-liquidity.ts --network goerli - Add pool to the bridge:
npx hardhat run ./scripts/bridge/add-pool.ts --network goerli - Set bridge (check args):
npx hardhat run ./scripts/bridge/add-bridge.ts --network goerli - Add bridge token (check args):
npx hardhat run ./scripts/bridge/add-bridge-token.ts --network goerli - Set bridge gas usage (check args):
npx hardhat run ./scripts/bridge/set-gas-usage.ts --network goerli - Set messenger gas usage (check args):
npx hardhat run ./scripts/messenger/set-gas-usage.ts --network goerli - Set wormhole gas usage (check args):
npx hardhat run ./scripts/wormhole/set-gas-usage.ts --network goerli
- Add to env file
NODE_URL,PRIVATE_KEY,VALIDATOR_ADDRESS,CHAIN_ID
Deploy:
- Gas oracle:
tronbox migrate --f 1 --to 1 --network nilesetGAS_ORACLE_ADDRESS - Messenger:
tronbox migrate --f 2 --to 2 --network nilesetMESSENGER_ADDRESS - Bridge:
tronbox migrate --f 3 --to 3 --network nilesetBRIDGE_ADDRESS - Optional deploy test token, check args inside :
tronbox migrate --f 4 --to 4 --network nilesetTOKEN_ADDRESS - Pool:
tronbox migrate --f 5 --to 5 --network nilesetPOOL_ADDRESS
Config:
- Approve token
node ./scripts/tron/approve-token.js --network nile - Add pool liquidity (check amount):
node ./scripts/tron/add-pool-liquidity.js --network nile - Add pool to the bridge:
node ./scripts/tron/add-pool.js --network nile - Set bridge (check args):
node ./scripts/tron/add-bridge.js --network nile - Add bridge token (check args):
node ./scripts/tron/add-bridge-token.js --network nile - Set bridge gas usage (check args):
node ./scripts/tron/set-bridge-gas-usage.js --network nile - Set messenger gas usage (check args):
node ./scripts/tron/set-messenger-gas-usage.js --network nile
Deploy:
- Add to env file
USDC_ADDRESS,CCTP_MESSENGER_ADDRESS,CCTP_TRANSMITTER_ADDRESS - CCTP Bridge
npx hardhat run scripts/deploy/cctp-bridge.ts --network goerli
Config:
- Add to env file
CCTP_BRIDGE_ADDRESS - Register destination domains
npx hardhat run scripts/cctp-bridge/register-bridge-destination.ts --network goerli - Set bridge gas usage (check args):
npx hardhat run scripts/cctp-bridge/set-gas-usage.ts --network goerli - Add to env file
CCTP_FEE_BP - Set admin fee:
npx hardhat run scripts/cctp-bridge/set-admin-fee.ts --network goerli
- Add to env file
ETHERSCAN_API_KEYand<CONTRACT_ADDRESS> - Check
./scripts/verify/<contract>.tsfile args to be the same as on deploy - Run
npx hardhat run ./scripts/verify/<contract>.ts --network goerli