Class: Casper::Entity::StoredVersionedContractByHash
- Inherits:
-
DeployExecutableItemInternal
- Object
- DeployExecutableItemInternal
- Casper::Entity::StoredVersionedContractByHash
- Defined in:
- lib/entity/stored_versioned_contract_by_hash.rb
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.
11 12 13 14 15 16 17 |
# File 'lib/entity/stored_versioned_contract_by_hash.rb', line 11 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
35 36 37 |
# File 'lib/entity/stored_versioned_contract_by_hash.rb', line 35 def get_args @args end |
#get_entry_point ⇒ Object
31 32 33 |
# File 'lib/entity/stored_versioned_contract_by_hash.rb', line 31 def get_entry_point @entry_point end |
#get_hash ⇒ Object
23 24 25 |
# File 'lib/entity/stored_versioned_contract_by_hash.rb', line 23 def get_hash @hash end |
#get_tag ⇒ Object
19 20 21 |
# File 'lib/entity/stored_versioned_contract_by_hash.rb', line 19 def get_tag @tag end |
#get_version ⇒ Object
27 28 29 |
# File 'lib/entity/stored_versioned_contract_by_hash.rb', line 27 def get_version @version end |
#to_bytes ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/entity/stored_versioned_contract_by_hash.rb', line 39 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 |