Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

templatised foundry deploy script #43

Merged
merged 3 commits into from
Jun 12, 2024

Conversation

technophile-04
Copy link
Collaborator

@technophile-04 technophile-04 commented Jun 3, 2024

Description :

This will allow people to create extension's which adds new contract and also deployments for them.

To test :

Switch to this branch then:

  1. Start cli :
yarn dev
  1. Scaffold new app, with eip-5792 extension:
yarn cli -e technophile-04/eip-5792:foundry
  1. Choose foundry as extension too

Here is extension repo


Adding contracts and deployments in hardhat does not require any templatisation since we can create separate 01_deploy_.. file and main deploy script 99_deploy... will consider all the deployments.

But in foundry this is not the case checkout this for more details

@rin-st
Copy link
Member

rin-st commented Jun 3, 2024

Thanks Shiv, good job!

Trying to run

yarn cli -e technophile-04/eip-5792:foundry

and getting this error when deploying contracts (sorry for screenshots, adding as images because of colors)

image

if I move vm.stopBroadcast() upper in Deploy.s.sol

    vm.startBroadcast(deployerPrivateKey);

    YourContract yourContract = new YourContract(vm.addr(deployerPrivateKey));
    console.logString(string.concat("YourContract deployed at: ", vm.toString(address(yourContract))));

    vm.stopBroadcast();

    DeployExampleContract deployExampleContract = new DeployExampleContract();
    deployExampleContract.run();

I'm getting this error
image

Looks like DeployHelpers.s.sol should create folder/files if they don't exist.

Upd. Added empty deployments/31337.json and deployment worked 🎉 . But looks like it should be changed in another pr.

@technophile-04
Copy link
Collaborator Author

Upd. Added empty deployments/31337.json and deployment worked 🎉 . But looks like it should be changed in another pr.

Ohh yeah thanks !, actually this bug was introduced in #38 and currently present main.

In #38 we removed .gitignore from foundry/deployments and since .gitignore was only file present in deployments git removed the whole deployments dir and stopped tracking it.

Fixed this at 8e2f18d by adding deployments/31337.json this makes sure that deployments dir is present when we run yarn deploy. We can't have empty deployments in cli template since git is not able to track it. But I think its fine to have deployments/31337.json already present since 31337 is any which way git ignored in scaffolded app and also it just a small file which mentions name of the network so its always deterministic

Copy link
Member

@rin-st rin-st left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm! Thank you!

@technophile-04
Copy link
Collaborator Author

Merging this, thanks !! 🙌

@technophile-04 technophile-04 merged commit 6a3afc7 into main Jun 12, 2024
1 check passed
@technophile-04 technophile-04 deleted the templatise-foundry-deploy-script branch June 12, 2024 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants