Skip to main content

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

Source: core/vm/evm.go:91

Enhanced Features

Viction extends standard EVM functionality:

1. TomoX Integration

Smart contracts can interact with the TomoX protocol:
Source: 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

Source: contracts/tomox/contract/TRC21.sol:38

Solidity 0.5.x and 0.6.x

Source: 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:
Transactions with lower gas prices are rejected.

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

  1. Write contract in Remix IDE
  2. Compile with desired Solidity version
  3. Connect to Viction network (MetaMask)
  4. Deploy with sufficient VIC for gas

Using Hardhat

Using Truffle

Contract Examples

Basic Token (TRC21)

Multisig Wallet

Source: contracts/multisigwallet/contract/MultiSigWallet.sol

TomoX Relayer Registration

Source: contracts/tomox/contract/Registration.sol:115

Contract Verification

VicScan Verification

Verify contracts on VicScan explorer:
  1. Navigate to deployed contract address
  2. Click “Verify & Publish”
  3. Select compiler version and optimization
  4. Paste contract source code
  5. 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+):
Source: 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

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
Simply point your deployment tools to Viction’s RPC endpoint and deploy as you would on 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
Typical transaction costs:
  • Token transfer: ~$0.01
  • Uniswap swap: ~$0.05
  • NFT mint: ~$0.02
Compare this to Ethereum where similar operations can cost $5-50+ during peak times.
Viction provides precompiled contracts for TomoX price data:
Use these addresses:
  • Epoch Price: 0x00000... (check documentation)
  • Last Price: 0x00000... (check documentation)
These provide on-chain price feeds for any token pair traded on TomoX.
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
All versions work perfectly on Viction. Choose based on your project requirements.

See Also