Skip to main content
Learn how to write and deploy smart contracts on TeQoin L2. TeQoin is 100% EVM-compatible, so your existing Ethereum contracts work without modifications.
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

Recommended: Use Solidity 0.8.20 or later for new contracts. It includes the latest security features and optimizations.

📝 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:
Pack Variables:
Use mappings over arrays when appropriate:

🔐 Security Best Practices

Common Vulnerabilities to Avoid

Problem: External calls before state updates can be exploited.
Solution: Use Solidity 0.8.x which has built-in overflow checks.
Use proper access control mechanisms:
Protect against transaction ordering attacks:
Avoid patterns that can be exploited:

📚 Using Libraries

OpenZeppelin Contracts

The industry-standard library works perfectly on TeQoin:

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 Production:
  • TeQoin produces blocks every 5 seconds (vs 12 seconds on Ethereum)
  • This means block.number increments faster
Impact:
  • Time-based logic using block.number will execute faster
  • Use block.timestamp for time-based logic instead
Lower Gas Costs:
  • Some operations cost less on TeQoin L2
  • Storage is still expensive (same as L1)
Optimization still matters:
  • 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