Skip to content

Commit

Permalink
[FA] no withdraw event for burn
Browse files Browse the repository at this point in the history
  • Loading branch information
lightmark committed Dec 2, 2024
1 parent 5d87d94 commit a8d769c
Show file tree
Hide file tree
Showing 10 changed files with 275 additions and 70 deletions.
4 changes: 2 additions & 2 deletions aptos-move/framework/aptos-framework/doc/aptos_account.md
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ to transfer APT) - if we want to allow APT PFS without account itself
// <b>as</b> APT cannot be frozen or have dispatch, and PFS cannot be transfered
// (PFS could potentially be burned. regular transfer would permanently unburn the store.
// Ignoring the check here <b>has</b> the equivalent of unburning, transfers, and then burning again)
<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));
<a href="fungible_asset.md#0x1_fungible_asset_raw_deposit">fungible_asset::raw_deposit</a>(recipient_store, <a href="fungible_asset.md#0x1_fungible_asset_raw_withdraw">fungible_asset::raw_withdraw</a>(sender_store, amount));
}
</code></pre>

Expand Down Expand Up @@ -765,7 +765,7 @@ Burn from APT Primary FungibleStore
// 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.
<b>if</b> (amount != 0) {
<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>);
<a href="fungible_asset.md#0x1_fungible_asset_address_burn_from">fungible_asset::address_burn_from</a>(ref, store_addr, amount);
<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);
};
}
</code></pre>
Expand Down
9 changes: 6 additions & 3 deletions aptos-move/framework/aptos-framework/doc/coin.md
Original file line number Diff line number Diff line change
Expand Up @@ -2538,9 +2538,12 @@ Note: This bypasses CoinStore::frozen -- coins within a frozen CoinStore can be
<a href="coin.md#0x1_coin_burn">burn</a>(coin_to_burn, burn_cap);
};
<b>if</b> (fa_amount_to_burn &gt; 0) {
<a href="fungible_asset.md#0x1_fungible_asset_burn_from">fungible_asset::burn_from</a>(
<a href="fungible_asset.md#0x1_fungible_asset_address_burn_from_for_gas">fungible_asset::address_burn_from_for_gas</a>(
<a href="coin.md#0x1_coin_borrow_paired_burn_ref">borrow_paired_burn_ref</a>(burn_cap),
<a href="primary_fungible_store.md#0x1_primary_fungible_store_primary_store">primary_fungible_store::primary_store</a>(account_addr, <a href="../../aptos-stdlib/../move-stdlib/doc/option.md#0x1_option_destroy_some">option::destroy_some</a>(<a href="coin.md#0x1_coin_paired_metadata">paired_metadata</a>&lt;CoinType&gt;())),
<a href="primary_fungible_store.md#0x1_primary_fungible_store_primary_store_address">primary_fungible_store::primary_store_address</a>(
account_addr,
<a href="../../aptos-stdlib/../move-stdlib/doc/option.md#0x1_option_destroy_some">option::destroy_some</a>(<a href="coin.md#0x1_coin_paired_metadata">paired_metadata</a>&lt;CoinType&gt;())
),
fa_amount_to_burn
);
};
Expand Down Expand Up @@ -2670,7 +2673,7 @@ This is for internal use only and doesn't emit an DepositEvent.
<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>);
<b>let</b> metadata = <a href="fungible_asset.md#0x1_fungible_asset_asset_metadata">fungible_asset::asset_metadata</a>(&fa);
<b>let</b> store = <a href="primary_fungible_store.md#0x1_primary_fungible_store_primary_store">primary_fungible_store::primary_store</a>(account_addr, metadata);
<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);
<a href="fungible_asset.md#0x1_fungible_asset_deposit_to_for_gas">fungible_asset::deposit_to_for_gas</a>(<a href="object.md#0x1_object_object_address">object::object_address</a>(&store), fa);
} <b>else</b> {
<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>)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ The semantics of deposit will be governed by the function specified in DispatchF
<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>));
fa
} <b>else</b> {
<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)
<a href="fungible_asset.md#0x1_fungible_asset_raw_withdraw">fungible_asset::raw_withdraw</a>(<a href="object.md#0x1_object_object_address">object::object_address</a>(&store), amount)
}
}
</code></pre>
Expand Down Expand Up @@ -283,7 +283,7 @@ The semantics of deposit will be governed by the function specified in DispatchF
func
)
} <b>else</b> {
<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)
<a href="fungible_asset.md#0x1_fungible_asset_raw_deposit">fungible_asset::raw_deposit</a>(<a href="object.md#0x1_object_object_address">object::object_address</a>(&store), fa)
}
}
</code></pre>
Expand Down
Loading

0 comments on commit a8d769c

Please sign in to comment.