-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #114 from propeller-heads/dc/load-bytecode
fix: Load bytecode from files with include_bytes!
- Loading branch information
Showing
9 changed files
with
69 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,25 @@ | ||
use alloy_primitives::{Address, U256}; | ||
use lazy_static::lazy_static; | ||
|
||
use crate::protocol::errors::SimulationError; | ||
|
||
lazy_static! { | ||
pub static ref EXTERNAL_ACCOUNT: Address = Address::from_slice( | ||
&hex::decode("f847a638E44186F3287ee9F8cAF73FF4d4B80784") | ||
.expect("Invalid string for external account address"), | ||
); | ||
pub static ref MAX_BALANCE: U256 = U256::MAX / U256::from(2); | ||
} | ||
|
||
pub const ERC20_BYTECODE: &[u8] = include_bytes!("assets/ERC20.bin"); | ||
pub const BALANCER_V2: &[u8] = include_bytes!("assets/BalancerV2SwapAdapter.evm.runtime"); | ||
pub const CURVE: &[u8] = include_bytes!("assets/CurveSwapAdapter.evm.runtime"); | ||
pub fn get_adapter_file(protocol: &str) -> Result<&'static [u8], SimulationError> { | ||
match protocol { | ||
"balancer_v2" => Ok(BALANCER_V2), | ||
"curve" => Ok(CURVE), | ||
_ => { | ||
Err(SimulationError::FatalError(format!("Adapter for protocol {} not found", protocol))) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
mod adapter_contract; | ||
mod constants; | ||
pub mod constants; | ||
mod erc20_token; | ||
mod models; | ||
pub mod state; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.