summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-06-20 06:57:23 +0000
committerCoprDistGit <infra@openeuler.org>2023-06-20 06:57:23 +0000
commit30b6e8c261d594465d6259bb606475c6188f1377 (patch)
treee232132650b6177066d96c30da2b53b520a104e8
parent443481a980770d43cd1d3e16567211fc12e6fb4a (diff)
automatic import of python-badger-utilsopeneuler20.03
-rw-r--r--.gitignore1
-rw-r--r--python-badger-utils.spec508
-rw-r--r--sources1
3 files changed, 510 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..a8048fb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/badger-utils-0.2.5.tar.gz
diff --git a/python-badger-utils.spec b/python-badger-utils.spec
new file mode 100644
index 0000000..cd7c12d
--- /dev/null
+++ b/python-badger-utils.spec
@@ -0,0 +1,508 @@
+%global _empty_manifest_terminate_build 0
+Name: python-badger-utils
+Version: 0.2.5
+Release: 1
+Summary: Badger utils and shared code
+License: MIT
+URL: https://github.com/SHAKOTN/badger-utils
+Source0: https://mirrors.aliyun.com/pypi/web/packages/8e/72/c2d794d20fee6fdbcd596595b6e0acb24ff88b508e8df821ee008cf2e0e9/badger-utils-0.2.5.tar.gz
+BuildArch: noarch
+
+Requires: python3-dotmap
+Requires: python3-eth-brownie
+Requires: python3-numpy
+Requires: python3-elasticsearch
+
+%description
+## 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, BadgerRegistry
+```
+## Installing library
+`pip install badger-utils`
+## To run tests:
+```
+$ virtualenv venv
+$ source venv/bin/activate
+$ make
+$ brownie test
+```
+## Using library
+- [Coingecko Utils](#using-coingecko-utils)
+- [Gas utils module](#using-gas_utils-module)
+- [Network utils](#using-network-utils)
+- [Proxy utils](#using-proxy-utils)
+- [Distribute from whales realtime](#using-distribute-from-whales-realtime)
+- [Distribute from whales realtime with exact amount](#using-distribute-from-whales-realtime-with-exact-amount)
+- [Token utils](#using-token-utils)
+- [Constants](#using-constants)
+- [Tx timer](#using-tx-timer)
+- [Artifacts](#using-artifacts)
+- [Local registry](#locally-defined-registry)
+- [On chain registry](#on-chain-registry)
+- [Systems](#using-systems)
+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 gas_utils module
+```python
+from badger_utils.gas_utils import GasStrategies
+# Class initialization will initialize everything and fetch gas prices
+strategies = GasStrategies()
+price = strategies.optimal_price()
+# check gas cost:
+strategies.gas_cost(gas_estimate=21000)
+# Set default strategy:
+strategies.set_default_for_active_chain()
+```
+**NOTE:** If you want to use Anyblock historical data in gas analysis, consider adding auth keys
+from anyblock account:
+```shell
+export ANYBLOCK_EMAIL=email@gmail.com
+export ANYBLOCK_KEY=<YOU ANYBLOCK API KEY>
+```
+otherwise `def analyze_gas` function will always return static data:
+```python
+DotMap(mode=999999999999999999, median=999999999999999999, std=999999999999999999)
+```
+### 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 distribute from whales realtime with percentage
+If you want to use some other Ethplorer key to fetch whales, set env variable: ETHPLORER_API_KEY
+```shell
+export ETHPLORER_API_KEY=<API_KEY>
+```
+Otherwise, ethplorer key will be used by default, which is a bit slow
+```python
+import token # some deployed token
+from brownie import accounts
+from badger_utils.token_utils.distribute_from_whales_realtime import distribute_from_whales_realtime_percentage
+token.transfer(
+ "0x19d099670a21bC0a8211a89B84cEdF59AbB4377F", 100000, {'from': accounts[0]}
+)
+distribute_from_whales_realtime_percentage(accounts[1], percentage=0.8)
+```
+### Using distribute from whales realtime with exact amount
+```python
+import token # some deployed token
+from brownie import accounts
+from badger_utils.token_utils.distribute_from_whales_realtime import distribute_from_whales_realtime_exact
+token.transfer(
+ "0x19d099670a21bC0a8211a89B84cEdF59AbB4377F", 100000, {'from': accounts[0]}
+)
+distribute_from_whales_realtime_exact(accounts[1], amount=123)
+```
+### Using token utils
+**LEGACY**. Consider using `distribute_from_whales_realtime` module
+```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
+### On chain registry
+```python
+from badger_utils.registry import chain_registries
+chain_registries.initialize()
+chain_registries.get("badgerTree")
+```
+### Locally defined registry
+**NOTE:** This is legacy way of working with 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
+```
+
+%package -n python3-badger-utils
+Summary: Badger utils and shared code
+Provides: python-badger-utils
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-badger-utils
+## 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, BadgerRegistry
+```
+## Installing library
+`pip install badger-utils`
+## To run tests:
+```
+$ virtualenv venv
+$ source venv/bin/activate
+$ make
+$ brownie test
+```
+## Using library
+- [Coingecko Utils](#using-coingecko-utils)
+- [Gas utils module](#using-gas_utils-module)
+- [Network utils](#using-network-utils)
+- [Proxy utils](#using-proxy-utils)
+- [Distribute from whales realtime](#using-distribute-from-whales-realtime)
+- [Distribute from whales realtime with exact amount](#using-distribute-from-whales-realtime-with-exact-amount)
+- [Token utils](#using-token-utils)
+- [Constants](#using-constants)
+- [Tx timer](#using-tx-timer)
+- [Artifacts](#using-artifacts)
+- [Local registry](#locally-defined-registry)
+- [On chain registry](#on-chain-registry)
+- [Systems](#using-systems)
+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 gas_utils module
+```python
+from badger_utils.gas_utils import GasStrategies
+# Class initialization will initialize everything and fetch gas prices
+strategies = GasStrategies()
+price = strategies.optimal_price()
+# check gas cost:
+strategies.gas_cost(gas_estimate=21000)
+# Set default strategy:
+strategies.set_default_for_active_chain()
+```
+**NOTE:** If you want to use Anyblock historical data in gas analysis, consider adding auth keys
+from anyblock account:
+```shell
+export ANYBLOCK_EMAIL=email@gmail.com
+export ANYBLOCK_KEY=<YOU ANYBLOCK API KEY>
+```
+otherwise `def analyze_gas` function will always return static data:
+```python
+DotMap(mode=999999999999999999, median=999999999999999999, std=999999999999999999)
+```
+### 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 distribute from whales realtime with percentage
+If you want to use some other Ethplorer key to fetch whales, set env variable: ETHPLORER_API_KEY
+```shell
+export ETHPLORER_API_KEY=<API_KEY>
+```
+Otherwise, ethplorer key will be used by default, which is a bit slow
+```python
+import token # some deployed token
+from brownie import accounts
+from badger_utils.token_utils.distribute_from_whales_realtime import distribute_from_whales_realtime_percentage
+token.transfer(
+ "0x19d099670a21bC0a8211a89B84cEdF59AbB4377F", 100000, {'from': accounts[0]}
+)
+distribute_from_whales_realtime_percentage(accounts[1], percentage=0.8)
+```
+### Using distribute from whales realtime with exact amount
+```python
+import token # some deployed token
+from brownie import accounts
+from badger_utils.token_utils.distribute_from_whales_realtime import distribute_from_whales_realtime_exact
+token.transfer(
+ "0x19d099670a21bC0a8211a89B84cEdF59AbB4377F", 100000, {'from': accounts[0]}
+)
+distribute_from_whales_realtime_exact(accounts[1], amount=123)
+```
+### Using token utils
+**LEGACY**. Consider using `distribute_from_whales_realtime` module
+```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
+### On chain registry
+```python
+from badger_utils.registry import chain_registries
+chain_registries.initialize()
+chain_registries.get("badgerTree")
+```
+### Locally defined registry
+**NOTE:** This is legacy way of working with 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
+```
+
+%package help
+Summary: Development documents and examples for badger-utils
+Provides: python3-badger-utils-doc
+%description help
+## 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, BadgerRegistry
+```
+## Installing library
+`pip install badger-utils`
+## To run tests:
+```
+$ virtualenv venv
+$ source venv/bin/activate
+$ make
+$ brownie test
+```
+## Using library
+- [Coingecko Utils](#using-coingecko-utils)
+- [Gas utils module](#using-gas_utils-module)
+- [Network utils](#using-network-utils)
+- [Proxy utils](#using-proxy-utils)
+- [Distribute from whales realtime](#using-distribute-from-whales-realtime)
+- [Distribute from whales realtime with exact amount](#using-distribute-from-whales-realtime-with-exact-amount)
+- [Token utils](#using-token-utils)
+- [Constants](#using-constants)
+- [Tx timer](#using-tx-timer)
+- [Artifacts](#using-artifacts)
+- [Local registry](#locally-defined-registry)
+- [On chain registry](#on-chain-registry)
+- [Systems](#using-systems)
+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 gas_utils module
+```python
+from badger_utils.gas_utils import GasStrategies
+# Class initialization will initialize everything and fetch gas prices
+strategies = GasStrategies()
+price = strategies.optimal_price()
+# check gas cost:
+strategies.gas_cost(gas_estimate=21000)
+# Set default strategy:
+strategies.set_default_for_active_chain()
+```
+**NOTE:** If you want to use Anyblock historical data in gas analysis, consider adding auth keys
+from anyblock account:
+```shell
+export ANYBLOCK_EMAIL=email@gmail.com
+export ANYBLOCK_KEY=<YOU ANYBLOCK API KEY>
+```
+otherwise `def analyze_gas` function will always return static data:
+```python
+DotMap(mode=999999999999999999, median=999999999999999999, std=999999999999999999)
+```
+### 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 distribute from whales realtime with percentage
+If you want to use some other Ethplorer key to fetch whales, set env variable: ETHPLORER_API_KEY
+```shell
+export ETHPLORER_API_KEY=<API_KEY>
+```
+Otherwise, ethplorer key will be used by default, which is a bit slow
+```python
+import token # some deployed token
+from brownie import accounts
+from badger_utils.token_utils.distribute_from_whales_realtime import distribute_from_whales_realtime_percentage
+token.transfer(
+ "0x19d099670a21bC0a8211a89B84cEdF59AbB4377F", 100000, {'from': accounts[0]}
+)
+distribute_from_whales_realtime_percentage(accounts[1], percentage=0.8)
+```
+### Using distribute from whales realtime with exact amount
+```python
+import token # some deployed token
+from brownie import accounts
+from badger_utils.token_utils.distribute_from_whales_realtime import distribute_from_whales_realtime_exact
+token.transfer(
+ "0x19d099670a21bC0a8211a89B84cEdF59AbB4377F", 100000, {'from': accounts[0]}
+)
+distribute_from_whales_realtime_exact(accounts[1], amount=123)
+```
+### Using token utils
+**LEGACY**. Consider using `distribute_from_whales_realtime` module
+```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
+### On chain registry
+```python
+from badger_utils.registry import chain_registries
+chain_registries.initialize()
+chain_registries.get("badgerTree")
+```
+### Locally defined registry
+**NOTE:** This is legacy way of working with 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
+```
+
+%prep
+%autosetup -n badger-utils-0.2.5
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-badger-utils -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Tue Jun 20 2023 Python_Bot <Python_Bot@openeuler.org> - 0.2.5-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..e91ddb4
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+c97bf13c8d6fb3d21166c32aba079220 badger-utils-0.2.5.tar.gz