Class: Zold::Taxes
- Inherits:
-
Object
- Object
- Zold::Taxes
- Includes:
- ThreadBadge
- 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::NULL) ⇒ Taxes
constructor
A new instance of Taxes.
- #run(args = []) ⇒ Object
Constructor Details
Instance Method Details
#run(args = []) ⇒ Object
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 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/zold/commands/taxes.rb', line 63 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 '--ignore-score-weakness', 'Don\'t complain when their score is too weak', default: false o.string '--keygap', 'Keygap, if the private RSA key is not complete', default: '' o.bool '--ignore-nodes-absence', 'Don\'t complain if there are not enough nodes in the network to pay taxes', default: false 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| @wallets.acq(Id.new(id)) do |w| show(w, opts) end end when 'debt' raise 'At least one wallet ID is required' unless mine[1] mine[1..-1].each do |id| @wallets.acq(Id.new(id)) do |w| debt(w, opts) end end when 'pay' raise 'At least one wallet ID is required' unless mine[1] mine[1..-1].each do |id| @wallets.acq(Id.new(id), exclusive: true) do |w| pay(w, opts) end end else @log.info(opts.to_s) end end |