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

[Aptos Framework] Add batch versions of aptos_coin::transfer and transfer_coins #5895

Merged
merged 1 commit into from
Dec 16, 2022

Conversation

movekevin
Copy link
Contributor

No description provided.

@@ -40,6 +40,18 @@ module aptos_framework::aptos_account {
coin::register<AptosCoin>(&signer);
}

/// Batch version of APT transfer.
public entry fun batch_transfer(source: &signer, recipients: vector<address>, amounts: vector<u64>) {
let i = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

do we want to assert the vector lengths are the same?

Copy link
Contributor Author

@movekevin movekevin Dec 16, 2022

Choose a reason for hiding this comment

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

Updated. It is better to fail explicitly rather than discarding the extra amounts.

Copy link
Contributor

@0xchloe 0xchloe left a comment

Choose a reason for hiding this comment

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

looks pretty straightforward but do we want to add some simple unit test just to make sure that this works as expected?

@movekevin
Copy link
Contributor Author

looks pretty straightforward but do we want to add some simple unit test just to make sure that this works as expected?

Added

@movekevin movekevin merged this pull request into coin-register Dec 16, 2022
@movekevin movekevin deleted the coin-register-2 branch December 16, 2022 08:34
);

let i = 0;
let len = vector::length(&recipients);
Copy link
Contributor

Choose a reason for hiding this comment

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

we can save one length() if move this line up before line 75.

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.

3 participants