DEFAULT_ADMIN_ROLE: Can manage all other roles
AUCTIONEER_ROLE: Can create and manage bond markets
TOKEN_WHITELISTER_ROLE: Can whitelist new tokens for bonding
EMERGENCY_ADMIN_ROLE: Can pause/unpause the contract
Contract Interface
Administrative Functions
grantAuctioneerRole(address _auctioneer)
Grants the AUCTIONEER_ROLE to an address.
Requires DEFAULT_ADMIN_ROLE
whitelistToken(address _token)
Adds a token to the whitelist of acceptable payout tokens.
Requires TOKEN_WHITELISTER_ROLE
Validates token implements IERC20Metadata
Adds token to _payoutTokens array
pauseContract() / unpauseContract()
Emergency controls to pause/unpause contract operations.
Requires EMERGENCY_ADMIN_ROLE
Emits ContractPaused/ContractUnpaused events
Market Creation & Management
Creates a new bond market with specified parameters:
payoutToken_: Token to be distributed to bonders
_quoteToken: Token to be received from bonders
_terms: Array containing:
[0] amountToBond: Total tokens available for bonding
[1] controlVariable: Scaling factor for price
[2] minimumPrice: Price floor
[3] maxDebt: Maximum debt ratio allowed
_vestingTerms: Array containing:
[0] bondEnds: Timestamp when bond expires
[1] vestingTerm: Duration of vesting in seconds
closeBond(uint256 _id)
Closes an existing bond market early.
Only callable by original auctioneer
Returns remaining payout tokens to auctioneer
Deposits quote tokens to receive vesting payout tokens:
amount: Amount of quote tokens to deposit
user: Address to receive the bond
Requirements:
Amount must meet minimum deposit
Total debt must not exceed maximum
redeem(uint256 _id, address user)
Claims vested tokens from a bond:
Calculates claimable amount based on vesting schedule
Transfers available tokens to user
Returns total amount redeemed
bondPrice(uint256 id_)
Returns current price for a specific market
isLive(uint256 id_)
Checks if a market is active
calculateLinearPayout(address user, uint256 _bondId)
Calculates currently claimable amount for a specific bond
The bond price is determined by:
Formula:
The CV can be adjusted over time using the adjustment mechanism to target specific price levels.
Creating a New Market
Depositing Into a Bond
Redeeming Vested Tokens
Security Considerations
Slippage Protection
Users should verify expected output before depositing
Price can change between blocks
Token Approvals
Only approve exact amounts needed
Revoke approvals after use
Market Parameters
Verify control variables are reasonable
Check minimum price aligns with expectations
ContractPaused(address indexed by)
ContractUnpaused(address indexed by)
newBondCreated(uint256 indexed id, address indexed payoutToken, address indexed quoteToken, uint256 initialPrice)
BondEnded(uint256 indexed id)
BondDeposited(address indexed user, uint256 indexed marketId, uint256 depositAmount, uint256 totalOwed, uint256 bondPrice)
QuoteTokensWithdrawn(uint256 indexed marketId, address indexed auctioneer, uint256 amount, uint256 daoFee)
Error Conditions
The contract will revert if:
Market is closed or expired
Deposit amount too low/high
Invalid parameters provided
Always check isLive() before depositing
Monitor debt ratio to understand pricing
Verify market parameters before participation
Use view functions to simulate outcomes
Consider gas costs during high network usage