Skip to main content

Automated Prediction Market Maker on Algorand

Project description

Automated Prediction Market Maker on Algorand

NOTE: This code is not audited and should not be used in production environment.

Summary

Algo AMM is an automated prediction market maker on Algorand that allows users to trade on the outcomes of events, and follow the odds to garner accurate insights about the future.

Our target market is traders, speculators and investors who are interested in taking advantage of the predictive power of markets. The user problem we are addressing is the difficulty in predicting outcomes of events accurately and reliably. Our solution is an automated prediction market maker that allows users to trade on the outcomes of events, and follow the odds to garner accurate insights about the future. We provide liquidity for users to buy or sell Voting Shares, which can be redeemed for 1 unit of the stable asset if the outcome is resolved as correct, and become worthless if it’s incorrect.

The goal is, by harnessing the power of free markets to aggregate collective knowledge and provide the general public with an unbiased source of truth in regards to the likelihood of certain significant events happening in the future.

Automated Market Maker

Project Slides Deck

We wrote contract for Prediction Market Constant Function Automated Market Maker with the help of PyTeal and Py-algorand-sdk.

The front end application is written with react and vite.

The repository for the front-end

AlgoAMM Live

Founders

Pavel Fedotov: LinkedIn Twitter GitHub

Grigore Gabriel Trifan: LinkedIn Twitter GitHub

Overview

Constant Function Automated Market Maker (AMM) contract provides configuration options and creates a market for an event that has a binary outcome.

Liquidity Pool provides a foundation for users to purchase and redeem spawned tokens once the event has been resolved. The Liquidity Pool supports a constant reserve ratio for stable price discovery and protection from liquidity drain. The liquidity provided allows to spawn two tokens in equal amount in 25%/25% proportion of the liquidity supplied.

The purchase price for each token is determined by equation: x + y = k. Where x is the amount of A tokens in the AMM, y is the amount of B tokens in the AMM.

Once the event has occurred the price for one token should resolve to 1, while 0 for another.

Liquidity Shares and Voting Shares can only be released after the creator of the contract moderated the outcome.

As a prediction market maker on Algorand, our primary role would be to provide liquidity to users who are looking to buy and sell prediction market tokens on the platform. This involves creating markets for events or outcomes, such as the winner of a political election or the outcome of a sports game, and setting prices for these tokens based on supply and demand.

Requirements

  1. Vscode or another IDE
  2. Python 3
  3. PIP Package Manager
  4. Py-algorand-sdk
  5. PyTEAL
  6. Algorand Purestake node api key

PyTeal AMM Smart Contract

PyTeal contracts are written in Python using any editor of your choice. compileProgram method produces the TEAL code which is then compiled into bytecode and deployed to the blockchain.

The PyTeal smart contract consists of two programs. These are called the approval program and the clear programs. In PyTeal both of these programs are generally created in the same Python file.

The approval_program is responsible for processing all application calls to the contract, with the exception of the clear call. The program is responsible for implementing most of the logic of an application.

The clear_program is used to handle accounts using the clear call to remove the smart contract from their balance record.

In amm.py we keep the high-level logic of the contract, helpers.py contains lower level methods and config.py keeps track of global variable and key configuration variables.

Useful Resources

PyTEAL

Testnet Dispensary

Algorand Dispenser

Py-algorand-sdk

AlgoExplorer

Algorand: Build with Python

Algorand: Smart contract details

Amm Demo contract

Creating Stateful Algorand Smart Contracts in Python with PyTeal

How to publish PIP package

Algorand Ecosystem Algo AMM page

How To Use unittest to Write a Test Case for a Function in Python

More Information about Dspyt

Dspyt Homepage

Dspyt GitHub DAO Page

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

algo_amm-0.0.2.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

algo_amm-0.0.2-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file algo_amm-0.0.2.tar.gz.

File metadata

  • Download URL: algo_amm-0.0.2.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for algo_amm-0.0.2.tar.gz
Algorithm Hash digest
SHA256 8d3796fde1261030b497c66b97c108b793f3bfd9799cf957fddc5d33d6efc2c8
MD5 a6d511dd7acc84aab1128107456dfe12
BLAKE2b-256 27385a160d6e911528e0bc4a677960fbf41e1b640295703d3bb3b968386bce90

See more details on using hashes here.

File details

Details for the file algo_amm-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: algo_amm-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for algo_amm-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 aba4b380f2614766856c3d7e234c8d4cc6b17d3596fc08083d1c421eff8030e6
MD5 815e14c4804b61e270e8a776fec6c3af
BLAKE2b-256 b4d7e561243541bc8d1f270550031a0877824d9da9b09236cc466c7e8ede1b27

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page