pub struct PolicyConfig {
pub spending_limits: HashMap<ChainType, SpendingLimits>,
pub whitelist: Option<HashSet<String>>,
pub blacklist: HashSet<String>,
pub time_bounds: Option<TimeBounds>,
pub contract_restrictions: Option<ContractRestriction>,
pub additional_approval_threshold: Option<u128>,
pub max_pending_requests: usize,
pub enabled: bool,
}Expand description
Complete policy configuration
Fields§
§spending_limits: HashMap<ChainType, SpendingLimits>Spending limits per chain type
whitelist: Option<HashSet<String>>Whitelisted addresses (if set, only these addresses are allowed)
blacklist: HashSet<String>Blacklisted addresses (always rejected)
time_bounds: Option<TimeBounds>Time restrictions
contract_restrictions: Option<ContractRestriction>Contract interaction restrictions
additional_approval_threshold: Option<u128>Whether to require additional approval for amounts exceeding a threshold
max_pending_requests: usizeMaximum pending requests at any time
enabled: boolWhether the policy is enabled
Implementations§
Source§impl PolicyConfig
impl PolicyConfig
Sourcepub fn with_spending_limits(
self,
chain: ChainType,
limits: SpendingLimits,
) -> Self
pub fn with_spending_limits( self, chain: ChainType, limits: SpendingLimits, ) -> Self
Set spending limits for a chain
Sourcepub fn with_per_tx_limit(
self,
amount: u128,
currency: impl Into<String>,
) -> Self
pub fn with_per_tx_limit( self, amount: u128, currency: impl Into<String>, ) -> Self
Set per-transaction limit (convenience method for EVM)
Sourcepub fn with_daily_limit(self, amount: u128) -> Self
pub fn with_daily_limit(self, amount: u128) -> Self
Set daily limit (convenience method for EVM)
Sourcepub fn with_weekly_limit(self, amount: u128) -> Self
pub fn with_weekly_limit(self, amount: u128) -> Self
Set weekly limit (convenience method for EVM)
Sourcepub fn with_whitelist(self, addresses: Vec<String>) -> Self
pub fn with_whitelist(self, addresses: Vec<String>) -> Self
Set address whitelist
Sourcepub fn with_blacklist(self, addresses: Vec<String>) -> Self
pub fn with_blacklist(self, addresses: Vec<String>) -> Self
Add address to blacklist
Sourcepub fn with_time_bounds(self, bounds: TimeBounds) -> Self
pub fn with_time_bounds(self, bounds: TimeBounds) -> Self
Set time bounds
Sourcepub fn with_contract_restrictions(
self,
restrictions: ContractRestriction,
) -> Self
pub fn with_contract_restrictions( self, restrictions: ContractRestriction, ) -> Self
Set contract restrictions
Sourcepub fn with_additional_approval_threshold(self, amount: u128) -> Self
pub fn with_additional_approval_threshold(self, amount: u128) -> Self
Set additional approval threshold
Trait Implementations§
Source§impl Clone for PolicyConfig
impl Clone for PolicyConfig
Source§fn clone(&self) -> PolicyConfig
fn clone(&self) -> PolicyConfig
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 PolicyConfig
impl Debug for PolicyConfig
Source§impl Default for PolicyConfig
impl Default for PolicyConfig
Source§impl<'de> Deserialize<'de> for PolicyConfig
impl<'de> Deserialize<'de> for PolicyConfig
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 PolicyConfig
impl RefUnwindSafe for PolicyConfig
impl Send for PolicyConfig
impl Sync for PolicyConfig
impl Unpin for PolicyConfig
impl UnwindSafe for PolicyConfig
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