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: track pending payments to MBSM #851

Merged
merged 4 commits into from
Dec 13, 2024
Merged

feat: track pending payments to MBSM #851

merged 4 commits into from
Dec 13, 2024

Conversation

shekohex
Copy link
Contributor

@shekohex shekohex commented Dec 12, 2024

Summary of changes
Changes introduced in this pull request:
This pull request introduces several significant changes to the pallets/services module, focusing on enhancing the handling of ERC20 tokens, adding new error types, and implementing mechanisms for staging and refunding service payments. Key changes include modifications to the erc20_transfer function, the addition of new error types, and updates to the storage and event handling logic. Additionally, the pull request includes extensive updates to the testing framework to ensure the correctness of these new features.

Enhancements to ERC20 Token Handling:

  • Modified the erc20_transfer function to accept from as an H160 type instead of deriving it from the caller's account ID. This change simplifies the function and improves its flexibility.

New Error Types:

  • Added new error types such as MissingEVMOrigin, ExpectedEVMAddress, and ExpectedAccountId to handle specific error scenarios related to EVM addresses and account IDs.

Storage and Event Handling:

  • Introduced a new storage map StagingServicePayments to hold service payment information temporarily until the service is initiated or refunded. This ensures accurate tracking and management of service payments.
  • Implemented logic to handle the transfer of payments to the Master Blueprint Service Manager (MBSM) upon service initiation and to refund payments to the requester if the service is rejected. [1] [2]

Testing Framework Updates:

  • Updated existing tests and added new ones to cover scenarios involving ERC20 token payments, including service requests, approvals, rejections, and refunds. These tests ensure that the new features work as expected and maintain the integrity of the system. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]

These changes collectively enhance the robustness and functionality of the pallets/services module, particularly in handling ERC20 token transactions and managing service payments.

Reference issue to close (if applicable)

Closes tangle-network/tnt-core#27

@shekohex
Copy link
Contributor Author

Adding more tests to ensure everything is working.

@shekohex shekohex marked this pull request as ready for review December 13, 2024 15:17
Copy link
Contributor

@1xstj 1xstj left a comment

Choose a reason for hiding this comment

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

LG, just nits

pallets/services/src/lib.rs Show resolved Hide resolved
pallets/services/src/mock.rs Show resolved Hide resolved
@drewstone drewstone merged commit af5234c into main Dec 13, 2024
3 checks passed
@drewstone drewstone deleted the shady/srvs-paytrack branch December 13, 2024 18: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.

[TASK] Create payment collection mechanism
3 participants