istox 0.1.73 → 0.1.74

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
  SHA256:
3
- metadata.gz: 89cb97b251bd3167a5d522d491435400e431a9982d6f501d6cca344be7e27d3c
4
- data.tar.gz: 77c8b4b77a2f0b8cc2e9545f952034dcef255a524eb29770a53ccad824f3e4a4
3
+ metadata.gz: ddff3bd1460aa44f126c5d5ebb6710654cab919454ff0868e29d6d0b129050c7
4
+ data.tar.gz: 7c34f6f2356bb4456123b0a045a036f662d26fe22b7cfbfdfa91b814b1bdf68a
5
5
  SHA512:
6
- metadata.gz: ed2589885791c54379d75ea56059c8bf8df4911820e0ce01190eb453623f2c4ac52486201716c9a3476a17c2d864b4662cc93d4419f05954a73f41cefe243a97
7
- data.tar.gz: 7268e1dac0443429bf08f1611b4d962d0a4739f694700d914923466043988a2a639a5e8f4b925e630c522f493d71dd1226c0434b9dd5d424a3cff8e720fe4921
6
+ metadata.gz: f1006312fee26837a7727113d555c43f8e9bae7d4e7b2bb5a3a4605fb8dd0326f659eaf32f44cc2c79ba79fddd33726c01d1d2a8a501b574f6040071e8738fa9
7
+ data.tar.gz: 9c7a1d084bda1c80294e5b29f0bc3b632059e2919e2ff7156a67c3e944282c4b9950f4b5c7f6c6bd0d40abb858e70dbac77e12f960d96d611cb3d17686c84599
data/Gemfile.lock CHANGED
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- istox (0.1.60.3)
4
+ istox (0.1.73)
5
+ binding_of_caller
5
6
  bunny (>= 2.12.0)
6
7
  graphlient
7
8
  gruf
@@ -59,6 +60,8 @@ GEM
59
60
  aws-eventstream (1.0.3)
60
61
  aws-sigv4 (1.1.0)
61
62
  aws-eventstream (~> 1.0, >= 1.0.2)
63
+ binding_of_caller (0.8.0)
64
+ debug_inspector (>= 0.0.1)
62
65
  builder (3.2.3)
63
66
  bullet (5.7.6)
64
67
  activesupport (>= 3.0.0)
@@ -68,6 +71,7 @@ GEM
68
71
  concurrent-ruby (1.1.4)
69
72
  crass (1.0.4)
70
73
  database_cleaner (1.6.2)
74
+ debug_inspector (0.0.3)
71
75
  diff-lcs (1.3)
72
76
  erubi (1.8.0)
73
77
  factory_bot (4.8.2)
@@ -84,7 +88,7 @@ GEM
84
88
  ffi (1.11.1)
85
89
  globalid (0.4.2)
86
90
  activesupport (>= 4.2.0)
87
- google-protobuf (3.8.0)
91
+ google-protobuf (3.8.0-universal-darwin)
88
92
  googleapis-common-protos-types (1.0.4)
89
93
  google-protobuf (~> 3.0)
90
94
  graphlient (0.3.5)
@@ -95,7 +99,7 @@ GEM
95
99
  graphql-client (0.14.0)
96
100
  activesupport (>= 3.0, < 6.0)
97
101
  graphql (~> 1.6)
98
- grpc (1.22.0)
102
+ grpc (1.22.0-universal-darwin)
99
103
  google-protobuf (~> 3.8)
100
104
  googleapis-common-protos-types (~> 1.0)
101
105
  grpc-tools (1.22.0)
data/lib/istox.rb CHANGED
@@ -22,6 +22,7 @@ module Istox
22
22
  require "istox/helpers/gruf_listener_hook"
23
23
  require "istox/helpers/message_service"
24
24
  require "istox/helpers/blockchain_receipt_service"
25
+ require "istox/helpers/f_math"
25
26
  require "istox/models/blockchain_receipt"
26
27
  require "istox/models/concerns/blockchain_receipt_query"
27
28
  require "istox/consumers/blockchain_status_handler"
@@ -0,0 +1,67 @@
1
+ module Istox
2
+ class FMath
3
+ class << self
4
+
5
+ def add(x, y)
6
+ BigDecimal.mode(BigDecimal::ROUND_MODE, :down)
7
+
8
+ x = 0 if x.blank?
9
+ y = 0 if y.blank?
10
+
11
+ x = ::BigDecimal.new(x.to_s)
12
+ y = ::BigDecimal.new(y.to_s)
13
+
14
+ return x.add(y, 100).truncate(18).to_s
15
+ end
16
+
17
+ def sub(x, y)
18
+ BigDecimal.mode(BigDecimal::ROUND_MODE, :down)
19
+
20
+ x = 0 if x.blank?
21
+ y = 0 if y.blank?
22
+
23
+ x = ::BigDecimal.new(x.to_s)
24
+ y = ::BigDecimal.new(y.to_s)
25
+
26
+ return x.sub(y, 100).truncate(18).to_s
27
+ end
28
+
29
+ def mul(x, y)
30
+ BigDecimal.mode(BigDecimal::ROUND_MODE, :down)
31
+
32
+ x = 0 if x.blank?
33
+ y = 0 if y.blank?
34
+
35
+ x = ::BigDecimal.new(x.to_s)
36
+ y = ::BigDecimal.new(y.to_s)
37
+
38
+ return x.mult(y, 100).truncate(18).to_s
39
+ end
40
+
41
+ def div(x, y)
42
+ BigDecimal.mode(BigDecimal::ROUND_MODE, :down)
43
+
44
+ x = 0 if x.blank?
45
+ y = 0 if y.blank?
46
+
47
+ x = ::BigDecimal.new(x.to_s)
48
+ y = ::BigDecimal.new(y.to_s)
49
+
50
+ return x.div(y, 100).truncate(18).to_s
51
+ end
52
+
53
+ def round_up(x, digits)
54
+ BigDecimal.mode(BigDecimal::ROUND_MODE, :up)
55
+ x = 0 if x.blank?
56
+ ::BigDecimal.new(x.to_s).round(digits).to_s
57
+ end
58
+
59
+ def round_down(x, digits)
60
+ BigDecimal.mode(BigDecimal::ROUND_MODE, :down)
61
+ x = 0 if x.blank?
62
+ ::BigDecimal.new(x.to_s).round(digits).to_s
63
+ end
64
+
65
+ end
66
+ end
67
+ end
data/lib/istox/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Istox
2
- VERSION = "0.1.73"
2
+ VERSION = "0.1.74"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: istox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.73
4
+ version: 0.1.74
5
5
  platform: ruby
6
6
  authors:
7
7
  - Siong Leng
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-19 00:00:00.000000000 Z
11
+ date: 2019-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny
@@ -291,6 +291,7 @@ files:
291
291
  - lib/istox/consumers/blockchain_status_handler.rb
292
292
  - lib/istox/helpers/blockchain_receipt_service.rb
293
293
  - lib/istox/helpers/bunny_boot.rb
294
+ - lib/istox/helpers/f_math.rb
294
295
  - lib/istox/helpers/graphql_client.rb
295
296
  - lib/istox/helpers/grpc_client.rb
296
297
  - lib/istox/helpers/gruf_listener_hook.rb
@@ -324,7 +325,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
324
325
  version: '0'
325
326
  requirements: []
326
327
  rubyforge_project:
327
- rubygems_version: 2.7.8
328
+ rubygems_version: 2.7.7
328
329
  signing_key:
329
330
  specification_version: 4
330
331
  summary: istox backend shared gem