Class: Shilling::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/shilling.rb

Constant Summary collapse

WALLET_ADDRESSES =
%w[Theresa Franz Antonia Maximilan Maria Ferdinand Elisabeth Adam Eva]
COINBASE =

note: add a (†) coinbase marker

fix: "sync" with ledger-lite config!!!!
['Coinbase†']

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



76
77
78
79
80
81
82
83
84
# File 'lib/shilling.rb', line 76

def initialize
  ## try default setup via ENV variables
  ## pick "random" address if nil (none passed in)
  @address = ENV[ 'SHILLING_NAME'] || rand_address()

  @coinbase = COINBASE         ## use a different name - why? why not?
                               ##  note: for now is an array (multiple coinbases)
  @mining_reward = 43     ## use country code for austria (43)
end

Instance Attribute Details

#addressObject

user/node settings



56
57
58
# File 'lib/shilling.rb', line 56

def address
  @address
end

#coinbaseObject

system/blockchain settings



61
62
63
# File 'lib/shilling.rb', line 61

def coinbase
  @coinbase
end

#mining_rewardObject

Returns the value of attribute mining_reward.



62
63
64
# File 'lib/shilling.rb', line 62

def mining_reward
  @mining_reward
end

Instance Method Details

#coinbase?(address) ⇒ Boolean

check/todo: use wallet - why? why not? (for now wallet==address)

Returns:

  • (Boolean)


89
90
91
# File 'lib/shilling.rb', line 89

def coinbase?( address )    ## check/todo: use wallet - why? why not? (for now wallet==address)
  @coinbase.include?( address )
end

#rand_addressObject



86
# File 'lib/shilling.rb', line 86

def rand_address()      WALLET_ADDRESSES[rand( WALLET_ADDRESSES.size )];  end

#rand_coinbaseObject



87
# File 'lib/shilling.rb', line 87

def rand_coinbase()     @coinbase[rand( @coinbase.size )];  end