Class: Ciri::Types::Account

Inherits:
Object
  • Object
show all
Includes:
RLP::Serializable
Defined in:
lib/ciri/types/account.rb

Constant Summary

Constants included from RLP::Serializable

RLP::Serializable::TYPES

Instance Attribute Summary

Attributes included from RLP::Serializable

#serializable_attributes

Class Method Summary collapse

Instance Method Summary collapse

Methods included from RLP::Serializable

#==, included, #initialize, #initialize_copy, #rlp_encode

Class Method Details

.new_emptyObject



47
48
49
# File 'lib/ciri/types/account.rb', line 47

def new_empty
  Account.new(balance: 0, nonce: 0)
end

Instance Method Details

#empty?Boolean

EMPTY(σ,a) ≡ σc =KEC􏰁()􏰂∧σn =0∧σb =0

Returns:

  • (Boolean)


38
39
40
# File 'lib/ciri/types/account.rb', line 38

def empty?
  !has_code? && nonce == 0 && balance == 0
end

#has_code?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/ciri/types/account.rb', line 42

def has_code?
  code_hash != Utils::BLANK_SHA3
end