Skip to content

Conversation

@0xleal
Copy link
Member

@0xleal 0xleal commented Jan 31, 2025

No description provided.

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]);
Copy link
Member

Choose a reason for hiding this comment

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

transferFrom can fail silently.

Suggested change
token.transferFrom(msg.sender, _recipients[i], _amounts[i]);
require(token.transferFrom(msg.sender, _recipients[i], _amounts[i]), "Transfer failed");

Copy link
Collaborator

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?

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 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 {
Copy link
Collaborator

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?

Copy link
Member Author

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

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