This repo contains the most recent EVM and Tron version of Allbridge Core smart contracts.
npm
orpnpm
to 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 venv
source ./venv/bin/activate
pip3 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 goerli
setGAS_ORACLE_ADDRESS
npx hardhat run ./scripts/deploy/messenger.ts --network goerli
setMESSENGER_ADDRESS
npx hardhat run ./scripts/deploy/wormhole_messenger.ts --network goerli
setWORMHOLE_MESSENGER_ADDRESS
npx hardhat run ./scripts/deploy/bridge.ts --network goerli
setBRIDGE_ADDRESS
- Optional deploy test token, check args inside :
npx hardhat run ./scripts/deploy/test-token.ts --network goerli
setTOKEN_ADDRESS
npx hardhat run ./scripts/deploy/pool.ts --network goerli
setPOOL_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 nile
setGAS_ORACLE_ADDRESS
- Messenger:
tronbox migrate --f 2 --to 2 --network nile
setMESSENGER_ADDRESS
- Bridge:
tronbox migrate --f 3 --to 3 --network nile
setBRIDGE_ADDRESS
- Optional deploy test token, check args inside :
tronbox migrate --f 4 --to 4 --network nile
setTOKEN_ADDRESS
- Pool:
tronbox migrate --f 5 --to 5 --network nile
setPOOL_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_KEY
and<CONTRACT_ADDRESS>
- Check
./scripts/verify/<contract>.ts
file args to be the same as on deploy - Run
npx hardhat run ./scripts/verify/<contract>.ts --network goerli