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

SYS-4189 multi currency support #435

Merged
merged 21 commits into from
Sep 20, 2024
Merged

Conversation

nahuseyoum
Copy link
Contributor

@nahuseyoum nahuseyoum commented Sep 16, 2024

Proposed changes

This PR enables support for multi currency payment when sending transactions via the Gateway. This means users will be able to pay Relayers in a variety of ERC20 tokens.

Tests and Benchmarks are also updated to be compatible.

Type of change/Merge

🚨What type of change is this PR?

Put an x in the boxes that apply

  • Release
    • Increase versions
    • Baseline tests passed
    • Release type:
      • Major release
      • Minor release
      • Patch release

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR.

  • You describe the purpose of the PR, e.g.:
    • What does it do?
    • Highlight what important points reviewers should know about;
    • Indicates if there is something left for follow-up PRs.
  • Documentation updated
  • Business logic tested successfully
  • Verify First, Write Last: In Substrate development, it is important that you always ensure preconditions are met and return errors at the beginning. After these checks have completed, then you may begin the function's computation.

Copy link
Contributor

@thadouk thadouk left a comment

Choose a reason for hiding this comment

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

Overall nice work. Is it possible to avoid the hardcoding of mnemonics and the dependency between accounts and genesis.

@@ -211,7 +233,7 @@ impl<T: Config> Pallet<T> {

pub(crate) fn charge_fee(
proof: &Proof<T::Signature, T::AccountId>,
payment_info: PaymentInfo<T::AccountId, BalanceOf<T>, T::Signature>,
payment_info: PaymentInfo<T::AccountId, BalanceOf<T>, T::Signature, T::Token>,
Copy link
Contributor

Choose a reason for hiding this comment

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

can this be abused? meaning any ERC20 token can be used as a payment proof?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a good question. If someone sends a transaction direct to chain, and decides to pay for it, it will be done voluntarily (the whole payment_info is optional). The real check to make sure supported tokens are used as payment is done in the gateway by the relayer.

@nahuseyoum nahuseyoum merged commit 9a74ed6 into main Sep 20, 2024
5 checks passed
@nahuseyoum nahuseyoum deleted the nahu-sys-4189-multiCurrencySupport branch September 20, 2024 11:11
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.

4 participants