Class: Cns::Etherscan

Inherits:
Object
  • Object
show all
Extended by:
Memoist
Defined in:
lib/cns/etherscan.rb

Overview

classe para processar transacoes do etherscan

Constant Summary collapse

TT =
{
  normal: {
    new: :novxt,
    format: :foti,
    header: "\ntx normal                     from            to              data         valor",
    sork: :srx,
    adjk: :hash
  }.freeze,
  internal: {
    new: :novxi,
    format: :foti,
    header: "\ntx intern                     from            to              data         valor",
    sork: :srx,
    adjk: :hash
  }.freeze,
  block: {
    new: :novxp,
    format: :fop,
    header: "\ntx block  address                                   data                   valor",
    sork: :itx,
    adjk: :blockNumber
  }.freeze,
  token: {
    new: :novxk,
    format: :fok,
    header: "\ntx token             from            to              data            valor moeda",
    sork: :srx,
    adjk: :hash
  }.freeze,
  withdrawal: {
    new: :novxw,
    format: :fow,
    header: "\nwithdrawal validator data            valor",
    sork: :itx,
    adjk: :withdrawalIndex
  }.freeze
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dad, pop) ⇒ Etherscan

Returns a new instance of Etherscan.

Parameters:

  • dad (Hash)

    todos os dados bigquery

  • pop (Thor::CoreExt::HashWithIndifferentAccess)

    opcoes trabalho

Options Hash (pop):

  • :h (Hash) — default: {}

    configuracao dias ajuste reposicionamento temporal

  • :v (Boolean) — default: false

    mostra dados transacoes



58
59
60
61
# File 'lib/cns/etherscan.rb', line 58

def initialize(dad, pop)
  @bqd = dad
  @ops = pop.transform_keys(&:to_sym)
end

Instance Attribute Details

#bqdArray<Hash>, Thor::CoreExt::HashWithIndifferentAccess (readonly)

Returns:

  • (Array<Hash>)

    todos os dados bigquery

  • (Thor::CoreExt::HashWithIndifferentAccess)

    opcoes trabalho



14
15
16
# File 'lib/cns/etherscan.rb', line 14

def bqd
  @bqd
end

#opsArray<Hash>, Thor::CoreExt::HashWithIndifferentAccess (readonly)

Returns:

  • (Array<Hash>)

    todos os dados bigquery

  • (Thor::CoreExt::HashWithIndifferentAccess)

    opcoes trabalho



14
15
16
# File 'lib/cns/etherscan.rb', line 14

def ops
  @ops
end

Instance Method Details

#mresumoObject

mostra resumo carteiras & transacoes & ajuste dias (com contadores)



64
65
66
67
68
69
70
71
# File 'lib/cns/etherscan.rb', line 64

def mresumo
  return if bqexd.none?

  puts("\nid     address      etherscan  tn ti tb tk   tw    bigquery  tn ti tb tk   tw")
  bqexd.each { |o| puts(foct(o)) }
  mtransacoes_novas
  mconfiguracao_ajuste_dias
end