pub struct RateLimit {
pub volume: Dec,
pub used: u64,
pub cap: u64,
pub surplus: u64,
}Expand description
userRateLimit.
Fields§
§volume: DecUSDC traded since the address began: what buys its cap.
used: u64§cap: u64§surplus: u64Bought with reserveRequestWeight.
Implementations§
Source§impl RateLimit
impl RateLimit
Sourcepub const fn remaining(&self) -> u64
pub const fn remaining(&self) -> u64
What is left before the address is throttled; never a wrapped total, since throttled requests still count.
pub const fn is_throttled(&self) -> bool
Sourcepub const fn cancel_cap(&self) -> u64
pub const fn cancel_cap(&self) -> u64
What cancels may use: min(cap + 100000, cap * 2), so a throttled address can still cancel.
Sourcepub fn earned_cap(volume: Dec) -> Option<u64>
pub fn earned_cap(volume: Dec) -> Option<u64>
The cap volume earns: 10,000 and one for every whole USDC. None
for a negative volume.
Trait Implementations§
impl Copy for RateLimit
Source§impl<'de> Deserialize<'de> for RateLimit
impl<'de> Deserialize<'de> for RateLimit
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
impl Eq for RateLimit
impl StructuralPartialEq for RateLimit
Auto Trait Implementations§
impl Freeze for RateLimit
impl RefUnwindSafe for RateLimit
impl Send for RateLimit
impl Sync for RateLimit
impl Unpin for RateLimit
impl UnsafeUnpin for RateLimit
impl UnwindSafe for RateLimit
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.