Very simple contract for locking liquidity (Uniswap v3 LP) and continue claiming earned fees
yarn
or use
pnpm i
There are 2 flavors of tests: hardhat and forge. tests are on both fw to catch different aspects.
- One using hardhat that can leverage hardhat-deploy to reuse deployment procedures and named accounts:
yarn test
forge test
This require the installation of forge (see foundry)
Here is the list of npm scripts you can execute:
Some of them relies on ./_scripts.js to allow parameterizing it via command line argument (have a look inside if you need modifications)
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
These will format check your code. the :fix
version will modifiy the files to match the requirement specified in .prettierrc.
These will compile your contracts
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
These will execute your tests using mocha. you can pass extra arguments to mocha
These will produce a coverage report in the coverage/
folder
These will produce a gas report for function used in the tests
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.
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.
This will execute the script <file.ts>
against the specified network
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
This will export the abi+address of deployed contract to <file.json>
This will execute the script <file.ts>
against a temporary fork of the specified network
if --deploy
is used, deploy scripts will be executed
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
This will test the contract against a temporary fork of the specified network.
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
Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
Foundry consists of:
- Forge: Ethereum testing framework (like Truffle, Hardhat and DappTools).
- Cast: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
- Anvil: Local Ethereum node, akin to Ganache, Hardhat Network.
- Chisel: Fast, utilitarian, and verbose solidity REPL.
$ forge build
$ forge test
$ forge fmt
$ forge snapshot
$ anvil
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
$ cast <subcommand>
$ forge --help
$ anvil --help
$ cast --help