DECANFT-SC/script/DCO2s.s.sol

59 lines
2.0 KiB
Solidity
Raw Normal View History

// SPDX-License-Identifier: UNLICENSED
2024-04-11 01:40:29 +00:00
pragma solidity ^0.8.23;
import { Script, console2 } from "forge-std/Script.sol";
import { DCO2s } from "src/DCO2s.sol";
contract DCO2sScript is Script {
DCO2s public dco2sc;
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 = 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
uint256 deployerPrivateKey = vm.envUint("PK0");
vm.startBroadcast(deployerPrivateKey);
// here we just need to deploy a new contract
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();
}
}