Skip to content

Commit 18b5686

Browse files
committed
fix: on primary_fungible_store::transfer, create account if does not exist
1 parent aa45303 commit 18b5686

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

aptos-move/framework/aptos-framework/sources/primary_fungible_store.move

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ module aptos_framework::primary_fungible_store {
1515
use aptos_framework::dispatchable_fungible_asset;
1616
use aptos_framework::fungible_asset::{Self, FungibleAsset, FungibleStore, Metadata, MintRef, TransferRef, BurnRef};
1717
use aptos_framework::object::{Self, Object, ConstructorRef, DeriveRef};
18+
use aptos_framework::account;
1819

1920
use std::option::Option;
2021
use std::signer;
@@ -182,6 +183,8 @@ module aptos_framework::primary_fungible_store {
182183
recipient: address,
183184
amount: u64,
184185
) acquires DeriveRefPod {
186+
// Create account if it does not yet exist, otherwise funds may get stuck in new accounts.
187+
account::create_account_if_does_not_exist(recipient);
185188
let sender_store = ensure_primary_store_exists(signer::address_of(sender), metadata);
186189
// Check if the sender store object has been burnt or not. If so, unburn it first.
187190
may_be_unburn(sender, sender_store);

0 commit comments

Comments
 (0)