-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(exchange)!: Update IntentionResolvedDirectTradeFees event #262
feat(exchange)!: Update IntentionResolvedDirectTradeFees event #262
Conversation
0482012
to
c71e596
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks ok to me.
Add intention_id to the IntentionResolvedDirectTradeFees event. This commit resolves galacticcouncil#248.
c71e596
to
35d8ba4
Compare
@@ -260,9 +261,10 @@ impl<'a, T: Config> DirectTradeData<'a, T> { | |||
} | |||
|
|||
/// Send pallet event after a fee is transferred. | |||
fn send_trade_fee_event(from: &T::AccountId, to: &T::AccountId, asset: AssetId, amount: Balance) { | |||
fn send_trade_fee_event(from: &T::AccountId, intention: &Intention<T>, to: &T::AccountId, asset: AssetId, amount: Balance) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we only send fee from one side?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is sent for each intention/transaction. you can see it in the tests.
Add intention_id to the IntentionResolvedDirectTradeFees event.
This commit resolves #248.
This change changes the signature of the IntentionResolvedDirectTradeFees event.
I think it does it for good - to be similar to
IntentionResolvedDirectTrade
Description
The change is pretty straightforward, on each direct match we have access to two intentions and by the
fee: true
flag we already know all of the tranansactions which are taking part in taking the fees. Also those transactions has a fieldfrom
. So, by matching thatfrom
field with intention data we are computing the intention IDs.In my opinion it is a pretty robust way of doing things. Because I didn't touch the matching rules, and also, the change will adopt itself to any further changes in the fees rules.
Related Issue
Fixes: #248
Motivation and Context
That missing field is pretty important to any tools which want to drill down into the transaction costs. Otherwise they all will have the same snippet of decyphering other emitted events.
How Has This Been Tested?
Run tests locally. Worked. Unbelivable. Broke tests, verified they got broken. Fixed back.
Checklist: