-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from eth-educators/smoothing-pools
add smoothing pool page
- Loading branch information
Showing
15 changed files
with
499 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Update Data Daily | ||
|
||
on: | ||
schedule: | ||
- cron: '30 */24 * * *' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
update_data: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.x | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install requests | ||
- name: Fetch latest changes | ||
run: | | ||
git fetch origin main | ||
git reset --hard origin/main | ||
- name: Run Python script | ||
run: python _scripts/collect_data.py | ||
|
||
- name: Commit and push changes | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git add * | ||
git diff --quiet && git diff --staged --quiet || (git commit -m "[BOT] Update data" && git push https://${GITHUB_TOKEN}@github.com/${{ github.repository }}.git HEAD:${{ github.ref }}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"smooth":{"id":"smooth","name":"Smooth","link":"https://smooth.dappnode.io/","address":"`0xAdFb8D27671F14f297eE94135e266aAFf8752e35`","fee":"7%","oracles":"3 oracle operators: DAppNode, Giveth & Migalabs","validators":546,"incentives":"Accepts donations - [docs](https://docs.dappnode.io/docs/smooth/deep-dive-into-smooth/rewards)","team":"[DappNode](https://dappnode.com/pages/about)","bond":"0.01 ETH bond","claim_period":"?","audit":"?","launch_date":"Dec 2023","discord":"https://discord.gg/dappnode"},"smoothly":{"id":"smoothly","name":"Smoothly","link":"https://app.smoothly.money/","address":"`0x43670D6f39Bca19EE26462f62339e90A39B01e34`","fee":"1.5%","oracles":"[6 oracle operators](https://docs.smoothly.money/oracle-operators): EthStaker, Anthony Sassano, Aestus Relay, Cryptomanufaktur, Kody, Noah","validators":6,"incentives":"[SLIDE](https://docs.smoothly.money/social-layer-incentives-for-decentralization-slide): Gitcoin Grants & other public goods funding","team":"[Kody Sale](https://warpcast.com/kodys.eth) & [Noah Figueras](https://github.com/noahfigueras)","bond":"[0.5 ETH bond](https://docs.smoothly.money/bond-and-mev-theft)","claim_period":"Every 21 days","audit":"[Pashov, Aug 2023](https://github.com/Smoothly-Protocol/contracts/blob/master/audits/Smoothly-security-review-Pashov-14-8-2023.md)","launch_date":"Jan 2024","discord":"https://discord.gg/7hrV76bKEa"}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
## id = permanent id, used to link validator data | ||
## name = pool name | ||
## link = website link | ||
## address = pool address | ||
## fee = total pool fees | ||
## oracles = list about and members | ||
## validators = number of validators in pool, this is a fallback for live data | ||
## incentives = additional pool incentives | ||
## team = developers/maintainers | ||
## theft_protection = how much bond | ||
## claim_period = how long you have to claim rewards | ||
## audit = link to audits | ||
## launch_date = launch data in "mon yyyy" format (i.e. Dec 2023) | ||
## discord = non-expiring unlimited invite link | ||
|
||
# Template to copy for new entries | ||
# - id: | ||
# name: | ||
# link: | ||
# address: | ||
# fee: | ||
# oracles: | ||
# validators: | ||
# incentives: | ||
# team: | ||
# theft_protection: | ||
# claim_period: | ||
# audit: | ||
# launch_date: | ||
# discord: | ||
|
||
|
||
# Entries are shown in the order listed | ||
smooth: | ||
id: "smooth" | ||
name: "Smooth" | ||
link: "https://smooth.dappnode.io/" | ||
# address: "[0xAdFb8D27671F14f297eE94135e266aAFf8752e35](https://etherscan.io/address/0xAdFb8D27671F14f297eE94135e266aAFf8752e35)" | ||
address: "`0xAdFb8D27671F14f297eE94135e266aAFf8752e35`" | ||
fee: "7%" | ||
oracles: "3 oracle operators: DAppNode, Giveth & Migalabs" | ||
validators: 550 | ||
incentives: "Accepts donations - [docs](https://docs.dappnode.io/docs/smooth/deep-dive-into-smooth/rewards)" | ||
team: "[DappNode](https://dappnode.com/pages/about)" | ||
bond: "0.01 ETH bond" | ||
claim_period: "?" | ||
audit: "?" | ||
launch_date: "Dec 2023" | ||
discord: "https://discord.gg/dappnode" | ||
smoothly: | ||
id: "smoothly" | ||
name: "Smoothly" | ||
link: "https://app.smoothly.money/" | ||
# address: "[0x43670D6f39Bca19EE26462f62339e90A39B01e34](https://etherscan.io/address/0x43670D6f39Bca19EE26462f62339e90A39B01e34)" | ||
address: "`0x43670D6f39Bca19EE26462f62339e90A39B01e34`" | ||
fee: "1.5%" | ||
oracles: "[6 oracle operators](https://docs.smoothly.money/oracle-operators): EthStaker, Anthony Sassano, Aestus Relay, Cryptomanufaktur, Kody, Noah" | ||
validators: 50 | ||
incentives: "[SLIDE](https://docs.smoothly.money/social-layer-incentives-for-decentralization-slide): Gitcoin Grants & other public goods funding" | ||
team: "[Kody Sale](https://warpcast.com/kodys.eth) & [Noah Figueras](https://github.com/noahfigueras)" | ||
bond: "[0.5 ETH bond](https://docs.smoothly.money/bond-and-mev-theft)" | ||
claim_period: "Every 21 days" | ||
audit: "[Pashov, Aug 2023](https://github.com/Smoothly-Protocol/contracts/blob/master/audits/Smoothly-security-review-Pashov-14-8-2023.md)" | ||
launch_date: "Jan 2024" | ||
discord: "https://discord.gg/7hrV76bKEa" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import utilities | ||
from smoothing_pools import update_smoothing_pool_data | ||
|
||
|
||
|
||
def run_app(): | ||
update_smoothing_pool_data() | ||
|
||
|
||
run_app() | ||
print(f"Error count: {utilities.error_count}") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import utilities | ||
import json | ||
|
||
|
||
script_id = "smoothing_pools" | ||
|
||
|
||
|
||
def get_smooth_data(): | ||
if utilities.use_test_data: | ||
response = {'status': 200, 'attempts': 1, 'data': {"total_subscribed_validators":550,"total_active_validators":545,"total_yellowcard_validators":5,"total_redcard_validators":0,"total_banned_validators":6,"total_notsubscribed_validators":42,"latest_checkpoint_slot":8378993,"next_checkpoint_slot":8407793,"total_accumulated_rewards_wei":"5492187571739729067","total_pending_rewards_wei":"26632826481114096934","total_rewards_sent_wei":"28378168778057702925","total_rewards_sent_30days_wei":"21248332054296665781","rewards_per_validator_per_30days_wei":"38633331007812119","total_donations_wei":"5335484726961771065","avg_block_reward_wei":"128408003520623090","total_proposed_blocks":222,"total_missed_blocks":6,"total_wrongfee_blocks":6}} | ||
utilities.log(response, context=f"{script_id}__get_smooth_data") | ||
return response | ||
else: | ||
url = "https://smooth.dappnode.io/api/memory/statistics" | ||
response = utilities.fetch(url, "GET", context=f"{script_id}__get_smooth_data") | ||
return response | ||
|
||
def process_smooth_data(raw_data): | ||
active = raw_data["total_active_validators"] | ||
total = raw_data["total_subscribed_validators"] | ||
print({"source":"smooth", "active":active, "total":total}) | ||
return active | ||
|
||
|
||
|
||
def get_smoothly_data(): | ||
if utilities.use_test_data: | ||
response = {'status': 200, 'attempts': 1, 'data': {"ok":True,"data":{"awaiting_activation":45,"activated":5,"total_rewards":{"type":"BigNumber","hex":"0x0b0663b6a6aed8f2"},"total_stake":{"type":"BigNumber","hex":"0x015af1d78b58c40000"},"total_value_period":{"type":"BigNumber","hex":"0x04a1237d4867696e"},"total_miss":0,"total_fee":0}}} | ||
utilities.log(response, context=f"{script_id}__get_smoothly_data") | ||
return response | ||
else: | ||
url = "https://app.smoothly.money/poolstats" | ||
response = utilities.fetch(url, "GET", context=f"{script_id}__get_smoothly_data") | ||
return response | ||
|
||
def process_smoothly_data(raw_data): | ||
active = raw_data["data"]["activated"] | ||
waiting = raw_data["data"]["awaiting_activation"] | ||
total = active + waiting | ||
print({"source":"smoothly", "active":active, "waiting":waiting, "total":total}) | ||
return active | ||
|
||
|
||
def save_smoothing_pool_data(smooth_subs, smoothly_subs): | ||
smoothing_pool_data = utilities.read_file(f"_data/smoothing-pools.yml", file_type="yaml") | ||
smoothing_pool_data["smooth"]["validators"] = smooth_subs | ||
smoothing_pool_data["smoothly"]["validators"] = smoothly_subs | ||
utilities.save_to_file(f"/_data/smoothing-pools-processed.json", smoothing_pool_data, context=f"{script_id}__save_smoothing_pool_data") | ||
|
||
|
||
|
||
def update_smoothing_pool_data(): | ||
raw_smooth_data = get_smooth_data() | ||
raw_smoothly_data = get_smoothly_data() | ||
if (raw_smooth_data["status"] == 200 and raw_smoothly_data["status"] == 200): | ||
smooth_subs = process_smooth_data(raw_smooth_data["data"]) | ||
smoothly_subs = process_smoothly_data(raw_smoothly_data["data"]) | ||
save_smoothing_pool_data(smooth_subs, smoothly_subs) | ||
else: | ||
error = f"Bad response" | ||
utilities.log(f"{error}: {metric_id}_{data_source}") | ||
utilities.report_error(error, context=f"{script_id}__update_smoothing_pool_data") | ||
return | ||
|
Oops, something went wrong.