IMarketPlace

Git Source

Functions

initialize

Initializes the MarketPlace, setting the WCSB contract address.

function initialize(address wcsb_, address mira_, address admin) external;

Parameters

NameTypeDescription
wcsb_addressThe address of WCSB contract.
mira_addressThe address of MIRA contract.
adminaddressThe address of the contract admin.

pause

Pauses interaction with the contract. Requirements:

  • The caller must have the ADMIN_ROLE.
function pause() external;

unpause

Resumes interaction with the contract. Requirements:

  • The caller must have the ADMIN_ROLE.
function unpause() external;

ask

Creates an ask order for an NFT. Emits the AskCreated event.

function ask(address nftAddress, uint256 tokenId, address payToken, uint256 price, uint256 deadline)
    external
    returns (uint256 orderId);

Parameters

NameTypeDescription
nftAddressaddressThe contract address of the NFT.
tokenIduint256The token id of the NFT to be sold.
payTokenaddressThe ERC20 token address for buyers to pay.
priceuint256The sale price for the NFT.
deadlineuint256The expiration timestamp of the ask order.

Returns

NameTypeDescription
orderIduint256The id of the new generated ask order.

updateAsk

Updates an ask order. Emits the AskUpdated event.

function updateAsk(uint256 orderId, address payToken, uint256 price, uint256 deadline) external;

Parameters

NameTypeDescription
orderIduint256The id of the ask order to be updated.
payTokenaddressThe ERC20 token address for buyers to pay.
priceuint256The new sale price for the NFT.
deadlineuint256The new expiration timestamp of the ask order.

cancelAsk

Cancels an ask order. Emits the AskCanceled event.

function cancelAsk(uint256 orderId) external;

Parameters

NameTypeDescription
orderIduint256The id of the ask order to be canceled.

acceptAsk

Accepts an ask order. Emits the OrdersMatched event.

The amount of CSB to send must be specified in the msg.value.

function acceptAsk(uint256 orderId) external payable;

Parameters

NameTypeDescription
orderIduint256The id of the ask order to be accepted.

bid

Creates a bid order for an NFT. Emits the BidCreated event.

function bid(address nftAddress, uint256 tokenId, address payToken, uint256 price, uint256 deadline)
    external
    returns (uint256 orderId);

Parameters

NameTypeDescription
nftAddressaddressThe contract address of the NFT.
tokenIduint256The token id of the NFT to bid.
payTokenaddressThe ERC20 token address for buyers to pay.
priceuint256The bid price for the NFT.
deadlineuint256The expiration timestamp of the bid order.

Returns

NameTypeDescription
orderIduint256The id of the new generated bid order.

cancelBid

Cancels a bid order. Emits the BidCanceled event.

function cancelBid(uint256 orderId) external;

Parameters

NameTypeDescription
orderIduint256The id of the bid order to be canceled.

updateBid

Updates a bid order. Emits the BidUpdated event.

function updateBid(uint256 orderId, address payToken, uint256 price, uint256 deadline) external;

Parameters

NameTypeDescription
orderIduint256The id of the bid order to be updated.
payTokenaddressThe ERC20 token address for buyers to pay.
priceuint256The new bid price for the NFT.
deadlineuint256The new expiration timestamp of the ask order.

acceptBid

Accepts a bid order. Emits the OrdersMatched event.

function acceptBid(uint256 orderId) external;

Parameters

NameTypeDescription
orderIduint256The id of the bid order to be accepted.

getAskOrder

Gets the detail info of an ask order.

function getAskOrder(uint256 orderId) external view returns (DataTypes.Order memory);

Parameters

NameTypeDescription
orderIduint256The id of the ask order to query.

getBidOrder

Gets the detail info of a bid order.

function getBidOrder(uint256 orderId) external view returns (DataTypes.Order memory);

Parameters

NameTypeDescription
orderIduint256The id of the bid order to query.

getAskOrderId

Gets ID of an ask order .

function getAskOrderId(address nftAddress, uint256 tokenId, address owner) external view returns (uint256 orderId);

Parameters

NameTypeDescription
nftAddressaddressThe contract address of the NFT.
tokenIduint256The token id of the NFT to be sold.
owneraddressThe owner who creates the order.

getBidOrderId

Gets ID of a bid order.

function getBidOrderId(address nftAddress, uint256 tokenId, address owner) external view returns (uint256 orderId);

Parameters

NameTypeDescription
nftAddressaddressThe contract address of the NFT.
tokenIduint256The token id of the NFT to bid.
owneraddressThe owner who creates the order.

wcsb

Returns the address of WCSB contract.

function wcsb() external view returns (address);

Returns

NameTypeDescription
<none>addressThe address of WCSB contract.

mira

Returns the address of MIRA contract.

function mira() external view returns (address);

Returns

NameTypeDescription
<none>addressThe address of MIRA contract.