Skip to content

Commit

Permalink
fix(verified sources fetcher): Use correct contact_name for `SolSin…
Browse files Browse the repository at this point in the history
…gleFile` (#1433)

## What ❔

Use correct `contact_name` for `SolSingleFile `

## Why ❔

Fix panic in verified sources fetcher.

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [ ] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [ ] Code has been formatted via `zk fmt` and `zk lint`.
- [ ] Spellcheck has been run via `zk spellcheck`.
- [ ] Linkcheck has been run via `zk linkcheck`.
  • Loading branch information
perekopskiy committed Mar 14, 2024
1 parent cfc88a8 commit 0764227
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions core/bin/verified_sources_fetcher/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,16 @@ async fn main() {

match req.req.source_code_data {
SourceCodeData::SolSingleFile(content) => {
let contact_name = if let Some((_file_name, contract_name)) =
req.req.contract_name.rsplit_once(':')
{
contract_name.to_string()
} else {
req.req.contract_name.clone()
};

let mut file =
std::fs::File::create(format!("{}/{}.sol", &dir, req.req.contract_name))
.unwrap();
std::fs::File::create(format!("{}/{}.sol", &dir, contact_name)).unwrap();
file.write_all(content.as_bytes()).unwrap();
}
SourceCodeData::YulSingleFile(content) => {
Expand Down

0 comments on commit 0764227

Please sign in to comment.