-
Notifications
You must be signed in to change notification settings - Fork 23
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
base: main
Are you sure you want to change the base?
Conversation
339b70c
to
4e0507a
Compare
no manual override yet, but now the detection of explorers works a lot better |
adds contract verification as feature #48 |
|
||
fn main() { | ||
// Create assets directory | ||
let clean = env::var("CLEAN").unwrap_or("false".to_string()) == "true"; |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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),
}
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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
Fixes #44