change nft distributor, change method for user call
This commit is contained in:
parent
06ca2f1c9c
commit
a7cd708678
@ -71,18 +71,10 @@ contract NftDistributor is AccessControlEnumerable {
|
|||||||
emit OpenStatusChange(_open);
|
emit OpenStatusChange(_open);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
function mintNft(uint256 count) external {
|
||||||
* @dev The mintToUser function mints NFTs to a given user.
|
|
||||||
*
|
|
||||||
* Only functions called by an address with the MANAGE_ROLE permission can access this function.
|
|
||||||
* The function takes an array of nftIds and checks that there are enough mintable NFTs for the user.
|
|
||||||
* It then loops through the user's owned NFTs, checking if each is mintable, and if so, adds it to a list to be minted.
|
|
||||||
* Then it emits the Minted event with details of the operation.
|
|
||||||
*
|
|
||||||
* @param _user - The address of the user receiving the NFTs
|
|
||||||
*/
|
|
||||||
function mintToUser(address _user, uint256 count) external onlyManager {
|
|
||||||
require(isOpen, "NFT distributor is not open");
|
require(isOpen, "NFT distributor is not open");
|
||||||
|
require(count > 0, "Count is zero");
|
||||||
|
address _user = _msgSender();
|
||||||
// Check that there are enough mintable NFTs
|
// Check that there are enough mintable NFTs
|
||||||
require(count <= getMintableCount(_user), "Mintable count is not enough");
|
require(count <= getMintableCount(_user), "Mintable count is not enough");
|
||||||
// Get the array of the user's owned NFTs
|
// Get the array of the user's owned NFTs
|
||||||
|
Loading…
x
Reference in New Issue
Block a user