algoworld-contracts


Namealgoworld-contracts JSON
Version 1.3.6 PyPI version JSON
download
home_pagehttps://github.com/AlgoWorldNFT/algoworld-contracts
SummaryAlgoWorld Smart Contracts and Signatures
upload_time2022-06-25 20:14:03
maintainer
docs_urlNone
authorAlgoWorld
requires_python>=3.9,<4.0
licenseMIT
keywords algoworld algorand blockchain pyteal smart contracts
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            <p align="center"><a  href="https://twitter.com/algoworld_nft/status/1450608110268211203"><img  width=100%  src="https://i.imgur.com/cGWGmxa.png"  alt="687474703a2f2f6936332e74696e797069632e636f6d2f333031336c67342e706e67"  border="0" /></a></p>

<p align="center">
    <a href="https://algorand.com"><img src="https://img.shields.io/badge/Powered by-Algorand-blue.svg" /></a>
    <a href="https://algoworld.io"><img src="https://img.shields.io/badge/AlgoWorld-Website-pink.svg" /></a>
    <a href="https://algoworldexplorer.io"><img src="https://img.shields.io/badge/AlgoWorldExplorer-Platform-red.svg" /></a>
    <a><img src="https://visitor-badge.glitch.me/badge?page_id=AlgoWorldNFT.algoworld-contracts&right_color=green" /></a>
    <a href="https://github.com/AlgoWorldNFT/algoworld-contracts/actions/workflows/ci.yaml"><img src="https://github.com/AlgoWorldNFT/algoworld-contracts/actions/workflows/ci.yaml/badge.svg" /></a>
    <a href="https://codecov.io/gh/AlgoWorldNFT/algoworld-contracts"><img src="https://codecov.io/gh/AlgoWorldNFT/algoworld-contracts/branch/main/graph/badge.svg?token=2O1VAOJCUD"  /></a>
</p>

## ๐Ÿ“ƒ About

The following repository hosts the source codes for:
- `AlgoWorld Swapper`'s algorand smart signatures.
- `AlgoWorldExplorer`'s stateful smart contracts for card auctions and card trading. Modified version of [OpenNFT](https://github.com/ulamlabs/OpenNFT)'s smart contracts.

_**โš ๏ธ NOTE: These contracts are not formally audited by accredited third parties. However, contracts are a basis for certain functionality on the AlgoWorldExplorer.io platform and were created in collaboration with Solution Architect from Algorand (credits @cusma). Code is provided under MIT license.**_

## Prerequisites

-   [poetry](https://python-poetry.org/)
-   [pre-commit](https://pre-commit.com/)
-   [Algorand Sandbox](https://github.com/algorand/sandbox)
-   [Docker](https://www.docker.com/)

## ๐Ÿš€ Overview

AlgoWorld currently offers stateful contracts used for auction trading on AlgoWorldExplorer and several smart signatures used for swapping on AlgoWorld Swapper.

---

If you are looking to install algoworld contracts into your project run the following command:

```bash
pip install algoworld-contracts
```

### Example usage

```python
from algoworld_contracts import contracts

# Replace inputParams with real values
asa_to_asa_swap = contracts.get_swapper_teal(
        inputParams.creator_address,
        inputParams.offered_asa_id,
        inputParams.offered_asa_amount,
        inputParams.requested_asa_id,
        inputParams.requested_asa_amount,
        inputParams.incentive_wallet,
        inputParams.incentive_fee,
    )

# asa_to_asa_swap is a string of TEAL code
response = algod.compile(asa_to_asa_swap)
...
```

### Swapper

There are two main types of smart signatures available:

- [ASA to ASA swap | ๐ŸŽดโ†”๏ธ๐ŸŽด](algoworld_contracts/swapper/asa_to_asa_swapper.py):  Smart signature that allows performing a swap of any single ASA of specified amount to any other single ASA of specified amount.
- - [Swap Configuration Proxy ๐Ÿ“](algoworld_contracts/swapper/swap_proxy.py): Smart signature that powers the [AlgoWorld Swapper](https://swapper.algoworld.io) by allowing users to issue certain transactions that contain links to swap configuration files stored as `.json` files on `ipfs`. Proxy is then used to obtain those `ipfs` files by grabbing the latest pay transaction using Algorand Indexer queries.

- [ASAs to ALGO swap | ๐ŸŽด๐ŸŽด๐ŸŽดโ†”๏ธ๐Ÿ’ฐ](algoworld_contracts/swapper/asas_to_algo_swapper.py): Smart signature that allows performing a swap of multiple ASAs of specified amount to ALGO of specified amount.

### Auction

A set of stateful smart contracts for card auctions and card trading:
- [ASAs for ALGO with trades and bidding | ๐ŸŽด๐Ÿ’ฐ๐Ÿ”จ](src/auction/manager.py): <br> Allows trading ASA via auctions, selling or purchasing directly.

## โš™๏ธ Installation

This section assumes that poetry and pre-commit are installed and executed from the root folder of this repository.

1. Clone the repo

```bash
git clone https://github.com/AlgoWorldNFT/algoworld-contracts
```

2. Install python requirements

```bash
poetry install # install all dependencies
poetry shell # activate virtual env
```

(OPTIONAL) 3. Configure `pre-commit` hooks

```bash
pre-commit install
```

If you are not going to setup `pre-commit` locally, there is a Github Actions plugin that will autoformat your branch if you are opening a PR with commits that contain un-formatted code.

## ๐Ÿงช Testing

Testing assumes that docker-compose is installed and available. Project is relying on `pytest-docker-compose` plugin that automatically boots up temporary algorand sandbox and destroys the containers after the tests are finished.

```bash
(.venv) pytest
```

You can also include `[pytest]` into your commit message to trigger the test in CI pipeline on `push` action (on pr it is triggered automatically).

## ๐Ÿšง Contribution guideline

See [`CONTRIBUTING.md`](CONTRIBUTING.md)

## โญ๏ธ Stargazers

Special thanks to everyone who forked or starred the repository โค๏ธ

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

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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/AlgoWorldNFT/algoworld-contracts",
    "name": "algoworld-contracts",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "",
    "keywords": "algoworld,algorand,blockchain,pyteal,smart contracts",
    "author": "AlgoWorld",
    "author_email": "info@algoworld.io",
    "download_url": "https://files.pythonhosted.org/packages/4d/fa/5aa189e81d52bee5eb54e92e6c52c8f52cec8e3e47d691af678afd861f6f/algoworld_contracts-1.3.6.tar.gz",
    "platform": null,
    "description": "<p align=\"center\"><a  href=\"https://twitter.com/algoworld_nft/status/1450608110268211203\"><img  width=100%  src=\"https://i.imgur.com/cGWGmxa.png\"  alt=\"687474703a2f2f6936332e74696e797069632e636f6d2f333031336c67342e706e67\"  border=\"0\" /></a></p>\n\n<p align=\"center\">\n    <a href=\"https://algorand.com\"><img src=\"https://img.shields.io/badge/Powered by-Algorand-blue.svg\" /></a>\n    <a href=\"https://algoworld.io\"><img src=\"https://img.shields.io/badge/AlgoWorld-Website-pink.svg\" /></a>\n    <a href=\"https://algoworldexplorer.io\"><img src=\"https://img.shields.io/badge/AlgoWorldExplorer-Platform-red.svg\" /></a>\n    <a><img src=\"https://visitor-badge.glitch.me/badge?page_id=AlgoWorldNFT.algoworld-contracts&right_color=green\" /></a>\n    <a href=\"https://github.com/AlgoWorldNFT/algoworld-contracts/actions/workflows/ci.yaml\"><img src=\"https://github.com/AlgoWorldNFT/algoworld-contracts/actions/workflows/ci.yaml/badge.svg\" /></a>\n    <a href=\"https://codecov.io/gh/AlgoWorldNFT/algoworld-contracts\"><img src=\"https://codecov.io/gh/AlgoWorldNFT/algoworld-contracts/branch/main/graph/badge.svg?token=2O1VAOJCUD\"  /></a>\n</p>\n\n## \ud83d\udcc3 About\n\nThe following repository hosts the source codes for:\n- `AlgoWorld Swapper`'s algorand smart signatures.\n- `AlgoWorldExplorer`'s stateful smart contracts for card auctions and card trading. Modified version of [OpenNFT](https://github.com/ulamlabs/OpenNFT)'s smart contracts.\n\n_**\u26a0\ufe0f NOTE: These contracts are not formally audited by accredited third parties. However, contracts are a basis for certain functionality on the AlgoWorldExplorer.io platform and were created in collaboration with Solution Architect from Algorand (credits @cusma). Code is provided under MIT license.**_\n\n## Prerequisites\n\n-   [poetry](https://python-poetry.org/)\n-   [pre-commit](https://pre-commit.com/)\n-   [Algorand Sandbox](https://github.com/algorand/sandbox)\n-   [Docker](https://www.docker.com/)\n\n## \ud83d\ude80 Overview\n\nAlgoWorld currently offers stateful contracts used for auction trading on AlgoWorldExplorer and several smart signatures used for swapping on AlgoWorld Swapper.\n\n---\n\nIf you are looking to install algoworld contracts into your project run the following command:\n\n```bash\npip install algoworld-contracts\n```\n\n### Example usage\n\n```python\nfrom algoworld_contracts import contracts\n\n# Replace inputParams with real values\nasa_to_asa_swap = contracts.get_swapper_teal(\n        inputParams.creator_address,\n        inputParams.offered_asa_id,\n        inputParams.offered_asa_amount,\n        inputParams.requested_asa_id,\n        inputParams.requested_asa_amount,\n        inputParams.incentive_wallet,\n        inputParams.incentive_fee,\n    )\n\n# asa_to_asa_swap is a string of TEAL code\nresponse = algod.compile(asa_to_asa_swap)\n...\n```\n\n### Swapper\n\nThere are two main types of smart signatures available:\n\n- [ASA to ASA swap | \ud83c\udfb4\u2194\ufe0f\ud83c\udfb4](algoworld_contracts/swapper/asa_to_asa_swapper.py):  Smart signature that allows performing a swap of any single ASA of specified amount to any other single ASA of specified amount.\n- - [Swap Configuration Proxy \ud83d\udcdd](algoworld_contracts/swapper/swap_proxy.py): Smart signature that powers the [AlgoWorld Swapper](https://swapper.algoworld.io) by allowing users to issue certain transactions that contain links to swap configuration files stored as `.json` files on `ipfs`. Proxy is then used to obtain those `ipfs` files by grabbing the latest pay transaction using Algorand Indexer queries.\n\n- [ASAs to ALGO swap | \ud83c\udfb4\ud83c\udfb4\ud83c\udfb4\u2194\ufe0f\ud83d\udcb0](algoworld_contracts/swapper/asas_to_algo_swapper.py): Smart signature that allows performing a swap of multiple ASAs of specified amount to ALGO of specified amount.\n\n### Auction\n\nA set of stateful smart contracts for card auctions and card trading:\n- [ASAs for ALGO with trades and bidding | \ud83c\udfb4\ud83d\udcb0\ud83d\udd28](src/auction/manager.py): <br> Allows trading ASA via auctions, selling or purchasing directly.\n\n## \u2699\ufe0f Installation\n\nThis section assumes that poetry and pre-commit are installed and executed from the root folder of this repository.\n\n1. Clone the repo\n\n```bash\ngit clone https://github.com/AlgoWorldNFT/algoworld-contracts\n```\n\n2. Install python requirements\n\n```bash\npoetry install # install all dependencies\npoetry shell # activate virtual env\n```\n\n(OPTIONAL) 3. Configure `pre-commit` hooks\n\n```bash\npre-commit install\n```\n\nIf you are not going to setup `pre-commit` locally, there is a Github Actions plugin that will autoformat your branch if you are opening a PR with commits that contain un-formatted code.\n\n## \ud83e\uddea Testing\n\nTesting assumes that docker-compose is installed and available. Project is relying on `pytest-docker-compose` plugin that automatically boots up temporary algorand sandbox and destroys the containers after the tests are finished.\n\n```bash\n(.venv) pytest\n```\n\nYou can also include `[pytest]` into your commit message to trigger the test in CI pipeline on `push` action (on pr it is triggered automatically).\n\n## \ud83d\udea7 Contribution guideline\n\nSee [`CONTRIBUTING.md`](CONTRIBUTING.md)\n\n## \u2b50\ufe0f Stargazers\n\nSpecial thanks to everyone who forked or starred the repository \u2764\ufe0f\n\n[![Stargazers repo roster for @AlgoWorldNFT/algoworld-contracts](https://reporoster.com/stars/dark/AlgoWorldNFT/algoworld-contracts)](https://github.com/AlgoWorldNFT/algoworld-contracts/stargazers)\n\n[![Forkers repo roster for @AlgoWorldNFT/algoworld-contracts](https://reporoster.com/forks/dark/AlgoWorldNFT/algoworld-contracts)](https://github.com/AlgoWorldNFT/algoworld-contracts/network/members)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "AlgoWorld Smart Contracts and Signatures",
    "version": "1.3.6",
    "split_keywords": [
        "algoworld",
        "algorand",
        "blockchain",
        "pyteal",
        "smart contracts"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "3d6cefb22dc7c86a0733f0fddf32c9be",
                "sha256": "08551c26f673adffdf5ffe279d619c3c76141d92a425a0f28b31ee443f6fd746"
            },
            "downloads": -1,
            "filename": "algoworld_contracts-1.3.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3d6cefb22dc7c86a0733f0fddf32c9be",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 22952,
            "upload_time": "2022-06-25T20:14:02",
            "upload_time_iso_8601": "2022-06-25T20:14:02.051955Z",
            "url": "https://files.pythonhosted.org/packages/90/cf/3dd55dae3c69a7e38755570d8ee23ff3be938f12c093bd3949f4a193ff42/algoworld_contracts-1.3.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "869a3b71381f77cef25df01d0526a5a4",
                "sha256": "9c30dcfc52db589f531d1aaa4214cb08855d391c3b39fbe90ae291e445921d3a"
            },
            "downloads": -1,
            "filename": "algoworld_contracts-1.3.6.tar.gz",
            "has_sig": false,
            "md5_digest": "869a3b71381f77cef25df01d0526a5a4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 13526,
            "upload_time": "2022-06-25T20:14:03",
            "upload_time_iso_8601": "2022-06-25T20:14:03.412153Z",
            "url": "https://files.pythonhosted.org/packages/4d/fa/5aa189e81d52bee5eb54e92e6c52c8f52cec8e3e47d691af678afd861f6f/algoworld_contracts-1.3.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-06-25 20:14:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "AlgoWorldNFT",
    "github_project": "algoworld-contracts",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "algoworld-contracts"
}
        
Elapsed time: 0.64196s