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.
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
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)
...
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.
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 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).
See CONTRIBUTING.md
Special thanks to everyone who forked or starred the repository β€οΈ