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 hardhat
To initialize project, run install and copy .env
file:
yarn install
cp .env.example .env
Then modify the .env
file with your appropriate variables.
Run tests with following CLI:
npx hardhat test
To deploy a test with Hardhat localhost, first run the node:
npx hardhat node
Then, in another shell, run a script for deploying:
npx hardhat run --network localhost scripts/deployLocal.js
Then 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.js
There 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 localhost
npx 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 31338
npx 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