Code Monkey home page Code Monkey logo

algoworld-contracts's Introduction

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:

โš™๏ธ 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

algoworld-contracts's People

Contributors

aorumbayev avatar cusma avatar pre-commit-ci[bot] avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

algoworld-contracts's Issues

Propose and implement auto semantic version increments for `algoworld-contracts` python package

Goal

  1. Propose a mechanism to automatically increase algoworld-contracts version on merge to the repository.
  2. Discuss mechanism in github issue, upon agreement proceed to next step.
  3. Implement the solution, refine github ci yaml so that on each merge (push aciton) to master branch, package version is updated following semver conventions before package is published to pypi. Additionally final step in the pipeline should make a new github pre-release automatically as well as setting the tag equal to package version that was just published.
  4. Open PR against main branch, complete pr review.

An issue will be closed after enhancement is implemented reviewed and merged to main branch.

Further notes

The flow doesn't have to be fully automated, if there is a better, popular pattern for pypi releases for packages on github (that rely on github actions), please describe it in detail before implementation.

Concurrent ASA-to-ASA swaps

Issue
Since the ASA-to-ASA swap requires the offered ASA to be deposited in the Swapper Contract, there is a limitation for those users willing to concurrently swap a card for different possible requested cards.

Example
Let's say a user offers card A accepting either cards B, C or D as possible requested ASA. Since user has just 1 card A is not possible to open multiple requests for card B, C or D at the same time, since the user can only deposit A in one Swapper Contract at time.

Proposal
Adding an Or condition on requested ASA, so that the Swapper Contract could approve concurrent swaps with B, C or D at the same time, in the same Swapper Contract.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/ci.yaml
  • styfle/cancel-workflow-action 0.11.0
  • actions/checkout v3
  • actions/setup-python v4
  • abatilo/actions-poetry v2.3.0
  • codecov/codecov-action v3
.github/workflows/codeql-analysis.yml
  • actions/checkout v3
  • github/codeql-action v2
  • github/codeql-action v2
  • github/codeql-action v2
.github/workflows/release.yaml
  • actions/checkout v3
  • actions/setup-python v4
  • abatilo/actions-poetry v2.3.0
  • CasperWA/push-protected v2
pep621
pyproject.toml
poetry
pyproject.toml

  • Check this box to trigger a request for Renovate to run again on this repository

Decouple swap proxy escrow funding from main `save` transaction group

The goal is to decouple the funding logic from the logic that performs the main save operation (of ipfs note in pay transaction field issued by escrow).

Original suggestion by @cusma - #47 (comment)

After decoupling, a change on algoworld swapper needs to follow to implement a little dialog popup that will appear on wallet's who are making first ever login to algoworld swapper. The popup should take care of initial funding transaction (can be later used to present Terms and Conditions checkbox as well)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.