// SPDX-License-Identifier: BlueOak-1.0.0
pragma solidity 0.8.17;
import "./IAsset.sol";
import "./IComponent.sol";
import "./IGnosis.sol";
import "./ITrade.sol";
/// The data format that describes a request for trade with the Broker
struct TradeRequest {
IAsset sell;
IAsset buy;
uint256 sellAmount; // {qSellTok}
uint256 minBuyAmount; // {qBuyTok}
}
/**
* @title IBroker
* @notice The Broker deploys oneshot Trade contracts for Traders and monitors
* the continued proper functioning of trading platforms.
*/
interface IBroker is IComponent {
event GnosisSet(IGnosis indexed oldVal, IGnosis indexed newVal);
event TradeImplementationSet(ITrade indexed oldVal, ITrade indexed newVal);
event AuctionLengthSet(uint48 indexed oldVal, uint48 indexed newVal);
event DisabledSet(bool indexed prevVal, bool indexed newVal);
// Initialization
function init(
IMain main_,
IGnosis gnosis_,
ITrade tradeImplementation_,
uint48 auctionLength_
) external;
/// Request a trade from the broker
/// @dev Requires setting an allowance in advance
/// @custom:interaction
function openTrade(TradeRequest memory req) external returns (ITrade);
/// Only callable by one of the trading contracts the broker deploys
function reportViolation() external;
function disabled() external view returns (bool);
}
interface TestIBroker is IBroker {
function gnosis() external view returns (IGnosis);
function tradeImplementation() external view returns (ITrade);
function auctionLength() external view returns (uint48);
function setGnosis(IGnosis newGnosis) external;
function setTradeImplementation(ITrade newTradeImplementation) external;
function setAuctionLength(uint48 newAuctionLength) external;
function setDisabled(bool disabled_) external;
}
|