Sha256: 8b073f0601f1debf93554a2b88e55dcc391ca049d886cb9e5efc34425a1e398e
Contents?: true
Size: 974 Bytes
Versions: 2
Compression:
Stored size: 974 Bytes
Contents
module Glueby module Contract module FeeEstimator # It calculates actual minimum fee to broadcast txs. class Auto include FeeEstimator # This is same with Tapyrus Core's default min_relay_fee value.(tapyrus/kB) DEFAULT_FEE_RATE = 1_000 # @!attribute [r] fee_rate # @return [Integer] the fee rate(tapyrus/kB) that is used actual fee calculation attr_reader :fee_rate class << self # @!attribute [rw] default_fee_rate # @return [Integer] The global fee rate configuration. All instances use this value as the default. attr_accessor :default_fee_rate end # @param [Integer] fee_rate def initialize(fee_rate: Auto.default_fee_rate || DEFAULT_FEE_RATE) @fee_rate = fee_rate end private def estimate_fee(tx) ((tx.to_payload.bytesize / 1000.0) * fee_rate).ceil end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
glueby-1.0.0 | lib/glueby/contract/fee_estimator/auto.rb |
glueby-0.12.0 | lib/glueby/contract/fee_estimator/auto.rb |