Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring proposal, CI integration, linters integrations, renovate integration, sexy header logo (#1) #7

Merged
merged 2 commits into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
### Description

> _Please explain the changes you made here_
### Checklist

> _Please, make sure to comply with the checklist below before expecting review_
- [ ] Code compiles correctly
- [ ] Created tests which fail without the change (if possible)
- [ ] All tests passing
- [ ] Extended the README / documentation, if necessary
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI

on:
pull_request:
branches:
- '*'
push:
branches:
- 'main'

jobs:
run-ci:

name: Run Type Check & Linters
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.10.8

- name: Set up Poetry
uses: abatilo/[email protected]
with:
poetry-version: 1.1.13

- name: Install python dependencies
run: poetry install

- uses: pre-commit/[email protected]
name: "Linters and formatters check"
with:
extra_args: --all-files --show-diff-on-failure
36 changes: 36 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/psf/black
rev: 22.6.0
hooks:
- id: black

- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
args: ["--profile", "black"]

- repo: https://github.com/myint/autoflake
rev: v1.4
hooks:
- id: autoflake
args:
- --in-place
- --remove-unused-variables
- --remove-all-unused-imports
- --expand-star-imports
- --ignore-init-module-imports

- repo: https://github.com/myint/eradicate
rev: v2.0.0
hooks:
- id: eradicate
args:
- --in-place
107 changes: 55 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
```
__ __ ___ __ __
\*) \*) \*/ (*/ (*/
\*\_\*\_|O|_/*/_/*/
\_______________/
_ __ _______ __
/ \ [ | |_ __ \ [ |
/ _ \ | | .--./) .--. | |__) | .---. ,--. | | _ .--..--.
/ ___ \ | | / /'`\;/ .'`\ \ | __ / / /__\\`'_\ : | | [ `.-. .-. |
_/ / \ \_ | | \ \._//| \__. |_| | \ \_| \__.,// | |, | | | | | | | |
|____| |____|[___].',__` '.__.'|____| |___|'.__.'\'-;__/[___][___||__||__]
( ( __))
by cusma
```
<p align="center"><a href="https://github.com/cusma/algorealm"><img width=100% src="https://ipfs.algonode.xyz/ipfs/bafybeicqjdrwufixgun4quyble4kkvojouo3dnijuexx4wtnmt23p3dxeq" border="0" /></a></p>

<p align="center">
<a href="https://algorand.com"><img src="https://img.shields.io/badge/Powered by-Algorand-teal.svg" /></a>
<img src="https://visitor-badge.glitch.me/badge?page_id=cusma.algorealm&right_color=teal" />
<a href="https://twitter.com/cusma_b"><img src="https://img.shields.io/badge/Created [email protected]" /></a>
</p>

## Incipit

Expand Down Expand Up @@ -39,19 +32,20 @@ Join [AlgoRealm channel](https://t.me/algorealm)!

## Play with AlgoRealm CLI

### 1. Setup

1. Download the [`algorealm.py`](https://github.com/cusma/algorealm/blob/main/algorealm.py) script
2. Install the following dependencies:
### 0. Prerequisites

- [poetry](https://python-poetry.org/)
- [python >= 3.10](https://www.python.org/)

### 1. Setup

```shell
$ pip3 install docopt --upgrade
$ pip3 install msgpack --upgrade
$ pip3 install py-algorand-sdk --upgrade
$ poetry install # install dependencies
$ poetry shell # activate virtual environment
$ cd src # cd into source directory, to be replaced with UI webapp in future
```

3. Create an account on PureStake and [get your API token](https://developer.purestake.io/login)

### 2. How to play

Playing **AlgoRealm** from your CLI is pretty easy, just ask for help:
Expand All @@ -65,13 +59,13 @@ AlgoRealm, only generous heart will ever rule over Algorand. (by cusma)

Usage:
algorealm.py poem
algorealm.py dynasty <purestake-api-token>
algorealm.py verify-order <purestake-api-token> <seller-address>
algorealm.py claim-crown <purestake-api-token> <mnemonic> <majesty-name> <microalgos>
algorealm.py claim-sceptre <purestake-api-token> <mnemonic> <majesty-name> <microalgos>
algorealm.py claim-card <purestake-api-token> <mnemonic>
algorealm.py buy-order <purestake-api-token> <mnemonic> <microalgos> [--notify]
algorealm.py sell-card <purestake-api-token> <mnemonic>
algorealm.py dynasty
algorealm.py verify-order <seller-address>
algorealm.py claim-crown <mnemonic> <majesty-name> <microalgos>
algorealm.py claim-sceptre <mnemonic> <majesty-name> <microalgos>
algorealm.py claim-card <mnemonic>
algorealm.py buy-order <mnemonic> <microalgos> [--notify]
algorealm.py sell-card <mnemonic>
algorealm.py [--help]

Commands:
Expand Down Expand Up @@ -104,24 +98,24 @@ $ ./goal app read --app-id 137491307 --global

3. Discover it with the AlgoRealm CLI:
```shell
$ python3 algorealm.py dynasty <purestake-api-token>
$ python3 algorealm.py dynasty
```

```
__ __ ___ __ __
\*) \*) \*/ (*/ (*/
\*\_\*\_|O|_/*/_/*/
\_______________/
_ __ _______ __
/ \ [ | |_ __ \ [ |
/ _ \ | | .--./) .--. | |__) | .---. ,--. | | _ .--..--.
/ ___ \ | | / /'`\;/ .'`\ \ | __ / / /__\\`'_\ : | | [ `.-. .-. |
_/ / \ \_ | | \ \._//| \__. |_| | \ \_| \__.,// | |, | | | | | | | |
__ __ ___ __ __
\*) \*) \*/ (*/ (*/
\*\_\*\_|O|_/*/_/*/
\_______________/
_ __ _______ __
/ \ [ | |_ __ \ [ |
/ _ \ | | .--./) .--. | |__) | .---. ,--. | | _ .--..--.
/ ___ \ | | / /'`\;/ .'`\ \ | __ / / /__\\`'_\ : | | [ `.-. .-. |
_/ / \ \_ | | \ \._//| \__. |_| | \ \_| \__.,// | |, | | | | | | | |
|____| |____|[___].',__` '.__.'|____| |___|'.__.'\'-;__/[___][___||__||__]
( ( __))
*** DYNASTY ***
( ( __))
*** DYNASTY ***


👑 jkbishbish claimed the Crown of Entropy
on Block: 13578171 donating: 2 microALGOs to the Rewards Pool.

Expand All @@ -146,11 +140,11 @@ on Block: 14989913 donating: 4 microALGOs to the Rewards Pool.
Chose your `<majesty-name>` and become part of the Dynasty! Remember that to dethrone the current Majesties you must donate to the Algorand's Rewards Pool more `<microalgos>` than the last donation.

```shell
$ python3 algorealm.py claim-crown <purestake-api-token> <mnemonic> <majesty-name> <microalgos>
$ python3 algorealm.py claim-crown <mnemonic> <majesty-name> <microalgos>
```

```shell
$ python3 algorealm.py claim-sceptre <purestake-api-token> <mnemonic> <majesty-name> <microalgos>
$ python3 algorealm.py claim-sceptre <mnemonic> <majesty-name> <microalgos>
```

⚠️ Enter the the `<mnemonic>` formatting it as: `"word_1 word_2 word_3 ... word_25"` and keep it safe!
Expand All @@ -168,7 +162,7 @@ Only the generous heart of the [Great Majesty of Algorand](https://github.com/cu
The AlgoRealm Card can be claimed **starting from block 16,250,000** using the command `claim-card`: hold strong both the Crown and the Sceptre and keep the throne until there!

```shell
$ python3 algorealm.py claim-card <purestake-api-token> <mnemonic>
$ python3 algorealm.py claim-card <mnemonic>
```

⚠️ Enter the the `<mnemonic>` formatting it as: `"word_1 word_2 word_3 ... word_25"` and keep it safe!
Expand All @@ -180,7 +174,7 @@ As a **Buyer** you can easily place a **buy-order** proposal to the **Seller** u
Using the `--notify` option the **Seller** will receive a notification on-chain, being acknowledge about the new buy-order proposal.

```shell
$ python3 algorealm.py buy-order <purestake-api-token> <mnemonic> <microalgos> [--notify]
$ python3 algorealm.py buy-order <mnemonic> <microalgos> [--notify]
```

⚠️ Enter the the `<mnemonic>` formatting it as: `"word_1 word_2 word_3 ... word_25"` and keep it safe!
Expand All @@ -194,21 +188,21 @@ As a **Seller** you can review and verify the buy-order proposal, validating the
The `verify-order` command requires your `<seller-address>` as argument.

```shell
$ python3 algorealm.py verify-order <purestake-api-token> <seller-address>
$ python3 algorealm.py verify-order <seller-address>
```

Some compliancy checks are performed over the `trade.gtx` file before displaying the buy-order summary:

```shell
* =========================== ORDER SUMMARY =========================== *

BUYER: <BUYER_ADDRESS>
SELLER: <SELLER_ADDRESS>
AMOUNT: 1.0 ALGO
ROYALTY: 0.1 ALGO

LAST VALID BLOCK: 13184621

* ===================================================================== *
```

Expand All @@ -219,7 +213,7 @@ If you agree with the buy-order proposal you can sell the AlgoRealm Special Card
As a **Seller**, if you agree with the buy-order proposal, you can sell your AlgoRealm Special Card using the command `sell-card`.

```shell
$ python3 algorealm.py sell-card <purestake-api-token> <mnemonic>
$ python3 algorealm.py sell-card <mnemonic>
```

⚠️ Enter the the `<mnemonic>` formatting it as: `"word_1 word_2 word_3 ... word_25"` and keep it safe!
Expand Down Expand Up @@ -360,3 +354,12 @@ If you enjoyed AlgoRealm or find it useful as free and open source learning exam
Here you find the [AlgoRealm slide deck](https://docs.google.com/presentation/d/1pkE_VWuq_zPOtkc8tK8MYKPzdBwUQA8r5UgACpBpmvk/edit?usp=sharing) presented at Algorand's Office Hours!

Join [AlgoRealm channel](https://t.me/algorealm)!


## ⭐️ Stargazers

Special thanks to everyone who forked or starred the repository ❤️

[![Stargazers repo roster for @AlgoWorldNFT/algoworld-contracts](https://reporoster.com/stars/dark/cusma/algorealm)](https://github.com/cusma/algorealm/stargazers)

[![Forkers repo roster for @AlgoWorldNFT/algoworld-contracts](https://reporoster.com/forks/dark/cusma/algorealm)](https://github.com/cusma/algorealm/network/members)
Loading