Navigate back to the homepage

WebAssembly-first Decentralized Exchange

Tomasz Waszczyk
March 30th, 2023 · 1 min read

United Nations Educational, Scientific and Cultural Organization

The UNESCO Institute for Information Technologies in Education (UNESCO IITE) is the only UNESCO Category 1 Institute that holds a global mandate for Information and Communication Technologies (ICT) in Education. In line with the new Education 2030 Agenda, IITE has developed its strategic priority areas to meet new demands and tasks ahead. The mission of UNESCO IITE is to promote the innovative use of ICT and serve as facilitator and enabler for achieving Sustainable Development Goal 4 (SDG 4) through ICT-enabled solutions and best practices.

WebAssembly and Astar Network

Astar & Shiden runtimes are based on Substrate, and both networks incorporate pallet-contracts, a sandboxed environment used to deploy and execute WebAssembly smart contracts. Any language that compiles to Wasm may be deployed and run on this Wasm Virtual Machine, however, the code should be compatible with the pallet-contracts API.

For WASM smart contracts you can use any compatible programming language, not only Rust.

Implementation

1#[derive(Default)]
2#[ink(storage)]
3pub struct AutomatedMarketMaker {
4 total_shares: Balance, // Stores the total amount of share issued for the pool
5 total_token1: Balance, // Stores the amount of Token1 locked in the pool
6 total_token2: Balance, // Stores the amount of Token2 locked in the pool
7 shares: Mapping<AccountId, Balance>, // Stores the share holding of each provider
8 token1_balance: Mapping<AccountId, Balance>, // Stores the token1 balance of each user
9 token2_balance: Mapping<AccountId, Balance>, // Stores the token2 balance of each user
10 fees: Balance, // Percent of trading fees charged on trade
11}

Do you have an experience with implementing of decentralized exchanges? Ping me, please.

TBD

  • Github repository

More articles from waszczyk.com

Kurs Dotyczący Wprowadzenia do Decentralizacji Systemów Informatycznych oraz Bankowości

Decentralizacja systemu bankowego oraz systemów informatycznych to trend który coraz wyraźniej przebija się do świadomości użytkowników internetu, właśnie przygotowuję kurs w którym przekrojowo przedstawię ten nurt - prawdopodobnie już nie do zatrzymania.

December 8th, 2022 · 4 min read

The Basics of Cryptography

Vires in Numeris

September 18th, 2022 · 4 min read
© 2020–2023 waszczyk.com
Link to $https://twitter.com/tomaszwaszczykLink to $https://github.com/tomaszwaszczykLink to $https://instagram.com/tomasz_waszczykLink to $https://www.linkedin.com/in/tomaszwaszczyk