10 Challenge Spotlights, one for every challenge on Speedrun Ethereum.
Tokenization. Crowdfunding. Token Vendor. Dice Game. DEX. Oracles. Lending. Stablecoins. Prediction Markets. ZK Voting.
That's a full cycle. Which one was your favorite?
🧵 How to Safely Call Other Contracts in Solidity
Smart contracts rarely live alone. Most real-world dApps rely on contract-to-contract communication.
But every call is a potential risk.
Here’s how to do it securely 👇
🧵 How to Safely Call Other Contracts in Solidity
Smart contracts rarely live alone. Most real-world dApps rely on contract-to-contract communication.
But every call is a potential risk.
Here’s how to do it securely 👇
5/
🔁 Reentrancy is Real
Attackers can re-enter your contract mid-function and drain funds.
💡 Defend with:
- Checks-Effects-Interactions pattern
- OpenZeppelin ReentrancyGuard
Foundry support just shipped on Speedrun Ethereum 🔨
Pick your stack when you start a challenge: Hardhat or Foundry.
Try it on the first challenge:
npx [email protected] -e challenge-tokenization challenge-tokenization
Available for challenges 0 to 4. More coming soon.
Challenge 5: Oracles.
The exercise:
• Your contract needs off-chain data (a price, a weather feed, a score)
• Solidity can only see on-chain state
• An oracle bridges the gap, and becomes a trust anchor you have to reason about
Two ways to declare a value that never changes:
• `constant` — inlined at compile time. Value has to be known before deploy.
• `immutable` — set once in the constructor. Stored in bytecode, not a storage slot.
Reading either costs ~3 gas. Reading a storage variable costs ~100 (warm) or ~2100 (cold). Use one of these whenever you can.
Challenge 4: Build a DEX.
The exercise:
• Constant-product AMM from scratch (`x * y = k`)
• Provide liquidity, earn swap fees
• Swap against your own pool
• Under 50 lines of Solidity at the core