Overview
Viction provides full Ethereum Virtual Machine (EVM) compatibility, allowing developers to deploy and run smart contracts written in Solidity and other EVM languages. All existing Ethereum tools, libraries, and contracts work seamlessly on Viction.EVM Compatibility
Viction maintains compatibility with Ethereum’s execution environment:- Solidity Support: All Solidity versions supported by Ethereum
- Vyper Support: Alternative smart contract language
- Bytecode Compatible: Deploy existing Ethereum contract bytecode
- Standard Opcodes: Full EVM instruction set
- Precompiled Contracts: Standard cryptographic operations
EVM Context
core/vm/evm.go:91
Enhanced Features
Viction extends standard EVM functionality:1. TomoX Integration
Smart contracts can interact with the TomoX protocol:core/vm/evm.go:57
2. TRC21 Token Support
Native protocol support for gasless token transactions:- Zero-gas transactions for TRC21 tokens
- Fee abstraction at protocol level
- Issuer capacity management
3. Extended Precompiles
Additional precompiled contracts:- TomoX Price Oracles: Access on-chain price data
- Randomization: Verifiable random numbers
- Block Signer: Consensus participant info
Solidity Versions
Viction supports all Solidity versions:Solidity 0.4.x
contracts/tomox/contract/TRC21.sol:38
Solidity 0.5.x and 0.6.x
contracts/tests/contract/Inherited.sol:13
Solidity 0.8.x
Full support for latest features:- Built-in overflow checking
- Custom errors
- Enhanced type safety
Gas Mechanics
Gas Price
Viction uses a minimum gas price:Gas Costs
Standard EVM gas costs apply:- SSTORE: 20,000 gas (first write), 5,000 gas (update)
- SLOAD: 200 gas
- Transfer: 21,000 gas
- Contract Creation: 32,000 gas + bytecode cost
- CALL: 700 gas + value transfer
TRC21 Gas Subsidy
TRC21 tokens enable gasless transactions:- Users pay 0 gas price
- Validators pay gas from token issuer’s deposit
- Fee collected in tokens instead of VIC
Contract Deployment
Using Remix
- Write contract in Remix IDE
- Compile with desired Solidity version
- Connect to Viction network (MetaMask)
- Deploy with sufficient VIC for gas
Using Hardhat
Using Truffle
Contract Examples
Basic Token (TRC21)
Multisig Wallet
contracts/multisigwallet/contract/MultiSigWallet.sol
TomoX Relayer Registration
contracts/tomox/contract/Registration.sol:115
Contract Verification
VicScan Verification
Verify contracts on VicScan explorer:- Navigate to deployed contract address
- Click “Verify & Publish”
- Select compiler version and optimization
- Paste contract source code
- Submit for verification
Benefits of Verification
- Users can read contract code
- Direct contract interaction via explorer
- Increased trust and transparency
- ABI automatically generated
Contract Interaction
Web3.js
Ethers.js
Smart Contract Calls
Contracts can call other contracts:Security Considerations
Reentrancy
Protect against reentrancy attacks:Integer Overflow
Use SafeMath (or Solidity 0.8+):contracts/tomox/contract/SafeMath.sol
Access Control
Implement proper access restrictions:Gas Optimization
Storage vs Memory
Packing Variables
Batch Operations
Debugging
Events
Use events for debugging:Revert Messages
Provide clear error messages:Hardhat Console
Testing
Unit Tests (Hardhat)
Integration Tests
Test on Viction testnet before mainnet deployment.Contract Upgrades
Proxy Pattern
Can I deploy any Ethereum contract on Viction?
Can I deploy any Ethereum contract on Viction?
Yes, Viction is fully EVM-compatible. Any contract that works on Ethereum will work on Viction without modifications. This includes:
- Uniswap V2/V3 contracts
- OpenZeppelin contracts
- Compound Finance contracts
- Custom contracts written in Solidity or Vyper
What are the gas costs compared to Ethereum?
What are the gas costs compared to Ethereum?
Viction has significantly lower gas costs than Ethereum:
- Faster block times (2 seconds vs 12 seconds)
- Lower gas prices (0.25 Gwei minimum vs Ethereum’s market rate)
- Same gas per operation, but lower cost per gas
- Token transfer: ~$0.01
- Uniswap swap: ~$0.05
- NFT mint: ~$0.02
How do I access TomoX prices from my smart contract?
How do I access TomoX prices from my smart contract?
Viction provides precompiled contracts for TomoX price data:Use these addresses:
- Epoch Price:
0x00000...(check documentation) - Last Price:
0x00000...(check documentation)
Should I use Solidity 0.4, 0.5, 0.6, or 0.8?
Should I use Solidity 0.4, 0.5, 0.6, or 0.8?
Recommendation depends on your needs:
-
Solidity 0.8.x: Best for new projects
- Built-in overflow protection
- Better error handling
- Latest features
- No SafeMath needed
-
Solidity 0.4.x/0.5.x: Use for compatibility
- Porting existing Ethereum contracts
- Integrating with legacy code
- Must use SafeMath library
See Also
- TRC21 Tokens - Gasless token standard
- TomoX DEX - Decentralized exchange integration
- TomoX Lending - Lending protocol contracts