pub struct Operation {
pub version: ReservedBytes<1>,
pub contract_id: ContractId,
pub call_id: u16,
pub nonce: fe256,
pub witness: StateValue,
pub destructible_in: Confined<Vec<Input>, amplify::::collection::confinement::SmallVec::{constant#0}, amplify::::collection::confinement::SmallVec::{constant#1}>,
pub immutable_in: Confined<Vec<CellAddr>, amplify::::collection::confinement::SmallVec::{constant#0}, amplify::::collection::confinement::SmallVec::{constant#1}>,
pub destructible_out: Confined<Vec<StateCell>, amplify::::collection::confinement::SmallVec::{constant#0}, amplify::::collection::confinement::SmallVec::{constant#1}>,
pub immutable_out: Confined<Vec<StateData>, amplify::::collection::confinement::SmallVec::{constant#0}, amplify::::collection::confinement::SmallVec::{constant#1}>,
}
Expand description
Operation under a contract which may update the contract state.
Fields§
§version: ReservedBytes<1>
Operation version.
§Future use
For now, the only supported version is one; thus, a ReservedBytes
is used.
In the future, with more versions coming, this should be replaced with an enum, where the first byte will encode (with standard strict encoding) a version number as an enum variant. For instance,
pub enum Operation {
V0(OperationV0),
V1(OperationV1)
}
pub struct OperationV0 { /*...*/ }
pub struct OperationV1 { /*...*/ }
contract_id: ContractId
Contract id for which this operation is performed.
call_id: u16
Contract method this operation calls to.
nonce: fe256
A nonce, used to change operation id for subsequent operations using the same arguments.
witness: StateValue
An operation witness, which, unlike Input::witness
is not specific to any particular
input but applies to all of them.
destructible_in: Confined<Vec<Input>, amplify::::collection::confinement::SmallVec::{constant#0}, amplify::::collection::confinement::SmallVec::{constant#1}>
A list of read-once memory cells which are the inputs to the operation and which state must be destroyed in the result of operation application.
The list may be empty; in this case the operation just adds to the state without destroying any previously existing data.
immutable_in: Confined<Vec<CellAddr>, amplify::::collection::confinement::SmallVec::{constant#0}, amplify::::collection::confinement::SmallVec::{constant#1}>
A list of append-only immutable memory cells which this operation may read.
The list may be empty.
destructible_out: Confined<Vec<StateCell>, amplify::::collection::confinement::SmallVec::{constant#0}, amplify::::collection::confinement::SmallVec::{constant#1}>
A list of the state for the new destructible memory cells which are created by the operation (read-once, access-controlled).
The list may be empty.
immutable_out: Confined<Vec<StateData>, amplify::::collection::confinement::SmallVec::{constant#0}, amplify::::collection::confinement::SmallVec::{constant#1}>
A list of the state for the new Immutable memory cells, which are created by the operation (write-once, readable by all).
The list may be empty.
Implementations§
Trait Implementations§
Source§impl CommitEncode for Operation
impl CommitEncode for Operation
Source§type CommitmentId = Opid
type CommitmentId = Opid
Source§fn commit_encode(&self, e: &mut CommitEngine)
fn commit_encode(&self, e: &mut CommitEngine)
std::io::Write
writer instanceSource§impl<'de> Deserialize<'de> for Operation
impl<'de> Deserialize<'de> for Operation
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Operation, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Operation, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Ord for Operation
impl Ord for Operation
Source§impl PartialOrd for Operation
impl PartialOrd for Operation
Source§impl Serialize for Operation
impl Serialize for Operation
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl StrictDecode for Operation
impl StrictDecode for Operation
fn strict_decode(reader: &mut impl TypedRead) -> Result<Operation, DecodeError>
fn strict_read(reader: impl ReadRaw) -> Result<Self, DecodeError>
Source§impl StrictDumb for Operation
impl StrictDumb for Operation
fn strict_dumb() -> Operation
Source§impl StrictEncode for Operation
impl StrictEncode for Operation
fn strict_encode<W>(&self, writer: W) -> Result<W, Error>where
W: TypedWrite,
fn strict_write(&self, writer: impl WriteRaw) -> Result<(), Error>
Source§impl StrictStruct for Operation
impl StrictStruct for Operation
const ALL_FIELDS: &'static [&'static str]
fn strict_check_fields()
fn strict_type_info() -> TypeInfo<Self>
Source§impl StrictType for Operation
impl StrictType for Operation
const STRICT_LIB_NAME: &'static str = LIB_NAME_ULTRASONIC
fn strict_name() -> Option<TypeName>
impl Eq for Operation
impl StrictProduct for Operation
Auto Trait Implementations§
impl Freeze for Operation
impl RefUnwindSafe for Operation
impl Send for Operation
impl Sync for Operation
impl Unpin for Operation
impl UnwindSafe for Operation
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§impl<T> CommitId for Twhere
T: CommitEncode,
impl<T> CommitId for Twhere
T: CommitEncode,
fn commit(&self) -> CommitEngine
Source§fn commit_id(&self) -> <T as CommitEncode>::CommitmentId
fn commit_id(&self) -> <T as CommitEncode>::CommitmentId
Source§impl<T> CommitmentLayout for Twhere
T: CommitEncode + StrictDumb,
impl<T> CommitmentLayout for Twhere
T: CommitEncode + StrictDumb,
Source§fn commitment_layout() -> CommitLayout
fn commitment_layout() -> CommitLayout
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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
key
and return true
if they are equal.