Class: TxCatcher::Deposit
- Inherits:
-
Sequel::Model
- Object
- Sequel::Model
- TxCatcher::Deposit
- Defined in:
- lib/txcatcher/models/deposit.rb
Instance Attribute Summary collapse
-
#address_string ⇒ Object
Returns the value of attribute address_string.
Instance Method Summary collapse
Instance Attribute Details
#address_string ⇒ Object
Returns the value of attribute address_string.
7 8 9 |
# File 'lib/txcatcher/models/deposit.rb', line 7 def address_string @address_string end |
Instance Method Details
#amount_in_btc ⇒ Object
17 18 19 |
# File 'lib/txcatcher/models/deposit.rb', line 17 def amount_in_btc Satoshi.new(self.amount, from_unit: :satoshi).to_btc end |
#before_save ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/txcatcher/models/deposit.rb', line 9 def before_save if @address_string self.address = Address.find_or_create(address: @address_string) end self.address.update(received: self.address.received + self.amount) end |