Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wighawag/template-ethereum-contracts
Template to develop ethereum smart contracts
https://github.com/wighawag/template-ethereum-contracts
Last synced: 2 months ago
JSON representation
Template to develop ethereum smart contracts
- Host: GitHub
- URL: https://github.com/wighawag/template-ethereum-contracts
- Owner: wighawag
- License: mit
- Created: 2020-10-23T11:39:16.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-26T19:12:59.000Z (4 months ago)
- Last Synced: 2024-03-23T05:23:12.959Z (3 months ago)
- Language: TypeScript
- Size: 1.11 MB
- Stars: 445
- Watchers: 8
- Forks: 110
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- awesome-solidity - wighawag/template-ethereum-contracts - Template to develop smart contracts. (Resources)
- awesome-dapptools - Template Ethereum Contracts
- awesome-solidity - wighawag/template-ethereum-contracts - Template to develop smart contracts. (Resources)
- awesome-solidity - wighawag/template-ethereum-contracts - Template to develop smart contracts. (Resources)
README
# Boilerplate for ethereum solidity smart contract development
## INSTALL
```bash
yarn
```## TEST
There are 3 flavors of tests: hardhat, dapptools and forge
### hardhat
- One using hardhat that can leverage hardhat-deploy to reuse deployment procedures and named accounts:
```bash
yarn test
```### [dapptools](https://dapp.tools)
```bash
dapp test
```The latter requires additional step to set up your machine:
Install dapptools (Following instruction [here](https://github.com/dapphub/dapptools#installation)):
```bash
# user must be in sudoers
curl -L https://nixos.org/nix/install | sh# Run this or login again to use Nix
. "$HOME/.nix-profile/etc/profile.d/nix.sh"curl https://dapp.tools/install | sh
```Then install solc with the correct version:
```bash
nix-env -f https://github.com/dapphub/dapptools/archive/master.tar.gz -iA solc-static-versions.solc_0_8_9
```### forge
```bash
forge test
```This require the installation of forge (see [foundry](https://github.com/gakonst/foundry))
## SCRIPTS
Here is the list of npm scripts you can execute:
Some of them relies on [./\_scripts.js](./_scripts.js) to allow parameterizing it via command line argument (have a look inside if you need modifications)
### `yarn prepare`
As a standard lifecycle npm script, it is executed automatically upon install. It generate config file and typechain to get you started with type safe contract interactions
### `yarn format` and `yarn format:fix`
These will format check your code. the `:fix` version will modifiy the files to match the requirement specified in `.prettierrc.`
### `yarn compile`
These will compile your contracts
### `yarn void:deploy`
This will deploy your contracts on the in-memory hardhat network and exit, leaving no trace. quick way to ensure deployments work as intended without consequences
### `yarn test [mocha args...]`
These will execute your tests using mocha. you can pass extra arguments to mocha
### `yarn coverage`
These will produce a coverage report in the `coverage/` folder
### `yarn gas`
These will produce a gas report for function used in the tests
### `yarn dev`
These will run a local hardhat network on `localhost:8545` and deploy your contracts on it. Plus it will watch for any changes and redeploy them.
### `yarn local:dev`
This assumes a local node it running on `localhost:8545`. It will deploy your contracts on it. Plus it will watch for any changes and redeploy them.
### `yarn execute [args...]`
This will execute the script `` against the specified network
### `yarn deploy [args...]`
This will deploy the contract on the specified network.
Behind the scene it uses `hardhat deploy` command so you can append any argument for it
### `yarn export `
This will export the abi+address of deployed contract to ``
### `yarn fork:execute [--blockNumber ] [--deploy] [args...]`
This will execute the script `` against a temporary fork of the specified network
if `--deploy` is used, deploy scripts will be executed
### `yarn fork:deploy [--blockNumber ] [args...]`
This will deploy the contract against a temporary fork of the specified network.
Behind the scene it uses `hardhat deploy` command so you can append any argument for it
### `yarn fork:test [--blockNumber ] [mocha args...]`
This will test the contract against a temporary fork of the specified network.
### `yarn fork:dev [--blockNumber ] [args...]`
This will deploy the contract against a fork of the specified network and it will keep running as a node.
Behind the scene it uses `hardhat node` command so you can append any argument for it