-
Notifications
You must be signed in to change notification settings - Fork 77
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: OTC fees #863
feat: OTC fees #863
Conversation
@@ -291,14 +305,17 @@ pub mod pallet { | |||
let who = ensure_signed(origin)?; | |||
let order = <Orders<T>>::get(order_id).ok_or(Error::<T>::OrderNotFound)?; | |||
|
|||
Self::execute_order(&order, &who, order.amount_in, order.amount_out)?; | |||
let fee = Self::calculate_fee(order.amount_out); |
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.
why not to have the fee calculation inside the execute_order ? you would not need extra parameter and there would be only one place to calculate it.
i get you need to have the fee amount in the event, but the execute order can return the amount.
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.
Initially it was there, but I didn't like returning fee
from execute_order()
. It doesn't make a lot of sense. But I can change it
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.
or you can move the deposit event into execute order as well.
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.
sounds good, thanks
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.
in the latest version, we need fee in some check prior calling execute_order, so I will leave it as it is
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.
lgtm
Crate versions that have been updated:
Runtime version has been increased. |
No description provided.