Skip to content

Commit

Permalink
add tokenURIBatch
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoAcosta committed Aug 25, 2024
1 parent e0cd91f commit ac72168
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
18 changes: 18 additions & 0 deletions script/Deploy.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import "forge-std/Script.sol";
import "../src/OpenFlowTransactionCertificates.sol";

contract MyScript is Script {
function run() external {
uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);

OpenFlowTransactionCertificates nft = new OpenFlowTransactionCertificates(
0xaEe07187f47a24627427Ccc3C25bE6CB7D73A9F4
);

vm.stopBroadcast();
}
}
15 changes: 15 additions & 0 deletions src/OpenFlowTransactionCertificates.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,19 @@ contract OpenFlowTransactionCertificates is ERC721URIStorage, Ownable {
_setTokenURI(newtokenId, _uri);
_mint(address(this), newtokenId);
}

function tokenURIBatch(
uint256 _floor,
uint256 ceiling
) public view returns (string[] memory) {
require(_floor < ceiling, "Invalid range");

string[] memory uris = new string[](ceiling - _floor);

for (uint256 i = _floor; i < ceiling; i++) {
uris[i - _floor] = tokenURI(i);
}

return uris;
}
}

0 comments on commit ac72168

Please sign in to comment.