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

Update Refund Function to Skip Treasury Transfer for Zero Fee #43

Open
Shallysunny opened this issue Jul 25, 2024 · 0 comments · Fixed by #44
Open

Update Refund Function to Skip Treasury Transfer for Zero Fee #43

Shallysunny opened this issue Jul 25, 2024 · 0 comments · Fixed by #44
Assignees

Comments

@Shallysunny
Copy link

Shallysunny commented Jul 25, 2024

User Story

As a developer, I want to ensure that the refund fee is not transferred to the treasury if the fee value is 0, so that unnecessary transactions are avoided.

Acceptance Criteria

  1. GIVEN an order with a refund fee of 0,
    WHEN the refund function is called,
    THEN the system should not transfer the refund fee to the treasury.

  2. GIVEN an order with a refund fee greater than 0,
    WHEN the refund function is called,
    THEN the system should transfer the refund fee to the treasury as usual.

Product & Design Links:

Tech Details:

  • Update the refund function to include a check that ensures the refund fee is not transferred to the treasury if the fee value is 0.
  • Ensure proper error handling and validation for the refund functionality.

Open Questions:

Notes/Assumptions:

Code Changes

Update the refund function as follows:

function refund(uint256 _fee, bytes32 _orderId) external onlyAggregator returns (bool) {
    ...

    // transfer refund fee to the treasury if the fee is not 0
    if (_fee != 0) {
        IERC20(order[_orderId].token).transfer(treasuryAddress, _fee);
    }

   ...
}
@chibie chibie changed the title Implement Transfer Protocol to Refund Fee Only When the Provided Fee Value is Not Zero Update Refund Function to Skip Treasury Transfer for Zero Fee Jul 27, 2024
@chibie chibie removed their assignment Jul 27, 2024
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 a pull request may close this issue.

3 participants