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 of the contract, using Self::root_from_code
.
sourcepub fn root_from_code<B>(bytes: B) -> Bytes32 where
B: AsRef<[u8]>,
pub fn root_from_code<B>(bytes: B) -> Bytes32 where
B: AsRef<[u8]>,
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<'a, I>(storage_slots: I) -> Bytes32 where
I: Iterator<Item = &'a StorageSlot>,
pub fn initial_state_root<'a, I>(storage_slots: I) -> Bytes32 where
I: Iterator<Item = &'a StorageSlot>,
Calculate the root of the initial storage slots for this contract
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<'de> Deserialize<'de> for Contract
impl<'de> Deserialize<'de> for Contract
sourcefn deserialize<__D>(
__deserializer: __D
) -> Result<Contract, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Contract, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Serialize for Contract
impl Serialize for Contract
sourcefn 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,
Serialize this value into the given Serde serializer. Read more
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 = ValidationError
type Error = ValidationError
The type returned in the event of a conversion error.
sourcefn try_from(
tx: &Transaction
) -> Result<Contract, <Contract as TryFrom<&'_ Transaction>>::Error>
fn try_from(
tx: &Transaction
) -> Result<Contract, <Contract as TryFrom<&'_ Transaction>>::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