Skip to content

Latest commit

聽

History

History

contracts-core

README.md

Umbra contracts

On-chain components of the Umbra protocol.

Development

This dev toolchain is based on @PaulRBerg's hardhat-template repo and includes:

  • 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

Prerequisites

Before running any command, make sure to install dependencies:

$ yarn install

Build

Compile the smart contracts with Hardhat and generate the TypeChain bindings in typechain/:

$ yarn build

Lint

Run Solhint, ESLint, and the Prettier check:

$ yarn lint

Apply available fixes and formatting, then rerun the checks:

$ yarn lint:fix

To run a single linter, use yarn lint:sol for Solhint or yarn lint:ts for ESLint.

Format

Format the code with Prettier:

$ yarn prettier

Test

Run the Mocha tests:

$ yarn test

Run the tests with a gas report:

$ yarn test:gas

Deploy

Deploy the Umbra and StealthKeyRegistry contracts to a network defined in hardhat.config.ts, using the account derived from MNEMONIC in .env. Deployment records are saved to deploy-history/:

$ yarn deploy --network <network>

To deploy only the StealthKeyRegistry:

$ yarn deploy:registry --network <network>

Clean

Delete the smart contract artifacts, the TypeChain bindings and the Hardhat cache:

$ yarn clean