@@ -17,6 +17,7 @@ modified from https://github.com/move-language/move/tree/main/language/documenta
17
17
- [ Function ` destroy_mint_cap ` ] ( #0x1_aptos_coin_destroy_mint_cap )
18
18
- [ Function ` configure_accounts_for_test ` ] ( #0x1_aptos_coin_configure_accounts_for_test )
19
19
- [ Function ` mint ` ] ( #0x1_aptos_coin_mint )
20
+ - [ Function ` destroy_mint_capability_from ` ] ( #0x1_aptos_coin_destroy_mint_capability_from )
20
21
- [ Function ` delegate_mint_capability ` ] ( #0x1_aptos_coin_delegate_mint_capability )
21
22
- [ Function ` claim_mint_capability ` ] ( #0x1_aptos_coin_claim_mint_capability )
22
23
- [ Function ` find_delegation ` ] ( #0x1_aptos_coin_find_delegation )
@@ -260,7 +261,7 @@ Only called during genesis to destroy the aptos framework account's mint capabil
260
261
and accounts have been initialized during genesis.
261
262
262
263
263
- <pre ><code ><b >public</b >(<b >friend</b >) <b >fun</b > <a href =" aptos_coin.md#0x1_aptos_coin_destroy_mint_cap " >destroy_mint_cap</a >(aptos_framework : &<a href =" ../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer " >signer</a >)
264
+ <pre ><code ><b >public</b >(<b >friend</b >) <b >fun</b > <a href =" aptos_coin.md#0x1_aptos_coin_destroy_mint_cap " >destroy_mint_cap</a >(< a href = " account.md#0x1_account " >account</ a > : &<a href =" ../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer " >signer</a >)
264
265
</code ></pre >
265
266
266
267
@@ -269,8 +270,8 @@ and accounts have been initialized during genesis.
269
270
<summary >Implementation</summary >
270
271
271
272
272
- <pre ><code ><b >public</b >(<b >friend</b >) <b >fun</b > <a href =" aptos_coin.md#0x1_aptos_coin_destroy_mint_cap " >destroy_mint_cap</a >(aptos_framework : &<a href =" ../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer " >signer</a >) <b >acquires</b > <a href =" aptos_coin.md#0x1_aptos_coin_MintCapStore " >MintCapStore</a > {
273
- <a href =" system_addresses.md#0x1_system_addresses_assert_aptos_framework " >system_addresses::assert_aptos_framework</a >(aptos_framework );
273
+ <pre ><code ><b >public</b >(<b >friend</b >) <b >fun</b > <a href =" aptos_coin.md#0x1_aptos_coin_destroy_mint_cap " >destroy_mint_cap</a >(< a href = " account.md#0x1_account " >account</ a > : &<a href =" ../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer " >signer</a >) <b >acquires</b > <a href =" aptos_coin.md#0x1_aptos_coin_MintCapStore " >MintCapStore</a > {
274
+ <a href =" system_addresses.md#0x1_system_addresses_assert_aptos_framework " >system_addresses::assert_aptos_framework</a >(< a href = " account.md#0x1_account " >account</ a > );
274
275
<b >let</b > <a href =" aptos_coin.md#0x1_aptos_coin_MintCapStore " >MintCapStore</a > { mint_cap } = <b >move_from</b >< ; <a href =" aptos_coin.md#0x1_aptos_coin_MintCapStore " >MintCapStore</a >> ; (@aptos_framework);
275
276
<a href =" coin.md#0x1_coin_destroy_mint_cap " >coin::destroy_mint_cap</a >(mint_cap);
276
277
}
@@ -358,6 +359,33 @@ Create new coins and deposit them into dst_addr's account.
358
359
359
360
360
361
362
+ </details >
363
+
364
+ <a id =" 0x1_aptos_coin_destroy_mint_capability_from " ></a >
365
+
366
+ ## Function ` destroy_mint_capability_from `
367
+
368
+ Desroy the mint capability from the account.
369
+
370
+
371
+ <pre ><code ><b >public</b > <b >fun</b > <a href =" aptos_coin.md#0x1_aptos_coin_destroy_mint_capability_from " >destroy_mint_capability_from</a >(<a href =" account.md#0x1_account " >account</a >: &<a href =" ../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer " >signer</a >, from: <b >address</b >)
372
+ </code ></pre >
373
+
374
+
375
+
376
+ <details >
377
+ <summary >Implementation</summary >
378
+
379
+
380
+ <pre ><code ><b >public</b > <b >fun</b > <a href =" aptos_coin.md#0x1_aptos_coin_destroy_mint_capability_from " >destroy_mint_capability_from</a >(<a href =" account.md#0x1_account " >account</a >: &<a href =" ../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer " >signer</a >, from: <b >address</b >) <b >acquires</b > <a href =" aptos_coin.md#0x1_aptos_coin_MintCapStore " >MintCapStore</a > {
381
+ <a href =" system_addresses.md#0x1_system_addresses_assert_aptos_framework " >system_addresses::assert_aptos_framework</a >(<a href =" account.md#0x1_account " >account</a >);
382
+ <b >let</b > <a href =" aptos_coin.md#0x1_aptos_coin_MintCapStore " >MintCapStore</a > { mint_cap } = <b >move_from</b >< ; <a href =" aptos_coin.md#0x1_aptos_coin_MintCapStore " >MintCapStore</a >> ; (from);
383
+ <a href =" coin.md#0x1_coin_destroy_mint_cap " >coin::destroy_mint_cap</a >(mint_cap);
384
+ }
385
+ </code ></pre >
386
+
387
+
388
+
361
389
</details >
362
390
363
391
<a id =" 0x1_aptos_coin_delegate_mint_capability " ></a >
@@ -368,7 +396,7 @@ Only callable in tests and testnets where the core resources account exists.
368
396
Create delegated token for the address so the account could claim MintCapability later.
369
397
370
398
371
- <pre ><code ><b >public</b > entry <b >fun</b > <a href =" aptos_coin.md#0x1_aptos_coin_delegate_mint_capability " >delegate_mint_capability</a >(<a href =" account.md#0x1_account " >account</a >: <a href =" ../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer " >signer</a >, <b >to</b >: <b >address</b >)
399
+ <pre ><code ><b >public</b > entry <b >fun</b > <a href =" aptos_coin.md#0x1_aptos_coin_delegate_mint_capability " >delegate_mint_capability</a >(<a href =" account.md#0x1_account " >account</a >: & <a href =" ../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer " >signer</a >, <b >to</b >: <b >address</b >)
372
400
</code ></pre >
373
401
374
402
@@ -377,9 +405,12 @@ Create delegated token for the address so the account could claim MintCapability
377
405
<summary >Implementation</summary >
378
406
379
407
380
- <pre ><code ><b >public</b > entry <b >fun</b > <a href =" aptos_coin.md#0x1_aptos_coin_delegate_mint_capability " >delegate_mint_capability</a >(<a href =" account.md#0x1_account " >account</a >: <a href =" ../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer " >signer</a >, <b >to</b >: <b >address</b >) <b >acquires</b > <a href =" aptos_coin.md#0x1_aptos_coin_Delegations " >Delegations</a > {
381
- <a href =" system_addresses.md#0x1_system_addresses_assert_core_resource " >system_addresses::assert_core_resource</a >(&<a href =" account.md#0x1_account " >account</a >);
382
- <b >let</b > delegations = &<b >mut</b > <b >borrow_global_mut</b >< ; <a href =" aptos_coin.md#0x1_aptos_coin_Delegations " >Delegations</a >> ; (@core_resources).inner;
408
+ <pre ><code ><b >public</b > entry <b >fun</b > <a href =" aptos_coin.md#0x1_aptos_coin_delegate_mint_capability " >delegate_mint_capability</a >(<a href =" account.md#0x1_account " >account</a >: &<a href =" ../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer " >signer</a >, <b >to</b >: <b >address</b >) <b >acquires</b > <a href =" aptos_coin.md#0x1_aptos_coin_Delegations " >Delegations</a > {
409
+ <a href =" system_addresses.md#0x1_system_addresses_assert_aptos_framework " >system_addresses::assert_aptos_framework</a >(<a href =" account.md#0x1_account " >account</a >);
410
+ <b >let</b > delegations = &<b >mut</b > <b >borrow_global_mut</b >< ; <a href =" aptos_coin.md#0x1_aptos_coin_Delegations " >Delegations</a >> ; (@aptos_framework).inner;
411
+ <b >if</b > (!<b >exists</b >< ; <a href =" aptos_coin.md#0x1_aptos_coin_Delegations " >Delegations</a >> ; (<a href =" ../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer_address_of " >signer::address_of</a >(<a href =" account.md#0x1_account " >account</a >))) {
412
+ <b >move_to</b >(<a href =" account.md#0x1_account " >account</a >, <a href =" aptos_coin.md#0x1_aptos_coin_Delegations " >Delegations</a > { inner: <a href =" ../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector " >vector</a >[] });
413
+ };
383
414
<a href =" ../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_for_each_ref " >vector::for_each_ref</a >(delegations, |element| {
384
415
<b >let</b > element: &<a href =" aptos_coin.md#0x1_aptos_coin_DelegatedMintCapability " >DelegatedMintCapability</a > = element;
385
416
<b >assert</b >!(element.<b >to</b > != <b >to</b >, <a href =" ../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error_invalid_argument " >error::invalid_argument</a >(<a href =" aptos_coin.md#0x1_aptos_coin_EALREADY_DELEGATED " >EALREADY_DELEGATED</a >));
@@ -413,11 +444,11 @@ Claim the delegated mint capability and destroy the delegated token.
413
444
<b >let</b > maybe_index = <a href =" aptos_coin.md#0x1_aptos_coin_find_delegation " >find_delegation</a >(<a href =" ../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer_address_of " >signer::address_of</a >(<a href =" account.md#0x1_account " >account</a >));
414
445
<b >assert</b >!(<a href =" ../../aptos-stdlib/../move-stdlib/doc/option.md#0x1_option_is_some " >option::is_some</a >(&maybe_index), <a href =" aptos_coin.md#0x1_aptos_coin_EDELEGATION_NOT_FOUND " >EDELEGATION_NOT_FOUND</a >);
415
446
<b >let</b > idx = *<a href =" ../../aptos-stdlib/../move-stdlib/doc/option.md#0x1_option_borrow " >option::borrow</a >(&maybe_index);
416
- <b >let</b > delegations = &<b >mut</b > <b >borrow_global_mut</b >< ; <a href =" aptos_coin.md#0x1_aptos_coin_Delegations " >Delegations</a >> ; (@core_resources ).inner;
447
+ <b >let</b > delegations = &<b >mut</b > <b >borrow_global_mut</b >< ; <a href =" aptos_coin.md#0x1_aptos_coin_Delegations " >Delegations</a >> ; (@aptos_framework ).inner;
417
448
<b >let</b > <a href =" aptos_coin.md#0x1_aptos_coin_DelegatedMintCapability " >DelegatedMintCapability</a > { <b >to</b >: _ } = <a href =" ../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_swap_remove " >vector::swap_remove</a >(delegations, idx);
418
449
419
450
// Make a <b >copy</b > of mint cap and give it <b >to</b > the specified <a href =" account.md#0x1_account " >account</a >.
420
- <b >let</b > mint_cap = <b >borrow_global</b >< ; <a href =" aptos_coin.md#0x1_aptos_coin_MintCapStore " >MintCapStore</a >> ; (@core_resources ).mint_cap;
451
+ <b >let</b > mint_cap = <b >borrow_global</b >< ; <a href =" aptos_coin.md#0x1_aptos_coin_MintCapStore " >MintCapStore</a >> ; (@aptos_framework ).mint_cap;
421
452
<b >move_to</b >(<a href =" account.md#0x1_account " >account</a >, <a href =" aptos_coin.md#0x1_aptos_coin_MintCapStore " >MintCapStore</a > { mint_cap });
422
453
}
423
454
</code ></pre >
@@ -442,7 +473,7 @@ Claim the delegated mint capability and destroy the delegated token.
442
473
443
474
444
475
<pre ><code ><b >fun</b > <a href =" aptos_coin.md#0x1_aptos_coin_find_delegation " >find_delegation</a >(addr: <b >address</b >): Option< ; u64> ; <b >acquires</b > <a href =" aptos_coin.md#0x1_aptos_coin_Delegations " >Delegations</a > {
445
- <b >let</b > delegations = &<b >borrow_global</b >< ; <a href =" aptos_coin.md#0x1_aptos_coin_Delegations " >Delegations</a >> ; (@core_resources ).inner;
476
+ <b >let</b > delegations = &<b >borrow_global</b >< ; <a href =" aptos_coin.md#0x1_aptos_coin_Delegations " >Delegations</a >> ; (@aptos_framework ).inner;
446
477
<b >let</b > i = 0;
447
478
<b >let</b > len = <a href =" ../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_length " >vector::length</a >(delegations);
448
479
<b >let</b > index = <a href =" ../../aptos-stdlib/../move-stdlib/doc/option.md#0x1_option_none " >option::none</a >();
@@ -552,13 +583,13 @@ Claim the delegated mint capability and destroy the delegated token.
552
583
### Function ` destroy_mint_cap `
553
584
554
585
555
- <pre ><code ><b >public</b >(<b >friend</b >) <b >fun</b > <a href =" aptos_coin.md#0x1_aptos_coin_destroy_mint_cap " >destroy_mint_cap</a >(aptos_framework : &<a href =" ../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer " >signer</a >)
586
+ <pre ><code ><b >public</b >(<b >friend</b >) <b >fun</b > <a href =" aptos_coin.md#0x1_aptos_coin_destroy_mint_cap " >destroy_mint_cap</a >(< a href = " account.md#0x1_account " >account</ a > : &<a href =" ../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer " >signer</a >)
556
587
</code ></pre >
557
588
558
589
559
590
560
591
561
- <pre ><code ><b >let</b > addr = <a href =" ../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer_address_of " >signer::address_of</a >(aptos_framework );
592
+ <pre ><code ><b >let</b > addr = <a href =" ../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer_address_of " >signer::address_of</a >(< a href = " account.md#0x1_account " >account</ a > );
562
593
<b >aborts_if</b > addr != @aptos_framework;
563
594
<b >aborts_if</b > !<b >exists</b >< ; <a href =" aptos_coin.md#0x1_aptos_coin_MintCapStore " >MintCapStore</a >> ; (@aptos_framework);
564
595
</code ></pre >
@@ -602,7 +633,7 @@ Claim the delegated mint capability and destroy the delegated token.
602
633
### Function ` delegate_mint_capability `
603
634
604
635
605
- <pre ><code ><b >public</b > entry <b >fun</b > <a href =" aptos_coin.md#0x1_aptos_coin_delegate_mint_capability " >delegate_mint_capability</a >(<a href =" account.md#0x1_account " >account</a >: <a href =" ../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer " >signer</a >, <b >to</b >: <b >address</b >)
636
+ <pre ><code ><b >public</b > entry <b >fun</b > <a href =" aptos_coin.md#0x1_aptos_coin_delegate_mint_capability " >delegate_mint_capability</a >(<a href =" account.md#0x1_account " >account</a >: & <a href =" ../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer " >signer</a >, <b >to</b >: <b >address</b >)
606
637
</code ></pre >
607
638
608
639
0 commit comments