-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Create benchmark #14916
Create benchmark #14916
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
module 0xABCD::permissioned_transfer { | ||
use aptos_framework::aptos_account; | ||
use aptos_framework::permissioned_signer; | ||
use aptos_framework::primary_fungible_store; | ||
|
||
public entry fun transfer_permissioned( | ||
source: &signer, to: address, amount: u64 | ||
) { | ||
let handle = permissioned_signer::create_permissioned_handle(source); | ||
let permissioned_signer = permissioned_signer::signer_from_permissioned_handle(&handle); | ||
|
||
primary_fungible_store::grant_apt_permission(source, &permissioned_signer, amount); | ||
aptos_account::transfer(&permissioned_signer, to, amount); | ||
|
||
permissioned_signer::destroy_permissioned_handle(handle); | ||
} | ||
Comment on lines
+7
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Spotted by Graphite Reviewer |
||
|
||
public entry fun transfer( | ||
source: &signer, to: address, amount: u64 | ||
) { | ||
aptos_account::transfer(source, to, amount); | ||
} | ||
} |
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
permissioned_signer
retains its APT transfer permissions after the transfer completes. To maintain proper permission hygiene, callprimary_fungible_store::revoke_apt_permission(source, &permissioned_signer)
before destroying the handle. This ensures no permissions persist beyond their intended use.Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.