generated from keep-starknet-strange/alexandria
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
9 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
use contracts::contract_account::{ContractAccount, ContractAccountTrait}; | ||
use contracts::kakarot_core::{KakarotCore}; | ||
use contracts::kakarot_core::interface::{IKakarotCore}; | ||
use contracts::kakarot_core::{ContractAccountStorage, KakarotCore}; | ||
use evm::errors::{EVMError}; | ||
use starknet::EthAddress; | ||
|
||
/// Returns the bytecode of the EVM account (EOA or CA) | ||
fn bytecode(evm_address: EthAddress) -> Span<u8> { | ||
fn bytecode(evm_address: EthAddress) -> Result<Span<u8>, EVMError> { | ||
// Get access to Kakarot State locally | ||
let kakarot_state = KakarotCore::unsafe_new_contract_state(); | ||
|
||
let eoa_starknet_address = kakarot_state.eoa_starknet_address(evm_address); | ||
|
||
// Case 1: EOA is deployed | ||
if !eoa_starknet_address.is_zero() { | ||
return Default::default().span(); | ||
return Result::Ok(Default::default().span()); | ||
} | ||
|
||
// Case 2: EOA is not deployed and CA is deployed | ||
let ca_storage = kakarot_state.contract_account_storage(evm_address); | ||
// Once bytecode is implemented: return ca_storage.bytecode; | ||
return Default::default().span(); | ||
let ca = ContractAccountTrait::new(evm_address); | ||
return Result::Ok(Default::default().span()); | ||
} | ||
|
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