Module: Currency

Extended by:
ActiveSupport::Concern
Included in:
Event::Participant
Defined in:
app/models/concerns/currency.rb

Constant Summary collapse

TOKENS_AMOUNT_PRECISION =
4
RATIO_PRECISION =
4
COMMISSION_PRECISION =
6
LIABILITY_CODES =
{
    fiat: { main: 201, locked: 211 },
    coin: { main: 202, locked: 212 }
}
REVENUE_CODES =
{
    fiat: { main: 301 },
    coin: { main: 302 }
}

Instance Method Summary collapse

Instance Method Details

#fetch_currency(code) ⇒ Object



21
22
23
24
25
# File 'app/models/concerns/currency.rb', line 21

def fetch_currency(code)
  Rails.cache.fetch("currency_#{code}", expires_in: 1.day) do
    Peatio::ManagementAPIV2::Client.new.currency(code: code)
  end
end