Skip to content

Commit

Permalink
Merge pull request #265 from gRoussac/release-1.5.1
Browse files Browse the repository at this point in the history
Release 1.5.1 into dev branch
  • Loading branch information
gRoussac authored Jan 4, 2024
2 parents 9f7aeac + 4904d66 commit d218c05
Show file tree
Hide file tree
Showing 20 changed files with 517 additions and 93 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ All notable changes to this project will be documented in this file. The format

### Added

## Release 1.5.1

### Changed

- Add ACL in types of js_client (#256)
- Fix Wrong error on insertion of duplicated token identifier (#258)
- Fix Failure on migration when EventsMode::CES to EventsMode::CES (#263)

### Added

- Optional custom string identifier in mint entrypoint (#255)

## Release 1.5.0

### Changed
Expand Down
13 changes: 8 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@ build-contract:
wasm-strip test-contracts/minting_contract/target/wasm32-unknown-unknown/release/minting_contract.wasm
wasm-strip test-contracts/transfer_filter_contract/target/wasm32-unknown-unknown/release/transfer_filter_contract.wasm

VERSIONS := 1_0_0 1_1_0 1_2_0 1_3_0 1_4_0 1_5_0

setup-test: build-contract
mkdir -p tests/wasm
mkdir -p tests/wasm/1_0_0; curl -L https://github.com/casper-ecosystem/cep-78-enhanced-nft/releases/download/v1.0.0/cep-78-wasm.tar.gz | tar zxv -C tests/wasm/1_0_0/
mkdir -p tests/wasm/1_1_0; curl -L https://github.com/casper-ecosystem/cep-78-enhanced-nft/releases/download/v1.1.0/cep-78-wasm.tar.gz | tar zxv -C tests/wasm/1_1_0/
mkdir -p tests/wasm/1_2_0; curl -L https://github.com/casper-ecosystem/cep-78-enhanced-nft/releases/download/v1.2.0/cep-78-wasm.tar.gz | tar zxv -C tests/wasm/1_2_0/
mkdir -p tests/wasm/1_3_0; curl -L https://github.com/casper-ecosystem/cep-78-enhanced-nft/releases/download/v1.3.0/cep-78-wasm.tar.gz | tar zxv -C tests/wasm/1_3_0/
mkdir -p tests/wasm/1_4_0; curl -L https://github.com/casper-ecosystem/cep-78-enhanced-nft/releases/download/v1.4.0/cep-78-wasm.tar.gz | tar zxv -C tests/wasm/1_4_0/
$(foreach version,$(VERSIONS), \
if [ ! -d "tests/wasm/$(version)" ]; then \
mkdir -p tests/wasm/$(version); \
curl -L https://github.com/casper-ecosystem/cep-78-enhanced-nft/releases/download/v$(subst _,.,$(version))/cep-78-wasm.tar.gz | tar zxv -C tests/wasm/$(version)/; \
fi; \
)

cp contract/target/wasm32-unknown-unknown/release/contract.wasm tests/wasm
cp client/mint_session/target/wasm32-unknown-unknown/release/mint_call.wasm tests/wasm
Expand Down
6 changes: 6 additions & 0 deletions client-js/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.5.1] - 2023-11-20

### Fixed

- Add ACL in types of js_client (#256)

## [1.5.0] - 2023-10-05

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion client-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "casper-cep78-js-client",
"version": "1.5.0",
"version": "1.5.1",
"description": "CEP78 Enhanced NFT JS Client",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
Expand Down
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.0"
version = "1.5.1"
edition = "2018"

[dependencies]
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.0"
version = "1.5.1"
edition = "2018"

[dependencies]
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.0"
version = "1.5.1"
edition = "2018"

[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.0"
version = "1.5.1"
edition = "2018"

[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.0"
version = "1.5.1"
edition = "2018"

[dependencies]
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.0"
version = "1.5.1"
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/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.0"
version = "1.5.1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
10 changes: 4 additions & 6 deletions contract/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
[package]
name = "contract"
version = "1.5.0"
version = "1.5.1"
edition = "2018"

[dependencies]
casper-contract = { version = "3.0.0", default-features = false, features = [
"test-support",
], optional = true }
casper-types = "3.0.0"
casper-contract = { version = "3.0.0", default-features = false, optional = true }
casper-types = { version = "3.0.0", default-features = false }
serde = { version = "1.0.80", default-features = false }
serde_json = { version = "1.0.59", default-features = false }
serde-json-wasm = { version = "0.5.1", default-features = false }
base16 = { version = "0.2.1", default-features = false }
casper-event-standard = { version = "0.4.0", default-features = false }
casper-event-standard = { version = "0.4.1", default-features = false }
hex = { version = "0.4.3", default-features = false }

[[bin]]
Expand Down
62 changes: 42 additions & 20 deletions contract/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2001,27 +2001,50 @@ pub extern "C" fn migrate() {

runtime::put_key(RLO_MFLAG, storage::new_uref(false).into());

let events_mode: EventsMode = utils::get_optional_named_arg_with_user_errors::<u8>(
ARG_EVENTS_MODE,
NFTCoreError::InvalidEventsMode,
)
.unwrap_or(EventsMode::NoEvents as u8)
.try_into()
.unwrap_or_revert();

match events_mode {
EventsMode::NoEvents => {}
EventsMode::CES => {
// Initialize events structures.
utils::init_events();
// Emit Migration event.
casper_event_standard::emit(Migration::new());
let optional_events_mode: Option<u8> = runtime::get_named_arg::<Option<u8>>(ARG_EVENTS_MODE);
let current_events_mode: EventsMode = runtime::get_key(EVENTS_MODE)
.and_then(|_| {
utils::get_stored_value_with_user_errors::<u8>(
EVENTS_MODE,
NFTCoreError::MissingEventsMode,
NFTCoreError::InvalidEventsMode,
)
.try_into()
.ok()
})
.unwrap_or(EventsMode::NoEvents);

if let Some(optional_events_mode) = optional_events_mode {
let requested_events_mode: EventsMode = optional_events_mode
.try_into()
.unwrap_or_revert_with(NFTCoreError::InvalidEventsMode);
match (current_events_mode, requested_events_mode) {
(EventsMode::CES, EventsMode::CES) => casper_event_standard::emit(Migration::new()),
(_, EventsMode::CES) => {
// Initialize events structures.
utils::init_events();
casper_event_standard::emit(Migration::new());
}
(_, EventsMode::CEP47) => record_cep47_event_dictionary(CEP47Event::Migrate),
(_, _) => {}
}
runtime::put_key(EVENTS_MODE, storage::new_uref(optional_events_mode).into());
} else {
match current_events_mode {
EventsMode::CEP47 => record_cep47_event_dictionary(CEP47Event::Migrate),
EventsMode::CES => casper_event_standard::emit(Migration::new()),
_ => {
// Store "no events" mode in case it was never stored like version < 1.2
if !runtime::has_key(EVENTS_MODE) {
runtime::put_key(
EVENTS_MODE,
storage::new_uref(EventsMode::NoEvents as u8).into(),
)
}
}
}
EventsMode::CEP47 => record_cep47_event_dictionary(CEP47Event::Migrate),
}

runtime::put_key(EVENTS_MODE, storage::new_uref(events_mode as u8).into());

let acl_package_mode: bool = utils::get_optional_named_arg_with_user_errors::<bool>(
ARG_ACL_PACKAGE_MODE,
NFTCoreError::InvalidACLPackageMode,
Expand Down Expand Up @@ -2823,8 +2846,7 @@ fn migrate_contract(access_key_name: String, package_key_name: String) {
let events_mode = utils::get_optional_named_arg_with_user_errors::<u8>(
ARG_EVENTS_MODE,
NFTCoreError::InvalidEventsMode,
)
.unwrap_or(0u8);
);

let acl_package_mode: bool = utils::get_optional_named_arg_with_user_errors(
ARG_ACL_PACKAGE_MODE,
Expand Down
2 changes: 1 addition & 1 deletion contract/src/modalities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ impl TryFrom<u8> for NamedKeyConventionMode {
}

#[repr(u8)]
#[derive(PartialEq, Eq)]
#[derive(PartialEq, Eq, Clone, Copy)]
#[allow(clippy::upper_case_acronyms)]
pub enum EventsMode {
NoEvents = 0,
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.0"
version = "1.5.1"
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.0"
version = "1.5.1"
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/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.0"
version = "1.5.1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
8 changes: 3 additions & 5 deletions tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
[package]
name = "tests"
version = "1.5.0"
version = "1.5.1"
edition = "2018"
[dependencies]
casper-engine-test-support = { version = "5.0.0", default-features = false, features = [
"test-support",
] }
casper-engine-test-support = { version = "5.0.0", default-features = false }
contract = { path = "../contract", default-features = false }
casper-execution-engine = { version = "5.0.0", default-features = false }
casper-types = "3.0.0"
casper-types = { version = "3.0.0", default-features = false }
serde = { version = "1.0.80", default-features = false }
serde_json = { version = "1.0.59", default-features = false }
once_cell = "1"
Expand Down
Loading

0 comments on commit d218c05

Please sign in to comment.