Skip to content
This repository has been archived by the owner on Jul 7, 2021. It is now read-only.

Accept Transaction Fees in Assets #5

Open
3 tasks
joepetrowski opened this issue Mar 15, 2021 · 3 comments
Open
3 tasks

Accept Transaction Fees in Assets #5

joepetrowski opened this issue Mar 15, 2021 · 3 comments

Comments

@joepetrowski
Copy link
Collaborator

Some assets, as allowed by the Relay Chain, will be accepted for the payment of transaction fees. The abstract logic should be handled in pallet-transaction-payment. This parachain will need the following:

  • Functions to allow/forbid the payment of transaction fees with a given AssetId
  • Function to set the DOT/KSM to Asset ratio with which to convert native fees
  • Privileged origins for these functions. Ideally setting the ratio has a unique origin that could be passed off to an oracle at some point in the future.
@jak-pan
Copy link

jak-pan commented Apr 10, 2021

FIY https://github.com/galacticcouncil/HydraDX-node/blob/master/pallets/transaction-multi-payment/src/lib.rs

We use this in HydraDX but! We have AMM to price/trade in the tx token. It will be quite hard to have correct pricing of transactions without an oracle since prices of tokens will probably fluctuate quite a lot after launching.

@apopiak apopiak self-assigned this Apr 30, 2021
@apopiak
Copy link
Contributor

apopiak commented May 4, 2021

I'm looking into how to implement this and I'm unsure about what to do with the fees:

  • Do we automatically convert the fees (in assets) to DOT and credit it to the staking pot (like the current implementation) while dropping (i.e. burning) the corresponding amount of the asset? This will mint DOTs on Statemint, though.
  • Or do we collect the assets into the treasury (account for that asset) and then pay out DOTs as well as assets to collators which I imagine will lead to lots of small amounts of assets flying around.

@apopiak
Copy link
Contributor

apopiak commented May 4, 2021

Based on conversation with @gavofyork the initial plan for calculating the assets tx fees is the following pseudocode:

let maybe_asset_fee = if asset.is_sufficient { 
    Some(asset.min_balance * dot_fee / Balances::existential_deposit())
} else {
    None
};

Meaning we will treat the minimum balance (in combination with the existential deposit) as a conversion ratio.
We don't need high fidelity prices as we just need to make sure that enough fees are paid to make it costly to attack.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Development

No branches or pull requests

3 participants