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.
Motivation:
This change introduces a
Batch-Transferaction to the token blueprint. This functionality is essential for scenarios requiring multiple token transfers from a single sender, such as airdrops, payroll, or reward distributions. Performing these transfers individually is inefficient, incurs higher message overhead, and lacks atomicity guarantees across the entire set of transfers. TheBatch-Transferaction addresses these issues by allowing multiple transfers to be processed within a single message, ensuring atomicity and reducing memory usage on the token process.Implementation Details:
Action = "Batch-Transfer".msg.Datafield, where each line represents a transfer in the formatrecipient_address,quantity.msg.From) balance is checked against this total quantity.Batch-Debit-Noticeis always sent back to the sender (viamsg.reply). This notice includes the total number of transfers (Count), the total quantity transferred (Total), and crucially, aBatch-Transfer-Init-Idtag containing themsg.Idof the originalBatch-Transfermessage for easy traceability.Transferaction, individualCredit-Noticemessages are sent to each recipient only if the initiatingBatch-Transfermessage does not include theCast = truetag. IfCastis present, these individual notifications are suppressed (recommended behavior).X-on the originalBatch-Transfermessage are forwarded to both theBatch-Debit-Noticeand any individualCredit-Noticemessages sent.Caveats:
recipient,quantity).