Questions for Foundry users:
→ What's your testing workflow?
→ How do you approach fuzz testing?
→ Gas optimization benchmark process?
Replies become Day 19. 👇
#BuildingInPublic #Web3
@manavgandhi27
Full Stack Software Engineer building scalable, production-grade systems. Experience across frontend, backend, and system design. I value clean architecture, correctness, and solving real business problems.
Questions for Foundry users:
→ What's your testing workflow?
→ How do you approach fuzz testing?
→ Gas optimization benchmark process?
Replies become Day 19. 👇
#BuildingInPublic #Web3
This is how production teams work.
Fast tests, comprehensive coverage, production tooling.
Code → buff.ly/cIKv55G
Deep dive → buff.ly/twNsF5O
The progression:
Day 15: Wrote Solidity contracts
Day 16: Made contracts communicate
Day 17: Created ERC-20 tokens
Day 18: Production dev environment
From writing code → testing like production teams.
The speed difference is real:
Hardhat test: 10 seconds
Foundry test: 100 milliseconds
100x faster.
When you have hundreds of tests, this compounds.
Why cheat codes matter:
Without them:
→ Deploy contracts
→ Fund multiple wallets
→ Sign from each wallet
→ Wait for confirmations
With them:
→ Instant balance
→ Instant impersonation
→ Tests run in milliseconds
Real-world analogy:
vm.prank → Borrow friend's ID for one store visit
vm.startPrank → Borrow ID, use it all day
vm.stopPrank → Return ID, use your own
This is how you test different users interacting with contract.
Testing cheat codes:
vm.deal → Set balance of address
vm.prank → Impersonate for one tx
vm.startPrank → Impersonate for multiple txs
vm.stopPrank → Stop impersonating
vm.hoax → Prank with ETH for one tx
Testing events with Foundry:
vm.expectEmit checks if event was emitted correctly
You specify:
→ Check from address?
→ Check to address?
→ Check value?
Then execute transaction and verify.
Why events matter:
Logging: Record important actions
Off-chain tracking: Frontends listen to events
Gas efficient: Cheaper than storage
Searchable: Indexed parameters
Without events, frontends couldn't track on-chain activity.
Events in Solidity:
How contracts log important actions.
Example: Token transfer emits event
→ Who sent (indexed)
→ Who received (indexed)
→ How much (data)
Indexed = searchable
This is how Etherscan filters transactions.
Foundry has 4 parts:
Forge → Testing framework (like Anchor)
Cast → Interact with contracts (like spl-token cli)
Anvil → Local node (like solana-test-validator)
Chisel → Solidity REPL
Complete toolkit.
Why Foundry is faster:
Hardhat:
→ Contract in Solidity
→ Test in JavaScript
→ Context switch every test
Foundry:
→ Contract in Solidity
→ Test in Solidity
→ Same language, same VM
10-100x speed difference.
Evolution of Ethereum dev tools:
Ganache → Local blockchain (like test validator)
Truffle → Classic framework
Hardhat → Modern (JS/TS testing)
Foundry → Game changer (Solidity testing)
Each generation got faster.
Day 18 of learning Web3 in public.
I set up production Solidity development environment.
Here's why Foundry is 10-100x faster than Hardhat 🧵
Day 18: I Set Up a Production Solidity Development Environment. Here's Why Foundry Changed Everything - buff.ly/twNsF5O
SOL-USDC strategy rocks!
Absolutely, key for growth!
Day 17: I Created My Own Cryptocurrency. Here's How ERC-20 Tokens Actually Work -
Questions for token builders:
→ How do you design sustainable tokenomics?
→ Infinite approvals — safe or risky?
→ Best token launch strategy?
Replies become Day 18. 👇
#BuildingInPublic #Web3
This is how DeFi works.
Every protocol runs on custom tokens.
Code → buff.ly/nOXlHVI
Deep dive → buff.ly/M0zlGIU
The progression:
Day 2: Created wallets
Day 14: Built cloud wallet
Day 15: Wrote smart contracts
Day 16: Made contracts communicate
Day 17: Created digital assets
From using → building → creating assets.
OpenZeppelin:
Production-ready token in 7 lines.
Audited, battle-tested, gas-optimized.
Don't write ERC-20 from scratch.
Use OpenZeppelin.
Every serious DeFi protocol does.
Allowances enable:
→ Uniswap swaps
→ Aave deposits
→ Compound lending
→ Curve liquidity pools
Every DeFi interaction uses approve + transferFrom.
How Uniswap uses allowances:
You approve Uniswap to spend 100 USDC
You call swap function
Uniswap pulls your USDC using transferFrom
Uniswap sends you ETH
Without allowances, DeFi wouldn't exist.
Allowances: The DeFi Enabler
You can grant permission for another address to spend your tokens on your behalf.
Like giving a friend your ATM card with a spending limit.
This is how all DeFi works.
Real-world example:
Company rewards program:
Mint: Give customer 500 points
Transfer: Customer gifts 100 points to friend
Burn: Customer spends 200 points for discount
Same mechanics as blockchain tokens.
What I built:
KiratCoin Token
Features:
→ Mint (create new tokens)
→ Transfer (send to others)
→ Burn (destroy tokens)
Think of it as company reward points on blockchain.
What is a token?
Digital money on blockchain
Has an issuer who controls supply
Record of who owns how much
Users can transfer between addresses
Like Amazon gift cards on the blockchain.
Key Insight:
Your wallet doesn't store custom tokens.
It queries the smart contract's storage to display your balance.
Every custom token on Ethereum is a separate contract.
Storage: The Critical Distinction
Native ETH:
→ Stored in your wallet balance
→ Like cash in your bank account
Custom Tokens:
→ Stored in contract storage
→ Like items in lockers managed by the bank