Splice.Fees
Utility functions for different kinds of fees.
Data Types
data ExpiringAmount
Field
Type
Description
initialAmount
createdAt
ratePerRound
instance Eq ExpiringAmount
instance Ord ExpiringAmount
instance Show ExpiringAmount
instance GetField "amount" Amulet ExpiringAmount
instance GetField "createdAt" ExpiringAmount Round
instance GetField "initialAmount" ExpiringAmount Decimal
instance GetField "ratePerRound" ExpiringAmount RatePerRound
instance SetField "amount" Amulet ExpiringAmount
instance SetField "createdAt" ExpiringAmount Round
instance SetField "initialAmount" ExpiringAmount Decimal
instance SetField "ratePerRound" ExpiringAmount RatePerRound
data FixedFee
A fixed fee independent of the action being taken. TODO(M3-90): check whether this name matches usage in financial terms, it probably isn’t. Should it be ‘flat-fee’, ‘constantfee’, ... ???
Field
Type
Description
fee
instance GetField "createFee" (TransferConfig unit) FixedFee
instance GetField "fee" FixedFee Decimal
instance GetField "lockHolderFee" (TransferConfig unit) FixedFee
instance SetField "createFee" (TransferConfig unit) FixedFee
instance SetField "fee" FixedFee Decimal
instance SetField "lockHolderFee" (TransferConfig unit) FixedFee
data RatePerRound
Field
Type
Description
rate
instance Eq RatePerRound
instance Ord RatePerRound
instance Show RatePerRound
instance GetField "holdingFee" (TransferConfig unit) RatePerRound
instance GetField "rate" RatePerRound Decimal
instance GetField "ratePerRound" ExpiringAmount RatePerRound
instance SetField "holdingFee" (TransferConfig unit) RatePerRound
instance SetField "rate" RatePerRound Decimal
instance SetField "ratePerRound" ExpiringAmount RatePerRound
data SteppedRate
A rate defined as a piecewise linear function, e.g., `SteppedRate 0.01 [(100.0, 0.001), (1000.0, 0.0001), (1000000, 0.00001)] corresponds to 1% of the first 100, 0.1% between 100 and 1000, 0.01% between 1000 and 1000000 and 0.001% for everything above that.
instance Eq SteppedRate
instance Ord SteppedRate
instance Show SteppedRate
instance GetField "initialRate" SteppedRate Decimal
instance GetField "steps" SteppedRate [(Decimal, Decimal)]
instance GetField "transferFee" (TransferConfig unit) SteppedRate
instance SetField "initialRate" SteppedRate Decimal
instance SetField "steps" SteppedRate [(Decimal, Decimal)]
instance SetField "transferFee" (TransferConfig unit) SteppedRate
Functions
- scaleRatePerRound
: Decimal -> RatePerRound -> RatePerRound
Scale a round rate such that
ALL s r dt. s * chargeRatePerRound r dt = chargeRatePerRound (s
scaleRatePerRound
r) dt
- scaleSteppedRate
: Decimal -> SteppedRate -> SteppedRate
Scale a fixed-plus-variable rate such that
ALL s r q. s * chargeSteppedRate r (q/s) = chargeSteppedRate (s
scaleSteppedRate
r) q
- actualAmount
: Round -> ExpiringAmount -> Decimal
- expiringAmount
: RatePerRound -> Decimal -> Round -> ExpiringAmount
Smart constructor for an expiring amount.