This repository contains Solidity contracts designed for the Retok token ecosystem. It includes implementations for restricted tokens, income distribution mechanisms, and additional utilities to enhance token functionality.
- Whitelist Token: Implements the ERC1404 standard for restricted tokens, enabling compliance with specific rules and regulations.
- Income Distribution: Contracts to distribute income (in any ERC20-compatible token) to token holders based on their balances.
- Snapshot Token: Provides snapshot functionality for capturing token balances at specific points in time.
-
WhitelistToken:
- An ERC1404-compliant token with built-in transfer restrictions.
- Allows controlled token transfer to comply with whitelist rules.
-
Distributor:
- Handles income distribution to
WhitelistToken
holders. - Supports arbitrary ERC20 tokens as income.
- Handles income distribution to
-
SnapshotToken:
- Extends ERC20 to provide snapshot functionality.
- Captures balances at specific block numbers for analytics or distribution.
-
PythSwap:
- A specialized utility for managing token swaps and liquidity.
-
Mock Contracts:
MockDistributor
andMockSnapshotToken
for testing purposes.
To set up the development environment, ensure you have the following tools:
- Node.js (v16 or later)
- Hardhat (for compiling and testing contracts)
- A compatible Ethereum wallet (e.g., MetaMask) for deployment.
-
Clone the repository:
git clone https://github.com/yourusername/retok-token.git cd retok-token
-
Install dependencies:
npm install
-
Compile contracts:
npx hardhat compile
-
Run tests:
npx hardhat test
To deploy the contracts, update the hardhat.config.js
file with your network and private key details, then use the following command:
npx hardhat run scripts/deploy.js --network <network_name>
Replace <network_name>
with the desired network, e.g., mainnet
, rinkeby
, or fuji
.
Deploy the WhitelistToken
contract to enable restricted token transfers. Example setup:
const WhitelistToken = await ethers.getContractFactory("WhitelistToken");
const token = await WhitelistToken.deploy("Retok", "RTK", 18);
await token.deployed();
console.log("WhitelistToken deployed to:", token.address);
Deploy the Distributor
contract and link it to your WhitelistToken
:
const Distributor = await ethers.getContractFactory("Distributor");
const distributor = await Distributor.deploy(token.address, incomeToken.address);
await distributor.deployed();
console.log("Distributor deployed to:", distributor.address);
Use SnapshotToken
to capture token balances at specific points:
await snapshotToken.snapshot();
This repository also includes pre-configured token lists for integration:
retok.tokenlist.json
retok-fuji.tokenlist.json
Contributions are welcome! To contribute:
- Fork the repository.
- Create a feature branch.
- Submit a pull request with detailed explanations.
This project is licensed under the MIT License. See the LICENSE.txt file for more details.
Built with OpenZeppelin for secure and reliable smart contract development.