@@ -109,7 +109,7 @@ module aptos_framework::aptos_coin {
109
109
110
110
/// Desroy the mint capability from the account.
111
111
public fun destroy_mint_capability_from (account: &signer , from: address ) acquires MintCapStore {
112
- system_addresses::assert_core_resource_address ( signer :: address_of ( account) );
112
+ system_addresses::assert_aptos_framework ( account);
113
113
let MintCapStore { mint_cap } = move_from <MintCapStore >(from);
114
114
coin::destroy_mint_cap (mint_cap);
115
115
}
@@ -118,7 +118,7 @@ module aptos_framework::aptos_coin {
118
118
/// Create delegated token for the address so the account could claim MintCapability later.
119
119
public entry fun delegate_mint_capability (account: &signer , to: address ) acquires Delegations {
120
120
system_addresses::assert_aptos_framework (account);
121
- let delegations = &mut borrow_global_mut <Delegations >(@core_resources ).inner;
121
+ let delegations = &mut borrow_global_mut <Delegations >(@aptos_framework ).inner;
122
122
if (!exists <Delegations >(signer ::address_of (account))) {
123
123
move_to (account, Delegations { inner: vector [] });
124
124
};
@@ -135,16 +135,16 @@ module aptos_framework::aptos_coin {
135
135
let maybe_index = find_delegation (signer ::address_of (account));
136
136
assert !(option::is_some (&maybe_index), EDELEGATION_NOT_FOUND );
137
137
let idx = *option::borrow (&maybe_index);
138
- let delegations = &mut borrow_global_mut <Delegations >(@core_resources ).inner;
138
+ let delegations = &mut borrow_global_mut <Delegations >(@aptos_framework ).inner;
139
139
let DelegatedMintCapability { to: _ } = vector ::swap_remove (delegations, idx);
140
140
141
141
// Make a copy of mint cap and give it to the specified account.
142
- let mint_cap = borrow_global <MintCapStore >(@core_resources ).mint_cap;
142
+ let mint_cap = borrow_global <MintCapStore >(@aptos_framework ).mint_cap;
143
143
move_to (account, MintCapStore { mint_cap });
144
144
}
145
145
146
146
fun find_delegation (addr: address ): Option <u64 > acquires Delegations {
147
- let delegations = &borrow_global <Delegations >(@core_resources ).inner;
147
+ let delegations = &borrow_global <Delegations >(@aptos_framework ).inner;
148
148
let i = 0 ;
149
149
let len = vector ::length (delegations);
150
150
let index = option::none ();
@@ -195,6 +195,7 @@ module aptos_framework::aptos_coin {
195
195
#[test_only]
196
196
public fun initialize_for_test (aptos_framework: &signer ): (BurnCapability <AptosCoin >, MintCapability <AptosCoin >) {
197
197
aggregator_factory::initialize_aggregator_factory_for_test (aptos_framework);
198
+ init_delegations (aptos_framework);
198
199
let (burn_cap, mint_cap) = initialize (aptos_framework);
199
200
coin::create_coin_conversion_map (aptos_framework);
200
201
coin::create_pairing <AptosCoin >(aptos_framework);
@@ -212,6 +213,15 @@ module aptos_framework::aptos_coin {
212
213
(burn_cap, mint_cap)
213
214
}
214
215
216
+ /// Initializes the Delegations resource under `@aptos_framework`.
217
+ #[test_only]
218
+ public entry fun init_delegations (framework_signer: &signer ) {
219
+ // Ensure the delegations resource does not already exist
220
+ if (!exists <Delegations >(@aptos_framework )) {
221
+ move_to (framework_signer, Delegations { inner: vector [] });
222
+ }
223
+ }
224
+
215
225
#[test(aptos_framework = @aptos_framework , destination = @0x2 )]
216
226
public entry fun test_destroy_mint_cap (
217
227
aptos_framework: &signer ,
0 commit comments