istox 0.2.6.pre.1 → 0.2.7
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 +4 -4
- data/.gitignore +0 -0
- data/.rubocop.yml +0 -0
- data/.solargraph.yml +0 -0
- data/CODE_OF_CONDUCT.md +0 -0
- data/Gemfile +0 -0
- data/Gemfile.lock +33 -15
- data/README.md +0 -0
- data/Rakefile +0 -0
- data/istox.gemspec +1 -0
- data/lib/istox/constants/error.rb +0 -0
- data/lib/istox/helpers/f_math.rb +0 -0
- data/lib/istox/helpers/graphql_client.rb +0 -0
- data/lib/istox/helpers/gruf_listener_hook.rb +0 -0
- data/lib/istox/helpers/messaging.rb +22 -2
- data/lib/istox/helpers/my_open_struct.rb +0 -0
- data/lib/istox/helpers/order_book_prorate.rb +17 -3
- data/lib/istox/helpers/rate_limit.rb +0 -0
- data/lib/istox/helpers/redis_manager.rb +0 -8
- data/lib/istox/helpers/regex_helper.rb +0 -0
- data/lib/istox/helpers/result_handler.rb +0 -0
- data/lib/istox/helpers/sns_publisher.rb +7 -3
- data/lib/istox/helpers/vault.rb +0 -0
- data/lib/istox/interfaces/chainhub/transaction.rb +0 -0
- data/lib/istox/models/blockchain_receipt.rb +0 -0
- data/lib/istox/models/concerns/blockchain_receipt_query.rb +0 -0
- data/lib/istox/version.rb +1 -1
- metadata +22 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 55b3c9aa9a02afcb1419637b7eac9ff25b2ac69c157668826af65e13d3c37c00
|
|
4
|
+
data.tar.gz: bcdcbe386c2ca95a3a4f8e68b617a92dbc8ea37272909a1ab48fb1e95f678f2d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a9817547969c289454deab78634271d6cb44d9f3a190de1c4de8d3e3def3f0ec7a320522bc601845286412ba215550ef8ed26fc0ffbfd02bc20a48582c8673d7
|
|
7
|
+
data.tar.gz: b071f1d3a181cd90f30e235d7425050f9c8871c4a2b8f7c1c52cf95ffe5137ff1eade6e70782dd8b9e7a9f6ce7e3c4a653e1b99210571e7eaf744f66ed8d3cc4
|
data/.gitignore
CHANGED
|
File without changes
|
data/.rubocop.yml
CHANGED
|
File without changes
|
data/.solargraph.yml
CHANGED
|
File without changes
|
data/CODE_OF_CONDUCT.md
CHANGED
|
File without changes
|
data/Gemfile
CHANGED
|
File without changes
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
istox (0.2.
|
|
4
|
+
istox (0.2.5.3)
|
|
5
5
|
amazing_print
|
|
6
6
|
awesome_print
|
|
7
7
|
aws-sdk-sns (~> 1)
|
|
@@ -9,6 +9,7 @@ PATH
|
|
|
9
9
|
bunny (>= 2.12.0)
|
|
10
10
|
exponential-backoff (= 0.0.4)
|
|
11
11
|
graphlient
|
|
12
|
+
gruf
|
|
12
13
|
hashie (~> 3.5.7)
|
|
13
14
|
istox_gruf (~> 2.7.3)
|
|
14
15
|
listen (~> 3.0.5)
|
|
@@ -66,7 +67,7 @@ GEM
|
|
|
66
67
|
amazing_print (1.3.0)
|
|
67
68
|
amq-protocol (2.3.2)
|
|
68
69
|
arel (9.0.0)
|
|
69
|
-
awesome_print (1.
|
|
70
|
+
awesome_print (1.9.2)
|
|
70
71
|
aws-eventstream (1.1.0)
|
|
71
72
|
aws-partitions (1.318.0)
|
|
72
73
|
aws-sdk-core (3.96.1)
|
|
@@ -100,6 +101,7 @@ GEM
|
|
|
100
101
|
database_cleaner (1.6.2)
|
|
101
102
|
debug_inspector (1.1.0)
|
|
102
103
|
diff-lcs (1.3)
|
|
104
|
+
e2mmap (0.1.0)
|
|
103
105
|
erubi (1.9.0)
|
|
104
106
|
exponential-backoff (0.0.4)
|
|
105
107
|
factory_bot (4.8.2)
|
|
@@ -111,31 +113,44 @@ GEM
|
|
|
111
113
|
i18n (~> 0.5)
|
|
112
114
|
fakeredis (0.7.0)
|
|
113
115
|
redis (>= 3.2, < 5.0)
|
|
114
|
-
faraday (1.
|
|
116
|
+
faraday (1.4.1)
|
|
117
|
+
faraday-excon (~> 1.1)
|
|
115
118
|
faraday-net_http (~> 1.0)
|
|
119
|
+
faraday-net_http_persistent (~> 1.1)
|
|
116
120
|
multipart-post (>= 1.2, < 3)
|
|
117
|
-
ruby2_keywords
|
|
121
|
+
ruby2_keywords (>= 0.0.4)
|
|
122
|
+
faraday-excon (1.1.0)
|
|
118
123
|
faraday-net_http (1.0.1)
|
|
124
|
+
faraday-net_http_persistent (1.1.0)
|
|
119
125
|
faraday_middleware (1.0.0)
|
|
120
126
|
faraday (~> 1.0)
|
|
121
127
|
ffi (1.15.0)
|
|
122
128
|
globalid (0.4.2)
|
|
123
129
|
activesupport (>= 4.2.0)
|
|
124
|
-
google-protobuf (3.
|
|
125
|
-
googleapis-common-protos-types (1.0.
|
|
126
|
-
google-protobuf (~> 3.
|
|
130
|
+
google-protobuf (3.15.8-universal-darwin)
|
|
131
|
+
googleapis-common-protos-types (1.0.6)
|
|
132
|
+
google-protobuf (~> 3.14)
|
|
127
133
|
graphlient (0.5.0)
|
|
128
134
|
faraday (>= 1.0)
|
|
129
135
|
faraday_middleware
|
|
130
136
|
graphql-client
|
|
131
|
-
graphql (1.
|
|
137
|
+
graphql (1.12.8)
|
|
132
138
|
graphql-client (0.16.0)
|
|
133
139
|
activesupport (>= 3.0)
|
|
134
140
|
graphql (~> 1.8)
|
|
135
|
-
grpc (1.
|
|
136
|
-
google-protobuf (~> 3.
|
|
141
|
+
grpc (1.37.0-universal-darwin)
|
|
142
|
+
google-protobuf (~> 3.15)
|
|
137
143
|
googleapis-common-protos-types (~> 1.0)
|
|
138
|
-
grpc-tools (1.
|
|
144
|
+
grpc-tools (1.37.0)
|
|
145
|
+
gruf (2.9.1)
|
|
146
|
+
activesupport (> 4)
|
|
147
|
+
concurrent-ruby (> 1)
|
|
148
|
+
e2mmap (~> 0.1)
|
|
149
|
+
grpc (~> 1.10)
|
|
150
|
+
grpc-tools (~> 1.10)
|
|
151
|
+
json (>= 2.3)
|
|
152
|
+
slop (~> 4.6)
|
|
153
|
+
thwait (~> 0.1)
|
|
139
154
|
hashie (3.5.7)
|
|
140
155
|
i18n (0.9.5)
|
|
141
156
|
concurrent-ruby (~> 1.0)
|
|
@@ -146,6 +161,7 @@ GEM
|
|
|
146
161
|
grpc-tools (~> 1.10)
|
|
147
162
|
slop (~> 4.6)
|
|
148
163
|
jmespath (1.4.0)
|
|
164
|
+
json (2.5.1)
|
|
149
165
|
listen (3.0.8)
|
|
150
166
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
|
151
167
|
rb-inotify (~> 0.9, >= 0.9.7)
|
|
@@ -166,8 +182,8 @@ GEM
|
|
|
166
182
|
nio4r (2.3.1)
|
|
167
183
|
nokogiri (1.10.9)
|
|
168
184
|
mini_portile2 (~> 2.4.0)
|
|
169
|
-
oj (3.
|
|
170
|
-
ougai (
|
|
185
|
+
oj (3.11.5)
|
|
186
|
+
ougai (2.0.0)
|
|
171
187
|
oj (~> 3.10)
|
|
172
188
|
paranoia (2.4.3)
|
|
173
189
|
activerecord (>= 4.0, < 6.2)
|
|
@@ -218,7 +234,7 @@ GEM
|
|
|
218
234
|
redis-activesupport (5.2.0)
|
|
219
235
|
activesupport (>= 3, < 7)
|
|
220
236
|
redis-store (>= 1.3, < 2)
|
|
221
|
-
redis-namespace (1.8.
|
|
237
|
+
redis-namespace (1.8.1)
|
|
222
238
|
redis (>= 3.0.4)
|
|
223
239
|
redis-rack (2.1.3)
|
|
224
240
|
rack (>= 2.0.8, < 3)
|
|
@@ -250,7 +266,7 @@ GEM
|
|
|
250
266
|
rspec-mocks (~> 3.8.0)
|
|
251
267
|
rspec-support (~> 3.8.0)
|
|
252
268
|
rspec-support (3.8.0)
|
|
253
|
-
ruby2_keywords (0.0.
|
|
269
|
+
ruby2_keywords (0.0.4)
|
|
254
270
|
slop (4.8.2)
|
|
255
271
|
sprockets (3.7.2)
|
|
256
272
|
concurrent-ruby (~> 1.0)
|
|
@@ -262,6 +278,8 @@ GEM
|
|
|
262
278
|
sqlite3 (1.3.13)
|
|
263
279
|
thor (0.20.3)
|
|
264
280
|
thread_safe (0.3.6)
|
|
281
|
+
thwait (0.2.0)
|
|
282
|
+
e2mmap
|
|
265
283
|
timecop (0.9.1)
|
|
266
284
|
tzinfo (1.2.6)
|
|
267
285
|
thread_safe (~> 0.1)
|
data/README.md
CHANGED
|
File without changes
|
data/Rakefile
CHANGED
|
File without changes
|
data/istox.gemspec
CHANGED
|
@@ -37,6 +37,7 @@ Gem::Specification.new do |spec|
|
|
|
37
37
|
spec.add_dependency 'bunny', '>= 2.12.0'
|
|
38
38
|
spec.add_dependency 'exponential-backoff', '0.0.4'
|
|
39
39
|
spec.add_dependency 'graphlient'
|
|
40
|
+
spec.add_dependency 'gruf'
|
|
40
41
|
spec.add_dependency 'hashie', '~> 3.5.7'
|
|
41
42
|
spec.add_dependency 'istox_gruf', '~> 2.7.3'
|
|
42
43
|
spec.add_dependency 'listen', '~> 3.0.5'
|
|
File without changes
|
data/lib/istox/helpers/f_math.rb
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -23,7 +23,7 @@ module Istox
|
|
|
23
23
|
type: 'SEND_SMS',
|
|
24
24
|
data: {
|
|
25
25
|
to: targets,
|
|
26
|
-
subject: subject || 'Message from
|
|
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
|
-
|
|
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
|
|
@@ -160,6 +161,25 @@ module Istox
|
|
|
160
161
|
end
|
|
161
162
|
template_data_arr.concat(copy_email_data_arr)
|
|
162
163
|
end
|
|
164
|
+
|
|
165
|
+
def push_notification(template_name, template_data_arr)
|
|
166
|
+
raise ArgumentError, 'Template name and template data arr cannot be empty' if template_name.blank? || template_data_arr.nil?
|
|
167
|
+
|
|
168
|
+
return log.info 'Template data is empty, skipping this request' if template_data_arr.empty?
|
|
169
|
+
|
|
170
|
+
::Istox::Publisher.manual_publish(
|
|
171
|
+
exchange: 'message',
|
|
172
|
+
exchange_type: 'direct',
|
|
173
|
+
routing_key: 'push_notification.message',
|
|
174
|
+
message: {
|
|
175
|
+
type: 'SEND_PUSH_NOTIFICATION',
|
|
176
|
+
data: {
|
|
177
|
+
template_name: template_name,
|
|
178
|
+
template_data_arr_json: template_data_arr.to_json
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
)
|
|
182
|
+
end
|
|
163
183
|
end
|
|
164
184
|
end
|
|
165
185
|
end
|
|
File without changes
|
|
@@ -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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -14,12 +14,16 @@ module Istox
|
|
|
14
14
|
|
|
15
15
|
message = JSON.generate(message) unless message.is_a? String
|
|
16
16
|
|
|
17
|
-
|
|
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.
|
|
22
|
-
log.
|
|
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/helpers/vault.rb
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/istox/version.rb
CHANGED
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.
|
|
4
|
+
version: 0.2.7
|
|
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-
|
|
11
|
+
date: 2021-05-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: amazing_print
|
|
@@ -108,6 +108,20 @@ dependencies:
|
|
|
108
108
|
- - ">="
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
110
|
version: '0'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: gruf
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - ">="
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '0'
|
|
118
|
+
type: :runtime
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - ">="
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '0'
|
|
111
125
|
- !ruby/object:Gem::Dependency
|
|
112
126
|
name: hashie
|
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -517,7 +531,7 @@ files:
|
|
|
517
531
|
homepage: http://www.abc.com
|
|
518
532
|
licenses: []
|
|
519
533
|
metadata: {}
|
|
520
|
-
post_install_message:
|
|
534
|
+
post_install_message:
|
|
521
535
|
rdoc_options: []
|
|
522
536
|
require_paths:
|
|
523
537
|
- lib
|
|
@@ -528,12 +542,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
528
542
|
version: '0'
|
|
529
543
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
530
544
|
requirements:
|
|
531
|
-
- - "
|
|
545
|
+
- - ">="
|
|
532
546
|
- !ruby/object:Gem::Version
|
|
533
|
-
version:
|
|
547
|
+
version: '0'
|
|
534
548
|
requirements: []
|
|
535
|
-
rubygems_version: 3.
|
|
536
|
-
signing_key:
|
|
549
|
+
rubygems_version: 3.2.11
|
|
550
|
+
signing_key:
|
|
537
551
|
specification_version: 4
|
|
538
552
|
summary: istox backend shared gem
|
|
539
553
|
test_files: []
|