Skip to main content

687474703a2f2f6936332e74696e797069632e636f6d2f333031336c67342e706e67

📃 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 were created in collaboration with Solution Architect from Algorand (credits @cusma) and audited by TENSET security. Code is provided under MIT license.

Prerequisites

🚀 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:

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 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 | 🎴🎴🎴↔️💰: 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
git clone https://github.com/AlgoWorldNFT/algoworld-contracts
  1. 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 ❤️

Stargazers repo roster for @AlgoWorldNFT/algoworld-contracts

Forkers repo roster for @AlgoWorldNFT/algoworld-contracts

Metadata

Release files for algoworld-contracts 1.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for algoworld-contracts 1.4.0
File Size Uploaded
algoworld_contracts-1.4.0.tar.gz 9.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for algoworld-contracts 1.4.0
File Interpreter ABI Platform
algoworld_contracts-1.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 23.4 kB

Release files / algoworld_contracts-1.4.0.tar.gz

Download URL algoworld_contracts-1.4.0.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
bd6580d922136fd0802f64d71d04c25dd0a20d000168a1622cd5247375081993
BLAKE2b-256 checksum
How to use checksums
a1f7f59547e75e7ea99568d32df02cfaa55eef005f7fc4b8a4b2dc2180f1de42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.10.4 Linux/5.15.0-1042-azure

Release files / algoworld_contracts-1.4.0-py3-none-any.whl

Download URL algoworld_contracts-1.4.0-py3-none-any.whl
Size 14.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
990bcb41417a1ca76e69386fe2f88cf93da4284aa29742279c6d8b206677788a
BLAKE2b-256 checksum
How to use checksums
42d3ae53beb9ed93e3a1abcccc202b7689d08984f70178db6eeab67a993bee68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.10.4 Linux/5.15.0-1042-azure

Release history Release notifications | RSS feed

This release

1.4.0 This release

2 release files

1.3.6

2 release files

1.2.5

2 release files

1.2.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page