Skip to main content

IConvertibleDepositAuctioneer

Git Source

Title: IConvertibleDepositAuctioneer

Interface for a contract that runs auctions for a single deposit token to convert to a convertible deposit token

Functions

bid

Submit a bid for convertible deposit tokens

function bid(
uint8 depositPeriod_,
uint256 depositAmount_,
uint256 minOhmOut_,
bool wrapPosition_,
bool wrapReceipt_
) external returns (uint256 ohmOut, uint256 positionId, uint256 receiptTokenId, uint256 actualAmount);

Parameters

NameTypeDescription
depositPeriod_uint8The deposit period
depositAmount_uint256Amount of deposit asset to deposit
minOhmOut_uint256The minimum amount of OHM tokens that the deposit should convert to, in order to succeed. This acts as slippage protection.
wrapPosition_boolWhether to wrap the position as an ERC721
wrapReceipt_boolWhether to wrap the receipt as an ERC20

Returns

NameTypeDescription
ohmOutuint256Amount of OHM tokens that the deposit can be converted to
positionIduint256The ID of the position created by the DEPOS module to represent the convertible deposit terms
receiptTokenIduint256The ID of the receipt token created by the DepositManager to represent the deposit
actualAmountuint256The actual amount of deposit assets that were deposited (receipt tokens minted)

previewBid

Get the amount of OHM tokens that could be converted for a bid

function previewBid(uint8 depositPeriod_, uint256 depositAmount_) external view returns (uint256 ohmOut);

Parameters

NameTypeDescription
depositPeriod_uint8The deposit period
depositAmount_uint256Amount of deposit asset to deposit

Returns

NameTypeDescription
ohmOutuint256Amount of OHM tokens that the deposit could be converted to

getPreviousTick

Get the previous tick of the auction

function getPreviousTick(uint8 depositPeriod_) external view returns (Tick memory tick);

Returns

NameTypeDescription
tickTickTick info

getCurrentTick

Calculate the current tick of the auction

This function should calculate the current tick based on the previous tick and the time passed since the last update

function getCurrentTick(uint8 depositPeriod_) external view returns (Tick memory tick);

Returns

NameTypeDescription
tickTickTick info

getCurrentTickSize

Get the current tick size

function getCurrentTickSize() external view returns (uint256 tickSize);

Returns

NameTypeDescription
tickSizeuint256The current tick size

getAuctionParameters

Get the current auction parameters

function getAuctionParameters() external view returns (AuctionParameters memory auctionParameters);

Returns

NameTypeDescription
auctionParametersAuctionParametersAuction parameters

isAuctionActive

Check if the auction is currently active

The auction is considered active when target > 0

function isAuctionActive() external view returns (bool isActive);

Returns

NameTypeDescription
isActiveboolTrue if the auction is active, false if disabled

getDayState

Get the auction state for the current day

function getDayState() external view returns (Day memory day);

Returns

NameTypeDescription
dayDayDay info

getTickStep

The multiplier applied to the conversion price at every tick, in terms of ONE_HUNDRED_PERCENT

This is stored as a percentage, where 100e2 = 100% (no increase)

function getTickStep() external view returns (uint24 tickStep);

Returns

NameTypeDescription
tickStepuint24The tick step, in terms of ONE_HUNDRED_PERCENT

getAuctionTrackingPeriod

Get the number of days that auction results are tracked for

function getAuctionTrackingPeriod() external view returns (uint8 daysTracked);

Returns

NameTypeDescription
daysTrackeduint8The number of days that auction results are tracked for

getAuctionResults

Get the auction results for the tracking period

function getAuctionResults() external view returns (int256[] memory results);

Returns

NameTypeDescription
resultsint256[]The auction results, where a positive number indicates an over-subscription for the day.

getAuctionResultsNextIndex

Get the index of the next auction result

function getAuctionResultsNextIndex() external view returns (uint8 index);

Returns

NameTypeDescription
indexuint8The index where the next auction result will be stored

getMinimumBid

Get the minimum bid amount

function getMinimumBid() external view returns (uint256 minimumBid);

Returns

NameTypeDescription
minimumBiduint256The minimum bid amount required

getDepositAsset

Get the deposit asset

function getDepositAsset() external view returns (IERC20 asset);

Returns

NameTypeDescription
assetIERC20The deposit asset

getDepositPeriods

Get the deposit periods for the deposit asset that are enabled

function getDepositPeriods() external view returns (uint8[] memory periods);

Returns

NameTypeDescription
periodsuint8[]The deposit periods

getDepositPeriodsCount

Get the number of deposit periods that are enabled

function getDepositPeriodsCount() external view returns (uint256 count);

Returns

NameTypeDescription
countuint256The number of deposit periods

isDepositPeriodEnabled

Returns whether a deposit period is enabled

function isDepositPeriodEnabled(uint8 depositPeriod_) external view returns (bool isEnabled, bool isPendingEnabled);

Parameters

NameTypeDescription
depositPeriod_uint8The deposit period

Returns

NameTypeDescription
isEnabledboolCurrent state
isPendingEnabledboolDesired state after applying all queued changes (equals isEnabled if no changes are queued)

enableDepositPeriod

Enables a deposit period

The implementing contract is expected to handle the following:

  • Validating that the caller has the correct role
  • Enabling the deposit period
  • Emitting an event
function enableDepositPeriod(uint8 depositPeriod_) external;

Parameters

NameTypeDescription
depositPeriod_uint8The deposit period

disableDepositPeriod

Disables a deposit period

The implementing contract is expected to handle the following:

  • Validating that the caller has the correct role
  • Disabling the deposit period
  • Emitting an event
function disableDepositPeriod(uint8 depositPeriod_) external;

Parameters

NameTypeDescription
depositPeriod_uint8The deposit period

setAuctionParameters

Update the auction parameters

This function is expected to be called periodically. Only callable by the auction admin

function setAuctionParameters(uint256 target_, uint256 tickSize_, uint256 minPrice_) external;

Parameters

NameTypeDescription
target_uint256new target sale per day
tickSize_uint256new size per tick
minPrice_uint256new minimum tick price

setTickStep

Sets the multiplier applied to the conversion price at every tick, in terms of ONE_HUNDRED_PERCENT

See getTickStep() for more information Only callable by the admin

function setTickStep(uint24 tickStep_) external;

Parameters

NameTypeDescription
tickStep_uint24new tick step, in terms of ONE_HUNDRED_PERCENT

setAuctionTrackingPeriod

Set the number of days that auction results are tracked for

Only callable by the admin

function setAuctionTrackingPeriod(uint8 days_) external;

Parameters

NameTypeDescription
days_uint8The number of days that auction results are tracked for

setMinimumBid

Set the minimum bid amount

Only callable by the admin or manager

function setMinimumBid(uint256 minimumBid_) external;

Parameters

NameTypeDescription
minimumBid_uint256The new minimum bid amount

getTickSizeBase

Get the exponent base used for determining the tick size when the day target is crossed

function getTickSizeBase() external view returns (uint256 baseWad);

Returns

NameTypeDescription
baseWaduint256The tick size base

setTickSizeBase

Set the exponent base used for determining the tick size when the day target is crossed

Only callable by the admin or manager

function setTickSizeBase(uint256 newBase_) external;

Parameters

NameTypeDescription
newBase_uint256The new base

Events

Bid

Emitted when a bid is made

event Bid(
address indexed bidder,
address indexed depositAsset,
uint8 indexed depositPeriod,
uint256 depositAmount,
uint256 convertedAmount,
uint256 positionId
);

Parameters

NameTypeDescription
bidderaddressThe address of the bidder
depositAssetaddressThe asset that is being deposited
depositPerioduint8The deposit period
depositAmountuint256The amount of deposit asset that was deposited
convertedAmountuint256The amount of OHM that can be converted
positionIduint256The ID of the position created by the DEPOS module to represent the convertible deposit terms

AuctionParametersUpdated

Emitted when the auction parameters are updated

event AuctionParametersUpdated(
address indexed depositAsset, uint256 newTarget, uint256 newTickSize, uint256 newMinPrice
);

Parameters

NameTypeDescription
depositAssetaddress
newTargetuint256Target for OHM sold per day
newTickSizeuint256Number of OHM in a tick
newMinPriceuint256Minimum tick price

AuctionResult

Emitted when the auction result is recorded

event AuctionResult(address indexed depositAsset, uint256 ohmConvertible, uint256 target, uint8 periodIndex);

Parameters

NameTypeDescription
depositAssetaddress
ohmConvertibleuint256Amount of OHM that was converted
targetuint256Target for OHM sold per day
periodIndexuint8The index of the auction result in the tracking period

TickStepUpdated

Emitted when the tick step is updated

event TickStepUpdated(address indexed depositAsset, uint24 newTickStep);

Parameters

NameTypeDescription
depositAssetaddress
newTickStepuint24Percentage increase (decrease) per tick

AuctionTrackingPeriodUpdated

Emitted when the auction tracking period is updated

event AuctionTrackingPeriodUpdated(address indexed depositAsset, uint8 newAuctionTrackingPeriod);

Parameters

NameTypeDescription
depositAssetaddress
newAuctionTrackingPerioduint8The number of days that auction results are tracked for

MinimumBidUpdated

Emitted when the minimum bid is updated

event MinimumBidUpdated(address indexed depositAsset, uint256 newMinimumBid);

Parameters

NameTypeDescription
depositAssetaddress
newMinimumBiduint256The new minimum bid amount

TickSizeBaseUpdated

Emitted when the tick size base is updated

event TickSizeBaseUpdated(address indexed depositAsset, uint256 newBase);

Parameters

NameTypeDescription
depositAssetaddress
newBaseuint256The new tick size base

DepositPeriodEnabled

Emitted when a deposit period is enabled

event DepositPeriodEnabled(address indexed depositAsset, uint8 depositPeriod);

Parameters

NameTypeDescription
depositAssetaddressThe asset that is being deposited
depositPerioduint8The deposit period

DepositPeriodDisabled

Emitted when a deposit period is disabled

event DepositPeriodDisabled(address indexed depositAsset, uint8 depositPeriod);

Parameters

NameTypeDescription
depositAssetaddressThe asset that is being deposited
depositPerioduint8The deposit period

DepositPeriodEnableQueued

Emitted when a deposit period enable is queued

event DepositPeriodEnableQueued(address indexed depositAsset, uint8 depositPeriod);

Parameters

NameTypeDescription
depositAssetaddressThe asset that is being deposited
depositPerioduint8The deposit period

DepositPeriodDisableQueued

Emitted when a deposit period disable is queued

event DepositPeriodDisableQueued(address indexed depositAsset, uint8 depositPeriod);

Parameters

NameTypeDescription
depositAssetaddressThe asset that is being deposited
depositPerioduint8The deposit period

Errors

ConvertibleDepositAuctioneer_InvalidParams

Emitted when the parameters are invalid

error ConvertibleDepositAuctioneer_InvalidParams(string reason);

Parameters

NameTypeDescription
reasonstringReason for invalid parameters

ConvertibleDepositAuctioneer_ConvertedAmountZero

Emitted when the OHM output (the amount of OHM the deposit can be converted to) is zero

error ConvertibleDepositAuctioneer_ConvertedAmountZero();

ConvertibleDepositAuctioneer_ConvertedAmountSlippage

Emitted when the OHM output (the amount of OHM the deposit can be converted to) is less than the minimum specified

error ConvertibleDepositAuctioneer_ConvertedAmountSlippage(uint256 ohmOut, uint256 minOhmOut);

Parameters

NameTypeDescription
ohmOutuint256The amount of OHM tokens that the deposit can be converted to
minOhmOutuint256The minimum amount of OHM that the deposit should convert to, in order to succeed

ConvertibleDepositAuctioneer_DepositPeriodNotEnabled

Emitted when the deposit period is not enabled for this asset

error ConvertibleDepositAuctioneer_DepositPeriodNotEnabled(address depositAsset, uint8 depositPeriod);

ConvertibleDepositAuctioneer_DepositPeriodInvalidState

Emitted when the deposit period is in an invalid state for the requested operation

error ConvertibleDepositAuctioneer_DepositPeriodInvalidState(
address depositAsset, uint8 depositPeriod, bool isEnabled
);

Parameters

NameTypeDescription
depositAssetaddress
depositPerioduint8
isEnabledboolThe current enabled state: true if enabled, false if disabled

ConvertibleDepositAuctioneer_BidBelowMinimum

Emitted when the bid amount is below the minimum required

error ConvertibleDepositAuctioneer_BidBelowMinimum(uint256 bidAmount, uint256 minimumBid);

Parameters

NameTypeDescription
bidAmountuint256The amount of the bid
minimumBiduint256The minimum bid amount required

Structs

AuctionParameters

Auction parameters

These values should only be set through the setAuctionParameters() function

struct AuctionParameters {
uint256 target;
uint256 tickSize;
uint256 minPrice;
}

Properties

NameTypeDescription
targetuint256Number of OHM available to sell per day
tickSizeuint256Number of OHM in a tick
minPriceuint256Minimum price that OHM can be sold for, in terms of the bid token

Day

Tracks auction activity for a given day

struct Day {
uint48 initTimestamp;
uint256 convertible;
}

Properties

NameTypeDescription
initTimestampuint48Timestamp when the day state was initialized
convertibleuint256Quantity of OHM that will be issued for the day's deposits

Tick

Information about a tick

struct Tick {
uint256 price;
uint256 capacity;
uint48 lastUpdate;
}

Properties

NameTypeDescription
priceuint256Price of the tick, in terms of the bid token
capacityuint256Capacity of the tick, in terms of OHM
lastUpdateuint48Timestamp of last update to the tick

EnableParams

Parameters provided to the enable() function

struct EnableParams {
uint256 target;
uint256 tickSize;
uint256 minPrice;
uint256 tickSizeBase;
uint24 tickStep;
uint8 auctionTrackingPeriod;
}

Properties

NameTypeDescription
targetuint256Number of OHM available to sell per day
tickSizeuint256Number of OHM in a tick
minPriceuint256Minimum price that OHM can be sold for, in terms of the bid token
tickSizeBaseuint256Base for exponential tick size reduction (by 1/(base^multiplier)) when the day target is crossed
tickStepuint24Percentage increase (decrease) per tick
auctionTrackingPerioduint8Number of days that auction results are tracked for