This project allows verifying documents using their hashes. So as an example documents hash could be generated using keccak256 then this hash would be add to contract and signed by requested addresses.
NOTES
Contracts are put on verification only by document creators. Document creators allowance set on Management contracts. ManagementSingle contract only for managing single DocumentVerification contract. ManagementMulti contract for managing multi DocumentVerification contracts. For managing multiple different DocumentVerification contracts controllers are used in ManagementMulti contract, each controller can only control 1 DocumentVerification contract
Before running any command, you need to create a .env file and set a BIP-39 compatible mnemonic as an environment variable. Follow the example in .env.example. If you don't already have a mnemonic, use this website to generate one.
- Install node and npm
- Install yarn
npm install --global yarnCheck that Yarn is installed by running:
yarn --versionThen, proceed with installing dependencies:
yarn installCompile the smart contracts with Hardhat:
yarn compileCompile the smart contracts and generate TypeChain artifacts:
yarn typechainLint the Solidity and TypeScript code (then check with prettier):
yarn lintDelete the smart contract artifacts, the coverage reports and the Hardhat cache:
yarn cleanCreate documentation for the contracts (in "docs" folder):
yarn docgenTo see available tasks from Hardhat:
npx hardhatTo run tests, run the following command:
yarn testTo report gas after test, set REPORT_GAS="true" on .env file. Then run test.
Generate the code coverage report:
yarn coverageTo deploy this project first change those fields on your .env file:
MNEMONIC="your mnemomic" that should be your REAL mnemonic that you use on chain.
RUN_OPTIMIZER="true" that is recommended for gas fees optimization.
Then set your infura or alchemy api key (depending on chain you want to deploy).
Deployment arguments
You have to create deploy argument json file, using examples on deployargs folder.
So first create a json file using example: deploy${ContractName}Args.example.json file, new json file should be exact same name but without .example in it's file name. Example: deploy${ContractName}Args.json, then fill the fields.
Deployment commands
yarn deploy:${contractname} --network ${networkToDeploy}Example:
yarn deploy:token --network rinkebyTo verify the contract first change block explorer api key on your .env file, depending on your network.
For example, for ethereum network:
ETHERSCAN_API_KEY="etherscan_api_key".
Verification commands
yarn verify:${contractname} --address ${deployed_contract_address} --network ${network}Example:
yarn verify:token --address ${deployed_contract_address} --network rinkebyFor git linting commitlint is being used. This website can be helpful to write commit messages.