Enum mito_protocol::launchpad::Schedule
source · pub enum Schedule {
SaturatingLinear,
PiecewiseLinear(Vec<(u64, Uint128)>),
}
Variants§
SaturatingLinear
Vests linearly from 0
to total
.
PiecewiseLinear(Vec<(u64, Uint128)>)
Vests by linearly interpolating between the provided
(seconds, amount) points. The first amount must be zero and
the last amount the total vesting amount. seconds
are
seconds since the vest start time.
There is a problem in the underlying Curve library that
doesn’t allow zero start values, so the first value of
seconds
must be > 1. To start at a particular time (if you
need that level of precision), subtract one from the true
start time, and make the first seconds
value 1
.
Implementations§
source§impl Schedule
impl Schedule
sourcepub fn into_curve(
self,
total: Uint128,
duration_seconds: u64,
) -> Result<Curve, ContractError>
pub fn into_curve( self, total: Uint128, duration_seconds: u64, ) -> Result<Curve, ContractError>
The vesting schedule tracks vested(t), so for a curve to be valid:
- it must start at 0,
- it must end at total,
- it must never decrease.
Piecewise curves must have at least two steps. One step would be a constant vest (why would you want this?).
A schedule is valid if total
is zero: nothing will ever be
paid out. Consumers should consider validating that total
is
non-zero.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Schedule
impl<'de> Deserialize<'de> for Schedule
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>,
source§impl JsonSchema for Schedule
impl JsonSchema for Schedule
source§fn schema_name() -> String
fn schema_name() -> String
source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read moresource§impl PartialEq for Schedule
impl PartialEq for Schedule
impl Eq for Schedule
impl StructuralPartialEq for Schedule
Auto Trait Implementations§
impl Freeze for Schedule
impl RefUnwindSafe for Schedule
impl Send for Schedule
impl Sync for Schedule
impl Unpin for Schedule
impl UnwindSafe for Schedule
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)