215 bool _shouldNotExist =
false 217 m_hasBalance(_hasBalance),
218 m_hasNonce(_hasNonce),
220 m_hasStorage(_hasStorage),
221 m_shouldNotExist(_shouldNotExist)
224 bool allSet()
const {
return m_hasBalance && m_hasNonce && m_hasCode && m_hasStorage; }
236 bool m_shouldNotExist =
false;
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
std::unordered_map< Address, PrecompiledContract > PrecompiledContractMap
std::unordered_map< u256, u256 > m_storageOverlay
The map with is overlaid onto whatever storage is implied by the m_storageRoot in the trie...
Account(u256 _nonce, u256 _balance, h256 _contractRoot, h256 _codeHash, Changedness _c)
Explicit constructor for wierd cases of construction or a contract account.
Account starts as though it has been changed.
bytes m_codeCache
The associated code for this account.
std::unordered_map< Address, Account > AccountMap
u256 m_balance
Account's balance.
Models the state of a single Ethereum account.
Account()
Construct a dead Account.
Account starts as though it has not been changed.
std::unordered_map< u256, u256 > const & storageOverlay() const
void changed()
Note that we've altered the account.
void noteCode(bytesConstRef _code)
Specify to the object what the actual code is for the account.
bool m_hasNewCode
True if new code was deployed to the account.
void setStorageCache(u256 _p, u256 _v) const
Set a key/value pair in the account's storage to a value that is already present inside the database...
assert(len-trim+(2 *lenIndices)<=WIDTH)
void setNonce(u256 const &_nonce)
Set nonce to a new value.
AccountMask(bool _all=false)
h256 m_storageRoot
The base storage root.
AccountMask(bool _hasBalance, bool _hasNonce, bool _hasCode, bool _hasStorage, bool _shouldNotExist=false)
static const h256 c_contractConceptionCodeHash
Value for m_codeHash when this account is having its code determined.
bool m_isUnchanged
True if we've not made any alteration to the account having been given it's properties directly...
bytes const & code() const
void setNewCode(bytes &&_code)
Sets the code of the account. Used by "create" messages.
std::vector< byte > bytes
std::vector< unsigned char > toBytes() const
h256 m_codeHash
If c_contractConceptionCodeHash then we're in the limbo where we're running the initialisation code...
Account(u256 _nonce, u256 _balance, Changedness _c=Changed)
Construct an alive Account, with given endowment, for either a normal (non-contract) account or for a...
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void >> u256
std::unordered_map< Address, AccountMask > AccountMaskMap
u256 const & balance() const
Changedness
Changedness of account to create.
void kill()
Kill this account. Useful for the suicide opcode. Following this call, isAlive() returns false...
void addBalance(u256 _value)
Increments the balance of this account by the given amount.
bool m_isAlive
Is this account existant? If not, it represents a deleted account.
void setStorage(u256 _p, u256 _v)
Set a key/value pair in the account's storage.
AccountMap jsonToAccountMap(std::string const &_json, u256 const &_defaultNonce=0, AccountMaskMap *o_mask=nullptr, PrecompiledContractMap *o_precompiled=nullptr)
bool sha3(bytesConstRef _input, bytesRef o_output)
Calculate SHA3-256 hash of the given input and load it into the given output.
u256 m_nonce
Account's nonce.
void resetCode()
Reset the code set by previous CREATE message.
void incNonce()
Increment the nonce of the account by one.