pub struct ContractRestriction {
pub allowed_contracts: HashSet<String>,
pub allowed_selectors: HashSet<String>,
pub blocked_selectors: HashSet<String>,
}Expand description
Contract interaction restriction
Fields§
§allowed_contracts: HashSet<String>Allowed contract addresses (empty = all allowed)
allowed_selectors: HashSet<String>Allowed function selectors (4 bytes, hex-encoded)
blocked_selectors: HashSet<String>Blocked function selectors
Implementations§
Source§impl ContractRestriction
impl ContractRestriction
Sourcepub fn allow_contract(self, address: impl Into<String>) -> Self
pub fn allow_contract(self, address: impl Into<String>) -> Self
Add an allowed contract
Sourcepub fn allow_selector(self, selector: impl Into<String>) -> Self
pub fn allow_selector(self, selector: impl Into<String>) -> Self
Add an allowed function selector
Sourcepub fn block_selector(self, selector: impl Into<String>) -> Self
pub fn block_selector(self, selector: impl Into<String>) -> Self
Block a function selector
Trait Implementations§
Source§impl Clone for ContractRestriction
impl Clone for ContractRestriction
Source§fn clone(&self) -> ContractRestriction
fn clone(&self) -> ContractRestriction
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ContractRestriction
impl Debug for ContractRestriction
Source§impl Default for ContractRestriction
impl Default for ContractRestriction
Source§impl<'de> Deserialize<'de> for ContractRestriction
impl<'de> Deserialize<'de> for ContractRestriction
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ContractRestriction
impl RefUnwindSafe for ContractRestriction
impl Send for ContractRestriction
impl Sync for ContractRestriction
impl Unpin for ContractRestriction
impl UnwindSafe for ContractRestriction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more