Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
ERC-20 token transfer example and improvements to NFT #209
ERC-20 token transfer example and improvements to NFT #209
Changes from 21 commits
55c7031
012c5e6
72ff65b
2715a72
b4f8749
e360b47
95914a5
ee7ad2f
7d73ae0
bdacd74
0f5ad41
9108b37
8affa13
e959412
c01dac3
49dbabc
a26a56d
ee5ce68
5de7d5f
0adfb61
3bbcab0
e5f9b6f
fb8e5a8
fbed6dc
726f485
246361d
a98517d
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๐ ๏ธ Refactor suggestion
Add address validation and improve event emission.
The function should validate the new counterparty address and include the old value in the event for better traceability.
Apply this improvement:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add security checks and follow CEI pattern.
The function has several security considerations that should be addressed:
Apply these security improvements:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๐ ๏ธ Refactor suggestion
Add amount validation in onCall function.
The function should validate the minting amount to prevent potential issues.
Apply this improvement:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implement revert handling logic.
The empty
onRevert
function could lead to lost tokens in case of cross-chain transfer failures. Consider implementing proper revert handling logic to ensure tokens can be recovered.Would you like me to provide an implementation for handling cross-chain transfer reverts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid hardcoding the system contract address
Hardcoding the
systemContract
address reduces flexibility and can lead to issues if the address changes across different networks or environments. Consider passing the address as a constructor parameter or providing a setter function with appropriate access control to allow for configuration.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add input validation and reentrancy protection
The
transferCrossChain
function needs additional security measures:ReentrancyGuard
Apply this diff:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enhance security in onCall function
The
onCall
function needs improvements:Apply this diff:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๐ ๏ธ Refactor suggestion
Add validation in onRevert function
The
onRevert
function should validate the decoded parameters.