pub struct Contract(_);
Expand description
Deployable representation of a contract code.
Implementations
sourceimpl Contract
impl Contract
sourcepub fn root(&self) -> Bytes32
pub fn root(&self) -> Bytes32
Calculate the code root from a contract.
https://github.com/FuelLabs/fuel-specs/blob/master/specs/protocol/identifiers.md#contract-id
sourcepub fn initial_state_root(storage_slots: &[StorageSlot]) -> Bytes32
pub fn initial_state_root(storage_slots: &[StorageSlot]) -> Bytes32
Calculate the root of the initial storage slots for this contract TODO: Use a sparse merkle tree once the implementation is available
sourcepub fn default_state_root() -> Bytes32
pub fn default_state_root() -> Bytes32
The default state root value without any entries
sourcepub fn id(
&self,
salt: &Salt,
root: &Bytes32,
state_root: &Bytes32
) -> ContractId
pub fn id(
&self,
salt: &Salt,
root: &Bytes32,
state_root: &Bytes32
) -> ContractId
Calculate and return the contract id, provided a salt, code root and state root.
https://github.com/FuelLabs/fuel-specs/blob/master/specs/protocol/identifiers.md#contract-id
Trait Implementations
sourceimpl Storage<ContractId, Contract> for MemoryStorage
impl Storage<ContractId, Contract> for MemoryStorage
type Error = Infallible
type Error = Infallible
Error implementation of the storage functions
sourcefn insert(
&mut self,
key: &ContractId,
value: &Contract
) -> Result<Option<Contract>, Infallible>
fn insert(
&mut self,
key: &ContractId,
value: &Contract
) -> Result<Option<Contract>, Infallible>
Append K->V
mapping to the storage. Read more
sourcefn remove(&mut self, key: &ContractId) -> Result<Option<Contract>, Infallible>
fn remove(&mut self, key: &ContractId) -> Result<Option<Contract>, Infallible>
Remove K->V
mapping from the storage. Read more
sourcefn get(&self, key: &ContractId) -> Result<Option<Cow<'_, Contract>>, Infallible>
fn get(&self, key: &ContractId) -> Result<Option<Cow<'_, Contract>>, Infallible>
Retrieve Cow<V>
such as K->V
.
sourcefn contains_key(&self, key: &ContractId) -> Result<bool, Infallible>
fn contains_key(&self, key: &ContractId) -> Result<bool, Infallible>
Return true
if there is a K
mapping to a value in the storage.
sourceimpl TryFrom<&'_ Transaction> for Contract
impl TryFrom<&'_ Transaction> for Contract
type Error = InterpreterError
type Error = InterpreterError
The type returned in the event of a conversion error.
sourcefn try_from(tx: &Transaction) -> Result<Self, Self::Error>
fn try_from(tx: &Transaction) -> Result<Self, Self::Error>
Performs the conversion.
impl Eq for Contract
impl StructuralEq for Contract
impl StructuralPartialEq for Contract
Auto Trait Implementations
impl RefUnwindSafe for Contract
impl Send for Contract
impl Sync for Contract
impl Unpin for Contract
impl UnwindSafe for Contract
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToHex for T where
T: AsRef<[u8]>,
impl<T> ToHex for T where
T: AsRef<[u8]>,
sourcefn encode_hex<U>(&self) -> U where
U: FromIterator<char>,
fn encode_hex<U>(&self) -> U where
U: FromIterator<char>,
Encode the hex strict representing self
into the result. Lower case
letters are used (e.g. f9b4ca
) Read more
sourcefn encode_hex_upper<U>(&self) -> U where
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> U where
U: FromIterator<char>,
Encode the hex strict representing self
into the result. Upper case
letters are used (e.g. F9B4CA
) Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more