Hub Contracts

Interfaces for contracts deployed on the clearing chain.

/**
 * @title IAuctioneer
 * @notice Interface for the Auctioneer contract
 */
interface IAuctioneer {
  /*//////////////////////////////////////////////////////////////
                                STRUCTS
    //////////////////////////////////////////////////////////////*/

  /**
   * @notice Struct representing the fees for an intent
   * @param routerFee The fee of the router
   * @param protocolFees The protocol fees when the auction is created
   * @param totalProtocolFee The total sum of the protocol fees for the token
   * @dev when routers call to execute they should submit the total fee = routerFee + totalProtocolFee
   */
  struct IntentFee {
    uint24 routerFee;
    IHubStorage.Fee[] protocolFees;
    uint24 totalProtocolFee;
  }

  /**
   * @notice Struct for an auction
   * @dev endTime is equal to the block.timestamp + auctionDuration at the moment of creation
   * since auctionDuration can change due to protocol changes we must save the end time at the moment of creation
   * @param winnerRouter Router address of the winning bid
   * @param lowestFee The lowest intent fee in the auction
   * @param endTime End time of the auction
   */
  struct Auction {
    address winnerRouter;
    IntentFee lowestFee;
    uint256 endTime;
  }

  /*//////////////////////////////////////////////////////////////
                                EVENTS
    //////////////////////////////////////////////////////////////*/

  /**
   * @notice Emitted when a new auction is started when receiving the first bid
   * @param _origin Origin chain ID
   * @param _intentId Intent ID
   * @param _endTime End time of the auction
   */
  event AuctionStarted(uint32 indexed _origin, bytes32 indexed _intentId, uint256 _endTime);

  /**
   * @notice Emitted when a new winning bid is placed
   * @param _intentId Intent ID
   * @param _router Router address of the winning bid
   * @param _fee The fee of the winning bid
   */
  event Bid(bytes32 indexed _intentId, address indexed _router, uint24 _fee);

  /*//////////////////////////////////////////////////////////////
                                ERRORS
    //////////////////////////////////////////////////////////////*/

  /**
   * @notice Error emitted when the bid fee exceeds the maximum fee
   */
  error Auctioneer_Bid_MaxFeeExceeded(uint24 _fee);

  /**
   * @notice Error emitted when the router is not whitelisted
   */
  error Auctioneer_Bid_RouterNotWhitelisted(address _router);

  /**
   * @notice Error emitted when the auction is over
   */
  error Auctioneer_Bid_AuctionIsOver();

  /**
   * @notice Error emitted when trying to get the auction winner and the auction is not over
   */
  error Auctioneer_AuctionWinner_AuctionNotOver(uint256 _endTime);

  /**
   * @notice Error emitted when trying to get the auction winner and the auction is not created
   */
  error Auctioneer_AuctionWinner_AuctionNotExists(bytes32 _intentId);

  /**
   * @notice Error emitted when the bid is not the lowest
   */
  error Auctioneer_Bid_BidIsNotLowest(uint24 _fee, uint256 _lowestFee);

  /**
   * @notice Error emitted when bidding with the lightweight bid and the auction is not created
   */
  error Auctioneer_Bid_AuctionNotCreated(bytes32 _intentId);

  /*//////////////////////////////////////////////////////////////
                            EXTERNAL FUNCTIONS
    //////////////////////////////////////////////////////////////*/

  /**
   * @notice Bid on an intent
   * @dev if the Auction is not already created for the intent, it creates a new one
   * @param _intent The intent object
   * @param _routerFee The router fee
   */
  function bid(IConnext.Intent calldata _intent, uint24 _routerFee) external;

  /**
   * @notice Lightweight method to bid on an intent when the auction is already created
   * @param _intentId The intent ID
   * @param _routerFee The bid fee
   */
  function bid(bytes32 _intentId, uint24 _routerFee) external;

  /*//////////////////////////////////////////////////////////////
                            VIEW FUNCTIONS
    //////////////////////////////////////////////////////////////*/

  /**
   * @notice Get the manager address
   */
  function hub() external view returns (address _manager);

  /**
   * @notice Get the auction for an intent
   * @param _intentId Intent ID
   */
  function auctions(bytes32 _intentId) external view returns (Auction memory _auction);

  /**
   * @notice Get the winner of an auction
   * @dev reverts if the auction is not over
   * @param _intentId Intent ID
   * @return _winnerRouter The router address of the winner
   * @return _fee The fee of the winner
   */
  function auctionWinner(bytes32 _intentId) external view returns (address _winnerRouter, uint24 _fee);
}
/**

Last updated