Class: Zold::Taxes
- Inherits:
-
Object
- Object
- Zold::Taxes
- Defined in:
- lib/zold/commands/taxes.rb
Overview
Taxes command.
The user pays taxes for his/her wallet by running ‘zold taxes pay’. As the White Paper explains (find it at papers.zold.io), each wallet has to pay certain amount of taxes in order to be accepted by any node in the network. Of course, a node may make a decision to accept and store any wallet, even if taxes are not paid, but the majority of nodes will obey the rules and will reject wallets that haven’t paid enough taxes.
Taxes are paid from wallet to wallet, not from clients to nodes. A wallet just selects the most suitable wallet to transfer taxes to and sends the payment. More details you can find in the White Paper.
Instance Method Summary collapse
-
#initialize(wallets:, remotes:, log: Log::Quiet.new) ⇒ Taxes
constructor
A new instance of Taxes.
- #run(args = []) ⇒ Object
Constructor Details
Instance Method Details
#run(args = []) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/zold/commands/taxes.rb', line 58 def run(args = []) opts = Slop.parse(args, help: true, suppress_errors: true) do |o| o. = "Usage: zold taxes command [options] Available commands: #{Rainbow('taxes pay').green} wallet Pay taxes for the given wallet #{Rainbow('taxes show').green} Show taxes status for the given wallet #{Rainbow('taxes debt').green} Show current debt Available options:" o.string '--private-key', 'The location of RSA private key (default: ~/.ssh/id_rsa)', require: true, default: '~/.ssh/id_rsa' o.bool '--help', 'Print instructions' end mine = Args.new(opts, @log).take || return command = mine[0] case command when 'show' raise 'At least one wallet ID is required' unless mine[1] mine[1..-1].each do |id| show(@wallets.find(Id.new(id)), opts) end when 'debt' raise 'At least one wallet ID is required' unless mine[1] mine[1..-1].each do |id| debt(@wallets.find(Id.new(id)), opts) end when 'pay' raise 'At least one wallet ID is required' unless mine[1] mine[1..-1].each do |id| pay(@wallets.find(Id.new(id)), opts) end else @log.info(opts.to_s) end end |