Using Foundry
This page describes how to deploy smart contracts using Foundry.
Foundry
Foundry is a smart contract development toolchain. Foundry manages your dependencies, compiles your project, runs tests, deploys, and lets you interact with the chain from the command-line and via Solidity scripts.
Foundry book, see: https://book.getfoundry.sh/
Steps
Install Foundry and Node.
Create a project with Foundry,
forge init
andcd
into it:
Let's check out what
forge
generated for us:
We Can build the project with forge build
:
And run the tests with forge test
:
Deploy the contract from your project, located at
src/Counter.sol
. ReplaceYOUR_PRIVATE_KEY
with your private key, mentioned in the previous prerequisites section.
--legacy
flag means Use legacy transactions instead of EIP1559 ones. This is auto-enabled for common networks without EIP1559.<unlock_time>
is the Unix timestamp after which the funds locked in the contract will become available for withdrawal. Try setting this to some Unix timestamp in the future, like1696118400
(this Unix timestamp corresponds to October 1, 2023).<lock_amount>
is the amount of testETH
to be locked in the contract. Try setting this to some small amount, like0.0000001ether
.For information on additional flag options, follow this link
Last updated