Skip to content

Commit 1706bf1

Browse files
committed
[FA] no withdraw event for burn
1 parent 81a2f42 commit 1706bf1

15 files changed

+208
-116
lines changed

aptos-move/framework/aptos-framework/doc/aptos_account.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
- [Function `register_apt`](#0x1_aptos_account_register_apt)
2626
- [Function `fungible_transfer_only`](#0x1_aptos_account_fungible_transfer_only)
2727
- [Function `is_fungible_balance_at_least`](#0x1_aptos_account_is_fungible_balance_at_least)
28-
- [Function `burn_from_fungible_store`](#0x1_aptos_account_burn_from_fungible_store)
28+
- [Function `burn_from_fungible_store_for_gas`](#0x1_aptos_account_burn_from_fungible_store_for_gas)
2929
- [Function `ensure_primary_fungible_store_exists`](#0x1_aptos_account_ensure_primary_fungible_store_exists)
3030
- [Function `primary_fungible_store_address`](#0x1_aptos_account_primary_fungible_store_address)
3131
- [Specification](#@Specification_1)
@@ -47,7 +47,7 @@
4747
- [Function `register_apt`](#@Specification_1_register_apt)
4848
- [Function `fungible_transfer_only`](#@Specification_1_fungible_transfer_only)
4949
- [Function `is_fungible_balance_at_least`](#@Specification_1_is_fungible_balance_at_least)
50-
- [Function `burn_from_fungible_store`](#@Specification_1_burn_from_fungible_store)
50+
- [Function `burn_from_fungible_store_for_gas`](#@Specification_1_burn_from_fungible_store_for_gas)
5151

5252

5353
<pre><code><b>use</b> <a href="account.md#0x1_account">0x1::account</a>;
@@ -707,7 +707,7 @@ to transfer APT) - if we want to allow APT PFS without account itself
707707
// <b>as</b> APT cannot be frozen or have dispatch, and PFS cannot be transfered
708708
// (PFS could potentially be burned. regular transfer would permanently unburn the store.
709709
// Ignoring the check here <b>has</b> the equivalent of unburning, transfers, and then burning again)
710-
<a href="fungible_asset.md#0x1_fungible_asset_deposit_internal">fungible_asset::deposit_internal</a>(recipient_store, <a href="fungible_asset.md#0x1_fungible_asset_withdraw_internal">fungible_asset::withdraw_internal</a>(sender_store, amount));
710+
<a href="fungible_asset.md#0x1_fungible_asset_unchecked_deposit">fungible_asset::unchecked_deposit</a>(recipient_store, <a href="fungible_asset.md#0x1_fungible_asset_unchecked_withdraw">fungible_asset::unchecked_withdraw</a>(sender_store, amount));
711711
}
712712
</code></pre>
713713

@@ -741,14 +741,14 @@ Is balance from APT Primary FungibleStore at least the given amount
741741

742742
</details>
743743

744-
<a id="0x1_aptos_account_burn_from_fungible_store"></a>
744+
<a id="0x1_aptos_account_burn_from_fungible_store_for_gas"></a>
745745

746-
## Function `burn_from_fungible_store`
746+
## Function `burn_from_fungible_store_for_gas`
747747

748-
Burn from APT Primary FungibleStore
748+
Burn from APT Primary FungibleStore for gas charge
749749

750750

751-
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="aptos_account.md#0x1_aptos_account_burn_from_fungible_store">burn_from_fungible_store</a>(ref: &<a href="fungible_asset.md#0x1_fungible_asset_BurnRef">fungible_asset::BurnRef</a>, <a href="account.md#0x1_account">account</a>: <b>address</b>, amount: u64)
751+
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="aptos_account.md#0x1_aptos_account_burn_from_fungible_store_for_gas">burn_from_fungible_store_for_gas</a>(ref: &<a href="fungible_asset.md#0x1_fungible_asset_BurnRef">fungible_asset::BurnRef</a>, <a href="account.md#0x1_account">account</a>: <b>address</b>, amount: u64)
752752
</code></pre>
753753

754754

@@ -757,15 +757,15 @@ Burn from APT Primary FungibleStore
757757
<summary>Implementation</summary>
758758

759759

760-
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="aptos_account.md#0x1_aptos_account_burn_from_fungible_store">burn_from_fungible_store</a>(
760+
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="aptos_account.md#0x1_aptos_account_burn_from_fungible_store_for_gas">burn_from_fungible_store_for_gas</a>(
761761
ref: &BurnRef,
762762
<a href="account.md#0x1_account">account</a>: <b>address</b>,
763763
amount: u64,
764764
) {
765765
// Skip burning <b>if</b> amount is zero. This shouldn't <a href="../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error">error</a> out <b>as</b> it's called <b>as</b> part of transaction fee burning.
766766
<b>if</b> (amount != 0) {
767767
<b>let</b> store_addr = <a href="aptos_account.md#0x1_aptos_account_primary_fungible_store_address">primary_fungible_store_address</a>(<a href="account.md#0x1_account">account</a>);
768-
<a href="fungible_asset.md#0x1_fungible_asset_address_burn_from">fungible_asset::address_burn_from</a>(ref, store_addr, amount);
768+
<a href="fungible_asset.md#0x1_fungible_asset_address_burn_from_for_gas">fungible_asset::address_burn_from_for_gas</a>(ref, store_addr, amount);
769769
};
770770
}
771771
</code></pre>
@@ -1294,12 +1294,12 @@ Check if the AptosCoin under the address existed.
12941294

12951295

12961296

1297-
<a id="@Specification_1_burn_from_fungible_store"></a>
1297+
<a id="@Specification_1_burn_from_fungible_store_for_gas"></a>
12981298

1299-
### Function `burn_from_fungible_store`
1299+
### Function `burn_from_fungible_store_for_gas`
13001300

13011301

1302-
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="aptos_account.md#0x1_aptos_account_burn_from_fungible_store">burn_from_fungible_store</a>(ref: &<a href="fungible_asset.md#0x1_fungible_asset_BurnRef">fungible_asset::BurnRef</a>, <a href="account.md#0x1_account">account</a>: <b>address</b>, amount: u64)
1302+
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="aptos_account.md#0x1_aptos_account_burn_from_fungible_store_for_gas">burn_from_fungible_store_for_gas</a>(ref: &<a href="fungible_asset.md#0x1_fungible_asset_BurnRef">fungible_asset::BurnRef</a>, <a href="account.md#0x1_account">account</a>: <b>address</b>, amount: u64)
13031303
</code></pre>
13041304

13051305

aptos-move/framework/aptos-framework/doc/coin.md

+2-10
Original file line numberDiff line numberDiff line change
@@ -2057,15 +2057,7 @@ or disallow upgradability of total supply.
20572057
<b>if</b> (<a href="coin.md#0x1_coin">coin</a>.value == 0) {
20582058
<a href="coin.md#0x1_coin_destroy_zero">destroy_zero</a>(<a href="coin.md#0x1_coin">coin</a>);
20592059
} <b>else</b> {
2060-
<b>if</b> (std::features::module_event_migration_enabled()) {
2061-
<a href="event.md#0x1_event_emit">event::emit</a>(<a href="coin.md#0x1_coin_CoinWithdraw">CoinWithdraw</a> { coin_type: type_name&lt;CoinType&gt;(), <a href="account.md#0x1_account">account</a>, amount: <a href="coin.md#0x1_coin">coin</a>.value });
2062-
} <b>else</b> {
2063-
<a href="event.md#0x1_event_emit_event">event::emit_event</a>&lt;<a href="coin.md#0x1_coin_WithdrawEvent">WithdrawEvent</a>&gt;(
2064-
&<b>mut</b> withdraw_events,
2065-
<a href="coin.md#0x1_coin_WithdrawEvent">WithdrawEvent</a> { amount: <a href="coin.md#0x1_coin">coin</a>.value },
2066-
);
2067-
};
2068-
<a href="fungible_asset.md#0x1_fungible_asset_deposit_internal">fungible_asset::deposit_internal</a>(object_address(&store), <a href="coin.md#0x1_coin_coin_to_fungible_asset">coin_to_fungible_asset</a>(<a href="coin.md#0x1_coin">coin</a>));
2060+
<a href="fungible_asset.md#0x1_fungible_asset_unchecked_deposit_with_no_events">fungible_asset::unchecked_deposit_with_no_events</a>(object_address(&store), <a href="coin.md#0x1_coin_coin_to_fungible_asset">coin_to_fungible_asset</a>(<a href="coin.md#0x1_coin">coin</a>));
20692061
};
20702062
<a href="event.md#0x1_event_destroy_handle">event::destroy_handle</a>(deposit_events);
20712063
<a href="event.md#0x1_event_destroy_handle">event::destroy_handle</a>(withdraw_events);
@@ -2710,7 +2702,7 @@ This is for internal use only and doesn't emit an DepositEvent.
27102702
<b>let</b> fa = <a href="coin.md#0x1_coin_coin_to_fungible_asset">coin_to_fungible_asset</a>(<a href="coin.md#0x1_coin">coin</a>);
27112703
<b>let</b> metadata = <a href="fungible_asset.md#0x1_fungible_asset_asset_metadata">fungible_asset::asset_metadata</a>(&fa);
27122704
<b>let</b> store = <a href="primary_fungible_store.md#0x1_primary_fungible_store_ensure_primary_store_exists">primary_fungible_store::ensure_primary_store_exists</a>(account_addr, metadata);
2713-
<a href="fungible_asset.md#0x1_fungible_asset_deposit_internal">fungible_asset::deposit_internal</a>(<a href="object.md#0x1_object_object_address">object::object_address</a>(&store), fa);
2705+
<a href="fungible_asset.md#0x1_fungible_asset_unchecked_deposit_with_no_events">fungible_asset::unchecked_deposit_with_no_events</a>(<a href="object.md#0x1_object_object_address">object::object_address</a>(&store), fa);
27142706
} <b>else</b> {
27152707
<b>abort</b> <a href="../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error_not_found">error::not_found</a>(<a href="coin.md#0x1_coin_ECOIN_STORE_NOT_PUBLISHED">ECOIN_STORE_NOT_PUBLISHED</a>)
27162708
}

aptos-move/framework/aptos-framework/doc/dispatchable_fungible_asset.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ The semantics of deposit will be governed by the function specified in DispatchF
239239
<b>assert</b>!(amount &lt;= start_balance - end_balance, <a href="../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error_aborted">error::aborted</a>(<a href="dispatchable_fungible_asset.md#0x1_dispatchable_fungible_asset_EAMOUNT_MISMATCH">EAMOUNT_MISMATCH</a>));
240240
fa
241241
} <b>else</b> {
242-
<a href="fungible_asset.md#0x1_fungible_asset_withdraw_internal">fungible_asset::withdraw_internal</a>(<a href="object.md#0x1_object_object_address">object::object_address</a>(&store), amount)
242+
<a href="fungible_asset.md#0x1_fungible_asset_unchecked_withdraw">fungible_asset::unchecked_withdraw</a>(<a href="object.md#0x1_object_object_address">object::object_address</a>(&store), amount)
243243
}
244244
}
245245
</code></pre>
@@ -283,7 +283,7 @@ The semantics of deposit will be governed by the function specified in DispatchF
283283
func
284284
)
285285
} <b>else</b> {
286-
<a href="fungible_asset.md#0x1_fungible_asset_deposit_internal">fungible_asset::deposit_internal</a>(<a href="object.md#0x1_object_object_address">object::object_address</a>(&store), fa)
286+
<a href="fungible_asset.md#0x1_fungible_asset_unchecked_deposit">fungible_asset::unchecked_deposit</a>(<a href="object.md#0x1_object_object_address">object::object_address</a>(&store), fa)
287287
}
288288
}
289289
</code></pre>

0 commit comments

Comments
 (0)