Key Points:
- ✅ Full EVM compatibility (Shanghai version)
- ✅ Use Solidity 0.4.x - 0.8.x
- ✅ Same tooling as Ethereum (Hardhat, Foundry, Remix)
- ✅ No code changes needed for existing contracts
🎯 EVM Compatibility
TeQoin L2 is 100% EVM-compatible, which means:Same Languages
Solidity, Vyper, YulAll Ethereum contract languages work
Same Tools
Hardhat, Foundry, RemixUse your existing development stack
Same Libraries
OpenZeppelin, ChainlinkAll Ethereum libraries are compatible
Same Bytecode
No Compilation ChangesDeploy existing contracts as-is
Supported Solidity Versions
📝 Writing Your First Contract
Let’s write a simple smart contract for TeQoin L2.Example: Simple Storage Contract
🏗️ Contract Patterns for TeQoin
Gas Optimization Tips
TeQoin L2 already has low fees, but you can optimize further:- Storage Optimization
- Function Optimization
- Event Optimization
- Loop Optimization
Pack Variables:Use mappings over arrays when appropriate:
🔐 Security Best Practices
Common Vulnerabilities to Avoid
1. Reentrancy Attacks
1. Reentrancy Attacks
Problem: External calls before state updates can be exploited.
2. Integer Overflow/Underflow
2. Integer Overflow/Underflow
Solution: Use Solidity 0.8.x which has built-in overflow checks.
3. Access Control
3. Access Control
Use proper access control mechanisms:
4. Front-Running Protection
4. Front-Running Protection
Protect against transaction ordering attacks:
5. Denial of Service
5. Denial of Service
Avoid patterns that can be exploited:
📚 Using Libraries
OpenZeppelin Contracts
The industry-standard library works perfectly on TeQoin:Other Popular Libraries
Chainlink
Oracles & VRFPrice feeds and randomness✅ Compatible
Uniswap V2/V3
DEX ContractsAutomated market makers✅ Compatible
AAVE
Lending ProtocolsDeFi primitives✅ Compatible
The Graph
IndexingQuery blockchain data✅ Compatible
🧪 Testing Contracts
Unit Testing with Hardhat
test/SimpleStorage.test.js
Testing on TeQoin Testnet
scripts/test-on-testnet.js
🎨 Contract Examples
DeFi: Simple Staking Contract
NFT: Dynamic NFT
🔍 Differences from Ethereum L1
While TeQoin is fully EVM-compatible, there are a few minor considerations:Block Numbers and Timestamps
Block Numbers and Timestamps
Block Production:
- TeQoin produces blocks every 5 seconds (vs 12 seconds on Ethereum)
- This means
block.numberincrements faster
- Time-based logic using
block.numberwill execute faster - Use
block.timestampfor time-based logic instead
Gas Costs
Gas Costs
Lower Gas Costs:
- Some operations cost less on TeQoin L2
- Storage is still expensive (same as L1)
- Even though gas is cheap, optimize for good practice
- Future-proof your contracts
📖 Learning Resources
Solidity Documentation
Official Solidity docs
OpenZeppelin Contracts
Secure contract library
Ethereum.org
Ethereum developer resources
CryptoZombies
Interactive Solidity tutorial
🎯 Next Steps
Deploy Your Contract
Deploy to TeQoin L2 using Hardhat or Foundry
Verify Your Contract
Verify source code on block explorer
Integration Guide
Integrate contracts with frontend
Network Information
Network configs and endpoints
Ready to deploy? Continue to Deploy Your First Contract →