Skip to content

Commit

Permalink
Merge pull request #112 from propeller-heads/dc/fix-erc20-path
Browse files Browse the repository at this point in the history
fix: Make the ERC20.bin filepath dependent on CARGO_MANIFEST_DIR
  • Loading branch information
dianacarvalho1 authored Dec 19, 2024
2 parents 3564a4b + 2d20d30 commit e7af9b1
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/evm/protocol/vm/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{
env,
fs::File,
io::Read,
path::{Path, PathBuf},
path::PathBuf,
str::FromStr,
sync::{Arc, LazyLock},
};
Expand Down Expand Up @@ -307,13 +307,8 @@ pub(crate) fn get_contract_bytecode(path: &PathBuf) -> Result<Bytecode, FileErro
}

pub(crate) fn load_erc20_bytecode() -> Result<Bytecode, FileError> {
let erc20_bin_path = Path::new(file!())
.parent()
.ok_or_else(|| {
FileError::Structure("Failed to obtain assets directory for ERC20.bin".to_string())
})?
.join("assets")
.join("ERC20.bin");
let erc20_bin_path =
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("src/evm/protocol/vm/assets/ERC20.bin");

let mut erc_20_file = File::open(&erc20_bin_path).map_err(FileError::Io)?;
let mut erc_20_contents = Vec::new();
Expand Down

0 comments on commit e7af9b1

Please sign in to comment.