Struct sapio_contrib::contracts::undo_send::UndoSendInternal
source · pub struct UndoSendInternal {
pub from_contract: Compiled,
pub to_contract: Compiled,
pub amount: CoinAmount,
pub timeout: AnyRelTimeLock,
}
Expand description
Undoable Sending Contract
UndoSendInternal allows funds to be sent to the to_contract only after a relative timeout. Otherwise, they can move back to the from_contract.
Fields§
§from_contract: Compiled
The contract to return funds to before timeout
to_contract: Compiled
the contract to forward funds to after timeout
amount: CoinAmount
the amount
timeout: AnyRelTimeLock
the timeout period (relative height or blocks)
Trait Implementations§
source§impl Contract for UndoSendInternal
impl Contract for UndoSendInternal
source§const THEN_FNS: &'static [fn() -> Option<ThenFuncAsFinishOrFunc<'static, Self, Self::StatefulArguments>>] = _
const THEN_FNS: &'static [fn() -> Option<ThenFuncAsFinishOrFunc<'static, Self, Self::StatefulArguments>>] = _
binds the list of ThenFunc
’s to this impl.
Any fn() which returns None is ignored (useful for type-level state machines)
§type StatefulArguments = ()
type StatefulArguments = ()
Due to type system limitations, all
FinishOrFuncs
for a Contract type must share a
parameter pack type. If stable, no default type allowed.source§const FINISH_OR_FUNCS: &'static [fn() -> Option<Box<dyn CallableAsFoF<Self, Self::StatefulArguments>>>] = _
const FINISH_OR_FUNCS: &'static [fn() -> Option<Box<dyn CallableAsFoF<Self, Self::StatefulArguments>>>] = _
binds the list of
FinishOrFunc
’s to this impl.
Any fn() which returns None is ignored (useful for type-level state machines)source§const FINISH_FNS: &'static [fn() -> Option<Guard<Self>>] = _
const FINISH_FNS: &'static [fn() -> Option<Guard<Self>>] = _
binds the list of
Gurard
’s to this impl as unlocking conditions.
Guard
s only need to be bound if it is desired that they are
sufficient to unlock funds, a Guard
should not be bound if it is
intended to be used with a ThenFunc
.
Any fn() which returns None is ignored (useful for type-level state machines)source§fn metadata(&self, _ctx: Context) -> Result<ObjectMetadata, CompilationError>
fn metadata(&self, _ctx: Context) -> Result<ObjectMetadata, CompilationError>
Generate metadata for this contract object
source§fn ensure_amount(&self, _ctx: Context) -> Result<Amount, CompilationError>
fn ensure_amount(&self, _ctx: Context) -> Result<Amount, CompilationError>
minimum balance to have in this coin
source§impl<'de> Deserialize<'de> for UndoSendInternal
impl<'de> Deserialize<'de> for UndoSendInternal
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 UndoSendInternal
impl JsonSchema for UndoSendInternal
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(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &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 moreAuto Trait Implementations§
impl RefUnwindSafe for UndoSendInternal
impl Send for UndoSendInternal
impl Sync for UndoSendInternal
impl Unpin for UndoSendInternal
impl UnwindSafe for UndoSendInternal
Blanket Implementations§
source§impl<C> AnyContract for C
impl<C> AnyContract for C
§type StatefulArguments = <C as Contract>::StatefulArguments
type StatefulArguments = <C as Contract>::StatefulArguments
The parameter pack type for
FinishOrFunc
s.§type Ref = C
type Ref = C
A Reference which can be extracted to the contract argument data
For some types, Ref == Self, and for other types Ref may point to a member.
This enables
DynamicContract
and Contract
to impl AnyContract
, as well
as more exotic types.source§fn then_fns<'a>(
&'a self
) -> &'a [fn() -> Option<FinishOrFunc<'a, <C as AnyContract>::Ref, <C as AnyContract>::StatefulArguments, ThenFuncTypeTag, WebAPIDisabled>>]where
<C as AnyContract>::Ref: 'a,
fn then_fns<'a>(
&'a self
) -> &'a [fn() -> Option<FinishOrFunc<'a, <C as AnyContract>::Ref, <C as AnyContract>::StatefulArguments, ThenFuncTypeTag, WebAPIDisabled>>]where
<C as AnyContract>::Ref: 'a,
obtain a reference to the
ThenFuncAsFinishOrFunc
list.source§fn finish_or_fns<'a>(
&'a self
) -> &'a [fn() -> Option<Box<dyn CallableAsFoF<<C as AnyContract>::Ref, <C as AnyContract>::StatefulArguments>>>]
fn finish_or_fns<'a>( &'a self ) -> &'a [fn() -> Option<Box<dyn CallableAsFoF<<C as AnyContract>::Ref, <C as AnyContract>::StatefulArguments>>>]
obtain a reference to the
FinishOrFunc
list.source§fn finish_fns<'a>(
&'a self
) -> &'a [fn() -> Option<Guard<<C as AnyContract>::Ref>>]
fn finish_fns<'a>( &'a self ) -> &'a [fn() -> Option<Guard<<C as AnyContract>::Ref>>]
obtain a reference to the
Guard
list.source§fn get_inner_ref<'a>(&'a self) -> &'a <C as AnyContract>::Ref
fn get_inner_ref<'a>(&'a self) -> &'a <C as AnyContract>::Ref
obtain a reference to
Self::Ref
type.source§fn metadata<'a>(
&'a self,
ctx: Context
) -> Result<ObjectMetadata, CompilationError>
fn metadata<'a>( &'a self, ctx: Context ) -> Result<ObjectMetadata, CompilationError>
Generate the metadata
source§fn ensure_amount<'a>(&'a self, ctx: Context) -> Result<Amount, CompilationError>
fn ensure_amount<'a>(&'a self, ctx: Context) -> Result<Amount, CompilationError>
Minimum Amount
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