DHK dao airdrop scripts
Project description
DHK Tokens Airdrop Scripts
A Python script to retrieve historical token prices and compute DHK tokens to distribute out each month.
Output example
The key output is the table at the bottom. It can also be exported as csv or json.
It is fine to see error messages as above saying unable to fetch price and staking apr for some tokens, as they may not be popular enough or not indexed by the service providers we used.
Usage
pip install dhkdao-airdrop
# Get help
dhkdao-airdrop --help
# Run script with api keys set in config.json
dhkdao-airdrop config.json -o output -t type
# Run script with api keys set in env vars
CRYPTOCOMPARE_APIKEY="cc-apikey" MINTSCAN_APIKEY="ms-apikey" dhkdao-airdrop config.json -o output -t type
Options:
-o
: Output file path. If skipped, output is printed on screen.-t
: [table|csv|json]. Output type.
You can have api keys set in the input config file or env var. Env vars will override the one set in config file.
Input Config
An input config example is follows.
{
"dhk_distribution": 100000,
"reference_date": "2024-08-27",
"tokens": [
{ "token": "AKT", "network": "akash", "qty": 188787 },
{ "token": "ATOM", "network": "cosmos", "qty": 592015 }
],
"apis": {
"cryptocompare": {
"endpoint": "https://min-api.cryptocompare.com/data/pricehistorical",
"apikey": "cryptocompare-123456"
},
"mintscan": {
"endpoint": "https://apis.mintscan.io/v1/:network/apr",
"apikey": "mintscan-123456"
}
}
}
-
The config used to run for 2024 Sep output is shown here, with the two
apikey
values redacted. -
Most of the time, you only need to change the
reference_date
and the content insidetokens
, after you have set the twoapikey
values correctly. -
For each token inside
tokens
, you also need to provide anetwork
value, which is different from the token name. This is required by Cosmostation API. If an incorrect network value is provided, the staking APR will not be fetched. You can test the network value in the API panel provided by the link above. Another way is going to Mintscan and search for the token/network, the white label underneath it, as circled below, is the network value used in Cosmostation. -
If you couldn't get a network staking APR from Mintscan API but know it somewhere, you can set
{..., "staking-apr": 0.xxx}
manually. This will prevent the script from fetching it from Cosmostation.Same principle goes that if you couldn't get a token price from Cyptocompare API but know it somewhere, you can set
{..., "price": xx.xxx }
manually. This will override the token price.An example is here.
Data Sources
- Token price: https://www.cryptocompare.com/
- Staking APR: https://www.mintscan.io/ (operated by Cosmostation)
- DHK airdrop template master speadsheet
Development
# sync all the dependencies
pdm sync -d
# show the help text
pdm exe --help
# Run the regular command
pdm exe input.json -o output -t json
# Run test cases with no output capture
pdm test:no-capture
Please copy .env.example
over to .env
and fills in the API_KEYs inside before running pdm test
. Otherwise, tests expected to pass will fail.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file dhkdao_airdrop-0.1.0.tar.gz
.
File metadata
- Download URL: dhkdao_airdrop-0.1.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.19.1 CPython/3.11.4 Darwin/23.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4c20ab39a6bfcb52945417f91a881a67fd8d9867ff15855ec2607d207a613b5 |
|
MD5 | 2b13d71c91ac380221536d1889b68426 |
|
BLAKE2b-256 | 6fe85a6f422851ad9064cf543faa2c46c649b432dbd5dbb9670dc5ef6cab5631 |
File details
Details for the file dhkdao_airdrop-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: dhkdao_airdrop-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.19.1 CPython/3.11.4 Darwin/23.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 860dd32927881e17d984aa06121d44741cd21698a1e2dab631481687c410e1e4 |
|
MD5 | b9a4db1947d2b52ba6b1288874829750 |
|
BLAKE2b-256 | 7dfff8a67816c99eb3787ee4f0f89c81e8dd0a6c3c44342ec385541cd09d2f4b |