diff --git a/aptos-move/framework/aptos-framework/doc/coin.md b/aptos-move/framework/aptos-framework/doc/coin.md
index c5ff5884262a7..07e97171f99b1 100644
--- a/aptos-move/framework/aptos-framework/doc/coin.md
+++ b/aptos-move/framework/aptos-framework/doc/coin.md
@@ -1440,7 +1440,7 @@ Create APT pairing by passing AptosCoin
.
};
primary_fungible_store::create_primary_store_enabled_fungible_asset(
&metadata_object_cref,
- option::map(coin_supply<CoinType>(), |_| MAX_U128),
+ option::none(),
name<CoinType>(),
symbol<CoinType>(),
decimals<CoinType>(),
@@ -4595,6 +4595,27 @@ The creator of CoinType
must be @aptos_framework
.
+Make sure name
and symbol
are legal length.
+Only the creator of CoinType
can initialize.
+
+
+
+
+
+
schema InitializeInternalSchema<CoinType> {
+ account: signer;
+ name: vector<u8>;
+ symbol: vector<u8>;
+ let account_addr = signer::address_of(account);
+ let coin_address = type_info::type_of<CoinType>().account_address;
+ aborts_if coin_address != account_addr;
+ aborts_if exists<CoinInfo<CoinType>>(account_addr);
+ aborts_if len(name) > MAX_COIN_NAME_LENGTH;
+ aborts_if len(symbol) > MAX_COIN_SYMBOL_LENGTH;
+}
+
+
+
diff --git a/aptos-move/framework/aptos-framework/doc/fungible_asset.md b/aptos-move/framework/aptos-framework/doc/fungible_asset.md
index 2c58cdd944dac..f12ee14942b4f 100644
--- a/aptos-move/framework/aptos-framework/doc/fungible_asset.md
+++ b/aptos-move/framework/aptos-framework/doc/fungible_asset.md
@@ -3321,12 +3321,12 @@ Destroy an empty fungible asset.
public(friend) fun deposit_internal(store_addr: address, fa: FungibleAsset) acquires FungibleStore, ConcurrentFungibleBalance {
let FungibleAsset { metadata, amount } = fa;
- if (amount == 0) return;
-
assert!(exists<FungibleStore>(store_addr), error::not_found(EFUNGIBLE_STORE_EXISTENCE));
let store = borrow_global_mut<FungibleStore>(store_addr);
assert!(metadata == store.metadata, error::invalid_argument(EFUNGIBLE_ASSET_AND_STORE_MISMATCH));
+ if (amount == 0) return;
+
if (store.balance == 0 && concurrent_fungible_balance_exists_inline(store_addr)) {
let balance_resource = borrow_global_mut<ConcurrentFungibleBalance>(store_addr);
aggregator_v2::add(&mut balance_resource.balance, amount);
diff --git a/aptos-move/framework/aptos-framework/sources/coin.move b/aptos-move/framework/aptos-framework/sources/coin.move
index 19a41f144b1f7..91a54edb7fddd 100644
--- a/aptos-move/framework/aptos-framework/sources/coin.move
+++ b/aptos-move/framework/aptos-framework/sources/coin.move
@@ -328,7 +328,7 @@ module aptos_framework::coin {
};
primary_fungible_store::create_primary_store_enabled_fungible_asset(
&metadata_object_cref,
- option::map(coin_supply(), |_| MAX_U128),
+ option::none(),
name(),
symbol(),
decimals(),
@@ -2080,6 +2080,7 @@ module aptos_framework::coin {
let (mint_ref, mint_ref_receipt) = get_paired_mint_ref(&mint_cap);
let (burn_ref, burn_ref_receipt) = get_paired_burn_ref(&burn_cap);
let fungible_asset = fungible_asset::mint(&mint_ref, 50);
+ assert!(option::is_none(&fungible_asset::maximum(ensure_paired_metadata())), 0);
assert!(supply() == option::some(150), 0);
assert!(coin_supply() == option::some(100), 0);
assert!(fungible_asset::supply(ensure_paired_metadata()) == option::some(50), 0);
diff --git a/aptos-move/framework/aptos-framework/sources/fungible_asset.move b/aptos-move/framework/aptos-framework/sources/fungible_asset.move
index 1b12cb49a2c61..946d7b05eb415 100644
--- a/aptos-move/framework/aptos-framework/sources/fungible_asset.move
+++ b/aptos-move/framework/aptos-framework/sources/fungible_asset.move
@@ -1011,12 +1011,12 @@ module aptos_framework::fungible_asset {
public(friend) fun deposit_internal(store_addr: address, fa: FungibleAsset) acquires FungibleStore, ConcurrentFungibleBalance {
let FungibleAsset { metadata, amount } = fa;
- if (amount == 0) return;
-
assert!(exists(store_addr), error::not_found(EFUNGIBLE_STORE_EXISTENCE));
let store = borrow_global_mut(store_addr);
assert!(metadata == store.metadata, error::invalid_argument(EFUNGIBLE_ASSET_AND_STORE_MISMATCH));
+ if (amount == 0) return;
+
if (store.balance == 0 && concurrent_fungible_balance_exists_inline(store_addr)) {
let balance_resource = borrow_global_mut(store_addr);
aggregator_v2::add(&mut balance_resource.balance, amount);