Badger utils and shared code
Project description
badger-utils library
This is the library for all badger utils that were moved from badger-system repo.
Build | Coverage |
---|---|
Features and Utils
Current state of library and components and what was moved from badger-system repo:
Systems:
- AaveSystem
- SushiSwapSystem
- CompoundSystem
Utils:
- Registry
- Proxy utils
- Coingecko utils
- Network manager
- Time utils
- Token utils
- Digg utils
- txTimer utility
- Full constants module
- Different misc functions
Testing Tools:
distribute_from_whales
and some other balance calculation functions
Requirements
To make use of library you would need some interfaces and contracts to be compiled and injected by brownie into your brownie project. List of required interfaces can be found here
You also need some contracts to be compiled as well:
ForceEther, SafeMath, Token
Please, not that it can all be copied from
Installing library
pip install badger-utils
Using library
Giving some examples on library usage:
Using coingecko utils:
from badger_utils.coingecko_utils import fetch_usd_price
some_erc_token = interface.IERC20(Token)
usd_price = fetch_usd_price(some_erc_token.address)
Using network utils
from badger_utils.network_manager import network_manager
network = network_manager.get_active_network()
badger_deploy_file = network_manager.get_active_network_badger_deploy()
Using proxy utils
from badger_utils.proxy_utils import deploy_proxy_admin
from brownie import accounts
contract = deploy_proxy_admin(accounts[0])
assert contract.address is not None
Using token utils
import token # some deployed token
from brownie import accounts
from badger_utils.token_utils import distribute_from_whales
token.transfer(
"0x19d099670a21bC0a8211a89B84cEdF59AbB4377F", 100000, {'from': accounts[0]}
)
distribute_from_whales(accounts[1], percentage=0.8)
Using constants
from badger_utils.constants import AddressZero
from badger_utils.constants import TOKEN_LOCKER_ROLE
from badger_utils.constants import ContractSystems
Using tx timer
from badger_utils.tx_timer import tx_timer
from brownie import accounts
tx_timer.prepare_timer(accounts[0], "Harvest")
tx_timer.start_timer(accounts[0], 'Harvest')
tx_timer.end_timer()
Using artifacts
from badger_utils.registry.artifacts import artifacts
timelock_abi = artifacts.open_zeppelin["TokenTimelock"]["abi"]
Using registries
from brownie import web3
from badger_utils.registry import registry
checksummed = web3.toChecksumAddress(registry.tokens.wbtc)
Using systems
from badger_utils.systems import SushiswapSystem
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
badger-utils-0.0.5.tar.gz
(20.5 kB
view hashes)
Built Distribution
Close
Hashes for badger_utils-0.0.5-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fd59813c389cd41d556482610b4091b864d02745838d12cc6ce0691e2f4bf8b |
|
MD5 | 52c610ebe2717be9280a854ac1e69cef |
|
BLAKE2b-256 | aa22ecf1966c4f8f6b2faa3e48449b5a0498c05caf169aad8f79380bfd23106e |