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

1️⃣ One Token Model - New Pallet Proxy Bonding #399

Merged
merged 2 commits into from
Oct 10, 2024

Conversation

JuaniRios
Copy link
Contributor

@JuaniRios JuaniRios commented Sep 10, 2024

What?

  • Make it possible for users of the funding pallet to avoid having to bond PLMC when participating, and instead pay a fee to have the treasury bond its own PLMC

Why?

  • Participants no longer need to hold any PLMC to participate, especially if we allow paying extrinsics with USDT/C/DOT
  • Better UI/UX

How?

  • Add a new pallet called proxy-bonding.
  • This pallet exposes a function called bond_on_behalf_of which takes the account, bond amount, fee asset id, derivation path (project id), and the hold reason.
    • The function does a transfer_on_hold of the bond amount from the treasury, into a sub account generated using the derivation path, and pays the fee from the account to the sub_account,.
  • A function called set_release_type decides whether the the fee will go to the configured fee recipient, or will be refunded. Also decides if the bond can be immediately send back to the treasury, or after a set block
  • A function refund_fee refunds the fee of a certain user/bond if the release type was configured as refunded.
  • An extrinsic transfer_bonds_back_to_treasury does what the name entails, and checks the release type for when it can be done successfully
  • An extrinsic transfer_fees_to_recipient does what the name entails, only if the release type is Locked(n) and not Refunded

Testing?

One for each release type.

Anything Else?

If the design is approved by the reviewers, I can include the integration tests in a separate PR after this.

@JuaniRios JuaniRios changed the title one-token-model 1️⃣ One Token Model Sep 10, 2024
@JuaniRios JuaniRios force-pushed the 09-10-one-token-model branch 5 times, most recently from 9cea8b2 to 1e0a680 Compare September 13, 2024 13:54
@JuaniRios JuaniRios marked this pull request as ready for review September 13, 2024 14:01
Copy link
Member

@lrazovic lrazovic left a comment

Choose a reason for hiding this comment

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

Few nits here and there, but the logic looks good and aligns with what we discussed. Just a few minor issues to iron out. I'll approve this once we have some integration tests in place to verify it works as expected on our runtime.

pallets/proxy-bonding/src/tests.rs Outdated Show resolved Hide resolved
polimec-common/common/src/lib.rs Show resolved Hide resolved
pallets/proxy-bonding/src/lib.rs Show resolved Hide resolved
pallets/proxy-bonding/src/lib.rs Show resolved Hide resolved
pallets/proxy-bonding/src/lib.rs Show resolved Hide resolved
pallets/proxy-bonding/src/functions.rs Outdated Show resolved Hide resolved
@JuaniRios JuaniRios force-pushed the 09-10-one-token-model branch 2 times, most recently from edf4404 to b13ff8f Compare September 18, 2024 09:46
@JuaniRios JuaniRios changed the title 1️⃣ One Token Model 1️⃣ One Token Model - New Pallet Sep 19, 2024
@JuaniRios JuaniRios changed the title 1️⃣ One Token Model - New Pallet 1️⃣ One Token Model - New Pallet Sep 19, 2024
@JuaniRios JuaniRios changed the title 1️⃣ One Token Model - New Pallet 1️⃣ One Token Model - New Pallet Proxy Bonding Sep 19, 2024
Copy link
Collaborator

@vstam1 vstam1 left a comment

Choose a reason for hiding this comment

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

Think logic looks good. Couple of comments, but can be merged once comments are addressed

pallets/proxy-bonding/src/functions.rs Show resolved Hide resolved
pallets/proxy-bonding/src/functions.rs Show resolved Hide resolved
pallets/proxy-bonding/src/functions.rs Show resolved Hide resolved
Copy link
Contributor Author

JuaniRios commented Oct 10, 2024

Merge activity

  • Oct 10, 10:08 AM EDT: A user started a stack merge that includes this pull request via Graphite.
  • Oct 10, 10:08 AM EDT: A user merged this pull request with Graphite.

@JuaniRios JuaniRios merged commit c30938a into main Oct 10, 2024
1 check passed
@JuaniRios JuaniRios deleted the 09-10-one-token-model branch October 10, 2024 14:08
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