Skip to content

4everland/tokenomics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

4ever Tokenomics API

A Node.js based REST API service for querying token supply data. The service reads tokenomics data in CSV format and provides an interface to query token supply information based on timestamps.

Features

  • Parse and read tokenomics CSV data
  • Query supply by timestamp
  • Return total supply and circulating supply
  • RESTful API design
  • Time-based supply calculation

Installation

Requires Node.js (v14+). To install:

# Clone repository
git clone [repository-url]

# Install dependencies
cd [project-directory]
npm install

Configuration

Environment Variables

The following environment variables can be configured:

  • PORT: The port on which the server will run (default: 3000)
  • CSV_FILE_PATH: Path to the tokenomics CSV file (default: ./tokenomics.csv)

CSV Data Format Requirements

The tokenomics.csv file should contain these columns:

  • Date: Release date (YYYY/MM/DD)
  • Month: Month number
  • Node Rewards: Node rewards allocation
  • Operating Funds: Operating funds allocation
  • Community Funds: Community funds allocation
  • User Rewards: User rewards allocation
  • Initial Liquidity & MM Fund: Initial liquidity and market maker fund
  • Fundraising: Fundraising allocation
  • Core Team & Consultants: Core team and consultants allocation
  • Total: Total supply
  • Circulating Percent: Circulating percentage

Usage

# Start server
npm start

Server will run at http://localhost:3000

API Endpoints

GET /

Query token supply data for a specific timestamp.

Parameters:

  • timestamp (optional): ISO format timestamp, defaults to current time

Example Requests:

# Query current supply
curl http://localhost:3000/

# Query supply for specific time
curl http://localhost:3000/?timestamp=2024-12-12T00:00:00Z

Response Format:

{
  "timestamp": "2024-12-12T00:00:00.000Z",
  "timeRange": "2024/12/12 - 2025/01/12 (Current: 2024/12/12)",
  "totalSupply": 10000000000,
  "circulatingSupply": 800000000,
  "circulatingPercent": 0.08
}

GET /circulatingSupply

Query circulating supply data for a specific timestamp.

Parameters:

  • timestamp (optional): ISO format timestamp, defaults to current time

Example Requests:

# Query current circulating supply
curl http://localhost:3000/circulatingSupply

# Query circulating supply for specific time
curl http://localhost:3000/circulatingSupply?timestamp=2024-12-12T00:00:00Z

Response Format:

800000000

GET /circulatingSupply/json

Query circulating supply data for a specific timestamp and return as JSON.

Parameters:

  • timestamp (optional): ISO format timestamp, defaults to current time

Example Requests:

# Query current circulating supply
curl http://localhost:3000/circulatingSupply/json

# Query circulating supply for specific time
curl http://localhost:3000/circulatingSupply/json?timestamp=2024-12-12T00:00:00Z

Response Format:

{
  "result": 800000000
}

GET /totalSupply

Query total supply data for a specific timestamp.

Parameters:

  • timestamp (optional): ISO format timestamp, defaults to current time

Example Requests:

# Query current total supply
curl http://localhost:3000/totalSupply

# Query total supply for specific time
curl http://localhost:3000/totalSupply?timestamp=2024-12-12T00:00:00Z

Response Format:

10000000000

GET /totalSupply/json

Query total supply data for a specific timestamp and return as JSON.

Parameters:

  • timestamp (optional): ISO format timestamp, defaults to current time

Example Requests:

# Query current total supply
curl http://localhost:3000/totalSupply/json

# Query total supply for specific time
curl http://localhost:3000/totalSupply/json?timestamp=2024-12-12T00:00:00Z

Response Format:

{
  "result": 10000000000
}

Dependencies

  • express: Web framework for creating REST API
  • csv-parser: CSV parsing library for reading tokenomics data
  • moment: Date handling and formatting library
  • web3: Ethereum JavaScript API (currently included but not actively used)

Project Structure

├── index.js          # Main application file
├── package.json      # Project dependencies and scripts
├── tokenomics.csv    # Tokenomics data file
└── README.md         # Project documentation

License

MIT

About

Tokenomics api of 4everland

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published