I know there are so many articles of how to test / deploy proxy contracts with Hardhat, but do you know you can do it with Foundry?
Here is how it works:
First, create a new project, run `forge init` and the next commands:
Right after create a 'remappings.txt' and provide new paths:
Then open up the foundry.toml file and add the following code to your file:
Now lets write two versions of token contract:
Pay attention to the next line:
@custom
:oz-upgrades-from MyToken. It is necessary to run an upgrade in a right way!
Now we can write a test! Also note some new import files and Upgrades from "openzeppelin-foundry-upgrades/Upgrades.sol"
Here is a test contract:
Now you can run `forge test --ffi` to test your proxy!
Later you can deploy it to the required blockchain with a simple script:
Now you know how to work with proxy contracts in Foundry!
Like, comment and share!
For more info visit Open Zeppelin repo:
#foundry
#proxy
#test
Completely free courses
Learn more about the blockchain world
Free education videos
by RareSkills
by Jeiwan
by RareSkills
by RareSkills
by Andreas M. Antonopoulos, Gavin Wood
by Micah Dameron
Compare execution layer differences between chains
Dive deep into the storage of any contract