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

fix(its): remove unnecessary use of payable in functions #298

Merged
merged 11 commits into from
Nov 11, 2024

Conversation

ahramy
Copy link
Contributor

@ahramy ahramy commented Nov 7, 2024

AXE-4706

  • I tested all functions with use of payable. To verify, I removed payable and ran unit tests one by one.

InterchainTokenFactory.sol

[x] deployInterchainToken -> MulticallFailed, unit test failed
[x] deployRemoteInterchainToken -> MulticallFailed, unit test failed
[x] registerCanonicalInterchainToken -> MulticallFailed, TakeTokenFailed, unit test failed
[x] deployRemoteCanonicalInterchainToken -> MulticallFailed, unit test failed

TokenHandler.sol

[o] giveToken -> payable can be removed.
[x] takeToken -> lockUnlockFee failed
[o] transferTokenFrom -> payable can be removed.
[x] postTokenManagerDeploy -> PostDeployFailed

InterchainTokenService.sol

[x] deployTokenManager -> failed
[x] deployInterchainToken -> Cannot set option "value" on a non-payable function type.
[x] expressExecute
[x] interchainTransfer -> MultiCallFailed, non-payable method cannot override value
[o] callContractWithInterchainToken -> payable can be removed.
=> Not sure we should remove it. Are we allowing ETH to be sent or not?
=> Unit test should be added.

TransmitInterchainToken.sol

[x] transmitInterchainTransfer -> Cannot set option "value" on a non-payable function type.

InterchainTokenStandard.sol

[x] interchainTransfer -> "msg.value" and "callvalue()" can only be used in payable public functions.
[x] interchainTransferFrom -> "msg.value" and "callvalue()" can only be used in payable public functions.

GatewayCaller.sol

[x] callContract -> GatewayCallFailed

TokenManagerDeployer

[x] deployTokenManager -> TokenManagerDeploymentFailed

@ahramy ahramy requested a review from a team as a code owner November 7, 2024 22:02
@codecov-commenter
Copy link

codecov-commenter commented Nov 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.79%. Comparing base (c58ed5e) to head (4eb655d).
Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #298      +/-   ##
==========================================
+ Coverage   97.67%   97.79%   +0.12%     
==========================================
  Files          19       19              
  Lines         601      545      -56     
  Branches      126      120       -6     
==========================================
- Hits          587      533      -54     
+ Misses          5        4       -1     
+ Partials        9        8       -1     

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

Copy link
Contributor

@Foivos Foivos left a comment

Choose a reason for hiding this comment

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

You cannot call non payable functions in multical, which is why the payable is needed on all these functions.

contracts/InterchainTokenService.sol Outdated Show resolved Hide resolved
contracts/InterchainTokenFactory.sol Outdated Show resolved Hide resolved
contracts/InterchainTokenFactory.sol Outdated Show resolved Hide resolved
contracts/TokenHandler.sol Outdated Show resolved Hide resolved
contracts/TokenHandler.sol Show resolved Hide resolved
@ahramy ahramy merged commit 3d0a371 into main Nov 11, 2024
5 checks passed
@ahramy ahramy deleted the fix/remove-unnecessary-payable branch November 11, 2024 06:48
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