Class: Casper::Entity::StoredContractByHash
- Inherits:
-
DeployExecutableItemInternal
- Object
- DeployExecutableItemInternal
- Casper::Entity::StoredContractByHash
- Defined in:
- lib/entity/stored_contract_by_hash.rb
Overview
Stored contract referenced by its ContractHash, entry point and an instance of RuntimeArgs.
Instance Attribute Summary
Attributes inherited from DeployExecutableItemInternal
Instance Method Summary collapse
- #get_args ⇒ Object
- #get_entry_point ⇒ Object
- #get_hash ⇒ Object
- #get_tag ⇒ Object
-
#initialize(hash, entry_point, args) ⇒ StoredContractByHash
constructor
A new instance of StoredContractByHash.
- #to_bytes ⇒ Object
Methods inherited from DeployExecutableItemInternal
Constructor Details
#initialize(hash, entry_point, args) ⇒ StoredContractByHash
Returns a new instance of StoredContractByHash.
11 12 13 14 15 16 |
# File 'lib/entity/stored_contract_by_hash.rb', line 11 def initialize(hash, entry_point, args) @tag = 1 @hash = hash @entry_point = entry_point @args = args end |
Instance Method Details
#get_args ⇒ Object
30 31 32 |
# File 'lib/entity/stored_contract_by_hash.rb', line 30 def get_args @args end |
#get_entry_point ⇒ Object
26 27 28 |
# File 'lib/entity/stored_contract_by_hash.rb', line 26 def get_entry_point @entry_point end |
#get_hash ⇒ Object
22 23 24 |
# File 'lib/entity/stored_contract_by_hash.rb', line 22 def get_hash @hash end |
#get_tag ⇒ Object
18 19 20 |
# File 'lib/entity/stored_contract_by_hash.rb', line 18 def get_tag @tag end |
#to_bytes ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/entity/stored_contract_by_hash.rb', line 34 def to_bytes serializer = DeployNamedArgSerializer.new num_of_args = @args.length bytes = Utils::ByteUtils.to_u8(@tag) bytes += @hash bytes += CLValueBytesParsers::CLStringBytesParser.to_bytes(@entry_point) bytes += Utils::ByteUtils.to_u32(num_of_args) @args.each do |arg| arg.each do |item| bytes += serializer.to_bytes(item) end end Utils::ByteUtils.hex_to_byte_array(bytes) end |