更新market一些检查逻辑
This commit is contained in:
parent
7453ceeef4
commit
4d078f62cc
@ -111,7 +111,7 @@ contract BENftMarket is Ownable, ReentrancyGuard, ERC1155Holder, ERC721Holder {
|
||||
"NFTMarket: Maximum price limit exceeded"
|
||||
);
|
||||
require(
|
||||
price >= nftPriceMinLimit[nftToken] && price != 0,
|
||||
price >= nftPriceMinLimit[nftToken],
|
||||
"NFTMarket: Below the minimum price limit"
|
||||
);
|
||||
incrId += 1;
|
||||
@ -148,6 +148,7 @@ contract BENftMarket is Ownable, ReentrancyGuard, ERC1155Holder, ERC721Holder {
|
||||
}
|
||||
|
||||
function buy(uint256 orderId, uint256 price) external nonReentrant {
|
||||
require(orderId > 0 && orderId <= incrId, "NFTMarket: orderId error");
|
||||
OrderInfo memory orderInfo = orderInfos[orderId];
|
||||
require(orderInfo.orderId != 0, "NFTMarket: order info does not exist");
|
||||
require(orderInfo.price == price, "NFTMarket: Price error");
|
||||
@ -217,11 +218,10 @@ contract BENftMarket is Ownable, ReentrancyGuard, ERC1155Holder, ERC721Holder {
|
||||
}
|
||||
|
||||
function cancelOrder(uint256 orderId) external nonReentrant {
|
||||
require(
|
||||
orderInfos[orderId].owner == _msgSender(),
|
||||
"NFTMarket: cancel caller is not owner"
|
||||
);
|
||||
require(orderId > 0 && orderId <= incrId, "NFTMarket: orderId error");
|
||||
OrderInfo memory orderInfo = orderInfos[orderId];
|
||||
require(orderInfo.orderId != 0, "NFTMarket: NFT does not exist");
|
||||
require(orderInfo.owner == _msgSender(), "NFTMarket: caller is not owner");
|
||||
if (
|
||||
erc721Supported[orderInfo.nftToken] ||
|
||||
erc721SupportedHistory[orderInfo.nftToken]
|
||||
@ -249,8 +249,9 @@ contract BENftMarket is Ownable, ReentrancyGuard, ERC1155Holder, ERC721Holder {
|
||||
}
|
||||
|
||||
function updatePrice(uint256 orderId, uint256 price) external {
|
||||
require(orderId > 0 && orderId <= incrId, "NFTMarket: orderId error");
|
||||
OrderInfo storage orderInfo = orderInfos[orderId];
|
||||
require(orderInfo.tokenId != 0, "NFTMarket: NFT does not exist");
|
||||
require(orderInfo.orderId != 0, "NFTMarket: NFT does not exist");
|
||||
require(orderInfo.owner == _msgSender(), "NFTMarket: caller is not owner");
|
||||
require(
|
||||
price <= nftPriceMaxLimit[orderInfo.nftToken] ||
|
||||
@ -258,7 +259,7 @@ contract BENftMarket is Ownable, ReentrancyGuard, ERC1155Holder, ERC721Holder {
|
||||
"NFTMarket: Maximum price limit exceeded"
|
||||
);
|
||||
require(
|
||||
price >= nftPriceMinLimit[orderInfo.nftToken] && price != 0,
|
||||
price >= nftPriceMinLimit[orderInfo.nftToken],
|
||||
"NFTMarket: Below the minimum price limit"
|
||||
);
|
||||
uint256 priceOld = orderInfo.price;
|
||||
|
Loading…
x
Reference in New Issue
Block a user