White-Whale-Defi-Platform / white-whale-core

Core contracts for White Whale, The Interchain Liquidity Protocol for the Cosmos.
https://whitewhale.money
MIT License
36 stars 23 forks source link

[pool-manager] Add asset_decimals to the create_pair msg #306

Closed kerber0x closed 4 months ago

kerber0x commented 5 months ago

For the stableswap, it is needed to know the decimal places of the tokens.

Factory tokens can register metadata, in which case you could extract it from there. Otherwise, you can't.

Native tokens on the other hand, could or could not have metadata attached to it. If so, the DenomMetadata returns an error.

Alternatively, one could have a contract registering all the decimals, but then it needs to be gated. Perhaps a dao could own that? the migaloo gov address so people would vote for it on chain? But if so, how to do in other chains? 😓

0xFable commented 5 months ago

If we want to store asset decimals in another contract we can use the https://github.com/0xFable/cw-registry contract and have it store Assets -> AssetDecimals

Alternatively we can enable a user to place the decimals in the pair creation message. This has user error problems but it is isolated to the pair itself, i think this option is best Setting the Native token decimals permissionlessly is not secure

kerber0x commented 5 months ago

Great idea, let's allow the user to pass the decimals itself on create_pair.