pub struct Allocation {
pub params: AllocationParams,
pub status: AllocationStatus,
pub user: Addr,
pub block_ts: u64,
}Fields§
§params: AllocationParamsThe allocation parameters
status: AllocationStatusThe allocation status
user: AddrAllocation owner
block_ts: u64Current block timestamp
Implementations§
Source§impl Allocation
impl Allocation
pub fn must_load( storage: &dyn Storage, block_ts: u64, user: &Addr, ) -> Result<Self, ContractError>
pub fn save(self, storage: &mut dyn Storage) -> StdResult<()>
pub fn new_allocation( storage: &mut dyn Storage, block_ts: u64, user: &Addr, params: CreateAllocationParams, ) -> Result<Self, ContractError>
pub fn withdraw_and_update(&mut self) -> Result<Uint128, ContractError>
pub fn propose_new_receiver( &mut self, storage: &dyn Storage, new_receiver: &Addr, ) -> Result<(), ContractError>
pub fn drop_proposed_receiver(&mut self) -> Result<Addr, ContractError>
Sourcepub fn claim_allocation(
self,
storage: &mut dyn Storage,
new_receiver: &Addr,
) -> Result<Self, ContractError>
pub fn claim_allocation( self, storage: &mut dyn Storage, new_receiver: &Addr, ) -> Result<Self, ContractError>
Produces new allocation object for new receiver. Old allocation is removed from state.
Sourcepub fn compute_unlocked_amount(&self, timestamp: u64) -> Uint128
pub fn compute_unlocked_amount(&self, timestamp: u64) -> Uint128
Computes number of tokens that are now unlocked for a given allocation
Sourcepub fn compute_withdraw_amount(
&self,
timestamp: u64,
) -> SimulateWithdrawResponse
pub fn compute_withdraw_amount( &self, timestamp: u64, ) -> SimulateWithdrawResponse
Computes number of tokens that are withdrawable for a given allocation
pub fn decrease_allocation( &mut self, amount: Uint128, ) -> Result<(), ContractError>
pub fn increase_allocation( &mut self, amount: Uint128, ) -> Result<(), ContractError>
pub fn update_unlock_schedule( &mut self, new_schedule: &Schedule, ) -> StdResult<()>
Trait Implementations§
Source§impl Clone for Allocation
impl Clone for Allocation
Source§fn clone(&self) -> Allocation
fn clone(&self) -> Allocation
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 Allocation
impl Debug for Allocation
Source§impl<'de> Deserialize<'de> for Allocation
impl<'de> Deserialize<'de> for Allocation
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
Source§impl JsonSchema for Allocation
impl JsonSchema for Allocation
Source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for Allocation
impl PartialEq for Allocation
Source§fn eq(&self, other: &Allocation) -> bool
fn eq(&self, other: &Allocation) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for Allocation
impl Serialize for Allocation
impl StructuralPartialEq for Allocation
Auto Trait Implementations§
impl Freeze for Allocation
impl RefUnwindSafe for Allocation
impl Send for Allocation
impl Sync for Allocation
impl Unpin for Allocation
impl UnsafeUnpin for Allocation
impl UnwindSafe for Allocation
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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