Skip to content

Commit

Permalink
bulk mint & uri update added (#37)
Browse files Browse the repository at this point in the history
This is to move some parts of our metadata storage to another AWS S3 account

* uri param added in safeMintAppNFT

* test file updated

* EIP4906 MetadataUpdate event added

* fees for mint integration

* test file updated

* updated mint fee error text

* appStore & dev names added

* latest merge (#1)

* reserved dev names and appstore names (#24)

* uri param added in safeMintAppNFT

* test file updated

* EIP4906 MetadataUpdate event added

* fees for mint integration

* test file updated

* updated mint fee error text

* appStore & dev names added

---------

Co-authored-by: r48Bit <[email protected]>

* Updates

* added bitscrunch and boomland to whitelisted (#25)

* Fixing test & adding some reservations

* added new 57 dapp to whitelisted dapps (#28)

* Added 14 new dapps to registry (#29)

---------

Co-authored-by: r48Bit <[email protected]>
Co-authored-by: r48b1t <[email protected]>
Co-authored-by: kailash-bitpack <[email protected]>

* bulk mint and updateURI added

---------

Co-authored-by: r48Bit <[email protected]>
Co-authored-by: r48b1t <[email protected]>
Co-authored-by: kailash-bitpack <[email protected]>
  • Loading branch information
4 people authored Feb 27, 2024
1 parent 71c677a commit 5614f13
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 6 deletions.
12 changes: 6 additions & 6 deletions contracts/AppNFTUpgradeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -433,15 +433,15 @@ contract AppNFTUpgradeable is Initializable, ERC721Upgradeable, ERC721Enumerable
/**
* @dev Mint multiple NFTs and assign them to a specified address.
* @param to The address to assign the minted NFTs to.
* @param appNames An array of app names to use for the NFTs.
* @param names An array of names to use for the NFTs.
* @param uris An array of URIs to use for the NFTs.
*/
function bulkMintAndURIupdate(address[] calldata to, uint256[] calldata tokenIds, string[] calldata appNames, string[] calldata uris) external onlyOwner {
uint256 quantity = appNames.length;
require(quantity == uris.length, "appNames and uris length mismatch");
for (uint256 i = 0; i < appNames.length; i++) {
function bulkMintAndURIupdate(address[] calldata to, uint256[] calldata tokenIds, string[] calldata names, string[] calldata uris) external onlyOwner {
uint256 quantity = tokenIds.length;
require(quantity == uris.length, "tokenIds and uris length mismatch");
for (uint256 i = 0; i < tokenIds.length; i++) {
if(tokenIds[i] == 0){
mint(to[i], uris[i], appNames[i]);
mint(to[i], uris[i], names[i]);
} else {
_setTokenURI(tokenIds[i], uris[i]);
}
Expand Down
31 changes: 31 additions & 0 deletions contracts/AppStoreNFTUpgradeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,37 @@ contract AppStoreNFTUpgradeable is Initializable, ERC721Upgradeable, ERC721Enume
require(_to.send(amount), 'Fee Transfer to Owner failed.');
}

/**
* @dev Mint multiple NFTs and assign them to a specified address.
* @param to The address to assign the minted NFTs to.
* @param names An array of names to use for the NFTs.
* @param uris An array of URIs to use for the NFTs.
*/
function bulkMintAndURIupdate(address[] calldata to, uint256[] calldata tokenIds, string[] calldata names, string[] calldata uris) external onlyOwner {
uint256 quantity = tokenIds.length;
require(quantity == uris.length, "tokenIds and uris length mismatch");
for (uint256 i = 0; i < tokenIds.length; i++) {
if(tokenIds[i] == 0){
mint(to[i], uris[i], names[i]);
} else {
_setTokenURI(tokenIds[i], uris[i]);
}
}
}

/**
* @dev Transfer multiple NFTs from one address to another.
* @param to The address to transfer the NFTs to.
* @param tokenIds An array of token IDs to transfer.
*/
function bulkTransfer(address to, uint256[] calldata tokenIds) external {
for (uint256 i = 0; i < tokenIds.length; i++) {
uint256 tokenId = tokenIds[i];
require(_isApprovedOrOwner(_msgSender(), tokenId), "Caller is not owner nor approved");
_transfer(_msgSender(), to, tokenId);
}
}

/**
* @notice function to set trusted forwarder
* @dev only owner can call this function
Expand Down
31 changes: 31 additions & 0 deletions contracts/DevNFTUpgradeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,37 @@ contract DevNFTUpgradeable is Initializable, ERC721Upgradeable, ERC721Enumerable
require(_to.send(amount), 'Fee Transfer to Owner failed.');
}

/**
* @dev Mint multiple NFTs and assign them to a specified address.
* @param to The address to assign the minted NFTs to.
* @param names An array of names to use for the NFTs.
* @param uris An array of URIs to use for the NFTs.
*/
function bulkMintAndURIupdate(address[] calldata to, uint256[] calldata tokenIds, string[] calldata names, string[] calldata uris) external onlyOwner {
uint256 quantity = tokenIds.length;
require(quantity == uris.length, "tokenIds and uris length mismatch");
for (uint256 i = 0; i < tokenIds.length; i++) {
if(tokenIds[i] == 0){
mint(to[i], uris[i], names[i]);
} else {
_setTokenURI(tokenIds[i], uris[i]);
}
}
}

/**
* @dev Transfer multiple NFTs from one address to another.
* @param to The address to transfer the NFTs to.
* @param tokenIds An array of token IDs to transfer.
*/
function bulkTransfer(address to, uint256[] calldata tokenIds) external {
for (uint256 i = 0; i < tokenIds.length; i++) {
uint256 tokenId = tokenIds[i];
require(_isApprovedOrOwner(_msgSender(), tokenId), "Caller is not owner nor approved");
_transfer(_msgSender(), to, tokenId);
}
}

/**
* @notice function to set trusted forwarder
* @dev only owner can call this function
Expand Down
1 change: 1 addition & 0 deletions scripts/upgradeDevProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var file = require("./config.json");
async function main() {
const DevNFT = await ethers.getContractFactory("DevNFTUpgradeable");
const devNFT = await upgrades.upgradeProxy(file.DevNFTUpgradeable, DevNFT, [
file.DappNameList,
process.env.TRUSTED_FORWARDER_ADDRESS,
]);
console.log("DevNFT upgraded", devNFT);
Expand Down

0 comments on commit 5614f13

Please sign in to comment.