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

CLI: explorer rework and contract verification #64

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

gretzke
Copy link
Collaborator

@gretzke gretzke commented Feb 12, 2025

Fixes #44

@gretzke gretzke force-pushed the deploy-cli-explorer-rework branch from 339b70c to 4e0507a Compare February 12, 2025 22:16
@gretzke gretzke changed the title CLI: explorer rework CLI: explorer rework and contract verification Feb 13, 2025
@gretzke
Copy link
Collaborator Author

gretzke commented Feb 13, 2025

no manual override yet, but now the detection of explorers works a lot better

@gretzke
Copy link
Collaborator Author

gretzke commented Feb 13, 2025

adds contract verification as feature #48


fn main() {
// Create assets directory
let clean = env::var("CLEAN").unwrap_or("false".to_string()) == "true";
Copy link
Contributor

Choose a reason for hiding this comment

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

recommend using structopt to manage env variables / cli parameters

pub name: String,
pub url: String,
pub standard: String,
pub explorer_type: SupportedExplorerType,
Copy link
Contributor

Choose a reason for hiding this comment

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

Recommend having the enum be the top level type with struct variant, to allow for potential of different explorer types needing different parameters / behavior. like

enum ExplorerType {
   Etherscan(ExplorerData),
   Blockscout(ExplorerData),
   ...
   NewExplorer(OtherExplorerData),
   
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oh that's cool, thanks!

}

impl ExplorerApiLib {
pub fn new(explorer: Explorer, api_key: String) -> Result<Self, Box<dyn std::error::Error>> {
if explorer.name.to_lowercase().contains("blockscout") {
if explorer.explorer_type == SupportedExplorerType::Blockscout {
Copy link
Contributor

Choose a reason for hiding this comment

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

Recommend a match statement rather than if tree. better type checking for case coverage

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.

Add manual block explorer override
2 participants