v1 source pure
Package fairmath prices whole-lot fair-sale commitments without holding funds. No sale is active until a separate rea...
Package fairmath prices whole-lot fair-sale commitments without holding funds. No sale is active until a separate realm accounts for custody and exit rights. All amounts are token or quote base units.
1
4
func MaxLots
MaxLots requires the escrowed sale allocation to consist of whole lots. No token dust is created by dividing the allocation between buyers.
func Claim
Claim computes one buyer's exact rights after Clear. Claims over the same orders telescope to its aggregate settlement, regardless of claim order.
func QuoteOrder
QuoteOrder gives the exact token and quote amounts for a whole-lot order.
func Clear
1func Clear(c Caps, allocation, lotSize, totalLots, totalDeposits, closePrice int64) SettlementClear partitions all whole-lot commitments at one pinned clearing price. A missed soft cap returns all deposits and all tokens. On success, deposits above the clearing-price gross remain buyer refund liabilities.
5
type BuyerClaim
structtype Caps
structCaps snapshots the sale's hard cap in whole lots and soft cap in quote atoms actually spent at the final clearing price. Entry deposits and later refunds do not count toward the soft cap.
type Order
structtype Schedule
structSchedule defines quote atoms per lot. A zero decrement is a fixed-price sale; otherwise the price falls by Decrement every IntervalSeconds, never below FloorPrice. End is the scheduled close instant. An inventory or hard- cap close must pass its recorded transaction time to PriceAt instead.