Skip to content

Commit

Permalink
add debugging script
Browse files Browse the repository at this point in the history
  • Loading branch information
malteish committed Oct 23, 2023
1 parent cb394e4 commit 6fa9388
Showing 1 changed file with 89 additions and 0 deletions.
89 changes: 89 additions & 0 deletions script/DeployTokenFromScratch.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

// taken from https://moveseventyeight.com/deploy-your-first-nft-contract-with-foundry#heading-prepare-a-basic-deployment-script

import "../lib/forge-std/src/Script.sol";
import "../contracts/FeeSettings.sol";
import "../contracts/AllowList.sol";
import "../contracts/PersonalInviteFactory.sol";
import "../contracts/VestingWalletFactory.sol";
import "../contracts/TokenCloneFactory.sol";

contract DeployPlatform is Script {
function setUp() public {}

function run() public {
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");

// Goerli
//address platformColdWallet = 0x1695F52e342f3554eC8BC06621B7f5d1644cCE39;
//address platformAdminWallet = 0x1695F52e342f3554eC8BC06621B7f5d1644cCE39;

// Mainnet
//address platformColdWallet = 0x9E23f8AA17B2721cf69D157b8a15bd7b64ac881C;
//address platformAdminWallet = platformColdWallet;

// Anvil
uint256 adminPrivateKey = 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80;
deployerPrivateKey = adminPrivateKey;

address deployerAddress = vm.addr(deployerPrivateKey);
console.log("Deployer address: ", deployerAddress);

address platformColdWallet = deployerAddress;
address platformAdminWallet = deployerAddress;

vm.startBroadcast(deployerPrivateKey);

console.log("Deploying FeeSettings contract...");
Fees memory fees = Fees(100, 100, 100, 0);
FeeSettings feeSettings = new FeeSettings(fees, platformColdWallet, platformColdWallet, platformColdWallet);
console.log("FeeSettings deployed at: ", address(feeSettings));
feeSettings.transferOwnership(platformColdWallet);
console.log("Started ownership transfer to: ", platformColdWallet);

console.log("Deploying AllowList contract...");
AllowList allowList = new AllowList();
console.log("Allowlist deployed at: ", address(allowList));
allowList.transferOwnership(platformAdminWallet);
console.log("Started ownership transfer to: ", platformAdminWallet);

console.log("Deploying PersonalInviteFactory contract...");
PersonalInviteFactory personalInviteFactory = new PersonalInviteFactory();
console.log("PersonalInviteFactory deployed at: ", address(personalInviteFactory));

console.log("Deploying VestingWalletFactory contract...");
VestingWalletFactory vestingWalletFactory = new VestingWalletFactory();
console.log("VestingWalletFactory deployed at: ", address(vestingWalletFactory));

console.log("Deploying TokenCloneFactory contract...");
Token tokenLogicContract = new Token(address(1)); // use bullshit forwarder
TokenCloneFactory tokenCloneFactory = new TokenCloneFactory(address(tokenLogicContract));
console.log("TokenCloneFactory deployed at: ", address(tokenCloneFactory));

console.log("Deploying Token contract...");
Token token = Token(
tokenCloneFactory.createTokenClone(
0,
address(1), // use bullshit forwarder
feeSettings,
platformAdminWallet,
allowList,
0,
"Anvil Token",
"ANVIL"
)
);
console.log("Token deployed at: ", address(token));

console.log("Minting tokens...");
token.grantRole(token.MINTALLOWER_ROLE(), platformAdminWallet);
token.mint(platformAdminWallet, 1000000000000000000000000000);
console.log("Tokens minted.");

vm.stopBroadcast();

console.log("Don't forget to check and finalize ownership transfers for all contracts!");
}
}

0 comments on commit 6fa9388

Please sign in to comment.