Skip to content

FEAT: support vyper contract verification #10864

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

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

Another-DevX
Copy link
Contributor

@Another-DevX Another-DevX commented Jun 27, 2025

Closes: #10702

This PR enables verification of Vyper contracts via forge verify-contract.

✅ Summary of the approach

  1. Added a new CLI argument --language that allows selecting between solidity and vyper.
  2. Used the Vyper binary directly to generate the solc_json (standard input JSON) through a small bypass, avoiding the need to route through foundry-compilers.
  3. Implemented conditional handling so that, when the target file is a .vy, the appropriate arguments expected by Etherscan for Vyper are applied.

🔧 Dependencies

This implementation depends on:
foundry-rs/block-explorers#91
Please make sure to merge and update that crate before merging this PR.

🧪 Test

Verified on Sepolia:
https://sepolia.etherscan.io/address/0x538d309a74c7201803db2eff456d7ebba56022b2#code
image

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

cool, what's missing to get this over the line?

@@ -410,6 +421,20 @@ impl VerifyArgs {
}
}

pub fn detect_language(args: &VerifyArgs, ctx: &VerificationContext) -> ContractLanguage {
Copy link
Member

Choose a reason for hiding this comment

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

can we make this a function of VerifyArgs instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just fixed!

feat: make detect_language a function from VerifyArgs Impl
@Another-DevX Another-DevX marked this pull request as ready for review June 29, 2025 04:04
@Another-DevX Another-DevX changed the title WIP: support vyper contract verification FEAT: support vyper contract verification Jun 29, 2025
Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

released new block-explorers version

still have a few questions here, mainly why we need additional logic for the solidity codeformat

Comment on lines 28 to 32
#[derive(Copy, Clone, Debug, Eq, PartialEq, ValueEnum)]
pub enum ContractLanguage {
Solidity,
Vyper,
}
Copy link
Member

Choose a reason for hiding this comment

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

needs docs

@Another-DevX Another-DevX requested a review from mattsse July 2, 2025 00:42
@Another-DevX Another-DevX force-pushed the feature/vyper-support branch from 93a3dfe to e049932 Compare July 2, 2025 02:36
@Another-DevX
Copy link
Contributor Author

Btw @mattsse, we should probably open an issue on the foundry-docs to properly mention this new feature, right?

@Norbeth101
Copy link

hello

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

cool, last pedantic nits

and would like another review by @grandizzy or @zerosnacks

}
ContractLanguage::Vyper => {
// Execute vyper -f solc_json {target_path}
let output = Command::new("vyper")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess that's ok for now but wonder if we should upstream a vyper.solc_json fn to compilers as it is basically doing similar as here https://github.com/foundry-rs/compilers/blob/5846d3ca5181ecf4515997eecdeac52fdda22d29/crates/compilers/src/compilers/vyper/mod.rs#L118

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mmm, let me try to use the functions already existing on compilers or to create a new one for the solc_json generation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Vyper Support with forge verify-contract
4 participants