Deploy on EVM (Foundry)
Foundry is an exceptionally fast, portable, and modular toolkit designed for Ethereum application development, and it's written in Rust – a choice we highly appreciate!
Requirements:
If Rust is not already installed on your local system, simply follow the provided link to get started. Now, let's proceed with installing Foundry:
Start by establishing a new project folder on your system. After this folder is set up, proceed to initialize it with Forge:
The command will populate the directory with various files, including an example contract, deployment scripts, and tests.
We will need OpenZeppelin for our ERC20 development:
Finally, let's create the contract. Add a new file into the src/
directory and name it Token.sol
. Use the following code for this file:
Now, let's proceed with building the project:
The command mentioned above will download the Solc compiler and build the contracts.
To deploy our Token, let's create a new file named Token.s.sol
in the script/
directory. Then, insert the following code into this file:
We're almost there. Now, we need to execute a script to deploy everything:
Remember to replace the placeholder for the private key with your actual private key.
Upon successful deployment, you will receive a message confirming that the contract has been deployed successfully. To simulate the execution before broadcasting the transaction, simply remove the --broadcast
flag from the command above.
You will see the following message:
Copy the address and go to block explorer, that's all! Now you can continue develop your contract/project on the EVM part of the L2.
Last updated