Struct fuel_tx::Contract

source ·
pub struct Contract(_);
Expand description

Deployable representation of a contract code.

Implementations§

source§

impl Contract

source

pub fn root(&self) -> Bytes32

Calculate the code root of the contract, using Self::root_from_code.

source

pub fn root_from_code<B>(bytes: B) -> Bytes32where B: AsRef<[u8]>,

source

pub fn initial_state_root<'a, I>(storage_slots: I) -> Bytes32where I: Iterator<Item = &'a StorageSlot>,

Calculate the root of the initial storage slots for this contract

source

pub fn default_state_root() -> Bytes32

The default state root value without any entries

source

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/src/protocol/id/contract.md#contract-id

Trait Implementations§

source§

impl AsMut<[u8]> for Contract

source§

fn as_mut(&mut self) -> &mut [u8]

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsRef<[u8]> for Contract

source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for Contract

source§

fn clone(&self) -> Contract

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Contract

source§

fn fmt(&self, __f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Contract

source§

fn default() -> Contract

Returns the “default value” for a type. Read more
source§

impl From<&[u8]> for Contract

source§

fn from(c: &[u8]) -> Self

Converts to this type from the input type.
source§

impl From<&mut [u8]> for Contract

source§

fn from(c: &mut [u8]) -> Self

Converts to this type from the input type.
source§

impl From<Contract> for Vec<u8>

source§

fn from(c: Contract) -> Vec<u8>

Converts to this type from the input type.
source§

impl From<Vec<u8, Global>> for Contract

source§

fn from(c: Vec<u8>) -> Self

Converts to this type from the input type.
source§

impl Hash for Contract

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq<Contract> for Contract

source§

fn eq(&self, other: &Contract) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl TryFrom<&Create> for Contract

§

type Error = CheckError

The type returned in the event of a conversion error.
source§

fn try_from(tx: &Create) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&Transaction> for Contract

§

type Error = CheckError

The type returned in the event of a conversion error.
source§

fn try_from(tx: &Transaction) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Eq for Contract

source§

impl StructuralEq for Contract

source§

impl StructuralPartialEq for Contract

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Base32Len for Twhere T: AsRef<[u8]>,

§

fn base32_len(&self) -> usize

Calculate the base32 serialized length
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<'f, T> CheckBase32<Vec<u5, Global>> for Twhere T: AsRef<[u8]>,

§

type Err = Error

Error type if conversion fails
§

fn check_base32( self ) -> Result<Vec<u5, Global>, <T as CheckBase32<Vec<u5, Global>>>::Err>

Check if all values are in range and return array-like struct of u5 values
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
§

impl<T> StorageAsMut for T

§

fn storage<Type>(&mut self) -> StorageMut<'_, Self, Type>where Type: Mappable,

§

fn storage_as_mut<Type>(&mut self) -> StorageMut<'_, Self, Type>where Type: Mappable,

§

impl<T> StorageAsRef for T

§

fn storage<Type>(&self) -> StorageRef<'_, Self, Type>where Type: Mappable,

§

fn storage_as_ref<Type>(&self) -> StorageRef<'_, Self, Type>where Type: Mappable,

§

impl<T> ToBase32 for Twhere T: AsRef<[u8]>,

§

fn write_base32<W>(&self, writer: &mut W) -> Result<(), <W as WriteBase32>::Err>where W: WriteBase32,

Encode as base32 and write it to the supplied writer Implementations shouldn’t allocate.
§

fn to_base32(&self) -> Vec<u5, Global>

Convert Self to base32 vector
source§

impl<T> ToHex for Twhere T: AsRef<[u8]>,

source§

fn encode_hex<U>(&self) -> Uwhere U: FromIterator<char>,

Encode the hex strict representing self into the result. Lower case letters are used (e.g. f9b4ca)
source§

fn encode_hex_upper<U>(&self) -> Uwhere U: FromIterator<char>,

Encode the hex strict representing self into the result. Upper case letters are used (e.g. F9B4CA)
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V