Acala
Acala copied to clipboard
using more concise way to express `Trader`
current we have a lot of FixedRateOfFungible, maybe gets more later. we could support a more concise way to use Trader. i.e:
FixedRateOfFungibles<(KsmPerSecond, KusdPerSecond, ...), ToTreasury>
Also the implementation of FixedRateOfForeignAsset and newly PeriodUpdatedRateOfFungible, and existing FixedRateOfFungible have some common behavior: calculate the final units_per_second. for doing that, different implementation offered different way:
-
FixedRateOfFungible: Get<(AssetId, u128)> -
FixedRateOfForeignAsset: calculate ed_ratio by asset_metadatas -
PeriodUpdatedRateOfFungible: get rate from storage
may be we could supply a trait: GetRate that support get rate by AssetId, and let they implements GetRate.
need to refactor FixedRateOfAssetRegistry and TransactionFeePoolTrader after https://github.com/AcalaNetwork/Acala/issues/2167