Skip to content

Commit

Permalink
Merge branch 'fixture' of github.com:casper-ecosystem/cep-78-enhanced…
Browse files Browse the repository at this point in the history
…-nft into fixture
  • Loading branch information
gRoussac committed Aug 21, 2024
2 parents 432a62b + 3b85eaa commit ae699df
Show file tree
Hide file tree
Showing 30 changed files with 132 additions and 129 deletions.
2 changes: 1 addition & 1 deletion client/balance_of_session/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "balance_of_session"
version = "1.5.1"
version = "2.0.0"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion client/balance_of_session/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use casper_contract::{
contract_api::{runtime, storage},
unwrap_or_revert::UnwrapOrRevert,
};
use casper_types::{contracts::ContractHash, runtime_args, AddressableEntityHash, ApiError, Key};
use casper_types::{runtime_args, AddressableEntityHash, ApiError, Key};

const ENTRY_POINT_BALANCE_OF: &str = "balance_of";
const ARG_NFT_CONTRACT_HASH: &str = "nft_contract_hash";
Expand Down
2 changes: 1 addition & 1 deletion client/get_approved_session/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "get_approved_session"
version = "1.5.1"
version = "2.0.0"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion client/get_approved_session/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use casper_contract::{
contract_api::{runtime, storage},
unwrap_or_revert::UnwrapOrRevert,
};
use casper_types::{contracts::ContractHash, runtime_args, AddressableEntityHash, ApiError, Key};
use casper_types::{runtime_args, AddressableEntityHash, ApiError, Key};

const ENTRY_POINT_GET_APPROVED: &str = "get_approved";
const ARG_NFT_CONTRACT_HASH: &str = "nft_contract_hash";
Expand Down
2 changes: 1 addition & 1 deletion client/is_approved_for_all_session/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "is_approved_for_all_session"
version = "1.5.1"
version = "2.0.0"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion client/mint_session/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mint_session"
version = "1.5.1"
version = "2.0.0"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion client/owner_of_session/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "owner_of_session"
version = "1.5.1"
version = "2.0.0"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion client/owner_of_session/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use casper_contract::{
contract_api::{runtime, storage},
unwrap_or_revert::UnwrapOrRevert,
};
use casper_types::{contracts::ContractHash, runtime_args, AddressableEntityHash, ApiError, Key};
use casper_types::{runtime_args, AddressableEntityHash, ApiError, Key};

const ENTRY_POINT_OWNER_OF: &str = "owner_of";
const ARG_NFT_CONTRACT_HASH: &str = "nft_contract_hash";
Expand Down
2 changes: 1 addition & 1 deletion client/transfer_session/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "transfer_session"
version = "1.5.1"
version = "2.0.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion client/transfer_session/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ extern crate alloc;
use alloc::string::String;

use casper_contract::{contract_api::runtime, unwrap_or_revert::UnwrapOrRevert};
use casper_types::{contracts::ContractHash, runtime_args, AddressableEntityHash, ApiError, Key};
use casper_types::{runtime_args, AddressableEntityHash, ApiError, Key};

const ENTRY_POINT_TRANSFER: &str = "transfer";

Expand Down
2 changes: 1 addition & 1 deletion client/updated_receipts/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "updated_receipts"
version = "1.5.1"
version = "2.0.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion contract/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "contract"
version = "1.5.1"
version = "2.0.0"
edition = "2021"

[dependencies]
Expand Down
4 changes: 2 additions & 2 deletions contract/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1897,9 +1897,9 @@ pub extern "C" fn migrate() {
.unwrap_or(EventsMode::NoEvents);

if let Some(optional_events_mode) = optional_events_mode {
if optional_events_mode as u8 != current_events_mode as u8 {
if optional_events_mode != current_events_mode as u8 {
runtime::put_key(EVENTS_MODE, storage::new_uref(optional_events_mode).into());
if let Some(_) = get_key(casper_event_standard::EVENTS_DICT) {
if get_key(casper_event_standard::EVENTS_DICT).is_some() {
utils::init_events();
}
}
Expand Down
1 change: 1 addition & 0 deletions contract/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(deprecated)]
use alloc::{
borrow::ToOwned,
format,
Expand Down
2 changes: 1 addition & 1 deletion test-contracts/mangle_named_keys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mangle_named_keys"
version = "1.5.1"
version = "2.0.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion test-contracts/minting_contract/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "minting_contract"
version = "1.5.1"
version = "2.0.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
20 changes: 10 additions & 10 deletions test-contracts/minting_contract/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub extern "C" fn mint() {
}
if reverse_lookup_enabled {
runtime::call_contract::<(String, URef)>(
nft_contract_hash.into(),
nft_contract_hash,
ENTRY_POINT_REGISTER_OWNER,
runtime_args! {
ARG_TOKEN_OWNER => token_owner,
Expand All @@ -76,7 +76,7 @@ pub extern "C" fn mint() {

let (collection_name, owned_tokens_dictionary_key, _token_id_string) =
runtime::call_contract::<(String, Key, String)>(
nft_contract_hash.into(),
nft_contract_hash,
ENTRY_POINT_MINT,
runtime_args! {
ARG_TOKEN_HASH => token_hash,
Expand All @@ -88,7 +88,7 @@ pub extern "C" fn mint() {
runtime::put_key(&collection_name, owned_tokens_dictionary_key)
} else {
runtime::call_contract::<()>(
nft_contract_hash.into(),
nft_contract_hash,
ENTRY_POINT_MINT,
runtime_args! {
ARG_TOKEN_HASH => token_hash,
Expand All @@ -110,7 +110,7 @@ pub extern "C" fn approve() {
let spender_key = runtime::get_named_arg::<Key>(ARG_SPENDER);

runtime::call_contract::<()>(
nft_contract_hash.into(),
nft_contract_hash,
ENTRY_POINT_APPROVE,
runtime_args! {
ARG_TOKEN_ID => token_id,
Expand All @@ -129,7 +129,7 @@ pub extern "C" fn revoke() {
let token_id = runtime::get_named_arg::<u64>(ARG_TOKEN_ID);

runtime::call_contract::<()>(
nft_contract_hash.into(),
nft_contract_hash,
ENTRY_POINT_REVOKE,
runtime_args! {
ARG_TOKEN_ID => token_id,
Expand All @@ -149,7 +149,7 @@ pub extern "C" fn transfer() {
let target_token_owner = runtime::get_named_arg::<Key>(ARG_TARGET_KEY);

let (collection_name, owned_tokens_dictionary_key) = runtime::call_contract::<(String, Key)>(
nft_contract_hash.into(),
nft_contract_hash,
ENTRY_POINT_TRANSFER,
runtime_args! {
ARG_TOKEN_ID => token_id,
Expand All @@ -171,7 +171,7 @@ pub extern "C" fn burn() {
let token_id = runtime::get_named_arg::<u64>(ARG_TOKEN_ID);

runtime::call_contract::<()>(
nft_contract_hash.into(),
nft_contract_hash,
ENTRY_POINT_BURN,
runtime_args! {
ARG_TOKEN_ID => token_id
Expand All @@ -189,7 +189,7 @@ pub extern "C" fn metadata() {
let metadata: String = if runtime::get_named_arg::<bool>(ARG_IS_HASH_IDENTIFIER_MODE) {
let token_hash = runtime::get_named_arg::<String>(ARG_TOKEN_HASH);
runtime::call_contract::<String>(
nft_contract_hash.into(),
nft_contract_hash,
ENTRY_POINT_METADATA,
runtime_args! {
ARG_TOKEN_HASH => token_hash
Expand All @@ -198,7 +198,7 @@ pub extern "C" fn metadata() {
} else {
let token_id = runtime::get_named_arg::<u64>(ARG_TOKEN_ID);
runtime::call_contract::<String>(
nft_contract_hash.into(),
nft_contract_hash,
ENTRY_POINT_METADATA,
runtime_args! {
ARG_TOKEN_ID => token_id
Expand All @@ -218,7 +218,7 @@ pub extern "C" fn register_contract() {
let token_owner = runtime::get_named_arg::<Key>(ARG_TOKEN_OWNER);

runtime::call_contract::<(String, URef)>(
nft_contract_hash.into(),
nft_contract_hash,
ENTRY_POINT_REGISTER_OWNER,
runtime_args! {
ARG_TOKEN_OWNER => token_owner
Expand Down
2 changes: 1 addition & 1 deletion test-contracts/transfer_filter_contract/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "transfer_filter_contract"
version = "1.5.1"
version = "2.0.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tests"
version = "1.5.1"
version = "2.0.0"
edition = "2021"

[dev-dependencies]
Expand Down
12 changes: 6 additions & 6 deletions tests/src/acl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ fn should_disallow_unlisted_account_from_minting() {

let mint_session_call = ExecuteRequestBuilder::contract_call_by_hash(
account_user_1,
nft_contract_hash.into(),
nft_contract_hash,
ENTRY_POINT_MINT,
mint_runtime_args,
)
Expand Down Expand Up @@ -555,7 +555,7 @@ fn should_allow_mixed_account_contract_to_mint() {

let mint_session_call = ExecuteRequestBuilder::contract_call_by_hash(
account_user_1,
nft_contract_hash.into(),
nft_contract_hash,
ENTRY_POINT_MINT,
mint_runtime_args,
)
Expand Down Expand Up @@ -697,7 +697,7 @@ fn should_disallow_unlisted_account_from_minting_with_mixed_account_contract() {

let mint_session_call = ExecuteRequestBuilder::contract_call_by_hash(
account_user_1,
nft_contract_hash.into(),
nft_contract_hash,
ENTRY_POINT_MINT,
mint_runtime_args,
)
Expand Down Expand Up @@ -771,7 +771,7 @@ fn should_disallow_listed_account_from_minting_with_nftholder_contract() {

let mint_session_call = ExecuteRequestBuilder::contract_call_by_hash(
account_user_1,
nft_contract_hash.into(),
nft_contract_hash,
ENTRY_POINT_MINT,
mint_runtime_args,
)
Expand Down Expand Up @@ -1131,7 +1131,7 @@ fn should_be_able_to_update_whitelist_for_minting_with_deprecated_arg_contract_w

let update_whitelist_request = ExecuteRequestBuilder::contract_call_by_hash(
*DEFAULT_ACCOUNT_ADDR,
nft_contract_hash.into(),
nft_contract_hash,
ENTRY_POINT_SET_VARIABLES,
runtime_args! {
ARG_CONTRACT_WHITELIST => vec![minting_contract_hash]
Expand Down Expand Up @@ -1246,7 +1246,7 @@ fn should_be_able_to_update_whitelist_for_minting() {

let update_whitelist_request = ExecuteRequestBuilder::contract_call_by_hash(
*DEFAULT_ACCOUNT_ADDR,
nft_contract_hash.into(),
nft_contract_hash,
ENTRY_POINT_SET_VARIABLES,
runtime_args! {
ARG_ACL_WHITELIST => vec![Key::from(minting_contract_hash)]
Expand Down
22 changes: 11 additions & 11 deletions tests/src/burn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fn should_burn_minted_token(reporting: OwnerReverseLookupMode) {
let token_page = support::get_token_page_by_id(
&builder,
&nft_contract_key,
&*DEFAULT_ACCOUNT_KEY,
&DEFAULT_ACCOUNT_KEY,
token_id,
);

Expand All @@ -80,7 +80,7 @@ fn should_burn_minted_token(reporting: OwnerReverseLookupMode) {

let minting_request = ExecuteRequestBuilder::contract_call_by_hash(
*DEFAULT_ACCOUNT_ADDR,
nft_contract_hash.into(),
nft_contract_hash,
ENTRY_POINT_MINT,
mint_runtime_args,
)
Expand Down Expand Up @@ -177,7 +177,7 @@ fn should_not_burn_previously_burnt_token() {
builder.exec(mint_session_call).expect_success().commit();

let token_page =
support::get_token_page_by_id(&builder, &nft_contract_key, &*DEFAULT_ACCOUNT_KEY, 0u64);
support::get_token_page_by_id(&builder, &nft_contract_key, &DEFAULT_ACCOUNT_KEY, 0u64);

assert!(token_page[0]);

Expand Down Expand Up @@ -286,13 +286,13 @@ fn should_return_expected_error_burning_of_others_users_token() {
builder.exec(mint_session_call).expect_success().commit();

let token_page =
support::get_token_page_by_id(&builder, &nft_contract_key, &*DEFAULT_ACCOUNT_KEY, 0u64);
support::get_token_page_by_id(&builder, &nft_contract_key, &DEFAULT_ACCOUNT_KEY, 0u64);

assert!(token_page[0]);

let incorrect_burn_request = ExecuteRequestBuilder::contract_call_by_hash(
account_user_1,
nft_contract_hash.into(),
nft_contract_hash,
ENTRY_POINT_BURN,
runtime_args! {
ARG_TOKEN_ID => 0u64,
Expand Down Expand Up @@ -489,7 +489,7 @@ fn should_let_account_operator_burn_tokens_with_operator_burn_mode() {

let burn_request = ExecuteRequestBuilder::contract_call_by_hash(
operator,
nft_contract_hash.into(),
nft_contract_hash,
ENTRY_POINT_BURN,
runtime_args! {
ARG_TOKEN_ID => token_id,
Expand All @@ -508,7 +508,7 @@ fn should_let_account_operator_burn_tokens_with_operator_burn_mode() {

let approve_all_request = ExecuteRequestBuilder::contract_call_by_hash(
*DEFAULT_ACCOUNT_ADDR,
nft_contract_hash.into(),
nft_contract_hash,
ENTRY_POINT_SET_APPROVALL_FOR_ALL,
runtime_args! {
ARG_APPROVE_ALL => true,
Expand All @@ -521,7 +521,7 @@ fn should_let_account_operator_burn_tokens_with_operator_burn_mode() {

let burn_request = ExecuteRequestBuilder::contract_call_by_hash(
operator,
nft_contract_hash.into(),
nft_contract_hash,
ENTRY_POINT_BURN,
runtime_args! {
ARG_TOKEN_ID => token_id,
Expand Down Expand Up @@ -632,7 +632,7 @@ fn should_let_contract_operator_burn_tokens_with_operator_burn_mode() {

let approve_all_request = ExecuteRequestBuilder::contract_call_by_hash(
*DEFAULT_ACCOUNT_ADDR,
nft_contract_hash.into(),
nft_contract_hash,
ENTRY_POINT_SET_APPROVALL_FOR_ALL,
runtime_args! {
ARG_APPROVE_ALL => true,
Expand Down Expand Up @@ -759,7 +759,7 @@ fn should_let_package_operator_burn_tokens_with_contract_package_mode_and_operat

let approve_all_request = ExecuteRequestBuilder::contract_call_by_hash(
*DEFAULT_ACCOUNT_ADDR,
nft_contract_hash.into(),
nft_contract_hash,
ENTRY_POINT_SET_APPROVALL_FOR_ALL,
runtime_args! {
ARG_APPROVE_ALL => true,
Expand Down Expand Up @@ -849,7 +849,7 @@ fn should_burn_token_in_hash_identifier_mode() {

let burn_request = ExecuteRequestBuilder::contract_call_by_hash(
*DEFAULT_ACCOUNT_ADDR,
nft_contract_hash.into(),
nft_contract_hash,
ENTRY_POINT_BURN,
runtime_args! {
ARG_TOKEN_HASH => token_hash,
Expand Down
2 changes: 1 addition & 1 deletion tests/src/costs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ fn transfer_costs_should_remain_stable() {

let register_request = ExecuteRequestBuilder::contract_call_by_hash(
*DEFAULT_ACCOUNT_ADDR,
nft_contract_hash.into(),
nft_contract_hash,
ENTRY_POINT_REGISTER_OWNER,
runtime_args! {
ARG_TOKEN_OWNER => Key::Account(AccountHash::new([9u8;32]))
Expand Down
Loading

0 comments on commit ae699df

Please sign in to comment.