Tag: smart-contracts
All the articles with the tag "smart-contracts".
-
Fork testing smart contracts runs your tests on a copy of mainnet state. Learn when it helps, when it gives false confidence, and how to pin the block.
-
How to write a reentrancy test in Solidity with Foundry. Build the attacker contract, watch the test fail, then apply checks-effects-interactions and a guard.
-
Six Solidity unit test patterns with Foundry code: revert, event, access control, rounding, fuzz and state-transition tests, plus the bug each one catches.
-
The edge cases that break NFT contracts: stale approvals, mint limits, reentrancy, royalties, metadata and ownership, with Hardhat tests for each.
-
Build realistic DeFi test data: fee-on-transfer, rebasing and blacklistable token mocks, forked mainnet state and failure scenarios, with Hardhat code.
-
Use gas ceilings, gas reports and snapshot tests to find and lock in gas savings in smart contracts, with measured Hardhat examples.
-
How to test upgradeable contracts: storage layout checks, proxy upgrade simulation, initializer tests, gas checks and a pre-upgrade checklist.
-
Set up automated smart contract tests with Hardhat and ethers v6, run them in GitHub Actions on every push, and add gas, fuzz and fork tests.
-
How to test the contract-to-frontend flow in a dapp: a local Hardhat chain, an injected wallet provider, Playwright tests and a CI run, with a DEX swap example.