Skip to content

Commit

Permalink
Update DVPN Price Config for automatica minimum gigabyte and hourly p…
Browse files Browse the repository at this point in the history
…rices in config.toml for node runners
  • Loading branch information
freQniK committed Oct 5, 2023
1 parent e0acd9f commit 70fbd12
Show file tree
Hide file tree
Showing 15 changed files with 1,453 additions and 1,362 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/tg-notify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: tg-notify
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Update status
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: | #https://help.github.com/en/actions/reference/contexts-and-expression-syntax-for-github-actions#github-context
${{ github.actor }} created commit:
Commit message: ${{ github.event.head_commit.message }}
Repository: ${{ github.repository }}
Branch: ${{ github.ref_name }}
See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}}
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

# v0.4.0 (October, 2023)
* NEW: Min price feed from remote API
* NEW: Set hourly price

# v0.3.0 (November, 2022)
* NEW: First binary release

# v0.2.0 (August, 2022)
* FIX: stable build

# v0.1.0 (June, 2022)
* Initial launch
65 changes: 29 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,74 +1,67 @@
# dvpn_price
Update Sentinel DVPN Node Prices with Market Changes
Update Sentinel DVPN Node Prices with Market Changes including IBC coin prices based on TWAP (Time Weighted Average Price). Updates the `config.toml` for hourly and gigabyte prices based on this average and user specified price.

## Note

This is for dVPN node versions 0.3.2
This is for dVPN node versions 0.7.0

# Install (binary)

Download the latest version of **dvpn_price** from our the releases page.


Download the latest version of [dvpn_price](https://github.com/freQniK/dvpn_price/releases/download/v0.4.0/dvpn_price) from the releases page.

# Install (source)
```shell
sudo apt install python3-pip
sudo pip install toml pycoingecko
```

## Note
It is no longer necessary to edit the file as we have provided command line arguments for the configuration. Please see below.

# Run

## Source
Then run from source:

```shell
$ sudo python3 dvpn_price.py --help
usage: dvpn_price.py [-h] [-t twap] [-p price] [-u user]

dVPN Price Oracle for dVPN Node operators v0.3.2

optional arguments:
-h, --help show this help message and exit
-t twap, --twap twap Time Weighted Average Price. --twap days
-p price, --price price
Set the price per GB you would like to charge in USD.
i.e., --price 0.005
-u user, --user user Set the base directory where .sentinelnode/ exists
i.e., --user dvpn - implies (/home/dvpn/.sentinelnode)

sudo ./dvpn_price.py -h
```

Where **days** in `--twap` is the number of days to average a price over based on market price of the coin for each previous day.

## Binary
# Run

```shell
$ sudo dvpn_price --help
usage: dvpn_price [-h] [-t twap] [-p price] [-u user]
$ sudo python3 dvpn_price -h
dVPN Price Oracle for dVPN Node operators v0.4.0 - freQniK

dVPN Price Oracle for dVPN Node operators v0.3.2

usage: dvpn_price.py [-h] [-t days] [-p price] [-q hprice] [-u user]

dVPN Price Oracle for dVPN Node operators v0.4.0 - freQniK

optional arguments:
-h, --help show this help message and exit
-t twap, --twap twap Time Weighted Average Price. --twap days
-p price, --price price
-t days, --twap days Time Weighted Average Price.
-p price, --price-gb price
Set the price per GB you would like to charge in USD.
i.e., --price 0.005
-q hprice, --price-hr hprice
Set the price per hour you would like to charge in
USD. i.e., --price 0.005
-u user, --user user Set the base directory where .sentinelnode/ exists
i.e., --user dvpn - implies (/home/dvpn/.sentinelnode)

```

Where **days** in `--twap` is the number of days to average a price over based on market price of the coin for each previous day.

i.e.,
`-p/--price-gb 0.008` - $0.008/GB
`-q/--price-hr 0.004` - $0.004/hr
`-t/--twap 7` - Average all IBC and DVPN prices over 7 days

## Example
```shell
sudo dvpn_price --twap 10 --price 0.001 --user sentinel
sudo dvpn_price --twap 7 --price-gb 0.008 --price-hr 0.005 --user sentinel
```

This will average the price of *OSMO, SCRT, ATOM, DEC, DVPN* over the last 10 days. It will set a price of *$0.001/GB* and change the **config.toml** in the directory `/home/sentinel/.sentinelnode/config.toml`
This will average the price of *OSMO, SCRT, ATOM, DEC, DVPN* over the last 7 days. It will set a price of *$0.008/GB* and *$0.005/hr* and change the **config.toml** in the directory `/home/sentinel/.sentinelnode/config.toml`

### Note
Be sure to run this as `sudo` as the config directory is root permissions only.

## Cronjob
You can also create a cronjob (as root) to have this run every week, every month, every day, every hour, every minute. Just be sure to restart your node eventually for the changes to take place.
Expand All @@ -80,7 +73,7 @@ sudo crontab -e

Place the following line at the bottom of the file:
```
59 12 * * * /home/sentinel/Scripts/dvpn_price --twap 14 --price 0.003 --user sentinel
59 12 * * * /home/sentinel/Scripts/dvpn_price --twap 7 --price-gb 0.008 --price-hr 0.005 --user sentinel
```

This will update your sentinel node **config.toml** every day at 12:59 p.m.
Expand Down
Loading

0 comments on commit 70fbd12

Please sign in to comment.