Skip to main content

IBondAuctioneer

Git Source

Functions

createMarket

Creates a new bond market

See specific auctioneer implementations for details on encoding the parameters.

function createMarket(bytes memory params_) external returns (uint256);

Parameters

NameTypeDescription
params_bytesConfiguration data needed for market creation, encoded in a bytes array

Returns

NameTypeDescription
<none>uint256id ID of new bond market

closeMarket

Disable existing bond market

Must be market owner

function closeMarket(uint256 id_) external;

Parameters

NameTypeDescription
id_uint256ID of market to close

purchaseBond

Exchange quote tokens for a bond in a specified market

Must be teller

function purchaseBond(uint256 id_, uint256 amount_, uint256 minAmountOut_) external returns (uint256 payout);

Parameters

NameTypeDescription
id_uint256ID of the Market the bond is being purchased from
amount_uint256Amount to deposit in exchange for bond (after fee has been deducted)
minAmountOut_uint256Minimum acceptable amount of bond to receive. Prevents frontrunning

Returns

NameTypeDescription
payoutuint256Amount of payout token to be received from the bond

setIntervals

Set market intervals to different values than the defaults

Must be market owner

Changing the intervals could cause markets to behave in unexpected way tuneInterval should be greater than tuneAdjustmentDelay

function setIntervals(uint256 id_, uint32[3] calldata intervals_) external;

Parameters

NameTypeDescription
id_uint256Market ID
intervals_uint32[3]Array of intervals (3) 1. Tune interval - Frequency of tuning 2. Tune adjustment delay - Time to implement downward tuning adjustments 3. Debt decay interval - Interval over which debt should decay completely

pushOwnership

Designate a new owner of a market

Must be market owner

Doesn't change permissions until newOwner calls pullOwnership

function pushOwnership(uint256 id_, address newOwner_) external;

Parameters

NameTypeDescription
id_uint256Market ID
newOwner_addressNew address to give ownership to

pullOwnership

Accept ownership of a market

Must be market newOwner

The existing owner must call pushOwnership prior to the newOwner calling this function

function pullOwnership(uint256 id_) external;

Parameters

NameTypeDescription
id_uint256Market ID

setDefaults

Set the auctioneer defaults

Must be policy

The defaults set here are important to avoid edge cases in market behavior, e.g. a very short market reacts doesn't tune well

Only applies to new markets that are created after the change

function setDefaults(uint32[6] memory defaults_) external;

Parameters

NameTypeDescription
defaults_uint32[6]Array of default values 1. Tune interval - amount of time between tuning adjustments 2. Tune adjustment delay - amount of time to apply downward tuning adjustments 3. Minimum debt decay interval - minimum amount of time to let debt decay to zero 4. Minimum deposit interval - minimum amount of time to wait between deposits 5. Minimum market duration - minimum amount of time a market can be created for 6. Minimum debt buffer - the minimum amount of debt over the initial debt to trigger a market shutdown

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

function setAllowNewMarkets(bool status_) external;

Parameters

NameTypeDescription
status_boolAllow market creation (true) : Disallow market creation (false)

setCallbackAuthStatus

Change whether a market creator is allowed to use a callback address in their markets or not

Must be guardian

Callback is believed to be safe, but a whitelist is implemented to prevent abuse

function setCallbackAuthStatus(address creator_, bool status_) external;

Parameters

NameTypeDescription
creator_addressAddress of market creator
status_boolAllow callback (true) : Disallow callback (false)

getMarketInfoForPurchase

Provides information for the Teller to execute purchases on a Market

function getMarketInfoForPurchase(uint256 id_)
external
view
returns (
address owner,
address callbackAddr,
ERC20 payoutToken,
ERC20 quoteToken,
uint48 vesting,
uint256 maxPayout
);

Parameters

NameTypeDescription
id_uint256Market ID

Returns

NameTypeDescription
owneraddressAddress of the market owner (tokens transferred from this address if no callback)
callbackAddraddressAddress of the callback contract to get tokens for payouts
payoutTokenERC20Payout Token (token paid out) for the Market
quoteTokenERC20Quote Token (token received) for the Market
vestinguint48Timestamp or duration for vesting, implementation-dependent
maxPayoutuint256Maximum amount of payout tokens you can purchase in one transaction

marketPrice

Calculate current market price of payout token in quote tokens

function marketPrice(uint256 id_) external view returns (uint256);

Parameters

NameTypeDescription
id_uint256ID of market

Returns

NameTypeDescription
<none>uint256Price for market in configured decimals

marketScale

Scale value to use when converting between quote token and payout token amounts with marketPrice()

function marketScale(uint256 id_) external view returns (uint256);

Parameters

NameTypeDescription
id_uint256ID of market

Returns

NameTypeDescription
<none>uint256Scaling factor for market in configured decimals

payoutFor

Payout due for amount of quote tokens

Accounts for debt and control variable decay so it is up to date

function payoutFor(uint256 amount_, uint256 id_, address referrer_) external view returns (uint256);

Parameters

NameTypeDescription
amount_uint256Amount of quote tokens to spend
id_uint256ID of market
referrer_addressAddress of referrer, used to get fees to calculate accurate payout amount. Inputting the zero address will take into account just the protocol fee.

Returns

NameTypeDescription
<none>uint256amount of payout tokens to be paid

maxAmountAccepted

Returns maximum amount of quote token accepted by the market

function maxAmountAccepted(uint256 id_, address referrer_) external view returns (uint256);

Parameters

NameTypeDescription
id_uint256ID of market
referrer_addressAddress of referrer, used to get fees to calculate accurate payout amount. Inputting the zero address will take into account just the protocol fee.

isInstantSwap

Does market send payout immediately

function isInstantSwap(uint256 id_) external view returns (bool);

Parameters

NameTypeDescription
id_uint256Market ID to search for

isLive

Is a given market accepting deposits

function isLive(uint256 id_) external view returns (bool);

Parameters

NameTypeDescription
id_uint256ID of market

ownerOf

Returns the address of the market owner

function ownerOf(uint256 id_) external view returns (address);

Parameters

NameTypeDescription
id_uint256ID of market

getTeller

Returns the Teller that services the Auctioneer

function getTeller() external view returns (IBondTeller);

getAggregator

Returns the Aggregator that services the Auctioneer

function getAggregator() external view returns (IBondAggregator);

currentCapacity

Returns current capacity of a market

function currentCapacity(uint256 id_) external view returns (uint256);