Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Framework] remove unnecessary lines creating resource acct signer #5486

Merged
merged 1 commit into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,7 @@ the SignerCapability.
<a href="../../aptos-stdlib/doc/simple_map.md#0x1_simple_map_destroy_empty">simple_map::destroy_empty</a>(store);
};

<b>let</b> resource = <a href="account.md#0x1_account_create_signer_with_capability">account::create_signer_with_capability</a>(&resource_signer_cap);
<a href="account.md#0x1_account_rotate_authentication_key_internal">account::rotate_authentication_key_internal</a>(&resource, <a href="resource_account.md#0x1_resource_account_ZERO_AUTH_KEY">ZERO_AUTH_KEY</a>);
<a href="account.md#0x1_account_rotate_authentication_key_internal">account::rotate_authentication_key_internal</a>(resource, <a href="resource_account.md#0x1_resource_account_ZERO_AUTH_KEY">ZERO_AUTH_KEY</a>);
resource_signer_cap
}
</code></pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@
///
/// Code snippets to help:
/// ```
/// fun init_module(source: &signer) {
/// fun init_module(resource: &signer) {
/// let dev_address = @DEV_ADDR;
/// let signer_cap = retrieve_resource_account_cap(&source, dev_address);
/// let lp_signer = create_signer_with_capability(&signer_cap);
/// let signer_cap = retrieve_resource_account_cap(resource, dev_address);
/// let lp = LiquidityPoolInfo { signer_cap: signer_cap, ... };
/// move_to(&lp_signer, lp);
/// move_to(resource, lp);
/// }
/// ```
///
Expand Down Expand Up @@ -182,8 +181,7 @@ module aptos_framework::resource_account {
simple_map::destroy_empty(store);
};

let resource = account::create_signer_with_capability(&resource_signer_cap);
account::rotate_authentication_key_internal(&resource, ZERO_AUTH_KEY);
account::rotate_authentication_key_internal(resource, ZERO_AUTH_KEY);
resource_signer_cap
}

Expand Down
9 changes: 4 additions & 5 deletions aptos-move/move-examples/mint_nft/sources/minting.move
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,16 @@ module mint_nft::minting {

// change source_addr to the actual account that created the resource account
let resource_signer_cap = resource_account::retrieve_resource_account_cap(resource_account, @source_addr);
let resource_signer = account::create_signer_with_capability(&resource_signer_cap);

// create the nft collection
let maximum_supply = 0;
let mutate_setting = vector<bool>[ false, false, false ];
let resource_account_address = signer::address_of(&resource_signer);
token::create_collection(&resource_signer, collection_name, description, collection_uri, maximum_supply, mutate_setting);
let resource_account_address = signer::address_of(resource_account);
token::create_collection(resource_account, collection_name, description, collection_uri, maximum_supply, mutate_setting);

// create a token data id to specify which token will be minted
let token_data_id = token::create_tokendata(
&resource_signer,
resource_account,
collection_name,
token_name,
string::utf8(b""),
Expand All @@ -156,7 +155,7 @@ module mint_nft::minting {
token_data_id,
expiration_timestamp,
minting_enabled: true,
token_minting_events: account::new_event_handle<TokenMintingEvent>(&resource_signer),
token_minting_events: account::new_event_handle<TokenMintingEvent>(resource_account),
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ module resource_account::simple_defi {
fun init_module(account: &signer) {
// store the capabilities within `ModuleData`
let resource_signer_cap = resource_account::retrieve_resource_account_cap(account, @source_addr);
let resource_signer = account::create_signer_with_capability(&resource_signer_cap);
let (burn_cap, freeze_cap, mint_cap) = coin::initialize<ChloesCoin>(
&resource_signer,
account,
string::utf8(b"Chloe's Coin"),
string::utf8(b"CCOIN"),
8,
Expand Down