Auction contract
/**
* @dev
* This function is used to create a new auction request. The auction can be for buying or selling tokens.
*
* @param _requestId The unique identifier for the auction request.
* @param _targetchainId The ID of the target chain, which must match the current chain ID.
* @param _trader The address of the trader initiating the auction.
* @param _tokenAddress The address of the token.
* @param _stableCoinAddress The address of the stable coin.
* @param _stableCoinAmount If it's a buy auction, this is the amount of stable coins to be purchased; if it's a sell auction, this is the minimum amount of stable coins to be received.
* @param _tokenAmount If it's a buy auction, this is the minimum amount of tokens to be received; if it's a sell auction, this is the amount of tokens to be sold.
* @param _startPrice If it's a buy auction, this is the minimum buy price; if it's a sell auction, this is the maximum sell price.
* @param _endPrice If it's a buy auction, this is the maximum buy price; if it's a sell auction, this is the minimum sell price.
* @param _duration The duration of the auction in seconds.
* @param _isBuy Indicates whether this is a buy auction or a sell auction.
*
* @notice This function can only be called by users with the TRADER_ROLE.
* @notice An AuctionCreated event will be triggered after the auction is created.
*/
function createAuction(
uint256 _requestId,
uint256 _targetchainId,
address _trader,
address _tokenAddress,
address _stableCoinAddress,
uint256 _stableCoinAmount,
uint256 _tokenAmount,
uint256 _startPrice,
uint256 _endPrice,
uint256 _duration,
bool _isBuy
)
public
onlyRole(TRADER_ROLE)
{
}
/**
* @dev Cancels an active auction.
*
* @param _requestId The unique identifier for the auction request.
*
* @notice This function can only be called by the auction creator or the contract owner.
*/
function cancelAuction(uint256 _requestId) public onlyRole(TRADER_ROLE){
}
/**
* @dev
* This function is used to proxy a buy auction. The auction must be active and must be a buy auction.
*
* @param _requestId The unique identifier for the auction request.
*
* @notice This function can only be called by users with the TRADER_ROLE.
* @notice An AuctionEnded event will be triggered after the auction is ended.
*/
function proxyBuy(uint256 _requestId) public {
}
/**
* @dev
* This function is used to proxy a sell auction. The auction must be active and must be a sell auction.
*
* @param _requestId The unique identifier for the auction request.
*
* @notice This function can only be called by users with the TRADER_ROLE.
* @notice An AuctionEnded event will be triggered after the auction is ended.
*/
function proxySell(uint256 _requestId) public {
}
/**
* @dev
* This function is used to get the current price of the auction.
*
* @param auction The auction to get the current price of.
* @return The current price of the auction.
*/
function getCurrentPrice(TradeRequest storage auction) internal view returns (uint256) {
}
/**
* @dev
* This function is used to add a new stable coin to the supported stable coins.
*
* @param token The address of the stable coin to add.
*
* @notice This function can only be called by users with the DEFAULT_ADMIN_ROLE.
* @notice A StableCoinAdded event will be triggered after the stable coin is added.
*/
function addStableCoin(address token) public onlyRole(DEFAULT_ADMIN_ROLE) {
}
/**
* @dev
* This function is used to remove a stable coin from the supported stable coins.
*
* @param token The address of the stable coin to remove.
*
* @notice This function can only be called by users with the DEFAULT_ADMIN_ROLE.
* @notice A StableCoinRemoved event will be triggered after the stable coin is removed.
*/
function removeStableCoin(address token) public onlyRole(DEFAULT_ADMIN_ROLE) {
}
/**
* @dev Sets the precision factor.
* @param _precisionFactor The new precision factor.
*/
function setPrecisionFactor(uint8 _precisionFactor) public onlyRole(DEFAULT_ADMIN_ROLE) {
}
/**
* @dev
* This function is used to retrieve auctions based on user and active status with optional pagination.
*
* @param user The address of the user whose auctions are to be retrieved. Use address(0) to ignore user filter.
* @param isActive Boolean indicating whether to retrieve active (true) or inactive (false) auctions.
* @param pageSize The number of auctions per page. Set to 0 to return all auctions.
* @param page The page number to retrieve, starting from 0. Ignored if pageSize is 0.
* @return Returns an array of TradeRequest containing auctions filtered by the specified criteria and pagination.
*/
function getFilteredAuctions(address user, bool isActive, uint256 pageSize, uint256 page) public view returns (TradeRequest[] memory) {
}
/**
* @dev
* Retrieves detailed information of an auction using the auction ID.
*
* @param requestId The unique identifier of the auction.
* @return Returns detailed information of the auction with the specified ID.
*/
function getAuctionDetails(uint256 requestId) public view returns (TradeRequest memory) {
}
/**
* @dev Retrieves the target chain ID of a specific auction.
* @param requestId The unique identifier of the auction.
* @return The target chain ID of the auction.
*/
function getAuctionTargetChainId(uint256 requestId) public view returns (uint256) {
}
/**
* @dev Retrieves the trader address of a specific auction.
* @param requestId The unique identifier of the auction.
* @return The trader address of the auction.
*/
function getAuctionTrader(uint256 requestId) public view returns (address) {
}
/**
* @dev Retrieves the token address of a specific auction.
* @param requestId The unique identifier of the auction.
* @return The token address of the auction.
*/
function getAuctionTokenAddress(uint256 requestId) public view returns (address) {
}
/**
* @dev Retrieves the stable coin address of a specific auction.
* @param requestId The unique identifier of the auction.
* @return The stable coin address of the auction.
*/
function getAuctionStableCoinAddress(uint256 requestId) public view returns (address) {
}
/**
* @dev Retrieves the stable coin amount of a specific auction.
* @param requestId The unique identifier of the auction.
* @return The stable coin amount of the auction.
*/
function getAuctionStableCoinAmount(uint256 requestId) public view returns (uint256) {
}
/**
* @dev Retrieves the token amount of a specific auction.
* @param requestId The unique identifier of the auction.
* @return The token amount of the auction.
*/
function getAuctionTokenAmount(uint256 requestId) public view returns (uint256) {
}
/**
* @dev Retrieves the start price of a specific auction.
* @param requestId The unique identifier of the auction.
* @return The start price of the auction.
*/
function getAuctionStartPrice(uint256 requestId) public view returns (uint256) {
}
/**
* @dev Retrieves the end price of a specific auction.
* @param requestId The unique identifier of the auction.
* @return The end price of the auction.
*/
function getAuctionEndPrice(uint256 requestId) public view returns (uint256) {
}
/**
* @dev Retrieves the start time of a specific auction.
* @param requestId The unique identifier of the auction.
* @return The start time of the auction.
*/
function getAuctionStartTime(uint256 requestId) public view returns (uint256) {
}
/**
* @dev Retrieves the end time of a specific auction.
* @param requestId The unique identifier of the auction.
* @return The end time of the auction.
*/
function getAuctionEndTime(uint256 requestId) public view returns (uint256) {
}
/**
* @dev Retrieves the buy status of a specific auction.
* @param requestId The unique identifier of the auction.
* @return True if the auction is a buy auction, false otherwise.
*/
function getAuctionIsBuy(uint256 requestId) public view returns (bool) {
}
/**
* @dev Retrieves the active status of a specific auction.
* @param requestId The unique identifier of the auction.
* @return True if the auction is active, false otherwise.
*/
function getAuctionIsActive(uint256 requestId) public view returns (bool) {
}
Last updated