Class: XRBP::NodeStore::Rate

Inherits:
Object
  • Object
show all
Defined in:
lib/xrbp/nodestore/protocol/rate.rb

Overview

Represents a transfer rate.

The percent of an amount sent that is charged to the sender and paid to the issuer.

xrpl.org/transfer-fees.html

From rippled docs:

Transfer rates are specified as fractions of 1 billion.
For example, a transfer rate of 1% is represented as
  1,010,000,000.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rate = nil) ⇒ Rate

Returns a new instance of Rate.


17
18
19
# File 'lib/xrbp/nodestore/protocol/rate.rb', line 17

def initialize(rate=nil)
  @rate = rate
end

Instance Attribute Details

#rateObject (readonly)

Returns the value of attribute rate.


15
16
17
# File 'lib/xrbp/nodestore/protocol/rate.rb', line 15

def rate
  @rate
end

Class Method Details

.parityObject

Rate signifying a 1:1 exchange


22
23
24
# File 'lib/xrbp/nodestore/protocol/rate.rb', line 22

def self.parity
  @parity ||= Rate.new(QUALITY_ONE)
end

Instance Method Details

#to_amountObject


26
27
28
29
30
# File 'lib/xrbp/nodestore/protocol/rate.rb', line 26

def to_amount
  STAmount.new :issue    => NodeStore.no_issue,
               :mantissa => rate,
               :exponent =>   -9
end