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



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

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



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

def bqd
  @bqd
end

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

Returns:

  • (Array<Hash>)

    todos os dados bigquery

  • (Thor::CoreExt::HashWithIndifferentAccess)

    opcoes trabalho



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

def ops
  @ops
end

Instance Method Details

#mresumoObject

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



73
74
75
76
77
78
79
80
# File 'lib/cns/etherscan.rb', line 73

def mresumo
  return unless bqexd.any?

  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

#mresumo_simplesObject

mostra resumo carteiras & transacoes & ajuste dias



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

def mresumo_simples
  return unless bqexd.any?

  puts("\nid     address                                        etherscan      bigquery")
  bqexd.each { |o| puts(focs(o)) }
  mtransacoes_novas
  mconfiguracao_ajuste_dias
end