增加已上架nft修改价格的功能
This commit is contained in:
parent
5e741e0baa
commit
e5407165f8
File diff suppressed because one or more lines are too long
@ -3235,7 +3235,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"schemaVersion": "3.4.9",
|
"schemaVersion": "3.4.9",
|
||||||
"updatedAt": "2022-12-20T11:14:12.108Z",
|
"updatedAt": "2022-12-22T07:28:03.415Z",
|
||||||
"networkType": "ethereum",
|
"networkType": "ethereum",
|
||||||
"devdoc": {
|
"devdoc": {
|
||||||
"kind": "dev",
|
"kind": "dev",
|
||||||
|
@ -43,6 +43,14 @@ contract BENFTMarket is Ownable, ReentrancyGuard {
|
|||||||
uint256 indexed tokenId
|
uint256 indexed tokenId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
event PriceUpdate(
|
||||||
|
uint256 indexed orderId,
|
||||||
|
address indexed nftToken,
|
||||||
|
uint256 indexed tokenId,
|
||||||
|
uint256 priceOld,
|
||||||
|
uint256 price
|
||||||
|
);
|
||||||
|
|
||||||
event BuyOrder(
|
event BuyOrder(
|
||||||
uint256 indexed tokenId,
|
uint256 indexed tokenId,
|
||||||
uint256 orderId,
|
uint256 orderId,
|
||||||
@ -191,6 +199,23 @@ contract BENFTMarket is Ownable, ReentrancyGuard {
|
|||||||
emit CancelOrder(orderId, orderInfo.nftToken, orderInfo.tokenId);
|
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 {
|
function addERC721Support(address nftToken) external onlyOwner {
|
||||||
erc721Supported[nftToken] = true;
|
erc721Supported[nftToken] = true;
|
||||||
emit AddNFTSuppout(nftToken);
|
emit AddNFTSuppout(nftToken);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user