ethereum 0.4.62 → 0.4.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7167e08de3db947aa03d0552b7ba34921124411a
4
- data.tar.gz: c5ebedb054a9f7bd457601ab695609512269b6c9
3
+ metadata.gz: dccc79e9ed08f479e0b29a23b118219cc6a4279e
4
+ data.tar.gz: 6698a12c7b695fa55e5cbfef02cfe659e0bdf4a9
5
5
  SHA512:
6
- metadata.gz: ca9324dbc0687a680fd8502c45ed5705fb9acfea004be6e776ca5b8c6b1749ad7dcb581ffedbd8c6dcab7931f504973b5150dc4562c60dc21768e11560d50c21
7
- data.tar.gz: 902db7a87860f4e962ad7857cabccbd48109a168d12f4a6dc8cf6dc483ec81ffb133057a9839e2cfd1b671d0a3a6adfc9973207cf5c9f0b9d9472e81a9604b7d
6
+ metadata.gz: dc37866485be2014731cc2e909c013a02f3c0f6765fb2a1650644f3c4062f998de0775e579278538e721d674a05d5129cb6ea9c238bb2f1ee97a31a2b87d928e
7
+ data.tar.gz: 2a7370d6d0fba1ec25987e3dfb130dd081803b61b409cb207c7ca21c3d8720ec3cf1b5fd052ff3d0c1f0c1941f96190ea7d87a265773d34e574265df2043f9e1
@@ -22,7 +22,7 @@ module Ethereum
22
22
  class_name = @name
23
23
  functions = @functions
24
24
  constructor_inputs = @constructor_inputs
25
- code = @code
25
+ binary = @code
26
26
 
27
27
  class_methods = Class.new do
28
28
 
@@ -32,57 +32,61 @@ module Ethereum
32
32
 
33
33
  define_method :deploy do |*params|
34
34
  formatter = Ethereum::Formatter.new
35
+ deploy_code = binary
36
+ deploy_arguments = ""
35
37
  if constructor_inputs.present?
36
38
  raise "Missing constructor parameter" and return if params.length != constructor_inputs.length
37
39
  constructor_inputs.each_index do |i|
38
40
  args = [constructor_inputs[i]["type"], params[i]]
39
- code << formatter.to_payload(args)
41
+ deploy_arguments << formatter.to_payload(args)
40
42
  end
41
43
  end
42
- deploytx = connection.send_transaction({from: self.sender, gas: 2000000, gasPrice: 60000000000, data: code})["result"]
43
- self.instance_variable_set("@deployment", Ethereum::Deployment.new(deploytx, connection))
44
+ deploy_payload = deploy_code + deploy_arguments
45
+ puts "sending payload #{deploy_payload}"
46
+ deploytx = connection.send_transaction({from: self.sender, gas: 2000000, gasPrice: 60000000000, data: deploy_payload})["result"]
47
+ instance_variable_set("@deployment", Ethereum::Deployment.new(deploytx, connection))
44
48
  end
45
49
 
46
50
  define_method :deployment do
47
- self.instance_variable_get("@deployment")
51
+ instance_variable_get("@deployment")
48
52
  end
49
53
 
50
54
  define_method :deploy_and_wait do |time = 60.seconds, *params|
51
55
  self.deploy(*params)
52
56
  self.deployment.wait_for_deployment(time)
53
- self.instance_variable_set("@address", self.deployment.contract_address)
57
+ instance_variable_set("@address", self.deployment.contract_address)
54
58
  end
55
59
 
56
60
  define_method :at do |addr|
57
- self.instance_variable_set("@address", addr)
61
+ instance_variable_set("@address", addr)
58
62
  end
59
63
 
60
64
  define_method :address do
61
- self.instance_variable_get("@address")
65
+ instance_variable_get("@address")
62
66
  end
63
67
 
64
68
  define_method :as do |addr|
65
- self.instance_variable_set("@sender", addr)
69
+ instance_variable_set("@sender", addr)
66
70
  end
67
71
 
68
72
  define_method :sender do
69
- self.instance_variable_get("@sender") || connection.coinbase["result"]
73
+ instance_variable_get("@sender") || connection.coinbase["result"]
70
74
  end
71
75
 
72
76
  define_method :set_gas_price do |gp|
73
- self.instance_variable_set("@gas_price", gp)
77
+ instance_variable_set("@gas_price", gp)
74
78
  end
75
79
 
76
80
  define_method :gas_price do
77
- self.instance_variable_get("@gas_price") || 60000000000
81
+ instance_variable_get("@gas_price") || 60000000000
78
82
  end
79
83
 
80
84
  define_method :set_gas do |gas|
81
- self.instance_variable_set("@gas", gas)
85
+ instance_variable_set("@gas", gas)
82
86
  end
83
87
 
84
88
  define_method :gas do
85
- self.instance_variable_get("@gas") || 2000000
89
+ instance_variable_get("@gas") || 2000000
86
90
  end
87
91
 
88
92
  functions.each do |fun|
@@ -152,7 +156,10 @@ module Ethereum
152
156
 
153
157
  end
154
158
  end
155
- Object.const_set(class_name, class_methods) unless Object.const_defined?(class_name)
159
+ if Object.const_defined?(class_name)
160
+ Object.send(:remove_const, class_name)
161
+ end
162
+ Object.const_set(class_name, class_methods)
156
163
  end
157
164
 
158
165
  end
@@ -1,3 +1,3 @@
1
1
  module Ethereum
2
- VERSION = "0.4.62"
2
+ VERSION = "0.4.65"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ethereum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.62
4
+ version: 0.4.65
5
5
  platform: ruby
6
6
  authors:
7
7
  - DigixGlobal Pte Ltd (https://dgx.io)