Class: Casper::Entity::StoredValue

Inherits:
Object
  • Object
show all
Defined in:
lib/entity/stored_value.rb

Overview

A class that represents a value stored in global state.

Instance Method Summary collapse

Constructor Details

#initialize(stored_value = {}) ⇒ StoredValue

Returns a new instance of StoredValue.

Parameters:

  • stored_value (Hash) (defaults to: {})

Options Hash (stored_value):



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_accountAccount

Returns an account.

Returns:



80
81
82
# File 'lib/entity/stored_value.rb', line 80

def 
  @account
end

#get_bidBid

Returns a bid.

Returns:

  • (Bid)

    a bid



114
115
116
# File 'lib/entity/stored_value.rb', line 114

def get_bid
  @bid
end

#get_cl_valueCLValue

Returns a CasperLabs value.

Returns:

  • (CLValue)

    a CasperLabs value.



75
76
77
# File 'lib/entity/stored_value.rb', line 75

def get_cl_value
  @cl_value
end

#get_contractContract

Returns methods and type signatures supported by a contract.

Returns:

  • (Contract)

    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_packageObject

@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_infoDeployInfo

Returns record of a deploy.

Returns:



104
105
106
# File 'lib/entity/stored_value.rb', line 104

def get_deploy_info
  @deploy_info
end

#get_era_infoEraInfo

Returns auction metadata.

Returns:



109
110
111
# File 'lib/entity/stored_value.rb', line 109

def get_era_info
  @era_info
end

#get_keyObject



127
128
129
# File 'lib/entity/stored_value.rb', line 127

def get_key
  @key
end

#get_stored_valueObject



123
124
125
# File 'lib/entity/stored_value.rb', line 123

def get_stored_value
  @stored_value[@key]
end

#get_transferTransfer

Returns record of a transfer.

Returns:



99
100
101
# File 'lib/entity/stored_value.rb', line 99

def get_transfer
  @transfer
end

#get_withdrawArray

Returns a withdraw.

Returns:

  • (Array)

    a withdraw



119
120
121
# File 'lib/entity/stored_value.rb', line 119

def get_withdraw
  @withdraw
end