Skip to main content

Overview

The Computable Token Machine is a revolutionary token standard that combines ERC-20 functionality with the Diamond Standard (EIP-2535). Each CTM is both a standard token AND a modular execution environment capable of running its own applications, managing state, and evolving over time.
Beyond value, beyond utility—tokens that think.

EIP-2535 Diamond

Modular architecture

Modular Programs

Infinite extensibility

On-Chain Autonomy

Self-executing logic

Live Contract

Deployed CTM

Address: 0x477A9f214c947e6D81b9d32b6b1883F4a4ffFb24View on PaxScan →

What is CTM?

The Computable Token Machine is a revolutionary token standard that combines ERC-20 functionality with the Diamond Standard (EIP-2535). Each CTM is both a standard token AND a modular execution environment capable of running its own applications, managing state, and evolving over time.

Key Features

Add new features and applications to your token after deployment. Your token evolves with your needs.
All Programs share the same storage context. Programs can read and interact with each other seamlessly.
Modular Programs optimize gas usage and bypass EVM contract size limits.
Create complex on-chain agents that manage assets and execute tasks based on rich internal state.

Core Concepts

Two Personalities

CTM acts as both a token and a machine:
On the outside, a CTM behaves like any standard ERC-20 token. It can be:
  • Held in wallets
  • Traded on exchanges
  • Used in DeFi protocols
  • Transferred between addresses
No special handling required - it’s just a token!

Programs (Facets)

Programs are stateless Solidity contracts that contain the logic executed by the CTM. Each Program manages its own state within a unique storage slot to prevent collisions. Example Programs:
  • Voting and Governance
  • Staking and Rewards
  • DEX Integration
  • NFT Minting
  • Custom Game Logic
  • Automated Trading
  • On-chain AI Agents

Diamond Standard (EIP-2535)

CTM is built on the Diamond Standard, which allows a single contract to use multiple logic contracts (facets/programs). This pattern enables:
  • ✅ Unlimited contract size
  • ✅ Upgradability
  • ✅ Modular functionality
  • ✅ Single address persistence

Quick Start

1

Clone Repository

2

Configure Network

Add HyperPaxeer details to hardhat.config.js:
hardhat.config.js
3

Deploy

This deploys:
  • TokenVM.sol (the main proxy contract)
  • DiamondCutFacet (for adding/removing Programs)
  • DiamondLoupeFacet (for inspecting installed Programs)
  • OwnershipFacet (access control)
  • ERC20Facet (token functionality)

Creating Programs

Program Structure

Programs must be stateless and manage state within a unique storage slot to prevent collisions.
VotingProgram.sol

Adding Programs to CTM

Use the diamondCut function to register new Programs:

Helper Function for Selectors

Program Best Practices

Always use keccak256 hashes for storage positions to avoid collisions:
Never use regular state variables at the contract level!
Programs should not hold funds or use constructors that set state:Wrong:
Correct:
Protect diamondCut with ownership or governance controls:
Only authorized addresses should be able to add/remove Programs.
Programs can call each other using address(this) and shared storage:

Security Considerations

Critical Security Points:
  1. Storage Layout: Never use standard global state variables. Always use the diamond storage pattern with unique keccak256 slots.
  2. Access Control: The diamondCut function is extremely powerful. Ensure it’s protected by robust ownership or governance control.
  3. Stateless Logic: Programs are logic contracts and should not hold funds or have constructors that set state.
  4. Testing: Thoroughly test all Programs before deployment. Once added to a CTM, they have access to the token’s storage and capabilities.

Auditing Checklist

Before deploying CTM or adding new Programs:
  • Storage slots use unique keccak256 hashes
  • No global state variables in Programs
  • Access control properly configured
  • Programs don’t hold funds directly
  • All Programs thoroughly tested
  • diamondCut function is protected
  • Inter-program interactions tested
  • Gas optimization reviewed
  • Security audit completed (for production)

Advanced Examples

Staking Program

Governance Program

Resources

GitHub Repository

View source code and examples

Live Contract

Explore on PaxScan

EIP-2535 Specification

Learn about Diamond Standard

Developer Community

Join other CTM developers

Next Steps

Deploy Your First CTM

Follow the deployment guide

Create Custom Programs

Build your own logic modules

Smart Contracts Guide

General contract deployment

Configuration

Set up your development environment