This project uses Solidity smart contracts to enable transfers to and from EVM compatible chains. These contracts consist of a core bridge contract (Bridge.sol) and a set of handler contracts.
A list of command can be found via CLI:
npx hardhatTo initialize project, run install and copy .env file:
yarn install
cp .env.example .envThen modify the .env file with your appropriate variables.
Run tests with following CLI:
npx hardhat testTo deploy a test with Hardhat localhost, first run the node:
npx hardhat nodeThen, in another shell, run a script for deploying:
npx hardhat run --network localhost scripts/deployLocal.jsThen we can continue with other tasks: approveERC20, transferERC20
Run deploy Bridge and ERC20Handler for an available public testnet:
npx hardhat run --network fuji scripts/deploy.jsThere are some pre-defined tasks that can run directly for setting up Astra Bridge and interacting with smart contracts:
npx hardhat approveERC20 --network [network] --amount [amount] --recipient [approving-address] --tokenAddress [approving-token]For example, following script will allow SRC_HANDLER to send 10 amount of SRC_TOKEN:
npx hardhat approveERC20 --amount 10 --network localhostnpx hardhat transferERC20 --network [network] --amount [amount] --target-chain-id [target] --recipient [receiving-address] --resource-id [resource-id] --bridge [bridge-address]For example:
npx hardhat transferERC20 --amount 1 --recipient 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --network localhost --target-chain-id 31338npx hardhat grantMinterRole --network [network]npx hardhat registerResource --network [network]npx hardhat setTrustedRemote --network [network]npx hardhat setBurnable --network [network]TODO: Update document for folder structures