pub struct AccountDelta {
pub chain: Chain,
pub address: Address,
pub slots: ContractStoreDeltas,
pub balance: Option<Balance>,
/* private fields */
}Fields§
§chain: Chain§address: Address§slots: ContractStoreDeltas§balance: Option<Balance>Implementations§
Source§impl AccountDelta
impl AccountDelta
pub fn deleted(chain: &Chain, address: &Address) -> Self
pub fn new( chain: Chain, address: Address, slots: ContractStoreDeltas, balance: Option<Balance>, code: Option<Code>, change: ChangeType, ) -> Self
pub fn contract_id(&self) -> ContractId
pub fn into_account(self, tx: &Transaction) -> Account
Sourcepub fn into_account_without_tx(self) -> Account
pub fn into_account_without_tx(self) -> Account
Convert the delta into an account. Note that data not present in the delta, such as creation_tx etc, will be initialized to default values.
pub fn ref_into_account(&self, tx: &Transaction) -> Account
Sourcepub fn merge(&mut self, other: AccountDelta) -> Result<(), MergeError>
pub fn merge(&mut self, other: AccountDelta) -> Result<(), MergeError>
Merge this update (self) with another one (other)
This function is utilized for aggregating multiple updates into a single
update. The attribute values of other are set on self.
Meanwhile, contract storage maps are merged, with keys from other taking precedence.
Be noted that, this function will mutate the state of the calling struct. An error will occur if merging updates from different accounts.
There are no further validation checks within this method, hence it could be used as needed. However, you should give preference to utilizing AccountChangesWithTx for merging, when possible.
§Errors
It returns an CoreError::MergeError error if self.address and
other.address are not identical.
§Arguments
other: An instance ofAccountUpdate. The attribute values and keys ofotherwill overwrite those ofself.
pub fn is_update(&self) -> bool
pub fn is_creation(&self) -> bool
pub fn change_type(&self) -> ChangeType
pub fn code(&self) -> &Option<Code>
pub fn set_code(&mut self, code: Bytes)
Trait Implementations§
Source§impl Clone for AccountDelta
impl Clone for AccountDelta
Source§fn clone(&self) -> AccountDelta
fn clone(&self) -> AccountDelta
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more