From a81d53f3f74e922b3b2d72bd42f08f0ea8b7ccbc Mon Sep 17 00:00:00 2001 From: Dominik | Supercolony <43150707+coreggon11@users.noreply.github.com> Date: Fri, 28 Jul 2023 14:36:17 +0200 Subject: [PATCH] update contracts to be compatible with cargo-contract 3 --- Cargo.toml | 10 +- contracts/Cargo.toml | 6 +- contracts/src/lib.rs | 2 +- example_project_structure/Cargo.toml | 4 +- .../contracts/lending/Cargo.toml | 7 +- .../contracts/lending/lib.rs | 2 +- .../contracts/loan/Cargo.toml | 5 +- .../contracts/loan/lib.rs | 2 +- .../contracts/shares/Cargo.toml | 5 +- .../contracts/shares/lib.rs | 2 +- .../contracts/stable_coin/Cargo.toml | 7 +- .../contracts/stable_coin/lib.rs | 2 +- example_project_structure/lib.rs | 2 +- examples/access_control/Cargo.toml | 9 +- examples/access_control/lib.rs | 111 ++++---- .../enumerable/Cargo.toml | 9 +- .../enumerable/lib.rs | 2 +- examples/alternatives/diamond/ink/Cargo.toml | 7 +- examples/alternatives/diamond/ink/lib.rs | 2 +- examples/alternatives/diamond/rust/Cargo.toml | 7 +- examples/alternatives/diamond/rust/lib.rs | 2 +- examples/diamond/Cargo.toml | 7 +- examples/diamond/diamond_caller/Cargo.toml | 8 +- examples/diamond/diamond_caller/lib.rs | 2 +- examples/diamond/lib.rs | 2 +- examples/diamond/psp22_facet_v1/Cargo.toml | 8 +- examples/diamond/psp22_facet_v1/lib.rs | 2 +- examples/diamond/psp22_facet_v2/Cargo.toml | 8 +- examples/diamond/psp22_facet_v2/lib.rs | 2 +- .../diamond/psp22_metadata_facet/Cargo.toml | 8 +- examples/diamond/psp22_metadata_facet/lib.rs | 2 +- examples/flash-borrower/Cargo.toml | 7 +- examples/flash-borrower/lib.rs | 8 +- examples/ownable/Cargo.toml | 9 +- examples/ownable/lib.rs | 189 +++++++------ examples/pausable/Cargo.toml | 9 +- examples/pausable/lib.rs | 23 +- examples/payment_splitter/Cargo.toml | 9 +- examples/payment_splitter/lib.rs | 76 +++--- examples/proxy/Cargo.toml | 7 +- examples/proxy/lib.rs | 2 +- .../psp22_metadata_upgradeable/Cargo.toml | 8 +- .../proxy/psp22_metadata_upgradeable/lib.rs | 2 +- examples/proxy/psp22_upgradeable/Cargo.toml | 8 +- examples/proxy/psp22_upgradeable/lib.rs | 2 +- examples/psp22/Cargo.toml | 10 +- examples/psp22/lib.rs | 32 ++- examples/psp22_extensions/burnable/Cargo.toml | 10 +- examples/psp22_extensions/burnable/lib.rs | 2 +- examples/psp22_extensions/capped/Cargo.toml | 10 +- examples/psp22_extensions/capped/lib.rs | 2 +- .../psp22_extensions/flashmint/Cargo.toml | 8 +- examples/psp22_extensions/flashmint/lib.rs | 2 +- examples/psp22_extensions/metadata/Cargo.toml | 10 +- examples/psp22_extensions/metadata/lib.rs | 2 +- examples/psp22_extensions/mintable/Cargo.toml | 10 +- examples/psp22_extensions/mintable/lib.rs | 2 +- examples/psp22_extensions/pausable/Cargo.toml | 10 +- examples/psp22_extensions/pausable/lib.rs | 2 +- examples/psp22_extensions/wrapper/Cargo.toml | 8 +- examples/psp22_extensions/wrapper/lib.rs | 2 +- examples/psp22_pallet/Cargo.toml | 10 +- examples/psp22_pallet/lib.rs | 37 ++- .../burnable/Cargo.toml | 10 +- .../psp22_pallet_extensions/burnable/lib.rs | 2 +- .../metadata/Cargo.toml | 10 +- .../psp22_pallet_extensions/metadata/lib.rs | 2 +- .../mintable/Cargo.toml | 10 +- .../psp22_pallet_extensions/mintable/lib.rs | 2 +- .../psp22_utils/token_timelock/Cargo.toml | 8 +- examples/psp22_utils/token_timelock/lib.rs | 2 +- examples/psp34/Cargo.toml | 10 +- examples/psp34/lib.rs | 165 +++++++---- examples/psp34_extensions/burnable/Cargo.toml | 10 +- examples/psp34_extensions/burnable/lib.rs | 2 +- .../psp34_extensions/enumerable/Cargo.toml | 10 +- examples/psp34_extensions/enumerable/lib.rs | 2 +- examples/psp34_extensions/metadata/Cargo.toml | 10 +- examples/psp34_extensions/metadata/lib.rs | 2 +- examples/psp34_extensions/mintable/Cargo.toml | 10 +- examples/psp34_extensions/mintable/lib.rs | 2 +- examples/psp37/Cargo.toml | 10 +- examples/psp37/lib.rs | 251 ++++++++++------- examples/psp37_extensions/batch/Cargo.toml | 10 +- examples/psp37_extensions/batch/lib.rs | 2 +- examples/psp37_extensions/burnable/Cargo.toml | 10 +- examples/psp37_extensions/burnable/lib.rs | 2 +- .../psp37_extensions/enumerable/Cargo.toml | 10 +- examples/psp37_extensions/enumerable/lib.rs | 2 +- examples/psp37_extensions/metadata/Cargo.toml | 10 +- examples/psp37_extensions/metadata/lib.rs | 2 +- examples/psp37_extensions/mintable/Cargo.toml | 10 +- examples/psp37_extensions/mintable/lib.rs | 2 +- examples/reentrancy_guard/Cargo.toml | 4 +- .../contracts/flip_on_me/Cargo.toml | 8 +- .../contracts/flip_on_me/lib.rs | 2 +- .../contracts/flipper/Cargo.toml | 7 +- .../reentrancy_guard/contracts/flipper/lib.rs | 2 +- examples/reentrancy_guard/lib.rs | 2 +- examples/test_helpers/Cargo.toml | 2 +- examples/test_helpers/lib.rs | 257 ++++++++++-------- examples/timelock_controller/Cargo.toml | 9 +- examples/timelock_controller/lib.rs | 175 ++++++------ lang/Cargo.toml | 6 +- lang/codegen/Cargo.toml | 6 +- lang/macro/Cargo.toml | 6 +- lang/macro/src/lib.rs | 2 +- lang/src/lib.rs | 2 +- src/lib.rs | 2 +- 109 files changed, 940 insertions(+), 924 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 847a6abb3..076eed054 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ exclude = [ [package] name = "openbrush" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2018" @@ -26,12 +26,12 @@ categories = ["no-std", "embedded"] include = ["Cargo.toml", "src/**/*.rs"] [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } -openbrush_contracts = { version = "~3.1.1", path = "contracts", default-features = false } -openbrush_lang = { version = "~3.1.1", path = "lang", default-features = false } +openbrush_contracts = { version = "~3.2.0", path = "contracts", default-features = false } +openbrush_lang = { version = "~3.2.0", path = "lang", default-features = false } [lib] name = "openbrush" @@ -41,7 +41,7 @@ crate-type = [ ] [dev-dependencies] -ink_e2e = "4.1.0" +ink_e2e = "4.2.1" [features] default = ["std"] diff --git a/contracts/Cargo.toml b/contracts/Cargo.toml index bceb40d05..d6a91daec 100644 --- a/contracts/Cargo.toml +++ b/contracts/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "openbrush_contracts" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" @@ -15,11 +15,11 @@ categories = ["no-std", "embedded"] include = ["Cargo.toml", "src/**/*.rs"] [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } -openbrush = { version = "~3.1.1", package = "openbrush_lang", path = "../lang", default-features = false } +openbrush = { version = "~3.2.0", package = "openbrush_lang", path = "../lang", default-features = false } pallet-assets-chain-extension = { git = "https://github.com/727-ventures/pallet-assets-chain-extension", branch = "polkadot-v0.9.37", default-features = false, features = ["ink-lang"] } diff --git a/contracts/src/lib.rs b/contracts/src/lib.rs index f26b8bb6f..9609cce4d 100644 --- a/contracts/src/lib.rs +++ b/contracts/src/lib.rs @@ -19,7 +19,7 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] mod access; diff --git a/example_project_structure/Cargo.toml b/example_project_structure/Cargo.toml index 3f8766f3b..3d680b70d 100644 --- a/example_project_structure/Cargo.toml +++ b/example_project_structure/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "lending_project" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } diff --git a/example_project_structure/contracts/lending/Cargo.toml b/example_project_structure/contracts/lending/Cargo.toml index eeecc73f1..b8a162d96 100644 --- a/example_project_structure/contracts/lending/Cargo.toml +++ b/example_project_structure/contracts/lending/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "lending_contract" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -19,9 +19,6 @@ openbrush = { path = "../../..", default-features = false, features = ["pausable [lib] name = "lending_contract" path = "lib.rs" -crate-type = [ - "cdylib", -] [features] default = ["std"] diff --git a/example_project_structure/contracts/lending/lib.rs b/example_project_structure/contracts/lending/lib.rs index 921cadb0f..3f38256f6 100644 --- a/example_project_structure/contracts/lending/lib.rs +++ b/example_project_structure/contracts/lending/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] /// This will be a simple lending contract where users can: diff --git a/example_project_structure/contracts/loan/Cargo.toml b/example_project_structure/contracts/loan/Cargo.toml index a7ebe3fac..97b03e3b2 100644 --- a/example_project_structure/contracts/loan/Cargo.toml +++ b/example_project_structure/contracts/loan/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "loan_contract" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -17,7 +17,6 @@ openbrush = { path = "../../..", default-features = false, features = ["ownable" name = "loan_contract" path = "lib.rs" crate-type = [ - "cdylib", "rlib" ] diff --git a/example_project_structure/contracts/loan/lib.rs b/example_project_structure/contracts/loan/lib.rs index ebeadf65a..57b866b1f 100644 --- a/example_project_structure/contracts/loan/lib.rs +++ b/example_project_structure/contracts/loan/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] /// This contract will represent the loan of a user diff --git a/example_project_structure/contracts/shares/Cargo.toml b/example_project_structure/contracts/shares/Cargo.toml index e9edb026e..af4f7f98d 100644 --- a/example_project_structure/contracts/shares/Cargo.toml +++ b/example_project_structure/contracts/shares/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "shares_contract" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -18,7 +18,6 @@ openbrush = { path = "../../..", default-features = false, features = ["ownable" name = "shares_contract" path = "lib.rs" crate-type = [ - "cdylib", "rlib" ] diff --git a/example_project_structure/contracts/shares/lib.rs b/example_project_structure/contracts/shares/lib.rs index 7d2fb3c1b..b3ff0f21f 100644 --- a/example_project_structure/contracts/shares/lib.rs +++ b/example_project_structure/contracts/shares/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] /// This contract will be used to represent the shares of a user diff --git a/example_project_structure/contracts/stable_coin/Cargo.toml b/example_project_structure/contracts/stable_coin/Cargo.toml index 6cc04e537..ff925cd0d 100644 --- a/example_project_structure/contracts/stable_coin/Cargo.toml +++ b/example_project_structure/contracts/stable_coin/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "stable_coin_contract" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -17,9 +17,6 @@ openbrush = { path = "../../..", default-features = false, features = ["psp22"] [lib] name = "stable_coin_contract" path = "lib.rs" -crate-type = [ - "cdylib", -] [features] default = ["std"] diff --git a/example_project_structure/contracts/stable_coin/lib.rs b/example_project_structure/contracts/stable_coin/lib.rs index b403c50ec..8042c6d64 100644 --- a/example_project_structure/contracts/stable_coin/lib.rs +++ b/example_project_structure/contracts/stable_coin/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] /// This is a simple `PSP22` which will be used as a stable coin and a collateral token in our lending contract diff --git a/example_project_structure/lib.rs b/example_project_structure/lib.rs index 77a7eb8bc..f10ff24d9 100644 --- a/example_project_structure/lib.rs +++ b/example_project_structure/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] pub mod impls; diff --git a/examples/access_control/Cargo.toml b/examples/access_control/Cargo.toml index e3d5d10dd..0853086d4 100644 --- a/examples/access_control/Cargo.toml +++ b/examples/access_control/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_access_control" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -14,15 +14,12 @@ scale-info = { version = "2.3", default-features = false, features = ["derive"], openbrush = { path = "../..", default-features = false, features = ["access_control", "psp34"] } [dev-dependencies] -ink_e2e = "4.1.0" +ink_e2e = "4.2.1" test_helpers = { path = "../test_helpers", default-features = false } [lib] name = "my_access_control" path = "lib.rs" -crate-type = [ - "cdylib", -] [features] default = ["std"] diff --git a/examples/access_control/lib.rs b/examples/access_control/lib.rs index 41ef1c2b6..b95c38e8a 100644 --- a/examples/access_control/lib.rs +++ b/examples/access_control/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] @@ -66,10 +66,16 @@ pub mod my_access_control { #[cfg(all(test, feature = "e2e-tests"))] pub mod tests { - use openbrush::contracts::access_control::accesscontrol_external::AccessControl; - use openbrush::contracts::psp34::extensions::mintable::psp34mintable_external::PSP34Mintable; - use openbrush::contracts::psp34::psp34_external::PSP34; - use openbrush::contracts::psp34::extensions::burnable::psp34burnable_external::PSP34Burnable; + use openbrush::contracts::{ + access_control::accesscontrol_external::AccessControl, + psp34::{ + extensions::{ + burnable::psp34burnable_external::PSP34Burnable, + mintable::psp34mintable_external::PSP34Mintable, + }, + psp34_external::PSP34, + }, + }; #[rustfmt::skip] use super::*; @@ -80,10 +86,10 @@ pub mod my_access_control { use test_helpers::{ address_of, - has_role, grant_role, - mint_dry_run, + has_role, mint, + mint_dry_run, revoke_role, }; @@ -92,12 +98,12 @@ pub mod my_access_control { #[ink_e2e::test] async fn only_minter_role_is_allowed_to_mint(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_access_control", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_access_control", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; - assert_eq!(has_role!(client, address, MINTER, bob), false); assert!(matches!(mint_dry_run!(client, address, bob, bob, Id::U8(0)), Err(_))); @@ -109,11 +115,10 @@ pub mod my_access_control { assert_eq!(mint!(client, address, bob, bob, Id::U8(0)), Ok(())); let owner_of = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.owner_of(Id::U8(0))); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + let _msg = build_message::(address.clone()).call(|contract| contract.owner_of(Id::U8(0))); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert_eq!(owner_of, Some(address_of!(bob))); @@ -123,7 +128,8 @@ pub mod my_access_control { #[ink_e2e::test] async fn should_grant_initial_roles_to_default_signer(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_access_control", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_access_control", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -137,7 +143,8 @@ pub mod my_access_control { #[ink_e2e::test] async fn should_not_grant_initial_roles_for_random_role(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_access_control", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_access_control", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -151,7 +158,8 @@ pub mod my_access_control { #[ink_e2e::test] async fn should_grant_role(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_access_control", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_access_control", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -168,7 +176,8 @@ pub mod my_access_control { #[ink_e2e::test] async fn should_not_change_old_roles_after_grant_role(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_access_control", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_access_control", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -191,7 +200,8 @@ pub mod my_access_control { #[ink_e2e::test] async fn should_revoke_role(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_access_control", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_access_control", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -205,10 +215,12 @@ pub mod my_access_control { let revoke_role = { let _msg = build_message::(address.clone()) .call(|contract| contract.revoke_role(MINTER, address_of!(bob))); - client.call(&ink_e2e::alice(), _msg, 0, None) + client + .call(&ink_e2e::alice(), _msg, 0, None) .await .expect("call failed") - }.return_value(); + } + .return_value(); assert_eq!(revoke_role, Ok(())); @@ -220,7 +232,8 @@ pub mod my_access_control { #[ink_e2e::test] async fn should_renounce_role(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_access_control", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_access_control", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -230,10 +243,12 @@ pub mod my_access_control { let renounce_role = { let _msg = build_message::(address.clone()) .call(|contract| contract.renounce_role(MINTER, address_of!(alice))); - client.call(&ink_e2e::alice(), _msg, 0, None) + client + .call(&ink_e2e::alice(), _msg, 0, None) .await .expect("call failed") - }.return_value(); + } + .return_value(); assert_eq!(renounce_role, Ok(())); @@ -243,9 +258,12 @@ pub mod my_access_control { } #[ink_e2e::test] - async fn should_reject_when_grant_or_revoke_not_by_admin_role(mut client: ink_e2e::Client) -> E2EResult<()> { + async fn should_reject_when_grant_or_revoke_not_by_admin_role( + mut client: ink_e2e::Client, + ) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_access_control", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_access_control", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -255,18 +273,18 @@ pub mod my_access_control { let grant_role = { let _msg = build_message::(address.clone()) .call(|contract| contract.grant_role(MINTER, address_of!(charlie))); - client.call_dry_run(&ink_e2e::bob(), &_msg, 0, None) - .await - }.return_value(); + client.call_dry_run(&ink_e2e::bob(), &_msg, 0, None).await + } + .return_value(); assert!(matches!(grant_role, Err(_))); let revoke_role = { let _msg = build_message::(address.clone()) .call(|contract| contract.revoke_role(MINTER, address_of!(charlie))); - client.call_dry_run(&ink_e2e::bob(), &_msg, 0, None) - .await - }.return_value(); + client.call_dry_run(&ink_e2e::bob(), &_msg, 0, None).await + } + .return_value(); assert!(matches!(revoke_role, Err(_))); @@ -276,7 +294,8 @@ pub mod my_access_control { #[ink_e2e::test] async fn should_reject_when_renounce_not_self_role(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_access_control", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_access_control", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -287,9 +306,9 @@ pub mod my_access_control { let renounce_role = { let _msg = build_message::(address.clone()) .call(|contract| contract.renounce_role(MINTER, address_of!(bob))); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert!(matches!(renounce_role, Err(_))); @@ -299,7 +318,8 @@ pub mod my_access_control { #[ink_e2e::test] async fn should_reject_burn_if_no_minter_role(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_access_control", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_access_control", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -310,11 +330,10 @@ pub mod my_access_control { assert_eq!(mint!(client, address, bob, bob, Id::U8(0)), Ok(())); let owner_of = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.owner_of(Id::U8(0))); - client.call_dry_run(&ink_e2e::bob(), &_msg, 0, None) - .await - }.return_value(); + let _msg = build_message::(address.clone()).call(|contract| contract.owner_of(Id::U8(0))); + client.call_dry_run(&ink_e2e::bob(), &_msg, 0, None).await + } + .return_value(); assert_eq!(owner_of, Some(address_of!(bob))); @@ -324,13 +343,13 @@ pub mod my_access_control { let burn = { let _msg = build_message::(address.clone()) .call(|contract| contract.burn(address_of!(bob), Id::U8(0))); - client.call_dry_run(&ink_e2e::bob(), &_msg, 0, None) - .await - }.return_value(); + client.call_dry_run(&ink_e2e::bob(), &_msg, 0, None).await + } + .return_value(); assert!(matches!(burn, Err(_))); Ok(()) } } -} \ No newline at end of file +} diff --git a/examples/access_control_extensions/enumerable/Cargo.toml b/examples/access_control_extensions/enumerable/Cargo.toml index 87afaf8ac..919c6c212 100644 --- a/examples/access_control_extensions/enumerable/Cargo.toml +++ b/examples/access_control_extensions/enumerable/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_access_control_enumerable" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -14,15 +14,12 @@ scale-info = { version = "2.3", default-features = false, features = ["derive"], openbrush = { path = "../../..", default-features = false, features = ["access_control"] } [dev-dependencies] -ink_e2e = "4.1.0" +ink_e2e = "4.2.1" test_helpers = { path = "../../test_helpers", default-features = false } [lib] name = "my_access_control_enumerable" path = "lib.rs" -crate-type = [ - "cdylib", -] [features] default = ["std"] diff --git a/examples/access_control_extensions/enumerable/lib.rs b/examples/access_control_extensions/enumerable/lib.rs index ef9352889..08d070f2f 100644 --- a/examples/access_control_extensions/enumerable/lib.rs +++ b/examples/access_control_extensions/enumerable/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] diff --git a/examples/alternatives/diamond/ink/Cargo.toml b/examples/alternatives/diamond/ink/Cargo.toml index 33fb21cee..851fa8b49 100644 --- a/examples/alternatives/diamond/ink/Cargo.toml +++ b/examples/alternatives/diamond/ink/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "ink_diamond" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -16,9 +16,6 @@ openbrush = { path = "../../../..", default-features = false, features = ["diamo [lib] name = "ink_diamond" path = "lib.rs" -crate-type = [ - "cdylib", -] [features] default = ["std"] diff --git a/examples/alternatives/diamond/ink/lib.rs b/examples/alternatives/diamond/ink/lib.rs index ce225dac0..2cca4fa51 100644 --- a/examples/alternatives/diamond/ink/lib.rs +++ b/examples/alternatives/diamond/ink/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] diff --git a/examples/alternatives/diamond/rust/Cargo.toml b/examples/alternatives/diamond/rust/Cargo.toml index 723a7df27..48b531459 100644 --- a/examples/alternatives/diamond/rust/Cargo.toml +++ b/examples/alternatives/diamond/rust/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "rust_diamond" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -17,9 +17,6 @@ paste = "1.0" [lib] name = "rust_diamond" path = "lib.rs" -crate-type = [ - "cdylib", -] [features] default = ["std"] diff --git a/examples/alternatives/diamond/rust/lib.rs b/examples/alternatives/diamond/rust/lib.rs index 34800e626..553904bbe 100644 --- a/examples/alternatives/diamond/rust/lib.rs +++ b/examples/alternatives/diamond/rust/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #![feature(core_panic)] #![feature(fmt_internals)] diff --git a/examples/diamond/Cargo.toml b/examples/diamond/Cargo.toml index 3b49057cf..27fcee0d8 100644 --- a/examples/diamond/Cargo.toml +++ b/examples/diamond/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_diamond" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -16,9 +16,6 @@ openbrush = { path = "../..", default-features = false, features = ["diamond"] } [lib] name = "my_diamond" path = "lib.rs" -crate-type = [ - "cdylib", -] [features] default = ["std"] diff --git a/examples/diamond/diamond_caller/Cargo.toml b/examples/diamond/diamond_caller/Cargo.toml index d730c22e0..b22cd6244 100644 --- a/examples/diamond/diamond_caller/Cargo.toml +++ b/examples/diamond/diamond_caller/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "diamond_caller" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -16,10 +16,6 @@ openbrush = { path = "../../..", default-features = false, features = ["psp22"] [lib] name = "diamond_caller" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [features] default = ["std"] diff --git a/examples/diamond/diamond_caller/lib.rs b/examples/diamond/diamond_caller/lib.rs index 3692072c1..87bded1a3 100644 --- a/examples/diamond/diamond_caller/lib.rs +++ b/examples/diamond/diamond_caller/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] diff --git a/examples/diamond/lib.rs b/examples/diamond/lib.rs index 673aabd3b..f281062b8 100644 --- a/examples/diamond/lib.rs +++ b/examples/diamond/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] diff --git a/examples/diamond/psp22_facet_v1/Cargo.toml b/examples/diamond/psp22_facet_v1/Cargo.toml index 343b12ad2..a46663155 100644 --- a/examples/diamond/psp22_facet_v1/Cargo.toml +++ b/examples/diamond/psp22_facet_v1/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_psp22_facet_v1" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -16,10 +16,6 @@ openbrush = { path = "../../..", default-features = false, features = ["psp22", [lib] name = "my_psp22_facet_v1" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [features] default = ["std"] diff --git a/examples/diamond/psp22_facet_v1/lib.rs b/examples/diamond/psp22_facet_v1/lib.rs index eb66598b2..369a08a34 100644 --- a/examples/diamond/psp22_facet_v1/lib.rs +++ b/examples/diamond/psp22_facet_v1/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] diff --git a/examples/diamond/psp22_facet_v2/Cargo.toml b/examples/diamond/psp22_facet_v2/Cargo.toml index d6c25c5cf..59f01fa7d 100644 --- a/examples/diamond/psp22_facet_v2/Cargo.toml +++ b/examples/diamond/psp22_facet_v2/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_psp22_facet_v2" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -16,10 +16,6 @@ openbrush = { path = "../../..", default-features = false, features = ["psp22", [lib] name = "my_psp22_facet_v2" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [features] default = ["std"] diff --git a/examples/diamond/psp22_facet_v2/lib.rs b/examples/diamond/psp22_facet_v2/lib.rs index 55930c7fb..565bed7b2 100644 --- a/examples/diamond/psp22_facet_v2/lib.rs +++ b/examples/diamond/psp22_facet_v2/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] diff --git a/examples/diamond/psp22_metadata_facet/Cargo.toml b/examples/diamond/psp22_metadata_facet/Cargo.toml index 41fef1171..e8c16c724 100644 --- a/examples/diamond/psp22_metadata_facet/Cargo.toml +++ b/examples/diamond/psp22_metadata_facet/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_psp22_metadata_facet" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -16,10 +16,6 @@ openbrush = { path = "../../..", default-features = false, features = ["psp22", [lib] name = "my_psp22_metadata_facet" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [features] default = ["std"] diff --git a/examples/diamond/psp22_metadata_facet/lib.rs b/examples/diamond/psp22_metadata_facet/lib.rs index 17e21ce75..72a6c03ae 100644 --- a/examples/diamond/psp22_metadata_facet/lib.rs +++ b/examples/diamond/psp22_metadata_facet/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] diff --git a/examples/flash-borrower/Cargo.toml b/examples/flash-borrower/Cargo.toml index e191e5fc4..9c9c96a2b 100644 --- a/examples/flash-borrower/Cargo.toml +++ b/examples/flash-borrower/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "flash_borrower" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -16,9 +16,6 @@ openbrush = { path = "../..", default-features = false, features = ["psp22"] } [lib] name = "flash_borrower" path = "lib.rs" -crate-type = [ - "cdylib", -] [features] default = ["std"] diff --git a/examples/flash-borrower/lib.rs b/examples/flash-borrower/lib.rs index 27a37119b..f1edd2ed1 100644 --- a/examples/flash-borrower/lib.rs +++ b/examples/flash-borrower/lib.rs @@ -1,9 +1,11 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #[openbrush::contract] pub mod flash_borrower { - use ink::codegen::Env; - use ink::prelude::vec::Vec; + use ink::{ + codegen::Env, + prelude::vec::Vec, + }; use openbrush::{ contracts::psp22::extensions::flashmint::*, traits::String, diff --git a/examples/ownable/Cargo.toml b/examples/ownable/Cargo.toml index 33a920c00..23b62de4c 100644 --- a/examples/ownable/Cargo.toml +++ b/examples/ownable/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_ownable" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -14,15 +14,12 @@ scale-info = { version = "2.3", default-features = false, features = ["derive"], openbrush = { path = "../..", default-features = false, features = ["ownable", "psp37"] } [dev-dependencies] -ink_e2e = "4.1.0" +ink_e2e = "4.2.1" test_helpers = { path = "../test_helpers", default-features = false } [lib] name = "my_ownable" path = "lib.rs" -crate-type = [ - "cdylib", -] [features] default = ["std"] diff --git a/examples/ownable/lib.rs b/examples/ownable/lib.rs index 3dcf6359d..9911fd6d0 100644 --- a/examples/ownable/lib.rs +++ b/examples/ownable/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] @@ -54,38 +54,39 @@ pub mod ownable { } } - #[cfg(all(test, feature = "e2e-tests"))] pub mod tests { - use openbrush::contracts::ownable::ownable_external::Ownable; - use openbrush::contracts::psp37::psp37_external::PSP37; - use openbrush::contracts::psp37::extensions::mintable::psp37mintable_external::PSP37Mintable; + use openbrush::contracts::{ + ownable::ownable_external::Ownable, + psp37::{ + extensions::mintable::psp37mintable_external::PSP37Mintable, + psp37_external::PSP37, + }, + }; #[rustfmt::skip] use super::*; #[rustfmt::skip] use ink_e2e::{build_message, PolkadotConfig}; - use test_helpers::{ - address_of, - }; + use test_helpers::address_of; type E2EResult = Result>; #[ink_e2e::test] async fn owner_is_by_default_contract_deployer(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_ownable", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_ownable", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; let owner = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.owner()); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + let _msg = build_message::(address.clone()).call(|contract| contract.owner()); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert_eq!(owner, address_of!(alice)); @@ -95,27 +96,29 @@ pub mod ownable { #[ink_e2e::test] async fn only_owner_is_allowed_to_mint(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_ownable", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_ownable", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; let owner = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.owner()); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + let _msg = build_message::(address.clone()).call(|contract| contract.owner()); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert_eq!(owner, address_of!(alice)); let mint_tx = { let _msg = build_message::(address.clone()) .call(|contract| contract.mint(address_of!(bob), vec![(Id::U8(0), 1)])); - client.call(&ink_e2e::alice(), _msg, 0, None) + client + .call(&ink_e2e::alice(), _msg, 0, None) .await .expect("mint failed") - }.return_value(); + } + .return_value(); assert_eq!(mint_tx, Ok(())); @@ -125,7 +128,8 @@ pub mod ownable { #[ink_e2e::test] async fn transfer_ownership_works(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_ownable", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_ownable", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -134,67 +138,66 @@ pub mod ownable { let ids_amounts = vec![(token.clone(), 123)]; let owner = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.owner()); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + let _msg = build_message::(address.clone()).call(|contract| contract.owner()); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert_eq!(owner, address_of!(alice)); let mint_tx = { let _msg = build_message::(address.clone()) .call(|contract| contract.mint(address_of!(bob), ids_amounts.clone())); - client.call_dry_run(&ink_e2e::bob(), &_msg, 0, None) - .await - }.return_value(); + client.call_dry_run(&ink_e2e::bob(), &_msg, 0, None).await + } + .return_value(); assert!(matches!(mint_tx, Err(_))); let balance_before = { let _msg = build_message::(address.clone()) .call(|contract| contract.balance_of(address_of!(bob), Some(token.clone()))); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert_eq!(balance_before, 0); let transfer_ownership_tx = { let _msg = build_message::(address.clone()) .call(|contract| contract.transfer_ownership(address_of!(bob))); - client.call(&ink_e2e::alice(), _msg, 0, None) + client + .call(&ink_e2e::alice(), _msg, 0, None) .await .expect("transfer_ownership failed") - }.return_value(); + } + .return_value(); assert_eq!(transfer_ownership_tx, Ok(())); let owner = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.owner()); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + let _msg = build_message::(address.clone()).call(|contract| contract.owner()); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert_eq!(owner, address_of!(bob)); let mint_tx = { let _msg = build_message::(address.clone()) .call(|contract| contract.mint(address_of!(bob), ids_amounts.clone())); - client.call(&ink_e2e::bob(), _msg, 0, None) - .await - .expect("mint failed") - }.return_value(); + client.call(&ink_e2e::bob(), _msg, 0, None).await.expect("mint failed") + } + .return_value(); assert_eq!(mint_tx, Ok(())); let balance_after = { let _msg = build_message::(address.clone()) .call(|contract| contract.balance_of(address_of!(bob), Some(token.clone()))); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert_eq!(balance_after, 123); @@ -204,36 +207,36 @@ pub mod ownable { #[ink_e2e::test] async fn renounce_ownership_works(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_ownable", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_ownable", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; let owner = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.owner()); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + let _msg = build_message::(address.clone()).call(|contract| contract.owner()); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert_eq!(owner, address_of!(alice)); let renounce_ownership_tx = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.renounce_ownership()); - client.call(&ink_e2e::alice(), _msg, 0, None) + let _msg = build_message::(address.clone()).call(|contract| contract.renounce_ownership()); + client + .call(&ink_e2e::alice(), _msg, 0, None) .await .expect("renounce_ownership failed") - }.return_value(); + } + .return_value(); assert_eq!(renounce_ownership_tx, Ok(())); let owner = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.owner()); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + let _msg = build_message::(address.clone()).call(|contract| contract.owner()); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert_eq!(owner, AccountId::from([0x00; 32])); @@ -243,35 +246,33 @@ pub mod ownable { #[ink_e2e::test] async fn cannot_renounce_ownership_if_not_owner(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_ownable", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_ownable", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; let owner = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.owner()); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + let _msg = build_message::(address.clone()).call(|contract| contract.owner()); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert_eq!(owner, address_of!(alice)); let renounce_ownership_tx = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.renounce_ownership()); - client.call_dry_run(&ink_e2e::bob(), &_msg, 0, None) - .await - }.return_value(); + let _msg = build_message::(address.clone()).call(|contract| contract.renounce_ownership()); + client.call_dry_run(&ink_e2e::bob(), &_msg, 0, None).await + } + .return_value(); assert!(matches!(renounce_ownership_tx, Err(_))); let owner = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.owner()); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + let _msg = build_message::(address.clone()).call(|contract| contract.owner()); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert_eq!(owner, address_of!(alice)); @@ -281,35 +282,33 @@ pub mod ownable { #[ink_e2e::test] async fn cannot_transfer_ownership_if_not_owner(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_ownable", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_ownable", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; let owner = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.owner()); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + let _msg = build_message::(address.clone()).call(|contract| contract.owner()); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert_eq!(owner, address_of!(alice)); let renounce_ownership_tx = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.renounce_ownership()); - client.call_dry_run(&ink_e2e::bob(), &_msg, 0, None) - .await - }.return_value(); + let _msg = build_message::(address.clone()).call(|contract| contract.renounce_ownership()); + client.call_dry_run(&ink_e2e::bob(), &_msg, 0, None).await + } + .return_value(); assert!(matches!(renounce_ownership_tx, Err(_))); let owner = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.owner()); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + let _msg = build_message::(address.clone()).call(|contract| contract.owner()); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert_eq!(owner, address_of!(alice)); diff --git a/examples/pausable/Cargo.toml b/examples/pausable/Cargo.toml index e5a8808a6..c7f4185e3 100644 --- a/examples/pausable/Cargo.toml +++ b/examples/pausable/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_pausable" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -14,15 +14,12 @@ scale-info = { version = "2.3", default-features = false, features = ["derive"], openbrush = { path = "../..", default-features = false, features = ["pausable"] } [dev-dependencies] -ink_e2e = "4.1.0" +ink_e2e = "4.2.1" test_helpers = { path = "../test_helpers", default-features = false } [lib] name = "my_pausable" path = "lib.rs" -crate-type = [ - "cdylib", -] [features] default = ["std"] diff --git a/examples/pausable/lib.rs b/examples/pausable/lib.rs index 215f3cc81..783a7cab8 100644 --- a/examples/pausable/lib.rs +++ b/examples/pausable/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] @@ -64,7 +64,8 @@ pub mod my_pausable { #[ink_e2e::test] async fn success_flip_when_not_paused(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_pausable", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_pausable", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -77,7 +78,8 @@ pub mod my_pausable { #[ink_e2e::test] async fn success_pause_when_not_paused(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_pausable", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_pausable", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -90,7 +92,8 @@ pub mod my_pausable { #[ink_e2e::test] async fn success_change_state(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_pausable", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_pausable", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -103,7 +106,8 @@ pub mod my_pausable { #[ink_e2e::test] async fn failed_double_pause(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_pausable", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_pausable", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -117,7 +121,8 @@ pub mod my_pausable { #[ink_e2e::test] async fn success_pause_and_unpause(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_pausable", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_pausable", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -131,7 +136,8 @@ pub mod my_pausable { #[ink_e2e::test] async fn failed_unpause(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_pausable", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_pausable", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -144,7 +150,8 @@ pub mod my_pausable { #[ink_e2e::test] async fn failed_flip_when_paused(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_pausable", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_pausable", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; diff --git a/examples/payment_splitter/Cargo.toml b/examples/payment_splitter/Cargo.toml index 259f7d231..820ea609c 100644 --- a/examples/payment_splitter/Cargo.toml +++ b/examples/payment_splitter/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_payment_splitter" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -14,15 +14,12 @@ scale-info = { version = "2.3", default-features = false, features = ["derive"], openbrush = { path = "../..", default-features = false, features = ["payment_splitter"] } [dev-dependencies] -ink_e2e = "4.1.0" +ink_e2e = "4.2.1" test_helpers = { path = "../test_helpers", default-features = false } [lib] name = "my_payment_splitter" path = "lib.rs" -crate-type = [ - "cdylib", -] [features] default = ["std"] diff --git a/examples/payment_splitter/lib.rs b/examples/payment_splitter/lib.rs index d64ad9b27..7372f917a 100644 --- a/examples/payment_splitter/lib.rs +++ b/examples/payment_splitter/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] @@ -45,19 +45,23 @@ pub mod my_payment_splitter { use ink_e2e::{build_message, PolkadotConfig}; use ink_e2e::Client; - use test_helpers::{address_of, get_shares, method_call}; + use test_helpers::{ + address_of, + get_shares, + method_call, + }; type E2EResult = Result>; #[ink_e2e::test] async fn init_values(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(vec![(address_of!(bob), 40), (address_of!(alice), 60)]); - let address = client.instantiate("my_payment_splitter", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_payment_splitter", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; - let bob_shares = get_shares!(client, address, bob); assert_eq!(bob_shares, 40); @@ -71,9 +75,9 @@ pub mod my_payment_splitter { assert_eq!(total_shares, 100); let payee_0 = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.payee(0)); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) + let _msg = build_message::(address.clone()).call(|contract| contract.payee(0)); + client + .call_dry_run(&ink_e2e::alice(), &_msg, 0, None) .await .return_value() }; @@ -81,9 +85,9 @@ pub mod my_payment_splitter { assert_eq!(payee_0, address_of!(bob)); let payee_1 = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.payee(1)); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) + let _msg = build_message::(address.clone()).call(|contract| contract.payee(1)); + client + .call_dry_run(&ink_e2e::alice(), &_msg, 0, None) .await .return_value() }; @@ -96,7 +100,8 @@ pub mod my_payment_splitter { #[ink_e2e::test] async fn release_native_token(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(vec![(address_of!(bob), 40), (address_of!(alice), 60)]); - let address = client.instantiate("my_payment_splitter", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_payment_splitter", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -106,18 +111,19 @@ pub mod my_payment_splitter { assert_eq!(total_released_before, 0); let receive_tx = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.receive()); - client.call(&ink_e2e::alice(), _msg, 1000000000000, None) + let _msg = build_message::(address.clone()).call(|contract| contract.receive()); + client + .call(&ink_e2e::alice(), _msg, 1000000000000, None) .await .expect("call failed") .return_value() }; let release_bob = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.release(address_of!(bob))); - client.call(&ink_e2e::alice(), _msg, 0, None) + let _msg = + build_message::(address.clone()).call(|contract| contract.release(address_of!(bob))); + client + .call(&ink_e2e::alice(), _msg, 0, None) .await .expect("call failed") .return_value() @@ -126,9 +132,10 @@ pub mod my_payment_splitter { assert!(release_bob.is_ok()); let release_alice = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.release(address_of!(alice))); - client.call(&ink_e2e::alice(), _msg, 0, None) + let _msg = + build_message::(address.clone()).call(|contract| contract.release(address_of!(alice))); + client + .call(&ink_e2e::alice(), _msg, 0, None) .await .expect("call failed") .return_value() @@ -139,9 +146,10 @@ pub mod my_payment_splitter { let total_released = method_call!(client, address, total_released); let bob_released = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.released(address_of!(bob))); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) + let _msg = + build_message::(address.clone()).call(|contract| contract.released(address_of!(bob))); + client + .call_dry_run(&ink_e2e::alice(), &_msg, 0, None) .await .return_value() }; @@ -149,7 +157,8 @@ pub mod my_payment_splitter { let alice_released = { let _msg = build_message::(address.clone()) .call(|contract| contract.released(address_of!(alice))); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) + client + .call_dry_run(&ink_e2e::alice(), &_msg, 0, None) .await .return_value() }; @@ -168,7 +177,8 @@ pub mod my_payment_splitter { #[ink_e2e::test] async fn release_native_token_using_release_all(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(vec![(address_of!(bob), 40), (address_of!(alice), 60)]); - let address = client.instantiate("my_payment_splitter", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_payment_splitter", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -178,9 +188,9 @@ pub mod my_payment_splitter { assert_eq!(total_released_before, 0); let receive_tx = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.receive()); - client.call(&ink_e2e::alice(), _msg, 1000000000000, None) + let _msg = build_message::(address.clone()).call(|contract| contract.receive()); + client + .call(&ink_e2e::alice(), _msg, 1000000000000, None) .await .expect("call failed") .return_value() @@ -193,9 +203,10 @@ pub mod my_payment_splitter { let total_released = method_call!(client, address, total_released); let bob_released = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.released(address_of!(bob))); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) + let _msg = + build_message::(address.clone()).call(|contract| contract.released(address_of!(bob))); + client + .call_dry_run(&ink_e2e::alice(), &_msg, 0, None) .await .return_value() }; @@ -203,7 +214,8 @@ pub mod my_payment_splitter { let alice_released = { let _msg = build_message::(address.clone()) .call(|contract| contract.released(address_of!(alice))); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) + client + .call_dry_run(&ink_e2e::alice(), &_msg, 0, None) .await .return_value() }; diff --git a/examples/proxy/Cargo.toml b/examples/proxy/Cargo.toml index 1e3ea5d46..0c6e702dd 100644 --- a/examples/proxy/Cargo.toml +++ b/examples/proxy/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_proxy" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -16,9 +16,6 @@ openbrush = { path = "../..", default-features = false, features = ["proxy"] } [lib] name = "my_proxy" path = "lib.rs" -crate-type = [ - "cdylib", -] [features] default = ["std"] diff --git a/examples/proxy/lib.rs b/examples/proxy/lib.rs index 2b9d95977..2d383ef93 100644 --- a/examples/proxy/lib.rs +++ b/examples/proxy/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] diff --git a/examples/proxy/psp22_metadata_upgradeable/Cargo.toml b/examples/proxy/psp22_metadata_upgradeable/Cargo.toml index 9ba8b12af..54ff76ae2 100644 --- a/examples/proxy/psp22_metadata_upgradeable/Cargo.toml +++ b/examples/proxy/psp22_metadata_upgradeable/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_psp22_metadata_upgradeable" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -16,10 +16,6 @@ openbrush = { path = "../../..", default-features = false, features = ["psp22", [lib] name = "my_psp22_metadata_upgradeable" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [features] default = ["std"] diff --git a/examples/proxy/psp22_metadata_upgradeable/lib.rs b/examples/proxy/psp22_metadata_upgradeable/lib.rs index 313e83160..943c323f3 100644 --- a/examples/proxy/psp22_metadata_upgradeable/lib.rs +++ b/examples/proxy/psp22_metadata_upgradeable/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] diff --git a/examples/proxy/psp22_upgradeable/Cargo.toml b/examples/proxy/psp22_upgradeable/Cargo.toml index e1525b4a9..b0ec70334 100644 --- a/examples/proxy/psp22_upgradeable/Cargo.toml +++ b/examples/proxy/psp22_upgradeable/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_psp22_upgradeable" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -16,10 +16,6 @@ openbrush = { path = "../../..", default-features = false, features = ["psp22", [lib] name = "my_psp22_upgradeable" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [features] default = ["std"] diff --git a/examples/proxy/psp22_upgradeable/lib.rs b/examples/proxy/psp22_upgradeable/lib.rs index 1c9f3a063..4df0fc6ff 100644 --- a/examples/proxy/psp22_upgradeable/lib.rs +++ b/examples/proxy/psp22_upgradeable/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] diff --git a/examples/psp22/Cargo.toml b/examples/psp22/Cargo.toml index 07e687775..a872e6cff 100644 --- a/examples/psp22/Cargo.toml +++ b/examples/psp22/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_psp22" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -14,16 +14,12 @@ scale-info = { version = "2.3", default-features = false, features = ["derive"], openbrush = { path = "../..", default-features = false, features = ["psp22"] } [dev-dependencies] -ink_e2e = "4.1.0" +ink_e2e = "4.2.1" test_helpers = { path = "../test_helpers", default-features = false } [lib] name = "my_psp22" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [features] default = ["std"] diff --git a/examples/psp22/lib.rs b/examples/psp22/lib.rs index a0d1cae20..a66222aee 100644 --- a/examples/psp22/lib.rs +++ b/examples/psp22/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] pub use my_psp22::*; @@ -13,7 +13,6 @@ pub mod my_psp22 { }, }; - #[ink(storage)] #[derive(Storage)] pub struct Contract { @@ -76,7 +75,7 @@ pub mod my_psp22 { use test_helpers::{ address_of, - balance_of + balance_of, }; type E2EResult = Result>; @@ -84,7 +83,8 @@ pub mod my_psp22 { #[ink_e2e::test] async fn assigns_initial_balance(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(100); - let address = client.instantiate("my_psp22", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_psp22", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -103,7 +103,8 @@ pub mod my_psp22 { #[ink_e2e::test] async fn transfer_adds_amount_to_destination_account(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(100); - let address = client.instantiate("my_psp22", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_psp22", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -111,7 +112,8 @@ pub mod my_psp22 { let result = { let _msg = build_message::(address.clone()) .call(|contract| contract.transfer(address_of!(bob), 50, vec![])); - client.call(&ink_e2e::alice(), _msg, 0, None) + client + .call(&ink_e2e::alice(), _msg, 0, None) .await .expect("transfer failed") }; @@ -131,7 +133,8 @@ pub mod my_psp22 { #[ink_e2e::test] async fn cannot_transfer_above_the_amount(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(100); - let address = client.instantiate("my_psp22", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_psp22", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -139,8 +142,7 @@ pub mod my_psp22 { let result = { let _msg = build_message::(address.clone()) .call(|contract| contract.transfer(address_of!(bob), 101, vec![])); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await }; assert!(matches!(result.return_value(), Err(PSP22Error::InsufficientBalance))); @@ -151,7 +153,8 @@ pub mod my_psp22 { #[ink_e2e::test] async fn cannot_transfer_to_hated_account(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(100); - let address = client.instantiate("my_psp22", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_psp22", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -159,7 +162,8 @@ pub mod my_psp22 { let result = { let _msg = build_message::(address.clone()) .call(|contract| contract.transfer(address_of!(bob), 10, vec![])); - client.call(&ink_e2e::alice(), _msg, 0, None) + client + .call(&ink_e2e::alice(), _msg, 0, None) .await .expect("transfer failed") }; @@ -173,7 +177,8 @@ pub mod my_psp22 { let result = { let _msg = build_message::(address.clone()) .call(|contract| contract.set_hated_account(address_of!(bob))); - client.call(&ink_e2e::alice(), _msg, 0, None) + client + .call(&ink_e2e::alice(), _msg, 0, None) .await .expect("set_hated_account failed") }; @@ -183,8 +188,7 @@ pub mod my_psp22 { let result = { let _msg = build_message::(address.clone()) .call(|contract| contract.transfer(address_of!(bob), 10, vec![])); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await }; assert!(matches!(result.return_value(), Err(PSP22Error::Custom(_)))); diff --git a/examples/psp22_extensions/burnable/Cargo.toml b/examples/psp22_extensions/burnable/Cargo.toml index 96219496a..c3bdaa184 100644 --- a/examples/psp22_extensions/burnable/Cargo.toml +++ b/examples/psp22_extensions/burnable/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_psp22_burnable" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -14,16 +14,12 @@ scale-info = { version = "2.3", default-features = false, features = ["derive"], openbrush = { path = "../../..", default-features = false, features = ["psp22"] } [dev-dependencies] -ink_e2e = "4.1.0" +ink_e2e = "4.2.1" test_helpers = { path = "../../test_helpers", default-features = false } [lib] name = "my_psp22_burnable" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [features] default = ["std"] diff --git a/examples/psp22_extensions/burnable/lib.rs b/examples/psp22_extensions/burnable/lib.rs index cd5eec3ad..ff52bfd94 100644 --- a/examples/psp22_extensions/burnable/lib.rs +++ b/examples/psp22_extensions/burnable/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] diff --git a/examples/psp22_extensions/capped/Cargo.toml b/examples/psp22_extensions/capped/Cargo.toml index f04926854..d95390b21 100644 --- a/examples/psp22_extensions/capped/Cargo.toml +++ b/examples/psp22_extensions/capped/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_psp22_capped" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -16,13 +16,9 @@ openbrush = { path = "../../..", default-features = false, features = ["psp22"] [lib] name = "my_psp22_capped" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [dev-dependencies] -ink_e2e = "4.1.0" +ink_e2e = "4.2.1" test_helpers = { path = "../../test_helpers", default-features = false } [features] diff --git a/examples/psp22_extensions/capped/lib.rs b/examples/psp22_extensions/capped/lib.rs index 5079bd56b..e598ed0f2 100644 --- a/examples/psp22_extensions/capped/lib.rs +++ b/examples/psp22_extensions/capped/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] diff --git a/examples/psp22_extensions/flashmint/Cargo.toml b/examples/psp22_extensions/flashmint/Cargo.toml index df376e87a..c7d00f71f 100644 --- a/examples/psp22_extensions/flashmint/Cargo.toml +++ b/examples/psp22_extensions/flashmint/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_psp22_flashmint" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -16,10 +16,6 @@ openbrush = { path = "../../..", default-features = false, features = ["psp22"] [lib] name = "my_psp22_flashmint" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [features] default = ["std"] diff --git a/examples/psp22_extensions/flashmint/lib.rs b/examples/psp22_extensions/flashmint/lib.rs index 6aa119efc..636bd713c 100644 --- a/examples/psp22_extensions/flashmint/lib.rs +++ b/examples/psp22_extensions/flashmint/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] diff --git a/examples/psp22_extensions/metadata/Cargo.toml b/examples/psp22_extensions/metadata/Cargo.toml index 6865e17f6..495904512 100644 --- a/examples/psp22_extensions/metadata/Cargo.toml +++ b/examples/psp22_extensions/metadata/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_psp22_metadata" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -14,16 +14,12 @@ scale-info = { version = "2.3", default-features = false, features = ["derive"], openbrush = { path = "../../..", default-features = false, features = ["psp22"] } [dev-dependencies] -ink_e2e = "4.1.0" +ink_e2e = "4.2.1" test_helpers = { path = "../../test_helpers", default-features = false } [lib] name = "my_psp22_metadata" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [features] default = ["std"] diff --git a/examples/psp22_extensions/metadata/lib.rs b/examples/psp22_extensions/metadata/lib.rs index 5abcd0020..55a87db01 100644 --- a/examples/psp22_extensions/metadata/lib.rs +++ b/examples/psp22_extensions/metadata/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] diff --git a/examples/psp22_extensions/mintable/Cargo.toml b/examples/psp22_extensions/mintable/Cargo.toml index c972dd1d7..0de2fdf28 100644 --- a/examples/psp22_extensions/mintable/Cargo.toml +++ b/examples/psp22_extensions/mintable/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_psp22_mintable" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -14,16 +14,12 @@ scale-info = { version = "2.3", default-features = false, features = ["derive"], openbrush = { path = "../../..", default-features = false, features = ["psp22"] } [dev-dependencies] -ink_e2e = "4.1.0" +ink_e2e = "4.2.1" test_helpers = { path = "../../test_helpers", default-features = false } [lib] name = "my_psp22_mintable" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [features] default = ["std"] diff --git a/examples/psp22_extensions/mintable/lib.rs b/examples/psp22_extensions/mintable/lib.rs index ba5437b0c..d8b9e38f5 100644 --- a/examples/psp22_extensions/mintable/lib.rs +++ b/examples/psp22_extensions/mintable/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] diff --git a/examples/psp22_extensions/pausable/Cargo.toml b/examples/psp22_extensions/pausable/Cargo.toml index d64320b41..1c530816a 100644 --- a/examples/psp22_extensions/pausable/Cargo.toml +++ b/examples/psp22_extensions/pausable/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_psp22_pausable" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -14,16 +14,12 @@ scale-info = { version = "2.3", default-features = false, features = ["derive"], openbrush = { path = "../../..", default-features = false, features = ["psp22", "pausable"] } [dev-dependencies] -ink_e2e = "4.1.0" +ink_e2e = "4.2.1" test_helpers = { path = "../../test_helpers", default-features = false } [lib] name = "my_psp22_pausable" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [features] default = ["std"] diff --git a/examples/psp22_extensions/pausable/lib.rs b/examples/psp22_extensions/pausable/lib.rs index 0b636dba9..4d00b499b 100644 --- a/examples/psp22_extensions/pausable/lib.rs +++ b/examples/psp22_extensions/pausable/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] diff --git a/examples/psp22_extensions/wrapper/Cargo.toml b/examples/psp22_extensions/wrapper/Cargo.toml index e315719f1..54455b1e9 100644 --- a/examples/psp22_extensions/wrapper/Cargo.toml +++ b/examples/psp22_extensions/wrapper/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_psp22_wrapper" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -16,10 +16,6 @@ openbrush = { path = "../../..", default-features = false, features = ["psp22"] [lib] name = "my_psp22_wrapper" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [features] default = ["std"] diff --git a/examples/psp22_extensions/wrapper/lib.rs b/examples/psp22_extensions/wrapper/lib.rs index dc48c9fc7..d55a2a131 100644 --- a/examples/psp22_extensions/wrapper/lib.rs +++ b/examples/psp22_extensions/wrapper/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] diff --git a/examples/psp22_pallet/Cargo.toml b/examples/psp22_pallet/Cargo.toml index 9fb79b98a..d97b4e744 100644 --- a/examples/psp22_pallet/Cargo.toml +++ b/examples/psp22_pallet/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_psp22_pallet" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -14,17 +14,13 @@ scale-info = { version = "2.3", default-features = false, features = ["derive"], openbrush = { path = "../..", default-features = false, features = ["psp22_pallet"] } [dev-dependencies] -ink_e2e = "4.1.0" +ink_e2e = "4.2.1" test_helpers = { path = "../test_helpers", default-features = false } rand = "0.8.5" [lib] name = "my_psp22_pallet" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [features] default = ["std"] diff --git a/examples/psp22_pallet/lib.rs b/examples/psp22_pallet/lib.rs index 2b9b58c48..e80c74736 100644 --- a/examples/psp22_pallet/lib.rs +++ b/examples/psp22_pallet/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #![feature(default_alloc_error_handler)] @@ -55,7 +55,7 @@ pub mod my_psp22_pallet { use test_helpers::{ address_of, - balance_of + balance_of, }; fn random_num() -> u32 { @@ -68,7 +68,14 @@ pub mod my_psp22_pallet { #[ink_e2e::test] async fn assigns_initial_balance(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(random_num(), 1, 100); - let address = client.instantiate("my_psp22_pallet", &ink_e2e::alice(), constructor, 10000000000000000, None) + let address = client + .instantiate( + "my_psp22_pallet", + &ink_e2e::alice(), + constructor, + 10000000000000000, + None, + ) .await .expect("instantiate failed") .account_id; @@ -87,7 +94,14 @@ pub mod my_psp22_pallet { #[ink_e2e::test] async fn transfer_adds_amount_to_destination_account(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(random_num(), 1, 100); - let address = client.instantiate("my_psp22_pallet", &ink_e2e::alice(), constructor, 10000000000000000, None) + let address = client + .instantiate( + "my_psp22_pallet", + &ink_e2e::alice(), + constructor, + 10000000000000000, + None, + ) .await .expect("instantiate failed") .account_id; @@ -95,7 +109,8 @@ pub mod my_psp22_pallet { let result = { let _msg = build_message::(address.clone()) .call(|contract| contract.transfer(address_of!(bob), 50, vec![])); - client.call(&ink_e2e::alice(), _msg, 0, None) + client + .call(&ink_e2e::alice(), _msg, 0, None) .await .expect("transfer failed") }; @@ -115,7 +130,14 @@ pub mod my_psp22_pallet { #[ink_e2e::test] async fn cannot_transfer_above_the_amount(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(random_num(), 1, 100); - let address = client.instantiate("my_psp22_pallet", &ink_e2e::alice(), constructor, 10000000000000000, None) + let address = client + .instantiate( + "my_psp22_pallet", + &ink_e2e::alice(), + constructor, + 10000000000000000, + None, + ) .await .expect("instantiate failed") .account_id; @@ -123,8 +145,7 @@ pub mod my_psp22_pallet { let result = { let _msg = build_message::(address.clone()) .call(|contract| contract.transfer(address_of!(bob), 101, vec![])); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await }; assert!(matches!(result.return_value(), Err(PSP22Error::InsufficientBalance))); diff --git a/examples/psp22_pallet_extensions/burnable/Cargo.toml b/examples/psp22_pallet_extensions/burnable/Cargo.toml index 3113362c9..2c8eab401 100644 --- a/examples/psp22_pallet_extensions/burnable/Cargo.toml +++ b/examples/psp22_pallet_extensions/burnable/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_psp22_pallet_burnable" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -14,7 +14,7 @@ scale-info = { version = "2.3", default-features = false, features = ["derive"], openbrush = { path = "../../..", default-features = false, features = ["psp22_pallet"] } [dev-dependencies] -ink_e2e = "4.1.0" +ink_e2e = "4.2.1" test_helpers = { path = "../../test_helpers", default-features = false } rand = "0.8.5" @@ -22,10 +22,6 @@ rand = "0.8.5" [lib] name = "my_psp22_pallet_burnable" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [features] default = ["std"] diff --git a/examples/psp22_pallet_extensions/burnable/lib.rs b/examples/psp22_pallet_extensions/burnable/lib.rs index 5a81c0e9d..f9d7d7448 100644 --- a/examples/psp22_pallet_extensions/burnable/lib.rs +++ b/examples/psp22_pallet_extensions/burnable/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #![feature(default_alloc_error_handler)] diff --git a/examples/psp22_pallet_extensions/metadata/Cargo.toml b/examples/psp22_pallet_extensions/metadata/Cargo.toml index fbc896ff9..a3df563d6 100644 --- a/examples/psp22_pallet_extensions/metadata/Cargo.toml +++ b/examples/psp22_pallet_extensions/metadata/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_psp22_pallet_metadata" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -14,17 +14,13 @@ scale-info = { version = "2.3", default-features = false, features = ["derive"], openbrush = { path = "../../..", default-features = false, features = ["psp22_pallet"] } [dev-dependencies] -ink_e2e = "4.1.0" +ink_e2e = "4.2.1" test_helpers = { path = "../../test_helpers", default-features = false } rand = "0.8.5" [lib] name = "my_psp22_pallet_metadata" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [features] default = ["std"] diff --git a/examples/psp22_pallet_extensions/metadata/lib.rs b/examples/psp22_pallet_extensions/metadata/lib.rs index 490629c6f..38fd0b097 100644 --- a/examples/psp22_pallet_extensions/metadata/lib.rs +++ b/examples/psp22_pallet_extensions/metadata/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #![feature(default_alloc_error_handler)] diff --git a/examples/psp22_pallet_extensions/mintable/Cargo.toml b/examples/psp22_pallet_extensions/mintable/Cargo.toml index 31fbba91a..bfc9579bc 100644 --- a/examples/psp22_pallet_extensions/mintable/Cargo.toml +++ b/examples/psp22_pallet_extensions/mintable/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_psp22_pallet_mintable" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -16,13 +16,9 @@ openbrush = { path = "../../..", default-features = false, features = ["psp22_pa [lib] name = "my_psp22_pallet_mintable" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [dev-dependencies] -ink_e2e = "4.1.0" +ink_e2e = "4.2.1" test_helpers = { path = "../../test_helpers", default-features = false } rand = "0.8.5" diff --git a/examples/psp22_pallet_extensions/mintable/lib.rs b/examples/psp22_pallet_extensions/mintable/lib.rs index cbd126077..d8bc53fd8 100644 --- a/examples/psp22_pallet_extensions/mintable/lib.rs +++ b/examples/psp22_pallet_extensions/mintable/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #![feature(default_alloc_error_handler)] diff --git a/examples/psp22_utils/token_timelock/Cargo.toml b/examples/psp22_utils/token_timelock/Cargo.toml index 3c08c1197..dd1fa92da 100644 --- a/examples/psp22_utils/token_timelock/Cargo.toml +++ b/examples/psp22_utils/token_timelock/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_psp22_token_timelock" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -16,10 +16,6 @@ openbrush = { path = "../../..", default-features = false, features = ["psp22"] [lib] name = "my_psp22_token_timelock" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [features] default = ["std"] diff --git a/examples/psp22_utils/token_timelock/lib.rs b/examples/psp22_utils/token_timelock/lib.rs index 075c50ac4..034f2d6db 100644 --- a/examples/psp22_utils/token_timelock/lib.rs +++ b/examples/psp22_utils/token_timelock/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] diff --git a/examples/psp34/Cargo.toml b/examples/psp34/Cargo.toml index d5dfa51dd..b2b35a858 100644 --- a/examples/psp34/Cargo.toml +++ b/examples/psp34/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_psp34" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -14,16 +14,12 @@ scale-info = { version = "2.3", default-features = false, features = ["derive"], openbrush = { path = "../..", default-features = false, features = ["psp34"] } [dev-dependencies] -ink_e2e = "4.1.0" +ink_e2e = "4.2.1" test_helpers = { path = "../test_helpers", default-features = false } [lib] name = "my_psp34" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [features] default = ["std"] diff --git a/examples/psp34/lib.rs b/examples/psp34/lib.rs index b03da6d3f..d89ac99df 100644 --- a/examples/psp34/lib.rs +++ b/examples/psp34/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] @@ -58,7 +58,8 @@ pub mod my_psp34 { #[ink_e2e::test] async fn return_collection_id_of_account(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_psp34", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_psp34", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -67,10 +68,10 @@ pub mod my_psp34 { let expected_collection_id = Id::Bytes(AsRef::<[u8]>::as_ref(&account_id).to_vec()); let actual_collection_id = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.collection_id()); + let _msg = build_message::(address.clone()).call(|contract| contract.collection_id()); client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await - }.return_value(); + } + .return_value(); assert_eq!(expected_collection_id, actual_collection_id); @@ -80,24 +81,25 @@ pub mod my_psp34 { #[ink_e2e::test] async fn returns_total_supply(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_psp34", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_psp34", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; let expected_total_supply = 0; let actual_total_supply = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.total_supply()); + let _msg = build_message::(address.clone()).call(|contract| contract.total_supply()); client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await }; assert_eq!(expected_total_supply, actual_total_supply.return_value()); for _ in 0..3 { - let _msg = build_message::(address.clone()) - .call(|contract| contract.mint_token()); - let result = client.call(&ink_e2e::alice(), _msg, 0, None).await + let _msg = build_message::(address.clone()).call(|contract| contract.mint_token()); + let result = client + .call(&ink_e2e::alice(), _msg, 0, None) + .await .expect("mint_token failed"); assert_eq!(result.return_value(), Ok(())); @@ -105,8 +107,7 @@ pub mod my_psp34 { let expected_total_supply = 3; let actual_total_supply = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.total_supply()); + let _msg = build_message::(address.clone()).call(|contract| contract.total_supply()); client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await }; @@ -118,17 +119,20 @@ pub mod my_psp34 { #[ink_e2e::test] async fn transfer_works(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_psp34", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_psp34", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; let mint_result = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.mint_token()); - client.call(&ink_e2e::alice(), _msg, 0, None).await + let _msg = build_message::(address.clone()).call(|contract| contract.mint_token()); + client + .call(&ink_e2e::alice(), _msg, 0, None) + .await .expect("mint_token failed") - }.return_value(); + } + .return_value(); assert_eq!(mint_result, Ok(())); @@ -141,9 +145,12 @@ pub mod my_psp34 { let transfer_result = { let _msg = build_message::(address.clone()) .call(|contract| contract.transfer(address_of!(bob), Id::U8(0), vec![])); - client.call(&ink_e2e::alice(), _msg, 0, None).await + client + .call(&ink_e2e::alice(), _msg, 0, None) + .await .expect("transfer_from failed") - }.return_value(); + } + .return_value(); assert_eq!(transfer_result, Ok(())); @@ -156,17 +163,20 @@ pub mod my_psp34 { #[ink_e2e::test] async fn approved_transfer_works(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_psp34", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_psp34", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; let mint_result = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.mint_token()); - client.call(&ink_e2e::alice(), _msg, 0, None).await + let _msg = build_message::(address.clone()).call(|contract| contract.mint_token()); + client + .call(&ink_e2e::alice(), _msg, 0, None) + .await .expect("mint_token failed") - }.return_value(); + } + .return_value(); assert_eq!(mint_result, Ok(())); @@ -179,18 +189,24 @@ pub mod my_psp34 { let approve_result = { let _msg = build_message::(address.clone()) .call(|contract| contract.approve(address_of!(bob), Some(Id::U8(0)), true)); - client.call(&ink_e2e::alice(), _msg, 0, None).await + client + .call(&ink_e2e::alice(), _msg, 0, None) + .await .expect("approve failed") - }.return_value(); + } + .return_value(); assert_eq!(approve_result, Ok(())); let transfer_result = { let _msg = build_message::(address.clone()) .call(|contract| contract.transfer(address_of!(bob), Id::U8(0), vec![])); - client.call(&ink_e2e::bob(), _msg, 0, None).await + client + .call(&ink_e2e::bob(), _msg, 0, None) + .await .expect("transfer_from failed") - }.return_value(); + } + .return_value(); assert_eq!(transfer_result, Ok(())); @@ -203,17 +219,20 @@ pub mod my_psp34 { #[ink_e2e::test] async fn approved_operator_transfer_works(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_psp34", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_psp34", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; let mint_result = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.mint_token()); - client.call(&ink_e2e::alice(), _msg, 0, None).await + let _msg = build_message::(address.clone()).call(|contract| contract.mint_token()); + client + .call(&ink_e2e::alice(), _msg, 0, None) + .await .expect("mint_token failed") - }.return_value(); + } + .return_value(); assert_eq!(mint_result, Ok(())); @@ -226,18 +245,24 @@ pub mod my_psp34 { let approve_result = { let _msg = build_message::(address.clone()) .call(|contract| contract.approve(address_of!(bob), None, true)); - client.call(&ink_e2e::alice(), _msg, 0, None).await + client + .call(&ink_e2e::alice(), _msg, 0, None) + .await .expect("approve failed") - }.return_value(); + } + .return_value(); assert_eq!(approve_result, Ok(())); let transfer_result = { let _msg = build_message::(address.clone()) .call(|contract| contract.transfer(address_of!(bob), Id::U8(0), vec![])); - client.call(&ink_e2e::bob(), _msg, 0, None).await + client + .call(&ink_e2e::bob(), _msg, 0, None) + .await .expect("transfer_from failed") - }.return_value(); + } + .return_value(); assert_eq!(transfer_result, Ok(())); @@ -250,17 +275,20 @@ pub mod my_psp34 { #[ink_e2e::test] async fn psp34_transfer_works(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_psp34", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_psp34", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; let mint_result = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.mint_token()); - client.call(&ink_e2e::alice(), _msg, 0, None).await + let _msg = build_message::(address.clone()).call(|contract| contract.mint_token()); + client + .call(&ink_e2e::alice(), _msg, 0, None) + .await .expect("mint_token failed") - }.return_value(); + } + .return_value(); assert_eq!(mint_result, Ok(())); @@ -269,9 +297,12 @@ pub mod my_psp34 { let transfer_result = { let _msg = build_message::(address.clone()) .call(|contract| contract.transfer(address_of!(bob), Id::U8(0), vec![])); - client.call(&ink_e2e::alice(), _msg, 0, None).await + client + .call(&ink_e2e::alice(), _msg, 0, None) + .await .expect("transfer_from failed") - }.return_value(); + } + .return_value(); assert_eq!(transfer_result, Ok(())); @@ -283,7 +314,8 @@ pub mod my_psp34 { #[ink_e2e::test] async fn can_nextot_transfer_non_existing_token(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_psp34", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_psp34", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -294,7 +326,8 @@ pub mod my_psp34 { let _msg = build_message::(address.clone()) .call(|contract| contract.transfer(address_of!(bob), Id::U8(0), vec![])); client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await - }.return_value(); + } + .return_value(); assert!(matches!(transfer_result, Err(PSP34Error::TokenNotExists))); assert_eq!(balance_of!(client, address, alice), 0); @@ -305,17 +338,20 @@ pub mod my_psp34 { #[ink_e2e::test] async fn cannot_transfer_without_allowance(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_psp34", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_psp34", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; let mint_result = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.mint_token()); - client.call(&ink_e2e::alice(), _msg, 0, None).await + let _msg = build_message::(address.clone()).call(|contract| contract.mint_token()); + client + .call(&ink_e2e::alice(), _msg, 0, None) + .await .expect("mint_token failed") - }.return_value(); + } + .return_value(); assert_eq!(mint_result, Ok(())); @@ -323,7 +359,8 @@ pub mod my_psp34 { let _msg = build_message::(address.clone()) .call(|contract| contract.transfer(address_of!(bob), Id::U8(0), vec![])); client.call_dry_run(&ink_e2e::bob(), &_msg, 0, None).await - }.return_value(); + } + .return_value(); assert!(matches!(transfer_result, Err(PSP34Error::NotApproved))); assert_eq!(balance_of!(client, address, alice), 1); @@ -335,22 +372,32 @@ pub mod my_psp34 { #[ink_e2e::test] async fn can_mint_any_id(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_psp34", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_psp34", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; assert_eq!(balance_of!(client, address, alice), 0); - let ids = vec![Id::U8(0), Id::U16(0), Id::U32(0), Id::U64(0), Id::U128(0), Id::Bytes(vec![0])]; + let ids = vec![ + Id::U8(0), + Id::U16(0), + Id::U32(0), + Id::U64(0), + Id::U128(0), + Id::Bytes(vec![0]), + ]; for id in ids { let mint_result = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.mint(id.clone())); - client.call(&ink_e2e::alice(), _msg, 0, None).await + let _msg = build_message::(address.clone()).call(|contract| contract.mint(id.clone())); + client + .call(&ink_e2e::alice(), _msg, 0, None) + .await .expect("mint failed") - }.return_value(); + } + .return_value(); assert_eq!(mint_result, Ok(())); } diff --git a/examples/psp34_extensions/burnable/Cargo.toml b/examples/psp34_extensions/burnable/Cargo.toml index eab98e0b0..c5f16d7e6 100644 --- a/examples/psp34_extensions/burnable/Cargo.toml +++ b/examples/psp34_extensions/burnable/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_psp34_burnable" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -14,16 +14,12 @@ scale-info = { version = "2.3", default-features = false, features = ["derive"], openbrush = { path = "../../..", default-features = false, features = ["psp34"] } [dev-dependencies] -ink_e2e = "4.1.0" +ink_e2e = "4.2.1" test_helpers = { path = "../../test_helpers", default-features = false } [lib] name = "my_psp34_burnable" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [features] default = ["std"] diff --git a/examples/psp34_extensions/burnable/lib.rs b/examples/psp34_extensions/burnable/lib.rs index 4c39d5be8..71774aaf7 100644 --- a/examples/psp34_extensions/burnable/lib.rs +++ b/examples/psp34_extensions/burnable/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] diff --git a/examples/psp34_extensions/enumerable/Cargo.toml b/examples/psp34_extensions/enumerable/Cargo.toml index 92e44495d..168c3f433 100644 --- a/examples/psp34_extensions/enumerable/Cargo.toml +++ b/examples/psp34_extensions/enumerable/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_psp34_enumerable" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -14,16 +14,12 @@ scale-info = { version = "2.3", default-features = false, features = ["derive"], openbrush = { path = "../../..", default-features = false, features = ["psp34"] } [dev-dependencies] -ink_e2e = "4.1.0" +ink_e2e = "4.2.1" test_helpers = { path = "../../test_helpers", default-features = false } [lib] name = "my_psp34_enumerable" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [features] default = ["std"] diff --git a/examples/psp34_extensions/enumerable/lib.rs b/examples/psp34_extensions/enumerable/lib.rs index e4d89daa9..3149eaa2a 100644 --- a/examples/psp34_extensions/enumerable/lib.rs +++ b/examples/psp34_extensions/enumerable/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] diff --git a/examples/psp34_extensions/metadata/Cargo.toml b/examples/psp34_extensions/metadata/Cargo.toml index 4815f44f0..3626b79c8 100644 --- a/examples/psp34_extensions/metadata/Cargo.toml +++ b/examples/psp34_extensions/metadata/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_psp34_metadata" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -14,16 +14,12 @@ scale-info = { version = "2.3", default-features = false, features = ["derive"], openbrush = { path = "../../..", default-features = false, features = ["psp34"] } [dev-dependencies] -ink_e2e = "4.1.0" +ink_e2e = "4.2.1" test_helpers = { path = "../../test_helpers", default-features = false } [lib] name = "my_psp34_metadata" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [features] default = ["std"] diff --git a/examples/psp34_extensions/metadata/lib.rs b/examples/psp34_extensions/metadata/lib.rs index 7f1bbeb71..342d000a9 100644 --- a/examples/psp34_extensions/metadata/lib.rs +++ b/examples/psp34_extensions/metadata/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] diff --git a/examples/psp34_extensions/mintable/Cargo.toml b/examples/psp34_extensions/mintable/Cargo.toml index 71a3a767a..e9abf8eec 100644 --- a/examples/psp34_extensions/mintable/Cargo.toml +++ b/examples/psp34_extensions/mintable/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_psp34_mintable" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -14,16 +14,12 @@ scale-info = { version = "2.3", default-features = false, features = ["derive"], openbrush = { path = "../../..", default-features = false, features = ["psp34"] } [dev-dependencies] -ink_e2e = "4.1.0" +ink_e2e = "4.2.1" test_helpers = { path = "../../test_helpers", default-features = false } [lib] name = "my_psp34_mintable" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [features] default = ["std"] diff --git a/examples/psp34_extensions/mintable/lib.rs b/examples/psp34_extensions/mintable/lib.rs index a2db46bac..04b3b56ec 100644 --- a/examples/psp34_extensions/mintable/lib.rs +++ b/examples/psp34_extensions/mintable/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] diff --git a/examples/psp37/Cargo.toml b/examples/psp37/Cargo.toml index cd00c32d6..96a39d7bb 100644 --- a/examples/psp37/Cargo.toml +++ b/examples/psp37/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_psp37" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -14,16 +14,12 @@ scale-info = { version = "2.3", default-features = false, features = ["derive"], openbrush = { path = "../..", default-features = false, features = ["psp37"] } [dev-dependencies] -ink_e2e = "4.1.0" +ink_e2e = "4.2.1" test_helpers = { path = "../test_helpers", default-features = false } [lib] name = "my_psp37" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [features] default = ["std"] diff --git a/examples/psp37/lib.rs b/examples/psp37/lib.rs index d7fcfdc74..3f974d575 100644 --- a/examples/psp37/lib.rs +++ b/examples/psp37/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] @@ -41,7 +41,6 @@ pub mod my_psp37 { } self._mint_to(Self::env().caller(), vec![(id, amount)]) } - } #[cfg(all(test, feature = "e2e-tests"))] @@ -55,7 +54,7 @@ pub mod my_psp37 { use test_helpers::{ address_of, - balance_of_37 + balance_of_37, }; type E2EResult = Result>; @@ -63,7 +62,8 @@ pub mod my_psp37 { #[ink_e2e::test] async fn balance_of_works(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_psp37", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_psp37", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -79,21 +79,24 @@ pub mod my_psp37 { let mint_tx = { let _msg = build_message::(address.clone()) .call(|contract| contract.mint_tokens(token_1.clone(), amount_1)); - client.call(&ink_e2e::alice(), _msg, 0, None) + client + .call(&ink_e2e::alice(), _msg, 0, None) .await .expect("mint failed") - }.return_value(); + } + .return_value(); assert_eq!(mint_tx, Ok(())); - let mint_tx = { let _msg = build_message::(address.clone()) .call(|contract| contract.mint_tokens(token_2.clone(), amount_2)); - client.call(&ink_e2e::alice(), _msg, 0, None) + client + .call(&ink_e2e::alice(), _msg, 0, None) .await .expect("mint failed") - }.return_value(); + } + .return_value(); assert_eq!(mint_tx, Ok(())); @@ -107,7 +110,8 @@ pub mod my_psp37 { #[ink_e2e::test] async fn total_supply_works(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_psp37", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_psp37", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -119,67 +123,68 @@ pub mod my_psp37 { let amount_2 = 20; let total_supply = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.total_supply(None)); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + let _msg = build_message::(address.clone()).call(|contract| contract.total_supply(None)); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert_eq!(total_supply, 0); let mint_tx = { let _msg = build_message::(address.clone()) .call(|contract| contract.mint_tokens(token_1.clone(), amount_1.clone())); - client.call(&ink_e2e::alice(), _msg, 0, None) + client + .call(&ink_e2e::alice(), _msg, 0, None) .await .expect("call failed") - }.return_value(); + } + .return_value(); assert_eq!(mint_tx, Ok(())); let total_supply_1 = { let _msg = build_message::(address.clone()) .call(|contract| contract.total_supply(Some(token_1.clone()))); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert_eq!(total_supply_1.clone(), amount_1.clone()); let total_supply_2 = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.total_supply(None)); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + let _msg = build_message::(address.clone()).call(|contract| contract.total_supply(None)); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert_eq!(total_supply_2, 1); let mint_tx = { let _msg = build_message::(address.clone()) .call(|contract| contract.mint_tokens(token_2.clone(), amount_2.clone())); - client.call(&ink_e2e::alice(), _msg, 0, None) + client + .call(&ink_e2e::alice(), _msg, 0, None) .await .expect("call failed") - }.return_value(); + } + .return_value(); assert_eq!(mint_tx, Ok(())); let total_supply_1 = { let _msg = build_message::(address.clone()) .call(|contract| contract.total_supply(Some(token_2.clone()))); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert_eq!(total_supply_1.clone(), amount_2.clone()); let total_supply_2 = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.total_supply(None)); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + let _msg = build_message::(address.clone()).call(|contract| contract.total_supply(None)); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert_eq!(total_supply_2.clone(), 2); @@ -189,7 +194,8 @@ pub mod my_psp37 { #[ink_e2e::test] async fn allowance_works(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_psp37", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_psp37", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -199,28 +205,30 @@ pub mod my_psp37 { let allowance = { let _msg = build_message::(address.clone()) .call(|contract| contract.allowance(address_of!(alice), address_of!(bob), Some(token.clone()))); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert_eq!(allowance, 0); let approve_tx = { let _msg = build_message::(address.clone()) .call(|contract| contract.approve(address_of!(bob), Some(token.clone()), 10)); - client.call(&ink_e2e::alice(), _msg, 0, None) + client + .call(&ink_e2e::alice(), _msg, 0, None) .await .expect("approve failed") - }.return_value(); + } + .return_value(); assert_eq!(approve_tx, Ok(())); let allowance = { let _msg = build_message::(address.clone()) .call(|contract| contract.allowance(address_of!(alice), address_of!(bob), Some(token.clone()))); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert_eq!(allowance, 10); @@ -230,7 +238,8 @@ pub mod my_psp37 { #[ink_e2e::test] async fn transfer_works(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_psp37", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_psp37", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -244,20 +253,24 @@ pub mod my_psp37 { let mint_tx = { let _msg = build_message::(address.clone()) .call(|contract| contract.mint_tokens(token_1.clone(), amount_1.clone())); - client.call(&ink_e2e::alice(), _msg, 0, None) + client + .call(&ink_e2e::alice(), _msg, 0, None) .await .expect("call failed") - }.return_value(); + } + .return_value(); assert_eq!(mint_tx, Ok(())); let mint_tx = { let _msg = build_message::(address.clone()) .call(|contract| contract.mint_tokens(token_2.clone(), amount_2.clone())); - client.call(&ink_e2e::alice(), _msg, 0, None) + client + .call(&ink_e2e::alice(), _msg, 0, None) .await .expect("call failed") - }.return_value(); + } + .return_value(); assert_eq!(mint_tx, Ok(())); @@ -266,21 +279,22 @@ pub mod my_psp37 { assert_eq!(balance_of_37!(client, address, alice, Some(token_2.clone())), amount_2); let total_supply = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.total_supply(None)); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + let _msg = build_message::(address.clone()).call(|contract| contract.total_supply(None)); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert_eq!(total_supply, 2); let transfer_tx = { let _msg = build_message::(address.clone()) .call(|contract| contract.transfer(address_of!(bob), token_2.clone(), amount_2, vec![])); - client.call(&ink_e2e::alice(), _msg, 0, None) + client + .call(&ink_e2e::alice(), _msg, 0, None) .await .expect("call failed") - }.return_value(); + } + .return_value(); assert_eq!(transfer_tx, Ok(())); @@ -294,27 +308,31 @@ pub mod my_psp37 { let transfer_tx = { let _msg = build_message::(address.clone()) .call(|contract| contract.transfer(address_of!(bob), token_1.clone(), amount_1, vec![])); - client.call(&ink_e2e::alice(), _msg, 0, None) + client + .call(&ink_e2e::alice(), _msg, 0, None) .await .expect("call failed") - }.return_value(); + } + .return_value(); assert_eq!(transfer_tx, Ok(())); let transfer_tx = { let _msg = build_message::(address.clone()) .call(|contract| contract.transfer(address_of!(alice), token_2.clone(), amount_1, vec![])); - client.call(&ink_e2e::bob(), _msg, 0, None) - .await - .expect("call failed") - }.return_value(); + client.call(&ink_e2e::bob(), _msg, 0, None).await.expect("call failed") + } + .return_value(); assert_eq!(transfer_tx, Ok(())); assert_eq!(balance_of_37!(client, address, alice, Some(token_1.clone())), 0); assert_eq!(balance_of_37!(client, address, alice, Some(token_2.clone())), amount_1); assert_eq!(balance_of_37!(client, address, bob, Some(token_1.clone())), amount_1); - assert_eq!(balance_of_37!(client, address, bob, Some(token_2.clone())), amount_2 - amount_1); + assert_eq!( + balance_of_37!(client, address, bob, Some(token_2.clone())), + amount_2 - amount_1 + ); assert_eq!(balance_of_37!(client, address, alice, None), 1); assert_eq!(balance_of_37!(client, address, bob, None), 2); @@ -324,7 +342,8 @@ pub mod my_psp37 { #[ink_e2e::test] async fn transfer_from_works(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_psp37", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_psp37", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -338,40 +357,46 @@ pub mod my_psp37 { let mint_tx = { let _msg = build_message::(address.clone()) .call(|contract| contract.mint_tokens(token_1.clone(), amount_1.clone())); - client.call(&ink_e2e::alice(), _msg, 0, None) + client + .call(&ink_e2e::alice(), _msg, 0, None) .await .expect("call failed") - }.return_value(); + } + .return_value(); assert_eq!(mint_tx, Ok(())); let mint_tx = { let _msg = build_message::(address.clone()) .call(|contract| contract.mint_tokens(token_2.clone(), amount_2.clone())); - client.call(&ink_e2e::alice(), _msg, 0, None) + client + .call(&ink_e2e::alice(), _msg, 0, None) .await .expect("call failed") - }.return_value(); + } + .return_value(); assert_eq!(mint_tx, Ok(())); let approve_tx = { let _msg = build_message::(address.clone()) .call(|contract| contract.approve(address_of!(alice), None, 1)); - client.call(&ink_e2e::bob(), _msg, 0, None) - .await - .expect("call failed") - }.return_value(); + client.call(&ink_e2e::bob(), _msg, 0, None).await.expect("call failed") + } + .return_value(); assert_eq!(approve_tx, Ok(())); let transfer_from_tx = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.transfer_from(address_of!(alice), address_of!(bob), token_2.clone(), amount_2, vec![])); - client.call(&ink_e2e::alice(), _msg, 0, None) + let _msg = build_message::(address.clone()).call(|contract| { + contract.transfer_from(address_of!(alice), address_of!(bob), token_2.clone(), amount_2, vec![]) + }); + client + .call(&ink_e2e::alice(), _msg, 0, None) .await .expect("call failed") - }.return_value(); + } + .return_value(); assert_eq!(transfer_from_tx, Ok(())); @@ -381,29 +406,38 @@ pub mod my_psp37 { assert_eq!(balance_of_37!(client, address, bob, Some(token_2.clone())), amount_2); let transfer_from_tx = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.transfer_from(address_of!(alice), address_of!(bob), token_1.clone(), amount_1, vec![])); - client.call(&ink_e2e::alice(), _msg, 0, None) + let _msg = build_message::(address.clone()).call(|contract| { + contract.transfer_from(address_of!(alice), address_of!(bob), token_1.clone(), amount_1, vec![]) + }); + client + .call(&ink_e2e::alice(), _msg, 0, None) .await .expect("call failed") - }.return_value(); + } + .return_value(); assert_eq!(transfer_from_tx, Ok(())); let transfer_from_tx = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.transfer_from(address_of!(bob), address_of!(alice), token_2.clone(), amount_1, vec![])); - client.call(&ink_e2e::alice(), _msg, 0, None) + let _msg = build_message::(address.clone()).call(|contract| { + contract.transfer_from(address_of!(bob), address_of!(alice), token_2.clone(), amount_1, vec![]) + }); + client + .call(&ink_e2e::alice(), _msg, 0, None) .await .expect("call failed") - }.return_value(); + } + .return_value(); assert_eq!(transfer_from_tx, Ok(())); assert_eq!(balance_of_37!(client, address, alice, Some(token_1.clone())), 0); assert_eq!(balance_of_37!(client, address, alice, Some(token_2.clone())), amount_1); assert_eq!(balance_of_37!(client, address, bob, Some(token_1.clone())), amount_1); - assert_eq!(balance_of_37!(client, address, bob, Some(token_2.clone())), amount_2 - amount_1); + assert_eq!( + balance_of_37!(client, address, bob, Some(token_2.clone())), + amount_2 - amount_1 + ); Ok(()) } @@ -411,7 +445,8 @@ pub mod my_psp37 { #[ink_e2e::test] async fn transfer_from_insufficient_balance_should_fail(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_psp37", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_psp37", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -422,10 +457,12 @@ pub mod my_psp37 { let mint_tx = { let _msg = build_message::(address.clone()) .call(|contract| contract.mint_tokens(token.clone(), amount.clone())); - client.call(&ink_e2e::alice(), _msg, 0, None) + client + .call(&ink_e2e::alice(), _msg, 0, None) .await .expect("call failed") - }.return_value(); + } + .return_value(); assert_eq!(mint_tx, Ok(())); @@ -434,19 +471,19 @@ pub mod my_psp37 { let approve_tx = { let _msg = build_message::(address.clone()) .call(|contract| contract.approve(address_of!(alice), Some(token.clone()), amount)); - client.call(&ink_e2e::bob(), _msg, 0, None) - .await - .expect("call failed") - }.return_value(); + client.call(&ink_e2e::bob(), _msg, 0, None).await.expect("call failed") + } + .return_value(); assert_eq!(approve_tx, Ok(())); let transfer_from_tx = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.transfer_from(address_of!(bob), address_of!(alice), token.clone(), amount + 1, vec![])); - client.call_dry_run(&ink_e2e::bob(), &_msg, 0, None) - .await - }.return_value(); + let _msg = build_message::(address.clone()).call(|contract| { + contract.transfer_from(address_of!(bob), address_of!(alice), token.clone(), amount + 1, vec![]) + }); + client.call_dry_run(&ink_e2e::bob(), &_msg, 0, None).await + } + .return_value(); assert!(matches!(transfer_from_tx, Err(_))); @@ -458,7 +495,8 @@ pub mod my_psp37 { #[ink_e2e::test] async fn transfer_from_without_allowance_should_fail(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); - let address = client.instantiate("my_psp37", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_psp37", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -469,21 +507,24 @@ pub mod my_psp37 { let mint_tx = { let _msg = build_message::(address.clone()) .call(|contract| contract.mint_tokens(token.clone(), amount.clone())); - client.call(&ink_e2e::alice(), _msg, 0, None) + client + .call(&ink_e2e::alice(), _msg, 0, None) .await .expect("call failed") - }.return_value(); + } + .return_value(); assert_eq!(mint_tx, Ok(())); assert_eq!(balance_of_37!(client, address, alice, Some(token.clone())), amount); let transfer_from_tx = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.transfer_from(address_of!(bob), address_of!(alice), token.clone(), amount + 1, vec![])); - client.call_dry_run(&ink_e2e::bob(), &_msg, 0, None) - .await - }.return_value(); + let _msg = build_message::(address.clone()).call(|contract| { + contract.transfer_from(address_of!(bob), address_of!(alice), token.clone(), amount + 1, vec![]) + }); + client.call_dry_run(&ink_e2e::bob(), &_msg, 0, None).await + } + .return_value(); assert!(matches!(transfer_from_tx, Err(_))); diff --git a/examples/psp37_extensions/batch/Cargo.toml b/examples/psp37_extensions/batch/Cargo.toml index 6f40b4a26..fed3ae2d6 100644 --- a/examples/psp37_extensions/batch/Cargo.toml +++ b/examples/psp37_extensions/batch/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_psp37_batch" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -14,16 +14,12 @@ scale-info = { version = "2.3", default-features = false, features = ["derive"], openbrush = { path = "../../..", default-features = false, features = ["psp37"] } [dev-dependencies] -ink_e2e = "4.1.0" +ink_e2e = "4.2.1" test_helpers = { path = "../../test_helpers", default-features = false } [lib] name = "my_psp37_batch" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [features] default = ["std"] diff --git a/examples/psp37_extensions/batch/lib.rs b/examples/psp37_extensions/batch/lib.rs index 33fa524ff..643af2bf7 100644 --- a/examples/psp37_extensions/batch/lib.rs +++ b/examples/psp37_extensions/batch/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] diff --git a/examples/psp37_extensions/burnable/Cargo.toml b/examples/psp37_extensions/burnable/Cargo.toml index 5a9ed272b..4fcb64121 100644 --- a/examples/psp37_extensions/burnable/Cargo.toml +++ b/examples/psp37_extensions/burnable/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_psp37_burnable" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -14,16 +14,12 @@ scale-info = { version = "2.3", default-features = false, features = ["derive"], openbrush = { path = "../../..", default-features = false, features = ["psp37"] } [dev-dependencies] -ink_e2e = "4.1.0" +ink_e2e = "4.2.1" test_helpers = { path = "../../test_helpers", default-features = false } [lib] name = "my_psp37_burnable" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [features] default = ["std"] diff --git a/examples/psp37_extensions/burnable/lib.rs b/examples/psp37_extensions/burnable/lib.rs index f1d138dbe..4d3cd0b01 100644 --- a/examples/psp37_extensions/burnable/lib.rs +++ b/examples/psp37_extensions/burnable/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] diff --git a/examples/psp37_extensions/enumerable/Cargo.toml b/examples/psp37_extensions/enumerable/Cargo.toml index d7dffe3d0..f9f77d9c0 100644 --- a/examples/psp37_extensions/enumerable/Cargo.toml +++ b/examples/psp37_extensions/enumerable/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_psp37_enumerable" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -14,16 +14,12 @@ scale-info = { version = "2.3", default-features = false, features = ["derive"], openbrush = { path = "../../..", default-features = false, features = ["psp37"] } [dev-dependencies] -ink_e2e = "4.1.0" +ink_e2e = "4.2.1" test_helpers = { path = "../../test_helpers", default-features = false } [lib] name = "my_psp37_enumerable" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [features] default = ["std"] diff --git a/examples/psp37_extensions/enumerable/lib.rs b/examples/psp37_extensions/enumerable/lib.rs index 326d65df1..3569cb9df 100644 --- a/examples/psp37_extensions/enumerable/lib.rs +++ b/examples/psp37_extensions/enumerable/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] diff --git a/examples/psp37_extensions/metadata/Cargo.toml b/examples/psp37_extensions/metadata/Cargo.toml index 2c0d30646..e2e4f52ba 100644 --- a/examples/psp37_extensions/metadata/Cargo.toml +++ b/examples/psp37_extensions/metadata/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_psp37_metadata" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -14,16 +14,12 @@ scale-info = { version = "2.3", default-features = false, features = ["derive"], openbrush = { path = "../../..", default-features = false, features = ["psp37"] } [dev-dependencies] -ink_e2e = "4.1.0" +ink_e2e = "4.2.1" test_helpers = { path = "../../test_helpers", default-features = false } [lib] name = "my_psp37_metadata" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [features] default = ["std"] diff --git a/examples/psp37_extensions/metadata/lib.rs b/examples/psp37_extensions/metadata/lib.rs index 5e23ffd75..5e4928fed 100644 --- a/examples/psp37_extensions/metadata/lib.rs +++ b/examples/psp37_extensions/metadata/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] diff --git a/examples/psp37_extensions/mintable/Cargo.toml b/examples/psp37_extensions/mintable/Cargo.toml index 82d1f0749..99587d3f1 100644 --- a/examples/psp37_extensions/mintable/Cargo.toml +++ b/examples/psp37_extensions/mintable/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_psp37_mintable" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -14,16 +14,12 @@ scale-info = { version = "2.3", default-features = false, features = ["derive"], openbrush = { path = "../../..", default-features = false, features = ["psp37"] } [dev-dependencies] -ink_e2e = "4.1.0" +ink_e2e = "4.2.1" test_helpers = { path = "../../test_helpers", default-features = false } [lib] name = "my_psp37_mintable" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [features] default = ["std"] diff --git a/examples/psp37_extensions/mintable/lib.rs b/examples/psp37_extensions/mintable/lib.rs index 1c07d6b23..d0fb1f09a 100644 --- a/examples/psp37_extensions/mintable/lib.rs +++ b/examples/psp37_extensions/mintable/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #[openbrush::contract] diff --git a/examples/reentrancy_guard/Cargo.toml b/examples/reentrancy_guard/Cargo.toml index 5ee81ee49..20b475b16 100644 --- a/examples/reentrancy_guard/Cargo.toml +++ b/examples/reentrancy_guard/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "flipper" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } diff --git a/examples/reentrancy_guard/contracts/flip_on_me/Cargo.toml b/examples/reentrancy_guard/contracts/flip_on_me/Cargo.toml index ac71869ce..7040e1d82 100644 --- a/examples/reentrancy_guard/contracts/flip_on_me/Cargo.toml +++ b/examples/reentrancy_guard/contracts/flip_on_me/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "flip_on_me" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -16,10 +16,6 @@ openbrush = { path = "../../../..", default-features = false } [lib] name = "flip_on_me" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", -] [features] default = ["std"] diff --git a/examples/reentrancy_guard/contracts/flip_on_me/lib.rs b/examples/reentrancy_guard/contracts/flip_on_me/lib.rs index 00d2bfd0b..03c343229 100644 --- a/examples/reentrancy_guard/contracts/flip_on_me/lib.rs +++ b/examples/reentrancy_guard/contracts/flip_on_me/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #[openbrush::contract] pub mod flip_on_me { diff --git a/examples/reentrancy_guard/contracts/flipper/Cargo.toml b/examples/reentrancy_guard/contracts/flipper/Cargo.toml index 88bc441ad..082e9a582 100644 --- a/examples/reentrancy_guard/contracts/flipper/Cargo.toml +++ b/examples/reentrancy_guard/contracts/flipper/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_flipper_guard" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -18,9 +18,6 @@ openbrush = { path = "../../../..", default-features = false } name = "my_flipper_guard" path = "lib.rs" -crate-type = [ - "cdylib", -] [features] default = ["std"] diff --git a/examples/reentrancy_guard/contracts/flipper/lib.rs b/examples/reentrancy_guard/contracts/flipper/lib.rs index 8900e5ea0..d795bfcc0 100644 --- a/examples/reentrancy_guard/contracts/flipper/lib.rs +++ b/examples/reentrancy_guard/contracts/flipper/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #[openbrush::contract] pub mod my_flipper_guard { diff --git a/examples/reentrancy_guard/lib.rs b/examples/reentrancy_guard/lib.rs index 57a707ac6..52b07a38f 100644 --- a/examples/reentrancy_guard/lib.rs +++ b/examples/reentrancy_guard/lib.rs @@ -1,3 +1,3 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] pub mod traits; diff --git a/examples/test_helpers/Cargo.toml b/examples/test_helpers/Cargo.toml index a274be885..4c9910266 100644 --- a/examples/test_helpers/Cargo.toml +++ b/examples/test_helpers/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "test_helpers" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" diff --git a/examples/test_helpers/lib.rs b/examples/test_helpers/lib.rs index ac86d0311..aec46cdf7 100644 --- a/examples/test_helpers/lib.rs +++ b/examples/test_helpers/lib.rs @@ -7,171 +7,188 @@ macro_rules! address_of { #[macro_export] macro_rules! balance_of { - ($client:ident, $address:ident, $account:ident) => { - { - let _msg = build_message::($address.clone()) - .call(|contract| contract.balance_of(address_of!($account))); - $client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await.return_value() - } - } + ($client:ident, $address:ident, $account:ident) => {{ + let _msg = + build_message::($address.clone()).call(|contract| contract.balance_of(address_of!($account))); + $client + .call_dry_run(&ink_e2e::alice(), &_msg, 0, None) + .await + .return_value() + }}; } #[macro_export] macro_rules! owner_of { - ($client:ident, $address:ident, $id:expr) => { - { - let _msg = build_message::($address.clone()) - .call(|contract| contract.owner_of($id)); - $client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await.return_value() - } - } + ($client:ident, $address:ident, $id:expr) => {{ + let _msg = build_message::($address.clone()).call(|contract| contract.owner_of($id)); + $client + .call_dry_run(&ink_e2e::alice(), &_msg, 0, None) + .await + .return_value() + }}; } #[macro_export] macro_rules! balance_of_37 { - ($client:ident, $address:ident, $account:ident, $token:expr) => { - { - let _msg = build_message::($address.clone()) - .call(|contract| contract.balance_of(address_of!($account), $token)); - $client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await.return_value() - } - } + ($client:ident, $address:ident, $account:ident, $token:expr) => {{ + let _msg = build_message::($address.clone()) + .call(|contract| contract.balance_of(address_of!($account), $token)); + $client + .call_dry_run(&ink_e2e::alice(), &_msg, 0, None) + .await + .return_value() + }}; } #[macro_export] macro_rules! has_role { - ($client:ident, $address:ident, $role:expr, $account:ident) => { - { - let _msg = build_message::($address.clone()) - .call(|contract| contract.has_role($role, address_of!($account))); - $client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await.return_value() - } - } + ($client:ident, $address:ident, $role:expr, $account:ident) => {{ + let _msg = build_message::($address.clone()) + .call(|contract| contract.has_role($role, address_of!($account))); + $client + .call_dry_run(&ink_e2e::alice(), &_msg, 0, None) + .await + .return_value() + }}; } #[macro_export] macro_rules! grant_role { - ($client:ident, $address:ident, $role:expr, $account:ident) => { - { - let _msg = build_message::($address.clone()) - .call(|contract| contract.grant_role($role, address_of!($account))); - $client.call(&ink_e2e::alice(), _msg, 0, None).await.expect("grant_role failed").return_value() - } - } + ($client:ident, $address:ident, $role:expr, $account:ident) => {{ + let _msg = build_message::($address.clone()) + .call(|contract| contract.grant_role($role, address_of!($account))); + $client + .call(&ink_e2e::alice(), _msg, 0, None) + .await + .expect("grant_role failed") + .return_value() + }}; } #[macro_export] macro_rules! revoke_role { - ($client:ident, $address:ident, $role:expr, $account:ident) => { - { - let _msg = build_message::($address.clone()) - .call(|contract| contract.revoke_role($role, address_of!($account))); - $client.call(&ink_e2e::alice(), _msg, 0, None).await.expect("revoke_role failed").return_value() - } - } + ($client:ident, $address:ident, $role:expr, $account:ident) => {{ + let _msg = build_message::($address.clone()) + .call(|contract| contract.revoke_role($role, address_of!($account))); + $client + .call(&ink_e2e::alice(), _msg, 0, None) + .await + .expect("revoke_role failed") + .return_value() + }}; } #[macro_export] macro_rules! mint_dry_run { - ($client:ident, $address:ident, $account:ident, $id:expr) => { - { - let _msg = build_message::($address.clone()) - .call(|contract| contract.mint(address_of!($account), $id)); - $client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await.return_value() - } - }; - ($client:ident, $address:ident, $signer:ident, $account:ident, $id:expr) => { - { - let _msg = build_message::($address.clone()) - .call(|contract| contract.mint(address_of!($account), $id)); - $client.call_dry_run(&ink_e2e::$signer(), &_msg, 0, None).await.return_value() - } - }; + ($client:ident, $address:ident, $account:ident, $id:expr) => {{ + let _msg = + build_message::($address.clone()).call(|contract| contract.mint(address_of!($account), $id)); + $client + .call_dry_run(&ink_e2e::alice(), &_msg, 0, None) + .await + .return_value() + }}; + ($client:ident, $address:ident, $signer:ident, $account:ident, $id:expr) => {{ + let _msg = + build_message::($address.clone()).call(|contract| contract.mint(address_of!($account), $id)); + $client + .call_dry_run(&ink_e2e::$signer(), &_msg, 0, None) + .await + .return_value() + }}; } #[macro_export] macro_rules! mint { - ($client:ident, $address:ident, $account:ident, $id:expr) => { - { - let _msg = build_message::($address.clone()) - .call(|contract| contract.mint(address_of!($account), $id)); - $client.call(&ink_e2e::alice(), _msg, 0, None).await.expect("mint failed").return_value() - } - }; - ($client:ident, $address:ident, $signer:ident, $account:ident, $id:expr) => { - { - let _msg = build_message::($address.clone()) - .call(|contract| contract.mint(address_of!($account), $id)); - $client.call(&ink_e2e::$signer(), _msg, 0, None).await.expect("mint failed").return_value() - } - }; + ($client:ident, $address:ident, $account:ident, $id:expr) => {{ + let _msg = + build_message::($address.clone()).call(|contract| contract.mint(address_of!($account), $id)); + $client + .call(&ink_e2e::alice(), _msg, 0, None) + .await + .expect("mint failed") + .return_value() + }}; + ($client:ident, $address:ident, $signer:ident, $account:ident, $id:expr) => {{ + let _msg = + build_message::($address.clone()).call(|contract| contract.mint(address_of!($account), $id)); + $client + .call(&ink_e2e::$signer(), _msg, 0, None) + .await + .expect("mint failed") + .return_value() + }}; } #[macro_export] macro_rules! get_role_member_count { - ($client:ident, $address:ident, $role:expr) => { - { - let _msg = build_message::($address.clone()) - .call(|contract| contract.get_role_member_count($role)); - $client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await.return_value() - } - } + ($client:ident, $address:ident, $role:expr) => {{ + let _msg = + build_message::($address.clone()).call(|contract| contract.get_role_member_count($role)); + $client + .call_dry_run(&ink_e2e::alice(), &_msg, 0, None) + .await + .return_value() + }}; } #[macro_export] macro_rules! get_role_member { - ($client:ident, $address:ident, $role:expr, $index:expr) => { - { - let _msg = build_message::($address.clone()) - .call(|contract| contract.get_role_member($role, $index)); - $client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await.return_value() - } - } + ($client:ident, $address:ident, $role:expr, $index:expr) => {{ + let _msg = + build_message::($address.clone()).call(|contract| contract.get_role_member($role, $index)); + $client + .call_dry_run(&ink_e2e::alice(), &_msg, 0, None) + .await + .return_value() + }}; } #[macro_export] macro_rules! get_shares { - ($client:ident, $address:ident, $user:ident) => { - { - let _msg = build_message::($address.clone()) - .call(|contract| contract.shares(address_of!($user))); - $client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await.return_value() - } - } + ($client:ident, $address:ident, $user:ident) => {{ + let _msg = build_message::($address.clone()).call(|contract| contract.shares(address_of!($user))); + $client + .call_dry_run(&ink_e2e::alice(), &_msg, 0, None) + .await + .return_value() + }}; } #[macro_export] macro_rules! method_call { - ($client:ident, $address:ident, $method:ident) => { - { - let _msg = build_message::($address.clone()) - .call(|contract| contract.$method()); - $client.call(&ink_e2e::alice(), _msg, 0, None).await.expect("method_call failed").return_value() - } - }; - ($client:ident, $address:ident, $signer:ident, $method:ident) => { - { - let _msg = build_message::($address.clone()) - .call(|contract| contract.$method()); - $client.call(&ink_e2e::$signer(), _msg, 0, None).await.expect("method_call failed").return_value() - } - }; + ($client:ident, $address:ident, $method:ident) => {{ + let _msg = build_message::($address.clone()).call(|contract| contract.$method()); + $client + .call(&ink_e2e::alice(), _msg, 0, None) + .await + .expect("method_call failed") + .return_value() + }}; + ($client:ident, $address:ident, $signer:ident, $method:ident) => {{ + let _msg = build_message::($address.clone()).call(|contract| contract.$method()); + $client + .call(&ink_e2e::$signer(), _msg, 0, None) + .await + .expect("method_call failed") + .return_value() + }}; } #[macro_export] macro_rules! method_call_dry_run { - ($client:ident, $address:ident, $method:ident) => { - { - let _msg = build_message::($address.clone()) - .call(|contract| contract.$method()); - $client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await.return_value() - } - }; - ($client:ident, $address:ident, $signer:ident, $method:ident) => { - { - let _msg = build_message::($address.clone()) - .call(|contract| contract.$method()); - $client.call_dry_run(&ink_e2e::$signer(), &_msg, 0, None).await.return_value() - } - }; -} \ No newline at end of file + ($client:ident, $address:ident, $method:ident) => {{ + let _msg = build_message::($address.clone()).call(|contract| contract.$method()); + $client + .call_dry_run(&ink_e2e::alice(), &_msg, 0, None) + .await + .return_value() + }}; + ($client:ident, $address:ident, $signer:ident, $method:ident) => {{ + let _msg = build_message::($address.clone()).call(|contract| contract.$method()); + $client + .call_dry_run(&ink_e2e::$signer(), &_msg, 0, None) + .await + .return_value() + }}; +} diff --git a/examples/timelock_controller/Cargo.toml b/examples/timelock_controller/Cargo.toml index 86167acee..674eedf29 100644 --- a/examples/timelock_controller/Cargo.toml +++ b/examples/timelock_controller/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "my_timelock_controller" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" [dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true } @@ -14,15 +14,12 @@ scale-info = { version = "2.3", default-features = false, features = ["derive"], openbrush = { path = "../..", default-features = false, features = ["timelock_controller"] } [dev-dependencies] -ink_e2e = "4.1.0" +ink_e2e = "4.2.1" test_helpers = { path = "../test_helpers", default-features = false } [lib] name = "my_timelock_controller" path = "lib.rs" -crate-type = [ - "cdylib", -] [features] default = ["std"] diff --git a/examples/timelock_controller/lib.rs b/examples/timelock_controller/lib.rs index ea819637e..f4fc545d8 100644 --- a/examples/timelock_controller/lib.rs +++ b/examples/timelock_controller/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] #![feature(min_specialization)] #![feature(default_alloc_error_handler)] @@ -48,16 +48,15 @@ pub mod my_timelock_controller { use ink_e2e::{build_message, PolkadotConfig}; use ink_e2e::Client; - use test_helpers::{ - address_of, - }; + use test_helpers::address_of; type E2EResult = Result>; #[ink_e2e::test] async fn can_schedule(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(0, vec![address_of!(bob)], vec![address_of!(bob)]); - let address = client.instantiate("my_timelock_controller", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_timelock_controller", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -75,53 +74,55 @@ pub mod my_timelock_controller { let id = { let _msg = build_message::(address.clone()) .call(|contract| contract.hash_operation(transaction.clone(), None, salt)); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); let is_operation_pending = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.is_operation_pending(id)); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + let _msg = + build_message::(address.clone()).call(|contract| contract.is_operation_pending(id)); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert_eq!(is_operation_pending, false); let schedule_tx = { let _msg = build_message::(address.clone()) .call(|contract| contract.schedule(transaction.clone(), None, salt, 0)); - client.call(&ink_e2e::bob(), _msg, 0, None) + client + .call(&ink_e2e::bob(), _msg, 0, None) .await .expect("schedule failed") - }.return_value(); + } + .return_value(); assert_eq!(schedule_tx, Ok(())); let is_operation_pending = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.is_operation_pending(id)); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + let _msg = + build_message::(address.clone()).call(|contract| contract.is_operation_pending(id)); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert_eq!(is_operation_pending, true); let is_operation_ready = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.is_operation_ready(id)); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + let _msg = + build_message::(address.clone()).call(|contract| contract.is_operation_ready(id)); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert_eq!(is_operation_ready, true); let is_operation_done = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.is_operation_done(id)); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + let _msg = + build_message::(address.clone()).call(|contract| contract.is_operation_done(id)); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert_eq!(is_operation_done, false); @@ -131,7 +132,8 @@ pub mod my_timelock_controller { #[ink_e2e::test] async fn schedule_and_execute_without_input_data(client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(0, vec![address_of!(bob)], vec![address_of!(bob)]); - let address = client.instantiate("my_timelock_controller", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_timelock_controller", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -149,45 +151,49 @@ pub mod my_timelock_controller { let id = { let _msg = build_message::(address.clone()) .call(|contract| contract.hash_operation(transaction.clone(), None, salt)); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); let schedule_tx = { let _msg = build_message::(address.clone()) .call(|contract| contract.schedule(transaction.clone(), None, salt, 0)); - client.call(&ink_e2e::bob(), _msg, 0, None) + client + .call(&ink_e2e::bob(), _msg, 0, None) .await .expect("schedule failed") - }.return_value(); + } + .return_value(); assert_eq!(schedule_tx, Ok(())); let is_operation_done = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.is_operation_done(id)); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + let _msg = + build_message::(address.clone()).call(|contract| contract.is_operation_done(id)); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert_eq!(is_operation_done, false); let execute_tx = { let _msg = build_message::(address.clone()) .call(|contract| contract.execute(transaction.clone(), None, salt)); - client.call(&ink_e2e::bob(), _msg, 0, None) + client + .call(&ink_e2e::bob(), _msg, 0, None) .await .expect("execute failed") - }.return_value(); + } + .return_value(); assert_eq!(execute_tx, Ok(())); let is_operation_done = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.is_operation_done(id)); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + let _msg = + build_message::(address.clone()).call(|contract| contract.is_operation_done(id)); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert_eq!(is_operation_done, true); @@ -195,9 +201,12 @@ pub mod my_timelock_controller { } #[ink_e2e::test] - async fn schedule_and_execute_by_passing_value_into_update_delay_and_update(client: ink_e2e::Client) -> E2EResult<()> { + async fn schedule_and_execute_by_passing_value_into_update_delay_and_update( + client: ink_e2e::Client, + ) -> E2EResult<()> { let constructor = ContractRef::new(0, vec![address_of!(bob)], vec![address_of!(bob)]); - let address = client.instantiate("my_timelock_controller", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_timelock_controller", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -217,38 +226,40 @@ pub mod my_timelock_controller { let schedule_tx = { let _msg = build_message::(address.clone()) .call(|contract| contract.schedule(transaction.clone(), None, salt, 0)); - client.call(&ink_e2e::bob(), _msg, 0, None) + client + .call(&ink_e2e::bob(), _msg, 0, None) .await .expect("schedule failed") - }.return_value(); + } + .return_value(); assert_eq!(schedule_tx, Ok(())); let get_min_delay = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.get_min_delay()); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + let _msg = build_message::(address.clone()).call(|contract| contract.get_min_delay()); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert_eq!(get_min_delay, 0); let execute_tx = { let _msg = build_message::(address.clone()) .call(|contract| contract.execute(transaction.clone(), None, salt)); - client.call(&ink_e2e::bob(), _msg, 0, None) + client + .call(&ink_e2e::bob(), _msg, 0, None) .await .expect("execute failed") - }.return_value(); + } + .return_value(); assert_eq!(execute_tx, Ok(())); let get_min_delay = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.get_min_delay()); - client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - }.return_value(); + let _msg = build_message::(address.clone()).call(|contract| contract.get_min_delay()); + client.call_dry_run(&ink_e2e::alice(), &_msg, 0, None).await + } + .return_value(); assert_eq!(get_min_delay, new_min_delay); @@ -258,7 +269,8 @@ pub mod my_timelock_controller { #[ink_e2e::test] async fn fails_schedule_because_signer_is_not_proposal(clientclient: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(0, vec![address_of!(bob)], vec![address_of!(bob)]); - let address = client.instantiate("my_timelock_controller", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_timelock_controller", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -276,9 +288,9 @@ pub mod my_timelock_controller { let schedule_tx = { let _msg = build_message::(address.clone()) .call(|contract| contract.schedule(transaction.clone(), None, salt, 0)); - client.call_dry_run(&ink_e2e::charlie(), &_msg, 0, None) - .await - }.return_value(); + client.call_dry_run(&ink_e2e::charlie(), &_msg, 0, None).await + } + .return_value(); assert!(matches!(schedule_tx, Err(_))); @@ -288,7 +300,8 @@ pub mod my_timelock_controller { #[ink_e2e::test] async fn fails_execute_because_signer_is_not_executor(client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(0, vec![address_of!(bob)], vec![address_of!(bob)]); - let address = client.instantiate("my_timelock_controller", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_timelock_controller", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; @@ -306,19 +319,21 @@ pub mod my_timelock_controller { let schedule_tx = { let _msg = build_message::(address.clone()) .call(|contract| contract.schedule(transaction.clone(), None, salt, 0)); - client.call(&ink_e2e::bob(), _msg, 0, None) + client + .call(&ink_e2e::bob(), _msg, 0, None) .await .expect("schedule failed") - }.return_value(); + } + .return_value(); assert_eq!(schedule_tx, Ok(())); let execute_tx = { let _msg = build_message::(address.clone()) .call(|contract| contract.execute(transaction.clone(), None, salt)); - client.call_dry_run(&ink_e2e::charlie(), &_msg, 0, None) - .await - }.return_value(); + client.call_dry_run(&ink_e2e::charlie(), &_msg, 0, None).await + } + .return_value(); assert!(matches!(execute_tx, Err(_))); @@ -328,17 +343,17 @@ pub mod my_timelock_controller { #[ink_e2e::test] async fn fails_update_delay(client: Client) -> E2EResult<()> { let constructor = ContractRef::new(0, vec![address_of!(bob)], vec![address_of!(bob)]); - let address = client.instantiate("my_timelock_controller", &ink_e2e::alice(), constructor, 0, None) + let address = client + .instantiate("my_timelock_controller", &ink_e2e::alice(), constructor, 0, None) .await .expect("instantiate failed") .account_id; let update_delay_tx = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.update_delay(15)); - client.call_dry_run(&ink_e2e::bob(), &_msg, 0, None) - .await - }.return_value(); + let _msg = build_message::(address.clone()).call(|contract| contract.update_delay(15)); + client.call_dry_run(&ink_e2e::bob(), &_msg, 0, None).await + } + .return_value(); assert!(matches!(update_delay_tx, Err(_))); diff --git a/lang/Cargo.toml b/lang/Cargo.toml index a3250c0ca..115ecff34 100644 --- a/lang/Cargo.toml +++ b/lang/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "openbrush_lang" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" @@ -14,9 +14,9 @@ categories = ["no-std", "embedded"] include = ["Cargo.toml", "src/**/*.rs"] [dependencies] -openbrush_lang_macro = { version = "~3.1.1", path = "macro", default-features = false } +openbrush_lang_macro = { version = "~3.2.0", path = "macro", default-features = false } -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"] } diff --git a/lang/codegen/Cargo.toml b/lang/codegen/Cargo.toml index f00a2848f..7b3663780 100644 --- a/lang/codegen/Cargo.toml +++ b/lang/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "openbrush_lang_codegen" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" @@ -24,8 +24,8 @@ cargo_metadata = "0.13.1" unwrap = "1.2.1" blake2 = "0.9" heck = "0.3.1" -ink_ir = { version = "4.1.0-beta", default-features = false } -ink_primitives = { version = "4.1.0-beta", default-features = false } +ink_ir = { version = "4.2.1", default-features = false } +ink_primitives = { version = "4.2.1", default-features = false } synstructure = "0.12" [lib] diff --git a/lang/macro/Cargo.toml b/lang/macro/Cargo.toml index 2532b5e25..ba1a83780 100644 --- a/lang/macro/Cargo.toml +++ b/lang/macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "openbrush_lang_macro" -version = "3.1.1" +version = "3.2.0" authors = ["Brushfam "] edition = "2021" @@ -14,13 +14,13 @@ categories = ["no-std", "embedded"] include = ["Cargo.toml", "src/**/*.rs"] [dependencies] -openbrush_lang_codegen = { version = "~3.1.1", path = "../codegen", default-features = false } +openbrush_lang_codegen = { version = "~3.2.0", path = "../codegen", default-features = false } syn = "1" proc-macro2 = "1" synstructure = "0.12" [dev-dependencies] -ink = { version = "4.1.0", default-features = false} +ink = { version = "4.2.1", default-features = false} scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"] } diff --git a/lang/macro/src/lib.rs b/lang/macro/src/lib.rs index 891a902c4..b94058d22 100644 --- a/lang/macro/src/lib.rs +++ b/lang/macro/src/lib.rs @@ -19,7 +19,7 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] use proc_macro::TokenStream; diff --git a/lang/src/lib.rs b/lang/src/lib.rs index 4e5745366..386fb7195 100644 --- a/lang/src/lib.rs +++ b/lang/src/lib.rs @@ -19,7 +19,7 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] mod macros; pub mod storage; diff --git a/src/lib.rs b/src/lib.rs index 463a7a6cf..14effb208 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,7 +19,7 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std, no_main)] pub use openbrush_contracts as contracts; pub use openbrush_lang::*;