Class: Casper::Entity::StoredValue
- Inherits:
-
Object
- Object
- Casper::Entity::StoredValue
- Defined in:
- lib/entity/stored_value.rb
Overview
A class that represents a value stored in global state.
Instance Method Summary collapse
-
#get_account ⇒ Account
An account.
-
#get_bid ⇒ Bid
A bid.
-
#get_cl_value ⇒ CLValue
A CasperLabs value.
-
#get_contract ⇒ Contract
Methods and type signatures supported by a contract.
-
#get_contract_package ⇒ Object
@return [ContractPackage] contract definition, metadata, and security container.
-
#get_deploy_info ⇒ DeployInfo
Record of a deploy.
-
#get_era_info ⇒ EraInfo
Auction metadata.
- #get_key ⇒ Object
- #get_stored_value ⇒ Object
-
#get_transfer ⇒ Transfer
Record of a transfer.
-
#get_withdraw ⇒ Array
A withdraw.
-
#initialize(stored_value = {}) ⇒ StoredValue
constructor
A new instance of StoredValue.
Constructor Details
#initialize(stored_value = {}) ⇒ StoredValue
Returns a new instance of StoredValue.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/entity/stored_value.rb', line 19 def initialize(stored_value = {}) @stored_value = stored_value @cl_value = nil @account = nil @contract_wasm = nil @contract = nil @contract_package = nil @transfer = nil @deploy_info = nil @era_info = nil @bid = nil @withdraw = nil @key = nil if stored_value.has_key?(:CLValue) @cl_value = stored_value[:CLValue] @key = :CLValue end if stored_value.has_key?(:Account) @account = stored_value[:Account] @key = :Account end if stored_value.has_key?(:ContractWasm) @contract_wasm = stored_value[:ContractWasm] @key = :ContractWasm end if stored_value.has_key?(:Contract) @contract = stored_value[:Contract] @key = :Contract end if stored_value.has_key?(:ContractPackage) @contract_package = stored_value[:ContractPackage] @key = :ContractPackage end if stored_value.has_key?(:Transfer) @transfer = stored_value[:Transfer] @key = :Transfer end if stored_value.has_key?(:DeployInfo) @transfer = stored_value[:DeployInfo] @key = :Deploy end if stored_value.has_key?(:EraInfo) @era_info = stored_value[:EraInfo] @key = :EraInfo end if stored_value.has_key?(:Bid) @bid = stored_value[:Bid] @key = :Bid end if stored_value.has_key?(:Withdraw) @withdraw = stored_value[:Withdraw] @key = :Withdraw end end |
Instance Method Details
#get_account ⇒ Account
Returns an account.
80 81 82 |
# File 'lib/entity/stored_value.rb', line 80 def get_account @account end |
#get_bid ⇒ Bid
Returns a bid.
114 115 116 |
# File 'lib/entity/stored_value.rb', line 114 def get_bid @bid end |
#get_cl_value ⇒ CLValue
Returns a CasperLabs value.
75 76 77 |
# File 'lib/entity/stored_value.rb', line 75 def get_cl_value @cl_value end |
#get_contract ⇒ Contract
Returns methods and type signatures supported by a contract.
85 86 87 |
# File 'lib/entity/stored_value.rb', line 85 def get_contract @contract end |
#get_contract_package ⇒ Object
@return [ContractPackage] contract definition, metadata, and security container.
94 95 96 |
# File 'lib/entity/stored_value.rb', line 94 def get_contract_package @contract_package end |
#get_deploy_info ⇒ DeployInfo
Returns record of a deploy.
104 105 106 |
# File 'lib/entity/stored_value.rb', line 104 def get_deploy_info @deploy_info end |
#get_era_info ⇒ EraInfo
Returns auction metadata.
109 110 111 |
# File 'lib/entity/stored_value.rb', line 109 def get_era_info @era_info end |
#get_key ⇒ Object
127 128 129 |
# File 'lib/entity/stored_value.rb', line 127 def get_key @key end |
#get_stored_value ⇒ Object
123 124 125 |
# File 'lib/entity/stored_value.rb', line 123 def get_stored_value @stored_value[@key] end |
#get_transfer ⇒ Transfer
Returns record of a transfer.
99 100 101 |
# File 'lib/entity/stored_value.rb', line 99 def get_transfer @transfer end |
#get_withdraw ⇒ Array
Returns a withdraw.
119 120 121 |
# File 'lib/entity/stored_value.rb', line 119 def get_withdraw @withdraw end |