huginn_callisto_network_agent 0.1.65 → 0.1.66

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: 565a2aba25a85dea17482fc779efdf6332d61f4c3fd4563abb0e614840795c45
4
- data.tar.gz: d99324987ccb1455a7d005dae44897218d0773070678ca1f537099fdb255728c
3
+ metadata.gz: 5ad5d958a5899bd266df53ff09fc4f61fbe0ef6544b4d8a5f755937178baa478
4
+ data.tar.gz: 3bd80217dd0e558ce3fba8f0fe2921276f40b0f7672ea27c7a51da34774173f8
5
5
  SHA512:
6
- metadata.gz: 323a293738009004b216e354cb8285ae2523260a5518317373f3deeaf58d76220d44c9e14e257f0432783816acf0b28f9c0c1e950b9050dbc82ad6e0574ef539
7
- data.tar.gz: c09ad3fae8868ee1e5711128b4914ec74b0b9244361e69f4f6461b48cf8475114f872e8c04c4b3237b9e163ad6de2bba0b2fc1c0be55b3f848b4baa3d46827bb
6
+ metadata.gz: 1da5ce65e680ba2120b439db4e4c224a487f838a0519af7efc677c0c5c57a692d98ef885def3d0d4dadb4ea1b094f590cec7a16d0cd854b671b9315b8679d0c0
7
+ data.tar.gz: c48f5605abced1cf379cca22c2eb28712208002167f3f363aa1358c20efe4728cff6dfb2b70c4769977411bc3dda31d43a7f1670148243052066b51efdd96e14
@@ -61,7 +61,7 @@ module Agents
61
61
  form_configurable :emit_events, type: :boolean
62
62
  form_configurable :expected_receive_period_in_days, type: :string
63
63
  form_configurable :changes_only, type: :boolean
64
- form_configurable :type, type: :array, values: ['get_balance', 'net_peerCount', 'net_version', 'eth_protocolVersion', 'eth_gasPrice', 'eth_getTransactionCount', 'stake_reward_clo', 'get_tokens_balance', 'eth_getBlockByNumber', 'soy_farming_soy_clo_pending_rewards', 'soy_farming_soy_cloe_pending_rewards', 'stake_reward_soy', 'soy_farming_soy_btt_pending_rewards', 'soy_cs_pending_rewards', 'clo_sendtx', 'get_tx_by_address_with_filter', 'start_cs_clo', 'withdraw_cs_clo', 'get_tx_stats', 'callosha_slots']
64
+ form_configurable :type, type: :array, values: ['get_balance', 'net_peerCount', 'net_version', 'eth_protocolVersion', 'eth_gasPrice', 'eth_getTransactionCount', 'stake_reward_clo', 'get_tokens_balance', 'eth_getBlockByNumber', 'soy_farming_soy_clo_pending_rewards', 'soy_farming_soy_cloe_pending_rewards', 'stake_reward_soy', 'soy_farming_soy_btt_pending_rewards', 'soy_cs_pending_rewards', 'clo_sendtx', 'get_tx_by_address_with_filter', 'start_cs_clo', 'withdraw_cs_clo', 'get_tx_stats', 'callosha_slots', '2bears_check_order_by_id']
65
65
  form_configurable :wallet, type: :string
66
66
  form_configurable :rpc_server, type: :string
67
67
  form_configurable :wallet_password, type: :string
@@ -72,13 +72,13 @@ module Agents
72
72
  form_configurable :first_block, type: :string
73
73
  form_configurable :last_block, type: :string
74
74
  def validate_options
75
- errors.add(:base, "type has invalid value: should be 'get_balance' 'net_peerCount' 'net_version' 'eth_protocolVersion' 'eth_gasPrice' 'eth_getTransactionCount' 'stake_reward_clo' 'get_tokens_balance' 'eth_getBlockByNumber' 'soy_farming_soy_clo_pending_rewards' 'soy_farming_soy_cloe_pending_rewards' 'stake_reward_soy' 'soy_farming_soy_btt_pending_rewards' 'soy_cs_pending_rewards' 'clo_sendtx' 'get_tx_by_address_with_filter' 'start_cs_clo' 'withdraw_cs_clo' 'get_tx_stats' 'callosha_slots'") if interpolated['type'].present? && !%w(get_balance net_peerCount net_version eth_protocolVersion eth_gasPrice eth_getTransactionCount stake_reward_clo get_tokens_balance eth_getBlockByNumber soy_farming_soy_clo_pending_rewards soy_farming_soy_cloe_pending_rewards stake_reward_soy soy_farming_soy_btt_pending_rewards soy_cs_pending_rewards clo_sendtx get_tx_by_address_with_filter start_cs_clo withdraw_cs_clo get_tx_stats callosha_slots).include?(interpolated['type'])
75
+ errors.add(:base, "type has invalid value: should be 'get_balance' 'net_peerCount' 'net_version' 'eth_protocolVersion' 'eth_gasPrice' 'eth_getTransactionCount' 'stake_reward_clo' 'get_tokens_balance' 'eth_getBlockByNumber' 'soy_farming_soy_clo_pending_rewards' 'soy_farming_soy_cloe_pending_rewards' 'stake_reward_soy' 'soy_farming_soy_btt_pending_rewards' 'soy_cs_pending_rewards' 'clo_sendtx' 'get_tx_by_address_with_filter' 'start_cs_clo' 'withdraw_cs_clo' 'get_tx_stats' 'callosha_slots' '2bears_check_order_by_id'") if interpolated['type'].present? && !%w(get_balance net_peerCount net_version eth_protocolVersion eth_gasPrice eth_getTransactionCount stake_reward_clo get_tokens_balance eth_getBlockByNumber soy_farming_soy_clo_pending_rewards soy_farming_soy_cloe_pending_rewards stake_reward_soy soy_farming_soy_btt_pending_rewards soy_cs_pending_rewards clo_sendtx get_tx_by_address_with_filter start_cs_clo withdraw_cs_clo get_tx_stats callosha_slots 2bears_check_order_by_id).include?(interpolated['type'])
76
76
 
77
77
  unless options['wallet_password'].present? || !['clo_sendtx' 'start_cs_clo' 'withdraw_cs_clo'].include?(options['type'])
78
78
  errors.add(:base, "wallet_password is a required field")
79
79
  end
80
80
 
81
- unless options['value'].present? || !['clo_sendtx' 'start_cs_clo' 'callosha_slots'].include?(options['type'])
81
+ unless options['value'].present? || !['clo_sendtx' 'start_cs_clo' 'callosha_slots' '2bears_check_order_by_id'].include?(options['type'])
82
82
  errors.add(:base, "value is a required field")
83
83
  end
84
84
 
@@ -295,6 +295,86 @@ module Agents
295
295
 
296
296
  end
297
297
 
298
+ def twobears_check_order_by_id()
299
+
300
+ hex_value = sprintf("%064x", interpolated['value'].to_i)
301
+ uri = URI.parse("#{interpolated['rpc_server']}")
302
+ request = Net::HTTP::Post.new(uri)
303
+ request.content_type = "application/json"
304
+ request.body = JSON.dump({
305
+ "jsonrpc" => "2.0",
306
+ "id" => 1,
307
+ "method" => "eth_call",
308
+ "params" => [
309
+ {
310
+ "data" => "0x0e0578f5#{hex_value}",
311
+ "to" => "0x78afc46df1d3eb5cff7044d288a453fe43e17310"
312
+ },
313
+ "latest"
314
+ ]
315
+ })
316
+
317
+ req_options = {
318
+ use_ssl: uri.scheme == "https",
319
+ }
320
+
321
+ response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
322
+ http.request(request)
323
+ end
324
+
325
+ log_curl_output(response.code,response.body)
326
+
327
+ payload = JSON.parse(response.body)
328
+
329
+ if interpolated['changes_only'] == 'true'
330
+ if payload != memory['last_status']
331
+ create_event payload: decode_2bears_content(payload)
332
+ end
333
+ else
334
+ create_event payload: decode_2bears_content(payload)
335
+ end
336
+ memory['last_status'] = payload
337
+
338
+ end
339
+
340
+ def decode_2bears_content(data)
341
+
342
+ event = {}
343
+ power = (10 ** 18).to_i
344
+ hex_string = data['result'].gsub(/^0x/, '')
345
+ chunk_size = 64
346
+ chunks = hex_string.scan(/.{1,#{chunk_size}}/)
347
+ tokenin = decode_2bears_token(chunks[7])
348
+ tokenout = decode_2bears_token(chunks[8])
349
+ event['timestamp'] = chunks[0].to_i(16)
350
+ event['commission'] = "#{chunks[1].to_i(16)/ power.to_i.to_f} #{tokenout}"
351
+ event['value_in'] = "#{chunks[2].to_i(16) / power.to_i.to_f} #{tokenin}"
352
+ event['price'] = "#{chunks[3].to_i(16) / power.to_i.to_f} #{tokenin}"
353
+ event['value_out'] = "#{chunks[4].to_i(16) / power.to_i.to_f} #{tokenout}"
354
+ event['exec_in'] = "#{chunks[5].to_i(16) / power.to_i.to_f} #{tokenin}"
355
+ event['exec_out'] = "#{chunks[6].to_i(16) / power.to_i.to_f} #{tokenout}"
356
+ event['token_in'] = tokenin
357
+ event['token_out'] = tokenout
358
+ event['owner'] = "0x#{chunks[9]}"
359
+ event['order_type'] = (chunks[10].to_i(16) == 1) ? "Sell" : "Buy"
360
+ event['order_status'] = (chunks[11].to_i(16) == 1) ? "Active" : "Executed"
361
+
362
+ return event
363
+
364
+ end
365
+
366
+ def decode_2bears_token(token)
367
+ case token
368
+ when "0000000000000000000000000000000000000000000000000000000000000001"
369
+ return "CLO"
370
+ when "000000000000000000000000bf6c50889d3a620eb42c0f188b65ade90de958c4"
371
+ return "BUSDT"
372
+ else
373
+ return "IDK"
374
+ end
375
+
376
+ end
377
+
298
378
  def get_tx_stats()
299
379
  all_miners = ['0xf34eaf6e2cf4744b5e29734295135c4213d59149', '0xed15b7b7b5dc81daae277a081b47a04c3a8bea1b' ,'0xd125b3b146d21d058edac7a5b5f7481a571e4c46', '0xe683de43ccfbef16424ecb577f288cf343dfbc5a', '0x0073cf1b9230cf3ee8cab1971b8dbef21ea7b595', '0x40b67778d97a7d15a519d907ed991948e8ea486c', '0x8845ee5cae61b807678415bb8a68773df9d48f8e', '0x52f0458c70af5cdeb555cad800add5f82c3e59f7', '0xd06bb917c099acf24d43552b5aa760aeef7cd4aa', '0xf35074bbd0a9aee46f4ea137971feec024ab704e', '0xd144e30a0571aaf0d0c050070ac435deba461fab', '0x8057c50c6d72f4399862fefbc8d3b8a8757cde57', '0xfbf679d6ed0cb9747e05e7e8ae06e890e6bf2b66', '0x11905bd0863ba579023f662d1935e39d0c671933', '0xe4f3cab1f11d5a917ac73c80927e64ee4b1a445a', '0xae83a3e136e6714e6c1e5483950936d7872fb999', '0x39ec1c88a7a7c1a575e8c8f42eff7630d9278179', '0xd6d27255eaef8c3fcb5433acb5494bf04cb5f2c3', '0x004730417cd2b1d19f6be2679906ded4fa8a64e2', '0x89308111f17a395b82f1e5a2824bd01fd13a53b5', '0x800f25eb68a06ff9671605bd450c29e80f593e0a', '0xa5d9018f6c99ec3230633c1187c5cb607c704ed8', '0xfe59743b65f2afec200ce279a289cb4a43eb7eeb', '0x811bad1a4041a9f6ed8fc2f4e9d421dc82626f81', '0xbd12b4511ec9fd1cf481d5643f307252ae6f55e2', '0x5f7661e493d4f1a318c02e9383568597e8a09b5a', '0xe0bac765ca88706a12e4f5a9c0e92dc823fe6293', '0x40c48b386e15981df5a10552cb97ee6d232c8547', '0x458ddc6a7e924554756f95715a53bf948560ee38', '0x3c6b9edb1f8ec6c85436b7cb384eb607489c732f', '0x2a1efdf9f09869a82e5e6b0f3736aabcb5381206', '0xf30a30315d5214e490458d0511595e42b3d917d0', '0x8c2fdc530815eb4267c8b12f10adafc4ca73484a', '0x254b0e1dee486908345e608da64afe35caa02a1c']
300
380
  shitty_wallets = ['0x7971d8defa89bf68ff4142b2bb1e1e3866927b36', '0x33344541086c709fe585caeabc83e5947e783333', '0xcbb8aaf930497c7bd0de6b19903410698e8adab4', '0xc352d245f25fec51ff15c77fc5bf767bf655276a', '0x9daa24510951bc0ac5d1e4f89de5efd89cc8e0b0', '0x941dab361e6d3f0b310f78c2c9eb6779608de0c3', '0x8877e6657f48aee236b47eb1c65be8e7a44f11f8', '0x1a146e329333919542cdb6d2d87de370275124c6', '0xf7d862d42976662d649cc356f4ca3854d595d53d', '0xd125b9d1415b77e0951d5b91dce3ce5d9e4375d0', '0xb94f03ad1b8ddddb82b08cd038b652cbfc47fbb4', '0x8832abcd7248ed2bd740d3eafdeb774ab8332623', '0x6dfb81b6945967e57052e4132a9ca328f8d12f7c', '0x11817fa65a9c2f68fc03bbbc9f2113d59b96908b']
@@ -1540,6 +1620,8 @@ module Agents
1540
1620
  get_tx_stats()
1541
1621
  when "callosha_slots"
1542
1622
  callosha_slots()
1623
+ when "2bears_check_order_by_id"
1624
+ twobears_check_order_by_id()
1543
1625
  else
1544
1626
  log "Error: type has an invalid value (#{type})"
1545
1627
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: huginn_callisto_network_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.65
4
+ version: 0.1.66
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Germain
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-23 00:00:00.000000000 Z
11
+ date: 2023-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler