-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initial commit * clippy * fmt * remove println * changes * integration tests * clippy * clippy * transaction simulation test * updated readme * changed names of params * updated supported features * updated readme * Update README.md Co-authored-by: FabijanC <[email protected]> * updated readme * rename method to set_auto_impersonate * add check for impersonate_account to not be able to impersonate an account that is in the state * changed test name * renamed utility method * use assert contains * renamed spawn_forkable_devnet with spawn_with_forking * use to_hex_felt * renamed methods auto_impersonate to set_auto_impersonate * change variable name and changed comment * edited utility function name * edited integration test * test improvement * typo [skip ci] * refactored integration tests * clippy * updated comment * fixed non compiling tests * Revert "fixed non compiling tests" This reverts commit 611b65c. * Revert "Merge branch 'main' into impersonate" This reverts commit 98de0f6, reversing changes made to 66f3273. * Revert "Revert "Merge branch 'main' into impersonate"" This reverts commit b038b20. * Revert "Revert "fixed non compiling tests"" This reverts commit dc0eed2. --------- Co-authored-by: FabijanC <[email protected]>
- Loading branch information
1 parent
a6fc0a1
commit de07790
Showing
15 changed files
with
680 additions
and
59 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
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use std::collections::HashSet; | ||
|
||
use starknet_types::contract_address::ContractAddress; | ||
|
||
#[derive(Default, Clone)] | ||
pub(crate) struct Cheats { | ||
impersonated_accounts: HashSet<ContractAddress>, | ||
auto_impersonate: bool, | ||
} | ||
|
||
impl Cheats { | ||
pub(crate) fn impersonate_account(&mut self, account: ContractAddress) { | ||
self.impersonated_accounts.insert(account); | ||
} | ||
pub(crate) fn stop_impersonating_account(&mut self, account: &ContractAddress) { | ||
self.impersonated_accounts.remove(account); | ||
} | ||
pub(crate) fn is_impersonated(&self, account: &ContractAddress) -> bool { | ||
self.auto_impersonate || self.impersonated_accounts.contains(account) | ||
} | ||
pub(crate) fn set_auto_impersonate(&mut self, auto_impersonation: bool) { | ||
self.auto_impersonate = auto_impersonation; | ||
} | ||
} |
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.