File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11-include .env
22
33deploy-anvil :
4- forge script script/DeployLowkickStarter .s.sol:DeployLowkickStarter \
4+ forge script script/DeployForestOnchain .s.sol:DeployForestOnchainLocal \
55 --rpc-url $(ANVIL_RPC_URL ) \
66 --broadcast \
77 --private-key $(ANVIL_PRIVATE_KEY ) \
@@ -11,6 +11,8 @@ test-specific:
1111 forge test --mt $(TEST ) -vvvv
1212
1313deploy-sepolia :
14- forge script script/DeployLowkickStarter .s.sol:DeployLowkickStarterSepolia \
14+ forge script script/DeployForestOnchain .s.sol:DeployForestOnchainSepolia \
1515 --rpc-url $(SEPOLIA_RPC_URL ) \
16- --broadcast
16+ --broadcast \
17+ --verify \
18+ --etherscan-api-key $(ETHERSCAN_API_KEY)
Load diff This file was deleted.
Original file line number Diff line number Diff line change 1+ // SPDX-License-Identifier: UNLICENSED
2+ pragma solidity ^ 0.8.13 ;
3+
4+ import {Script, console2} from "forge-std/Script.sol " ;
5+ import {ForestOnchain} from "../src/ForestOnchain.sol " ;
6+
7+ contract DeployForestOnchainLocal is Script {
8+ uint public constant COST_PER_TREE = 1e9 ;
9+ ForestOnchain public forestOnchain;
10+
11+ function setUp () public {}
12+
13+ function run () public {
14+ vm.startBroadcast ();
15+ forestOnchain = new ForestOnchain (COST_PER_TREE);
16+ vm.stopBroadcast ();
17+ }
18+ }
19+
20+ contract DeployForestOchainSepolia is Script {
21+ uint public constant COST_PER_TREE = 1e9 ;
22+
23+ function run () external {
24+ require (
25+ block .chainid == 11155111 ,
26+ "DeployGovernanceSepolia: wrong network (not Sepolia) "
27+ );
28+
29+ uint256 deployerKey = vm.envUint ("PRIVATE_KEY " );
30+
31+ vm.startBroadcast (deployerKey);
32+ ForestOnchain forestOnchain = new ForestOnchain (COST_PER_TREE);
33+ vm.stopBroadcast ();
34+
35+ console2.log ("Sepolia ForestOnchain: %s " , address (forestOnchain));
36+ console2.log ("Deployer: %s " , vm.addr (deployerKey));
37+ console2.log ("Chain ID: %s " , block .chainid );
38+ }
39+ }
Original file line number Diff line number Diff line change @@ -237,7 +237,7 @@ contract ForestOnchain {
237237 if (msg .value != stakeAmount) {
238238 revert ForestOnchain__IncorrectStakeSent (
239239 msg .value ,
240- requiredStake
240+ stakeAmount
241241 );
242242 }
243243 userGoals[msg .sender ][_activityType].activityType = _activityType;
@@ -309,9 +309,7 @@ contract ForestOnchain {
309309 return users;
310310 }
311311
312- function getStakeAmount (
313- uint _numOfTrees
314- ) public returns (address [] memory ) {
312+ function getStakeAmount (uint _numOfTrees ) public returns (uint ) {
315313 return _numOfTrees * cost_per_tree;
316314 }
317315}
Original file line number Diff line number Diff line change @@ -8,9 +8,10 @@ contract ForestOnchainTest is Test {
88 ForestOnchain public forestOnchain;
99 uint public CONTRACT_FUND_AMOUNT = 1e17 ;
1010 address USER1 = makeAddr ("USER1 " );
11+ uint public constant COST_PER_TREE = 1e9 ;
1112
1213 function setUp () public {
13- forestOnchain = new ForestOnchain ();
14+ forestOnchain = new ForestOnchain (COST_PER_TREE );
1415 vm.deal (address (forestOnchain), CONTRACT_FUND_AMOUNT);
1516 }
1617
You can’t perform that action at this time.
0 commit comments