Fixed Price Auctioneer (FPA)
Fixed Price Auctioneer is the simplest auction variant. It allows creators to buy/sell a set capacity of token at the quoted price for a certain amount of time. Because of this, it is similar to a limit order in an order book exchange. The goal of this auction variant is to sell as many tokens as possible at the set price. Unlike the SDA auction variants, it will not adjust price to sell out the capacity over the duration.
The Base FPA contract has the following data structures, variables, and methods.
Data Structures (Structs)
MarketParams
Parameters to create a new FPA market. Encoded as bytes and provided as input to createMarket
.
Calculating Formatted Price and Scale Adjustment
In order to support a broad range of tokens, with different decimal configurations and prices, we calculate an optimal scaling factor for each market. Specifically, the scale adjustment allows the FPA to support tokens with 6 to 18 configured decimals and with prices that differ by up to 24 decimal places (if the tokens have the configured decimals, less if not). To implement this, the market creator must provide a scale adjustment factor and format the price correctly.
First, you need the price of each token in a common unit, e.g. dollars or ether.
where:
Now, using the price values and the configured number of decimals for each token, we can calculate the scale adjustment.
where:
Example:
Once we have the scale adjustment, we can format the price using the variables defined above. Here we assume the auction will use the current market price. If selling vesting tokens, a discount to the current market price may be appropriate.
Example: Continuing with the WETH and OHM example from above, we format the price as:
The above price example can be interpreted as 0.0666.. WETH per OHM.
BondMarket
BondMarket contains the core data, such as tokens, capacity, owner, price, etc., for a Fixed Price Market.
BondTerms
BondTerms contains the time parameters of a Fixed Price Market.
Public Variables and View Methods
allowNewMarkets
Whether or not the auctioneer allows new markets to be created
Changing to false will sunset the auctioneer after all active markets end
authority
callbackAuthorized
Whether or not the market creator is authorized to use a callback address
currentCapacity
Returns current capacity of a market
Parameters
getAggregator
Returns the Aggregator that services the Auctioneer
getMarketInfoForPurchase
Provides information for the Teller to execute purchases on a Market
Parameters
Returns
getTeller
Returns the Teller that services the Auctioneer
isInstantSwap
Returns whether the market sends payout immediately (true = no vesting) or not (false = vesting)
Parameters
isLive
Returns whether the market is currently accepting deposits (true) or not (false)
Parameters
marketPrice
Calculates current market price, value returned is the number of quote tokens per payout token, scaled according to the logic described in Calculating Formatted Price and Scale Adjustment
Parameters
marketScale
Scale value to use when converting between quote token and payout token amounts with marketPrice()
Parameters
markets
Returns the core information pertaining to a bond market, see BondMarket
Parameters
maxAmountAccepted
Returns maximum amount of quote token accepted by the market
Parameters
maxPayout
Calculate max payout of the market in payout tokens
Returns a dynamically calculated payout or the maximum set by the creator, whichever is less. If the remaining capacity is less than the max payout, then that amount will be returned.
Parameters
minDepositInterval
Minimum deposit interval for a market
minMarketDuration
Minimum market duration in seconds
newOwners
New address to designate as market owner. They must accept ownership to transfer permissions.
Parameters
ownerOf
Returns the address of the market owner
Parameters
payoutFor
Payout due for amount of quote tokens
Parameters
terms
Information pertaining to market time parameters, see BondTerms
Parameters
State-Mutating Methods
closeMarket
Disable existing bond marketMust be market owner
Parameters
createMarket
Creates a new bond market
See MarketParams for the required formatting for the abi-encoded input params.
Parameters
Returns
pullOwnership
Accept ownership of a marketMust be market newOwner
The existing owner must call pushOwnership prior to the newOwner calling this function
Parameters
purchaseBond
Execute a purchase on the auctioneer. Only callable by the configured Teller. Users must interact with the Teller to make purchases.
Parameters
Returns
pushOwnership
Designate a new owner of a marketMust be market owner
Doesn't change permissions until newOwner calls pullOwnership
Parameters
setAllowNewMarkets
Change the status of the auctioneer to allow creation of new markets
Setting to false and allowing active markets to end will sunset the auctioneer
Parameters
setCallbackAuthStatus
Change whether a market creator is allowed to use a callback address in their markets or notMust be guardian
Callback is believed to be safe, but a whitelist is implemented to prevent abuse
Parameters
setMinDepositInterval
Set the minimum deposit intervalAccess controlled
Parameters
setMinMarketDuration
Set the minimum market durationAccess controlled
Parameters
Events
MarketClosed
Parameters
MarketCreated
Parameters
Errors
Auctioneer_AmountLessThanMinimum
Auctioneer_BadExpiry
Auctioneer_InvalidCallback
Auctioneer_InvalidParams
Auctioneer_MarketNotActive
Auctioneer_MaxPayoutExceeded
Auctioneer_NewMarketsNotAllowed
Auctioneer_NotAuthorized
Auctioneer_NotEnoughCapacity
Auctioneer_OnlyMarketOwner
Last updated