Skip to content

Commit

Permalink
Merge pull request #74 from eth-educators/smoothing-pools
Browse files Browse the repository at this point in the history
add smoothing pool page
  • Loading branch information
hanniabu authored Feb 15, 2024
2 parents 3543a73 + 4626283 commit 753a986
Show file tree
Hide file tree
Showing 15 changed files with 499 additions and 76 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/update_data_daily.yml
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 }})
1 change: 1 addition & 0 deletions _data/smoothing-pools-processed.json
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"}}
65 changes: 65 additions & 0 deletions _data/smoothing-pools.yml
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"
16 changes: 9 additions & 7 deletions _includes/js/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ document.querySelectorAll("table")
// Wrap tables in .table-responsive element
document.querySelectorAll("table")
.forEach( x=> {
// Create wrapping element
let wrapper = document.createElement('div');
wrapper.className = "table-responsive mx-auto";
// Insert wrapper before el in the DOM tree
x.parentNode.insertBefore(wrapper, x);
// Move el into wrapper
wrapper.appendChild(x);
if (!x.classList.contains("nonresponsive")) {
// Create wrapping element
let wrapper = document.createElement('div');
wrapper.className = "table-responsive mx-auto";
// Insert wrapper before el in the DOM tree
x.parentNode.insertBefore(wrapper, x);
// Move el into wrapper
wrapper.appendChild(x);
}
});

// Add copy links to headers
Expand Down
20 changes: 0 additions & 20 deletions _includes/partials/content/index/events.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,3 @@
<style type="text/css">
#events .videowrapper {
float: none;
clear: both;
width: 100%;
position: relative;
padding-bottom: 56.25%;
padding-top: 25px;
height: 0;
}
#events .videowrapper iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
</style>


<!-- Events -->
<section id="events" class="">
<div class="container my-3 my-md-0 my-lg-4 p-4 py-md-5">
Expand Down
48 changes: 0 additions & 48 deletions _includes/partials/content/mev-relay-list.html

This file was deleted.

1 change: 1 addition & 0 deletions _includes/partials/content/support/support-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ everything else is pulled from _data/clients.yml
</style>


{:class="nonresponsive"}
Community | Docs | Support
-----------|------|----------
<img class='d-inline logo m-0 me-2' src='/assets/img/projects/ethstaker.svg'> EthStaker | [{{site.data.icons.docs}}](https://kb.ethstaker.cc) | [Discord](https://dsc.gg/ethstaker) , [Reddit](https://reddit.com/r/ethstaker)
Expand Down
Empty file added _scripts/.env
Empty file.
12 changes: 12 additions & 0 deletions _scripts/collect_data.py
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}")

65 changes: 65 additions & 0 deletions _scripts/smoothing_pools.py
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

Loading

0 comments on commit 753a986

Please sign in to comment.