Struct casper_types::ContractPackage
source · pub struct ContractPackage { /* private fields */ }
Expand description
Contract definition, metadata, and security container.
Implementations§
source§impl ContractPackage
impl ContractPackage
sourcepub fn new(
access_key: URef,
versions: ContractVersions,
disabled_versions: DisabledVersions,
groups: Groups,
lock_status: ContractPackageStatus
) -> Self
pub fn new( access_key: URef, versions: ContractVersions, disabled_versions: DisabledVersions, groups: Groups, lock_status: ContractPackageStatus ) -> Self
Create new ContractPackage
(with no versions) from given access key.
sourcepub fn access_key(&self) -> URef
pub fn access_key(&self) -> URef
Get the access key for this contract.
sourcepub fn groups_mut(&mut self) -> &mut Groups
pub fn groups_mut(&mut self) -> &mut Groups
Get the mutable group definitions for this contract.
sourcepub fn add_group(&mut self, group: Group, urefs: BTreeSet<URef>)
pub fn add_group(&mut self, group: Group, urefs: BTreeSet<URef>)
Adds new group to this contract.
sourcepub fn lookup_contract_hash(
&self,
contract_version_key: ContractVersionKey
) -> Option<&ContractHash>
pub fn lookup_contract_hash( &self, contract_version_key: ContractVersionKey ) -> Option<&ContractHash>
Lookup the contract hash for a given contract version (if present)
sourcepub fn is_version_enabled(
&self,
contract_version_key: ContractVersionKey
) -> bool
pub fn is_version_enabled( &self, contract_version_key: ContractVersionKey ) -> bool
Checks if the given contract version exists and is available for use.
sourcepub fn is_contract_enabled(&self, contract_hash: &ContractHash) -> bool
pub fn is_contract_enabled(&self, contract_hash: &ContractHash) -> bool
Returns true
if the given contract hash exists and is enabled.
sourcepub fn insert_contract_version(
&mut self,
protocol_version_major: ProtocolVersionMajor,
contract_hash: ContractHash
) -> ContractVersionKey
pub fn insert_contract_version( &mut self, protocol_version_major: ProtocolVersionMajor, contract_hash: ContractHash ) -> ContractVersionKey
Insert a new contract version; the next sequential version number will be issued.
sourcepub fn disable_contract_version(
&mut self,
contract_hash: ContractHash
) -> Result<(), Error>
pub fn disable_contract_version( &mut self, contract_hash: ContractHash ) -> Result<(), Error>
Disable the contract version corresponding to the given hash (if it exists).
sourcepub fn versions(&self) -> &ContractVersions
pub fn versions(&self) -> &ContractVersions
Returns reference to all of this contract’s versions.
sourcepub fn enabled_versions(&self) -> ContractVersions
pub fn enabled_versions(&self) -> ContractVersions
Returns all of this contract’s enabled contract versions.
sourcepub fn versions_mut(&mut self) -> &mut ContractVersions
pub fn versions_mut(&mut self) -> &mut ContractVersions
Returns mutable reference to all of this contract’s versions (enabled and disabled).
sourcepub fn take_versions(self) -> ContractVersions
pub fn take_versions(self) -> ContractVersions
Consumes the object and returns all of this contract’s versions (enabled and disabled).
sourcepub fn disabled_versions(&self) -> &DisabledVersions
pub fn disabled_versions(&self) -> &DisabledVersions
Returns all of this contract’s disabled versions.
sourcepub fn disabled_versions_mut(&mut self) -> &mut DisabledVersions
pub fn disabled_versions_mut(&mut self) -> &mut DisabledVersions
Returns mut reference to all of this contract’s disabled versions.
sourcepub fn remove_group(&mut self, group: &Group) -> bool
pub fn remove_group(&mut self, group: &Group) -> bool
Removes a group from this contract (if it exists).
sourcepub fn current_contract_version(&self) -> Option<ContractVersionKey>
pub fn current_contract_version(&self) -> Option<ContractVersionKey>
Return the contract version key for the newest enabled contract version.
sourcepub fn current_contract_hash(&self) -> Option<ContractHash>
pub fn current_contract_hash(&self) -> Option<ContractHash>
Return the contract hash for the newest enabled contract version.
sourcepub fn get_lock_status(&self) -> ContractPackageStatus
pub fn get_lock_status(&self) -> ContractPackageStatus
Return the package status itself
Trait Implementations§
source§impl Clone for ContractPackage
impl Clone for ContractPackage
source§fn clone(&self) -> ContractPackage
fn clone(&self) -> ContractPackage
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ContractPackage
impl Debug for ContractPackage
source§impl Default for ContractPackage
impl Default for ContractPackage
source§fn default() -> ContractPackage
fn default() -> ContractPackage
source§impl From<ContractPackage> for StoredValue
impl From<ContractPackage> for StoredValue
source§fn from(value: ContractPackage) -> StoredValue
fn from(value: ContractPackage) -> StoredValue
source§impl FromBytes for ContractPackage
impl FromBytes for ContractPackage
source§impl PartialEq<ContractPackage> for ContractPackage
impl PartialEq<ContractPackage> for ContractPackage
source§fn eq(&self, other: &ContractPackage) -> bool
fn eq(&self, other: &ContractPackage) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for ContractPackage
impl Serialize for ContractPackage
source§impl ToBytes for ContractPackage
impl ToBytes for ContractPackage
source§fn serialized_length(&self) -> usize
fn serialized_length(&self) -> usize
Vec<u8>
which would be returned from a successful call to
to_bytes()
or into_bytes()
. The data is not actually serialized, so this call is
relatively cheap.source§impl TryFrom<StoredValue> for ContractPackage
impl TryFrom<StoredValue> for ContractPackage
§type Error = TypeMismatch
type Error = TypeMismatch
impl Eq for ContractPackage
impl StructuralEq for ContractPackage
impl StructuralPartialEq for ContractPackage
Auto Trait Implementations§
impl RefUnwindSafe for ContractPackage
impl Send for ContractPackage
impl Sync for ContractPackage
impl Unpin for ContractPackage
impl UnwindSafe for ContractPackage
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
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where Self: Display,
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.§impl<T> Pipe for T
impl<T> Pipe for T
§impl<T> PipeAsRef for T
impl<T> PipeAsRef for T
§impl<T> PipeBorrow for T
impl<T> PipeBorrow for T
§impl<T> PipeDeref for T
impl<T> PipeDeref for T
§impl<T> PipeRef for T
impl<T> PipeRef for T
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere R: 'a,
§fn pipe_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere R: 'a,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&Self) -> R,
fn tap<F, R>(self, func: F) -> Selfwhere F: FnOnce(&Self) -> R,
§fn tap_dbg<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&Self) -> R,
fn tap_dbg<F, R>(self, func: F) -> Selfwhere F: FnOnce(&Self) -> R,
tap
in debug builds, and does nothing in release builds.§fn tap_mut<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&mut Self) -> R,
fn tap_mut<F, R>(self, func: F) -> Selfwhere F: FnOnce(&mut Self) -> R,
§fn tap_mut_dbg<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&mut Self) -> R,
fn tap_mut_dbg<F, R>(self, func: F) -> Selfwhere F: FnOnce(&mut Self) -> R,
tap_mut
in debug builds, and does nothing in release builds.§impl<T, U> TapAsRef<U> for Twhere
U: ?Sized,
impl<T, U> TapAsRef<U> for Twhere U: ?Sized,
§fn tap_ref<F, R>(self, func: F) -> Selfwhere
Self: AsRef<T>,
F: FnOnce(&T) -> R,
fn tap_ref<F, R>(self, func: F) -> Selfwhere Self: AsRef<T>, F: FnOnce(&T) -> R,
§fn tap_ref_dbg<F, R>(self, func: F) -> Selfwhere
Self: AsRef<T>,
F: FnOnce(&T) -> R,
fn tap_ref_dbg<F, R>(self, func: F) -> Selfwhere Self: AsRef<T>, F: FnOnce(&T) -> R,
tap_ref
in debug builds, and does nothing in release builds.§fn tap_ref_mut<F, R>(self, func: F) -> Selfwhere
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_ref_mut<F, R>(self, func: F) -> Selfwhere Self: AsMut<T>, F: FnOnce(&mut T) -> R,
§fn tap_ref_mut_dbg<F, R>(self, func: F) -> Selfwhere
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_ref_mut_dbg<F, R>(self, func: F) -> Selfwhere Self: AsMut<T>, F: FnOnce(&mut T) -> R,
tap_ref_mut
in debug builds, and does nothing in release builds.§impl<T, U> TapBorrow<U> for Twhere
U: ?Sized,
impl<T, U> TapBorrow<U> for Twhere U: ?Sized,
§fn tap_borrow<F, R>(self, func: F) -> Selfwhere
Self: Borrow<T>,
F: FnOnce(&T) -> R,
fn tap_borrow<F, R>(self, func: F) -> Selfwhere Self: Borrow<T>, F: FnOnce(&T) -> R,
§fn tap_borrow_dbg<F, R>(self, func: F) -> Selfwhere
Self: Borrow<T>,
F: FnOnce(&T) -> R,
fn tap_borrow_dbg<F, R>(self, func: F) -> Selfwhere Self: Borrow<T>, F: FnOnce(&T) -> R,
tap_borrow
in debug builds, and does nothing in release builds.§fn tap_borrow_mut<F, R>(self, func: F) -> Selfwhere
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_borrow_mut<F, R>(self, func: F) -> Selfwhere Self: BorrowMut<T>, F: FnOnce(&mut T) -> R,
§fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Selfwhere
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Selfwhere Self: BorrowMut<T>, F: FnOnce(&mut T) -> R,
tap_borrow_mut
in debug builds, and does nothing in release
builds.§impl<T> TapDeref for T
impl<T> TapDeref for T
§fn tap_deref<F, R>(self, func: F) -> Selfwhere
Self: Deref,
F: FnOnce(&Self::Target) -> R,
fn tap_deref<F, R>(self, func: F) -> Selfwhere Self: Deref, F: FnOnce(&Self::Target) -> R,
self
for inspection.§fn tap_deref_dbg<F, R>(self, func: F) -> Selfwhere
Self: Deref,
F: FnOnce(&Self::Target) -> R,
fn tap_deref_dbg<F, R>(self, func: F) -> Selfwhere Self: Deref, F: FnOnce(&Self::Target) -> R,
tap_deref
in debug builds, and does nothing in release builds.§fn tap_deref_mut<F, R>(self, func: F) -> Selfwhere
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
fn tap_deref_mut<F, R>(self, func: F) -> Selfwhere Self: DerefMut, F: FnOnce(&mut Self::Target) -> R,
self
for modification.§fn tap_deref_mut_dbg<F, R>(self, func: F) -> Selfwhere
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
fn tap_deref_mut_dbg<F, R>(self, func: F) -> Selfwhere Self: DerefMut, F: FnOnce(&mut Self::Target) -> R,
tap_deref_mut
in debug builds, and does nothing in release
builds.