增加已上架nft修改价格的功能

This commit is contained in:
cebgcontract 2022-12-22 15:47:29 +08:00
parent 5e741e0baa
commit e5407165f8
3 changed files with 9815 additions and 7448 deletions

File diff suppressed because one or more lines are too long

View File

@ -3235,7 +3235,7 @@
}
},
"schemaVersion": "3.4.9",
"updatedAt": "2022-12-20T11:14:12.108Z",
"updatedAt": "2022-12-22T07:28:03.415Z",
"networkType": "ethereum",
"devdoc": {
"kind": "dev",

View File

@ -43,6 +43,14 @@ contract BENFTMarket is Ownable, ReentrancyGuard {
uint256 indexed tokenId
);
event PriceUpdate(
uint256 indexed orderId,
address indexed nftToken,
uint256 indexed tokenId,
uint256 priceOld,
uint256 price
);
event BuyOrder(
uint256 indexed tokenId,
uint256 orderId,
@ -191,6 +199,23 @@ contract BENFTMarket is Ownable, ReentrancyGuard {
emit CancelOrder(orderId, orderInfo.nftToken, orderInfo.tokenId);
}
function updatePrice(uint256 orderId, uint256 price) external {
OrderInfo memory orderInfo = orderInfos[orderId];
require(orderInfo.tokenId != 0, "NFTMarket: NFT does not exist");
require(orderInfo.owner == msg.sender, "NFTMarket: caller is not owner");
require(
price <= nftPriceMaxLimit[orderInfo.nftToken] || nftPriceMaxLimit[orderInfo.nftToken] == 0,
"NFTMarket: Maximum price limit exceeded"
);
require(
price >= nftPriceMinLimit[orderInfo.nftToken] && price != 0,
"NFTMarket: Below the minimum price limit"
);
uint256 priceOld = orderInfo.price;
orderInfo.price = price;
emit PriceUpdate(orderId, orderInfo.nftToken, orderInfo.tokenId, priceOld, price);
}
function addERC721Support(address nftToken) external onlyOwner {
erc721Supported[nftToken] = true;
emit AddNFTSuppout(nftToken);