Badger-Finance / gitcoin

Repo for gitcoin hack-a-thons,bonunties and code snippets.
7 stars 0 forks source link

Keeper dashboard #35

Open btcookies opened 2 years ago

btcookies commented 2 years ago

Create user friendly site displaying relevant keeper info for Convex setts. Submissions will differentiate themselves based on the user friendliness and simplicity of the data and display. All Convex setts are harvested and earned using the keeper acl contract via the botsquad keeper address. Currently all transactions are sent via webhook to Discord monitoring channels as they are confirmed. We would like to expand upon this monitoring to better understand performance and cost of the keepers.

Goals for this dashboard are:

Winning submission to receive 150 BADGER. The below are merely suggestions / guidelines, feel free to go above and beyond and restructure if needed. Data visualizations > text and tables.

Keeper Data

then we could translate that into a formulaic way given we know our # of users

Sett Data

Potentially helpful code snippets

List of addresses (should be up to date, can confirm sett addresses on https://app.badger.com)

Example code used by keepers to get most recent harvests from etherscan:

def get_last_harvest_times(
    web3: Web3, keeper_acl: contract, start_block: int = 0, etherscan_key: str = None
):
    """Fetches the latest harvest timestamps of strategies from Etherscan API which occur after `start_block`.
    NOTE: Temporary function until Harvested events are emitted from all strategies.
    Args:
        web3 (Web3): Web3 node instance.
        keeper_acl (contract): Keeper ACL web3 contract instance.
        start_block (int, optional): Minimum block number to start fetching harvest timestamps from. Defaults to 0.
    Returns:
        dict: Dictionary of strategy addresses and their latest harvest timestamps.
    """
    if etherscan_key is None:
        etherscan_key = get_secret("keepers/etherscan", "ETHERSCAN_TOKEN")

    endpoint = "https://api.etherscan.io/api"
    payload = {
        "module": "account",
        "action": "txlist",
        "address": keeper_acl.address,
        "startblock": start_block,
        "endblock": web3.eth.block_number,
        "sort": "desc",
        "apikey": etherscan_key,
    }
    try:
        response = requests.get(endpoint, params=payload)
        response.raise_for_status()  # Raise HTTP errors

        data = response.json()
        times = {}
        for tx in data["result"]:
            if (
                tx["to"] == ""
                or web3.toChecksumAddress(tx["to"]) != keeper_acl.address
                or "input" not in tx
            ):
                continue
            fn, args = keeper_acl.decode_function_input(tx["input"])
            if (
                str(fn)
                in [
                    "<Function harvest(address)>",
                    "<Function harvestNoReturn(address)>",
                ]
                and args["strategy"] not in times
            ):
                times[args["strategy"]] = int(tx["timeStamp"])
        return times
    except (KeyError, requests.HTTPError):
        raise ValueError("Last harvest time couldn't be fetched")
gitcoinbot commented 2 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 150.0 BADGER (4032.0 USD @ $26.88/BADGER) attached to it.

gitcoinbot commented 2 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 150.0 BADGER (4032.0 USD @ $26.88/BADGER) attached to it.

gitcoinbot commented 2 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work has been started.

These users each claimed they can complete the work by 1 week, 6 days from now. Please review their action plans below:

1) namelsking has started work.

I`ll implement this dashboard

Learn more on the Gitcoin Issue Details page.

MitchTODO commented 2 years ago

Is this bounty still available? It was canceled on gitCoin. Is a convex keeper dashboard still needed?