Created
June 24, 2024 04:36
-
-
Save sambacha/36587ddf401d29a0816e4291ae2d72be to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: UPL-1.0 | |
pragma solidity ^0.8.20; | |
interface MyInterface { | |
/// Errors related to the state of an auction. | |
/// @param slot The unique identifier for the auction. | |
error AuctionAlreadyOpen(uint256 slot); | |
/// Errors related to the state of an auction. | |
/// @param slot The unique identifier for the auction. | |
error AuctionAlreadySettled(uint256 slot); | |
/// Errors related to the state of an auction. | |
/// @param slot The unique identifier for the auction. | |
error AuctionNotClosed(uint256 slot); | |
/// Errors related to the state of an auction. | |
/// @param slot The unique identifier for the auction. | |
error AuctionNotOpen(uint256 slot); | |
error BidderAlreadyExists(address bidder); | |
error BidderNotRegistered(address bidder); | |
error InsufficientFunds(); | |
error InvalidBidItems(); | |
error InvalidId(); | |
error Unauthorized(); | |
event Approval(address indexed owner, address indexed spender, uint256 indexed id, uint256 amount); | |
/// Emitted when a new auction is opened. | |
/// @param slot The unique identifier for the auction. | |
/// @param itemsForSale The number of items available for sale in the auction. | |
event AuctionOpened(uint256 indexed slot, uint120 itemsForSale); | |
/// Emitted when an auction is paid out. | |
/// @param slot The unique identifier for the auction. | |
event AuctionPaidOut(uint256 indexed slot); | |
/// Emitted when an auction is refunded. | |
/// @param slot The unique identifier for the auction. | |
event AuctionRefund(uint256 indexed slot); | |
/// Emitted when an auction is settled. | |
/// @param slot The unique identifier for the auction. | |
event AuctionSettled(uint256 indexed slot); | |
/// Emitted when a new bidder is added to the auction. | |
/// @param bidder The address of the new bidder. | |
/// @param bidderId The unique identifier assigned to the new bidder. | |
event BidderAdded(address indexed bidder, uint8 indexed bidderId); | |
/// Emitted when a bidder is removed from the auction. | |
/// @param bidder The address of the removed bidder. | |
/// @param bidderId The unique identifier of the removed bidder. | |
event BidderRemoved(address indexed bidder, uint8 indexed bidderId); | |
/// Emitted when an operator is set or unset for an owner. | |
/// @param owner The address of the owner. | |
/// @param operator The address of the operator. | |
/// @param approved True if the operator is approved, false otherwise. | |
event OperatorSet( | |
address indexed owner, | |
address indexed operator, | |
bool approved | |
); | |
/// Emitted when an operator is updated. | |
/// @param oldOperator The address of the old operator. | |
/// @param newOperator The address of the new operator. | |
event OperatorUpdated( | |
address indexed oldOperator, | |
address indexed newOperator | |
); | |
/// Emitted when ownership transfer is started. | |
/// @param previousOwner The address of the previous owner. | |
/// @param newOwner The address of the new owner. | |
event OwnershipTransferStarted( | |
address indexed previousOwner, | |
address indexed newOwner | |
); | |
/// Emitted when ownership is transferred. | |
/// @param user The address of the user. | |
/// @param newOwner The address of the new owner. | |
event OwnershipTransferred(address indexed user, address indexed newOwner); | |
event Transfer(address caller, address indexed from, address indexed to, uint256 indexed id, uint256 amount); | |
function IdMap(address bidder) external view returns (uint8 id); | |
function WETH9() external view returns (address); | |
function acceptOwnership() external; | |
function accountant() external view returns (address); | |
function allowance(address, address, uint256) external view returns (uint256); | |
function approve(address spender, uint256 id, uint256 amount) external returns (bool); | |
function auctions(uint256 slot) | |
external | |
view | |
returns (uint120 itemsForSale, bool isOpen, bool isSettled, bool isPaidOut, bool isRefunded); | |
function balanceOf(address, uint256) external view returns (uint256); | |
/** | |
* Allows a bidder to place a bid on an auction. | |
* @param slot The unique identifier for the auction. | |
* @param packedBids An array of packed bid values, where each bid is represented as a 256-bit integer. | |
*/ | |
function bid(uint256 slot, uint256[] memory packedBids) external; | |
/// Returns the number of bids placed in the given auction slot. | |
/// @param slot The unique identifier for the auction. | |
/// @return count The number of bids placed in the auction. | |
function bidCount(uint256 slot) external view returns (uint256 count); | |
/// Returns the address of the bidder with the given ID. | |
/// @param id The ID of the bidder. | |
/// @return bidder The address of the bidder. | |
function bidderMap(uint8 id) external view returns (address bidder); | |
function calcAverageBid( | |
uint256 numAuctions | |
) external view returns (uint128 avBidPrice); | |
function changeOperator(address newOperator) external; | |
function getBidderInfo( | |
uint256 slot, | |
address bidder | |
) external view returns (uint120 itemsBought, uint128 amountOwed); | |
/** | |
* Checks if the given address is an approved operator for the caller. | |
* @param owner The address of the owner. | |
* @param operator The address of the operator to check. | |
* @return True if the operator is approved, false otherwise. | |
*/ | |
function isOperator( | |
address owner, | |
address operator | |
) external view returns (bool); | |
/** | |
* Returns the maximum number of bidders allowed in the auction. | |
* @return The maximum number of bidders. | |
*/ | |
function maxBidder() external view returns (uint8); | |
/** | |
* Returns the maximum number of bids allowed per auction. | |
* @return The maximum number of bids. | |
*/ | |
function maxBids() external view returns (uint256); | |
/** | |
* Returns the minimum amount of gas required for a bid to be accepted. | |
* @return The minimum gas amount. | |
*/ | |
function minGasAmount() external view returns (uint120); | |
/** | |
* Adds a new bidder to the auction. | |
* @param additionalBidder The address of the new bidder to add. | |
* @return newId The new bidder ID. | |
*/ | |
function newBidder(address additionalBidder) external returns (uint8 newId); | |
/// Opens a new auction with the specified number of items for sale. | |
/// @param slot The unique identifier for the auction. | |
/// @param itemsForSale The number of items being auctioned. | |
function openAuction(uint256 slot, uint120 itemsForSale) external; | |
function operator() external view returns (address); | |
function owner() external view returns (address); | |
function payout(uint256 slot) external; | |
function pendingOwner() external view returns (address); | |
/** | |
* Refunds the specified auction slot. | |
* @param slot The unique identifier for the auction to be refunded. | |
*/ | |
function refund(uint256 slot) external; | |
function removeBidder(uint8 bidderId) external; | |
function runAndSettle(uint256 slot) external; | |
function setOperator( | |
address operator, | |
bool approved | |
) external returns (bool); | |
function slotsAuctioned(uint256 index) external view returns (uint256 slot); | |
function slotsCount() external view returns (uint256); | |
function supportsInterface(bytes4 interfaceId) external view returns (bool); | |
function transfer(address receiver, uint256 id, uint256 amount) external returns (bool); | |
function transferFrom(address sender, address receiver, uint256 id, uint256 amount) external returns (bool); | |
function transferOwnership(address newOwner) external; | |
function updateAccountant(address newAccountant) external; | |
/** | |
* Packs a bid into a single 256-bit value. | |
* @param bidPrice The price of the bid. | |
* @param itemsToBuy The number of items the bidder wants to buy. | |
* @param bidderId The ID of the bidder. | |
* @return packedBid The packed bid value. | |
*/ | |
function packBid( | |
uint128 bidPrice, | |
uint120 itemsToBuy, | |
uint8 bidderId | |
) external pure returns (uint256 packedBid); | |
function updateMaxBids(uint256 newMaxBids) external; | |
function updateMinGasAmount(uint120 newAmount) external; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment