Metadata-Version: 2.1
Name: badger-utils
Version: 0.0.5
Summary: Badger utils and shared code
Home-page: https://github.com/SHAKOTN/badger-utils
Author: Andrii Kulikov
Author-email: blaynemono@gmail.com
License: MIT
Keywords: badger-utils
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.6,<4
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: apipkg (==1.5)
Requires-Dist: appdirs (==1.4.4)
Requires-Dist: asttokens (==2.0.4)
Requires-Dist: attrs (==20.3.0)
Requires-Dist: base58 (==2.1.0)
Requires-Dist: bitarray (==1.2.2)
Requires-Dist: black (==20.8b1)
Requires-Dist: certifi (==2020.12.5)
Requires-Dist: chardet (==4.0.0)
Requires-Dist: dotmap (==1.3.23)
Requires-Dist: click (==7.1.2)
Requires-Dist: cytoolz (==0.11.0)
Requires-Dist: eth-abi (==2.1.1)
Requires-Dist: eth-account (==0.5.4)
Requires-Dist: eth-brownie (==1.14.6)
Requires-Dist: eth-event (==1.2.3)
Requires-Dist: eth-hash (==0.3.1)
Requires-Dist: eth-keyfile (==0.5.1)
Requires-Dist: eth-keys (==0.3.3)
Requires-Dist: eth-rlp (==0.2.1)
Requires-Dist: eth-typing (==2.2.2)
Requires-Dist: eth-utils (==1.10.0)
Requires-Dist: execnet (==1.8.0)
Requires-Dist: hexbytes (==0.2.1)
Requires-Dist: hypothesis (==6.10.0)
Requires-Dist: idna (==2.10)
Requires-Dist: inflection (==0.5.0)
Requires-Dist: iniconfig (==1.1.1)
Requires-Dist: ipfshttpclient (==0.7.0a1)
Requires-Dist: jsonschema (==3.2.0)
Requires-Dist: lru-dict (==1.1.7)
Requires-Dist: multiaddr (==0.0.9)
Requires-Dist: mypy-extensions (==0.4.3)
Requires-Dist: mythx-models (==1.9.1)
Requires-Dist: netaddr (==0.8.0)
Requires-Dist: packaging (==20.9)
Requires-Dist: parsimonious (==0.8.1)
Requires-Dist: pathspec (==0.8.1)
Requires-Dist: pluggy (==0.13.1)
Requires-Dist: prompt-toolkit (==3.0.18)
Requires-Dist: protobuf (==3.15.8)
Requires-Dist: psutil (==5.8.0)
Requires-Dist: py (==1.10.0)
Requires-Dist: py-solc-ast (==1.2.8)
Requires-Dist: py-solc-x (==1.1.0)
Requires-Dist: pycryptodome (==3.10.1)
Requires-Dist: Pygments (==2.8.1)
Requires-Dist: pygments-lexer-solidity (==0.7.0)
Requires-Dist: PyJWT (==1.7.1)
Requires-Dist: pyparsing (==2.4.7)
Requires-Dist: pyrsistent (==0.17.3)
Requires-Dist: pytest (==6.2.3)
Requires-Dist: pytest-forked (==1.3.0)
Requires-Dist: pytest-xdist (==1.34.0)
Requires-Dist: python-dateutil (==2.8.1)
Requires-Dist: python-dotenv (==0.16.0)
Requires-Dist: pythx (==1.6.1)
Requires-Dist: PyYAML (==5.4.1)
Requires-Dist: regex (==2021.4.4)
Requires-Dist: requests (==2.25.1)
Requires-Dist: rlp (==1.2.0)
Requires-Dist: semantic-version (==2.8.5)
Requires-Dist: six (==1.15.0)
Requires-Dist: sortedcontainers (==2.3.0)
Requires-Dist: toml (==0.10.2)
Requires-Dist: toolz (==0.11.1)
Requires-Dist: tqdm (==4.60.0)
Requires-Dist: typed-ast (==1.4.3)
Requires-Dist: typing-extensions (==3.7.4.3)
Requires-Dist: urllib3 (==1.26.4)
Requires-Dist: varint (==1.0.2)
Requires-Dist: vvm (==0.1.0)
Requires-Dist: vyper (==0.2.12)
Requires-Dist: wcwidth (==0.2.5)
Requires-Dist: web3 (==5.18.0)
Requires-Dist: websockets (==8.1)

# badger-utils library

This is the library for all badger utils that were moved from [badger-system](https://github.com/Badger-Finance/badger-system) repo.

| Build  | Coverage |
| ------------- | ------------- |
| [![Tests](https://github.com/SHAKOTN/badger-utils/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/SHAKOTN/badger-utils/actions/workflows/main.yml) | [![codecov](https://codecov.io/gh/SHAKOTN/badger-utils/branch/master/graph/badge.svg?token=210VN0EJ90)](https://codecov.io/gh/SHAKOTN/badger-utils)  |

---

## Features and Utils
**Current state** of library and components and what was moved from [badger-system repo](https://github.com/Badger-Finance/badger-system):
### Systems:
1. AaveSystem
2. SushiSwapSystem
3. CompoundSystem

### Utils:
1. Registry
2. Proxy utils
3. Coingecko utils
4. Network manager
5. Time utils
6. Token utils
7. Digg utils
8. txTimer utility
9. Full constants module
10. 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](https://eth-brownie.readthedocs.io/en/stable/compile.html) 
and injected by brownie into your brownie project.
List of required interfaces can be found [here](https://github.com/SHAKOTN/badger-utils/tree/master/interfaces)

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:
```python
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
```python
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
```python
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
```python
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
```python
from badger_utils.constants import AddressZero
from badger_utils.constants import TOKEN_LOCKER_ROLE
from badger_utils.constants import ContractSystems
```

### Using tx timer
```python
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
```python
from badger_utils.registry.artifacts import artifacts

timelock_abi = artifacts.open_zeppelin["TokenTimelock"]["abi"]
```

### Using registries
```python
from brownie import web3
from badger_utils.registry import registry

checksummed = web3.toChecksumAddress(registry.tokens.wbtc)
```

### Using systems
```python
from badger_utils.systems import SushiswapSystem
```

