This is the library for shared code that is used in autovoters, such as cvx autovoter and aura autovoter
Build | Coverage | PYPI |
---|---|---|
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
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")
Preconfigured json logger to be shared across voting bots projects
from badger_voter_sdk.json_logger import logger
logger.info()
from badger_voter_sdk.collectors.snapshot_collectors import get_voters
voters = get_voters(snapshot_id="some_snapshot_id")
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>"}}]
)
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})