Foundry I

Solidity Programming Language
2 min readMay 9, 2022

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.

Foundry Resources

The Foundry Book is the definitive resource if you want to read more about Foundry. How to Foundry is an excellent introductory video.

Installation

Open your terminal and type in the following command:

curl -L https://foundry.paradigm.xyz | bash

This will download foundryup. Then install Foundry by running:

foundryup

To verify that Foundry is installed, run forge --version:

forge — version

You see the following message.

forge 0.2.0 (ccdfd3a 2022–04–27T00:03:53.441110+00:00)

forge init

To start a new project with Foundry, use forge init:

Note=If it doesn’t work, you can use forge init — force

forge init hello_foundry2

cd hello_foundry2
tree

This is representation of “hello_foundry2” in your home root.

There are 3 directories.

forge build

We can build the project with forge build:

forge build

You see the following message.

forge test

And run the tests with forge test:

forge test

You see the following message.

Ok.

Fucking openzeppelin and foundry physical path problem

Do you want to install openzeppelin ?

forge install openzeppelin/openzeppelin-contracts

didnt work ?

forge install OpenZeppelin/openzeppelin-contracts — no-commit

and system load this repository to the lib folder

but you need to arrange for using NPM style physical path

touch remappings.txt

add the following path to the .txt file

openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/

save it !

You can now import openzeppelin files as

import “openzeppelin-contracts/security/ReentrancyGuard.sol”;

import “openzeppelin-contracts/access/Ownable.sol”;

Please follow my article on Foundry…

Foundry II

Foundry III

Foundry IV

--

--

Solidity Programming Language

Solidity basics for beginners: Learn the fundamentals of smart contract development and build your first DApp! #Solidity #Foundry #Ethereum #Opcodes #DApps