-
Notifications
You must be signed in to change notification settings - Fork 23
create simple contract for multi send #114
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
base: master
Are you sure you want to change the base?
Conversation
contracts/utils/MultiSendERC20.sol
Outdated
| require(_recipients.length <= arrayLimit, "Array length exceeds limit"); | ||
| uint8 i = 0; | ||
| for (i; i < _recipients.length; i++) { | ||
| token.transferFrom(msg.sender, _recipients[i], _amounts[i]); |
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.
transferFrom can fail silently.
| token.transferFrom(msg.sender, _recipients[i], _amounts[i]); | |
| require(token.transferFrom(msg.sender, _recipients[i], _amounts[i]), "Transfer failed"); |
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.
The require here will possibly stop the process in the middle of the batch. Is this what you want? Maybe you just want to emit a not transferred event and let the function continue?
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.
Probably best to let the entire process fail rather than sending to some addresses, so that however is calling doesn't have to after the fact process all the events that were done to check for which got tokens or not
| arrayLimit = _arrayLimit; | ||
| } | ||
|
|
||
| function multisendToken(address[] calldata _recipients, uint256[] calldata _amounts) public { |
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.
Don't you want this to be called only by the owner?
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.
No need, since the tokens are sent from the message owner we don't need that control. The only thing I want to control is the limit of how many can be sent at a time
No description provided.