diff --git a/script/DCO2s.s.sol b/script/DCO2s.s.sol index 7b82747..3d8836c 100644 --- a/script/DCO2s.s.sol +++ b/script/DCO2s.s.sol @@ -1,32 +1,58 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.23; -import {Script, console2} from "forge-std/Script.sol"; +import { Script, console2 } from "forge-std/Script.sol"; import { DCO2s } from "src/DCO2s.sol"; contract DCO2sScript is Script { DCO2s public dco2sc; - string public baseURI; + address public defaultAdmin; + address public minter; + address[] public airdrops; + string public baseURI; + string public name; + string public symbol; + string[] public nfts; function setUp() public { - baseURI = "https://gateway.decentralizedscience.org/ipfs/"; - dco2sc = new DCO2s(0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266, - 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266, - baseURI, - "DCO2s", - "DCO2"); - console2.log("The DCO2s contract address is: ", address(dco2sc)); + baseURI = vm.envString("BASE_URI"); + defaultAdmin = vm.envAddress("DEFAULT_ADMIN"); + minter = vm.envAddress("MINTER"); + name = vm.envString("NAME"); + symbol = vm.envString("SYMBOL"); + // Import nfts array from .env and split by ' ' + nfts = vm.envString("nfts", ' '); + airdrops = vm.envAddress("airdrops", '\n'); } // run is the entry point function run() public { // startBroadcast and stopBraodcast will let us execute transactions anything between them - vm.startBroadcast(); + uint256 deployerPrivateKey = vm.envUint("PK0"); + vm.startBroadcast(deployerPrivateKey); // here we just need to deploy a new contract - string memory URI = "bafkreibc6p3y36yjmeqqnttqfrpb2yttxa6aonoywxwdxl7nqym4jj3jwa"; - dco2sc.safeMint(0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266, URI); - string memory tokenURI = dco2sc.tokenURI(0); - console2.log("Token0 URI is:", tokenURI); + dco2sc = new DCO2s(defaultAdmin, + minter, + baseURI, + name, + symbol); + console2.log("The DCO2s contract address is: ", address(dco2sc)); + + + // minting all nfts to airdrops accounts + // @notice: uses module for airdrops accounts to distribute the nfts + for(uint i; i < nfts.length; i++) { + dco2sc.safeMint(airdrops[i % airdrops.length], nfts[i]); + string memory tokenURI = dco2sc.tokenURI(i); + console2.log("Token0 URI is:", tokenURI); + } + + // minting NFT0 to the contract admin + //string memory URI = nfts[0]; + //dco2sc.safeMint(defaultAdmin, URI); + //string memory tokenURI = dco2sc.tokenURI(0); + //console2.log("Token0 URI is:", tokenURI); + vm.stopBroadcast(); } }