substrate icon indicating copy to clipboard operation
substrate copied to clipboard

WIP: Basic dex pallet

Open gilescope opened this issue 3 years ago • 8 comments

A simple automated market maker pallet.

I'd direct both non-technical discussion and discussion of possible future improvements to be hosted on the forum: https://forum.polkadot.network/t/statemint-e-swap-discussion/1498

The goal of this pallet is to provide people with a simple audited AMM pallet should a substrate chain need a basic decentralised exchange. (note: audit is still to be done.)

(Additional functional changes to this main PR should be done as child PRs that merge into this one.)

gilescope avatar Dec 20 '22 19:12 gilescope

There is no good reason to support Currency & Assets, which reduces compatibility and add complexity. If you really want to implement DEX, I will suggest take a look to some of the existing implementations first.

xlc avatar Dec 21 '22 10:12 xlc

It's no secret that the dex pallet might well be used in the statemint runtime. That runtime currently uses the Balances and Assets pallets. All the bounds are against traits so it shouldn't preclude the dex being backed by other asset registry pallets that support the fungibles traits.

gilescope avatar Dec 21 '22 11:12 gilescope

You need to check how orml-tokens, orml-currencies works. I did a workshop about it https://github.com/xlc/orml-workshop Basically the DEX pallet shouldn't need to handle two currency implementation. It is an adapter's job to handle that.

xlc avatar Dec 21 '22 21:12 xlc

@xlc I hear you. I'm hoping that XCM v3 which is "coming soon™" gets merged. When that happens I'd like to re-work the interface so that MultiAssetId is replaced with XCM v3's MultiLocation as that can represent everything in a standard way.

gilescope avatar Dec 23 '22 10:12 gilescope

@xlc I hear you. I'm hoping that XCM v3 which is "coming soon™" gets merged. When that happens I'd like to re-work the interface so that MultiAssetId is replaced with XCM v3's MultiLocation as that can represent everything in a standard way.

So we can expect that everything works with orml_tokens and orml_currencies in the first iteration of this pallet? This would be super useful, especially because many projects depend on the orml library. pallet_asset support is fine, but the real fruition kicks in with MultiAsset pallets like from the orml library. pallet_assets differs from orml_tokens in key points as we know. I don't think that pallet_assets is meant to replace orml_tokens, right?

Chralt98 avatar Feb 01 '23 02:02 Chralt98

bot rebase

jsidorenko avatar Mar 06 '23 10:03 jsidorenko

bot rebase

jsidorenko avatar Mar 16 '23 08:03 jsidorenko

bot clean

jsidorenko avatar Mar 22 '23 16:03 jsidorenko

bot bench $ pallet dev pallet_asset_conversion

jsidorenko avatar Mar 30 '23 08:03 jsidorenko

@jsidorenko https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2615782 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" pallet dev pallet_asset_conversion. Check out https://gitlab.parity.io/parity/mirrors/substrate/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 18-3edf597f-0663-438a-8e5c-df37da43fbef to cancel this command or bot cancel to cancel all commands in this pull request.

command-bot[bot] avatar Mar 30 '23 08:03 command-bot[bot]

@jsidorenko Command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" pallet dev pallet_asset_conversion has finished. Result: https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2615782 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2615782/artifacts/download.

command-bot[bot] avatar Mar 30 '23 18:03 command-bot[bot]

bot rebase

jsidorenko avatar May 08 '23 10:05 jsidorenko

Rebased

bot rebase

jsidorenko avatar May 11 '23 16:05 jsidorenko

Rebased

Last audit issue fixed. Removing needs audit label.

gilescope avatar May 25 '23 09:05 gilescope

let's allow auditors to set the "audited" label :)

jsidorenko avatar May 25 '23 10:05 jsidorenko

The CI pipeline was cancelled due to failure one of the required jobs. Job name: check-dependent-cumulus Logs: https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2897564

paritytech-cicd-pr avatar May 25 '23 18:05 paritytech-cicd-pr

bot merge

gilescope avatar May 25 '23 18:05 gilescope