2023-11-30 06:52:36 +00:00
|
|
|
// SPDX-License-Identifier: UNLICENSED
|
2024-04-11 01:40:29 +00:00
|
|
|
pragma solidity ^0.8.23;
|
2023-11-30 06:52:36 +00:00
|
|
|
|
2024-04-25 02:10:02 +00:00
|
|
|
import {Script, console2} from "forge-std/Script.sol";
|
|
|
|
import {DCO2s} from "src/DCO2s.sol";
|
2023-11-30 06:52:36 +00:00
|
|
|
|
|
|
|
contract DCO2sScript is Script {
|
|
|
|
DCO2s public dco2sc;
|
2024-04-25 02:05:27 +00:00
|
|
|
address public defaultAdmin;
|
|
|
|
address public minter;
|
|
|
|
address[] public airdrops;
|
2024-04-25 02:10:02 +00:00
|
|
|
string public baseURI;
|
|
|
|
string public name;
|
2024-04-25 02:05:27 +00:00
|
|
|
string public symbol;
|
|
|
|
string[] public nfts;
|
2023-11-30 06:52:36 +00:00
|
|
|
|
|
|
|
function setUp() public {
|
2024-04-25 02:05:27 +00:00
|
|
|
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 ' '
|
2024-04-25 02:10:02 +00:00
|
|
|
nfts = vm.envString("nfts", " ");
|
|
|
|
airdrops = vm.envAddress("airdrops", "\n");
|
2023-11-30 06:52:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// run is the entry point
|
|
|
|
function run() public {
|
|
|
|
// startBroadcast and stopBraodcast will let us execute transactions anything between them
|
2024-04-25 02:05:27 +00:00
|
|
|
uint256 deployerPrivateKey = vm.envUint("PK0");
|
|
|
|
vm.startBroadcast(deployerPrivateKey);
|
2023-11-30 06:52:36 +00:00
|
|
|
// here we just need to deploy a new contract
|
2024-04-25 02:10:02 +00:00
|
|
|
dco2sc = new DCO2s(defaultAdmin, minter, baseURI, name, symbol);
|
2024-04-25 02:05:27 +00:00
|
|
|
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
|
2024-04-25 02:10:02 +00:00
|
|
|
for (uint256 i; i < nfts.length; i++) {
|
2024-04-25 02:05:27 +00:00
|
|
|
dco2sc.safeMint(airdrops[i % airdrops.length], nfts[i]);
|
|
|
|
string memory tokenURI = dco2sc.tokenURI(i);
|
|
|
|
console2.log("Token0 URI is:", tokenURI);
|
2024-04-25 02:10:02 +00:00
|
|
|
}
|
2024-04-25 02:05:27 +00:00
|
|
|
|
|
|
|
// minting NFT0 to the contract admin
|
2024-04-25 02:10:02 +00:00
|
|
|
//string memory URI = nfts[0];
|
2024-04-25 02:05:27 +00:00
|
|
|
//dco2sc.safeMint(defaultAdmin, URI);
|
|
|
|
//string memory tokenURI = dco2sc.tokenURI(0);
|
|
|
|
//console2.log("Token0 URI is:", tokenURI);
|
|
|
|
|
2023-11-30 06:52:36 +00:00
|
|
|
vm.stopBroadcast();
|
|
|
|
}
|
|
|
|
}
|