86 lines
2.5 KiB
Solidity
86 lines
2.5 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.8.20;
|
|
|
|
interface IBondDepository {
|
|
error DepositoryConcluded(uint48 concludedTime);
|
|
error DepositoryMaxPrice(uint256 price, uint256 maxPrice);
|
|
error DepositoryMaxSize(uint256 payout, uint256 maxPayout);
|
|
error NotGuardianOrPolicy();
|
|
|
|
event MarketClosed(uint256 indexed id);
|
|
event Bond(uint256 indexed id, uint256 amount, uint256 price);
|
|
event Tuned(uint256 indexed id, uint64 oldControlVariable, uint64 newControlVariable);
|
|
event MarketCreated(
|
|
uint256 indexed id,
|
|
address indexed quoteToken,
|
|
uint256 initialPrice
|
|
);
|
|
|
|
struct Market {
|
|
uint256 capacity;
|
|
address quoteToken;
|
|
bool capacityInQuote;
|
|
uint64 totalDebt;
|
|
uint64 maxPayout;
|
|
uint64 sold;
|
|
uint256 purchased;
|
|
}
|
|
|
|
struct Term {
|
|
bool fixedTerm;
|
|
uint64 controlVariable;
|
|
uint48 vesting;
|
|
uint48 conclusion;
|
|
uint64 maxDebt;
|
|
}
|
|
|
|
struct Metadata {
|
|
uint48 lastTune;
|
|
uint48 lastDecay;
|
|
uint48 length;
|
|
uint48 depositInterval;
|
|
uint48 tuneInterval;
|
|
uint8 quoteDecimals;
|
|
}
|
|
|
|
struct Adjustment {
|
|
uint64 change;
|
|
uint48 lastAdjustment;
|
|
uint48 timeToAdjusted;
|
|
bool active;
|
|
}
|
|
|
|
function deposit(
|
|
uint256 _bid,
|
|
uint256 _amount,
|
|
uint256 _maxPrice,
|
|
address _user
|
|
)
|
|
external
|
|
payable
|
|
returns (
|
|
uint256 payout_,
|
|
uint256 expiry_,
|
|
uint256 index_
|
|
);
|
|
|
|
function create(
|
|
uint256[3] memory _market,
|
|
uint256[2] memory _terms,
|
|
address _quoteToken,
|
|
uint32[2] memory _intervals,
|
|
bool[2] memory _booleans
|
|
) external returns (uint256 id_);
|
|
|
|
function close(uint256 _id) external;
|
|
function isLive(uint256 _bid) external view returns (bool);
|
|
function liveMarkets() external view returns (uint256[] memory);
|
|
function liveMarketsFor(address _quoteToken) external view returns (uint256[] memory);
|
|
function payoutFor(uint256 _amount, uint256 _bid) external view returns (uint256);
|
|
function marketPrice(uint256 _bid) external view returns (uint256);
|
|
function currentDebt(uint256 _bid) external view returns (uint256);
|
|
function debtRatio(uint256 _bid) external view returns (uint256);
|
|
function debtDecay(uint256 _bid) external view returns (uint64);
|
|
function currentControlVariable(uint256 _id) external view returns (uint256);
|
|
}
|