├── .cargo └── config.toml ├── .config ├── cargo_spellcheck.dic ├── cargo_spellcheck.toml └── zepter.yaml ├── .editorconfig ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── config.yml ├── dependabot.yml ├── download-artifact │ └── action.yml ├── init │ └── action.yaml ├── pull_request_template.md ├── riscv64emac-unknown-none-polkavm.json ├── run-container-command │ └── action.yaml ├── rust-info │ └── action.yml ├── scripts │ ├── combine-pr.py │ └── contract_sizes_submit.sh └── workflows │ ├── ci.yml │ ├── dependabot-auto-merge.yml │ ├── issue-notifier.yml │ ├── measurements.yml │ ├── pr-notifier.yml │ ├── publish-docs.yml │ └── release-bot.yml ├── .gitignore ├── .images ├── badge.svg ├── badge_flat.svg ├── built-for-ink-flat.svg ├── built-for-ink.svg ├── ink-logo-glow.svg ├── ink-logo-white-bg.svg ├── ink-logo.svg ├── ink-squid.svg ├── inkternals.png ├── monthly-update │ └── athens-2022.jpg └── pallet-revive.png ├── .rustfmt.toml ├── ARCHITECTURE.md ├── CHANGELOG.md ├── CODEOWNERS ├── CODE_OF_CONDUCT.adoc ├── CONTRIBUTING.md ├── Cargo.lock ├── Cargo.toml ├── FILE_HEADER ├── LICENSE ├── MONTHLY_UPDATE.md ├── README.md ├── RELEASES_CHECKLIST.md ├── SECURITY.md ├── crates ├── allocator │ ├── Cargo.toml │ ├── LICENSE │ ├── README.md │ └── src │ │ ├── bump.rs │ │ └── lib.rs ├── e2e │ ├── Cargo.toml │ ├── LICENSE │ ├── README.md │ ├── macro │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── codegen.rs │ │ │ ├── config.rs │ │ │ ├── ir.rs │ │ │ └── lib.rs │ ├── sandbox │ │ ├── Cargo.toml │ │ ├── src │ │ │ ├── api.rs │ │ │ ├── api │ │ │ │ ├── balance_api.rs │ │ │ │ ├── revive_api.rs │ │ │ │ ├── system_api.rs │ │ │ │ └── timestamp_api.rs │ │ │ ├── lib.rs │ │ │ └── macros.rs │ │ └── test-resources │ │ │ └── dummy.polkavm │ └── src │ │ ├── backend.rs │ │ ├── backend_calls.rs │ │ ├── builders.rs │ │ ├── client_utils.rs │ │ ├── contract_build.rs │ │ ├── contract_results.rs │ │ ├── error.rs │ │ ├── events.rs │ │ ├── lib.rs │ │ ├── node_proc.rs │ │ ├── sandbox_client.rs │ │ ├── subxt_client.rs │ │ └── xts.rs ├── engine │ ├── Cargo.toml │ ├── LICENSE │ ├── README.md │ └── src │ │ ├── chain_extension.rs │ │ ├── database.rs │ │ ├── exec_context.rs │ │ ├── ext.rs │ │ ├── hashing.rs │ │ ├── lib.rs │ │ ├── test_api.rs │ │ ├── tests.rs │ │ └── types.rs ├── env │ ├── Cargo.toml │ ├── LICENSE │ ├── README.md │ └── src │ │ ├── api.rs │ │ ├── backend.rs │ │ ├── call │ │ ├── call_builder │ │ │ ├── call.rs │ │ │ ├── delegate.rs │ │ │ └── mod.rs │ │ ├── common.rs │ │ ├── create_builder.rs │ │ ├── execution.rs │ │ ├── mod.rs │ │ └── selector.rs │ │ ├── chain_extension.rs │ │ ├── engine │ │ ├── mod.rs │ │ ├── off_chain │ │ │ ├── call_data.rs │ │ │ ├── impls.rs │ │ │ ├── mod.rs │ │ │ ├── test_api.rs │ │ │ ├── tests.rs │ │ │ └── types.rs │ │ └── on_chain │ │ │ ├── buffer.rs │ │ │ ├── mod.rs │ │ │ └── pallet_revive.rs │ │ ├── error.rs │ │ ├── event.rs │ │ ├── hash.rs │ │ ├── lib.rs │ │ ├── tests.rs │ │ └── types.rs ├── ink │ ├── Cargo.toml │ ├── LICENSE │ ├── README.md │ ├── codegen │ │ ├── Cargo.toml │ │ ├── LICENSE │ │ ├── README.md │ │ └── src │ │ │ ├── enforced_error.rs │ │ │ ├── generator │ │ │ ├── arg_list.rs │ │ │ ├── as_dependency │ │ │ │ ├── call_builder.rs │ │ │ │ ├── contract_ref.rs │ │ │ │ └── mod.rs │ │ │ ├── blake2b.rs │ │ │ ├── chain_extension.rs │ │ │ ├── contract.rs │ │ │ ├── dispatch.rs │ │ │ ├── env.rs │ │ │ ├── event.rs │ │ │ ├── ink_test.rs │ │ │ ├── item_impls.rs │ │ │ ├── metadata.rs │ │ │ ├── mod.rs │ │ │ ├── selector.rs │ │ │ ├── sol.rs │ │ │ ├── sol │ │ │ │ ├── metadata.rs │ │ │ │ └── utils.rs │ │ │ ├── storage.rs │ │ │ ├── storage_item.rs │ │ │ └── trait_def │ │ │ │ ├── call_builder.rs │ │ │ │ ├── call_forwarder.rs │ │ │ │ ├── definition.rs │ │ │ │ ├── message_builder.rs │ │ │ │ ├── mod.rs │ │ │ │ └── trait_registry.rs │ │ │ ├── lib.rs │ │ │ └── traits.rs │ ├── ir │ │ ├── Cargo.toml │ │ ├── LICENSE │ │ ├── README.md │ │ └── src │ │ │ ├── ast │ │ │ ├── attr_args.rs │ │ │ ├── meta.rs │ │ │ └── mod.rs │ │ │ ├── error.rs │ │ │ ├── ir │ │ │ ├── attrs.rs │ │ │ ├── blake2.rs │ │ │ ├── chain_extension.rs │ │ │ ├── config.rs │ │ │ ├── contract.rs │ │ │ ├── event │ │ │ │ ├── config.rs │ │ │ │ ├── mod.rs │ │ │ │ └── signature_topic.rs │ │ │ ├── idents_lint.rs │ │ │ ├── ink_test.rs │ │ │ ├── item │ │ │ │ ├── mod.rs │ │ │ │ ├── storage.rs │ │ │ │ └── tests.rs │ │ │ ├── item_impl │ │ │ │ ├── callable.rs │ │ │ │ ├── constructor.rs │ │ │ │ ├── impl_item.rs │ │ │ │ ├── iter.rs │ │ │ │ ├── message.rs │ │ │ │ ├── mod.rs │ │ │ │ └── tests.rs │ │ │ ├── item_mod.rs │ │ │ ├── mod.rs │ │ │ ├── selector.rs │ │ │ ├── sha3.rs │ │ │ ├── storage_item │ │ │ │ ├── config.rs │ │ │ │ └── mod.rs │ │ │ ├── trait_def │ │ │ │ ├── config.rs │ │ │ │ ├── item │ │ │ │ │ ├── iter.rs │ │ │ │ │ ├── mod.rs │ │ │ │ │ └── trait_item.rs │ │ │ │ ├── mod.rs │ │ │ │ └── tests.rs │ │ │ └── utils.rs │ │ │ ├── lib.rs │ │ │ └── literal.rs │ ├── macro │ │ ├── Cargo.toml │ │ ├── LICENSE │ │ ├── README.md │ │ └── src │ │ │ ├── blake2b.rs │ │ │ ├── chain_extension.rs │ │ │ ├── contract.rs │ │ │ ├── event │ │ │ ├── metadata.rs │ │ │ └── mod.rs │ │ │ ├── ink_test.rs │ │ │ ├── lib.rs │ │ │ ├── scale.rs │ │ │ ├── selector.rs │ │ │ ├── storage │ │ │ ├── mod.rs │ │ │ ├── storable.rs │ │ │ ├── storable_hint.rs │ │ │ ├── storage_key.rs │ │ │ └── storage_layout.rs │ │ │ ├── storage_item.rs │ │ │ ├── tests │ │ │ ├── event.rs │ │ │ ├── event_metadata.rs │ │ │ ├── mod.rs │ │ │ ├── storable.rs │ │ │ ├── storable_hint.rs │ │ │ ├── storage_key.rs │ │ │ └── storage_layout.rs │ │ │ └── trait_def.rs │ ├── src │ │ ├── chain_extension.rs │ │ ├── codegen │ │ │ ├── dispatch │ │ │ │ ├── execution.rs │ │ │ │ ├── info.rs │ │ │ │ ├── mod.rs │ │ │ │ └── type_check.rs │ │ │ ├── env.rs │ │ │ ├── implies_return.rs │ │ │ ├── is_same_type.rs │ │ │ ├── mod.rs │ │ │ ├── solidity_compat.rs │ │ │ ├── trait_def │ │ │ │ ├── call_builder.rs │ │ │ │ ├── mod.rs │ │ │ │ └── trait_message.rs │ │ │ └── utils │ │ │ │ ├── identity_type.rs │ │ │ │ ├── mod.rs │ │ │ │ └── same_type.rs │ │ ├── contract_ref.rs │ │ ├── env_access.rs │ │ ├── lib.rs │ │ ├── message_builder.rs │ │ ├── option_info.rs │ │ └── result_info.rs │ └── tests │ │ ├── compile_tests.rs │ │ ├── events_metadata.rs │ │ ├── return_type_metadata.rs │ │ ├── trybuild_wrapper │ │ ├── .cargo │ │ │ └── config.toml │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ │ └── ui │ │ ├── abi │ │ ├── all │ │ │ ├── fail │ │ │ │ ├── message-selector-overlap.rs │ │ │ │ └── message-selector-overlap.stderr │ │ │ └── pass │ │ │ │ └── message-selector-encoding.rs │ │ └── sol │ │ │ ├── fail │ │ │ ├── trait-message-selector-overlap.rs │ │ │ └── trait-message-selector-overlap.stderr │ │ │ └── pass │ │ │ ├── message-encoding-inputs.rs │ │ │ ├── message-selector-encoding-args.rs │ │ │ └── message-selector-encoding.rs │ │ ├── blake2b │ │ ├── fail │ │ │ ├── invalid_parameter_type_01.rs │ │ │ ├── invalid_parameter_type_01.stderr │ │ │ ├── invalid_parameter_type_02.rs │ │ │ ├── invalid_parameter_type_02.stderr │ │ │ ├── missing_parameter.rs │ │ │ ├── missing_parameter.stderr │ │ │ ├── non_literal_parameter.rs │ │ │ └── non_literal_parameter.stderr │ │ └── pass │ │ │ ├── bytestring_input.rs │ │ │ ├── no_implicit_prelude.rs │ │ │ └── string_input.rs │ │ ├── chain_extension │ │ └── E-01-simple.rs │ │ ├── contract │ │ ├── fail │ │ │ ├── cfg │ │ │ │ ├── cfg-forbidden-usage-01.rs │ │ │ │ ├── cfg-forbidden-usage-01.stderr │ │ │ │ ├── cfg-forbidden-usage-02.rs │ │ │ │ ├── cfg-forbidden-usage-02.stderr │ │ │ │ ├── cfg-forbidden-usage-03.rs │ │ │ │ ├── cfg-forbidden-usage-03.stderr │ │ │ │ ├── cfg-forbidden-usage-04.rs │ │ │ │ ├── cfg-forbidden-usage-04.stderr │ │ │ │ ├── cfg-forbidden-usage-05.rs │ │ │ │ ├── cfg-forbidden-usage-05.stderr │ │ │ │ ├── cfg-forbidden-usage-06.rs │ │ │ │ ├── cfg-forbidden-usage-06.stderr │ │ │ │ ├── config-keep-attr-invalid-type.rs │ │ │ │ ├── config-keep-attr-invalid-type.stderr │ │ │ │ ├── config-keep-attr-missing-arg.rs │ │ │ │ └── config-keep-attr-missing-arg.stderr │ │ │ ├── constructor │ │ │ ├── event-conflicting-storage.rs │ │ │ ├── event-conflicting-storage.stderr │ │ │ ├── impl │ │ │ │ ├── impl-block-for-non-storage-01.rs │ │ │ │ ├── impl-block-for-non-storage-01.stderr │ │ │ │ ├── impl-block-for-non-storage-02.rs │ │ │ │ ├── impl-block-for-non-storage-02.stderr │ │ │ │ ├── impl-block-namespace-invalid-identifier.rs │ │ │ │ ├── impl-block-namespace-invalid-identifier.stderr │ │ │ │ ├── impl-block-namespace-invalid-type.rs │ │ │ │ ├── impl-block-namespace-invalid-type.stderr │ │ │ │ ├── impl-block-namespace-missing-argument.rs │ │ │ │ ├── impl-block-namespace-missing-argument.stderr │ │ │ │ ├── impl-block-using-env-no-marker.rs │ │ │ │ ├── impl-block-using-env-no-marker.stderr │ │ │ │ ├── impl-block-using-static-env-no-marker.rs │ │ │ │ └── impl-block-using-static-env-no-marker.stderr │ │ │ ├── message │ │ │ │ ├── message-hygiene-try.rs │ │ │ │ ├── message-hygiene-try.stderr │ │ │ │ ├── message-input-non-codec.rs │ │ │ │ ├── message-input-non-codec.stderr │ │ │ │ ├── message-input-pattern.rs │ │ │ │ ├── message-input-pattern.stderr │ │ │ │ ├── message-multiple-wildcard-selectors.rs │ │ │ │ ├── message-multiple-wildcard-selectors.stderr │ │ │ │ ├── message-returns-non-codec.rs │ │ │ │ ├── message-returns-non-codec.stderr │ │ │ │ ├── message-returns-self.rs │ │ │ │ ├── message-returns-self.stderr │ │ │ │ ├── message-selector-and-wildcard-selector.rs │ │ │ │ ├── message-selector-and-wildcard-selector.stderr │ │ │ │ ├── message-selector-invalid-type-01.rs │ │ │ │ ├── message-selector-invalid-type-01.stderr │ │ │ │ ├── message-selector-invalid-type-02.rs │ │ │ │ ├── message-selector-invalid-type-02.stderr │ │ │ │ ├── message-selector-missing-arg.rs │ │ │ │ ├── message-selector-missing-arg.stderr │ │ │ │ ├── message-self-receiver-invalid-01.rs │ │ │ │ ├── message-self-receiver-invalid-01.stderr │ │ │ │ ├── message-self-receiver-invalid-02.rs │ │ │ │ ├── message-self-receiver-invalid-02.stderr │ │ │ │ ├── message-self-receiver-invalid-03.rs │ │ │ │ ├── message-self-receiver-invalid-03.stderr │ │ │ │ ├── message-self-receiver-missing.rs │ │ │ │ ├── message-self-receiver-missing.stderr │ │ │ │ ├── message-unknown-property.rs │ │ │ │ └── message-unknown-property.stderr │ │ │ ├── module-missing-constructor.rs │ │ │ ├── module-missing-constructor.stderr │ │ │ ├── module-missing-message.rs │ │ │ ├── module-missing-message.stderr │ │ │ ├── module-missing-storage.rs │ │ │ ├── module-missing-storage.stderr │ │ │ ├── module-multiple-storages.rs │ │ │ ├── module-multiple-storages.stderr │ │ │ ├── module-use-forbidden-idents.rs │ │ │ ├── module-use-forbidden-idents.stderr │ │ │ ├── storage-conflicting-event.rs │ │ │ ├── storage-conflicting-event.stderr │ │ │ ├── storage-unknown-marker.rs │ │ │ ├── storage-unknown-marker.stderr │ │ │ └── trait │ │ │ │ ├── trait-impl-namespace-invalid.rs │ │ │ │ ├── trait-impl-namespace-invalid.stderr │ │ │ │ ├── trait-message-payable-mismatch.rs │ │ │ │ ├── trait-message-payable-mismatch.stderr │ │ │ │ ├── trait-message-selector-mismatch.rs │ │ │ │ ├── trait-message-selector-mismatch.stderr │ │ │ │ ├── trait-message-selector-overlap-1.rs │ │ │ │ ├── trait-message-selector-overlap-1.stderr │ │ │ │ ├── trait-message-selector-overlap-2.rs │ │ │ │ ├── trait-message-selector-overlap-2.stderr │ │ │ │ ├── trait-message-selector-overlap-3.rs │ │ │ │ ├── trait-message-selector-overlap-3.stderr │ │ │ │ ├── trait-message-wildcard-selector.rs │ │ │ │ └── trait-message-wildcard-selector.stderr │ │ └── pass │ │ │ ├── cfg-allowed-usage-01.rs │ │ │ ├── cfg-allowed-usage-02.rs │ │ │ ├── config-custom-env.rs │ │ │ ├── config-keep-attr.rs │ │ │ ├── constructor │ │ │ ├── dispatch-decoder-works.rs │ │ │ ├── env-access.rs │ │ │ ├── event │ │ │ ├── event-anonymous.rs │ │ │ ├── event-config-more-topics.rs │ │ │ ├── event-many-definitions.rs │ │ │ ├── event-single-definition.rs │ │ │ └── event-topics.rs │ │ │ ├── example │ │ │ ├── example-erc20-works.rs │ │ │ ├── example-erc721-works.rs │ │ │ ├── example-flipper-works.rs │ │ │ ├── example-incrementer-works.rs │ │ │ ├── example-return-err-works.rs │ │ │ ├── example-trait-flipper-works.rs │ │ │ └── example-trait-incrementer-works.rs │ │ │ ├── impl-alias-storage.rs │ │ │ ├── impl-block-namespace.rs │ │ │ ├── impl-block-using-env.rs │ │ │ ├── impl-with-property.rs │ │ │ ├── message │ │ │ ├── message-checked-variant.rs │ │ │ ├── message-many-inputs.rs │ │ │ ├── message-many-outputs.rs │ │ │ ├── message-payable.rs │ │ │ ├── message-selector.rs │ │ │ └── message-wildcard-selector.rs │ │ │ ├── minimal-contract.rs │ │ │ ├── module-env-types.rs │ │ │ ├── module-non-ink-items.rs │ │ │ ├── storage-many-fields.rs │ │ │ ├── storage-packed-fields.rs │ │ │ ├── storage-single-field.rs │ │ │ ├── storage-with-derives.rs │ │ │ ├── trait-message-payable-guard.rs │ │ │ ├── trait-message-selector-guard.rs │ │ │ └── traits-messages-same-name.rs │ │ ├── event │ │ ├── fail │ │ │ ├── anonymous_invalid_value.rs │ │ │ ├── anonymous_invalid_value.stderr │ │ │ ├── cfg_attr_on_field.rs │ │ │ ├── cfg_attr_on_field.stderr │ │ │ ├── cfg_attr_on_topic.rs │ │ │ ├── cfg_attr_on_topic.stderr │ │ │ ├── conficting_attributes.rs │ │ │ ├── conficting_attributes.stderr │ │ │ ├── conficting_attributes_inline.rs │ │ │ ├── conficting_attributes_inline.stderr │ │ │ ├── event_enum.rs │ │ │ ├── event_enum.stderr │ │ │ ├── generics.rs │ │ │ ├── generics.stderr │ │ │ ├── multiple_topic_args.rs │ │ │ ├── multiple_topic_args.stderr │ │ │ ├── multiple_topic_args_inline.rs │ │ │ ├── multiple_topic_args_inline.stderr │ │ │ ├── signature_hex_short.rs │ │ │ ├── signature_hex_short.stderr │ │ │ ├── signature_missing_value.rs │ │ │ ├── signature_missing_value.stderr │ │ │ ├── unknown_attribute.rs │ │ │ └── unknown_attribute.stderr │ │ └── pass │ │ │ ├── anonymous_flag_works.rs │ │ │ ├── custom_signature_works.rs │ │ │ ├── event_attribute_works.rs │ │ │ └── inline_custom_signature_works.rs │ │ ├── pay_with_call │ │ └── pass │ │ │ └── multiple_args.rs │ │ ├── scale_derive │ │ ├── fail │ │ │ ├── invalid_derive.rs │ │ │ └── invalid_derive.stderr │ │ └── pass │ │ │ ├── decode.rs │ │ │ ├── encode.rs │ │ │ ├── multiple.rs │ │ │ └── type_info.rs │ │ ├── selector_bytes │ │ ├── fail │ │ │ ├── invalid_parameter_type_01.rs │ │ │ ├── invalid_parameter_type_01.stderr │ │ │ ├── invalid_parameter_type_02.rs │ │ │ ├── invalid_parameter_type_02.stderr │ │ │ ├── missing_parameter.rs │ │ │ ├── missing_parameter.stderr │ │ │ ├── non_literal_parameter.rs │ │ │ └── non_literal_parameter.stderr │ │ └── pass │ │ │ ├── bytestring_input.rs │ │ │ ├── no_implicit_prelude.rs │ │ │ └── string_input.rs │ │ ├── selector_id │ │ ├── fail │ │ │ ├── invalid_parameter_type_01.rs │ │ │ ├── invalid_parameter_type_01.stderr │ │ │ ├── invalid_parameter_type_02.rs │ │ │ ├── invalid_parameter_type_02.stderr │ │ │ ├── missing_parameter.rs │ │ │ ├── missing_parameter.stderr │ │ │ ├── non_literal_parameter.rs │ │ │ └── non_literal_parameter.stderr │ │ └── pass │ │ │ ├── bytestring_input.rs │ │ │ ├── no_implicit_prelude.rs │ │ │ └── string_input.rs │ │ ├── storage_item │ │ ├── fail │ │ │ ├── argument_derive_invalid_type.rs │ │ │ ├── argument_derive_invalid_type.stderr │ │ │ ├── argument_derive_missing_arg.rs │ │ │ ├── argument_derive_missing_arg.stderr │ │ │ ├── collections_only_packed_1.rs │ │ │ ├── collections_only_packed_1.stderr │ │ │ ├── collections_only_packed_2.rs │ │ │ ├── collections_only_packed_2.stderr │ │ │ ├── double_storage_item.rs │ │ │ ├── double_storage_item.stderr │ │ │ ├── packed_is_not_derived_automatically.rs │ │ │ └── packed_is_not_derived_automatically.stderr │ │ └── pass │ │ │ ├── argument_derive_false.rs │ │ │ ├── complex_non_packed_enum.rs │ │ │ ├── complex_non_packed_struct.rs │ │ │ ├── complex_packed_enum.rs │ │ │ ├── complex_packed_struct.rs │ │ │ ├── default_storage_key_1.rs │ │ │ ├── default_storage_key_2.rs │ │ │ ├── default_storage_key_3.rs │ │ │ ├── default_storage_key_4.rs │ │ │ ├── non_packed_tuple_struct.rs │ │ │ └── packed_tuple_struct.rs │ │ └── trait_def │ │ ├── fail │ │ ├── config_keep_attr_invalid_type.rs │ │ ├── config_keep_attr_invalid_type.stderr │ │ ├── config_keep_attr_missing_arg.rs │ │ ├── config_keep_attr_missing_arg.stderr │ │ ├── config_namespace_invalid_1.rs │ │ ├── config_namespace_invalid_1.stderr │ │ ├── config_namespace_invalid_2.rs │ │ ├── config_namespace_invalid_2.stderr │ │ ├── config_namespace_invalid_3.rs │ │ ├── config_namespace_invalid_3.stderr │ │ ├── config_namespace_invalid_4.rs │ │ ├── config_namespace_invalid_4.stderr │ │ ├── definition_assoc_const.rs │ │ ├── definition_assoc_const.stderr │ │ ├── definition_assoc_type.rs │ │ ├── definition_assoc_type.stderr │ │ ├── definition_constructor.rs │ │ ├── definition_constructor.stderr │ │ ├── definition_empty.rs │ │ ├── definition_empty.stderr │ │ ├── definition_generic.rs │ │ ├── definition_generic.stderr │ │ ├── definition_non_pub.rs │ │ ├── definition_non_pub.stderr │ │ ├── definition_rust_method.rs │ │ ├── definition_rust_method.stderr │ │ ├── definition_super_trait_invalid_1.rs │ │ ├── definition_super_trait_invalid_1.stderr │ │ ├── definition_super_trait_invalid_2.rs │ │ ├── definition_super_trait_invalid_2.stderr │ │ ├── definition_unsafe.rs │ │ ├── definition_unsafe.stderr │ │ ├── message_abi_invalid.rs │ │ ├── message_abi_invalid.stderr │ │ ├── message_async_invalid.rs │ │ ├── message_async_invalid.stderr │ │ ├── message_const_invalid.rs │ │ ├── message_const_invalid.stderr │ │ ├── message_constructor_conflict.rs │ │ ├── message_constructor_conflict.stderr │ │ ├── message_default_impl.rs │ │ ├── message_default_impl.stderr │ │ ├── message_generic_invalid.rs │ │ ├── message_generic_invalid.stderr │ │ ├── message_input_non_codec.rs │ │ ├── message_input_non_codec.stderr │ │ ├── message_input_pattern_invalid.rs │ │ ├── message_input_pattern_invalid.stderr │ │ ├── message_output_non_codec.rs │ │ ├── message_output_non_codec.stderr │ │ ├── message_payable_invalid_1.rs │ │ ├── message_payable_invalid_1.stderr │ │ ├── message_payable_invalid_2.rs │ │ ├── message_payable_invalid_2.stderr │ │ ├── message_receiver_invalid_1.rs │ │ ├── message_receiver_invalid_1.stderr │ │ ├── message_receiver_invalid_2.rs │ │ ├── message_receiver_invalid_2.stderr │ │ ├── message_receiver_invalid_3.rs │ │ ├── message_receiver_invalid_3.stderr │ │ ├── message_receiver_missing.rs │ │ ├── message_receiver_missing.stderr │ │ ├── message_selector_invalid_1.rs │ │ ├── message_selector_invalid_1.stderr │ │ ├── message_selector_invalid_2.rs │ │ ├── message_selector_invalid_2.stderr │ │ ├── message_selector_overlap.rs │ │ ├── message_selector_overlap.stderr │ │ ├── message_unsafe_invalid.rs │ │ └── message_unsafe_invalid.stderr │ │ └── pass │ │ ├── avoid_overlap_with_namespace.rs │ │ ├── many_inputs.rs │ │ ├── many_outputs.rs │ │ ├── payable_message.rs │ │ ├── simple_definition.rs │ │ ├── using-env-types.rs │ │ ├── valid_selectors.rs │ │ ├── valid_selectors_namespace.rs │ │ ├── with_keep_attr.rs │ │ └── with_namespace.rs ├── metadata │ ├── Cargo.toml │ ├── LICENSE │ ├── README.md │ ├── contract_schema.json │ ├── outer_schema.json │ └── src │ │ ├── layout │ │ ├── mod.rs │ │ ├── tests.rs │ │ └── validate.rs │ │ ├── lib.rs │ │ ├── sol.rs │ │ ├── specs.rs │ │ ├── tests.rs │ │ └── utils.rs ├── prelude │ ├── Cargo.toml │ ├── LICENSE │ ├── README.md │ └── src │ │ └── lib.rs ├── primitives │ ├── Cargo.toml │ ├── LICENSE │ ├── README.md │ └── src │ │ ├── arithmetic.rs │ │ ├── contract.rs │ │ ├── key.rs │ │ ├── lib.rs │ │ ├── reflect │ │ ├── contract.rs │ │ ├── dispatch.rs │ │ ├── mod.rs │ │ └── trait_def │ │ │ ├── info.rs │ │ │ ├── mod.rs │ │ │ └── registry.rs │ │ ├── sol.rs │ │ ├── sol │ │ ├── bytes.rs │ │ ├── tests.rs │ │ └── types.rs │ │ └── types.rs └── storage │ ├── Cargo.toml │ ├── LICENSE │ ├── README.md │ ├── src │ ├── lazy │ │ ├── mapping.rs │ │ ├── mod.rs │ │ └── vec.rs │ └── lib.rs │ └── traits │ ├── Cargo.toml │ ├── LICENSE │ ├── README.md │ └── src │ ├── impls │ └── mod.rs │ ├── layout │ ├── impls.rs │ └── mod.rs │ ├── lib.rs │ └── storage.rs ├── integration-tests ├── .gitignore ├── LICENSE ├── README.md ├── internal │ ├── call-builder-return-value │ │ ├── Cargo.toml │ │ └── lib.rs │ ├── e2e-runtime-only-backend │ │ ├── Cargo.toml │ │ └── lib.rs │ ├── lang-err │ │ ├── call-builder-delegate │ │ │ ├── Cargo.toml │ │ │ └── lib.rs │ │ ├── call-builder │ │ │ ├── Cargo.toml │ │ │ └── lib.rs │ │ ├── constructors-return-value │ │ │ ├── Cargo.toml │ │ │ └── lib.rs │ │ ├── contract-ref │ │ │ ├── Cargo.toml │ │ │ └── lib.rs │ │ └── integration-flipper │ │ │ ├── Cargo.toml │ │ │ └── lib.rs │ ├── mapping │ │ ├── Cargo.toml │ │ └── lib.rs │ ├── mother │ │ ├── Cargo.toml │ │ └── lib.rs │ ├── sr25519-verification │ │ ├── Cargo.toml │ │ └── lib.rs │ ├── static-buffer │ │ ├── Cargo.toml │ │ ├── README.md │ │ └── lib.rs │ └── storage-types │ │ ├── Cargo.toml │ │ └── lib.rs ├── public │ ├── call-runtime │ │ ├── Cargo.toml │ │ ├── README.md │ │ └── lib.rs │ ├── combined-extension │ │ ├── Cargo.toml │ │ ├── README.md │ │ └── lib.rs │ ├── complex-storage-structures │ │ ├── Cargo.toml │ │ ├── README.md │ │ └── lib.rs │ ├── conditional-compilation │ │ ├── Cargo.toml │ │ └── lib.rs │ ├── contract-invocation │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── contract1 │ │ │ ├── Cargo.toml │ │ │ └── lib.rs │ │ ├── contract2 │ │ │ ├── Cargo.toml │ │ │ └── lib.rs │ │ ├── lib.rs │ │ ├── virtual_contract │ │ │ ├── Cargo.toml │ │ │ └── lib.rs │ │ ├── virtual_contract_ver1 │ │ │ ├── Cargo.toml │ │ │ └── lib.rs │ │ └── virtual_contract_ver2 │ │ │ ├── Cargo.toml │ │ │ └── lib.rs │ ├── contract-storage │ │ ├── Cargo.toml │ │ ├── e2e_tests.rs │ │ └── lib.rs │ ├── contract-terminate │ │ ├── Cargo.toml │ │ └── lib.rs │ ├── contract-transfer │ │ ├── Cargo.toml │ │ └── lib.rs │ ├── contract-xcm │ │ ├── Cargo.toml │ │ └── lib.rs │ ├── cross-contract-calls │ │ ├── Cargo.toml │ │ ├── e2e_tests.rs │ │ ├── lib.rs │ │ └── other-contract │ │ │ ├── Cargo.toml │ │ │ └── lib.rs │ ├── custom-allocator │ │ ├── Cargo.toml │ │ └── lib.rs │ ├── custom-environment │ │ ├── Cargo.toml │ │ ├── README.md │ │ └── lib.rs │ ├── debugging-strategies │ │ ├── Cargo.toml │ │ └── lib.rs │ ├── dns │ │ ├── Cargo.toml │ │ └── lib.rs │ ├── e2e-call-runtime │ │ ├── Cargo.toml │ │ └── lib.rs │ ├── erc1155 │ │ ├── Cargo.toml │ │ └── lib.rs │ ├── erc20 │ │ ├── Cargo.toml │ │ └── lib.rs │ ├── erc721 │ │ ├── Cargo.toml │ │ └── lib.rs │ ├── events │ │ ├── Cargo.toml │ │ ├── event-def-unused │ │ │ ├── Cargo.toml │ │ │ └── src │ │ │ │ └── lib.rs │ │ ├── event-def │ │ │ ├── Cargo.toml │ │ │ └── src │ │ │ │ └── lib.rs │ │ ├── event-def2 │ │ │ ├── Cargo.toml │ │ │ └── src │ │ │ │ └── lib.rs │ │ └── lib.rs │ ├── flipper │ │ ├── Cargo.toml │ │ └── lib.rs │ ├── incrementer │ │ ├── Cargo.toml │ │ └── lib.rs │ ├── lazyvec │ │ ├── Cargo.toml │ │ └── lib.rs │ ├── multi-contract-caller │ │ ├── .images │ │ │ └── code-hashes.png │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── accumulator │ │ │ ├── Cargo.toml │ │ │ └── lib.rs │ │ ├── adder │ │ │ ├── Cargo.toml │ │ │ └── lib.rs │ │ ├── build-all.sh │ │ ├── lib.rs │ │ └── subber │ │ │ ├── Cargo.toml │ │ │ └── lib.rs │ ├── multisig │ │ ├── Cargo.toml │ │ └── lib.rs │ ├── own-code-hash │ │ ├── .gitignore │ │ ├── Cargo.toml │ │ └── lib.rs │ ├── payment-channel │ │ ├── Cargo.toml │ │ └── lib.rs │ ├── psp22-extension │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── lib.rs │ │ └── runtime │ │ │ └── psp22-extension-example.rs │ ├── rand-extension │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── lib.rs │ │ └── runtime │ │ │ └── chain-extension-example.rs │ ├── runtime-call-contract │ │ ├── Cargo.toml │ │ ├── e2e_tests.rs │ │ ├── lib.rs │ │ ├── sandbox-runtime │ │ │ ├── Cargo.toml │ │ │ ├── pallet-revive-caller │ │ │ │ ├── Cargo.toml │ │ │ │ └── src │ │ │ │ │ ├── executor.rs │ │ │ │ │ └── lib.rs │ │ │ └── src │ │ │ │ └── lib.rs │ │ └── traits │ │ │ ├── Cargo.toml │ │ │ └── lib.rs │ ├── trait-dyn-cross-contract-calls │ │ ├── Cargo.toml │ │ ├── contracts │ │ │ └── incrementer │ │ │ │ ├── Cargo.toml │ │ │ │ └── lib.rs │ │ ├── lib.rs │ │ └── traits │ │ │ ├── Cargo.toml │ │ │ └── lib.rs │ ├── trait-erc20 │ │ ├── Cargo.toml │ │ └── lib.rs │ ├── trait-flipper │ │ ├── Cargo.toml │ │ └── lib.rs │ ├── trait-incrementer │ │ ├── Cargo.toml │ │ ├── lib.rs │ │ └── traits │ │ │ ├── Cargo.toml │ │ │ └── lib.rs │ ├── upgradeable-contracts │ │ ├── README.md │ │ ├── delegator │ │ │ ├── Cargo.toml │ │ │ ├── delegatee │ │ │ │ ├── Cargo.toml │ │ │ │ └── lib.rs │ │ │ ├── delegatee2 │ │ │ │ ├── Cargo.toml │ │ │ │ └── lib.rs │ │ │ └── lib.rs │ │ ├── set-code-hash-migration │ │ │ ├── Cargo.toml │ │ │ ├── e2e_tests.rs │ │ │ ├── lib.rs │ │ │ ├── migration │ │ │ │ ├── Cargo.toml │ │ │ │ └── lib.rs │ │ │ └── updated-incrementer │ │ │ │ ├── Cargo.toml │ │ │ │ └── lib.rs │ │ └── set-code-hash │ │ │ ├── Cargo.toml │ │ │ ├── lib.rs │ │ │ └── updated-incrementer │ │ │ ├── Cargo.toml │ │ │ └── lib.rs │ └── wildcard-selector │ │ ├── Cargo.toml │ │ └── lib.rs └── solidity-abi │ ├── events │ ├── Cargo.toml │ ├── event-def-unused │ │ ├── Cargo.toml │ │ └── src │ │ │ └── lib.rs │ ├── event-def │ │ ├── Cargo.toml │ │ └── src │ │ │ └── lib.rs │ ├── event-def2 │ │ ├── Cargo.toml │ │ └── src │ │ │ └── lib.rs │ └── lib.rs │ ├── sol-cross-contract │ ├── Cargo.toml │ ├── e2e_tests.rs │ ├── lib.rs │ └── other-contract-sol │ │ ├── Cargo.toml │ │ └── lib.rs │ ├── sol-encoding │ ├── Cargo.toml │ ├── e2e_tests.rs │ └── lib.rs │ └── solidity-calls-flipper │ ├── Cargo.toml │ ├── e2e_tests.rs │ ├── lib.rs │ └── sol │ ├── .gitignore │ ├── 01-deploy.js │ ├── 02-call-flip.js │ ├── contracts │ └── FlipperCaller.sol │ ├── hardhat.config.js │ ├── package-lock.json │ └── package.json ├── linting ├── .cargo │ └── config.toml ├── .gitignore ├── Cargo.toml ├── LICENSE ├── README.md ├── extra │ ├── Cargo.toml │ ├── LICENSE │ ├── README.md │ ├── src │ │ ├── lib.rs │ │ ├── non_fallible_api.rs │ │ ├── primitive_topic.rs │ │ ├── storage_never_freed.rs │ │ └── strict_balance_equality.rs │ └── ui │ │ ├── fail │ │ ├── non_fallible_api.rs │ │ ├── non_fallible_api.stderr │ │ ├── primitive_topic.rs │ │ ├── primitive_topic.stderr │ │ ├── storage_never_freed.rs │ │ ├── storage_never_freed.stderr │ │ ├── strict_balance_equality.rs │ │ └── strict_balance_equality.stderr │ │ └── pass │ │ ├── non_fallible_api.rs │ │ ├── primitive_topic.rs │ │ ├── storage_never_freed.rs │ │ └── strict_balance_equality.rs ├── mandatory │ ├── Cargo.toml │ ├── LICENSE │ ├── README.md │ ├── src │ │ ├── lib.rs │ │ └── no_main.rs │ └── ui │ │ └── pass │ │ └── no_main.rs ├── rust-toolchain.toml └── utils │ ├── Cargo.toml │ ├── LICENSE │ ├── README.md │ └── src │ └── lib.rs └── scripts ├── build_and_determine_contract_size.sh ├── contract_size.sh ├── contract_sizes_diff.sh ├── for_all_contracts_exec.sh ├── for_all_contracts_exec2.sh ├── generate_linter_docs.sh ├── is_contract.sh └── markdown-table.sh /.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [env] 2 | # We need to enable `RUSTC_BOOTSTRAP` so that the nightly ink! 3 | # features still work on stable. 4 | RUSTC_BOOTSTRAP = "1" 5 | 6 | [build] 7 | rustflags = ["--cfg", "substrate_runtime"] 8 | 9 | [registry] 10 | protocol = "sparse" 11 | -------------------------------------------------------------------------------- /.config/cargo_spellcheck.toml: -------------------------------------------------------------------------------- 1 | [Hunspell] 2 | lang = "en_US" 3 | search_dirs = ["."] 4 | extra_dictionaries = ["cargo_spellcheck.dic"] 5 | 6 | # If set to `true`, the OS specific default search paths are skipped and only explicitly 7 | # specified ones are used. 8 | skip_os_lookups = true 9 | 10 | # Use the builtin dictionaries if none were found in the configured lookup paths. 11 | # Usually combined with `skip_os_lookups=true` to enforce the `builtin` usage for 12 | # consistent results across distributions and CI runs. Setting this will still use the 13 | # dictionaries specified in `extra_dictionaries = [..]` for topic specific lingo. 14 | use_builtin = true 15 | 16 | [Hunspell.quirks] 17 | allow_concatenation = true 18 | allow_dashes = true 19 | transform_regex = ["^[0-9a-fA-F]{5,}$"] 20 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | [*] 8 | end_of_line = lf 9 | charset = utf-8 10 | trim_trailing_whitespace = true 11 | insert_final_newline = true 12 | indent_style = space 13 | indent_size = 4 14 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: true 2 | contact_links: 3 | - name: Ask questions and find answers using our dedicated StackExchange site 4 | url: https://substrate.stackexchange.com/questions/tagged/ink/ 5 | about: | 6 | For general questions you might already find an answer in our community. 7 | We encourage everyone to also share their understanding by answering questions for others too. 8 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "cargo" 4 | directory: "/" 5 | schedule: 6 | interval: "monthly" 7 | # ignore Substrate pallets major updates. 8 | # automated Substrate releases cause dependabot PR spam, so these must be updated manually when required. 9 | ignore: 10 | - dependency-name: "sp-*" 11 | update-types: [ "version-update:semver-major" ] 12 | - dependency-name: "pallet-*" 13 | update-types: [ "version-update:semver-major" ] 14 | - package-ecosystem: github-actions 15 | directory: '/' 16 | schedule: 17 | interval: monthly 18 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## Summary 2 | Closes #_ 3 | - [ ] y/n | Does it introduce breaking changes? 4 | - [ ] y/n | Is it dependent on a specific version of `cargo-contract` or `pallet-revive`? 5 | 6 | 7 | ## Description 8 | 9 | 10 | ## Checklist before requesting a review 11 | - [ ] I have added an entry to `CHANGELOG.md` 12 | - [ ] I have commented on my code, particularly in hard-to-understand areas 13 | - [ ] I have added tests that prove my fix is effective or that my feature works 14 | - [ ] Any dependent changes have been merged and published in downstream modules 15 | -------------------------------------------------------------------------------- /.github/riscv64emac-unknown-none-polkavm.json: -------------------------------------------------------------------------------- 1 | { 2 | "arch": "riscv64", 3 | "cpu": "generic-rv64", 4 | "crt-objects-fallback": "false", 5 | "data-layout": "e-m:e-p:64:64-i64:64-i128:128-n32:64-S64", 6 | "eh-frame-header": false, 7 | "emit-debug-gdb-scripts": false, 8 | "features": "+e,+m,+a,+c,+auipc-addi-fusion,+ld-add-fusion,+lui-addi-fusion,+xtheadcondmov", 9 | "linker": "rust-lld", 10 | "linker-flavor": "ld.lld", 11 | "llvm-abiname": "lp64e", 12 | "llvm-target": "riscv64", 13 | "max-atomic-width": 64, 14 | "panic-strategy": "abort", 15 | "relocation-model": "pie", 16 | "target-pointer-width": "64", 17 | "singlethread": true, 18 | "pre-link-args": { 19 | "ld": [ 20 | "--emit-relocs", 21 | "--unique", 22 | "--relocatable" 23 | ] 24 | }, 25 | "env": "polkavm" 26 | } 27 | -------------------------------------------------------------------------------- /.github/rust-info/action.yml: -------------------------------------------------------------------------------- 1 | name: Rust Info 2 | description: Rust and Bash details 3 | runs: 4 | using: composite 5 | steps: 6 | - run: | 7 | rustup show 8 | cargo --version 9 | rustup +nightly show 10 | cargo +nightly --version 11 | bash --version 12 | ink-node --version 13 | cargo contract --version 14 | git --version 15 | echo -e '[registry]\nprotocol = "sparse"' > /usr/local/cargo/config.toml 16 | shell: bash 17 | -------------------------------------------------------------------------------- /.github/workflows/release-bot.yml: -------------------------------------------------------------------------------- 1 | name: Pushes release updates to a pre-defined Matrix room 2 | on: 3 | release: 4 | types: 5 | - edited 6 | - prereleased 7 | - published 8 | jobs: 9 | ping_matrix: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: send message 13 | uses: s3krit/matrix-message-action@v0.0.3 14 | with: 15 | room_id: ${{ secrets.MATRIX_ROOM_ID }} 16 | access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }} 17 | message: "**${{github.event.repository.full_name}}:** A release has been ${{github.event.action}}
Release version [${{github.event.release.tag_name}}](${{github.event.release.html_url}})

***Description:***
${{github.event.release.body}}
" 18 | server: "matrix.parity.io" 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | **/target/ 2 | /design/ 3 | 4 | # Ignore history files. 5 | **/.history/** 6 | 7 | **/.DS_Store 8 | **/.idea/ 9 | -------------------------------------------------------------------------------- /.images/inkternals.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/use-ink/ink/641f05706e4f7ff1fb7c60e261ed0f4bc833f2f0/.images/inkternals.png -------------------------------------------------------------------------------- /.images/monthly-update/athens-2022.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/use-ink/ink/641f05706e4f7ff1fb7c60e261ed0f4bc833f2f0/.images/monthly-update/athens-2022.jpg -------------------------------------------------------------------------------- /.images/pallet-revive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/use-ink/ink/641f05706e4f7ff1fb7c60e261ed0f4bc833f2f0/.images/pallet-revive.png -------------------------------------------------------------------------------- /FILE_HEADER: -------------------------------------------------------------------------------- 1 | // Copyright (C) Use Ink (UK) Ltd. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /MONTHLY_UPDATE.md: -------------------------------------------------------------------------------- 1 | # Monthly Update: Parity Smart Contracts 2 | 3 | The monthly update has been moved to [https://use.ink/monthly-update](https://use.ink/monthly-update)! 4 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Reporting a vulnerability 2 | 3 | If you find something that can be treated as a security vulnerability, please do not use the issue tracker or discuss it in the public forum/channels, as it can cause more damage rather than give real help to the ecosystem. 4 | 5 | Security vulnerabilities should be reported using [this contact form](https://blocksurvey.io/ink-security-vulnerability-reporting-QCfzqPF8QMqIrJUEll7yPA?v=o). 6 | -------------------------------------------------------------------------------- /crates/allocator/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ink_allocator" 3 | version.workspace = true 4 | authors = ["Use Ink "] 5 | edition.workspace = true 6 | 7 | license.workspace = true 8 | readme = "README.md" 9 | repository.workspace = true 10 | documentation = "https://docs.rs/ink_allocator/" 11 | homepage.workspace = true 12 | description = "[ink!] Bindings to the Wasm heap memory allocator." 13 | keywords.workspace = true 14 | categories.workspace = true 15 | include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"] 16 | 17 | [dependencies] 18 | cfg-if = { workspace = true } 19 | 20 | [dev-dependencies] 21 | quickcheck = { workspace = true } 22 | quickcheck_macros = { workspace = true } 23 | 24 | [features] 25 | default = [ "std" ] 26 | std = [] 27 | ink-fuzz-tests = [ "std" ] 28 | no-allocator = [] 29 | -------------------------------------------------------------------------------- /crates/allocator/LICENSE: -------------------------------------------------------------------------------- 1 | ../../LICENSE -------------------------------------------------------------------------------- /crates/allocator/README.md: -------------------------------------------------------------------------------- 1 | ../../README.md -------------------------------------------------------------------------------- /crates/e2e/LICENSE: -------------------------------------------------------------------------------- 1 | ../../LICENSE -------------------------------------------------------------------------------- /crates/e2e/README.md: -------------------------------------------------------------------------------- 1 | ../../README.md -------------------------------------------------------------------------------- /crates/e2e/sandbox/src/api.rs: -------------------------------------------------------------------------------- 1 | pub mod balance_api; 2 | pub mod revive_api; 3 | pub mod system_api; 4 | pub mod timestamp_api; 5 | 6 | pub mod prelude { 7 | pub use super::{ 8 | balance_api::BalanceAPI, 9 | revive_api::ContractAPI, 10 | system_api::SystemAPI, 11 | timestamp_api::TimestampAPI, 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /crates/e2e/sandbox/test-resources/dummy.polkavm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/use-ink/ink/641f05706e4f7ff1fb7c60e261ed0f4bc833f2f0/crates/e2e/sandbox/test-resources/dummy.polkavm -------------------------------------------------------------------------------- /crates/engine/LICENSE: -------------------------------------------------------------------------------- 1 | ../../LICENSE -------------------------------------------------------------------------------- /crates/engine/README.md: -------------------------------------------------------------------------------- 1 | ../../README.md -------------------------------------------------------------------------------- /crates/env/LICENSE: -------------------------------------------------------------------------------- 1 | ../../LICENSE -------------------------------------------------------------------------------- /crates/env/README.md: -------------------------------------------------------------------------------- 1 | ../../README.md -------------------------------------------------------------------------------- /crates/ink/LICENSE: -------------------------------------------------------------------------------- 1 | ../../LICENSE -------------------------------------------------------------------------------- /crates/ink/README.md: -------------------------------------------------------------------------------- 1 | ../../README.md -------------------------------------------------------------------------------- /crates/ink/codegen/LICENSE: -------------------------------------------------------------------------------- 1 | ../../../LICENSE -------------------------------------------------------------------------------- /crates/ink/codegen/README.md: -------------------------------------------------------------------------------- 1 | ../../../README.md -------------------------------------------------------------------------------- /crates/ink/codegen/src/generator/sol.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) ink! contributors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Abstractions and utilities for Solidity ABI compatible codegen. 16 | 17 | pub mod metadata; 18 | pub mod utils; 19 | -------------------------------------------------------------------------------- /crates/ink/ir/LICENSE: -------------------------------------------------------------------------------- 1 | ../../../LICENSE -------------------------------------------------------------------------------- /crates/ink/ir/README.md: -------------------------------------------------------------------------------- 1 | ../../../README.md -------------------------------------------------------------------------------- /crates/ink/macro/LICENSE: -------------------------------------------------------------------------------- 1 | ../../../LICENSE -------------------------------------------------------------------------------- /crates/ink/macro/README.md: -------------------------------------------------------------------------------- 1 | ../../../README.md -------------------------------------------------------------------------------- /crates/ink/tests/trybuild_wrapper/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | # Tells `trybuild` not to pass a `--target` arg. 3 | # Ref: https://github.com/dtolnay/trybuild/blob/a2eb852409a69841ccca1acbf61813e8e8abb792/src/cargo.rs#L191-L204 4 | rustflags = ["--cfg", "trybuild_no_target"] 5 | -------------------------------------------------------------------------------- /crates/ink/tests/trybuild_wrapper/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "trybuild_wrapper" 3 | version = "0.1.0" 4 | authors = ["David Semakula ", "Use Ink "] 5 | edition = "2021" 6 | 7 | [dependencies] 8 | trybuild = { version = "1.0.102", features = ["diff"] } 9 | clap = {version = "4.5.32", features = ["derive"]} 10 | toml = "0.8.20" 11 | 12 | [workspace] 13 | # Tells cargo that this crate is not part of the workspace. -------------------------------------------------------------------------------- /crates/ink/tests/ui/abi/all/fail/message-selector-overlap.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | pub mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message, selector = 0xe21f37ce)] 15 | // Solidity selector is `keccak256("message()")` == `0xe21f37ce` == `3793696718` 16 | pub fn message(&self) {} 17 | } 18 | } 19 | 20 | fn main() {} 21 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/abi/all/fail/message-selector-overlap.stderr: -------------------------------------------------------------------------------- 1 | error[E0119]: conflicting implementations of trait `DispatchableMessageInfo<3793696718>` for type `Contract` 2 | --> tests/ui/abi/all/fail/message-selector-overlap.rs:16:9 3 | | 4 | 16 | pub fn message(&self) {} 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^ 6 | | | 7 | | first implementation here 8 | | conflicting implementation for `Contract` 9 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/abi/sol/fail/trait-message-selector-overlap.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::trait_definition] 4 | pub trait TraitDefinition { 5 | #[ink(message)] 6 | fn message(&self); 7 | } 8 | 9 | #[ink::contract] 10 | pub mod contract { 11 | use super::TraitDefinition; 12 | 13 | #[ink(storage)] 14 | pub struct Contract {} 15 | 16 | impl Contract { 17 | #[ink(constructor)] 18 | pub fn constructor() -> Self { 19 | Self {} 20 | } 21 | 22 | #[ink(message)] 23 | pub fn message(&self) {} 24 | } 25 | 26 | impl TraitDefinition for Contract { 27 | #[ink(message)] 28 | fn message(&self) {} 29 | } 30 | } 31 | 32 | fn main() {} 33 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/abi/sol/fail/trait-message-selector-overlap.stderr: -------------------------------------------------------------------------------- 1 | error[E0119]: conflicting implementations of trait `DispatchableMessageInfo<3793696718>` for type `Contract` 2 | --> tests/ui/abi/sol/fail/trait-message-selector-overlap.rs:28:9 3 | | 4 | 23 | pub fn message(&self) {} 5 | | ------------------------ first implementation here 6 | ... 7 | 28 | fn message(&self) {} 8 | | ^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Contract` 9 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/blake2b/fail/invalid_parameter_type_01.rs: -------------------------------------------------------------------------------- 1 | const _: [u8; 32] = ink::blake2x256!(true); 2 | 3 | fn main() {} 4 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/blake2b/fail/invalid_parameter_type_01.stderr: -------------------------------------------------------------------------------- 1 | error: expected string or byte string literal as input. found Lit::Bool { value: true } 2 | --> tests/ui/blake2b/fail/invalid_parameter_type_01.rs:1:38 3 | | 4 | 1 | const _: [u8; 32] = ink::blake2x256!(true); 5 | | ^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/blake2b/fail/invalid_parameter_type_02.rs: -------------------------------------------------------------------------------- 1 | const _: [u8; 32] = ink::blake2x256!(42); 2 | 3 | fn main() {} 4 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/blake2b/fail/invalid_parameter_type_02.stderr: -------------------------------------------------------------------------------- 1 | error: expected string or byte string literal as input. found Lit::Int { token: 42 } 2 | --> tests/ui/blake2b/fail/invalid_parameter_type_02.rs:1:38 3 | | 4 | 1 | const _: [u8; 32] = ink::blake2x256!(42); 5 | | ^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/blake2b/fail/missing_parameter.rs: -------------------------------------------------------------------------------- 1 | const _: [u8; 32] = ink::blake2x256!(); 2 | 3 | fn main() {} 4 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/blake2b/fail/missing_parameter.stderr: -------------------------------------------------------------------------------- 1 | error: expected string or byte string literal as input: unexpected end of input, expected literal 2 | --> tests/ui/blake2b/fail/missing_parameter.rs:1:21 3 | | 4 | 1 | const _: [u8; 32] = ink::blake2x256!(); 5 | | ^^^^^^^^^^^^^^^^^^ 6 | | 7 | = note: this error originates in the macro `ink::blake2x256` (in Nightly builds, run with -Z macro-backtrace for more info) 8 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/blake2b/fail/non_literal_parameter.rs: -------------------------------------------------------------------------------- 1 | const INPUT: &str = "test"; 2 | const _: [u8; 32] = ink::blake2x256!(INPUT); 3 | 4 | fn main() {} 5 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/blake2b/fail/non_literal_parameter.stderr: -------------------------------------------------------------------------------- 1 | error: expected string or byte string literal as input: expected literal 2 | --> tests/ui/blake2b/fail/non_literal_parameter.rs:2:38 3 | | 4 | 2 | const _: [u8; 32] = ink::blake2x256!(INPUT); 5 | | ^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/blake2b/pass/bytestring_input.rs: -------------------------------------------------------------------------------- 1 | use ink_ir as ir; 2 | 3 | macro_rules! assert_macro_eq { 4 | ( $input:literal ) => {{ 5 | // We put it into a constant to verify that the computation is constant. 6 | const HASH: [u8; 32] = ink::blake2x256!($input); 7 | assert_eq!( 8 | HASH, 9 | { 10 | let mut output = [0u8; 32]; 11 | ir::blake2b_256($input, &mut output); 12 | output 13 | } 14 | ); 15 | }}; 16 | } 17 | 18 | fn main() { 19 | assert_macro_eq!(b""); 20 | assert_macro_eq!(b"Hello, World!"); 21 | assert_macro_eq!(b"message"); 22 | assert_macro_eq!(b"constructor"); 23 | } 24 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/blake2b/pass/no_implicit_prelude.rs: -------------------------------------------------------------------------------- 1 | #![no_implicit_prelude] 2 | 3 | const _: [::core::primitive::u8; 32] = ::ink::blake2x256!("test"); 4 | 5 | fn main() {} 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/blake2b/pass/string_input.rs: -------------------------------------------------------------------------------- 1 | use ink_ir as ir; 2 | 3 | macro_rules! assert_macro_eq { 4 | ( $input:literal ) => {{ 5 | // We put it into a constant to verify that the computation is constant. 6 | const HASH: [u8; 32] = ink::blake2x256!($input); 7 | assert_eq!( 8 | HASH, 9 | { 10 | let mut output = [0u8; 32]; 11 | ir::blake2b_256($input.as_bytes(), &mut output); 12 | output 13 | } 14 | ); 15 | }}; 16 | } 17 | 18 | fn main() { 19 | assert_macro_eq!(""); 20 | assert_macro_eq!("Hello, World!"); 21 | assert_macro_eq!("message"); 22 | assert_macro_eq!("constructor"); 23 | } 24 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/cfg/cfg-forbidden-usage-01.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message1(&self) {} 16 | 17 | #[ink(message)] 18 | #[cfg(any(test, target_family = "wasm"))] 19 | pub fn message2(&self) {} 20 | } 21 | } 22 | 23 | fn main() {} 24 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/cfg/cfg-forbidden-usage-01.stderr: -------------------------------------------------------------------------------- 1 | error: This `cfg` attribute is not allowed. 2 | 3 | Allowed in `#[cfg(…)]`: 4 | - `test` 5 | - `feature` (without `std`) 6 | - `any` 7 | - `not` 8 | - `all` 9 | --> tests/ui/contract/fail/cfg/cfg-forbidden-usage-01.rs:18:25 10 | | 11 | 18 | #[cfg(any(test, target_family = "wasm"))] 12 | | ^^^^^^^^^^^^^ 13 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/cfg/cfg-forbidden-usage-02.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message1(&self) {} 16 | 17 | #[ink(message)] 18 | #[cfg(not(feature = "std"))] 19 | pub fn message2(&self) {} 20 | } 21 | } 22 | 23 | fn main() {} 24 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/cfg/cfg-forbidden-usage-02.stderr: -------------------------------------------------------------------------------- 1 | error: The feature `std` is not allowed in `cfg`. 2 | 3 | Allowed in `#[cfg(…)]`: 4 | - `test` 5 | - `feature` (without `std`) 6 | - `any` 7 | - `not` 8 | - `all` 9 | --> tests/ui/contract/fail/cfg/cfg-forbidden-usage-02.rs:18:19 10 | | 11 | 18 | #[cfg(not(feature = "std"))] 12 | | ^^^^^^^ 13 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/cfg/cfg-forbidden-usage-03.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message1(&self) {} 16 | 17 | #[ink(message)] 18 | #[cfg(any(not(feature = "std")))] 19 | pub fn message2(&self) {} 20 | } 21 | } 22 | 23 | fn main() {} 24 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/cfg/cfg-forbidden-usage-03.stderr: -------------------------------------------------------------------------------- 1 | error: The feature `std` is not allowed in `cfg`. 2 | 3 | Allowed in `#[cfg(…)]`: 4 | - `test` 5 | - `feature` (without `std`) 6 | - `any` 7 | - `not` 8 | - `all` 9 | --> tests/ui/contract/fail/cfg/cfg-forbidden-usage-03.rs:18:23 10 | | 11 | 18 | #[cfg(any(not(feature = "std")))] 12 | | ^^^^^^^ 13 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/cfg/cfg-forbidden-usage-04.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[cfg(any(test, target_family = "wasm", feature = "std"))] 10 | #[ink(constructor)] 11 | pub fn constructor() -> Self { 12 | Self {} 13 | } 14 | 15 | #[ink(message)] 16 | pub fn message1(&self) {} 17 | 18 | #[ink(message)] 19 | pub fn message2(&self) {} 20 | } 21 | } 22 | 23 | fn main() {} 24 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/cfg/cfg-forbidden-usage-04.stderr: -------------------------------------------------------------------------------- 1 | error: This `cfg` attribute is not allowed. 2 | 3 | Allowed in `#[cfg(…)]`: 4 | - `test` 5 | - `feature` (without `std`) 6 | - `any` 7 | - `not` 8 | - `all` 9 | --> tests/ui/contract/fail/cfg/cfg-forbidden-usage-04.rs:9:25 10 | | 11 | 9 | #[cfg(any(test, target_family = "wasm", feature = "std"))] 12 | | ^^^^^^^^^^^^^ 13 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/cfg/cfg-forbidden-usage-05.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message1(&self) {} 16 | 17 | #[ink(message)] 18 | #[cfg(target_pointer_width = "32")] 19 | pub fn message2(&self) {} 20 | } 21 | } 22 | 23 | fn main() {} 24 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/cfg/cfg-forbidden-usage-05.stderr: -------------------------------------------------------------------------------- 1 | error: This `cfg` attribute is not allowed. 2 | 3 | Allowed in `#[cfg(…)]`: 4 | - `test` 5 | - `feature` (without `std`) 6 | - `any` 7 | - `not` 8 | - `all` 9 | --> tests/ui/contract/fail/cfg/cfg-forbidden-usage-05.rs:18:15 10 | | 11 | 18 | #[cfg(target_pointer_width = "32")] 12 | | ^^^^^^^^^^^^^^^^^^^^ 13 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/cfg/cfg-forbidden-usage-06.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract(keep_attr = "cfg")] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message1(&self) {} 16 | 17 | #[ink(message)] 18 | #[cfg(target_os = "wasm")] 19 | pub fn message2(&self) {} 20 | } 21 | } 22 | 23 | fn main() {} 24 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/cfg/cfg-forbidden-usage-06.stderr: -------------------------------------------------------------------------------- 1 | error: This `cfg` attribute is not allowed. 2 | 3 | Allowed in `#[cfg(…)]`: 4 | - `test` 5 | - `feature` (without `std`) 6 | - `any` 7 | - `not` 8 | - `all` 9 | --> tests/ui/contract/fail/cfg/cfg-forbidden-usage-06.rs:18:15 10 | | 11 | 18 | #[cfg(target_os = "wasm")] 12 | | ^^^^^^^^^ 13 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/cfg/config-keep-attr-invalid-type.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract(keep_attr = true)] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message(&self) {} 16 | } 17 | } 18 | 19 | fn main() {} 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/cfg/config-keep-attr-invalid-type.stderr: -------------------------------------------------------------------------------- 1 | error: expected a string with attributes separated by `,` 2 | --> tests/ui/contract/fail/cfg/config-keep-attr-invalid-type.rs:3:17 3 | | 4 | 3 | #[ink::contract(keep_attr = true)] 5 | | ^^^^^^^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/cfg/config-keep-attr-missing-arg.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract(keep_attr)] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message(&self) {} 16 | } 17 | } 18 | 19 | fn main() {} 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/cfg/config-keep-attr-missing-arg.stderr: -------------------------------------------------------------------------------- 1 | error: expected a string literal value for `keep_attr` ink! configuration argument 2 | --> tests/ui/contract/fail/cfg/config-keep-attr-missing-arg.rs:3:17 3 | | 4 | 3 | #[ink::contract(keep_attr)] 5 | | ^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-abi.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub extern "C" fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message(&self) {} 16 | } 17 | } 18 | 19 | fn main() {} 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-abi.stderr: -------------------------------------------------------------------------------- 1 | error: ink! constructors must not have explicit ABI 2 | --> tests/ui/contract/fail/constructor/constructor-abi.rs:10:13 3 | | 4 | 10 | pub extern "C" fn constructor() -> Self { 5 | | ^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-async.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub async fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message(&self) {} 16 | } 17 | } 18 | 19 | fn main() {} 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-async.stderr: -------------------------------------------------------------------------------- 1 | error: ink! constructors must not be async 2 | --> tests/ui/contract/fail/constructor/constructor-async.rs:10:13 3 | | 4 | 10 | pub async fn constructor() -> Self { 5 | | ^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-const.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub const fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message(&self) {} 16 | } 17 | } 18 | 19 | fn main() {} 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-const.stderr: -------------------------------------------------------------------------------- 1 | error: ink! constructors must not be const 2 | --> tests/ui/contract/fail/constructor/constructor-const.rs:10:13 3 | | 4 | 10 | pub const fn constructor() -> Self { 5 | | ^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-input-non-codec.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[::ink::scale_derive(TypeInfo)] 6 | pub struct NonCodecType; 7 | 8 | #[ink(storage)] 9 | pub struct Contract {} 10 | 11 | impl Contract { 12 | #[ink(constructor)] 13 | pub fn constructor(_input: NonCodecType) -> Self { 14 | Self {} 15 | } 16 | 17 | #[ink(message)] 18 | pub fn message(&self) {} 19 | } 20 | } 21 | 22 | fn main() {} 23 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-input-pattern.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor((_a, _b): (i32, i32)) -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message(&self) {} 16 | } 17 | } 18 | 19 | fn main() {} 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-input-pattern.stderr: -------------------------------------------------------------------------------- 1 | error: ink! constructor arguments must have an identifier 2 | --> tests/ui/contract/fail/constructor/constructor-input-pattern.rs:10:28 3 | | 4 | 10 | pub fn constructor((_a, _b): (i32, i32)) -> Self { 5 | | ^^^^^^^^^^^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-missing-return.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() {} 11 | 12 | #[ink(message)] 13 | pub fn message(&self) {} 14 | } 15 | } 16 | 17 | fn main() {} 18 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-missing-return.stderr: -------------------------------------------------------------------------------- 1 | error: missing return for ink! constructor 2 | --> tests/ui/contract/fail/constructor/constructor-missing-return.rs:10:13 3 | | 4 | 10 | pub fn constructor() {} 5 | | ^^^^^^^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-multiple-wildcard-selectors.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor, selector = _)] 10 | pub fn constructor1() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(constructor, selector = _)] 15 | pub fn constructor2() -> Self { 16 | Self {} 17 | } 18 | 19 | #[ink(message)] 20 | pub fn message(&self) {} 21 | } 22 | } 23 | 24 | fn main() {} 25 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-multiple-wildcard-selectors.stderr: -------------------------------------------------------------------------------- 1 | error: encountered ink! constructor with overlapping wildcard selectors 2 | --> tests/ui/contract/fail/constructor/constructor-multiple-wildcard-selectors.rs:15:9 3 | | 4 | 15 | / pub fn constructor2() -> Self { 5 | 16 | | Self {} 6 | 17 | | } 7 | | |_________^ 8 | 9 | error: first ink! constructor with overlapping wildcard selector here 10 | --> tests/ui/contract/fail/constructor/constructor-multiple-wildcard-selectors.rs:10:9 11 | | 12 | 10 | / pub fn constructor1() -> Self { 13 | 11 | | Self {} 14 | 12 | | } 15 | | |_________^ 16 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-payable-invalid-1.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor, payable = true)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message(&self) {} 16 | } 17 | } 18 | 19 | fn main() {} 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-payable-invalid-1.stderr: -------------------------------------------------------------------------------- 1 | error: encountered unknown ink! attribute argument: payable 2 | --> tests/ui/contract/fail/constructor/constructor-payable-invalid-1.rs:9:28 3 | | 4 | 9 | #[ink(constructor, payable = true)] 5 | | ^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-payable-invalid-2.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor, payable = false)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message(&self) {} 16 | } 17 | } 18 | 19 | fn main() {} 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-payable-invalid-2.stderr: -------------------------------------------------------------------------------- 1 | error: encountered unknown ink! attribute argument: payable 2 | --> tests/ui/contract/fail/constructor/constructor-payable-invalid-2.rs:9:28 3 | | 4 | 9 | #[ink(constructor, payable = false)] 5 | | ^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-return-result-invalid.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | #[derive(Debug, PartialEq, Eq)] 9 | #[ink::scale_derive(Encode, Decode, TypeInfo)] 10 | pub enum Error { 11 | Foo, 12 | } 13 | 14 | impl Contract { 15 | #[ink(constructor)] 16 | pub fn constructor() -> Result { 17 | Ok(5_u8) 18 | } 19 | 20 | #[ink(message)] 21 | pub fn message(&self) {} 22 | } 23 | } 24 | 25 | fn main() {} 26 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-return-result-non-codec-error.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | #[derive(Debug, PartialEq, Eq)] 9 | pub enum Error { 10 | Foo, 11 | } 12 | 13 | impl Contract { 14 | #[ink(constructor)] 15 | pub fn constructor() -> Result { 16 | Ok(Self {}) 17 | } 18 | 19 | #[ink(message)] 20 | pub fn message(&self) {} 21 | } 22 | } 23 | 24 | fn main() {} 25 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-selector-and-wildcard-selector.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor, selector = 0xCAFEBABA, selector = _)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message(&self) {} 16 | } 17 | } 18 | 19 | fn main() {} 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-selector-and-wildcard-selector.stderr: -------------------------------------------------------------------------------- 1 | error: encountered ink! attribute arguments with equal kinds 2 | --> tests/ui/contract/fail/constructor/constructor-selector-and-wildcard-selector.rs:9:51 3 | | 4 | 9 | #[ink(constructor, selector = 0xCAFEBABA, selector = _)] 5 | | ^^^^^^^^^^^^ 6 | 7 | error: first equal ink! attribute argument with equal kind here 8 | --> tests/ui/contract/fail/constructor/constructor-selector-and-wildcard-selector.rs:9:28 9 | | 10 | 9 | #[ink(constructor, selector = 0xCAFEBABA, selector = _)] 11 | | ^^^^^^^^^^^^^^^^^^^^^ 12 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-self-receiver-01.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor(&self) -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message(&self) {} 16 | } 17 | } 18 | 19 | fn main() {} 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-self-receiver-01.stderr: -------------------------------------------------------------------------------- 1 | error: ink! constructors must have no `self` receiver 2 | --> tests/ui/contract/fail/constructor/constructor-self-receiver-01.rs:10:28 3 | | 4 | 10 | pub fn constructor(&self) -> Self { 5 | | ^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-self-receiver-02.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor(&mut self) -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message(&self) {} 16 | } 17 | } 18 | 19 | fn main() {} 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-self-receiver-02.stderr: -------------------------------------------------------------------------------- 1 | error: ink! constructors must have no `self` receiver 2 | --> tests/ui/contract/fail/constructor/constructor-self-receiver-02.rs:10:28 3 | | 4 | 10 | pub fn constructor(&mut self) -> Self { 5 | | ^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-self-receiver-03.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor(this: &Self) -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message(&self) {} 16 | } 17 | } 18 | 19 | fn main() {} 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-self-receiver-04.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor(self) -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message(&self) {} 16 | } 17 | } 18 | 19 | fn main() {} 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-self-receiver-04.stderr: -------------------------------------------------------------------------------- 1 | error: ink! constructors must have no `self` receiver 2 | --> tests/ui/contract/fail/constructor/constructor-self-receiver-04.rs:10:28 3 | | 4 | 10 | pub fn constructor(self) -> Self { 5 | | ^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-unsafe.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub unsafe fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message(&self) {} 16 | } 17 | } 18 | 19 | fn main() {} 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/constructor/constructor-unsafe.stderr: -------------------------------------------------------------------------------- 1 | error: ink! constructors must not be unsafe 2 | --> tests/ui/contract/fail/constructor/constructor-unsafe.rs:10:13 3 | | 4 | 10 | pub unsafe fn constructor() -> Self { 5 | | ^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/event-conflicting-storage.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | #[ink(event)] 9 | #[ink(storage)] 10 | pub struct Event {} 11 | 12 | impl Contract { 13 | #[ink(constructor)] 14 | pub fn constructor() -> Self { 15 | Self {} 16 | } 17 | 18 | #[ink(message)] 19 | pub fn message(&self) {} 20 | } 21 | } 22 | 23 | fn main() {} 24 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/event-conflicting-storage.stderr: -------------------------------------------------------------------------------- 1 | error: encountered conflicting ink! attribute argument 2 | --> tests/ui/contract/fail/event-conflicting-storage.rs:9:11 3 | | 4 | 9 | #[ink(storage)] 5 | | ^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/impl/impl-block-for-non-storage-01.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor_1() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message_1(&self) {} 16 | } 17 | 18 | pub struct NonContract {} 19 | 20 | impl NonContract { 21 | #[ink(constructor)] 22 | pub fn constructor_2() -> Self { 23 | Self {} 24 | } 25 | 26 | #[ink(message)] 27 | pub fn message_2(&self) {} 28 | } 29 | } 30 | 31 | fn main() {} 32 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/impl/impl-block-for-non-storage-02.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message(&self) {} 16 | } 17 | 18 | pub struct NonContract {} 19 | 20 | #[ink(impl)] 21 | impl NonContract {} 22 | } 23 | 24 | fn main() {} 25 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/impl/impl-block-for-non-storage-02.stderr: -------------------------------------------------------------------------------- 1 | error[E0308]: mismatched types 2 | --> tests/ui/contract/fail/impl/impl-block-for-non-storage-02.rs:21:10 3 | | 4 | 21 | impl NonContract {} 5 | | ^^^^^^^^^^^ expected `IsSameType`, found `IsSameType` 6 | | 7 | = note: expected struct `IsSameType` 8 | found struct `IsSameType` 9 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/impl/impl-block-namespace-invalid-identifier.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | #[ink(namespace = "::invalid_identifier")] 9 | impl Contract { 10 | #[ink(constructor)] 11 | pub fn constructor() -> Self { 12 | Self {} 13 | } 14 | 15 | #[ink(message)] 16 | pub fn message(&self) {} 17 | } 18 | } 19 | 20 | fn main() {} 21 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/impl/impl-block-namespace-invalid-identifier.stderr: -------------------------------------------------------------------------------- 1 | error: encountered invalid Rust identifier for namespace argument 2 | --> tests/ui/contract/fail/impl/impl-block-namespace-invalid-identifier.rs:8:23 3 | | 4 | 8 | #[ink(namespace = "::invalid_identifier")] 5 | | ^^^^^^^^^^^^^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/impl/impl-block-namespace-invalid-type.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | #[ink(namespace = true)] 9 | impl Contract { 10 | #[ink(constructor)] 11 | pub fn constructor() -> Self { 12 | Self {} 13 | } 14 | 15 | #[ink(message)] 16 | pub fn message(&self) {} 17 | } 18 | } 19 | 20 | fn main() {} 21 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/impl/impl-block-namespace-invalid-type.stderr: -------------------------------------------------------------------------------- 1 | error: expected string type for `namespace` argument, e.g. #[ink(namespace = "hello")] 2 | --> tests/ui/contract/fail/impl/impl-block-namespace-invalid-type.rs:8:23 3 | | 4 | 8 | #[ink(namespace = true)] 5 | | ^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/impl/impl-block-namespace-missing-argument.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | #[ink(namespace)] 9 | impl Contract { 10 | #[ink(constructor)] 11 | pub fn constructor() -> Self { 12 | Self {} 13 | } 14 | 15 | #[ink(message)] 16 | pub fn message(&self) {} 17 | } 18 | } 19 | 20 | fn main() {} 21 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/impl/impl-block-namespace-missing-argument.stderr: -------------------------------------------------------------------------------- 1 | error: encountered #[ink(namespace)] that is missing its string parameter. Did you mean #[ink(namespace = name: str)] ? 2 | --> tests/ui/contract/fail/impl/impl-block-namespace-missing-argument.rs:8:11 3 | | 4 | 8 | #[ink(namespace)] 5 | | ^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/impl/impl-block-using-env-no-marker.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | } 14 | 15 | impl Contract { 16 | #[ink(message)] 17 | pub fn message(&self) { 18 | self.message_impl(); 19 | } 20 | } 21 | 22 | impl Contract { 23 | fn message_impl(&self) { 24 | let _ = self.env().caller(); 25 | } 26 | } 27 | } 28 | 29 | fn main() {} 30 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/impl/impl-block-using-env-no-marker.stderr: -------------------------------------------------------------------------------- 1 | error[E0599]: no method named `env` found for reference `&Contract` in the current scope 2 | --> tests/ui/contract/fail/impl/impl-block-using-env-no-marker.rs:24:26 3 | | 4 | 24 | let _ = self.env().caller(); 5 | | ^^^ method not found in `&Contract` 6 | | 7 | = help: items from traits can only be used if the trait is in scope 8 | help: trait `Env` which provides `env` is implemented but not in scope; perhaps you want to import it 9 | | 10 | 3 + use ink::codegen::Env; 11 | | 12 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/impl/impl-block-using-static-env-no-marker.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self::constructor_impl() 12 | } 13 | } 14 | 15 | impl Contract { 16 | #[ink(message)] 17 | pub fn message(&self) {} 18 | } 19 | 20 | impl Contract { 21 | fn constructor_impl() -> Self { 22 | let _ = Self::env().caller(); 23 | Self {} 24 | } 25 | } 26 | } 27 | 28 | fn main() {} 29 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/message/message-hygiene-try.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message(&self) {} 16 | 17 | #[ink(message)] 18 | pub fn try_message(&self) {} 19 | } 20 | } 21 | 22 | fn main() {} 23 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/message/message-hygiene-try.stderr: -------------------------------------------------------------------------------- 1 | error[E0592]: duplicate definitions with name `try_message` 2 | --> tests/ui/contract/fail/message/message-hygiene-try.rs:18:9 3 | | 4 | 3 | #[ink::contract] 5 | | ---------------- other definition for `try_message` 6 | ... 7 | 18 | pub fn try_message(&self) {} 8 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ duplicate definitions for `try_message` 9 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/message/message-input-non-codec.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[::ink::scale_derive(TypeInfo)] 6 | pub struct NonCodecType; 7 | 8 | #[ink(storage)] 9 | pub struct Contract {} 10 | 11 | impl Contract { 12 | #[ink(constructor)] 13 | pub fn constructor() -> Self { 14 | Self {} 15 | } 16 | 17 | #[ink(message)] 18 | pub fn message(&self, _input: NonCodecType) {} 19 | } 20 | } 21 | 22 | fn main() {} 23 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/message/message-input-pattern.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message(&self, (_a, _b): (i32, i32)) {} 16 | } 17 | } 18 | 19 | fn main() {} 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/message/message-input-pattern.stderr: -------------------------------------------------------------------------------- 1 | error: ink! message arguments must have an identifier 2 | --> tests/ui/contract/fail/message/message-input-pattern.rs:15:31 3 | | 4 | 15 | pub fn message(&self, (_a, _b): (i32, i32)) {} 5 | | ^^^^^^^^^^^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/message/message-multiple-wildcard-selectors.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message, selector = _)] 15 | pub fn message1(&self) {} 16 | 17 | #[ink(message, selector = _)] 18 | pub fn message2(&self) {} 19 | } 20 | } 21 | 22 | fn main() {} 23 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/message/message-multiple-wildcard-selectors.stderr: -------------------------------------------------------------------------------- 1 | error: encountered ink! messages with overlapping wildcard selectors 2 | --> tests/ui/contract/fail/message/message-multiple-wildcard-selectors.rs:18:9 3 | | 4 | 18 | pub fn message2(&self) {} 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ 6 | 7 | error: first ink! message with overlapping wildcard selector here 8 | --> tests/ui/contract/fail/message/message-multiple-wildcard-selectors.rs:15:9 9 | | 10 | 15 | pub fn message1(&self) {} 11 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ 12 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/message/message-returns-non-codec.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[::ink::scale_derive(TypeInfo)] 6 | pub struct NonCodecType; 7 | 8 | #[ink(storage)] 9 | pub struct Contract {} 10 | 11 | impl Contract { 12 | #[ink(constructor)] 13 | pub fn constructor() -> Self { 14 | Self {} 15 | } 16 | 17 | #[ink(message)] 18 | pub fn message(&self) -> NonCodecType { 19 | NonCodecType 20 | } 21 | } 22 | } 23 | 24 | fn main() {} 25 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/message/message-returns-self.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn returns_self(&self) -> Self {} 16 | } 17 | } 18 | 19 | fn main() {} 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/message/message-returns-self.stderr: -------------------------------------------------------------------------------- 1 | error: ink! messages must not return `Self` 2 | --> tests/ui/contract/fail/message/message-returns-self.rs:15:39 3 | | 4 | 15 | pub fn returns_self(&self) -> Self {} 5 | | ^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/message/message-selector-and-wildcard-selector.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message, selector = 0xCAFEBABA, selector = _)] 15 | pub fn message(&self) {} 16 | } 17 | } 18 | 19 | fn main() {} 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/message/message-selector-and-wildcard-selector.stderr: -------------------------------------------------------------------------------- 1 | error: encountered ink! attribute arguments with equal kinds 2 | --> tests/ui/contract/fail/message/message-selector-and-wildcard-selector.rs:14:47 3 | | 4 | 14 | #[ink(message, selector = 0xCAFEBABA, selector = _)] 5 | | ^^^^^^^^^^^^ 6 | 7 | error: first equal ink! attribute argument with equal kind here 8 | --> tests/ui/contract/fail/message/message-selector-and-wildcard-selector.rs:14:24 9 | | 10 | 14 | #[ink(message, selector = 0xCAFEBABA, selector = _)] 11 | | ^^^^^^^^^^^^^^^^^^^^^ 12 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/message/message-selector-invalid-type-01.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message, selector = "0xC0DECAFE")] 15 | pub fn message(&self) {} 16 | } 17 | } 18 | 19 | fn main() {} 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/message/message-selector-invalid-type-01.stderr: -------------------------------------------------------------------------------- 1 | error: #[ink(selector = ..)] attributes with string inputs are deprecated. use an integer instead, e.g. #[ink(selector = 1)] or #[ink(selector = 0xC0DECAFE)]. 2 | --> tests/ui/contract/fail/message/message-selector-invalid-type-01.rs:14:35 3 | | 4 | 14 | #[ink(message, selector = "0xC0DECAFE")] 5 | | ^^^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/message/message-selector-invalid-type-02.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message, selector = true)] 15 | pub fn message(&self) {} 16 | } 17 | } 18 | 19 | fn main() {} 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/message/message-selector-invalid-type-02.stderr: -------------------------------------------------------------------------------- 1 | error: expected 4-digit hexcode for `selector` argument, e.g. #[ink(selector = 0xC0FEBABE] 2 | --> tests/ui/contract/fail/message/message-selector-invalid-type-02.rs:14:35 3 | | 4 | 14 | #[ink(message, selector = true)] 5 | | ^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/message/message-selector-missing-arg.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message, selector)] 15 | pub fn message(&self) {} 16 | } 17 | } 18 | 19 | fn main() {} 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/message/message-selector-missing-arg.stderr: -------------------------------------------------------------------------------- 1 | error: encountered #[ink(selector)] that is missing its u32 parameter. Did you mean #[ink(selector = value: u32)] ? 2 | --> tests/ui/contract/fail/message/message-selector-missing-arg.rs:14:24 3 | | 4 | 14 | #[ink(message, selector)] 5 | | ^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/message/message-self-receiver-invalid-01.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message(this: &Self) {} 16 | } 17 | } 18 | 19 | fn main() {} 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/message/message-self-receiver-invalid-01.stderr: -------------------------------------------------------------------------------- 1 | error: ink! messages must have `&self` or `&mut self` receiver 2 | --> tests/ui/contract/fail/message/message-self-receiver-invalid-01.rs:15:24 3 | | 4 | 15 | pub fn message(this: &Self) {} 5 | | ^^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/message/message-self-receiver-invalid-02.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message(this: &mut Self) {} 16 | } 17 | } 18 | 19 | fn main() {} 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/message/message-self-receiver-invalid-02.stderr: -------------------------------------------------------------------------------- 1 | error: ink! messages must have `&self` or `&mut self` receiver 2 | --> tests/ui/contract/fail/message/message-self-receiver-invalid-02.rs:15:24 3 | | 4 | 15 | pub fn message(this: &mut Self) {} 5 | | ^^^^^^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/message/message-self-receiver-invalid-03.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message(self) {} 16 | } 17 | } 18 | 19 | fn main() {} 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/message/message-self-receiver-invalid-03.stderr: -------------------------------------------------------------------------------- 1 | error: ink! messages must have `&self` or `&mut self` receiver 2 | --> tests/ui/contract/fail/message/message-self-receiver-invalid-03.rs:15:24 3 | | 4 | 15 | pub fn message(self) {} 5 | | ^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/message/message-self-receiver-missing.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message() {} 16 | } 17 | } 18 | 19 | fn main() {} 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/message/message-self-receiver-missing.stderr: -------------------------------------------------------------------------------- 1 | error: ink! messages must have `&self` or `&mut self` receiver 2 | --> tests/ui/contract/fail/message/message-self-receiver-missing.rs:14:9 3 | | 4 | 14 | / #[ink(message)] 5 | 15 | | pub fn message() {} 6 | | |___________________________^ 7 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/message/message-unknown-property.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | #[ink(unknown_marker)] 16 | pub fn message(&self) {} 17 | } 18 | } 19 | 20 | fn main() {} 21 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/message/message-unknown-property.stderr: -------------------------------------------------------------------------------- 1 | error: encountered unknown ink! attribute argument: unknown_marker 2 | --> tests/ui/contract/fail/message/message-unknown-property.rs:15:15 3 | | 4 | 15 | #[ink(unknown_marker)] 5 | | ^^^^^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/module-missing-constructor.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(message)] 10 | pub fn message(&self) {} 11 | } 12 | } 13 | 14 | fn main() {} 15 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/module-missing-constructor.stderr: -------------------------------------------------------------------------------- 1 | error: missing ink! constructor 2 | --> tests/ui/contract/fail/module-missing-constructor.rs:4:1 3 | | 4 | 4 | / mod contract { 5 | 5 | | #[ink(storage)] 6 | 6 | | pub struct Contract {} 7 | ... | 8 | 12 | | } 9 | | |_^ 10 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/module-missing-message.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | } 14 | } 15 | 16 | fn main() {} 17 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/module-missing-message.stderr: -------------------------------------------------------------------------------- 1 | error: missing ink! message 2 | --> tests/ui/contract/fail/module-missing-message.rs:4:1 3 | | 4 | 4 | / mod contract { 5 | 5 | | #[ink(storage)] 6 | 6 | | pub struct Contract {} 7 | ... | 8 | 14 | | } 9 | | |_^ 10 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/module-missing-storage.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | // #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self {} 11 | 12 | #[ink(message)] 13 | pub fn message(&self) {} 14 | } 15 | } 16 | 17 | fn main() {} 18 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/module-missing-storage.stderr: -------------------------------------------------------------------------------- 1 | error: missing ink! storage struct 2 | --> tests/ui/contract/fail/module-missing-storage.rs:4:1 3 | | 4 | 4 | / mod contract { 5 | 5 | | // #[ink(storage)] 6 | 6 | | pub struct Contract {} 7 | ... | 8 | 15 | | } 9 | | |_^ 10 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/module-multiple-storages.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message(&self) {} 16 | } 17 | 18 | #[ink(storage)] 19 | pub struct Contract2 {} 20 | 21 | impl Contract2 { 22 | #[ink(constructor)] 23 | pub fn constructor() -> Self { 24 | Self {} 25 | } 26 | 27 | #[ink(message)] 28 | pub fn message(&self) {} 29 | } 30 | } 31 | 32 | fn main() {} 33 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/module-multiple-storages.stderr: -------------------------------------------------------------------------------- 1 | error: encountered multiple ink! storage structs, expected exactly one 2 | --> tests/ui/contract/fail/module-multiple-storages.rs:4:1 3 | | 4 | 4 | / mod contract { 5 | 5 | | #[ink(storage)] 6 | 6 | | pub struct Contract {} 7 | ... | 8 | 30 | | } 9 | | |_^ 10 | 11 | error: ink! storage struct here 12 | --> tests/ui/contract/fail/module-multiple-storages.rs:6:5 13 | | 14 | 6 | pub struct Contract {} 15 | | ^^^^^^^^^^^^^^^^^^^^^^ 16 | 17 | error: ink! storage struct here 18 | --> tests/ui/contract/fail/module-multiple-storages.rs:19:5 19 | | 20 | 19 | pub struct Contract2 {} 21 | | ^^^^^^^^^^^^^^^^^^^^^^^ 22 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/module-use-forbidden-idents.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod __ink_contract { 5 | #[ink(storage)] 6 | pub struct __ink_Contract {} 7 | 8 | const __ink_CONST: () = (); 9 | static __ink_STATIC: () = (); 10 | type __ink_Type = (); 11 | 12 | impl __ink_Contract { 13 | #[ink(constructor)] 14 | pub fn __ink_constructor(__ink_input: __ink_Type) -> Self { 15 | Self {} 16 | } 17 | 18 | #[ink(message)] 19 | pub fn __ink_message(&self, __ink_input: __ink_Type) -> __ink_Type { 20 | let __ink_first = (); 21 | } 22 | } 23 | } 24 | 25 | fn main() {} 26 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/storage-conflicting-event.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | #[ink(event)] 7 | pub struct Contract {} 8 | 9 | impl Contract { 10 | #[ink(constructor)] 11 | pub fn constructor() -> Self { 12 | Self {} 13 | } 14 | 15 | #[ink(message)] 16 | pub fn message(&self) {} 17 | } 18 | } 19 | 20 | fn main() {} 21 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/storage-conflicting-event.stderr: -------------------------------------------------------------------------------- 1 | error: encountered conflicting ink! attribute argument 2 | --> tests/ui/contract/fail/storage-conflicting-event.rs:6:11 3 | | 4 | 6 | #[ink(event)] 5 | | ^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/storage-unknown-marker.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | #[ink(unknown_or_unsupported)] 7 | pub struct Contract {} 8 | 9 | impl Contract { 10 | #[ink(constructor)] 11 | pub fn constructor() -> Self { 12 | Self {} 13 | } 14 | 15 | #[ink(message)] 16 | pub fn message(&self) {} 17 | } 18 | } 19 | 20 | fn main() {} 21 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/storage-unknown-marker.stderr: -------------------------------------------------------------------------------- 1 | error: encountered unknown ink! attribute argument: unknown_or_unsupported 2 | --> tests/ui/contract/fail/storage-unknown-marker.rs:6:11 3 | | 4 | 6 | #[ink(unknown_or_unsupported)] 5 | | ^^^^^^^^^^^^^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/trait/trait-impl-namespace-invalid.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::trait_definition] 4 | pub trait TraitDefinition { 5 | #[ink(message)] 6 | fn message(&self); 7 | } 8 | 9 | #[ink::contract] 10 | mod contract { 11 | use super::TraitDefinition; 12 | 13 | #[ink(storage)] 14 | pub struct Contract {} 15 | 16 | impl Contract { 17 | #[ink(constructor)] 18 | pub fn constructor() -> Self { 19 | Self {} 20 | } 21 | } 22 | 23 | #[ink(namespace = "namespace")] 24 | impl TraitDefinition for Contract { 25 | #[ink(message)] 26 | fn message(&self) {} 27 | } 28 | } 29 | 30 | fn main() {} 31 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/trait/trait-impl-namespace-invalid.stderr: -------------------------------------------------------------------------------- 1 | error: namespace ink! property is not allowed on ink! trait implementation blocks 2 | --> tests/ui/contract/fail/trait/trait-impl-namespace-invalid.rs:23:5 3 | | 4 | 23 | / #[ink(namespace = "namespace")] 5 | 24 | | impl TraitDefinition for Contract { 6 | 25 | | #[ink(message)] 7 | 26 | | fn message(&self) {} 8 | 27 | | } 9 | | |_____^ 10 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/trait/trait-message-payable-mismatch.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::trait_definition] 4 | pub trait TraitDefinition { 5 | #[ink(message)] 6 | fn message(&self); 7 | } 8 | 9 | #[ink::contract] 10 | mod contract { 11 | use super::TraitDefinition; 12 | 13 | #[ink(storage)] 14 | pub struct Contract {} 15 | 16 | impl Contract { 17 | #[ink(constructor)] 18 | pub fn constructor() -> Self { 19 | Self {} 20 | } 21 | } 22 | 23 | impl TraitDefinition for Contract { 24 | #[ink(message, payable)] 25 | fn message(&self) {} 26 | } 27 | } 28 | 29 | fn main() {} 30 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/trait/trait-message-payable-mismatch.stderr: -------------------------------------------------------------------------------- 1 | error[E0308]: mismatched types 2 | --> tests/ui/contract/fail/trait/trait-message-payable-mismatch.rs:25:9 3 | | 4 | 25 | fn message(&self) {} 5 | | ^^^^^^^^^^^^^^^^^^^^ expected `false`, found `true` 6 | | 7 | = note: expected struct `TraitMessagePayable` 8 | found struct `TraitMessagePayable` 9 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/trait/trait-message-selector-mismatch.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::trait_definition] 4 | pub trait TraitDefinition { 5 | #[ink(message, selector = 1)] 6 | fn message(&self); 7 | } 8 | 9 | #[ink::contract] 10 | mod contract { 11 | use super::TraitDefinition; 12 | 13 | #[ink(storage)] 14 | pub struct Contract {} 15 | 16 | impl Contract { 17 | #[ink(constructor)] 18 | pub fn constructor() -> Self { 19 | Self {} 20 | } 21 | } 22 | 23 | impl TraitDefinition for Contract { 24 | #[ink(message, selector = 2)] 25 | fn message(&self) {} 26 | } 27 | } 28 | 29 | fn main() {} 30 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/trait/trait-message-selector-mismatch.stderr: -------------------------------------------------------------------------------- 1 | error[E0308]: mismatched types 2 | --> tests/ui/contract/fail/trait/trait-message-selector-mismatch.rs:25:9 3 | | 4 | 25 | fn message(&self) {} 5 | | ^^^^^^^^^^^^^^^^^^^^ expected `1`, found `2` 6 | | 7 | = note: expected struct `TraitMessageSelector<1>` 8 | found struct `TraitMessageSelector<2>` 9 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/fail/trait/trait-message-wildcard-selector.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | mod foo { 4 | #[ink::trait_definition] 5 | pub trait TraitDefinition { 6 | #[ink(message, selector = _)] 7 | fn message(&self); 8 | } 9 | } 10 | 11 | #[ink::contract] 12 | pub mod contract { 13 | use super::foo::TraitDefinition; 14 | 15 | #[ink(storage)] 16 | pub struct Contract {} 17 | 18 | impl Contract { 19 | #[ink(constructor)] 20 | pub fn constructor() -> Self { 21 | Self {} 22 | } 23 | } 24 | 25 | impl TraitDefinition for Contract { 26 | #[ink(message)] 27 | fn message(&self) {} 28 | } 29 | } 30 | 31 | fn main() {} 32 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/pass/cfg-allowed-usage-02.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[cfg(test)] 15 | #[ink(constructor)] 16 | pub fn constructor2() -> Self { 17 | Self {} 18 | } 19 | 20 | #[ink(message)] 21 | pub fn message1(&self) {} 22 | 23 | #[ink(message)] 24 | #[cfg(test)] 25 | pub fn message2(&self) {} 26 | } 27 | } 28 | 29 | fn main() {} 30 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/pass/config-custom-env.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[derive(Clone)] 4 | pub struct CustomEnv; 5 | 6 | impl ink_env::Environment for CustomEnv { 7 | const MAX_EVENT_TOPICS: usize = 3; 8 | type AccountId = [u8; 32]; 9 | type Balance = u64; 10 | type Hash = [u8; 32]; 11 | type Timestamp = u64; 12 | type BlockNumber = u64; 13 | type ChainExtension = (); 14 | type EventRecord = (); 15 | } 16 | 17 | #[ink::contract(env = super::CustomEnv)] 18 | mod contract { 19 | #[ink(storage)] 20 | pub struct Contract {} 21 | 22 | impl Contract { 23 | #[ink(constructor)] 24 | pub fn constructor() -> Self { 25 | Self {} 26 | } 27 | 28 | #[ink(message)] 29 | pub fn message(&self) {} 30 | } 31 | } 32 | 33 | fn main() {} 34 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/pass/config-keep-attr.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract(keep_attr = "foo, bar")] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | #[allow(non_snake_case)] 16 | pub fn meSSage(&self) {} 17 | } 18 | } 19 | 20 | fn main() {} 21 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/pass/constructor/constructor-non-payable-multiple.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor, selector = 0)] 10 | pub fn constructor_0() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(constructor, selector = 1)] 15 | pub fn constructor_1() -> Self { 16 | Self {} 17 | } 18 | 19 | #[ink(message)] 20 | pub fn message(&self) {} 21 | } 22 | } 23 | 24 | use contract::Contract; 25 | 26 | fn main() { 27 | assert!(!>::PAYABLE); 28 | assert!(!>::PAYABLE); 29 | } 30 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/pass/constructor/constructor-non-payable.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor, selector = 0)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message(&self) {} 16 | } 17 | } 18 | 19 | use contract::Contract; 20 | 21 | fn main() { 22 | assert!(!>::PAYABLE); 23 | } 24 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/pass/constructor/constructor-payable.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor, selector = 0, payable)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message(&self) {} 16 | } 17 | } 18 | 19 | use contract::Contract; 20 | 21 | fn main() { 22 | assert!(>::PAYABLE); 23 | } 24 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/pass/constructor/constructor-return-result-ok.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | #[derive(Debug, PartialEq, Eq)] 9 | #[ink::scale_derive(Encode, Decode, TypeInfo)] 10 | pub enum Error { 11 | Foo, 12 | } 13 | 14 | impl Contract { 15 | #[ink(constructor)] 16 | pub fn constructor() -> Result { 17 | Ok(Self {}) 18 | } 19 | 20 | #[ink(message)] 21 | pub fn message(&self) {} 22 | } 23 | } 24 | 25 | fn main() {} 26 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/pass/constructor/constructor-wildcard-selector.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor, selector = _)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message(&self) {} 16 | } 17 | } 18 | 19 | fn main() {} 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/pass/event/event-single-definition.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | #[ink(event)] 9 | pub struct Event0 {} 10 | 11 | impl Contract { 12 | #[ink(constructor)] 13 | pub fn constructor() -> Self { 14 | Self {} 15 | } 16 | 17 | #[ink(message)] 18 | pub fn message(&self) {} 19 | } 20 | } 21 | 22 | fn main() {} 23 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/pass/impl-alias-storage.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | type ContractAlias = Contract; 9 | 10 | impl ContractAlias { 11 | #[ink(constructor)] 12 | pub fn constructor() -> Self { 13 | Self {} 14 | } 15 | 16 | #[ink(message)] 17 | pub fn message(&self) {} 18 | } 19 | } 20 | 21 | fn main() {} 22 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/pass/impl-block-namespace.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | } 14 | 15 | #[ink(namespace = "namespace")] 16 | impl Contract { 17 | #[ink(message)] 18 | pub fn message(&self) {} 19 | } 20 | } 21 | 22 | fn main() {} 23 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/pass/impl-block-using-env.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self::constructor_impl() 12 | } 13 | } 14 | 15 | impl Contract { 16 | #[ink(message)] 17 | pub fn message(&self) { 18 | self.message_impl(); 19 | } 20 | } 21 | 22 | #[ink(impl)] 23 | impl Contract { 24 | fn constructor_impl() -> Self { 25 | let _ = Self::env().caller(); 26 | Self {} 27 | } 28 | 29 | fn message_impl(&self) { 30 | let _ = self.env().caller(); 31 | } 32 | } 33 | } 34 | 35 | fn main() {} 36 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/pass/impl-with-property.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | #[ink(impl)] 9 | impl Contract {} 10 | 11 | #[ink(impl)] 12 | impl Contract { 13 | #[ink(constructor)] 14 | pub fn constructor() -> Self { 15 | Self {} 16 | } 17 | 18 | #[ink(message)] 19 | pub fn message(&self) {} 20 | } 21 | } 22 | 23 | fn main() {} 24 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/pass/message/message-checked-variant.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | #[derive(Default)] 7 | pub struct Contract {} 8 | 9 | impl Contract { 10 | #[ink(constructor)] 11 | pub fn constructor() -> Self { 12 | Self::default() 13 | } 14 | 15 | #[ink(message)] 16 | pub fn message(&self) {} 17 | } 18 | } 19 | 20 | use contract::Contract; 21 | 22 | fn main() { 23 | let contract = Contract::default(); 24 | contract.message(); 25 | } 26 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/pass/message/message-payable.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message, selector = 1, payable)] 15 | pub fn message_1(&self) {} 16 | 17 | #[ink(message, selector = 2)] 18 | pub fn message_2(&self) {} 19 | } 20 | } 21 | 22 | use contract::Contract; 23 | 24 | fn main() { 25 | assert!(>::PAYABLE); 26 | assert!(!>::PAYABLE); 27 | } 28 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/pass/message/message-wildcard-selector.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message, selector = @)] 15 | pub fn message_1(&self) {} 16 | 17 | #[ink(message, selector = _)] 18 | pub fn message_2(&self) {} 19 | } 20 | } 21 | 22 | fn main() {} 23 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/pass/minimal-contract.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract {} 7 | 8 | impl Contract { 9 | #[ink(constructor)] 10 | pub fn constructor() -> Self { 11 | Self {} 12 | } 13 | 14 | #[ink(message)] 15 | pub fn message(&self) {} 16 | } 17 | } 18 | 19 | fn main() {} 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/pass/module-env-types.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract { 7 | account_id: AccountId, 8 | balance: Balance, 9 | hash: Hash, 10 | timestamp: Timestamp, 11 | block_number: BlockNumber, 12 | } 13 | 14 | impl Contract { 15 | #[ink(constructor)] 16 | pub fn constructor() -> Self { 17 | unimplemented!() 18 | } 19 | 20 | #[ink(message)] 21 | pub fn message(&self) {} 22 | } 23 | } 24 | 25 | fn main() {} 26 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/pass/storage-many-fields.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract { 7 | field_1: i8, 8 | field_2: i16, 9 | field_3: i32, 10 | field_4: i64, 11 | field_5: i128, 12 | field_6: u8, 13 | field_7: u16, 14 | field_8: u32, 15 | field_9: u64, 16 | field_10: u128, 17 | } 18 | 19 | impl Contract { 20 | #[ink(constructor)] 21 | pub fn constructor() -> Self { 22 | unimplemented!() 23 | } 24 | 25 | #[ink(message)] 26 | pub fn message(&self) {} 27 | } 28 | } 29 | 30 | fn main() {} 31 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/pass/storage-single-field.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::contract] 4 | mod contract { 5 | #[ink(storage)] 6 | pub struct Contract { 7 | field: i8, 8 | } 9 | 10 | impl Contract { 11 | #[ink(constructor)] 12 | pub fn constructor() -> Self { 13 | Self { field: 0 } 14 | } 15 | 16 | #[ink(message)] 17 | pub fn message(&self) {} 18 | } 19 | } 20 | 21 | fn main() {} 22 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/pass/storage-with-derives.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | use contract::Contract; 4 | 5 | #[ink::contract] 6 | mod contract { 7 | #[ink(storage)] 8 | #[derive(Debug, Default, PartialEq, Eq)] 9 | pub struct Contract {} 10 | 11 | impl Contract { 12 | #[ink(constructor)] 13 | pub fn constructor() -> Self { 14 | Self::default() 15 | } 16 | 17 | #[ink(message)] 18 | pub fn message(&self) {} 19 | } 20 | } 21 | 22 | fn main() { 23 | assert_eq!(Contract::constructor(), Contract::default()); 24 | } 25 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/pass/trait-message-payable-guard.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::trait_definition] 4 | pub trait TraitDefinition { 5 | #[ink(message, payable)] 6 | fn message(&self); 7 | } 8 | 9 | #[ink::contract] 10 | mod contract { 11 | use super::TraitDefinition; 12 | 13 | #[ink(storage)] 14 | pub struct Contract {} 15 | 16 | impl Contract { 17 | #[ink(constructor)] 18 | pub fn constructor() -> Self { 19 | Self {} 20 | } 21 | } 22 | 23 | impl TraitDefinition for Contract { 24 | #[ink(message, payable)] 25 | fn message(&self) {} 26 | } 27 | } 28 | 29 | fn main() {} 30 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/contract/pass/trait-message-selector-guard.rs: -------------------------------------------------------------------------------- 1 | #![allow(unexpected_cfgs)] 2 | 3 | #[ink::trait_definition] 4 | pub trait TraitDefinition { 5 | #[ink(message, selector = 1)] 6 | fn message(&self); 7 | } 8 | 9 | #[ink::contract] 10 | mod contract { 11 | use super::TraitDefinition; 12 | 13 | #[ink(storage)] 14 | pub struct Contract {} 15 | 16 | impl Contract { 17 | #[ink(constructor)] 18 | pub fn constructor() -> Self { 19 | Self {} 20 | } 21 | } 22 | 23 | impl TraitDefinition for Contract { 24 | #[ink(message, selector = 1)] 25 | fn message(&self) {} 26 | } 27 | } 28 | 29 | fn main() {} 30 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/event/fail/anonymous_invalid_value.rs: -------------------------------------------------------------------------------- 1 | #[ink::event(anonymous = true)] 2 | pub struct Event { 3 | #[ink(topic)] 4 | pub topic: [u8; 32], 5 | pub field_1: u32, 6 | } 7 | 8 | fn main() {} 9 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/event/fail/anonymous_invalid_value.stderr: -------------------------------------------------------------------------------- 1 | error: encountered an unexpected value for `anonymous` ink! event item configuration argument. Did you mean #[ink::event(anonymous)] ? 2 | --> tests/ui/event/fail/anonymous_invalid_value.rs:1:14 3 | | 4 | 1 | #[ink::event(anonymous = true)] 5 | | ^^^^^^^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/event/fail/cfg_attr_on_field.rs: -------------------------------------------------------------------------------- 1 | #[ink::event] 2 | pub struct Event { 3 | #[cfg(feature = "std")] 4 | pub a: [u8; 32], 5 | } 6 | 7 | fn main() {} -------------------------------------------------------------------------------- /crates/ink/tests/ui/event/fail/cfg_attr_on_field.stderr: -------------------------------------------------------------------------------- 1 | error: conditional compilation is not allowed for event fields 2 | --> tests/ui/event/fail/cfg_attr_on_field.rs:3:5 3 | | 4 | 3 | / #[cfg(feature = "std")] 5 | 4 | | pub a: [u8; 32], 6 | | |___________________^ 7 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/event/fail/cfg_attr_on_topic.rs: -------------------------------------------------------------------------------- 1 | #[ink::event] 2 | pub struct Event { 3 | #[cfg(feature = "std")] 4 | #[ink(topic)] 5 | pub topic: [u8; 32], 6 | } 7 | 8 | fn main() {} -------------------------------------------------------------------------------- /crates/ink/tests/ui/event/fail/cfg_attr_on_topic.stderr: -------------------------------------------------------------------------------- 1 | error: conditional compilation is not allowed for event fields 2 | --> tests/ui/event/fail/cfg_attr_on_topic.rs:3:5 3 | | 4 | 3 | / #[cfg(feature = "std")] 5 | 4 | | #[ink(topic)] 6 | 5 | | pub topic: [u8; 32], 7 | | |_______________________^ 8 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/event/fail/conficting_attributes.rs: -------------------------------------------------------------------------------- 1 | #[ink::event] 2 | #[ink(anonymous)] 3 | #[ink(signature_topic = "1111111111111111111111111111111111111111111111111111111111111111")] 4 | pub struct Event { 5 | pub topic: [u8; 32], 6 | } 7 | 8 | fn main() {} 9 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/event/fail/conficting_attributes.stderr: -------------------------------------------------------------------------------- 1 | error: cannot specify `signature_topic` with `anonymous` in ink! event item configuration argument 2 | --> tests/ui/event/fail/conficting_attributes.rs:3:7 3 | | 4 | 3 | #[ink(signature_topic = "1111111111111111111111111111111111111111111111111111111111111111")] 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 6 | 7 | error[E0277]: the trait bound `Event: ink::ink_env::Event` is not satisfied 8 | --> tests/ui/event/fail/conficting_attributes.rs:1:1 9 | | 10 | 1 | #[ink::event] 11 | | ^^^^^^^^^^^^^ the trait `ink::ink_env::Event` is not implemented for `Event` 12 | | 13 | = note: this error originates in the attribute macro `ink::event` (in Nightly builds, run with -Z macro-backtrace for more info) 14 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/event/fail/conficting_attributes_inline.rs: -------------------------------------------------------------------------------- 1 | #[ink::event] 2 | #[ink(anonymous, signature_topic = "1111111111111111111111111111111111111111111111111111111111111111")] 3 | pub struct Event { 4 | pub topic: [u8; 32], 5 | } 6 | 7 | fn main() {} 8 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/event/fail/event_enum.rs: -------------------------------------------------------------------------------- 1 | #[ink::event] 2 | pub enum Event { 3 | Variant1 { 4 | field_1: i8, 5 | #[ink(topic)] 6 | field_2: i16, 7 | } 8 | } 9 | 10 | fn main() {} -------------------------------------------------------------------------------- /crates/ink/tests/ui/event/fail/event_enum.stderr: -------------------------------------------------------------------------------- 1 | error: expected `struct` 2 | --> tests/ui/event/fail/event_enum.rs:2:5 3 | | 4 | 2 | pub enum Event { 5 | | ^^^^ 6 | 7 | error: event definition must be a `struct` 8 | --> tests/ui/event/fail/event_enum.rs:2:1 9 | | 10 | 2 | / pub enum Event { 11 | 3 | | Variant1 { 12 | 4 | | field_1: i8, 13 | 5 | | #[ink(topic)] 14 | ... | 15 | 8 | | } 16 | | |_^ 17 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/event/fail/generics.rs: -------------------------------------------------------------------------------- 1 | #[derive(ink::Event)] 2 | pub struct Event { 3 | #[ink(topic)] 4 | pub topic: T, 5 | } 6 | 7 | fn main() {} -------------------------------------------------------------------------------- /crates/ink/tests/ui/event/fail/generics.stderr: -------------------------------------------------------------------------------- 1 | error: can only derive `Event` for structs without generics 2 | --> tests/ui/event/fail/generics.rs:2:18 3 | | 4 | 2 | pub struct Event { 5 | | ^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/event/fail/multiple_topic_args.rs: -------------------------------------------------------------------------------- 1 | #[ink::event] 2 | pub struct Event { 3 | #[ink(topic)] 4 | #[ink(topic)] 5 | pub topic: [u8; 32], 6 | } 7 | 8 | fn main() {} -------------------------------------------------------------------------------- /crates/ink/tests/ui/event/fail/multiple_topic_args.stderr: -------------------------------------------------------------------------------- 1 | error: Only a single `#[ink(topic)]` is allowed 2 | --> tests/ui/event/fail/multiple_topic_args.rs:4:11 3 | | 4 | 4 | #[ink(topic)] 5 | | ^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/event/fail/multiple_topic_args_inline.rs: -------------------------------------------------------------------------------- 1 | #[ink::event] 2 | pub struct Event { 3 | #[ink(topic, topic)] 4 | pub topic: [u8; 32], 5 | } 6 | 7 | fn main() {} -------------------------------------------------------------------------------- /crates/ink/tests/ui/event/fail/multiple_topic_args_inline.stderr: -------------------------------------------------------------------------------- 1 | error: Only a single `#[ink(topic)]` is allowed 2 | --> tests/ui/event/fail/multiple_topic_args_inline.rs:3:18 3 | | 4 | 3 | #[ink(topic, topic)] 5 | | ^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/event/fail/signature_hex_short.rs: -------------------------------------------------------------------------------- 1 | #[ink::event] 2 | #[ink(signature_topic = "1111111111111111111111111111")] 3 | pub struct Event { 4 | pub topic: [u8; 32], 5 | } 6 | 7 | fn main() {} 8 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/event/fail/signature_hex_short.stderr: -------------------------------------------------------------------------------- 1 | error: `signature_topic` is expected to be 32-byte hex string. Found 14 bytes 2 | --> tests/ui/event/fail/signature_hex_short.rs:2:25 3 | | 4 | 2 | #[ink(signature_topic = "1111111111111111111111111111")] 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 6 | 7 | error[E0277]: the trait bound `Event: ink::ink_env::Event` is not satisfied 8 | --> tests/ui/event/fail/signature_hex_short.rs:1:1 9 | | 10 | 1 | #[ink::event] 11 | | ^^^^^^^^^^^^^ the trait `ink::ink_env::Event` is not implemented for `Event` 12 | | 13 | = note: this error originates in the attribute macro `ink::event` (in Nightly builds, run with -Z macro-backtrace for more info) 14 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/event/fail/signature_missing_value.rs: -------------------------------------------------------------------------------- 1 | #[ink::event(signature_topic)] 2 | pub struct Event { 3 | pub topic: [u8; 32], 4 | } 5 | 6 | fn main() {} 7 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/event/fail/signature_missing_value.stderr: -------------------------------------------------------------------------------- 1 | error: expected a string literal value for `signature_topic` ink! event item configuration argument 2 | --> tests/ui/event/fail/signature_missing_value.rs:1:14 3 | | 4 | 1 | #[ink::event(signature_topic)] 5 | | ^^^^^^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/event/fail/unknown_attribute.rs: -------------------------------------------------------------------------------- 1 | #[ink::event] 2 | #[ink(anonymous)] 3 | #[ink(my_arg)] 4 | pub struct Event { 5 | pub topic: [u8; 32], 6 | } 7 | 8 | fn main() {} 9 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/event/fail/unknown_attribute.stderr: -------------------------------------------------------------------------------- 1 | error: encountered unknown or unsupported ink! event item configuration argument 2 | --> tests/ui/event/fail/unknown_attribute.rs:3:7 3 | | 4 | 3 | #[ink(my_arg)] 5 | | ^^^^^^ 6 | 7 | error[E0277]: the trait bound `Event: ink::ink_env::Event` is not satisfied 8 | --> tests/ui/event/fail/unknown_attribute.rs:1:1 9 | | 10 | 1 | #[ink::event] 11 | | ^^^^^^^^^^^^^ the trait `ink::ink_env::Event` is not implemented for `Event` 12 | | 13 | = note: this error originates in the attribute macro `ink::event` (in Nightly builds, run with -Z macro-backtrace for more info) 14 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/event/pass/anonymous_flag_works.rs: -------------------------------------------------------------------------------- 1 | #[ink::event(anonymous)] 2 | pub struct Event { 3 | #[ink(topic)] 4 | pub topic: [u8; 32], 5 | pub field_1: u32, 6 | } 7 | 8 | fn main() {} 9 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/event/pass/custom_signature_works.rs: -------------------------------------------------------------------------------- 1 | #[ink::event] 2 | #[ink(signature_topic = "1111111111111111111111111111111111111111111111111111111111111111")] 3 | pub struct Event { 4 | #[ink(topic)] 5 | pub topic: [u8; 32], 6 | pub field_1: u32, 7 | } 8 | 9 | fn main() {} 10 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/event/pass/event_attribute_works.rs: -------------------------------------------------------------------------------- 1 | #[ink::event] 2 | pub struct Event { 3 | #[ink(topic)] 4 | pub topic: [u8; 32], 5 | pub field_1: u32, 6 | } 7 | 8 | fn main() {} -------------------------------------------------------------------------------- /crates/ink/tests/ui/event/pass/inline_custom_signature_works.rs: -------------------------------------------------------------------------------- 1 | #[ink::event(signature_topic = "1111111111111111111111111111111111111111111111111111111111111111")] 2 | pub struct Event { 3 | #[ink(topic)] 4 | pub topic: [u8; 32], 5 | pub field_1: u32, 6 | } 7 | 8 | fn main() {} 9 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/scale_derive/fail/invalid_derive.rs: -------------------------------------------------------------------------------- 1 | #[ink::scale_derive(Encode, Whatevs)] 2 | struct S; 3 | 4 | fn main() { 5 | } -------------------------------------------------------------------------------- /crates/ink/tests/ui/scale_derive/fail/invalid_derive.stderr: -------------------------------------------------------------------------------- 1 | error: unsupported scale derive: expected Encode, Decode or TypeInfo 2 | --> tests/ui/scale_derive/fail/invalid_derive.rs:1:29 3 | | 4 | 1 | #[ink::scale_derive(Encode, Whatevs)] 5 | | ^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/scale_derive/pass/decode.rs: -------------------------------------------------------------------------------- 1 | #[ink::scale_derive(Decode)] 2 | struct S; 3 | 4 | fn is_decode(_: T) {} 5 | 6 | fn main() { 7 | is_decode(S); 8 | } -------------------------------------------------------------------------------- /crates/ink/tests/ui/scale_derive/pass/encode.rs: -------------------------------------------------------------------------------- 1 | #[ink::scale_derive(Encode)] 2 | struct S; 3 | 4 | fn is_encode(_: T) {} 5 | 6 | fn main() { 7 | is_encode(S); 8 | } -------------------------------------------------------------------------------- /crates/ink/tests/ui/scale_derive/pass/multiple.rs: -------------------------------------------------------------------------------- 1 | #[ink::scale_derive(Encode, Decode, TypeInfo)] 2 | struct S; 3 | 4 | fn is_type_info(_: T) {} 5 | fn is_encode(_: T) {} 6 | fn is_decode(_: T) {} 7 | 8 | fn main() { 9 | is_type_info(S); 10 | is_encode(S); 11 | is_decode(S); 12 | } -------------------------------------------------------------------------------- /crates/ink/tests/ui/scale_derive/pass/type_info.rs: -------------------------------------------------------------------------------- 1 | #[ink::scale_derive(TypeInfo)] 2 | struct S; 3 | 4 | fn is_type_info(_: T) {} 5 | 6 | fn main() { 7 | is_type_info(S); 8 | } -------------------------------------------------------------------------------- /crates/ink/tests/ui/selector_bytes/fail/invalid_parameter_type_01.rs: -------------------------------------------------------------------------------- 1 | const _: u32 = ink::selector_bytes!(true); 2 | 3 | fn main() {} 4 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/selector_bytes/fail/invalid_parameter_type_01.stderr: -------------------------------------------------------------------------------- 1 | error: expected string or byte string literal as input. found Lit::Bool { value: true } 2 | --> tests/ui/selector_bytes/fail/invalid_parameter_type_01.rs:1:37 3 | | 4 | 1 | const _: u32 = ink::selector_bytes!(true); 5 | | ^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/selector_bytes/fail/invalid_parameter_type_02.rs: -------------------------------------------------------------------------------- 1 | const _: u32 = ink::selector_bytes!(42); 2 | 3 | fn main() {} 4 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/selector_bytes/fail/invalid_parameter_type_02.stderr: -------------------------------------------------------------------------------- 1 | error: expected string or byte string literal as input. found Lit::Int { token: 42 } 2 | --> tests/ui/selector_bytes/fail/invalid_parameter_type_02.rs:1:37 3 | | 4 | 1 | const _: u32 = ink::selector_bytes!(42); 5 | | ^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/selector_bytes/fail/missing_parameter.rs: -------------------------------------------------------------------------------- 1 | const _: u32 = ink::selector_bytes!(); 2 | 3 | fn main() {} 4 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/selector_bytes/fail/missing_parameter.stderr: -------------------------------------------------------------------------------- 1 | error: expected string or byte string literal as input: unexpected end of input, expected literal 2 | --> tests/ui/selector_bytes/fail/missing_parameter.rs:1:16 3 | | 4 | 1 | const _: u32 = ink::selector_bytes!(); 5 | | ^^^^^^^^^^^^^^^^^^^^^^ 6 | | 7 | = note: this error originates in the macro `ink::selector_bytes` (in Nightly builds, run with -Z macro-backtrace for more info) 8 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/selector_bytes/fail/non_literal_parameter.rs: -------------------------------------------------------------------------------- 1 | const INPUT: &str = "test"; 2 | const _: u32 = ink::selector_bytes!(INPUT); 3 | 4 | fn main() {} 5 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/selector_bytes/fail/non_literal_parameter.stderr: -------------------------------------------------------------------------------- 1 | error: expected string or byte string literal as input: expected literal 2 | --> tests/ui/selector_bytes/fail/non_literal_parameter.rs:2:37 3 | | 4 | 2 | const _: u32 = ink::selector_bytes!(INPUT); 5 | | ^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/selector_bytes/pass/bytestring_input.rs: -------------------------------------------------------------------------------- 1 | use ink_ir as ir; 2 | 3 | macro_rules! assert_macro_eq { 4 | ( $input:literal ) => {{ 5 | // We put it into a constant to verify that the computation is constant. 6 | const HASH: [u8; 4] = ink::selector_bytes!($input); 7 | assert_eq!( 8 | HASH, 9 | ir::Selector::compute($input).to_bytes(), 10 | ); 11 | }}; 12 | } 13 | 14 | fn main() { 15 | assert_macro_eq!(b""); 16 | assert_macro_eq!(b"Hello, World!"); 17 | assert_macro_eq!(b"message"); 18 | assert_macro_eq!(b"constructor"); 19 | } 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/selector_bytes/pass/no_implicit_prelude.rs: -------------------------------------------------------------------------------- 1 | #![no_implicit_prelude] 2 | 3 | const _: [::core::primitive::u8; 4] = ::ink::selector_bytes!("test"); 4 | 5 | fn main() {} 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/selector_bytes/pass/string_input.rs: -------------------------------------------------------------------------------- 1 | use ink_ir as ir; 2 | 3 | macro_rules! assert_macro_eq { 4 | ( $input:literal ) => {{ 5 | // We put it into a constant to verify that the computation is constant. 6 | const HASH: [u8; 4] = ink::selector_bytes!($input); 7 | assert_eq!( 8 | HASH, 9 | ir::Selector::compute($input.as_bytes()).to_bytes(), 10 | ); 11 | }}; 12 | } 13 | 14 | fn main() { 15 | assert_macro_eq!(""); 16 | assert_macro_eq!("Hello, World!"); 17 | assert_macro_eq!("message"); 18 | assert_macro_eq!("constructor"); 19 | } 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/selector_id/fail/invalid_parameter_type_01.rs: -------------------------------------------------------------------------------- 1 | const _: u32 = ink::selector_id!(true); 2 | 3 | fn main() {} 4 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/selector_id/fail/invalid_parameter_type_01.stderr: -------------------------------------------------------------------------------- 1 | error: expected string or byte string literal as input. found Lit::Bool { value: true } 2 | --> tests/ui/selector_id/fail/invalid_parameter_type_01.rs:1:34 3 | | 4 | 1 | const _: u32 = ink::selector_id!(true); 5 | | ^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/selector_id/fail/invalid_parameter_type_02.rs: -------------------------------------------------------------------------------- 1 | const _: u32 = ink::selector_id!(42); 2 | 3 | fn main() {} 4 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/selector_id/fail/invalid_parameter_type_02.stderr: -------------------------------------------------------------------------------- 1 | error: expected string or byte string literal as input. found Lit::Int { token: 42 } 2 | --> tests/ui/selector_id/fail/invalid_parameter_type_02.rs:1:34 3 | | 4 | 1 | const _: u32 = ink::selector_id!(42); 5 | | ^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/selector_id/fail/missing_parameter.rs: -------------------------------------------------------------------------------- 1 | const _: u32 = ink::selector_id!(); 2 | 3 | fn main() {} 4 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/selector_id/fail/missing_parameter.stderr: -------------------------------------------------------------------------------- 1 | error: expected string or byte string literal as input: unexpected end of input, expected literal 2 | --> tests/ui/selector_id/fail/missing_parameter.rs:1:16 3 | | 4 | 1 | const _: u32 = ink::selector_id!(); 5 | | ^^^^^^^^^^^^^^^^^^^ 6 | | 7 | = note: this error originates in the macro `ink::selector_id` (in Nightly builds, run with -Z macro-backtrace for more info) 8 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/selector_id/fail/non_literal_parameter.rs: -------------------------------------------------------------------------------- 1 | const INPUT: &str = "test"; 2 | const _: u32 = ink::selector_id!(INPUT); 3 | 4 | fn main() {} 5 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/selector_id/fail/non_literal_parameter.stderr: -------------------------------------------------------------------------------- 1 | error: expected string or byte string literal as input: expected literal 2 | --> tests/ui/selector_id/fail/non_literal_parameter.rs:2:34 3 | | 4 | 2 | const _: u32 = ink::selector_id!(INPUT); 5 | | ^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/selector_id/pass/bytestring_input.rs: -------------------------------------------------------------------------------- 1 | use ink_ir as ir; 2 | 3 | macro_rules! assert_macro_eq { 4 | ( $input:literal ) => {{ 5 | // We put it into a constant to verify that the computation is constant. 6 | const HASH: u32 = ink::selector_id!($input); 7 | assert_eq!( 8 | HASH, 9 | ir::Selector::compute($input).into_be_u32(), 10 | ); 11 | }}; 12 | } 13 | 14 | fn main() { 15 | assert_macro_eq!(b""); 16 | assert_macro_eq!(b"Hello, World!"); 17 | assert_macro_eq!(b"message"); 18 | assert_macro_eq!(b"constructor"); 19 | } 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/selector_id/pass/no_implicit_prelude.rs: -------------------------------------------------------------------------------- 1 | #![no_implicit_prelude] 2 | 3 | const _: ::core::primitive::u32 = ::ink::selector_id!("test"); 4 | 5 | fn main() {} 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/selector_id/pass/string_input.rs: -------------------------------------------------------------------------------- 1 | use ink_ir as ir; 2 | 3 | macro_rules! assert_macro_eq { 4 | ( $input:literal ) => {{ 5 | // We put it into a constant to verify that the computation is constant. 6 | const HASH: u32 = ink::selector_id!($input); 7 | assert_eq!( 8 | HASH, 9 | ir::Selector::compute($input.as_bytes()).into_be_u32(), 10 | ); 11 | }}; 12 | } 13 | 14 | fn main() { 15 | assert_macro_eq!(""); 16 | assert_macro_eq!("Hello, World!"); 17 | assert_macro_eq!("message"); 18 | assert_macro_eq!("constructor"); 19 | } 20 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/storage_item/fail/argument_derive_invalid_type.rs: -------------------------------------------------------------------------------- 1 | #[ink::storage_item(derive = "false")] 2 | #[derive(Default)] 3 | struct Contract> { 4 | a: u16, 5 | b: u64, 6 | c: u128, 7 | } 8 | 9 | fn main() {} 10 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/storage_item/fail/argument_derive_invalid_type.stderr: -------------------------------------------------------------------------------- 1 | error: expected a bool literal value for `derive` ink! storage item configuration argument 2 | --> tests/ui/storage_item/fail/argument_derive_invalid_type.rs:1:21 3 | | 4 | 1 | #[ink::storage_item(derive = "false")] 5 | | ^^^^^^^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/storage_item/fail/argument_derive_missing_arg.rs: -------------------------------------------------------------------------------- 1 | #[ink::storage_item(derive)] 2 | #[derive(Default)] 3 | struct Contract> { 4 | a: u16, 5 | b: u64, 6 | c: u128, 7 | } 8 | 9 | fn main() {} 10 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/storage_item/fail/argument_derive_missing_arg.stderr: -------------------------------------------------------------------------------- 1 | error: expected a bool literal value for `derive` ink! storage item configuration argument 2 | --> tests/ui/storage_item/fail/argument_derive_missing_arg.rs:1:21 3 | | 4 | 1 | #[ink::storage_item(derive)] 5 | | ^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/storage_item/fail/collections_only_packed_1.rs: -------------------------------------------------------------------------------- 1 | use ink_prelude::vec::Vec; 2 | use ink_storage::Lazy; 3 | 4 | #[ink::storage_item] 5 | struct NonPacked { 6 | a: Lazy, 7 | } 8 | 9 | #[ink::storage_item] 10 | struct Contract { 11 | a: Vec, 12 | } 13 | 14 | fn main() {} 15 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/storage_item/fail/collections_only_packed_2.rs: -------------------------------------------------------------------------------- 1 | use ink_prelude::collections::BTreeMap; 2 | use ink_storage::Lazy; 3 | 4 | #[ink::storage_item] 5 | struct NonPacked { 6 | a: Lazy, 7 | } 8 | 9 | #[ink::storage_item] 10 | struct Contract { 11 | a: BTreeMap, 12 | } 13 | 14 | fn main() {} 15 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/storage_item/fail/double_storage_item.rs: -------------------------------------------------------------------------------- 1 | #[ink::storage_item(derive = false)] 2 | #[ink::storage_item(derive = true)] 3 | #[derive(Default)] 4 | struct Contract> { 5 | a: u16, 6 | b: u64, 7 | c: u128, 8 | } 9 | 10 | fn main() {} 11 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/storage_item/fail/double_storage_item.stderr: -------------------------------------------------------------------------------- 1 | error: only one `ink::storage_item` is allowed 2 | --> tests/ui/storage_item/fail/double_storage_item.rs:2:1 3 | | 4 | 2 | #[ink::storage_item(derive = true)] 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/storage_item/fail/packed_is_not_derived_automatically.rs: -------------------------------------------------------------------------------- 1 | use ink_storage::{ 2 | traits::Packed, 3 | Lazy, 4 | }; 5 | 6 | #[ink::storage_item] 7 | #[derive(Default)] 8 | struct NonPacked { 9 | a: Lazy, 10 | } 11 | 12 | fn consume_packed() {} 13 | 14 | fn main() { 15 | let _ = consume_packed::(); 16 | } 17 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/storage_item/pass/default_storage_key_1.rs: -------------------------------------------------------------------------------- 1 | use ink::storage::traits::{ 2 | ManualKey, 3 | StorageKey, 4 | }; 5 | 6 | #[ink::storage_item] 7 | struct Contract> { 8 | a: u16, 9 | b: u16, 10 | c: u16, 11 | } 12 | 13 | fn main() { 14 | assert_eq!(::KEY, 123); 15 | } 16 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/storage_item/pass/default_storage_key_2.rs: -------------------------------------------------------------------------------- 1 | use ink_storage::{ 2 | traits, 3 | traits::ManualKey, 4 | }; 5 | 6 | #[ink::storage_item] 7 | struct Contract> { 8 | a: u16, 9 | b: u16, 10 | c: u16, 11 | } 12 | 13 | fn main() { 14 | assert_eq!(::KEY, 123); 15 | } 16 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/storage_item/pass/default_storage_key_3.rs: -------------------------------------------------------------------------------- 1 | use ink::storage::traits::ManualKey; 2 | 3 | #[ink::storage_item] 4 | struct Contract> { 5 | a: u16, 6 | b: u16, 7 | c: u16, 8 | } 9 | 10 | fn main() { 11 | assert_eq!(::KEY, 123); 12 | } 13 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/storage_item/pass/default_storage_key_4.rs: -------------------------------------------------------------------------------- 1 | use ink::storage::traits::ManualKey; 2 | 3 | #[ink::storage_item] 4 | struct Contract> { 5 | a: u16, 6 | b: u16, 7 | c: u16, 8 | } 9 | 10 | fn main() { 11 | assert_eq!(::KEY, 123); 12 | } 13 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/storage_item/pass/non_packed_tuple_struct.rs: -------------------------------------------------------------------------------- 1 | use ink_primitives::KeyComposer; 2 | use ink_storage::{ 3 | traits::StorageKey, 4 | Lazy, 5 | Mapping, 6 | }; 7 | 8 | #[ink::storage_item] 9 | #[derive(Default)] 10 | struct Contract(Mapping, Lazy); 11 | 12 | fn main() { 13 | ink_env::test::run_test::(|_| { 14 | let contract = Contract::default(); 15 | assert_eq!(contract.key(), 0); 16 | 17 | assert_eq!(contract.0.key(), KeyComposer::from_str("Contract::0")); 18 | assert_eq!(contract.1.key(), KeyComposer::from_str("Contract::1")); 19 | Ok(()) 20 | }) 21 | .unwrap() 22 | } 23 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/storage_item/pass/packed_tuple_struct.rs: -------------------------------------------------------------------------------- 1 | use ink::storage::traits::Storable; 2 | 3 | #[derive(Default)] 4 | #[cfg_attr(feature = "std", derive(ink::storage::traits::StorageLayout))] 5 | #[ink::scale_derive(Encode, Decode, TypeInfo)] 6 | struct Contract(String, u128); 7 | 8 | fn main() { 9 | let _: Result = Storable::decode(&mut &[][..]); 10 | } 11 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/config_keep_attr_invalid_type.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition(keep_attr = true)] 2 | pub trait TraitDefinition { 3 | #[ink(message)] 4 | fn message(&self); 5 | } 6 | 7 | fn main() {} 8 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/config_keep_attr_invalid_type.stderr: -------------------------------------------------------------------------------- 1 | error: expected a string with attributes separated by `,` 2 | --> tests/ui/trait_def/fail/config_keep_attr_invalid_type.rs:1:25 3 | | 4 | 1 | #[ink::trait_definition(keep_attr = true)] 5 | | ^^^^^^^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/config_keep_attr_missing_arg.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition(keep_attr)] 2 | pub trait TraitDefinition { 3 | #[ink(message)] 4 | fn message(&self); 5 | } 6 | 7 | fn main() {} 8 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/config_keep_attr_missing_arg.stderr: -------------------------------------------------------------------------------- 1 | error: expected a string literal value for `keep_attr` ink! configuration argument 2 | --> tests/ui/trait_def/fail/config_keep_attr_missing_arg.rs:1:25 3 | | 4 | 1 | #[ink::trait_definition(keep_attr)] 5 | | ^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/config_namespace_invalid_1.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition(namespace = "::invalid::rust::identifier")] 2 | pub trait TraitDefinition { 3 | #[ink(message)] 4 | fn message(&self); 5 | } 6 | 7 | fn main() {} 8 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/config_namespace_invalid_1.stderr: -------------------------------------------------------------------------------- 1 | error: encountered invalid Rust identifier for the ink! namespace configuration parameter 2 | --> tests/ui/trait_def/fail/config_namespace_invalid_1.rs:1:37 3 | | 4 | 1 | #[ink::trait_definition(namespace = "::invalid::rust::identifier")] 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/config_namespace_invalid_2.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition(namespace)] 2 | pub trait TraitDefinition { 3 | #[ink(message)] 4 | fn message(&self); 5 | } 6 | 7 | fn main() {} 8 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/config_namespace_invalid_2.stderr: -------------------------------------------------------------------------------- 1 | error: expected a string literal value for `namespace` ink! trait definition configuration argument 2 | --> tests/ui/trait_def/fail/config_namespace_invalid_2.rs:1:25 3 | | 4 | 1 | #[ink::trait_definition(namespace)] 5 | | ^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/config_namespace_invalid_3.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition(namespace = "")] 2 | pub trait TraitDefinition { 3 | #[ink(message)] 4 | fn message(&self); 5 | } 6 | 7 | fn main() {} 8 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/config_namespace_invalid_3.stderr: -------------------------------------------------------------------------------- 1 | error: encountered invalid Rust identifier for the ink! namespace configuration parameter 2 | --> tests/ui/trait_def/fail/config_namespace_invalid_3.rs:1:37 3 | | 4 | 1 | #[ink::trait_definition(namespace = "")] 5 | | ^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/config_namespace_invalid_4.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition(namespace = true)] 2 | pub trait TraitDefinition { 3 | #[ink(message)] 4 | fn message(&self); 5 | } 6 | 7 | fn main() {} 8 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/config_namespace_invalid_4.stderr: -------------------------------------------------------------------------------- 1 | error: expected a string literal value for `namespace` ink! trait definition configuration argument 2 | --> tests/ui/trait_def/fail/config_namespace_invalid_4.rs:1:25 3 | | 4 | 1 | #[ink::trait_definition(namespace = true)] 5 | | ^^^^^^^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/definition_assoc_const.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition] 2 | pub trait TraitDefinition { 3 | const CONST: bool; 4 | 5 | #[ink(message)] 6 | fn message(&self); 7 | } 8 | 9 | fn main() {} 10 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/definition_assoc_const.stderr: -------------------------------------------------------------------------------- 1 | error: associated constants in ink! trait definitions are not supported, yet 2 | --> tests/ui/trait_def/fail/definition_assoc_const.rs:3:5 3 | | 4 | 3 | const CONST: bool; 5 | | ^^^^^^^^^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/definition_assoc_type.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition] 2 | pub trait TraitDefinition { 3 | type Type; 4 | 5 | #[ink(message)] 6 | fn message(&self); 7 | } 8 | 9 | fn main() {} 10 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/definition_assoc_type.stderr: -------------------------------------------------------------------------------- 1 | error: associated types in ink! trait definitions are not supported, yet 2 | --> tests/ui/trait_def/fail/definition_assoc_type.rs:3:5 3 | | 4 | 3 | type Type; 5 | | ^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/definition_constructor.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition] 2 | pub trait TraitDefinition { 3 | #[ink(constructor)] 4 | fn constructor() -> Self; 5 | } 6 | 7 | fn main() {} 8 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/definition_constructor.stderr: -------------------------------------------------------------------------------- 1 | error: ink! trait definitions must not have constructors 2 | --> tests/ui/trait_def/fail/definition_constructor.rs:3:5 3 | | 4 | 3 | / #[ink(constructor)] 5 | 4 | | fn constructor() -> Self; 6 | | |_____________________________^ 7 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/definition_empty.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition] 2 | pub trait TraitDefinition {} 3 | 4 | fn main() {} 5 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/definition_empty.stderr: -------------------------------------------------------------------------------- 1 | error: encountered invalid empty ink! trait definition 2 | --> tests/ui/trait_def/fail/definition_empty.rs:2:1 3 | | 4 | 2 | pub trait TraitDefinition {} 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/definition_generic.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition] 2 | pub trait TraitDefinition { 3 | #[ink(message)] 4 | fn message(&self); 5 | } 6 | 7 | fn main() {} 8 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/definition_generic.stderr: -------------------------------------------------------------------------------- 1 | error: ink! trait definitions must not be generic 2 | --> tests/ui/trait_def/fail/definition_generic.rs:2:27 3 | | 4 | 2 | pub trait TraitDefinition { 5 | | ^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/definition_non_pub.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition] 2 | trait TraitDefinition { 3 | #[ink(message)] 4 | fn message(&self); 5 | } 6 | 7 | fn main() {} 8 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/definition_non_pub.stderr: -------------------------------------------------------------------------------- 1 | error: ink! trait definitions must have public visibility 2 | --> tests/ui/trait_def/fail/definition_non_pub.rs:1:1 3 | | 4 | 1 | #[ink::trait_definition] 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^ 6 | | 7 | = note: this error originates in the attribute macro `ink::trait_definition` (in Nightly builds, run with -Z macro-backtrace for more info) 8 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/definition_rust_method.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition] 2 | pub trait TraitDefinition { 3 | fn rust_method(&self); 4 | } 5 | 6 | fn main() {} 7 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/definition_rust_method.stderr: -------------------------------------------------------------------------------- 1 | error: missing #[ink(message)] or #[ink(constructor)] flags on ink! trait method 2 | --> tests/ui/trait_def/fail/definition_rust_method.rs:3:5 3 | | 4 | 3 | fn rust_method(&self); 5 | | ^^^^^^^^^^^^^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/definition_super_trait_invalid_1.rs: -------------------------------------------------------------------------------- 1 | pub trait SuperTraitDefinition {} 2 | 3 | #[ink::trait_definition] 4 | pub trait TraitDefinition: SuperTraitDefinition { 5 | #[ink(message)] 6 | fn message(&self); 7 | } 8 | 9 | fn main() {} 10 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/definition_super_trait_invalid_1.stderr: -------------------------------------------------------------------------------- 1 | error: ink! trait definitions with supertraits are not supported, yet 2 | --> tests/ui/trait_def/fail/definition_super_trait_invalid_1.rs:4:28 3 | | 4 | 4 | pub trait TraitDefinition: SuperTraitDefinition { 5 | | ^^^^^^^^^^^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/definition_super_trait_invalid_2.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition] 2 | pub trait SuperTraitDefinition { 3 | #[ink(message)] 4 | fn super_message(&self); 5 | } 6 | 7 | #[ink::trait_definition] 8 | pub trait TraitDefinition: SuperTraitDefinition { 9 | #[ink(message)] 10 | fn message(&self); 11 | } 12 | 13 | fn main() {} 14 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/definition_super_trait_invalid_2.stderr: -------------------------------------------------------------------------------- 1 | error: ink! trait definitions with supertraits are not supported, yet 2 | --> tests/ui/trait_def/fail/definition_super_trait_invalid_2.rs:8:28 3 | | 4 | 8 | pub trait TraitDefinition: SuperTraitDefinition { 5 | | ^^^^^^^^^^^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/definition_unsafe.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition] 2 | pub unsafe trait TraitDefinition { 3 | #[ink(message)] 4 | fn message(&self); 5 | } 6 | 7 | fn main() {} 8 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/definition_unsafe.stderr: -------------------------------------------------------------------------------- 1 | error: ink! trait definitions cannot be unsafe 2 | --> tests/ui/trait_def/fail/definition_unsafe.rs:2:5 3 | | 4 | 2 | pub unsafe trait TraitDefinition { 5 | | ^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_abi_invalid.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition] 2 | pub trait TraitDefinition { 3 | #[ink(message)] 4 | extern "C" fn message_ref(&self); 5 | 6 | #[ink(message)] 7 | extern "C" fn message_mut(&mut self); 8 | } 9 | 10 | fn main() {} 11 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_abi_invalid.stderr: -------------------------------------------------------------------------------- 1 | error: ink! trait methods with non default ABI are not supported 2 | --> tests/ui/trait_def/fail/message_abi_invalid.rs:4:5 3 | | 4 | 4 | extern "C" fn message_ref(&self); 5 | | ^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_async_invalid.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition] 2 | pub trait TraitDefinition { 3 | #[ink(message)] 4 | async fn message_ref(&self); 5 | 6 | #[ink(message)] 7 | async fn message_mut(&mut self); 8 | } 9 | 10 | fn main() {} 11 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_async_invalid.stderr: -------------------------------------------------------------------------------- 1 | error: async ink! trait methods are not supported 2 | --> tests/ui/trait_def/fail/message_async_invalid.rs:4:5 3 | | 4 | 4 | async fn message_ref(&self); 5 | | ^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_const_invalid.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition] 2 | pub trait TraitDefinition { 3 | #[ink(message)] 4 | const fn message_ref(&self); 5 | 6 | #[ink(message)] 7 | const fn message_mut(&mut self); 8 | } 9 | 10 | fn main() {} 11 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_const_invalid.stderr: -------------------------------------------------------------------------------- 1 | error: const ink! trait methods are not supported 2 | --> tests/ui/trait_def/fail/message_const_invalid.rs:4:5 3 | | 4 | 4 | const fn message_ref(&self); 5 | | ^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_constructor_conflict.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition] 2 | pub trait TraitDefinition { 3 | #[ink(message, constructor)] 4 | fn message(&self); 5 | } 6 | 7 | fn main() {} 8 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_constructor_conflict.stderr: -------------------------------------------------------------------------------- 1 | error: encountered conflicting ink! attribute argument 2 | --> tests/ui/trait_def/fail/message_constructor_conflict.rs:3:20 3 | | 4 | 3 | #[ink(message, constructor)] 5 | | ^^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_default_impl.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition] 2 | pub trait TraitDefinition { 3 | #[ink(message)] 4 | fn message(&self) {} 5 | } 6 | 7 | fn main() {} 8 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_default_impl.stderr: -------------------------------------------------------------------------------- 1 | error: ink! trait methods with default implementations are not supported 2 | --> tests/ui/trait_def/fail/message_default_impl.rs:4:23 3 | | 4 | 4 | fn message(&self) {} 5 | | ^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_generic_invalid.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition] 2 | pub trait TraitDefinition { 3 | #[ink(message)] 4 | fn message_ref(&self); 5 | 6 | #[ink(message)] 7 | fn message_mut(&mut self); 8 | } 9 | 10 | fn main() {} 11 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_generic_invalid.stderr: -------------------------------------------------------------------------------- 1 | error: generic ink! trait methods are not supported 2 | --> tests/ui/trait_def/fail/message_generic_invalid.rs:4:20 3 | | 4 | 4 | fn message_ref(&self); 5 | | ^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_input_non_codec.rs: -------------------------------------------------------------------------------- 1 | pub struct NonCodec; 2 | 3 | #[ink::trait_definition] 4 | pub trait TraitDefinition { 5 | #[ink(message)] 6 | fn message(&self, input: NonCodec); 7 | } 8 | 9 | fn main() {} 10 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_input_pattern_invalid.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition] 2 | pub trait TraitDefinition { 3 | #[ink(message)] 4 | fn message(&self, (a, b): (i32, i32)); 5 | } 6 | 7 | fn main() {} 8 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_input_pattern_invalid.stderr: -------------------------------------------------------------------------------- 1 | error[E0642]: patterns aren't allowed in functions without bodies 2 | --> tests/ui/trait_def/fail/message_input_pattern_invalid.rs:4:23 3 | | 4 | 4 | fn message(&self, (a, b): (i32, i32)); 5 | | ^^^^^^ pattern not allowed in function without body 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_output_non_codec.rs: -------------------------------------------------------------------------------- 1 | pub struct NonCodec; 2 | 3 | #[ink::trait_definition] 4 | pub trait TraitDefinition { 5 | #[ink(message)] 6 | fn message(&self) -> NonCodec; 7 | } 8 | 9 | fn main() {} 10 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_payable_invalid_1.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition] 2 | pub trait TraitDefinition { 3 | #[ink(message, payable = false)] 4 | fn message(&self); 5 | } 6 | 7 | fn main() {} 8 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_payable_invalid_1.stderr: -------------------------------------------------------------------------------- 1 | error: encountered unknown ink! attribute argument: payable 2 | --> tests/ui/trait_def/fail/message_payable_invalid_1.rs:3:20 3 | | 4 | 3 | #[ink(message, payable = false)] 5 | | ^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_payable_invalid_2.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition] 2 | pub trait TraitDefinition { 3 | #[ink(message, payable = true)] 4 | fn message(&self); 5 | } 6 | 7 | fn main() {} 8 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_payable_invalid_2.stderr: -------------------------------------------------------------------------------- 1 | error: encountered unknown ink! attribute argument: payable 2 | --> tests/ui/trait_def/fail/message_payable_invalid_2.rs:3:20 3 | | 4 | 3 | #[ink(message, payable = true)] 5 | | ^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_receiver_invalid_1.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition] 2 | pub trait TraitDefinition { 3 | #[ink(message)] 4 | fn message(); 5 | } 6 | 7 | fn main() {} 8 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_receiver_invalid_1.stderr: -------------------------------------------------------------------------------- 1 | error: missing `&self` or `&mut self` receiver for ink! message 2 | --> tests/ui/trait_def/fail/message_receiver_invalid_1.rs:4:5 3 | | 4 | 4 | fn message(); 5 | | ^^^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_receiver_invalid_2.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition] 2 | pub trait TraitDefinition { 3 | #[ink(message)] 4 | fn message(this: Self); 5 | } 6 | 7 | fn main() {} 8 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_receiver_invalid_2.stderr: -------------------------------------------------------------------------------- 1 | error: missing `&self` or `&mut self` receiver for ink! message 2 | --> tests/ui/trait_def/fail/message_receiver_invalid_2.rs:4:5 3 | | 4 | 4 | fn message(this: Self); 5 | | ^^^^^^^^^^^^^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_receiver_invalid_3.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition] 2 | pub trait TraitDefinition { 3 | #[ink(message)] 4 | fn message(this: &Self); 5 | } 6 | 7 | fn main() {} 8 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_receiver_invalid_3.stderr: -------------------------------------------------------------------------------- 1 | error: missing `&self` or `&mut self` receiver for ink! message 2 | --> tests/ui/trait_def/fail/message_receiver_invalid_3.rs:4:5 3 | | 4 | 4 | fn message(this: &Self); 5 | | ^^^^^^^^^^^^^^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_receiver_missing.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition] 2 | pub trait TraitDefinition { 3 | #[ink(message)] 4 | fn message(); 5 | } 6 | 7 | fn main() {} 8 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_receiver_missing.stderr: -------------------------------------------------------------------------------- 1 | error: missing `&self` or `&mut self` receiver for ink! message 2 | --> tests/ui/trait_def/fail/message_receiver_missing.rs:4:5 3 | | 4 | 4 | fn message(); 5 | | ^^^^^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_selector_invalid_1.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition] 2 | pub trait TraitDefinition { 3 | #[ink(message, selector = true)] 4 | fn message(&self); 5 | } 6 | 7 | fn main() {} 8 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_selector_invalid_1.stderr: -------------------------------------------------------------------------------- 1 | error: expected 4-digit hexcode for `selector` argument, e.g. #[ink(selector = 0xC0FEBABE] 2 | --> tests/ui/trait_def/fail/message_selector_invalid_1.rs:3:31 3 | | 4 | 3 | #[ink(message, selector = true)] 5 | | ^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_selector_invalid_2.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition] 2 | pub trait TraitDefinition { 3 | #[ink(message, selector)] 4 | fn message(&self); 5 | } 6 | 7 | fn main() {} 8 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_selector_invalid_2.stderr: -------------------------------------------------------------------------------- 1 | error: encountered #[ink(selector)] that is missing its u32 parameter. Did you mean #[ink(selector = value: u32)] ? 2 | --> tests/ui/trait_def/fail/message_selector_invalid_2.rs:3:20 3 | | 4 | 3 | #[ink(message, selector)] 5 | | ^^^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_selector_overlap.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition] 2 | pub trait TraitDefinition { 3 | #[ink(message, selector = 1)] 4 | fn message_1(&self); 5 | 6 | #[ink(message, selector = 1)] 7 | fn message_2(&self); 8 | } 9 | 10 | fn main() {} 11 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_selector_overlap.stderr: -------------------------------------------------------------------------------- 1 | error: encountered duplicate selector ([0, 0, 0, 1]) in the same ink! trait definition 2 | --> tests/ui/trait_def/fail/message_selector_overlap.rs:7:8 3 | | 4 | 7 | fn message_2(&self); 5 | | ^^^^^^^^^ 6 | 7 | error: first ink! trait constructor or message with same selector found here 8 | --> tests/ui/trait_def/fail/message_selector_overlap.rs:4:8 9 | | 10 | 4 | fn message_1(&self); 11 | | ^^^^^^^^^ 12 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_unsafe_invalid.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition] 2 | pub trait TraitDefinition { 3 | #[ink(message)] 4 | unsafe fn message_ref(&self); 5 | 6 | #[ink(message)] 7 | unsafe fn message_mut(&mut self); 8 | } 9 | 10 | fn main() {} 11 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/fail/message_unsafe_invalid.stderr: -------------------------------------------------------------------------------- 1 | error: unsafe ink! trait methods are not supported 2 | --> tests/ui/trait_def/fail/message_unsafe_invalid.rs:4:5 3 | | 4 | 4 | unsafe fn message_ref(&self); 5 | | ^^^^^^ 6 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/pass/many_outputs.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition] 2 | pub trait ManyOutputs { 3 | #[ink(message)] 4 | fn output0(&self); 5 | #[ink(message)] 6 | fn output0_mut(&mut self); 7 | 8 | #[ink(message)] 9 | fn output1(&self) -> i8; 10 | #[ink(message)] 11 | fn output1_mut(&mut self) -> i8; 12 | 13 | #[ink(message)] 14 | fn output2(&self) -> (i8, i16); 15 | #[ink(message)] 16 | fn output2_mut(&mut self) -> (i8, i16); 17 | 18 | #[ink(message)] 19 | fn output3(&self) -> (i8, i16, i32); 20 | #[ink(message)] 21 | fn output3_mut(&mut self) -> (i8, i16, i32); 22 | 23 | #[ink(message)] 24 | fn output4(&self) -> (i8, i16, i32, i64); 25 | #[ink(message)] 26 | fn output4_mut(&mut self) -> (i8, i16, i32, i64); 27 | } 28 | 29 | fn main() {} 30 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/pass/simple_definition.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition] 2 | pub trait TraitDefinition { 3 | #[ink(message)] 4 | fn message(&self); 5 | #[ink(message)] 6 | fn message_mut(&mut self); 7 | } 8 | 9 | fn main() {} 10 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/pass/using-env-types.rs: -------------------------------------------------------------------------------- 1 | use ink::env::ContractEnv; 2 | use ink_env::Environment; 3 | 4 | #[ink::trait_definition] 5 | pub trait TraitDefinition { 6 | #[ink(message)] 7 | fn message_1(&self) -> <::Env as Environment>::AccountId; 8 | #[ink(message)] 9 | fn message_2(&self, input: <::Env as Environment>::Balance); 10 | } 11 | 12 | fn main() {} 13 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/pass/with_keep_attr.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition(keep_attr = "foo, bar")] 2 | pub trait WithKeepAttr { 3 | #[ink(message)] 4 | #[allow(non_snake_case)] 5 | fn meSSage(&self); 6 | } 7 | 8 | fn main() {} 9 | -------------------------------------------------------------------------------- /crates/ink/tests/ui/trait_def/pass/with_namespace.rs: -------------------------------------------------------------------------------- 1 | #[ink::trait_definition(namespace = "my_trait_namespace")] 2 | pub trait WithNamespace { 3 | #[ink(message)] 4 | fn message(&self); 5 | } 6 | 7 | fn main() {} 8 | -------------------------------------------------------------------------------- /crates/metadata/LICENSE: -------------------------------------------------------------------------------- 1 | ../../LICENSE -------------------------------------------------------------------------------- /crates/prelude/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ink_prelude" 3 | version.workspace = true 4 | authors = ["Use Ink "] 5 | edition.workspace = true 6 | 7 | license.workspace = true 8 | readme = "README.md" 9 | repository.workspace = true 10 | documentation = "https://docs.rs/ink_prelude/" 11 | homepage.workspace = true 12 | description = "[ink!] Common API for no_std and std to access alloc crate types." 13 | keywords.workspace = true 14 | categories.workspace = true 15 | include = ["/Cargo.toml", "src/**/*.rs", "/README.md", "/LICENSE"] 16 | 17 | [dependencies] 18 | cfg-if = { workspace = true } 19 | 20 | [features] 21 | default = [ "std" ] 22 | std = [] 23 | -------------------------------------------------------------------------------- /crates/prelude/LICENSE: -------------------------------------------------------------------------------- 1 | ../../LICENSE -------------------------------------------------------------------------------- /crates/prelude/README.md: -------------------------------------------------------------------------------- 1 | ../../README.md -------------------------------------------------------------------------------- /crates/primitives/LICENSE: -------------------------------------------------------------------------------- 1 | ../../LICENSE -------------------------------------------------------------------------------- /crates/primitives/README.md: -------------------------------------------------------------------------------- 1 | ../../README.md -------------------------------------------------------------------------------- /crates/storage/LICENSE: -------------------------------------------------------------------------------- 1 | ../../LICENSE -------------------------------------------------------------------------------- /crates/storage/README.md: -------------------------------------------------------------------------------- 1 | ../../README.md -------------------------------------------------------------------------------- /crates/storage/traits/LICENSE: -------------------------------------------------------------------------------- 1 | ../../../LICENSE -------------------------------------------------------------------------------- /crates/storage/traits/README.md: -------------------------------------------------------------------------------- 1 | ../../../README.md -------------------------------------------------------------------------------- /integration-tests/.gitignore: -------------------------------------------------------------------------------- 1 | **/target/ 2 | Cargo.lock 3 | -------------------------------------------------------------------------------- /integration-tests/internal/call-builder-return-value/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "call_builder_return_value" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false } 10 | 11 | incrementer = { path = "../../public/incrementer", default-features = false, features = ["ink-as-dependency"] } 12 | 13 | [dev-dependencies] 14 | ink_e2e = { path = "../../../crates/e2e" } 15 | 16 | [lib] 17 | path = "lib.rs" 18 | 19 | [features] 20 | default = ["std"] 21 | std = [ 22 | "ink/std", 23 | 24 | "incrementer/std", 25 | ] 26 | ink-as-dependency = [] 27 | e2e-tests = [] 28 | -------------------------------------------------------------------------------- /integration-tests/internal/e2e-runtime-only-backend/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "e2e-runtime-only-backend" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false, features = ["unstable-hostfn"] } 10 | 11 | [dev-dependencies] 12 | ink_e2e = { path = "../../../crates/e2e", features = ["sandbox"] } 13 | 14 | [lib] 15 | path = "lib.rs" 16 | 17 | [features] 18 | default = ["std"] 19 | std = [ 20 | "ink/std", 21 | ] 22 | ink-as-dependency = [] 23 | e2e-tests = [] 24 | -------------------------------------------------------------------------------- /integration-tests/internal/lang-err/call-builder-delegate/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "call_builder_delegate" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../../crates/ink", default-features = false } 10 | 11 | incrementer = { path = "../../../public/incrementer", default-features = false, features = ["ink-as-dependency"] } 12 | 13 | [dev-dependencies] 14 | ink_e2e = { path = "../../../../crates/e2e" } 15 | 16 | [lib] 17 | path = "lib.rs" 18 | 19 | [features] 20 | default = ["std"] 21 | std = [ 22 | "ink/std", 23 | 24 | "incrementer/std", 25 | ] 26 | ink-as-dependency = [] 27 | e2e-tests = [] 28 | -------------------------------------------------------------------------------- /integration-tests/internal/lang-err/constructors-return-value/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "constructors_return_value" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../../crates/ink", default-features = false } 10 | 11 | [dev-dependencies] 12 | ink_e2e = { path = "../../../../crates/e2e" } 13 | 14 | [lib] 15 | path = "lib.rs" 16 | 17 | [features] 18 | default = ["std"] 19 | std = [ 20 | "ink/std", 21 | ] 22 | ink-as-dependency = [] 23 | e2e-tests = [] 24 | -------------------------------------------------------------------------------- /integration-tests/internal/lang-err/contract-ref/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "contract_ref" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | 7 | [dependencies] 8 | ink = { path = "../../../../crates/ink", default-features = false, features = ["unstable-hostfn"] } 9 | 10 | integration_flipper = { path = "../integration-flipper", default-features = false, features = ["ink-as-dependency"] } 11 | 12 | [dev-dependencies] 13 | ink_e2e = { path = "../../../../crates/e2e" } 14 | 15 | [lib] 16 | path = "lib.rs" 17 | 18 | [features] 19 | default = ["std"] 20 | std = [ 21 | "ink/std", 22 | 23 | "integration_flipper/std", 24 | ] 25 | ink-as-dependency = [] 26 | e2e-tests = [] 27 | -------------------------------------------------------------------------------- /integration-tests/internal/lang-err/integration-flipper/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "integration_flipper" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../../crates/ink", default-features = false } 10 | 11 | [dev-dependencies] 12 | ink_e2e = { path = "../../../../crates/e2e" } 13 | 14 | [lib] 15 | path = "lib.rs" 16 | 17 | [features] 18 | default = ["std"] 19 | std = [ 20 | "ink/std", 21 | ] 22 | ink-as-dependency = [] 23 | e2e-tests = [] 24 | -------------------------------------------------------------------------------- /integration-tests/internal/mapping/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "mapping" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false, features = ["unstable-hostfn"] } 10 | 11 | [dev-dependencies] 12 | ink_e2e = { path = "../../../crates/e2e" } 13 | 14 | [lib] 15 | path = "lib.rs" 16 | doctest = false 17 | 18 | [features] 19 | default = ["std"] 20 | std = [ 21 | "ink/std", 22 | ] 23 | ink-as-dependency = [] 24 | e2e-tests = [] 25 | -------------------------------------------------------------------------------- /integration-tests/internal/mother/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "mother" 3 | description = "Mother of all contracts" 4 | version = "6.0.0-alpha" 5 | authors = ["Use Ink "] 6 | edition = "2021" 7 | publish = false 8 | 9 | [dependencies] 10 | ink = { path = "../../../crates/ink", default-features = false, features = ["unstable-hostfn"] } 11 | 12 | [dev-dependencies] 13 | ink_e2e = { path = "../../../crates/e2e" } 14 | 15 | [lib] 16 | path = "lib.rs" 17 | 18 | [features] 19 | default = ["std"] 20 | std = [ 21 | "ink/std", 22 | ] 23 | ink-as-dependency = [] 24 | -------------------------------------------------------------------------------- /integration-tests/internal/sr25519-verification/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "sr25519_verification" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false, features = ["unstable-hostfn"] } 10 | 11 | [dev-dependencies] 12 | ink_e2e = { path = "../../../crates/e2e" } 13 | 14 | [lib] 15 | path = "lib.rs" 16 | 17 | [features] 18 | default = ["std"] 19 | std = [ 20 | "ink/std", 21 | ] 22 | ink-as-dependency = [] 23 | e2e-tests = [] 24 | -------------------------------------------------------------------------------- /integration-tests/internal/static-buffer/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "static-buffer" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false } 10 | 11 | [dev-dependencies] 12 | ink_e2e = { path = "../../../crates/e2e" } 13 | 14 | [lib] 15 | path = "lib.rs" 16 | doctest = false 17 | 18 | [features] 19 | default = ["std"] 20 | std = [ 21 | "ink/std", 22 | ] 23 | ink-as-dependency = [] 24 | e2e-tests = [] 25 | -------------------------------------------------------------------------------- /integration-tests/internal/static-buffer/README.md: -------------------------------------------------------------------------------- 1 | # Static buffer configuration demo 2 | 3 | This is a dummy contract illustrating how the [static buffer](/ARCHITECTURE.md#communication-with-the-pallet) 4 | can be configured using the environmental variables. 5 | 6 | Simply, run: 7 | ```bash 8 | cargo clean 9 | INK_STATIC_BUFFER_SIZE=32 cargo test -F e2e-tests 10 | ``` 11 | 12 | This will configure the buffer to have enough space to instantiate the contract, 13 | but not enough space to retrieve two times the caller's address as it is of 40 bytes, 14 | but we only allocated 32 bytes to the contract. 15 | 16 | ## Note 17 | You must run `cargo clean` every time you want to modify the buffer size 18 | because the value is baked into the binaries. 19 | -------------------------------------------------------------------------------- /integration-tests/internal/storage-types/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "storage-types" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false } 10 | 11 | [dev-dependencies] 12 | ink_e2e = { path = "../../../crates/e2e" } 13 | 14 | [lib] 15 | path = "lib.rs" 16 | 17 | [features] 18 | default = ["std"] 19 | std = [ 20 | "ink/std", 21 | ] 22 | ink-as-dependency = [] 23 | -------------------------------------------------------------------------------- /integration-tests/public/complex-storage-structures/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "complex_storage_structures" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false } 10 | # todo remove scale, use ink::scale 11 | scale = { package = "parity-scale-codec", version = "3.7.4", default-features = false, features = ["derive"] } 12 | scale-info = { version = "2.11", default-features = false } 13 | 14 | [dev-dependencies] 15 | ink_e2e = { path = "../../../crates/e2e" } 16 | 17 | [lib] 18 | path = "lib.rs" 19 | 20 | [features] 21 | default = ["std"] 22 | std = [ 23 | "ink/std", 24 | ] 25 | ink-as-dependency = [] 26 | e2e-tests = [] 27 | -------------------------------------------------------------------------------- /integration-tests/public/conditional-compilation/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "conditional-compilation" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | 7 | [dependencies] 8 | ink = { path = "../../../crates/ink", default-features = false, features = ["unstable-hostfn"] } 9 | 10 | [dev-dependencies] 11 | ink_e2e = { path = "../../../crates/e2e" } 12 | 13 | [lib] 14 | path = "lib.rs" 15 | 16 | [features] 17 | default = ["std"] 18 | std = [ 19 | "ink/std", 20 | ] 21 | ink-as-dependency = [] 22 | e2e-tests = [] 23 | # user-defined features 24 | foo = [] 25 | bar = [] 26 | -------------------------------------------------------------------------------- /integration-tests/public/contract-invocation/contract1/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "contract1" 3 | version = "0.1.0" 4 | edition = "2021" 5 | authors = ["Víctor M. González "] 6 | 7 | [lib] 8 | path = "lib.rs" 9 | 10 | [features] 11 | default = ["std"] 12 | std = ["ink/std"] 13 | ink-as-dependency = [] 14 | e2e-tests = [] 15 | 16 | [dependencies] 17 | ink = { path = "../../../../crates/ink", default-features = false } 18 | 19 | [dev-dependencies] 20 | ink_e2e = { path = "../../../../crates/e2e" } 21 | 22 | [profile.dev] 23 | overflow-checks = false 24 | 25 | [profile.release] 26 | overflow-checks = false 27 | -------------------------------------------------------------------------------- /integration-tests/public/contract-invocation/contract2/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "contract2" 3 | version = "0.1.0" 4 | edition = "2021" 5 | authors = ["Víctor M. González "] 6 | 7 | [lib] 8 | path = "lib.rs" 9 | 10 | [features] 11 | default = ["std"] 12 | std = ["ink/std"] 13 | ink-as-dependency = [] 14 | e2e-tests = [] 15 | 16 | [dependencies] 17 | ink = { path = "../../../../crates/ink", default-features = false } 18 | 19 | [dev-dependencies] 20 | ink_e2e = { path = "../../../../crates/e2e" } 21 | 22 | [profile.dev] 23 | overflow-checks = false 24 | 25 | [profile.release] 26 | overflow-checks = false 27 | -------------------------------------------------------------------------------- /integration-tests/public/contract-invocation/virtual_contract/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "virtual_contract" 3 | version = "0.1.0" 4 | edition = "2021" 5 | authors = ["Víctor M. González "] 6 | 7 | [lib] 8 | path = "lib.rs" 9 | 10 | [features] 11 | default = ["std"] 12 | std = ["ink/std"] 13 | ink-as-dependency = [] 14 | e2e-tests = [] 15 | 16 | [dependencies] 17 | ink = { path = "../../../../crates/ink", default-features = false } 18 | 19 | [dev-dependencies] 20 | ink_e2e = { path = "../../../../crates/e2e" } 21 | 22 | [profile.dev] 23 | overflow-checks = false 24 | 25 | [profile.release] 26 | overflow-checks = false 27 | -------------------------------------------------------------------------------- /integration-tests/public/contract-invocation/virtual_contract_ver1/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "virtual_contract_ver1" 3 | version = "0.1.0" 4 | edition = "2021" 5 | authors = ["Víctor M. González "] 6 | 7 | [lib] 8 | path = "lib.rs" 9 | 10 | [features] 11 | default = ["std"] 12 | std = ["ink/std"] 13 | ink-as-dependency = [] 14 | e2e-tests = [] 15 | 16 | [dependencies] 17 | ink = { path = "../../../../crates/ink", default-features = false } 18 | 19 | [dev-dependencies] 20 | ink_e2e = { path = "../../../../crates/e2e" } 21 | 22 | [profile.dev] 23 | overflow-checks = false 24 | 25 | [profile.release] 26 | overflow-checks = false 27 | -------------------------------------------------------------------------------- /integration-tests/public/contract-invocation/virtual_contract_ver2/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "virtual_contract_ver2" 3 | version = "0.1.0" 4 | edition = "2021" 5 | authors = ["Víctor M. González "] 6 | 7 | [lib] 8 | path = "lib.rs" 9 | 10 | [dependencies] 11 | ink = { path = "../../../../crates/ink", default-features = false } 12 | 13 | [dev-dependencies] 14 | ink_e2e = { path = "../../../../crates/e2e" } 15 | 16 | [profile.dev] 17 | overflow-checks = false 18 | 19 | [profile.release] 20 | overflow-checks = false 21 | 22 | [features] 23 | default = ["std"] 24 | std = ["ink/std"] 25 | ink-as-dependency = [] 26 | e2e-tests = [] 27 | 28 | -------------------------------------------------------------------------------- /integration-tests/public/contract-storage/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "contract-storage" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false, features = ["unstable-hostfn"] } 10 | 11 | [dev-dependencies] 12 | ink_e2e = { path = "../../../crates/e2e" } 13 | 14 | [lib] 15 | path = "lib.rs" 16 | 17 | [features] 18 | default = ["std"] 19 | std = [ 20 | "ink/std", 21 | ] 22 | ink-as-dependency = [] 23 | e2e-tests = [] 24 | -------------------------------------------------------------------------------- /integration-tests/public/contract-terminate/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "contract_terminate" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false, features = ["unstable-hostfn"] } 10 | 11 | [dev-dependencies] 12 | ink_e2e = { path = "../../../crates/e2e" } 13 | 14 | [lib] 15 | path = "lib.rs" 16 | 17 | [features] 18 | default = ["std"] 19 | std = [ 20 | "ink/std", 21 | ] 22 | 23 | ink-as-dependency = [] 24 | e2e-tests = [] 25 | -------------------------------------------------------------------------------- /integration-tests/public/contract-transfer/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "contract_transfer" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false, features = ["unstable-hostfn"] } 10 | 11 | [dev-dependencies] 12 | #ink_e2e = { path = "../../../crates/e2e" } 13 | ink_e2e = { path = "../../../crates/e2e", features = ["sandbox"] } 14 | 15 | [lib] 16 | path = "lib.rs" 17 | 18 | [features] 19 | default = ["std"] 20 | std = [ 21 | "ink/std", 22 | ] 23 | ink-as-dependency = [] 24 | e2e-tests = [] 25 | -------------------------------------------------------------------------------- /integration-tests/public/contract-xcm/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "contract-xcm" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false, features = ["unstable-hostfn"] } 10 | frame-support = { version = "40.1.0", default-features = false } 11 | pallet-balances = { version = "41.1.0", default-features = false } 12 | 13 | [dev-dependencies] 14 | ink_e2e = { path = "../../../crates/e2e", features = ["sandbox"] } 15 | 16 | [lib] 17 | path = "lib.rs" 18 | 19 | [features] 20 | default = ["std"] 21 | std = [ 22 | "ink/std", 23 | "pallet-balances/std", 24 | "frame-support/std", 25 | ] 26 | ink-as-dependency = [] 27 | e2e-tests = [] 28 | -------------------------------------------------------------------------------- /integration-tests/public/cross-contract-calls/other-contract/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "other-contract" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../../crates/ink", default-features = false } 10 | pallet-revive-uapi = { version = "0.4.0", default-features = false, features = ["unstable-hostfn"] } 11 | 12 | [dev-dependencies] 13 | ink_e2e = { path = "../../../../crates/e2e" } 14 | 15 | [lib] 16 | path = "lib.rs" 17 | 18 | [features] 19 | default = ["std"] 20 | std = [ 21 | "ink/std", 22 | ] 23 | ink-as-dependency = [] 24 | e2e-tests = [] 25 | -------------------------------------------------------------------------------- /integration-tests/public/cross-contract-calls/other-contract/lib.rs: -------------------------------------------------------------------------------- 1 | #![cfg_attr(not(feature = "std"), no_std, no_main)] 2 | 3 | pub use self::other_contract::{ 4 | OtherContract, 5 | OtherContractRef, 6 | }; 7 | 8 | #[ink::contract] 9 | mod other_contract { 10 | 11 | #[ink(storage)] 12 | pub struct OtherContract { 13 | value: bool, 14 | } 15 | 16 | impl OtherContract { 17 | #[ink(constructor)] 18 | pub fn new(init_value: bool) -> Self { 19 | Self { value: init_value } 20 | } 21 | 22 | #[ink(message)] 23 | pub fn flip(&mut self) { 24 | self.value = !self.value; 25 | } 26 | 27 | #[ink(message)] 28 | pub fn get(&self) -> bool { 29 | self.value 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /integration-tests/public/custom-environment/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "custom-environment" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false, features = ["unstable-hostfn"] } 10 | 11 | [dev-dependencies] 12 | ink_e2e = { path = "../../../crates/e2e" } 13 | 14 | [lib] 15 | path = "lib.rs" 16 | 17 | [features] 18 | default = ["std"] 19 | std = [ 20 | "ink/std", 21 | ] 22 | ink-as-dependency = [] 23 | e2e-tests = [] 24 | 25 | # Assumes that the node used in E2E testing allows for at least 6 event topics. 26 | permissive-node = [] 27 | -------------------------------------------------------------------------------- /integration-tests/public/debugging-strategies/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "debugging_strategies" 3 | description = "Illustrates different debugging strategies" 4 | version = "6.0.0-alpha" 5 | authors = ["Use Ink "] 6 | edition = "2021" 7 | publish = false 8 | 9 | [dependencies] 10 | ink = { path = "../../../crates/ink", default-features = false, features = ["unstable-hostfn"] } 11 | 12 | [dev-dependencies] 13 | ink_e2e = { path = "../../../crates/e2e" } 14 | 15 | [lib] 16 | path = "lib.rs" 17 | 18 | [features] 19 | default = ["std"] 20 | std = [ 21 | "ink/std", 22 | ] 23 | ink-as-dependency = [] 24 | e2e-tests = [] 25 | debug = [] 26 | -------------------------------------------------------------------------------- /integration-tests/public/dns/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "dns" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false, features = ["unstable-hostfn"] } 10 | 11 | [lib] 12 | path = "lib.rs" 13 | 14 | [features] 15 | default = ["std"] 16 | std = [ 17 | "ink/std", 18 | ] 19 | ink-as-dependency = [] 20 | -------------------------------------------------------------------------------- /integration-tests/public/e2e-call-runtime/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "e2e_call_runtime" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false, features = ["unstable-hostfn"] } 10 | 11 | [dev-dependencies] 12 | ink_e2e = { path = "../../../crates/e2e" } 13 | 14 | [lib] 15 | path = "lib.rs" 16 | 17 | [features] 18 | default = ["std"] 19 | std = [ 20 | "ink/std", 21 | ] 22 | ink-as-dependency = [] 23 | e2e-tests = [] 24 | -------------------------------------------------------------------------------- /integration-tests/public/erc1155/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "erc1155" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false, features = ["unstable-hostfn"] } 10 | 11 | [lib] 12 | path = "lib.rs" 13 | 14 | [features] 15 | default = ["std"] 16 | std = [ 17 | "ink/std", 18 | ] 19 | ink-as-dependency = [] 20 | -------------------------------------------------------------------------------- /integration-tests/public/erc20/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "erc20" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false, features = ["unstable-hostfn"] } 10 | 11 | [dev-dependencies] 12 | ink_e2e = { path = "../../../crates/e2e" } 13 | 14 | [lib] 15 | path = "lib.rs" 16 | 17 | [features] 18 | default = ["std"] 19 | std = [ 20 | "ink/std", 21 | ] 22 | ink-as-dependency = [] 23 | e2e-tests = [] 24 | -------------------------------------------------------------------------------- /integration-tests/public/erc721/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "erc721" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false, features = ["unstable-hostfn"] } 10 | 11 | [lib] 12 | path = "lib.rs" 13 | 14 | [features] 15 | default = ["std"] 16 | std = [ 17 | "ink/std", 18 | ] 19 | ink-as-dependency = [] 20 | -------------------------------------------------------------------------------- /integration-tests/public/events/event-def-unused/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "event-def-unused" 3 | authors = ["Use Ink "] 4 | version = "0.1.0" 5 | edition = "2021" 6 | 7 | [dependencies] 8 | ink = { path = "../../../../crates/ink", default-features = false } 9 | 10 | [lib] 11 | path = "src/lib.rs" 12 | 13 | [features] 14 | default = ["std"] 15 | std = [ 16 | "ink/std", 17 | ] 18 | -------------------------------------------------------------------------------- /integration-tests/public/events/event-def-unused/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![cfg_attr(not(feature = "std"), no_std, no_main)] 2 | 3 | #[ink::trait_definition] 4 | pub trait FlipperTrait { 5 | #[ink(message)] 6 | fn flip(&mut self); 7 | } 8 | 9 | #[ink::event] 10 | pub struct EventDefUnused { 11 | #[ink(topic)] 12 | pub hash: [u8; 32], 13 | #[ink(topic)] 14 | pub maybe_hash: Option<[u8; 32]>, 15 | } 16 | -------------------------------------------------------------------------------- /integration-tests/public/events/event-def/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "event-def" 3 | authors = ["Use Ink "] 4 | version = "0.1.0" 5 | edition = "2021" 6 | 7 | [dependencies] 8 | ink = { path = "../../../../crates/ink", default-features = false } 9 | 10 | [lib] 11 | path = "src/lib.rs" 12 | 13 | [features] 14 | default = ["std"] 15 | std = [ 16 | "ink/std", 17 | ] 18 | -------------------------------------------------------------------------------- /integration-tests/public/events/event-def/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![cfg_attr(not(feature = "std"), no_std, no_main)] 2 | 3 | #[ink::event] 4 | pub struct ForeignFlipped { 5 | pub value: bool, 6 | } 7 | 8 | #[ink::event] 9 | pub struct ThirtyTwoByteTopics { 10 | #[ink(topic)] 11 | pub hash: [u8; 32], 12 | #[ink(topic)] 13 | pub maybe_hash: Option<[u8; 32]>, 14 | } 15 | -------------------------------------------------------------------------------- /integration-tests/public/events/event-def2/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "event-def2" 3 | authors = ["Use Ink "] 4 | version = "0.1.0" 5 | edition = "2021" 6 | 7 | [dependencies] 8 | ink = { path = "../../../../crates/ink", default-features = false } 9 | 10 | [lib] 11 | path = "src/lib.rs" 12 | 13 | [features] 14 | default = ["std"] 15 | std = [ 16 | "ink/std", 17 | ] 18 | -------------------------------------------------------------------------------- /integration-tests/public/events/event-def2/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![cfg_attr(not(feature = "std"), no_std, no_main)] 2 | 3 | #[ink::event] 4 | pub struct EventDefAnotherCrate { 5 | #[ink(topic)] 6 | pub hash: [u8; 32], 7 | #[ink(topic)] 8 | pub maybe_hash: Option<[u8; 32]>, 9 | } 10 | -------------------------------------------------------------------------------- /integration-tests/public/flipper/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "flipper" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false } 10 | 11 | [dev-dependencies] 12 | ink_e2e = { path = "../../../crates/e2e", features = ["sandbox"] } 13 | hex = { version = "0.4.3" } 14 | 15 | [lib] 16 | path = "lib.rs" 17 | 18 | [features] 19 | default = ["std"] 20 | std = [ 21 | "ink/std", 22 | ] 23 | ink-as-dependency = [] 24 | e2e-tests = [] 25 | -------------------------------------------------------------------------------- /integration-tests/public/incrementer/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "incrementer" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false } 10 | 11 | [lib] 12 | path = "lib.rs" 13 | 14 | [features] 15 | default = ["std"] 16 | std = [ 17 | "ink/std", 18 | ] 19 | ink-as-dependency = [] 20 | -------------------------------------------------------------------------------- /integration-tests/public/lazyvec/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "lazyvec" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false, features = ["unstable-hostfn"] } 10 | 11 | [dev-dependencies] 12 | ink_e2e = { path = "../../../crates/e2e" } 13 | 14 | [lib] 15 | path = "lib.rs" 16 | 17 | [features] 18 | default = ["std"] 19 | std = [ 20 | "ink/std", 21 | ] 22 | ink-as-dependency = [] 23 | e2e-tests = [] 24 | -------------------------------------------------------------------------------- /integration-tests/public/multi-contract-caller/.images/code-hashes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/use-ink/ink/641f05706e4f7ff1fb7c60e261ed0f4bc833f2f0/integration-tests/public/multi-contract-caller/.images/code-hashes.png -------------------------------------------------------------------------------- /integration-tests/public/multi-contract-caller/accumulator/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "accumulator" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | 7 | [dependencies] 8 | ink = { path = "../../../../crates/ink", default-features = false } 9 | 10 | [lib] 11 | path = "lib.rs" 12 | 13 | [features] 14 | default = ["std"] 15 | std = [ 16 | "ink/std", 17 | ] 18 | ink-as-dependency = [] 19 | -------------------------------------------------------------------------------- /integration-tests/public/multi-contract-caller/adder/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "adder" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | 7 | [dependencies] 8 | ink = { path = "../../../../crates/ink", default-features = false } 9 | 10 | accumulator = { path = "../accumulator", default-features = false, features = ["ink-as-dependency"] } 11 | 12 | [lib] 13 | path = "lib.rs" 14 | 15 | [features] 16 | default = ["std"] 17 | std = [ 18 | "ink/std", 19 | "accumulator/std", 20 | ] 21 | ink-as-dependency = [] 22 | -------------------------------------------------------------------------------- /integration-tests/public/multi-contract-caller/build-all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | 5 | cargo contract build --manifest-path accumulator/Cargo.toml 6 | cargo contract build --manifest-path adder/Cargo.toml 7 | cargo contract build --manifest-path subber/Cargo.toml 8 | cargo contract build 9 | -------------------------------------------------------------------------------- /integration-tests/public/multi-contract-caller/subber/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "subber" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | 7 | [dependencies] 8 | ink = { path = "../../../../crates/ink", default-features = false } 9 | 10 | accumulator = { path = "../accumulator", default-features = false, features = ["ink-as-dependency"] } 11 | 12 | [lib] 13 | path = "lib.rs" 14 | 15 | [features] 16 | default = ["std"] 17 | std = [ 18 | "ink/std", 19 | "accumulator/std", 20 | ] 21 | ink-as-dependency = [] 22 | -------------------------------------------------------------------------------- /integration-tests/public/multisig/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "multisig" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false, features = ["unstable-hostfn"] } 10 | 11 | [lib] 12 | path = "lib.rs" 13 | 14 | [features] 15 | default = ["std"] 16 | std = [ 17 | "ink/std", 18 | ] 19 | ink-as-dependency = [] 20 | -------------------------------------------------------------------------------- /integration-tests/public/own-code-hash/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore build artifacts from the local tests sub-crate. 2 | /target/ 3 | 4 | # Ignore backup files creates by cargo fmt. 5 | **/*.rs.bk 6 | 7 | # Remove Cargo.lock when creating an executable, leave it for libraries 8 | # More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock 9 | Cargo.lock -------------------------------------------------------------------------------- /integration-tests/public/payment-channel/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "payment_channel" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false, features = ["unstable-hostfn"] } 10 | sp-core = { version = "36.1.0", default-features = false } 11 | 12 | [dev-dependencies] 13 | hex-literal = "1" 14 | 15 | [lib] 16 | path = "lib.rs" 17 | 18 | [features] 19 | default = ["std"] 20 | std = [ 21 | "ink/std", 22 | ] 23 | 24 | ink-as-dependency = [] 25 | -------------------------------------------------------------------------------- /integration-tests/public/psp22-extension/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "psp22_extension" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false, features = ["unstable-hostfn"] } 10 | 11 | [lib] 12 | path = "lib.rs" 13 | 14 | [features] 15 | default = ["std"] 16 | std = [ 17 | "ink/std", 18 | ] 19 | ink-as-dependency = [] 20 | -------------------------------------------------------------------------------- /integration-tests/public/rand-extension/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rand_extension" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false, features = ["unstable-hostfn"] } 10 | 11 | [lib] 12 | path = "lib.rs" 13 | 14 | [features] 15 | default = ["std"] 16 | std = [ 17 | "ink/std", 18 | ] 19 | ink-as-dependency = [] 20 | -------------------------------------------------------------------------------- /integration-tests/public/runtime-call-contract/sandbox-runtime/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "sandbox-runtime" 3 | version = "0.1.0" 4 | authors.workspace = true 5 | edition.workspace = true 6 | homepage.workspace = true 7 | keywords.workspace = true 8 | license.workspace = true 9 | repository.workspace = true 10 | 11 | [dependencies] 12 | ink_sandbox = { path = "../../../../crates/e2e/sandbox" } 13 | pallet-revive-caller = { path = "pallet-revive-caller", default-features = false } 14 | frame-support = { workspace = true } 15 | frame-system = { workspace = true } 16 | codec = { workspace = true } 17 | scale-info = { workspace = true } 18 | 19 | [features] 20 | default = ["std"] 21 | std = [ 22 | "pallet-revive-caller/std", 23 | ] 24 | -------------------------------------------------------------------------------- /integration-tests/public/runtime-call-contract/sandbox-runtime/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! # Contract Caller 2 | //! 3 | //! Demonstrates calling into an `ink!` contract from a pallet. 4 | 5 | #![cfg_attr(not(feature = "std"), no_std)] 6 | 7 | ink_sandbox::create_sandbox!(ContractCallerSandbox, ContractCallerSandboxRuntime, (), (), { 8 | ContractCaller: pallet_revive_caller, 9 | }); 10 | 11 | impl pallet_revive_caller::Config for ContractCallerSandboxRuntime {} 12 | -------------------------------------------------------------------------------- /integration-tests/public/runtime-call-contract/traits/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "flipper-traits" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../../crates/ink", default-features = false } 10 | 11 | [lib] 12 | path = "lib.rs" 13 | 14 | [features] 15 | default = ["std"] 16 | std = [ 17 | "ink/std", 18 | ] 19 | -------------------------------------------------------------------------------- /integration-tests/public/runtime-call-contract/traits/lib.rs: -------------------------------------------------------------------------------- 1 | #![cfg_attr(not(feature = "std"), no_std, no_main)] 2 | 3 | /// Allows to flip and get a bool value. 4 | #[ink::trait_definition] 5 | pub trait Flip { 6 | /// Flip the value of the stored `bool` from `true` 7 | /// to `false` and vice versa. 8 | #[ink(message)] 9 | fn flip(&mut self); 10 | 11 | /// Returns the current value of our `bool`. 12 | #[ink(message)] 13 | fn get(&self) -> bool; 14 | } 15 | -------------------------------------------------------------------------------- /integration-tests/public/trait-dyn-cross-contract-calls/contracts/incrementer/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "trait-incrementer" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../../../crates/ink", default-features = false } 10 | 11 | dyn-traits = { path = "../../traits", default-features = false } 12 | 13 | [lib] 14 | path = "lib.rs" 15 | 16 | [features] 17 | default = ["std"] 18 | std = [ 19 | "ink/std", 20 | "dyn-traits/std", 21 | ] 22 | ink-as-dependency = [] 23 | -------------------------------------------------------------------------------- /integration-tests/public/trait-dyn-cross-contract-calls/traits/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "dyn-traits" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../../crates/ink", default-features = false } 10 | 11 | [lib] 12 | path = "lib.rs" 13 | 14 | [features] 15 | default = ["std"] 16 | std = [ 17 | "ink/std", 18 | ] 19 | -------------------------------------------------------------------------------- /integration-tests/public/trait-dyn-cross-contract-calls/traits/lib.rs: -------------------------------------------------------------------------------- 1 | #![cfg_attr(not(feature = "std"), no_std, no_main)] 2 | 3 | //! The trait is extracted into a separate crate to show how to do cross-contract 4 | //! calls only with traits without importing the contract. 5 | 6 | /// Allows to increment and get the current value. 7 | #[ink::trait_definition] 8 | pub trait Increment { 9 | /// Increments the current value of the implementer by one (1). 10 | #[ink(message)] 11 | fn inc(&mut self); 12 | 13 | /// Returns the current value of the implementer. 14 | #[ink(message)] 15 | fn get(&self) -> u64; 16 | } 17 | -------------------------------------------------------------------------------- /integration-tests/public/trait-erc20/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "trait_erc20" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false, features = ["unstable-hostfn"] } 10 | 11 | [lib] 12 | path = "lib.rs" 13 | 14 | [features] 15 | default = ["std"] 16 | std = [ 17 | "ink/std", 18 | ] 19 | ink-as-dependency = [] 20 | -------------------------------------------------------------------------------- /integration-tests/public/trait-flipper/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "trait_flipper" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false } 10 | 11 | [lib] 12 | path = "lib.rs" 13 | 14 | [features] 15 | default = ["std"] 16 | std = [ 17 | "ink/std", 18 | ] 19 | ink-as-dependency = [] 20 | -------------------------------------------------------------------------------- /integration-tests/public/trait-incrementer/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "trait-incrementer" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false } 10 | 11 | traits = { path = "./traits", default-features = false } 12 | 13 | [lib] 14 | path = "lib.rs" 15 | 16 | [features] 17 | default = ["std"] 18 | std = [ 19 | "ink/std", 20 | "traits/std", 21 | ] 22 | ink-as-dependency = [] 23 | -------------------------------------------------------------------------------- /integration-tests/public/trait-incrementer/traits/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "traits" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../../crates/ink", default-features = false } 10 | 11 | [lib] 12 | path = "lib.rs" 13 | crate-type = ["rlib"] 14 | 15 | [features] 16 | default = ["std"] 17 | std = [ 18 | "ink/std", 19 | ] 20 | ink-as-dependency = [] 21 | -------------------------------------------------------------------------------- /integration-tests/public/upgradeable-contracts/delegator/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "delegator" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../../crates/ink", default-features = false } 10 | delegatee = { path = "delegatee", default-features = false, features = ["ink-as-dependency"] } 11 | delegatee2 = { path = "delegatee2", default-features = false, features = ["ink-as-dependency"] } 12 | 13 | [dev-dependencies] 14 | ink_e2e = { path = "../../../../crates/e2e" } 15 | 16 | [lib] 17 | path = "lib.rs" 18 | 19 | [features] 20 | default = ["std"] 21 | std = [ 22 | "ink/std", 23 | ] 24 | ink-as-dependency = [] 25 | e2e-tests = [] 26 | -------------------------------------------------------------------------------- /integration-tests/public/upgradeable-contracts/delegator/delegatee/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "delegatee" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../../../crates/ink", default-features = false } 10 | 11 | [lib] 12 | path = "lib.rs" 13 | 14 | [features] 15 | default = ["std"] 16 | std = [ 17 | "ink/std", 18 | ] 19 | ink-as-dependency = [] 20 | e2e-tests = [] 21 | -------------------------------------------------------------------------------- /integration-tests/public/upgradeable-contracts/delegator/delegatee2/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "delegatee2" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../../../crates/ink", default-features = false } 10 | 11 | [lib] 12 | path = "lib.rs" 13 | 14 | [features] 15 | default = ["std"] 16 | std = [ 17 | "ink/std", 18 | ] 19 | ink-as-dependency = [] 20 | e2e-tests = [] 21 | -------------------------------------------------------------------------------- /integration-tests/public/upgradeable-contracts/set-code-hash-migration/migration/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "migration" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../../../crates/ink", default-features = false, features = ["unstable-hostfn"] } 10 | 11 | [lib] 12 | path = "lib.rs" 13 | 14 | [features] 15 | default = ["std"] 16 | std = [ 17 | "ink/std", 18 | ] 19 | ink-as-dependency = [] 20 | -------------------------------------------------------------------------------- /integration-tests/public/upgradeable-contracts/set-code-hash-migration/updated-incrementer/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "updated-incrementer" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../../../crates/ink", default-features = false, features = ["unstable-hostfn"] } 10 | 11 | [lib] 12 | path = "lib.rs" 13 | 14 | [features] 15 | default = ["std"] 16 | std = [ 17 | "ink/std", 18 | ] 19 | ink-as-dependency = [] 20 | -------------------------------------------------------------------------------- /integration-tests/public/upgradeable-contracts/set-code-hash/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "incrementer" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../../crates/ink", default-features = false, features = ["unstable-hostfn"] } 10 | 11 | [dev-dependencies] 12 | ink_e2e = { path = "../../../../crates/e2e" } 13 | updated-incrementer = { path = "updated-incrementer", default-features = false, features = ["ink-as-dependency"] } 14 | 15 | [lib] 16 | path = "lib.rs" 17 | 18 | [features] 19 | default = ["std"] 20 | std = [ 21 | "ink/std", 22 | ] 23 | ink-as-dependency = [] 24 | e2e-tests = [] 25 | -------------------------------------------------------------------------------- /integration-tests/public/upgradeable-contracts/set-code-hash/updated-incrementer/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "updated-incrementer" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../../../crates/ink", default-features = false, features = ["unstable-hostfn"] } 10 | 11 | [lib] 12 | path = "lib.rs" 13 | 14 | [features] 15 | default = ["std"] 16 | std = [ 17 | "ink/std", 18 | ] 19 | ink-as-dependency = [] 20 | -------------------------------------------------------------------------------- /integration-tests/public/wildcard-selector/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "wildcard-selector" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false } 10 | 11 | [dev-dependencies] 12 | ink_e2e = { path = "../../../crates/e2e" } 13 | 14 | [lib] 15 | path = "lib.rs" 16 | 17 | [features] 18 | default = ["std"] 19 | std = [ 20 | "ink/std", 21 | ] 22 | ink-as-dependency = [] 23 | e2e-tests = [] 24 | emit-event = ["ink/unstable-hostfn"] 25 | -------------------------------------------------------------------------------- /integration-tests/solidity-abi/events/event-def-unused/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "event-def-unused" 3 | authors = ["Use Ink "] 4 | version = "0.1.0" 5 | edition = "2021" 6 | 7 | [dependencies] 8 | ink = { path = "../../../../crates/ink", default-features = false } 9 | 10 | [lib] 11 | path = "src/lib.rs" 12 | 13 | [features] 14 | default = ["std"] 15 | std = [ 16 | "ink/std", 17 | ] 18 | 19 | [package.metadata.ink-lang] 20 | abi = "sol" 21 | -------------------------------------------------------------------------------- /integration-tests/solidity-abi/events/event-def-unused/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![cfg_attr(not(feature = "std"), no_std, no_main)] 2 | 3 | #[ink::trait_definition] 4 | pub trait FlipperTrait { 5 | #[ink(message)] 6 | fn flip(&mut self); 7 | } 8 | 9 | #[ink::event] 10 | pub struct EventDefUnused { 11 | #[ink(topic)] 12 | pub hash: [u8; 32], 13 | } 14 | -------------------------------------------------------------------------------- /integration-tests/solidity-abi/events/event-def/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "event-def" 3 | authors = ["Use Ink "] 4 | version = "0.1.0" 5 | edition = "2021" 6 | 7 | [dependencies] 8 | ink = { path = "../../../../crates/ink", default-features = false } 9 | 10 | [lib] 11 | path = "src/lib.rs" 12 | 13 | [features] 14 | default = ["std"] 15 | std = [ 16 | "ink/std", 17 | ] 18 | 19 | [package.metadata.ink-lang] 20 | abi = "sol" 21 | -------------------------------------------------------------------------------- /integration-tests/solidity-abi/events/event-def/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![cfg_attr(not(feature = "std"), no_std, no_main)] 2 | 3 | #[ink::event] 4 | pub struct ForeignFlipped { 5 | pub value: bool, 6 | } 7 | 8 | #[ink::event] 9 | pub struct ThirtyTwoByteTopics { 10 | #[ink(topic)] 11 | pub hash: [u8; 32], 12 | } 13 | -------------------------------------------------------------------------------- /integration-tests/solidity-abi/events/event-def2/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "event-def2" 3 | authors = ["Use Ink "] 4 | version = "0.1.0" 5 | edition = "2021" 6 | 7 | [dependencies] 8 | ink = { path = "../../../../crates/ink", default-features = false } 9 | 10 | [lib] 11 | path = "src/lib.rs" 12 | 13 | [features] 14 | default = ["std"] 15 | std = [ 16 | "ink/std", 17 | ] 18 | 19 | [package.metadata.ink-lang] 20 | abi = "sol" 21 | -------------------------------------------------------------------------------- /integration-tests/solidity-abi/events/event-def2/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![cfg_attr(not(feature = "std"), no_std, no_main)] 2 | 3 | #[ink::event] 4 | pub struct EventDefAnotherCrate { 5 | #[ink(topic)] 6 | pub hash: [u8; 32], 7 | } 8 | -------------------------------------------------------------------------------- /integration-tests/solidity-abi/sol-cross-contract/other-contract-sol/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "other-contract-sol" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../../crates/ink", default-features = false } 10 | 11 | [dev-dependencies] 12 | ink_e2e = { path = "../../../../crates/e2e" } 13 | 14 | [lib] 15 | path = "lib.rs" 16 | 17 | [features] 18 | default = ["std"] 19 | std = [ 20 | "ink/std", 21 | ] 22 | ink-as-dependency = [] 23 | e2e-tests = [] 24 | 25 | [package.metadata.ink-lang] 26 | abi = "sol" 27 | -------------------------------------------------------------------------------- /integration-tests/solidity-abi/sol-encoding/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "sol-encoding" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false } 10 | 11 | [dev-dependencies] 12 | ink_e2e = { path = "../../../crates/e2e", features = ["sandbox"] } 13 | ink_sandbox = { path = "../../../crates/e2e/sandbox" } 14 | pallet-revive = { version = "0.5.0", default-features = false } 15 | sha3 = { version = "0.10" } 16 | 17 | [lib] 18 | path = "lib.rs" 19 | 20 | [features] 21 | default = ["std"] 22 | std = [ 23 | "ink/std", 24 | ] 25 | ink-as-dependency = [] 26 | e2e-tests = [] 27 | 28 | [package.metadata.ink-lang] 29 | abi = "sol" 30 | -------------------------------------------------------------------------------- /integration-tests/solidity-abi/solidity-calls-flipper/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "flipper" 3 | version = "6.0.0-alpha" 4 | authors = ["Use Ink "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | ink = { path = "../../../crates/ink", default-features = false } 10 | sha3 = { version = "0.10", default-features = false } 11 | 12 | [dev-dependencies] 13 | ink_e2e = { path = "../../../crates/e2e" } 14 | hex = { version = "0.4.3" } 15 | sha3 = { version = "0.10" } 16 | 17 | [lib] 18 | path = "lib.rs" 19 | 20 | [features] 21 | default = ["std"] 22 | std = [ 23 | "ink/std", 24 | ] 25 | ink-as-dependency = [] 26 | e2e-tests = [] 27 | 28 | [package.metadata.ink-lang] 29 | abi = "sol" 30 | -------------------------------------------------------------------------------- /integration-tests/solidity-abi/solidity-calls-flipper/sol/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | artifacts-pvm 3 | cache-pvm -------------------------------------------------------------------------------- /integration-tests/solidity-abi/solidity-calls-flipper/sol/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sol", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | "keywords": [], 9 | "author": "", 10 | "license": "ISC", 11 | "description": "", 12 | "devDependencies": { 13 | "@nomicfoundation/hardhat-ethers": "^3.0.8", 14 | "ethers": "^6.13.5", 15 | "hardhat": "^2.22.18", 16 | "hardhat-resolc": "^0.0.4", 17 | "hardhat-revive": "github:bee344/hardhat-revive#main", 18 | "hardhat-revive-node": "^0.0.3" 19 | }, 20 | "dependencies": { 21 | "axios": "^1.8.2" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /linting/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /linting/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | resolver = "2" 3 | members = [ 4 | "mandatory", 5 | "extra", 6 | "utils", 7 | ] 8 | 9 | [workspace.package] 10 | version = "6.0.0-alpha" 11 | authors = ["Use Ink "] 12 | edition = "2021" 13 | license = "Apache-2.0" 14 | repository = "https://github.com/use-ink/ink" 15 | homepage = "https://use.ink" 16 | keywords = ["ink", "blockchain", "edsl", "dylint", "linting"] 17 | 18 | [workspace.dependencies] 19 | ink_linting_utils = { version = "=6.0.0-alpha", path = "utils" } 20 | 21 | [workspace.metadata.dylint] 22 | libraries = [ 23 | { path = "mandatory" }, 24 | { path = "extra" }, 25 | ] 26 | -------------------------------------------------------------------------------- /linting/extra/LICENSE: -------------------------------------------------------------------------------- 1 | ../LICENSE -------------------------------------------------------------------------------- /linting/extra/README.md: -------------------------------------------------------------------------------- 1 | # Extra ink! linting rules 2 | These lints are designed to check for secure coding style in smart contracts and highlight potential issues. These are optional and intended for use by the contract developer to improve the security properties of their project. 3 | -------------------------------------------------------------------------------- /linting/mandatory/LICENSE: -------------------------------------------------------------------------------- 1 | ../LICENSE -------------------------------------------------------------------------------- /linting/mandatory/README.md: -------------------------------------------------------------------------------- 1 | # Mandatory ink! linting rules 2 | dylint-based lints integrated into the ink! contracts' build process, intended to generate custom compilation errors. 3 | -------------------------------------------------------------------------------- /linting/mandatory/ui/pass/no_main.rs: -------------------------------------------------------------------------------- 1 | #![cfg_attr(not(feature = "std"), no_std, no_main)] 2 | 3 | #[ink::contract] 4 | pub mod no_main { 5 | #[ink(storage)] 6 | pub struct NoMain {} 7 | impl NoMain { 8 | #[ink(constructor)] 9 | pub fn new() -> Self { 10 | Self {} 11 | } 12 | #[ink(message)] 13 | pub fn do_nothing(&mut self) {} 14 | } 15 | } 16 | 17 | fn main() {} 18 | -------------------------------------------------------------------------------- /linting/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | # This file corresponds to the `rust-toolchain` file used for the `dylint` examples here: 2 | # https://github.com/trailofbits/dylint/blob/master/internal/template/rust-toolchain 3 | 4 | [toolchain] 5 | channel = "nightly-2025-02-20" 6 | components = ["llvm-tools-preview", "rustc-dev"] 7 | -------------------------------------------------------------------------------- /linting/utils/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ink_linting_utils" 3 | version.workspace = true 4 | authors.workspace = true 5 | edition.workspace = true 6 | 7 | license.workspace = true 8 | readme = "README.md" 9 | repository.workspace = true 10 | documentation = "https://docs.rs/ink_linting_utils" 11 | homepage.workspace = true 12 | description = "Utilities used internally in ink_linting" 13 | keywords.workspace = true 14 | include = ["Cargo.toml", "*.rs", "LICENSE"] 15 | 16 | [dependencies] 17 | if_chain = "1.0.2" 18 | parity_clippy_utils = { package = "clippy_utils", git = "https://github.com/rust-lang/rust-clippy", rev = "238edf273d195c8e472851ebd60571f77f978ac8" } 19 | 20 | [package.metadata.rust-analyzer] 21 | rustc_private = true 22 | -------------------------------------------------------------------------------- /linting/utils/LICENSE: -------------------------------------------------------------------------------- 1 | ../LICENSE -------------------------------------------------------------------------------- /linting/utils/README.md: -------------------------------------------------------------------------------- 1 | # ink! linting utilities 2 | This crate implements various utility functions used in `ink_linting` crates. It also provides access to the specific version of the `clippy_utils` crate. 3 | --------------------------------------------------------------------------------