From 958a5131093d4ab269b1c538cb942b992a010975 Mon Sep 17 00:00:00 2001 From: george-openformat Date: Thu, 16 May 2024 13:59:22 +0100 Subject: [PATCH] feat: add mint to script for ERC721Base --- Makefile | 7 +++++++ scripts/tokens/ERC721Base.s.sol | 13 +++++++++++++ 2 files changed, 20 insertions(+) diff --git a/Makefile b/Makefile index 9052409..fb7e339 100644 --- a/Makefile +++ b/Makefile @@ -107,6 +107,13 @@ ERC721Badge.setBaseURI:; forge script \ --rpc-url $(rpc) --broadcast $(verbose) $(legacy) $(slow) \ $(word 1, $(args)) $(word 2, $(args)) +# example: make ERC721Base.setBaseURI args="0xaf4c80136581212185f37c5e8809120d8fbf6224 sometokenuri" +ERC721Base.mintTo:; forge script \ + scripts/tokens/ERC721Base.s.sol:MintTo \ + --sig "run(address,string)" \ + --rpc-url $(rpc) --broadcast $(verbose) $(legacy) $(slow) \ + $(word 1, $(args)) $(word 2, $(args)) + # Run all update scripts update:; make \ update-ERC721FactoryFacet \ diff --git a/scripts/tokens/ERC721Base.s.sol b/scripts/tokens/ERC721Base.s.sol index 529bb9a..0d256c4 100644 --- a/scripts/tokens/ERC721Base.s.sol +++ b/scripts/tokens/ERC721Base.s.sol @@ -25,3 +25,16 @@ contract Deploy is Script, Utils { exportContractDeployment(CONTRACT_NAME, address(erc721base), block.number); } } + +contract MintTo is Script, Utils { + function run(address _contractAddress, string memory _tokenURI) external { + uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); + address deployerAddress = vm.addr(deployerPrivateKey); + vm.startBroadcast(deployerPrivateKey); + + ERC721Base erc721Badge = ERC721Base(_contractAddress); + erc721Badge.mintTo(deployerAddress, _tokenURI); + + vm.stopBroadcast(); + } +}