Skip to main content

Badger SDK for autovoters

This is the library for shared code that is used in autovoters, such as cvx autovoter and aura autovoter

Build Coverage PYPI
Tests codecov PyPI version

List of functional modules:

Utilities


Get web3 instance

import os
from badger_voter_sdk.web3 import get_web3

web3 = get_web3(os.getenv("ETHNODEURL"))

Or web3 will be created from default secrets in constants.py

AWS get secret

Getting secret from AWS by id and key

from badger_voter_sdk.aws import get_secret

secret = get_secret(secret_id="SecretId", secret_key="SecretKey")

Json logger

Preconfigured json logger to be shared across voting bots projects

from badger_voter_sdk.json_logger import logger

logger.info()

Snapshot and data collectors

Get all voters for snapshot

from badger_voter_sdk.collectors.snapshot_collectors import get_voters

voters = get_voters(snapshot_id="some_snapshot_id")

Get vlTOKEN amounts per wallet voted for given snapshot round

from badger_voter_sdk.collectors.api_collectors import get_scores

scores = get_scores(
    "aurafinance.eth", "1", "<SNAPSHOT_ID>",
    ["<ADDRESS1>"],
    [{'name': "erc20-votes", 'network': "1", 'params': {
        'symbol': "<vlTOKEN>", 'address': "<STRATEGY_ADDR>"}}]
)

Get voting choices with voting power

You need to combine two previous functions outputs:

from badger_voter_sdk.collectors.data_processors import extract_voting_power_per_pool

choices_with_votes = extract_voting_power_per_pool(voters={"<wallet>": {"1": 123}}, scores={"<wallet>": 123333.1})

Metadata

Release files for badger-voter-sdk 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for badger-voter-sdk 0.1.3
File Size Uploaded Provenance Actions
badger-voter-sdk-0.1.3.tar.gz 11.0 kB Without provenance Details for badger-voter-sdk-0.1.3.tar.gz

Release files / badger-voter-sdk-0.1.3.tar.gz

Download URL badger-voter-sdk-0.1.3.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
3b72048d55455208eed79b1bf5c3a8727615c528ee1be600ec5385fe5403ef9a
BLAKE2b-256 checksum
How to use checksums
636082e04452ca67de13f6a03ea69d1989f214037a049ac060146cf5b447e889
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Security for badger-voter-sdk 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page