Repository navigation
Expand file tree
/
Copy pathDeployTestnet.s.sol
More file actions
85 lines (74 loc) · 3.42 KB
/
Copy pathDeployTestnet.s.sol
File metadata and controls
85 lines (74 loc) · 3.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import "forge-std/Script.sol";
import "../src/GitlawbTestToken.sol";
import "../src/GitlawbDIDRegistry.sol";
import "../src/GitlawbNameRegistry.sol";
import "../src/GitlawbBounty.sol";
import "../src/GitlawbStaking.sol";
import "../src/GitlawbNodeStaking.sol";
import "../src/GitlawbFeeDistributor.sol";
/// @notice One-shot testnet deploy for Base Sepolia.
///
/// Deploys:
/// - GitlawbTestToken (test $GITLAWB, public mint)
/// - All 6 protocol contracts, wired together
/// - Mints 10,000,000 tGITLAWB to the deployer for testing
///
/// Required env:
/// DEPLOYER_PRIVATE_KEY — EOA that pays gas + becomes owner
///
/// Usage:
/// forge script script/DeployTestnet.s.sol \
/// --rpc-url https://sepolia.base.org \
/// --broadcast \
/// --private-key $DEPLOYER_PRIVATE_KEY
contract DeployTestnet is Script {
function run() external {
console.log("=== gitlawb testnet deploy ===");
console.log("Chain ID:", block.chainid);
require(block.chainid != 8453, "DeployTestnet must not run on Base mainnet");
// Uses --private-key from forge CLI flag
vm.startBroadcast();
address deployer = msg.sender;
console.log("Deployer:", deployer);
// 0. Test token
GitlawbTestToken token = new GitlawbTestToken();
token.mint(deployer, 10_000_000 * 1e18);
// 1+2. Registries
GitlawbDIDRegistry didRegistry = new GitlawbDIDRegistry();
GitlawbNameRegistry nameRegistry = new GitlawbNameRegistry();
// 3. User staking
GitlawbStaking userStaking = new GitlawbStaking(address(token));
// 4. Node operator staking
GitlawbNodeStaking nodeStaking = new GitlawbNodeStaking(address(token));
// 5. Fee distributor (reward wallet)
GitlawbFeeDistributor feeDistributor = new GitlawbFeeDistributor(
address(token),
address(nodeStaking),
address(userStaking)
);
// 6. Bounty with treasury = feeDistributor
GitlawbBounty bounty = new GitlawbBounty(address(token), address(feeDistributor));
vm.stopBroadcast();
console.log("");
console.log("=== Deployed on Base Sepolia ===");
console.log("GitlawbTestToken: ", address(token));
console.log("GitlawbDIDRegistry: ", address(didRegistry));
console.log("GitlawbNameRegistry: ", address(nameRegistry));
console.log("GitlawbStaking: ", address(userStaking));
console.log("GitlawbNodeStaking: ", address(nodeStaking));
console.log("GitlawbFeeDistributor:", address(feeDistributor));
console.log("GitlawbBounty: ", address(bounty));
console.log("");
console.log("=== Export these for the CLI/node ===");
console.log("export GITLAWB_CHAIN_RPC_URL=https://sepolia.base.org");
console.log("export GITLAWB_TOKEN=%s", vm.toString(address(token)));
console.log("export GITLAWB_CONTRACT_NODE_STAKING=%s", vm.toString(address(nodeStaking)));
console.log("export GITLAWB_CONTRACT_DID_REGISTRY=%s", vm.toString(address(didRegistry)));
console.log("export GITLAWB_CONTRACT_NAME_REGISTRY=%s", vm.toString(address(nameRegistry)));
console.log("");
console.log("Deployer was minted 10,000,000 tGITLAWB.");
console.log("Anyone can mint more via: cast send <token> 'mint(address,uint256)' <addr> <amount>");
}
}