1

How can I implement token registration, trading, and fee payment with my native token (GGG) in a decentralized exchange (DEX) built with Substrate?

Specifically, I am looking to:

Allow users to add their own tokens to the DEX and enable trading between different tokens.

Use an off-chain worker to periodically send data to the main network and enforce the use of my native token (GGG) as the primary token in the network.

Provide a way for users to upload their smart contracts to create custom tokens on my network. I want to know if I should use the substrate-node-contract or pallet-contract feature to do this.

Ensure that all transactions in the network, including those in DApps, are conducted using my native token (GGG) as the fee payment.

I would appreciate it if you could provide guidance on how to implement these features using the capabilities of Substrate.

1 Answer 1

2

To make the fee payment with your own token follow this step-by-step old response where you will have to add the pallet_asset_tx_paymentfro.

I believe about how to create your own native token has been answered here already.

To have the functionality that allows users to upload WebAssembly smart-contracts in your chain you have to add in your runtime the FRAME pallet Contracts.

substrate-contracts-node is an example of a node that has this pallet in its runtime. Another example you can check is Contracts Rococo which is a parachain node for smart contracts running in Rococo.

In case you want to allow Solidity Smart contracts, is a bit more tricky but there are some pallets developed that allows it too. You can see an example of a node that has this pallet in its runtime checking the frontier-node-template and a tutorial about how to use it in the Substrate docs: Access EVM Accounts.

With the smart contracts feature you can allow users to develop smart contracts and deploy them in your chain implementing a DEX. You can also implement a pallet with the functionality of a DEX that lives in the runtime of your chain.

I share you some resources that I believe can help:

  • substrate-dex pallet: This pallet re-implements Uniswap V1 protocol for decentralized exchange of fungible assets.
  • Dex demo build by substrate: This is a full node that acts as a decentralized exchange (DEX) build by substrate.
  • Pablo: a new-generation decentralized exchange (DEX) that will be the first protocol to launch on Picasso. Check the code of the pallet here and its implementation in Picasso network here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.