Example of simple Automated Market Maker on Elrond network for studying purpose.
Inspired by tutorial https://learn.figment.io/tutorials/build-polkadot-amm-using-ink.
Contract: Rust
Frontend: SvelteKit framework
Working example: https://amm-elrond.netlify.app/
https://user-images.githubusercontent.com/143357/210095255-3633ec8b-c1b7-4569-82b5-e30a319068f4.mov
Collection of tokens or digital assets locked in a smart contract that provide essential liquidity to decentralized exchanges (DEX). A DEX is an exchange that doesn't rely on a third party to hold users' funds. Instead, DEX users transact with each other directly.
Playing with numbers we can see:Slippage is the price difference between when you submit a transaction and when the transaction is confirmed on the blockchain.
Besides smart contract algorithms, liquidity pools rely on arbitrage traders to ensure a digital asset's quoted price is accurate. Arbitrage is a strategy where traders capitalize on a slight price discrepancy on a token between two exchanges
Please check comments which polyfill to use for local dev and for production release in vite.config.js.
In fe-svelte-kit
directory run:
pnpm install
pnpm run dev
Run tests:
NOTE: only my local ... if there is issue with compiling contract (..unknown command: cargo.
) remove rust from asdf
as it is in some collision w/ rustup.
erdpy contract build
erdpy contract test
In examples is proxy set to https://devnet-gateway.elrond.com, change it if you want to work with different chain
Run interaction python script and chose 1. Deploy
python3 ./interaction/playground.py --pem=./wallet/walletKey.pem --proxy=https://devnet-gateway.elrond.com
The contract is already deployed on address erd1qqqqqqqqqqqqqpgqmq04sd9355zryhek7lly4a4sspxdwwg453ds53uesn
(devnet) or erd1qqqqqqqqqqqqqpgqgczuv6u6mgdewj4amsm5nnysk3404md253ds92srw6
(testnet)