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 โ†’