Class: Casper::Entity::StoredVersionedContractByHash
- Inherits:
-
DeployExecutableItemInternal
- Object
- DeployExecutableItemInternal
- Casper::Entity::StoredVersionedContractByHash
- Defined in:
- lib/entity/stored_versioned_contract_by_hash.rb
Overview
Stored versioned contract referenced by its ContractPackageHash,
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
- #get_version ⇒ Object
-
#initialize(hash, version, entry_point, args) ⇒ StoredVersionedContractByHash
constructor
A new instance of StoredVersionedContractByHash.
- #to_bytes ⇒ Object
Methods inherited from DeployExecutableItemInternal
Constructor Details
#initialize(hash, version, entry_point, args) ⇒ StoredVersionedContractByHash
Returns a new instance of StoredVersionedContractByHash.
13 14 15 16 17 18 19 |
# File 'lib/entity/stored_versioned_contract_by_hash.rb', line 13 def initialize(hash, version, entry_point, args) @tag = 3 @hash = hash @version = version @entry_point = entry_point @args = args end |
Instance Method Details
#get_args ⇒ Object
37 38 39 |
# File 'lib/entity/stored_versioned_contract_by_hash.rb', line 37 def get_args @args end |
#get_entry_point ⇒ Object
33 34 35 |
# File 'lib/entity/stored_versioned_contract_by_hash.rb', line 33 def get_entry_point @entry_point end |
#get_hash ⇒ Object
25 26 27 |
# File 'lib/entity/stored_versioned_contract_by_hash.rb', line 25 def get_hash @hash end |
#get_tag ⇒ Object
21 22 23 |
# File 'lib/entity/stored_versioned_contract_by_hash.rb', line 21 def get_tag @tag end |
#get_version ⇒ Object
29 30 31 |
# File 'lib/entity/stored_versioned_contract_by_hash.rb', line 29 def get_version @version end |
#to_bytes ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/entity/stored_versioned_contract_by_hash.rb', line 41 def to_bytes serializer = DeployNamedArgSerializer.new num_of_args = @args.length bytes = Utils::ByteUtils.to_u8(@tag) bytes += @hash if @version == nil bytes += Utils::ByteUtils.to_u8(0) else bytes += Utils::ByteUtils.to_u8(1) end 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 |