Capstone · Base Sepolia
Staking Lab
Connect MetaMask, point it at your deployed contract, and clear every checkpoint.
Guided checklist
Auto-detected from on-chain state and your actions this session.
0/8
complete
- ○Wallet installed & connectedInstall MetaMask and click Connect Wallet.
- ○Switched to Base Sepolia (chainId 84532)Click 'Switch to Base Sepolia' above.
- ○Contract deployed & address loadedPaste your deployed address and press 'Load contract state'.
- ○Reward pool funded (contract balance > totalStaked)As owner, call fundRewards() with some ETH so claims can pay out.
- ○Stake tx sentEnter an amount and press Stake.
- ○Rewards accrued (pendingRewards > 0)Wait a few seconds after staking, then reload state.
- ○Rewards claimedPress Claim once pending rewards are visible.
- ○Unstake tx sentPress Unstake to withdraw your principal.
Hardhat setup
TypeScript / JavaScript workflowInstall & test
mkdir staking && cd staking && npm init -y npm install --save-dev hardhat @nomicfoundation/hardhat-toolbox npx hardhat init # choose 'Create a JavaScript project' // Put SimpleStaking.sol in contracts/ and the test in test/ npx hardhat compile npx hardhat test
Deploy to Base Sepolia
// hardhat.config.js — add Base Sepolia network
networks: { baseSepolia: { url: 'https://sepolia.base.org', accounts: [process.env.PRIVATE_KEY] } }
// scripts/deploy.js:
const s = await ethers.deployContract('SimpleStaking', [1_000_000_000n]);
await s.waitForDeployment(); console.log(await s.getAddress());
npx hardhat run scripts/deploy.js --network baseSepoliaFoundry setup
Fast native Solidity workflowInstall & test
curl -L https://foundry.paradigm.xyz | bash && foundryup forge init staking && cd staking // Put SimpleStaking.sol in src/ and the test in test/ forge build forge test -vv
Deploy to Base Sepolia
export PRIVATE_KEY=0x… # a test-only key with Base Sepolia ETH forge create src/SimpleStaking.sol:SimpleStaking \ --rpc-url https://sepolia.base.org \ --private-key $PRIVATE_KEY \ --constructor-args 1000000000
Never paste a mainnet private key into a terminal or .env for lab work. Use a fresh MetaMask account funded only with Base Sepolia faucet ETH.
