-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
121 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
# Custom | ||
*.swp | ||
*.sqlite | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
sudo: false | ||
language: python | ||
python: | ||
- "3.6" | ||
install: pip install tox-travis | ||
script: tox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
# Change Log | ||
|
||
|
||
## [20181030] | ||
|
||
- Add tox testing | ||
- Enable Travis CI | ||
- Installable module | ||
|
||
|
||
## [v20181029] | ||
|
||
- Initial release import from EtherollApp v20181028 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,44 @@ | ||
# pyetheroll | ||
|
||
[![Build Status](https://travis-ci.com/AndreMiras/pyetheroll.svg?branch=develop)](https://travis-ci.com/AndreMiras/pyetheroll) | ||
|
||
Python library to Etheroll smart contract | ||
|
||
|
||
## Usage | ||
|
||
Simply set bet size, chances and wallet settings before rolling: | ||
```python | ||
from pyetheroll.etheroll import Etheroll | ||
|
||
etheroll = Etheroll() | ||
bet_size_ether = 0.1 | ||
chances = 50 | ||
wallet_path = '~/.ethereum/keystore/wallet.json' | ||
wallet_password = 'password' | ||
|
||
transaction = etheroll.player_roll_dice( | ||
bet_size_ether, chances, wallet_path, wallet_password) | ||
``` | ||
|
||
It's also possible to set different contract address and chain ID: | ||
```python | ||
from pyetheroll.constants import ChainID | ||
from pyetheroll.etheroll import Etheroll | ||
|
||
chain_id = ChainID.ROPSTEN | ||
contract_address = '0xe12c6dEb59f37011d2D9FdeC77A6f1A8f3B8B1e8' | ||
etheroll = Etheroll(chain_id, contract_address) | ||
``` | ||
|
||
## Install | ||
|
||
Latest stable release: | ||
```sh | ||
pip install https://github.com/AndreMiras/pyetheroll/archive/master.zip | ||
``` | ||
|
||
Development branch: | ||
```sh | ||
pip install https://github.com/AndreMiras/pyetheroll/archive/develop.zip | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
isort | ||
https://github.com/corpetty/py-etherscan-api/archive/cb91fb3.zip#egg=py-etherscan-api | ||
eth-account | ||
ethereum==2.1.1 | ||
web3==4.0.0b11 | ||
https://github.com/ethereum/pyethapp/archive/8406f32.zip#egg=pyethapp | ||
rlp==0.6.0 | ||
requests-cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from distutils.core import setup | ||
|
||
|
||
setup(name='pyetheroll', | ||
version='20181030', | ||
description='Python library to Etheroll smart contract', | ||
author='Andre Miras', | ||
url='https://github.com/AndreMiras/pyetheroll', | ||
packages=['pyetheroll'], | ||
install_requires=[]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[tox] | ||
envlist = pep8,isort,py3 | ||
# no setup.py to be ran | ||
skipsdist = True | ||
# trick to enable pre-installation modules | ||
# https://stackoverflow.com/a/50081741/185510 | ||
# used to downgrade to setuptools 37, see: | ||
# https://github.com/ethereum/pyethereum/pull/831 | ||
indexserver = | ||
preinstall = https://pypi.python.org/simple | ||
|
||
[testenv] | ||
deps = | ||
:preinstall: setuptools<=37.0.0 | ||
pytest | ||
-r{toxinidir}/requirements.txt | ||
commands = | ||
pytest tests/ | ||
python setup.py install | ||
|
||
[testenv:pep8] | ||
deps = flake8 | ||
commands = flake8 pyetheroll/ tests/ | ||
|
||
[testenv:isort] | ||
# isort needs to know the requirements to properly sort | ||
deps = | ||
:preinstall: setuptools<=37.0.0 | ||
-r{toxinidir}/requirements.txt | ||
commands = isort --check-only --recursive --diff pyetheroll/ tests/ |