feat: add support for basic vyper project using forge init --vyper#9930
feat: add support for basic vyper project using forge init --vyper#9930startup-dreamer wants to merge 2 commits intofoundry-rs:masterfrom
Conversation
zerosnacks
left a comment
There was a problem hiding this comment.
Hi @startup-dreamer, thanks for your PR
I would prefer if the Vyper template used local files, see: https://github.com/foundry-rs/foundry/tree/master/crates/forge/assets
We will have to move the Solidity ones in their respective subfolder in the assets directory and create a Vyper equivalent
Thanks!
|
Makes sense, I'll do the changes. |
|
Hey @startup-dreamer, if time permits - would be great to get this in! Thanks |
I will try to ship this by the end of weekend. |
5528dc5 to
985132e
Compare
This comment was marked as outdated.
This comment was marked as outdated.
985132e to
ec2d2f1
Compare
ec2d2f1 to
5b06b8e
Compare
|
Thanks! This is looking great |
|
Hey @zerosnacks! I can continue working on this — I'd also love for this feature to go out ASAP. Just let me know if my approach and semantics look good to you; if not, I’m happy to make changes. |
| with: | ||
| version: nightly |
There was a problem hiding this comment.
| with: | |
| version: nightly |
We prefer using stable by default
| - name: Install pnpm | ||
| uses: pnpm/action-setup@v3 | ||
| with: | ||
| version: latest | ||
| run_install: false | ||
|
|
||
| - name: Get pnpm cache directory path | ||
| id: pnpm-cache-dir-path | ||
| run: echo "dir=$(pnpm store path --silent)" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Restore pnpm cache | ||
| uses: actions/cache@v4 | ||
| id: pnpm-cache | ||
| with: | ||
| path: ${{ steps.pnpm-cache-dir-path.outputs.dir }} | ||
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
| restore-keys: ${{ runner.os }}-pnpm-store- | ||
|
|
||
| - name: Use Node.js ${{ matrix.node_version }} | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ matrix.node_version }} | ||
|
|
||
| - name: Install pnpm project with a clean slate | ||
| run: pnpm install --prefer-offline --frozen-lockfile |
There was a problem hiding this comment.
| - name: Install pnpm | |
| uses: pnpm/action-setup@v3 | |
| with: | |
| version: latest | |
| run_install: false | |
| - name: Get pnpm cache directory path | |
| id: pnpm-cache-dir-path | |
| run: echo "dir=$(pnpm store path --silent)" >> $GITHUB_OUTPUT | |
| - name: Restore pnpm cache | |
| uses: actions/cache@v4 | |
| id: pnpm-cache | |
| with: | |
| path: ${{ steps.pnpm-cache-dir-path.outputs.dir }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: ${{ runner.os }}-pnpm-store- | |
| - name: Use Node.js ${{ matrix.node_version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node_version }} | |
| - name: Install pnpm project with a clean slate | |
| run: pnpm install --prefer-offline --frozen-lockfile | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v3 | |
| with: | |
| version: latest | |
| run_install: false | |
| - name: Get pnpm cache directory path | |
| id: pnpm-cache-dir-path | |
| run: echo "dir=$(pnpm store path --silent)" >> $GITHUB_OUTPUT | |
| - name: Restore pnpm cache | |
| uses: actions/cache@v4 | |
| id: pnpm-cache | |
| with: | |
| path: ${{ steps.pnpm-cache-dir-path.outputs.dir }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: ${{ runner.os }}-pnpm-store- | |
| - name: Use Node.js ${{ matrix.node_version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node_version }} | |
| - name: Install pnpm project with a clean slate | |
| run: pnpm install --prefer-offline --frozen-lockfile |
I would prefer keeping this workflow template focused on Vyper + Foundry alone
|
|
||
| import {Vm} from "forge-std/Vm.sol"; | ||
|
|
||
| contract VyperDeployer { |
There was a problem hiding this comment.
I believe it is possible, per #8181, to deployCode directly like this https://github.com/mpeyfuss/vyper-template/blob/08a0eb515b2f0493d595de3ebf5a048442ea9a0f/script/Counter.s.sol#L10
eliminating the need for VyperDeployer and FFI should also not be required anymore
| // Write the full config with FFI enabled to foundry.toml | ||
| if !dest.exists() { | ||
| let toml_content = "[profile.default]\nsrc = \"src\"\nout = \"out\"\nlibs = [\"lib\"]\nffi = true\n\n# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options".to_string(); | ||
| fs::write(dest, toml_content)?; |
There was a problem hiding this comment.
See above, I don't think we actually need FFI anymore
|
Hey @startup-dreamer! My apologies for my late reply! This got lost in all my notifications Directionally this is looking good but it includes a few functions / files that are not required anymore |
|
Hi @startup-dreamer, would you be up for making the proposed modifications or would you like me to take this over? Thanks! |
|
Closing in favor of #11383 Added you as a co-author Thanks! |
Closes: #8340
This PR aims to add
forge init --vypercommand which instantiate a basic vyper project like this project as suggested here #8340 (comment).This command mimicsforge init --template https://github.com/Patronum-Labs/foundry-vypercurrently the standard way of initializing a vyper project.PR Checklist