This project implements a comprehensive token system for the XXX ecosystem on the Base network with a 3-contract architecture:
- XXXToken - Core ERC20 Token contract
- XXXTokenVault - Token Treasury & Allocation Manager
- XXXVestingManager - Vesting, Locking, and Claiming
ttn-token/
├── contracts/ # Smart contract source files
│ ├── XXXToken.sol # Core ERC20 Token
│ ├── XXXTokenVault.sol # Treasury & Allocation Manager
│ └── XXXVestingManager.sol # Vesting & Locking Manager
├── scripts/ # Deployment and upgrade scripts
├── deployments/ # Deployment artifacts
├── .env.example # Example environment configuration
├── test # Test files
├── hardhat.config.ts # Hardhat configuration
└── README.md # Project documentation
The XXX token system implements the following features:
-
3-Contract Architecture:
- XXXToken: Core ERC20 with minting, burning, pausing, and upgradeability
- XXXTokenVault: Manages token allocations, airdrops, and minting control
- XXXVestingManager: Handles vesting schedules, locking, unlocking, and claims
-
Upgradeable Architecture: All contracts use the UUPS (Universal Upgradeable Proxy Standard) pattern for future upgrades
-
On-Demand Minting with Hard Cap: Maximum supply is capped at 1 billion tokens, minted only as needed for allocations
-
Flexible Vesting and Locking: Custom unlock patterns including cliff periods, linear releases, and milestone-based unlocks
-
Airdrop Functionality: Batch-allocate tokens to multiple addresses for airdrops.
-
Manual Unlocking: Perform early unlocks when needed (e.g., exchange listings).
-
Allocation Revocation: Revoke part or all of locked allocations when needed
-
On-Chain Visibility: Transparent vesting schedules with query functions for beneficiaries
-
Emergency Controls: Pause transfers, vault operations, and vesting claims in case of security issues
- Node.js v18+
- npm or yarn
- A wallet with ETH/BASE for contract deployment
- Clone the repository:
git clone https://github.com/spikeyrock/ttn-token.git
cd ttn-token
- Install dependencies:
npm install
- Create a
.env
file based on.env.example
:
cp .env.example .env
- Configure your
.env
file with:- Your wallet's private key
- RPC URLs
- Etherscan API key for verification
Compile the smart contracts:
npx hardhat compile
Run tests to verify contract functionality:
npm test
Deploy the complete token system to Base Goerli testnet:
npm run deploy
After deployment:
- Save the proxy addresses in your
.env
file for future upgrades - Verify the implementation contracts on Basescan
To upgrade contract implementations:
- Make changes to the contract(s) you want to upgrade
- Update your
.env
file with the proxy addresses - Run the upgrade script, specifying which contract to upgrade:
# Upgrade a specific contract (token, vault, or vesting)
npm run upgrade -- token
npm run upgrade -- vault
npm run upgrade -- vesting
# Or upgrade all contracts
npm run upgrade -- all
Verify your contracts on Basescan (after deployment):
# Get all implementation addresses and verification commands
npx hardhat run scripts/verify.ts --network base_goerli
# Then run the verification command for each implementation
npx hardhat verify --network base_goerli IMPLEMENTATION_ADDRESS
- Initial Deployment: Contracts deployed without pre-minting the supply
- Allocation and Vesting: Tokens minted on-demand through the vault
- Locking: Allocated tokens locked under specific vesting schedules
- Unlocking and Claiming: Tokens unlock over time and can be claimed by beneficiaries
- Revocations (if needed): Admins can revoke unvested portions if required
- Visibility and Tracking: Beneficiaries can query their schedules and balances
- Admin roles should be managed carefully
- Consider using multisig wallets for admin operations
- Test thoroughly before deploying to mainnet
- Consider a security audit before mainnet deployment
This project is licensed under the MIT License.