Class: DeployExecutableSerializer

Inherits:
Object
  • Object
show all
Defined in:
lib/serialization/deploy_executable_serializer.rb

Overview

Byte serializer for DeployExecutable object

Instance Method Summary collapse

Constructor Details

#initializeDeployExecutableSerializer

Returns a new instance of DeployExecutableSerializer.



6
7
8
# File 'lib/serialization/deploy_executable_serializer.rb', line 6

def initialize 
  @deploy_executable = Casper::Entity::DeployExecutable.new
end

Instance Method Details

#to_bytes(deploy_executable) ⇒ Object

Parameters:

  • deploy_executable (DeployExecutable)


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/serialization/deploy_executable_serializer.rb', line 11

def to_bytes(deploy_executable)
  if deploy_executable.module_bytes?
    deploy_executable.get_module_bytes.to_bytes
  elsif deploy_executable.stored_contract_by_hash?
    deploy_executable.stored_contract_by_hash.to_bytes
  elsif deploy_executable.stored_contract_by_name?
    deploy_executable.stored_contract_by_name.to_bytes
  elsif deploy_executable.stored_versioned_contract_by_hash?
    deploy_executable.stored_versioned_contract_by_hash.to_bytes
  elsif deploy_executable.stored_versioned_contract_by_name?
    deploy_executable.stored_versioned_contract_by_name.to_bytes
  elsif deploy_executable.transfer?
    deploy_executable.transfer.to_bytes
  end
end