安利一下我们的项目 dddappp,一个“真”去中心化应用低代码开发平台

下面是另外一个教学项目,客户提出的需求寥寥几句:

Build a Simple Token Swap dApp using SUI Move

Overview: We’re creating a basic dApp to allow users to trade one cryptocurrency for another on the SUI blockchain. We need two main components: a smart contract and a simple frontend.

Requirements:

The token swap dApp contract should be straightforward, focusing only on the swapping feature. We don’t need the other DEX features

The smart contract code must include comments to explain how it works.

A basic frontend should be provided for users to interact with the dApp.


大家都知道,太“简单”的需求是很难做的,我的回复:

Let’s further clarify the requirements so that we can better determine the workload in the next step.

From the front-end, the dApp would look roughly like this:

  • First we would display a list of supported token pairs, TokenX-TokenY, TokenY-TokenZ and so on. Of course, at first, this list is empty.

  • Users can “initialize liquidity”. i.e. add a new swappable token pair TokenX-TokenY, by providing some amount of TokenX and TokenY.

  • Of course, after the token pair is initialized, users can continue to “add liquidity” to the token pair.

  • The front-end displays the current account’s share of liquidity in the current token pair where appropriate. Of course, at this point the user should already have connected a wallet.

  • The front-end has a place to show the “token reserves” in a token pair. That is, the amount of TokenX and TokenY are in the pair TokenX-TokenY.

  • For already supported token pair, e.g. TokenX-TokenY, user can “swap” TokenX for TokenY, or vice versa. Each swap transaction is charged 0.3% of the target token as a fee.

  • Users can "remove liquidity ". This means that by destroying their share of TokenX-TokenY liquidity, they can get a certain amount of TokenX and TokenY back.

  • The revenue that the user receives for providing liquidity comes from the fee and nothing else.

From a front-end UX perspective, the main features are those above.

The internal implementation of the smart contract will be kept as simple as possible, as long as it is sufficient to illustrate the basic principles of the DEX using the AMM model.


用中文简单来说,就是,让我们先厘清一下需求,是不是做成下面这样就可以:

  • 前端可以显示支持的币对列表。

  • 用户可以初始化流动性(创建新的可以 swap 的代币对)。

  • 用户可以添加流动性。

  • 前端可以显示当前账号所占的流动性份额。

  • 前端可以显示代币对中的代币储备。在 X-Y 币对中有多少代币 X 和代币 Y。

  • 提供兑换功能。代币 X 换成代币 Y,或者反过来也可以。每笔兑换收取换出代币的 0.3% 作为交易费。

  • 用户可以移除流动性。

  • 用户“提供流动性”获得的收益来自于手续费,没有其他。

以“教程”为目的,实现可以尽可能简单。


客户回复说:非常 OK,就是要像你说得这样。

我非常确信用现在的 dddappp 的 Sui Move 版本,可以做出这样的一个 DEX。