istox 0.2.6.pre.0 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e8961398a3a359f60a4df90adea1f6d1578cafde68a8be2cf496afba08fc069d
4
- data.tar.gz: ab96f1d839238cb29019adf29137823ea670b23c23b0d86201da08cecc80dacc
3
+ metadata.gz: 3a04c1473346b65b6cbede4d1308cdb2267af42212a76cdec99f77c17cdf7e36
4
+ data.tar.gz: 6439d8fba8144230f73eaf7a6d7e388642946508b53b986c925c0cc40a890790
5
5
  SHA512:
6
- metadata.gz: 1b4e009fad77eaa93910e5ffdc43888bbb3aa11da46caa3855736acaebaf548db141a7b0a8d0b48002ea6ddbe355bea69e5fbfffa29e19b53f8ddfbdbeff8a66
7
- data.tar.gz: 275a41eb82bd672f0a376a099a6d64670bd336215c46be6384f6f32f7d528975c3af301af8ec588343dcdc1531f5d80a3d351572215761134e2c403eb00a7723
6
+ metadata.gz: 288bd22b73176d05d9a900dc5b7fe3bc1d8742d03e448520f2f1e087303b2379f4bbd97ff713595d23f391e49de03b419b50ef4f2de11652cea90fe44439a386
7
+ data.tar.gz: adf4bef565107e7cfb90cb6cef08bec714ccbaec1b3fcbc2f3f174e5ee5aa24f4d05f036dc88f72bd736c2fe90120682de7ab3af5368ab5a8096bbb57d10368e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- istox (0.2.6.pre.0)
4
+ istox (0.2.5.3)
5
5
  amazing_print
6
6
  awesome_print
7
7
  aws-sdk-sns (~> 1)
@@ -67,7 +67,7 @@ GEM
67
67
  amazing_print (1.3.0)
68
68
  amq-protocol (2.3.2)
69
69
  arel (9.0.0)
70
- awesome_print (1.8.0)
70
+ awesome_print (1.9.2)
71
71
  aws-eventstream (1.1.0)
72
72
  aws-partitions (1.318.0)
73
73
  aws-sdk-core (3.96.1)
@@ -113,31 +113,35 @@ GEM
113
113
  i18n (~> 0.5)
114
114
  fakeredis (0.7.0)
115
115
  redis (>= 3.2, < 5.0)
116
- faraday (1.3.0)
116
+ faraday (1.4.1)
117
+ faraday-excon (~> 1.1)
117
118
  faraday-net_http (~> 1.0)
119
+ faraday-net_http_persistent (~> 1.1)
118
120
  multipart-post (>= 1.2, < 3)
119
- ruby2_keywords
121
+ ruby2_keywords (>= 0.0.4)
122
+ faraday-excon (1.1.0)
120
123
  faraday-net_http (1.0.1)
124
+ faraday-net_http_persistent (1.1.0)
121
125
  faraday_middleware (1.0.0)
122
126
  faraday (~> 1.0)
123
127
  ffi (1.15.0)
124
128
  globalid (0.4.2)
125
129
  activesupport (>= 4.2.0)
126
- google-protobuf (3.13.0-universal-darwin)
127
- googleapis-common-protos-types (1.0.5)
128
- google-protobuf (~> 3.11)
130
+ google-protobuf (3.15.8-universal-darwin)
131
+ googleapis-common-protos-types (1.0.6)
132
+ google-protobuf (~> 3.14)
129
133
  graphlient (0.5.0)
130
134
  faraday (>= 1.0)
131
135
  faraday_middleware
132
136
  graphql-client
133
- graphql (1.11.5)
137
+ graphql (1.12.8)
134
138
  graphql-client (0.16.0)
135
139
  activesupport (>= 3.0)
136
140
  graphql (~> 1.8)
137
- grpc (1.32.0-universal-darwin)
138
- google-protobuf (~> 3.13)
141
+ grpc (1.37.0-universal-darwin)
142
+ google-protobuf (~> 3.15)
139
143
  googleapis-common-protos-types (~> 1.0)
140
- grpc-tools (1.32.0)
144
+ grpc-tools (1.37.0)
141
145
  gruf (2.9.1)
142
146
  activesupport (> 4)
143
147
  concurrent-ruby (> 1)
@@ -157,7 +161,7 @@ GEM
157
161
  grpc-tools (~> 1.10)
158
162
  slop (~> 4.6)
159
163
  jmespath (1.4.0)
160
- json (2.3.1)
164
+ json (2.5.1)
161
165
  listen (3.0.8)
162
166
  rb-fsevent (~> 0.9, >= 0.9.4)
163
167
  rb-inotify (~> 0.9, >= 0.9.7)
@@ -178,8 +182,8 @@ GEM
178
182
  nio4r (2.3.1)
179
183
  nokogiri (1.10.9)
180
184
  mini_portile2 (~> 2.4.0)
181
- oj (3.10.14)
182
- ougai (1.8.5)
185
+ oj (3.11.5)
186
+ ougai (2.0.0)
183
187
  oj (~> 3.10)
184
188
  paranoia (2.4.3)
185
189
  activerecord (>= 4.0, < 6.2)
@@ -230,7 +234,7 @@ GEM
230
234
  redis-activesupport (5.2.0)
231
235
  activesupport (>= 3, < 7)
232
236
  redis-store (>= 1.3, < 2)
233
- redis-namespace (1.8.0)
237
+ redis-namespace (1.8.1)
234
238
  redis (>= 3.0.4)
235
239
  redis-rack (2.1.3)
236
240
  rack (>= 2.0.8, < 3)
@@ -262,7 +266,7 @@ GEM
262
266
  rspec-mocks (~> 3.8.0)
263
267
  rspec-support (~> 3.8.0)
264
268
  rspec-support (3.8.0)
265
- ruby2_keywords (0.0.2)
269
+ ruby2_keywords (0.0.4)
266
270
  slop (4.8.2)
267
271
  sprockets (3.7.2)
268
272
  concurrent-ruby (~> 1.0)
@@ -23,7 +23,7 @@ module Istox
23
23
  type: 'SEND_SMS',
24
24
  data: {
25
25
  to: targets,
26
- subject: subject || 'Message from iSTOX',
26
+ subject: subject || 'Message from ADDX',
27
27
  body: content
28
28
  }
29
29
  }
@@ -130,7 +130,8 @@ module Istox
130
130
  email_data[:copy_emails].each do |ce|
131
131
  next unless ce.present?
132
132
 
133
- copy_email_data = email_data.clone
133
+ # uid and sid are reserved fields that should be not cloned
134
+ copy_email_data = email_data.clone.except(:sid).except(:uid)
134
135
 
135
136
  # if it is just email to cc
136
137
  if ce.is_a? String
@@ -2,12 +2,19 @@ module Istox
2
2
  class OrderBookProrate
3
3
  class << self
4
4
  def allocation(token_price:, min_investment:, bid_block:, # rubocop:disable Metrics/AbcSize,Metrics/PerceivedComplexity
5
- invest_step:, hard_cap:, investments:, whitelists: [], include_refund_amount: false)
5
+ invest_step:, hard_cap:, investments:, whitelists: [], include_refund_amount: false,
6
+ rollover_investments: [])
6
7
 
7
8
  # make sure is hashes
8
9
  original_investments = investments.as_json.map(&:symbolize_keys)
9
10
  whitelists = whitelists.as_json.map(&:symbolize_keys)
10
11
  investments = investments.as_json.map(&:symbolize_keys)
12
+ rollover_investments = rollover_investments.as_json.map(&:symbolize_keys)
13
+
14
+ ## rollover investment is guaranteed, so it should decrease the hard cap
15
+ rollover_investments.map do |rollover_investment|
16
+ hard_cap = ::Istox::FMath.sub(hard_cap, rollover_investment[:fiat_amount])
17
+ end
11
18
 
12
19
  # process whitelist
13
20
  whitelists.each do |whitelist|
@@ -106,7 +113,7 @@ module Istox
106
113
 
107
114
  if include_refund_amount
108
115
  original_investment = original_investments.find { |original_investment1| original_investment1[:id] == interest[:id] }
109
- interest[:refund_amount] = ::Istox::FMath.sub(original_investment[:fiat_amount], interest[:investment])
116
+ interest[:refund_amount] = original_investment.present? ? ::Istox::FMath.sub(original_investment[:fiat_amount], interest[:investment]) : '0'
110
117
  end
111
118
  interest
112
119
  end
@@ -139,9 +146,16 @@ module Istox
139
146
  end
140
147
  end
141
148
 
149
+ transform_rollover_investments = rollover_investments.map do |rollover_investment|
150
+ rollover_investment[:investment] = ::BigDecimal.new(rollover_investment[:fiat_amount].to_s).to_s
151
+ rollover_investment[:refund_amount] = ::BigDecimal.new(0).to_s if include_refund_amount
152
+
153
+ rollover_investment.select { |k, _v| %i[id investment refund_amount].include?(k) }
154
+ end
155
+
142
156
  {
143
157
  cutoff_price: token_price.to_s,
144
- interests: final_interests
158
+ interests: final_interests.concat(transform_rollover_investments)
145
159
  }
146
160
  end
147
161
  end
@@ -16,14 +16,6 @@ module Istox
16
16
  db: 6
17
17
  ))
18
18
  end
19
-
20
- # for general redis cache
21
- def redis
22
- @redis ||= Redis::Namespace.new(:redis_cache, redis: Redis.new(
23
- url: ENV['REDIS_URL'] || 'redis://127.0.0.1:16379',
24
- db: 6
25
- ))
26
- end
27
19
  end
28
20
  end
29
21
  end
@@ -14,12 +14,16 @@ module Istox
14
14
 
15
15
  message = JSON.generate(message) unless message.is_a? String
16
16
 
17
- sns_client.publish(topic_arn: topic_arn || ENV.fetch('SNS_CLIENT_TOPIC', ''), message: message)
17
+ topic = topic_arn || ENV.fetch('SNS_CLIENT_TOPIC', '')
18
+
19
+ log.info("Publishing SNS to topic: #{topic} with message: #{message}")
20
+
21
+ sns_client.publish(topic_arn: topic, message: message)
18
22
 
19
23
  log.info('Publish to SNS successfully.')
20
24
  rescue StandardError => e
21
- log.fatal 'Unable to publish SNS message.'
22
- log.fatal(e)
25
+ log.info 'Unable to publish SNS message.'
26
+ log.info(e)
23
27
  log.info('Failed to publish SNS, ignoring...') unless throw_exception
24
28
 
25
29
  raise e if throw_exception
data/lib/istox/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Istox
2
- VERSION = '0.2.6-0'.freeze
2
+ VERSION = '0.2.6'.freeze
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.2.6.pre.0
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Siong Leng
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-29 00:00:00.000000000 Z
11
+ date: 2021-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: amazing_print
@@ -531,7 +531,7 @@ files:
531
531
  homepage: http://www.abc.com
532
532
  licenses: []
533
533
  metadata: {}
534
- post_install_message:
534
+ post_install_message:
535
535
  rdoc_options: []
536
536
  require_paths:
537
537
  - lib
@@ -542,12 +542,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
542
542
  version: '0'
543
543
  required_rubygems_version: !ruby/object:Gem::Requirement
544
544
  requirements:
545
- - - ">"
545
+ - - ">="
546
546
  - !ruby/object:Gem::Version
547
- version: 1.3.1
547
+ version: '0'
548
548
  requirements: []
549
- rubygems_version: 3.0.8
550
- signing_key:
549
+ rubygems_version: 3.0.6
550
+ signing_key:
551
551
  specification_version: 4
552
552
  summary: istox backend shared gem
553
553
  test_files: []