AlgoWorld Smart Contracts and Signatures
Project description
📃 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'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
🚀 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:
pip install algoworld-contracts
Example usage
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 | 🎴↔️🎴: 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 📝: Smart signature that powers the AlgoWorld Swapper by allowing users to issue certain transactions that contain links to swap configuration files stored as
.json
files onipfs
. Proxy is then used to obtain thoseipfs
files by grabbing the latest pay transaction using Algorand Indexer queries.
- Swap Configuration Proxy 📝: Smart signature that powers the AlgoWorld Swapper by allowing users to issue certain transactions that contain links to swap configuration files stored as
-
ASAs to ALGO swap | 🎴🎴🎴↔️💰: 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 | 🎴💰🔨:
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.
- Clone the repo
git clone https://github.com/AlgoWorldNFT/algoworld-contracts
- Install python requirements
poetry install # install all dependencies
poetry shell # activate virtual env
(OPTIONAL) 3. Configure pre-commit
hooks
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.
(.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
⭐️ Stargazers
Special thanks to everyone who forked or starred the repository ❤️
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file algoworld_contracts_legacy-1.3.0.tar.gz
.
File metadata
- Download URL: algoworld_contracts_legacy-1.3.0.tar.gz
- Upload date:
- Size: 13.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.11.3 Darwin/22.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bba1ccd3abc61b26eb52b48388ed1ddadd2d6f9a44e5b85050619b69f32a4b53 |
|
MD5 | 4679ea277ef86b6e2cedbc4ac92b535f |
|
BLAKE2b-256 | 4f2e0dc6163b5700a376e38f6a7ac790d97a8d58047b8f01a99282336a311f5b |
File details
Details for the file algoworld_contracts_legacy-1.3.0-py3-none-any.whl
.
File metadata
- Download URL: algoworld_contracts_legacy-1.3.0-py3-none-any.whl
- Upload date:
- Size: 23.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.11.3 Darwin/22.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbcd25c4e23aede32f1e1b2164bc3afc0738438d4e90b82886daf3387508ec39 |
|
MD5 | a77ba9a85a21b4d0c322f2a72e0a7485 |
|
BLAKE2b-256 | 8979e28f9b45a52e79a16dfcbe3806e18f69eed776a7c8a9c2ad439e666dccbd |