Struct ethcore::state::Account  [−][src]
pub struct Account { /* fields omitted */ }Single account in the system.
Keeps track of changes to the code and storage.
The changes are applied in commit_storage and commit_code
Methods
impl Account[src] 
impl Accountpub fn from_pod(pod: PodAccount) -> Account[src] 
pub fn from_pod(pod: PodAccount) -> AccountGeneral constructor.
pub fn new_basic(balance: U256, nonce: U256) -> Account[src] 
pub fn new_basic(balance: U256, nonce: U256) -> AccountCreate a new account with the given balance.
pub fn from_rlp(rlp: &[u8]) -> Result<Account, Error>[src] 
pub fn from_rlp(rlp: &[u8]) -> Result<Account, Error>Create a new account from RLP.
pub fn new_contract(balance: U256, nonce: U256) -> Account[src] 
pub fn new_contract(balance: U256, nonce: U256) -> AccountCreate a new contract account.
NOTE: make sure you use init_code on this before commiting.
pub fn init_code(&mut self, code: Bytes)[src] 
pub fn init_code(&mut self, code: Bytes)Set this account's code to the given code.
NOTE: Account should have been created with new_contract()
pub fn reset_code(&mut self, code: Bytes)[src] 
pub fn reset_code(&mut self, code: Bytes)Reset this account's code to the given code.
pub fn reset_code_and_storage(
    &mut self, 
    code: Arc<Bytes>, 
    storage: HashMap<H256, H256>
)[src] 
pub fn reset_code_and_storage(
    &mut self, 
    code: Arc<Bytes>, 
    storage: HashMap<H256, H256>
)Reset this account's code and storage to given values.
pub fn set_storage(&mut self, key: H256, value: H256)[src] 
pub fn set_storage(&mut self, key: H256, value: H256)Set (and cache) the contents of the trie's storage at key to value.
pub fn storage_at(
    &self, 
    db: &HashDB<KeccakHasher>, 
    key: &H256
) -> TrieResult<H256>[src] 
pub fn storage_at(
    &self, 
    db: &HashDB<KeccakHasher>, 
    key: &H256
) -> TrieResult<H256>Get (and cache) the contents of the trie's storage at key.
Takes modified storage into account.
pub fn cached_storage_at(&self, key: &H256) -> Option<H256>[src] 
pub fn cached_storage_at(&self, key: &H256) -> Option<H256>Get cached storage value if any. Returns None if the
key is not in the cache.
pub fn balance(&self) -> &U256[src] 
pub fn balance(&self) -> &U256return the balance associated with this account.
pub fn nonce(&self) -> &U256[src] 
pub fn nonce(&self) -> &U256return the nonce associated with this account.
pub fn code_hash(&self) -> H256[src] 
pub fn code_hash(&self) -> H256return the code hash associated with this account.
pub fn address_hash(&self, address: &Address) -> H256[src] 
pub fn address_hash(&self, address: &Address) -> H256return the code hash associated with this account.
pub fn code(&self) -> Option<Arc<Bytes>>[src] 
pub fn code(&self) -> Option<Arc<Bytes>>returns the account's code. If None then the code cache isn't available -
get someone who knows to call note_code.
pub fn code_size(&self) -> Option<usize>[src] 
pub fn code_size(&self) -> Option<usize>returns the account's code size. If None then the code cache or code size cache isn't available -
get someone who knows to call note_code.
pub fn is_cached(&self) -> bool[src] 
pub fn is_cached(&self) -> boolIs code_cache valid; such that code is going to return Some?
pub fn cache_code(&mut self, db: &HashDB<KeccakHasher>) -> Option<Arc<Bytes>>[src] 
pub fn cache_code(&mut self, db: &HashDB<KeccakHasher>) -> Option<Arc<Bytes>>Provide a database to get code_hash. Should not be called if it is a contract without code.
pub fn cache_given_code(&mut self, code: Arc<Bytes>)[src] 
pub fn cache_given_code(&mut self, code: Arc<Bytes>)Provide code to cache. For correctness, should be the correct code for the account.
pub fn cache_code_size(&mut self, db: &HashDB<KeccakHasher>) -> bool[src] 
pub fn cache_code_size(&mut self, db: &HashDB<KeccakHasher>) -> boolProvide a database to get code_size. Should not be called if it is a contract without code.
pub fn storage_is_clean(&self) -> bool[src] 
pub fn storage_is_clean(&self) -> boolDetermine whether there are any un-commit()-ed storage-setting operations.
pub fn is_empty(&self) -> bool[src] 
pub fn is_empty(&self) -> boolCheck if account has zero nonce, balance, no code and no storage.
NOTE: Will panic if !self.storage_is_clean()
pub fn is_null(&self) -> bool[src] 
pub fn is_null(&self) -> boolCheck if account has zero nonce, balance, no code.
pub fn is_basic(&self) -> bool[src] 
pub fn is_basic(&self) -> boolCheck if account is basic (Has no code).
pub fn storage_root(&self) -> Option<&H256>[src] 
pub fn storage_root(&self) -> Option<&H256>Return the storage root associated with this account or None if it has been altered via the overlay.
pub fn storage_changes(&self) -> &HashMap<H256, H256>[src] 
pub fn storage_changes(&self) -> &HashMap<H256, H256>Return the storage overlay.
pub fn inc_nonce(&mut self)[src] 
pub fn inc_nonce(&mut self)Increment the nonce of the account by one.
pub fn add_balance(&mut self, x: &U256)[src] 
pub fn add_balance(&mut self, x: &U256)Increase account balance.
pub fn sub_balance(&mut self, x: &U256)[src] 
pub fn sub_balance(&mut self, x: &U256)Decrease account balance.
Panics if balance is less than x
pub fn commit_storage(
    &mut self, 
    trie_factory: &TrieFactory, 
    db: &mut HashDB<KeccakHasher>
) -> TrieResult<()>[src] 
pub fn commit_storage(
    &mut self, 
    trie_factory: &TrieFactory, 
    db: &mut HashDB<KeccakHasher>
) -> TrieResult<()>Commit the storage_changes to the backing DB and update storage_root.
pub fn commit_code(&mut self, db: &mut HashDB<KeccakHasher>)[src] 
pub fn commit_code(&mut self, db: &mut HashDB<KeccakHasher>)Commit any unsaved code. code_hash will always return the hash of the code_cache after this.
pub fn rlp(&self) -> Bytes[src] 
pub fn rlp(&self) -> BytesExport to RLP.
pub fn clone_basic(&self) -> Account[src] 
pub fn clone_basic(&self) -> AccountClone basic account data
pub fn clone_dirty(&self) -> Account[src] 
pub fn clone_dirty(&self) -> AccountClone account data and dirty storage keys
pub fn clone_all(&self) -> Account[src] 
pub fn clone_all(&self) -> AccountClone account data, dirty storage keys and cached storage keys.
pub fn overwrite_with(&mut self, other: Account)[src] 
pub fn overwrite_with(&mut self, other: Account)Replace self with the data from other account merging storage cache. Basic account data and all modifications are overwritten with new values.
impl Account[src] 
impl Accountpub fn prove_storage(
    &self, 
    db: &HashDB<KeccakHasher>, 
    storage_key: H256
) -> TrieResult<(Vec<Bytes>, H256)>[src] 
pub fn prove_storage(
    &self, 
    db: &HashDB<KeccakHasher>, 
    storage_key: H256
) -> TrieResult<(Vec<Bytes>, H256)>Prove a storage key's existence or nonexistence in the account's storage
trie.
storage_key is the hash of the desired storage key, meaning
this will only work correctly under a secure trie.
Trait Implementations
impl From<BasicAccount> for Account[src] 
impl From<BasicAccount> for Accountfn from(basic: BasicAccount) -> Self[src] 
fn from(basic: BasicAccount) -> SelfPerforms the conversion.
impl Debug for Account[src] 
impl Debug for Account