Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/algoworldNFT/algoworld-contracts
๐ค A collection of Algorand Smart Signatures and Contracts for swaps and trading ๐ด
https://github.com/algoworldNFT/algoworld-contracts
algorand algoworld awesome-algorand blockchain nft pytest python teal
Last synced: 8 days ago
JSON representation
๐ค A collection of Algorand Smart Signatures and Contracts for swaps and trading ๐ด
- Host: GitHub
- URL: https://github.com/algoworldNFT/algoworld-contracts
- Owner: AlgoWorldNFT
- License: mit
- Created: 2021-10-15T18:55:41.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-08T20:43:28.000Z (7 months ago)
- Last Synced: 2024-04-08T22:56:50.981Z (7 months ago)
- Topics: algorand, algoworld, awesome-algorand, blockchain, nft, pytest, python, teal
- Language: Python
- Homepage:
- Size: 231 KB
- Stars: 30
- Watchers: 2
- Forks: 5
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-algorand - AlgoWorld-Contracts - Collection of all smart contracts used by AlgoWorld, written in PyTeal. (Community Resources / Projects)
- awesome-algorand - AlgoWorld-Contracts - Collection of all smart contracts used by AlgoWorld, written in PyTeal. (Community Resources / Projects)
README
## ๐ 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 were created in collaboration with Solution Architect from Algorand (credits @cusma) and audited by [TENSET security](https://www.tenset.io/en/smart-contract-audits). 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 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.
## โ๏ธ 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)