Skip to content

Commit

Permalink
Fix schema generation for generic types (#505)
Browse files Browse the repository at this point in the history
* Remove duplicates in generated code
* Fix custom types generation for generic types
* regenerate schema for modules
* install grcov with stable rust
* chore: Update rust-toolchain to nightly-2024-04-26
  • Loading branch information
kpob authored Jul 26, 2024
1 parent f17a38c commit dc80c41
Show file tree
Hide file tree
Showing 31 changed files with 717 additions and 47 deletions.
2 changes: 1 addition & 1 deletion benchmark/rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2024-02-09
nightly-2024-04-26
1 change: 1 addition & 0 deletions core/src/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ impl FromStr for Address {
}
}

#[allow(clippy::to_string_trait_impl)]
impl ToString for Address {
fn to_string(&self) -> String {
Key::from(*self).to_formatted_string()
Expand Down
2 changes: 1 addition & 1 deletion examples/ourcoin/rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2024-02-09
nightly-2024-04-26
4 changes: 2 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CARGO_ODRA_GIT_REPO := "https://github.com/odradev/cargo-odra"
CARGO_ODRA_BRANCH := "release/0.1.2"
CARGO_ODRA_BRANCH := "release/0.1.3"
BINARYEN_VERSION := "version_116"
BINARYEN_CHECKSUM := "c55b74f3109cdae97490faf089b0286d3bba926bb6ea5ed00c8c784fc53718fd"

Expand Down Expand Up @@ -36,7 +36,7 @@ install-cargo-odra:
prepare-test-env: install-cargo-odra
rustup target add wasm32-unknown-unknown
rustup component add llvm-tools-preview
cargo install grcov
cargo +stable install grcov
sudo apt install wabt
wget https://github.com/WebAssembly/binaryen/releases/download/{{BINARYEN_VERSION}}/binaryen-{{BINARYEN_VERSION}}-x86_64-linux.tar.gz || { echo "Download failed"; exit 1; }
sha256sum binaryen-{{BINARYEN_VERSION}}-x86_64-linux.tar.gz | grep {{BINARYEN_CHECKSUM}} || { echo "Checksum verification failed"; exit 1; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"repository": "https://github.com/odradev/odra",
"homepage": null,
"contract_name": "Cep18ClientContract",
"contract_version": "1.0.0",
"contract_version": "1.1.0",
"types": [],
"errors": [],
"entry_points": [
Expand Down
48 changes: 47 additions & 1 deletion modules/resources/casper_contract_schemas/cep18_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"repository": "https://github.com/odradev/odra",
"homepage": null,
"contract_name": "Cep18",
"contract_version": "1.0.0",
"contract_version": "1.1.0",
"types": [
{
"struct": {
Expand Down Expand Up @@ -199,6 +199,52 @@
}
]
}
},
{
"enum": {
"name": "Cep18Modality",
"description": null,
"variants": [
{
"name": "None",
"description": null,
"discriminant": 0,
"ty": "Unit"
},
{
"name": "MintAndBurn",
"description": null,
"discriminant": 1,
"ty": "Unit"
}
]
}
},
{
"enum": {
"name": "SecurityBadge",
"description": null,
"variants": [
{
"name": "Admin",
"description": null,
"discriminant": 0,
"ty": "Unit"
},
{
"name": "Minter",
"description": null,
"discriminant": 1,
"ty": "Unit"
},
{
"name": "None",
"description": null,
"discriminant": 2,
"ty": "Unit"
}
]
}
}
],
"errors": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"repository": "https://github.com/odradev/odra",
"homepage": null,
"contract_name": "Erc1155Receiver",
"contract_version": "1.0.0",
"contract_version": "1.1.0",
"types": [
{
"struct": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"repository": "https://github.com/odradev/odra",
"homepage": null,
"contract_name": "Erc1155Token",
"contract_version": "1.0.0",
"contract_version": "1.1.0",
"types": [
{
"struct": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"repository": "https://github.com/odradev/odra",
"homepage": null,
"contract_name": "Erc721Receiver",
"contract_version": "1.0.0",
"contract_version": "1.1.0",
"types": [],
"errors": [],
"entry_points": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"repository": "https://github.com/odradev/odra",
"homepage": null,
"contract_name": "Erc721Token",
"contract_version": "1.0.0",
"contract_version": "1.1.0",
"types": [
{
"struct": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
{
"casper_contract_schema_version": 1,
"toolchain": "rustc 1.78.0-nightly (98aa3624b 2024-02-08)",
"authors": [
"Jakub Płaskonka <kuba@odra.dev>",
"Krzysztof Pobiarżyn <krzysztof@odra.dev>",
"Maciej Zieliński <maciej@odra.dev>"
],
"repository": "https://github.com/odradev/odra",
"homepage": null,
"contract_name": "MockCep78Operator",
"contract_version": "1.1.0",
"types": [],
"errors": [],
"entry_points": [
{
"name": "set_address",
"description": "",
"is_mutable": true,
"arguments": [
{
"name": "nft_contract",
"description": null,
"ty": "Key",
"optional": false
}
],
"return_ty": "Unit",
"is_contract_context": true,
"access": "public"
},
{
"name": "mint",
"description": "",
"is_mutable": true,
"arguments": [
{
"name": "token_metadata",
"description": null,
"ty": "String",
"optional": false
},
{
"name": "is_reverse_lookup_enabled",
"description": null,
"ty": "Bool",
"optional": false
}
],
"return_ty": "Unit",
"is_contract_context": true,
"access": "public"
},
{
"name": "mint_with_hash",
"description": "",
"is_mutable": true,
"arguments": [
{
"name": "token_metadata",
"description": null,
"ty": "String",
"optional": false
},
{
"name": "token_hash",
"description": null,
"ty": "String",
"optional": false
}
],
"return_ty": "Unit",
"is_contract_context": true,
"access": "public"
},
{
"name": "burn",
"description": "",
"is_mutable": true,
"arguments": [
{
"name": "token_id",
"description": null,
"ty": "U64",
"optional": false
}
],
"return_ty": "Unit",
"is_contract_context": true,
"access": "public"
},
{
"name": "mint_for",
"description": "",
"is_mutable": true,
"arguments": [
{
"name": "token_owner",
"description": null,
"ty": "Key",
"optional": false
},
{
"name": "token_metadata",
"description": null,
"ty": "String",
"optional": false
}
],
"return_ty": "Unit",
"is_contract_context": true,
"access": "public"
},
{
"name": "transfer",
"description": "",
"is_mutable": true,
"arguments": [
{
"name": "token_id",
"description": null,
"ty": "U64",
"optional": false
},
{
"name": "target",
"description": null,
"ty": "Key",
"optional": false
}
],
"return_ty": "Unit",
"is_contract_context": true,
"access": "public"
},
{
"name": "transfer_from",
"description": "",
"is_mutable": true,
"arguments": [
{
"name": "token_id",
"description": null,
"ty": "U64",
"optional": false
},
{
"name": "source",
"description": null,
"ty": "Key",
"optional": false
},
{
"name": "target",
"description": null,
"ty": "Key",
"optional": false
}
],
"return_ty": "Unit",
"is_contract_context": true,
"access": "public"
},
{
"name": "approve",
"description": "",
"is_mutable": true,
"arguments": [
{
"name": "spender",
"description": null,
"ty": "Key",
"optional": false
},
{
"name": "token_id",
"description": null,
"ty": "U64",
"optional": false
}
],
"return_ty": "Unit",
"is_contract_context": true,
"access": "public"
},
{
"name": "revoke",
"description": "",
"is_mutable": true,
"arguments": [
{
"name": "token_id",
"description": null,
"ty": "U64",
"optional": false
}
],
"return_ty": "Unit",
"is_contract_context": true,
"access": "public"
}
],
"events": [],
"call": {
"wasm_file_name": "MockCep78Operator.wasm",
"description": null,
"arguments": [
{
"name": "odra_cfg_package_hash_key_name",
"description": "The arg name for the package hash key name.",
"ty": "String",
"optional": false
},
{
"name": "odra_cfg_allow_key_override",
"description": "The arg name for the allow key override.",
"ty": "Bool",
"optional": false
},
{
"name": "odra_cfg_is_upgradable",
"description": "The arg name for the contract upgradeability setting.",
"ty": "Bool",
"optional": false
}
]
}
}
Loading

0 comments on commit dc80c41

Please sign in to comment.