Skip to content

Commit

Permalink
README and some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
EugenWay committed Sep 4, 2023
1 parent c5573bf commit 4a2d052
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 413 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Vara Network Economic Parameters

Welcome to the Vara Network Economic Parameters repository. Here, you will find methods for retrieving crucial economic data related to the Vara Network, including:

- Total Token Supply
- Total Amount of Tokens Burned from the Inflation Pool
- Total Circulating Supply

## Overview

Vara Network is a decentralized blockchain network with a unique economic model. To understand the details of this economic model, please refer to our [Tokenomics Documentation](https://wiki.vara-network.io/docs/tokenomics/).

**API Endpoints**
To obtain these parameters programmatically, you can use the following API endpoints:

1. Total Tokens Burned
Use this endpoint to retrieve information about tokens burned from the inflation pool.

Endpoint: `/api/burned`

2. Total Token Supply
This endpoint provides data on the total token supply of Vara Network.

Endpoint: `/api/total`

3. Total Circulating Supply
Get the current circulating supply of tokens on Vara Network using this endpoint.

Endpoint: `/api/circulation`
4 changes: 4 additions & 0 deletions src/calculators/circulation-supply.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ async function getKeys(prefix) {
return result;
}

// Get all vested tokens from the chain
async function vestingTotal() {
const prefix = api.query.vesting.vesting.keyPrefix();
const keys = await getKeys(prefix);
Expand All @@ -40,10 +41,13 @@ async function vestingTotal() {
return Number(totalVesting);
}

// Get all pool addresses
// Each pool additionally has 10 derived accounts (indexes from 1 to 10)
function getPoolAddresses(poolAddr) {
return [poolAddr, ...deriveAddr(poolAddr)];
}

// Circulation Supply = Total Supply - (Vesting + Pools);
export async function circulationSupply() {
const addresses = [
...getPoolAddresses(MARKETING_POOL),
Expand Down
2 changes: 1 addition & 1 deletion src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const app = express();

app.use(cors());

app.get('/burnt', async (req, res) => {
app.get('/burned', async (req, res) => {
tokensSentFromInflationPool()
.then((result) => res.json(result))
.catch((err) => {
Expand Down
Loading

0 comments on commit 4a2d052

Please sign in to comment.