Skip to content
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

Merged
merged 18 commits into from
Jul 16, 2024
Merged

feat: OTC fees #863

merged 18 commits into from
Jul 16, 2024

Conversation

Roznovjak
Copy link
Contributor

No description provided.

@@ -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);
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good, thanks

Copy link
Contributor Author

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

@Roznovjak Roznovjak marked this pull request as ready for review July 12, 2024 10:42
Copy link
Contributor

@vgantchev vgantchev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link

github-actions bot commented Jul 15, 2024

Crate versions that have been updated:

  • pallet-otc: v1.1.5 -> v2.0.0
  • pallet-otc-settlements: v1.0.0 -> v1.0.1
  • hydradx-runtime: v246.0.0 -> v247.0.0

Runtime version has been increased.

@Roznovjak Roznovjak merged commit d86308e into master Jul 16, 2024
5 checks passed
@Roznovjak Roznovjak deleted the otc_fee branch July 16, 2024 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants