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: added pausability to ics20 #257

Merged
merged 7 commits into from
Feb 5, 2025
Merged

feat: added pausability to ics20 #257

merged 7 commits into from
Feb 5, 2025

Conversation

srdtrk
Copy link
Member

@srdtrk srdtrk commented Feb 5, 2025

Description

closes: #231


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Linked to GitHub issue with discussion and accepted design, OR link to spec that describes this work.
  • Wrote unit and integration tests.
  • Added relevant natspec and godoc comments.
  • Provide a conventional commit message to follow the repository standards.
  • Re-reviewed Files changed in the GitHub PR explorer.
  • Review SonarCloud Report in the comment section below once CI passes.

Copy link

codecov bot commented Feb 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.48%. Comparing base (305da82) to head (d64a80c).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #257      +/-   ##
==========================================
+ Coverage   99.46%   99.48%   +0.01%     
==========================================
  Files          12       13       +1     
  Lines         560      580      +20     
==========================================
+ Hits          557      577      +20     
  Misses          3        3              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@srdtrk srdtrk marked this pull request as ready for review February 5, 2025 21:03
Copy link
Contributor

@gjermundgaraba gjermundgaraba left a comment

Choose a reason for hiding this comment

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

Just left a few small comments for improvement, but looks good otherwise!

function sendTransfer(IICS20TransferMsgs.SendTransferMsg calldata msg_)
external
override
whenNotPaused
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the "when" part is implied. I think it should be notPaused.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is inherited from openzeppelin, the name isn't defined by us


vm.prank(ics20Pauser);
ics20Transfer.unpause();
assert(!ics20Transfer.paused());
Copy link
Contributor

Choose a reason for hiding this comment

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

should probably test that the function can be called after unpause

Copy link
Member Author

Choose a reason for hiding this comment

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

Probably not needed as this requires adding unrelated transfer helpers such as an erc20 contract into this test suite. I think simply checking that the contract is not paused and trusting openzeppelin is not so bad. Moreover, this can be fixed by a migration if it ever comes to it,

address newPauser = makeAddr("newPauser");

ics20Transfer.setPauser(newPauser);
assertEq(ics20Transfer.getPauser(), newPauser);
Copy link
Contributor

Choose a reason for hiding this comment

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

probably would be good to verify that you cannot call it with the old pauser, and that you can call it with the new one.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think getPauser() is enough since there is only a single state entry in the contract for pauser. This is a unit test, and the goal of the function is to change that state entry

@srdtrk srdtrk merged commit e0db3bd into main Feb 5, 2025
61 checks passed
@srdtrk srdtrk deleted the serdar/231-ics20-pause branch February 5, 2025 22:43
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.

Make ICS20Transfer pausable
2 participants