Class: Casper::Entity::StoredContractByName
Overview
Stored contract referenced by a named key existing in the signer’s Account context,
entry point and an instance of RuntimeArgs.
Instance Attribute Summary
#args
Instance Method Summary
collapse
#get_arg_by_name, #set_arg
Constructor Details
Returns a new instance of StoredContractByName.
12
13
14
15
16
17
|
# File 'lib/entity/stored_contract_by_name.rb', line 12
def initialize(name, entry_point, args)
@tag = 2
@name = name
@entry_point = entry_point
@args = args
end
|
Instance Method Details
#get_args ⇒ Object
31
32
33
|
# File 'lib/entity/stored_contract_by_name.rb', line 31
def get_args
@args
end
|
#get_entry_point ⇒ Object
27
28
29
|
# File 'lib/entity/stored_contract_by_name.rb', line 27
def get_entry_point
@entry_point
end
|
#get_name ⇒ Object
23
24
25
|
# File 'lib/entity/stored_contract_by_name.rb', line 23
def get_name
@name
end
|
#get_tag ⇒ Object
19
20
21
|
# File 'lib/entity/stored_contract_by_name.rb', line 19
def get_tag
@tag
end
|
#to_bytes ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/entity/stored_contract_by_name.rb', line 36
def to_bytes
serializer = DeployNamedArgSerializer.new
num_of_args = @args.length
bytes = Utils::ByteUtils.to_u8(@tag)
bytes += CLValueBytesParsers::CLStringBytesParser.to_bytes(@name)
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
|