-
Notifications
You must be signed in to change notification settings - Fork 17
feat: add asset conversion pallet #309
base: main
Are you sure you want to change the base?
Conversation
9dfce32
to
8982d63
Compare
8982d63
to
eab6896
Compare
@stiiifff in order to migrate to 1.3.0 |
runtime/stout/src/lib.rs
Outdated
@@ -546,6 +538,127 @@ impl pallet_asset_registry::Config for Runtime { | |||
type BenchmarkHelper = AssetRegistryBenchmarkHelper; | |||
} | |||
|
|||
parameter_types! { | |||
pub const AssetDeposit: Balance = UNITS / 10; // 1 / 10 UNITS deposit to create asset |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same remark as in the Trappist runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
runtime/trappist/src/lib.rs
Outdated
@@ -562,23 +568,124 @@ impl pallet_democracy::Config for Runtime { | |||
} | |||
|
|||
parameter_types! { | |||
pub const DexPalletId: PalletId = PalletId(*b"trap/dex"); | |||
pub const AssetDeposit: Balance = UNITS / 10; // 1 / 10 UNITS deposit to create asset |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would align this on the local Assets instance (1 UNITS) as it doesn't make sense that creating a foreign / pool asset is 10x less expensive than a local asset. Wdyt ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked several integrations of this pallet in polkadot-sdk, and in most asset-hub projects they use the value I provided, both for local and foreign asset creation. Also please note that the foreign asset deposit is the same:
pub const ForeignAssetsAssetDeposit: Balance = AssetDeposit::get();
Still, it's fine for me to change it 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
runtime/trappist/src/xcm_config.rs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some thoughts:
- We most probably want to have a
ForeignFungiblesTransactor
andPoolFungiblesTransactor
(see the AH Rococo's XCM config). - With a separate instance of the FRAME Assets pallet for foreign assets, do we still need the
AssetRegistry
pallet in the runtime ? (as far as I understand, we don't need it anymore .. and the runtime & XCM configs must be amended accordingly). - Don't we need to adapt the
Trader
configuration (see AH Rococo's XCM Trader config for inspiration). - Should we update the
SafeCallFilter
? (for now, we allowEverything
... which doesn't seem very safe).
wdyt @hbulgarini @metricaez ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- We most probably want to have a
ForeignFungiblesTransactor
andPoolFungiblesTransactor
(see the AH Rococo's XCM config).
Agreed 👍
- With a separate instance of the FRAME Assets pallet for foreign assets, do we still need the
AssetRegistry
pallet in the runtime ? (as far as I understand, we don't need it anymore .. and the runtime & XCM configs must be amended accordingly).
True. I simply didn't know wether it'd be reasonable to simply remove the whole pallet. Should we maybe remove it and place it somewhere else and mark the repository as staged? For now I'll simply remove it from the runtime and afterwards we can decide what to do with it.
- Don't we need to adapt the
Trader
configuration (see AH Rococo's XCM Trader config for inspiration).
No idea about this one. @metricaez ?
- Should we update the
SafeCallFilter
? (for now, we allowEverything
... which doesn't seem very safe).
We had a similar discussion in the past about another parachain, and we agreed it's OK to leave it like that, as the logic to filter calls is very cumbersome and hard to maintain, while the attack surface is supposed to be very limited. Still, no problem changing it if needed be.
Given my comments above, I think we might need to upgrade the DEX pallet to v1.3.0 to proceed with the v1.3.0 upgrade so that we can take more time to think about all the impacts of the integration of the Asset Conversion pallet, and bring all the necessary changes in a proper way. Let's not rush it. |
I already upgraded the dex pallet to 1.3.0. Still, it was causing compilation problems that were very hard to debug. |
hi! I'd like to jump in the discussion with some thoughts. TL:DR I would implement I fully understand the reason behind moving into a more standard way of managing assets I think that implementing a second instance of Since I think that is not Trappist purpose, I would promote a protectionist approach to assets and implement asset conversion only to local assets, and for outsiders tokens applications keep on limiting ourselves to accept tokens from other chains only as reserve asset transfers with a local derivative created and registered through asset registry that requires sudo, therefore we would be managing only tokens that were willingly approved by sudo/governance. Overall I think is best to push as much asset related functionality to AH to lower the chances of scams (with scam versions of the same asset) and the creation of multiple exchange rates (one on Trappist, one on AH) that eventually would be arbitraged but that is not always a good experiences for users. To wrap up, I see the use case for asset management for Trappist to be as follow:
Wdyt ? |
@metricaez Great feedback, very insightful. I agree with the approach, and this also has the benefit of showcasing the integration of the FRAME |
@stiiifff @metricaez I just pushed 4346a71 that removes the foreign asset instance and only allows pallet-asset-conversion to trade locally. |
Updated to latest main branch. |
Closes #281