all files / interfaces/ IBroker.sol

100% Statements 0/0
100% Branches 0/0
100% Functions 0/0
100% Lines 0/0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62                                                                                                                           
// 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;
}