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

Implement pallet that extends our current treasury pallet with buyout feature #396

Conversation

bogdanS98
Copy link
Contributor

@bogdanS98 bogdanS98 commented Jan 11, 2024

Closes #395.

Overview

This pallet allows users which hold other assets than our native asset to exchange them against the treasury in return for our native. This is limited by the assets supported, minimum and maximum buyout amounts and buyout period (after which the total buyout amount for a user is reset).

Buyout limit can only be changed by root. If set to None, then there is no amount limit for buyouts.

This pallet was only added for Foucoco runtime in this PR.

Assets supported

Amplitude

  • USDT
  • KSM

Pendulum

  • USDC
  • USDT
  • DOT
  • GLMR

Notes:

  1. We still have to properly define the values of the following parameters for each runtime:
  • SellFee
  • MinAmountToBuyout
  • BuyoutPeriod
  1. This pallet has yet to be tested in Polkadot.js

@bogdanS98 bogdanS98 requested a review from a team January 11, 2024 22:48
@bogdanS98 bogdanS98 self-assigned this Jan 11, 2024
Copy link
Member

@ebma ebma left a comment

Choose a reason for hiding this comment

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

I left some comments.

Overall I think we should never use '+,-,*,/' operators directly and rather use defensive operations like 'saturating_..' or 'checked_..'.
And I think we can remove the tight coupling to the oracle pallet.

Besides that we also need the logic for the signed extension but I know you are aware of this and it's still a WIP PR after all.

@bogdanS98 bogdanS98 marked this pull request as ready for review February 1, 2024 17:31
@bogdanS98 bogdanS98 requested a review from a team February 1, 2024 17:45
@bogdanS98 bogdanS98 changed the title [WIP] Implement pallet that extends our current treasury pallet with buyout feature Implement pallet that extends our current treasury pallet with buyout feature Feb 1, 2024
@bogdanS98 bogdanS98 requested review from ebma and gianfra-t February 8, 2024 16:19
Copy link
Member

@ebma ebma left a comment

Choose a reason for hiding this comment

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

Nice changes 👍 I think it would have been fine to just make the extrinsic such that the list is totally replaced, ie. implementing a setter and ignoring the last state. But it's fine either way 🤷

@bogdanS98 bogdanS98 requested a review from ebma February 9, 2024 17:59
Copy link
Contributor

@gianfra-t gianfra-t left a comment

Choose a reason for hiding this comment

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

I checked the changes since last review and everything looks ready! I just left a comment but I don't think it is a blocker.

Copy link
Member

@ebma ebma left a comment

Choose a reason for hiding this comment

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

I think it's good (better now with the simpler extrinsic). Just left a comment on the benchmark which is more an FYI, I don't mind if you don't change it @bogdanS98 and a question.

Copy link
Member

@ebma ebma left a comment

Choose a reason for hiding this comment

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

I think it's ready for merge now 👍

@bogdanS98 bogdanS98 requested a review from ebma February 13, 2024 17:42
@bogdanS98 bogdanS98 merged commit eb45880 into main Feb 13, 2024
2 checks passed
@bogdanS98 bogdanS98 deleted the 395-implement-pallet-that-extends-our-current-treasury-pallet-with-buyout-feature branch February 13, 2024 17:45
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.

Implement pallet that extends our current treasury pallet with buyout feature
3 participants