From 85525834e1c07ce59e7155612741e20e18356638 Mon Sep 17 00:00:00 2001 From: geovgy Date: Fri, 8 Nov 2024 10:51:47 -0500 Subject: [PATCH] Create script to set token URI --- .gitignore | 4 ++++ script/SetURI.s.sol | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 script/SetURI.s.sol diff --git a/.gitignore b/.gitignore index 85198aa..355f8a9 100644 --- a/.gitignore +++ b/.gitignore @@ -6,9 +6,13 @@ out/ !/broadcast /broadcast/*/31337/ /broadcast/**/dry-run/ +/broadcast/ # Docs docs/ # Dotenv file .env + +# metadata +metadata/ diff --git a/script/SetURI.s.sol b/script/SetURI.s.sol new file mode 100644 index 0000000..741aaa0 --- /dev/null +++ b/script/SetURI.s.sol @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.24; + +import {Script} from "forge-std/Script.sol"; +import {EIPAuthorReward} from "../src/EIPAuthorReward.sol"; + +contract SetURI is Script { + function run() external returns (uint256 tokenId, string memory uri) { + EIPAuthorReward nft = EIPAuthorReward(vm.envAddress("NFT_ADDRESS")); + tokenId = uint256(keccak256(abi.encodePacked(vm.envString("UPGRADE_NAME")))); + uri = vm.envString("IPFS_URI"); + + uint256 ownerPrivateKey = vm.envUint("OWNER_PRIVATE_KEY"); + + vm.startBroadcast(ownerPrivateKey); + nft.setUri(tokenId, uri); + vm.stopBroadcast(); + } +}