Skip to content

Commit

Permalink
Remove admin for mints
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnChangUK committed May 9, 2024
1 parent a76f5f4 commit 28e32dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 37 deletions.
40 changes: 5 additions & 35 deletions only-on-aptos/sources/only_on_aptos.move
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ module only_on_aptos::only_on_aptos {
) acquires CollectionConfig, MetadataConfig {
let user_addr = signer::address_of(user);
let token = mint_impl(
user,
collection_config_object,
user_addr,
);
Expand All @@ -136,32 +135,6 @@ module only_on_aptos::only_on_aptos {
});
}

// only used by txn emitter for load testing
public entry fun mint_with_admin_worker(
_worker: &signer,
admin: &signer,
collection_config_object: Object<CollectionConfig>,
recipient_addr: address,
) acquires CollectionConfig, MetadataConfig {
mint_with_admin_impl(
admin,
collection_config_object,
recipient_addr,
);
}

public entry fun mint_with_admin(
admin: &signer,
collection_config_object: Object<CollectionConfig>,
recipient_addr: address,
) acquires CollectionConfig, MetadataConfig {
mint_with_admin_impl(
admin,
collection_config_object,
recipient_addr,
);
}

public entry fun set_minting_status(
admin: &signer,
collection_config_object: Object<CollectionConfig>,
Expand Down Expand Up @@ -193,17 +166,14 @@ module only_on_aptos::only_on_aptos {
token_components::burn(&collection_signer, token);
}

public fun mint_with_admin_impl(
admin: &signer,
public fun mint_to_recipient(
collection_config_object: Object<CollectionConfig>,
recipient_addr: address,
): Object<Token> acquires CollectionConfig, MetadataConfig {
assert_owner(signer::address_of(admin), collection_config_object);
mint_impl(admin, collection_config_object, recipient_addr)
mint_impl(collection_config_object, recipient_addr)
}

fun mint_impl(
_minter: &signer,
collection_config_object: Object<CollectionConfig>,
recipient_addr: address,
): Object<Token> acquires CollectionConfig, MetadataConfig {
Expand All @@ -223,7 +193,7 @@ module only_on_aptos::only_on_aptos {
collection::name(collection),
metadata_config.token_description,
metadata_config.token_name_prefix,
utf8(b""), // name_with_index_suffix
utf8(b""), // name_with_index_suffix
royalty::get(collection),
uri,
);
Expand Down Expand Up @@ -454,6 +424,6 @@ module only_on_aptos::only_on_aptos {
collection_config_object: Object<CollectionConfig>,
recipient_addr: address,
): Object<Token> acquires CollectionConfig, MetadataConfig {
mint_impl(minter, collection_config_object, recipient_addr)
mint_impl(collection_config_object, recipient_addr)
}
}
}
3 changes: 1 addition & 2 deletions only-on-aptos/tests/only_on_aptos_tests.move
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ module only_on_aptos::only_on_aptos_tests {
let user_address = signer::address_of(user);
let collection_config = create_collection_helper(admin);
only_on_aptos::set_minting_status(admin, collection_config, true);
let admin_minted_token = only_on_aptos::mint_with_admin_impl(
admin,
let admin_minted_token = only_on_aptos::mint_to_recipient(
collection_config,
user_address,
);
Expand Down

0 comments on commit 28e32dd

Please sign in to comment.