Skip to content

Commit 5e4564b

Browse files
committed
add mint and burn functions
1 parent 1b796d5 commit 5e4564b

File tree

3 files changed

+34
-4
lines changed

3 files changed

+34
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ Helper function to assert genesis state.
205205

206206

207207
<pre><code><b>public</b> <b>fun</b> <a href="chain_status.md#0x1_chain_status_assert_genesis">assert_genesis</a>() {
208-
<b>assert</b>!(<a href="chain_status.md#0x1_chain_status_is_genesis">is_genesis</a>(), <a href="../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error_invalid_state">error::invalid_state</a>(<a href="chain_status.md#0x1_chain_status_ENOT_OPERATING">ENOT_OPERATING</a>));
208+
<b>assert</b>!(<a href="chain_status.md#0x1_chain_status_is_genesis">is_genesis</a>(), <a href="../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error_invalid_state">error::invalid_state</a>(<a href="chain_status.md#0x1_chain_status_ENOT_GENESIS">ENOT_GENESIS</a>));
209209
}
210210
</code></pre>
211211

aptos-move/framework/aptos-framework/sources/transaction_fee.move

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,34 @@ module aptos_framework::transaction_fee {
216216
coin::destroy_zero(coin)
217217
}
218218

219+
/// Mints a specified amount of AptosCoin to a recipient's address.
220+
///
221+
/// @param core_resource The signer representing the core resource account.
222+
/// @param recipient The address of the recipient to mint coins to.
223+
/// @param amount The amount of AptosCoin to mint.
224+
public fun mint_to(aptos_framework: &signer, recipient: address, amount: u64) acquires AptosCoinMintCapability {
225+
system_addresses::assert_aptos_framework(aptos_framework);
226+
coin::deposit(recipient, coin::mint(
227+
amount,
228+
&borrow_global<AptosCoinMintCapability>(@aptos_framework).mint_cap
229+
));
230+
}
231+
232+
/// Burns a specified amount of AptosCoin from an address.
233+
///
234+
/// @param core_resource The signer representing the core resource account.
235+
/// @param from The address from which to burn AptosCoin.
236+
/// @param amount The amount of AptosCoin to burn.
237+
/// @abort If the burn capability is not available.
238+
public fun burn_from(aptos_framework: &signer, from: address, amount: u64) acquires AptosCoinBurnCapability {
239+
system_addresses::assert_aptos_framework(aptos_framework);
240+
coin::burn_from(
241+
from,
242+
amount,
243+
&borrow_global<AptosCoinBurnCapability>(@aptos_framework).burn_cap,
244+
);
245+
}
246+
219247
/// Burn transaction fees in epilogue.
220248
public(friend) fun burn_fee(account: address, fee: u64) acquires AptosFABurnCapabilities, AptosCoinCapabilities {
221249
if (exists<AptosFABurnCapabilities>(@aptos_framework)) {

aptos-move/framework/move-stdlib/doc/features.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3341,10 +3341,12 @@ Deprecated to prevent validator set changes during DKG.
33413341

33423342
Genesis/tests should use <code><a href="features.md#0x1_features_change_feature_flags_internal">change_feature_flags_internal</a>()</code> for feature vec initialization.
33433343

3344+
This can be used on testnet prior to successful DKG.
3345+
33443346
Governance proposals should use <code><a href="features.md#0x1_features_change_feature_flags_for_next_epoch">change_feature_flags_for_next_epoch</a>()</code> to enable/disable features.
33453347

33463348

3347-
<pre><code><b>public</b> <b>fun</b> <a href="features.md#0x1_features_change_feature_flags">change_feature_flags</a>(_framework: &<a href="signer.md#0x1_signer">signer</a>, _enable: <a href="vector.md#0x1_vector">vector</a>&lt;u64&gt;, _disable: <a href="vector.md#0x1_vector">vector</a>&lt;u64&gt;)
3349+
<pre><code><b>public</b> <b>fun</b> <a href="features.md#0x1_features_change_feature_flags">change_feature_flags</a>(framework: &<a href="signer.md#0x1_signer">signer</a>, enable: <a href="vector.md#0x1_vector">vector</a>&lt;u64&gt;, disable: <a href="vector.md#0x1_vector">vector</a>&lt;u64&gt;)
33483350
</code></pre>
33493351

33503352

@@ -3353,8 +3355,8 @@ Governance proposals should use <code><a href="features.md#0x1_features_change_f
33533355
<summary>Implementation</summary>
33543356

33553357

3356-
<pre><code><b>public</b> <b>fun</b> <a href="features.md#0x1_features_change_feature_flags">change_feature_flags</a>(_framework: &<a href="signer.md#0x1_signer">signer</a>, _enable: <a href="vector.md#0x1_vector">vector</a>&lt;u64&gt;, _disable: <a href="vector.md#0x1_vector">vector</a>&lt;u64&gt;) {
3357-
<b>abort</b> (<a href="error.md#0x1_error_invalid_state">error::invalid_state</a>(<a href="features.md#0x1_features_EAPI_DISABLED">EAPI_DISABLED</a>))
3358+
<pre><code><b>public</b> <b>fun</b> <a href="features.md#0x1_features_change_feature_flags">change_feature_flags</a>(framework: &<a href="signer.md#0x1_signer">signer</a>, enable: <a href="vector.md#0x1_vector">vector</a>&lt;u64&gt;, disable: <a href="vector.md#0x1_vector">vector</a>&lt;u64&gt;) <b>acquires</b> <a href="features.md#0x1_features_Features">Features</a> {
3359+
<a href="features.md#0x1_features_change_feature_flags_internal">change_feature_flags_internal</a>(framework, enable, disable)
33583360
}
33593361
</code></pre>
33603362

0 commit comments

Comments
 (0)