Acala icon indicating copy to clipboard operation
Acala copied to clipboard

using more concise way to express `Trader`

Open zqhxuyuan opened this issue 4 years ago • 1 comments

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.

zqhxuyuan avatar Dec 15 '21 01:12 zqhxuyuan

need to refactor FixedRateOfAssetRegistry and TransactionFeePoolTrader after https://github.com/AcalaNetwork/Acala/issues/2167

zqhxuyuan avatar May 28 '22 17:05 zqhxuyuan