Skip to content

Latest commit

 

History

History
101 lines (70 loc) · 2.69 KB

File metadata and controls

101 lines (70 loc) · 2.69 KB

Token bridge smart contract

Uses

  • Hardhat: compile and run the smart contracts on a local development network
  • TypeChain: generate TypeScript types for smart contracts
  • Ethers: renowned Ethereum library and wallet implementation
  • Waffle: tooling for writing comprehensive smart contract tests
  • Solhint: linter
  • Prettier Plugin Solidity: code formatter

Usage

Sandbox adjustments

If you run Node.js in the sandbox, you need to make some adjustments.

Include this in the node-sandbox script:

  --mount type=bind,source="${HOME}/.cache/hardhat-nodejs,target=${HOME}/.cache/hardhat-nodejs" \
  --mount type=bind,source="${HOME}/.config/hardhat-nodejs,target=${HOME}/.config/hardhat-nodejs" \
  --mount type=bind,source="${HOME}/.local/share/hardhat-nodejs,target=${HOME}/.local/share/hardhat-nodejs" \
  --mount type=bind,source="${HOME}/.local/share/buidler-nodejs,target=${HOME}/.local/share/buidler-nodejs" \

You might also need to create those directories before running the first time:

mkdir -p ${HOME}/.cache/hardhat-nodejs
mkdir -p ${HOME}/.config/hardhat-nodejs
mkdir -p ${HOME}/.local/share/hardhat-nodejs
mkdir -p ${HOME}/.local/share/buidler-nodejs

Pre Requisites

Before running any command, make sure dependencies are installed in a reproducible way:

$ YARN_ENABLE_SCRIPTS=false yarn install --immutable
  • YARN_ENABLE_SCRIPTS=false -- skips lifecycle scripts (preinstall, postinstall, etc.).

  • --immutable -- ensures the lockfile (yarn.lock) isn't modified.

If you already have the enableScripts and enableImmutableInstalls set in your .yarnrc.yml, you can simply run:

$ yarn install

To audit the dependencies, disable enableImmutableInstalls in your .yarnrc.yml and run:

$ yarn npm audit

To apply automatic version bumps where possible, run:

$ yarn npm audit fix

Clean

$ yarn clean

Compile

Compile the smart contracts with Hardhat:

$ yarn compile

Test

Run the Mocha tests:

$ yarn test

Run test with gas report

$ REPORT_GAS=true yarn test

Run test with solidity coverage report

$ yarn coverage

Added plugins