Skip to content

Solidity contracts for Retok Token and distribution

Notifications You must be signed in to change notification settings

hstake/retok-token

Repository files navigation

Solidity Contracts for Retok Tokens

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.

Features

  • 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.

Contracts Overview

  1. WhitelistToken:

    • An ERC1404-compliant token with built-in transfer restrictions.
    • Allows controlled token transfer to comply with whitelist rules.
  2. Distributor:

    • Handles income distribution to WhitelistToken holders.
    • Supports arbitrary ERC20 tokens as income.
  3. SnapshotToken:

    • Extends ERC20 to provide snapshot functionality.
    • Captures balances at specific block numbers for analytics or distribution.
  4. PythSwap:

    • A specialized utility for managing token swaps and liquidity.
  5. Mock Contracts:

    • MockDistributor and MockSnapshotToken for testing purposes.

Installation

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.

Steps:

  1. Clone the repository:

    git clone https://github.com/yourusername/retok-token.git
    cd retok-token
  2. Install dependencies:

    npm install
  3. Compile contracts:

    npx hardhat compile
  4. Run tests:

    npx hardhat test

Deployment

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.

Usage

Setting Up Whitelist Tokens

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);

Income Distribution

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);

Snapshot Functionality

Use SnapshotToken to capture token balances at specific points:

await snapshotToken.snapshot();

Token Lists

This repository also includes pre-configured token lists for integration:

  • retok.tokenlist.json
  • retok-fuji.tokenlist.json

Contributing

Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Create a feature branch.
  3. Submit a pull request with detailed explanations.

License

This project is licensed under the MIT License. See the LICENSE.txt file for more details.

Acknowledgments

Built with OpenZeppelin for secure and reliable smart contract development.

About

Solidity contracts for Retok Token and distribution

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published