Class: Stellar::LiquidityPool::BasePool
- Inherits:
-
Object
- Object
- Stellar::LiquidityPool::BasePool
- Defined in:
- lib/stellar/liquidity_pool/base_pool.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#asset_a ⇒ Object
readonly
Returns the value of attribute asset_a.
-
#asset_b ⇒ Object
readonly
Returns the value of attribute asset_b.
-
#fee ⇒ Object
readonly
Returns the value of attribute fee.
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(asset_a:, asset_b:) ⇒ BasePool
constructor
A new instance of BasePool.
- #inspect ⇒ Object
- #pool_params ⇒ Object
- #pool_type ⇒ Object
- #to_change_trust_asset ⇒ Object
- #to_pool_id ⇒ Object
- #to_s ⇒ Object
- #to_trust_line_asset ⇒ Object
Constructor Details
#initialize(asset_a:, asset_b:) ⇒ BasePool
Returns a new instance of BasePool.
8 9 10 11 12 |
# File 'lib/stellar/liquidity_pool/base_pool.rb', line 8 def initialize(asset_a:, asset_b:) @asset_a = asset_a @asset_b = asset_b @fee = LIQUIDITY_POOL_FEE_V18 end |
Instance Attribute Details
#asset_a ⇒ Object (readonly)
Returns the value of attribute asset_a.
4 5 6 |
# File 'lib/stellar/liquidity_pool/base_pool.rb', line 4 def asset_a @asset_a end |
#asset_b ⇒ Object (readonly)
Returns the value of attribute asset_b.
4 5 6 |
# File 'lib/stellar/liquidity_pool/base_pool.rb', line 4 def asset_b @asset_b end |
#fee ⇒ Object (readonly)
Returns the value of attribute fee.
4 5 6 |
# File 'lib/stellar/liquidity_pool/base_pool.rb', line 4 def fee @fee end |
Instance Method Details
#id ⇒ Object
14 15 16 |
# File 'lib/stellar/liquidity_pool/base_pool.rb', line 14 def id PoolID.to_xdr(to_pool_id, :hex) end |
#inspect ⇒ Object
22 23 24 |
# File 'lib/stellar/liquidity_pool/base_pool.rb', line 22 def inspect "#<#{self.class.name} #{self}>" end |
#pool_params ⇒ Object
42 43 44 |
# File 'lib/stellar/liquidity_pool/base_pool.rb', line 42 def pool_params raise NotImplementedError end |
#pool_type ⇒ Object
38 39 40 |
# File 'lib/stellar/liquidity_pool/base_pool.rb', line 38 def pool_type raise NotImplementedError end |
#to_change_trust_asset ⇒ Object
30 31 32 |
# File 'lib/stellar/liquidity_pool/base_pool.rb', line 30 def to_change_trust_asset ChangeTrustAsset.liquidity_pool(pool_params) end |
#to_pool_id ⇒ Object
26 27 28 |
# File 'lib/stellar/liquidity_pool/base_pool.rb', line 26 def to_pool_id Digest::SHA256.digest(pool_params.to_xdr) end |
#to_s ⇒ Object
18 19 20 |
# File 'lib/stellar/liquidity_pool/base_pool.rb', line 18 def to_s "liquidity_pool:#{id}" end |
#to_trust_line_asset ⇒ Object
34 35 36 |
# File 'lib/stellar/liquidity_pool/base_pool.rb', line 34 def to_trust_line_asset TrustLineAsset.liquidity_pool_id(to_pool_id) end |