This repository has been archived by the owner on May 21, 2024. It is now read-only.
Custom HandleCredit implementation for block author rewards using on-chain DEX #100
Labels
enhancement
New feature or request
Milestone
The Trappist runtime uses the FRAME pallet-asset-tx-payment pallet to support paying for transaction fees in either the chain's native token or an arbitrary asset. This pallet is configured with a
FungiblesAdapter
that provides an implementation of theOnChargeAssetTransaction
trait, and is relying on the AssetsToBlockAuthor (from Cumulus) implementation of the HandleCredit trait. This implementation is rather simplistic as it attempts to transfer the transaction fees to the block author, and if it fails, the fees are burned.This issue proposes to create an example credit handler implementation with a more refined logic, that leverages Trappist's on-chain DEX:
add_liquidity
function of the DEX to add liquidity to the pool on behalf of the block author's account. This is a longer-term incentive to reward collators, with a self-reinforcing positive (feedback) loop as LP providers are rewarded in LP tokens and receive a portion of fees for every swap operations (based on their LP tokens share).This behavior mimics the block author rewards of Polkadot where 20% of the transaction fees go to the block author and 80% go to the on-chain treasury (the Trappist runtime does not have a Treasury).
Note: the pallet-dex should be be modified to define a trait for basic DEX operations (inquire whether a liquidity pool exists, add liquidity to a pool, perform a swap operation) so as to allow for a loosely-coupled integration with the credit handler (and a call to the add_liquidity & swap operations without the origin checks performed in the dispatchable calls).
Note: this is inspired by Alex Popiak's presentation at sub0 2021, where he mentioned (at the end of the presentation) some possible future improvements of the current
AssetsToBlockAuthor
implementation: see Statemint - Adding Support for Paying Transactions in AssetsThe text was updated successfully, but these errors were encountered: