virto-network / virto-node

Virto Network blockchain node.
GNU General Public License v3.0
21 stars 10 forks source link

Payment operations (superset of fee handler) #420

Open olanod opened 3 months ago

olanod commented 3 months ago

The FeeHandler in payments pallet returns a list of fees, that is, percentages of the total amount being transferred that need to be credited from the sender/receiver and sent to designated accounts(e.g. a community's treasury)

To account for more use cases such as discounts and other incentives we can generalize the concept more using something like:

enum PaymentOperation {
    Fee { ... }, // sender/receiver are credited funds sent to third-party account
    Discount { ... }, // third-party account sponsors part of the payment
    DerivedTransfer { ... }, // third-party account transfers funds to another third-party
}

The DerivedTransfer can cover cases like affiliate rewards where a given entity(e.g. a token issuer) wants to incentivize another entity(e.g. a community) based on the parameters of the payment(e.g. utilizing a token)