diff --git a/.github/workflows/check-contract-schema.yml b/.github/workflows/check-contract-schema.yml new file mode 100644 index 0000000000..700440bdd5 --- /dev/null +++ b/.github/workflows/check-contract-schema.yml @@ -0,0 +1,25 @@ +name: Check Contract Schema + +on: + push: + paths: + - 'contracts/**' + - 'common/**' + pull_request: + paths: + - 'contracts/**' + - 'common/**' + +jobs: + check-schema: + name: Generate and check schema + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v2 + + - name: Generate the schema + run: make contract-schema + + - name: Check for diff + run: git diff --exit-code diff --git a/.github/workflows/contracts.yml b/.github/workflows/contracts.yml index 9de2cab348..64aeabb5d7 100644 --- a/.github/workflows/contracts.yml +++ b/.github/workflows/contracts.yml @@ -48,12 +48,12 @@ jobs: RUSTFLAGS: '-C link-arg=-s' with: command: build - args: --manifest-path contracts/Cargo.toml --workspace --target wasm32-unknown-unknown + args: --manifest-path contracts/Cargo.toml --workspace --lib --target wasm32-unknown-unknown - uses: actions-rs/cargo@v1 with: command: test - args: --manifest-path contracts/Cargo.toml + args: --lib --manifest-path contracts/Cargo.toml - uses: actions-rs/cargo@v1 with: @@ -64,4 +64,4 @@ jobs: if: ${{ matrix.rust != 'nightly' }} with: command: clippy - args: --manifest-path contracts/Cargo.toml --workspace --all-targets -- -D warnings + args: --lib --manifest-path contracts/Cargo.toml --workspace --all-targets -- -D warnings diff --git a/Cargo.lock b/Cargo.lock index a823625624..43b8e6eff2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -541,6 +541,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "bnum" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "845141a4fade3f790628b7daaaa298a25b204fb28907eb54febe5142db6ce653" + [[package]] name = "bs58" version = "0.4.0" @@ -969,9 +975,9 @@ dependencies = [ [[package]] name = "cosmwasm-crypto" -version = "1.2.5" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75836a10cb9654c54e77ee56da94d592923092a10b369cdb0dbd56acefc16340" +checksum = "0d076a08ec01ed23c4396aca98ec73a38fa1fee5f310465add52b4108181c7a8" dependencies = [ "digest 0.10.7", "ed25519-zebra", @@ -982,18 +988,18 @@ dependencies = [ [[package]] name = "cosmwasm-derive" -version = "1.2.5" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c9f7f0e51bfc7295f7b2664fe8513c966428642aa765dad8a74acdab5e0c773" +checksum = "dec361f3c09d7b41221948fc17be9b3c96cb58e55a02f82da36f888a651f2584" dependencies = [ "syn 1.0.109", ] [[package]] name = "cosmwasm-schema" -version = "1.2.5" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f00b363610218eea83f24bbab09e1a7c3920b79f068334fdfcc62f6129ef9fc" +checksum = "bb6b2fb76758ef59cddc77f2e2ae91c22f77da49037e9f182e9c2833f0e959b1" dependencies = [ "cosmwasm-schema-derive", "schemars", @@ -1004,9 +1010,9 @@ dependencies = [ [[package]] name = "cosmwasm-schema-derive" -version = "1.2.5" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae38f909b2822d32b275c9e2db9728497aa33ffe67dd463bc67c6a3b7092785c" +checksum = "2bfa39422f0d9f1c9a6fd3711573258495314dfa3aae738ea825ecd9964bc659" dependencies = [ "proc-macro2", "quote", @@ -1015,11 +1021,12 @@ dependencies = [ [[package]] name = "cosmwasm-std" -version = "1.2.5" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a49b85345e811c8e80ec55d0d091e4fcb4f00f97ab058f9be5f614c444a730cb" +checksum = "1f6dc2ee23313add5ecacc3ccac217b9967ad9d2d11bd56e5da6aa65a9da6138" dependencies = [ "base64 0.13.1", + "bnum", "cosmwasm-crypto", "cosmwasm-derive", "derivative", @@ -1027,10 +1034,9 @@ dependencies = [ "hex", "schemars", "serde", - "serde-json-wasm 0.5.1", + "serde-json-wasm", "sha2 0.10.6", "thiserror", - "uint", ] [[package]] @@ -1203,12 +1209,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - [[package]] name = "crypto-bigint" version = "0.4.9" @@ -1370,9 +1370,9 @@ dependencies = [ [[package]] name = "cw-controllers" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91440ce8ec4f0642798bc8c8cb6b9b53c1926c6dadaf0eed267a5145cd529071" +checksum = "d5d8edce4b78785f36413f67387e4be7d0cb7d032b5d4164bcc024f9c3f3f2ea" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -1385,9 +1385,9 @@ dependencies = [ [[package]] name = "cw-storage-plus" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053a5083c258acd68386734f428a5a171b29f7d733151ae83090c6fcc9417ffa" +checksum = "3f0e92a069d62067f3472c62e30adedb4cab1754725c0f2a682b3128d2bf3c79" dependencies = [ "cosmwasm-std", "schemars", @@ -1411,22 +1411,23 @@ dependencies = [ [[package]] name = "cw2" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fb70cee2cf0b4a8ff7253e6bc6647107905e8eb37208f87d54f67810faa62f8" +checksum = "29ac2dc7a55ad64173ca1e0a46697c31b7a5c51342f55a1e84a724da4eb99908" dependencies = [ "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus", "schemars", "serde", + "thiserror", ] [[package]] name = "cw20" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91666da6c7b40c8dd5ff94df655a28114efc10c79b70b4d06f13c31e37d60609" +checksum = "011c45920f8200bd5d32d4fe52502506f64f2f75651ab408054d4cfc75ca3a9b" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -1437,9 +1438,9 @@ dependencies = [ [[package]] name = "cw3" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fe0b587008aa221cd2a2579a21990a28c4347dc53ad43167c68ad765f5b6efa" +checksum = "171af3d9127de6805a7dd819fb070c7d2f6c3ea85f4193f42cef259f0a7f33d5" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -1452,9 +1453,9 @@ dependencies = [ [[package]] name = "cw4" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c236e0bae02ce97e89235a681dd0e07d099524b369f1ef908d704db3e6b049b" +checksum = "a398696307efadaaa2d0850076f865fa706c959d493cb4203314f72be6b77a64" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -3846,22 +3847,21 @@ dependencies = [ name = "nym-coconut-bandwidth-contract-common" version = "0.1.0" dependencies = [ + "cosmwasm-schema", "cosmwasm-std", + "cw2", "nym-multisig-contract-common", - "schemars", - "serde", ] [[package]] name = "nym-coconut-dkg-common" version = "0.1.0" dependencies = [ + "cosmwasm-schema", "cosmwasm-std", "cw-utils", "nym-contracts-common", "nym-multisig-contract-common", - "schemars", - "serde", ] [[package]] @@ -3893,6 +3893,7 @@ name = "nym-contracts-common" version = "0.5.0" dependencies = [ "bs58 0.4.0", + "cosmwasm-schema", "cosmwasm-std", "schemars", "serde", @@ -4141,14 +4142,16 @@ name = "nym-mixnet-contract-common" version = "0.6.0" dependencies = [ "bs58 0.4.0", + "cosmwasm-schema", "cosmwasm-std", + "cw2", "humantime-serde", "log", "nym-contracts-common", "rand_chacha 0.3.1", "schemars", "serde", - "serde-json-wasm 0.4.1", + "serde-json-wasm", "serde_repr", "thiserror", "time 0.3.21", @@ -4249,11 +4252,12 @@ dependencies = [ name = "nym-name-service-common" version = "0.1.0" dependencies = [ + "cosmwasm-schema", "cosmwasm-std", "cw-controllers", "cw-utils", + "cw2", "nym-contracts-common", - "schemars", "serde", "thiserror", ] @@ -4449,12 +4453,12 @@ dependencies = [ name = "nym-service-provider-directory-common" version = "0.1.0" dependencies = [ + "cosmwasm-schema", "cosmwasm-std", "cw-controllers", "cw-utils", + "cw2", "nym-contracts-common", - "schemars", - "serde", "thiserror", ] @@ -4804,7 +4808,6 @@ dependencies = [ "nym-config", "nym-mixnet-contract-common", "nym-validator-client", - "nym-vesting-contract", "nym-vesting-contract-common", "reqwest", "schemars", @@ -4846,7 +4849,6 @@ dependencies = [ "nym-name-service-common", "nym-network-defaults", "nym-service-provider-directory-common", - "nym-vesting-contract", "nym-vesting-contract-common", "openssl", "prost", @@ -4862,33 +4864,17 @@ dependencies = [ "zeroize", ] -[[package]] -name = "nym-vesting-contract" -version = "1.4.0" -dependencies = [ - "cosmwasm-derive", - "cosmwasm-std", - "cw-storage-plus", - "cw2", - "nym-contracts-common", - "nym-mixnet-contract-common", - "nym-vesting-contract-common", - "schemars", - "semver 1.0.17", - "serde", - "thiserror", - "vergen", -] - [[package]] name = "nym-vesting-contract-common" version = "0.7.0" dependencies = [ + "cosmwasm-schema", "cosmwasm-std", + "cw2", "nym-contracts-common", "nym-mixnet-contract-common", - "schemars", "serde", + "thiserror", "ts-rs", ] @@ -4904,7 +4890,6 @@ dependencies = [ "nym-network-defaults", "nym-types", "nym-validator-client", - "nym-vesting-contract", "nym-vesting-contract-common", "serde", "serde_json", @@ -6431,18 +6416,9 @@ dependencies = [ [[package]] name = "serde-json-wasm" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479b4dbc401ca13ee8ce902851b834893251404c4f3c65370a49e047a6be09a5" -dependencies = [ - "serde", -] - -[[package]] -name = "serde-json-wasm" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16a62a1fad1e1828b24acac8f2b468971dade7b8c3c2e672bcadefefb1f8c137" +checksum = "a15bee9b04dd165c3f4e142628982ddde884c2022a89e8ddf99c4829bf2c3a58" dependencies = [ "serde", ] @@ -6980,12 +6956,6 @@ dependencies = [ "loom", ] -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - [[package]] name = "stringprep" version = "0.1.2" @@ -7197,9 +7167,9 @@ dependencies = [ [[package]] name = "tendermint-rpc" -version = "0.32.0" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd2cc789170db5a35d4e0bb2490035c03ef96df08f119bee25fd8dab5a09aa25" +checksum = "d119d83a130537fc4a98c3c9eb6899ebe857fea4860400a61675bfb5f0b35129" dependencies = [ "async-trait", "bytes", @@ -7818,18 +7788,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" -[[package]] -name = "uint" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" -dependencies = [ - "byteorder", - "crunchy", - "hex", - "static_assertions", -] - [[package]] name = "uncased" version = "0.9.9" diff --git a/Cargo.toml b/Cargo.toml index 22b4cb99ac..666d1f76fc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -117,20 +117,22 @@ anyhow = "1.0.71" async-trait = "0.1.64" bip39 = { version = "2.0.0", features = ["zeroize"] } cfg-if = "1.0.0" -cosmwasm-derive = "=1.2.5" -cosmwasm-schema = "=1.2.5" -cosmwasm-std = "=1.2.5" -cosmwasm-storage = "=1.2.5" +cosmwasm-derive = "=1.3.0" +cosmwasm-schema = "=1.3.0" +cosmwasm-std = "=1.3.0" +# use 0.5.0 as that's the version used by cosmwasm-std 1.3.0 +# (and ideally we don't want to pull the same dependency twice) +serde-json-wasm = "=0.5.0" +cosmwasm-storage = "=1.3.0" cosmrs = "=0.14.0" # same version as used by cosmrs tendermint-rpc = "=0.32" cw-utils = "=1.0.1" -cw-storage-plus = "=1.0.1" -cw2 = { version = "=1.0.1" } -cw3 = { version = "=1.0.1" } -cw3-fixed-multisig = { version = "=1.0.1" } -cw4 = { version = "=1.0.1" } -cw-controllers = { version = "=1.0.1" } +cw-storage-plus = "=1.1.0" +cw2 = { version = "=1.1.0" } +cw3 = { version = "=1.1.0" } +cw4 = { version = "=1.1.0" } +cw-controllers = { version = "=1.1.0" } dotenvy = "0.15.6" generic-array = "0.14.7" k256 = "0.13" diff --git a/Makefile b/Makefile index ad812f11b8..2576489be9 100644 --- a/Makefile +++ b/Makefile @@ -73,7 +73,7 @@ endef # Generate targets for the various cargo workspaces $(eval $(call add_cargo_workspace,main,.)) -$(eval $(call add_cargo_workspace,contracts,contracts,--target wasm32-unknown-unknown)) +$(eval $(call add_cargo_workspace,contracts,contracts,--lib --target wasm32-unknown-unknown)) $(eval $(call add_cargo_workspace,wasm-client,clients/webassembly,--target wasm32-unknown-unknown)) $(eval $(call add_cargo_workspace,wallet,nym-wallet,)) $(eval $(call add_cargo_workspace,connect,nym-connect/desktop)) @@ -104,7 +104,7 @@ NAME_SERVICE_CONTRACT=$(CONTRACTS_OUT_DIR)/nym_name_service.wasm wasm: wasm-build wasm-opt wasm-build: - RUSTFLAGS='-C link-arg=-s' cargo build --manifest-path contracts/Cargo.toml --release --target wasm32-unknown-unknown + RUSTFLAGS='-C link-arg=-s' cargo build --lib --manifest-path contracts/Cargo.toml --release --target wasm32-unknown-unknown wasm-opt: wasm-opt --disable-sign-ext -Os $(VESTING_CONTRACT) -o $(VESTING_CONTRACT) @@ -112,6 +112,9 @@ wasm-opt: wasm-opt --disable-sign-ext -Os $(SERVICE_PROVIDER_DIRECTORY_CONTRACT) -o $(SERVICE_PROVIDER_DIRECTORY_CONTRACT) wasm-opt --disable-sign-ext -Os $(NAME_SERVICE_CONTRACT) -o $(NAME_SERVICE_CONTRACT) +contract-schema: + $(MAKE) -C contracts schema + # ----------------------------------------------------------------------------- # Misc # ----------------------------------------------------------------------------- diff --git a/clients/webassembly/Cargo.lock b/clients/webassembly/Cargo.lock index 330f31c4d5..793f321a97 100644 --- a/clients/webassembly/Cargo.lock +++ b/clients/webassembly/Cargo.lock @@ -378,6 +378,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "bnum" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "845141a4fade3f790628b7daaaa298a25b204fb28907eb54febe5142db6ce653" + [[package]] name = "bs58" version = "0.4.0" @@ -658,18 +664,18 @@ dependencies = [ [[package]] name = "cosmwasm-derive" -version = "1.2.5" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c9f7f0e51bfc7295f7b2664fe8513c966428642aa765dad8a74acdab5e0c773" +checksum = "dec361f3c09d7b41221948fc17be9b3c96cb58e55a02f82da36f888a651f2584" dependencies = [ "syn 1.0.109", ] [[package]] name = "cosmwasm-schema" -version = "1.2.5" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f00b363610218eea83f24bbab09e1a7c3920b79f068334fdfcc62f6129ef9fc" +checksum = "bb6b2fb76758ef59cddc77f2e2ae91c22f77da49037e9f182e9c2833f0e959b1" dependencies = [ "cosmwasm-schema-derive", "schemars", @@ -680,9 +686,9 @@ dependencies = [ [[package]] name = "cosmwasm-schema-derive" -version = "1.2.5" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae38f909b2822d32b275c9e2db9728497aa33ffe67dd463bc67c6a3b7092785c" +checksum = "2bfa39422f0d9f1c9a6fd3711573258495314dfa3aae738ea825ecd9964bc659" dependencies = [ "proc-macro2", "quote", @@ -691,11 +697,12 @@ dependencies = [ [[package]] name = "cosmwasm-std" -version = "1.2.5" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a49b85345e811c8e80ec55d0d091e4fcb4f00f97ab058f9be5f614c444a730cb" +checksum = "1f6dc2ee23313add5ecacc3ccac217b9967ad9d2d11bd56e5da6aa65a9da6138" dependencies = [ "base64 0.13.1", + "bnum", "cosmwasm-crypto", "cosmwasm-derive", "derivative", @@ -703,10 +710,9 @@ dependencies = [ "hex", "schemars", "serde", - "serde-json-wasm 0.5.1", + "serde-json-wasm", "sha2 0.10.6", "thiserror", - "uint", ] [[package]] @@ -810,12 +816,6 @@ dependencies = [ "cfg-if 1.0.0", ] -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - [[package]] name = "crypto-bigint" version = "0.4.9" @@ -927,9 +927,9 @@ dependencies = [ [[package]] name = "cw-controllers" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91440ce8ec4f0642798bc8c8cb6b9b53c1926c6dadaf0eed267a5145cd529071" +checksum = "d5d8edce4b78785f36413f67387e4be7d0cb7d032b5d4164bcc024f9c3f3f2ea" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -942,9 +942,9 @@ dependencies = [ [[package]] name = "cw-storage-plus" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053a5083c258acd68386734f428a5a171b29f7d733151ae83090c6fcc9417ffa" +checksum = "3f0e92a069d62067f3472c62e30adedb4cab1754725c0f2a682b3128d2bf3c79" dependencies = [ "cosmwasm-std", "schemars", @@ -968,15 +968,16 @@ dependencies = [ [[package]] name = "cw2" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fb70cee2cf0b4a8ff7253e6bc6647107905e8eb37208f87d54f67810faa62f8" +checksum = "29ac2dc7a55ad64173ca1e0a46697c31b7a5c51342f55a1e84a724da4eb99908" dependencies = [ "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus", "schemars", "serde", + "thiserror", ] [[package]] @@ -994,9 +995,9 @@ dependencies = [ [[package]] name = "cw3" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fe0b587008aa221cd2a2579a21990a28c4347dc53ad43167c68ad765f5b6efa" +checksum = "171af3d9127de6805a7dd819fb070c7d2f6c3ea85f4193f42cef259f0a7f33d5" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -1009,9 +1010,9 @@ dependencies = [ [[package]] name = "cw4" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c236e0bae02ce97e89235a681dd0e07d099524b369f1ef908d704db3e6b049b" +checksum = "a398696307efadaaa2d0850076f865fa706c959d493cb4203314f72be6b77a64" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -2566,22 +2567,20 @@ dependencies = [ name = "nym-coconut-bandwidth-contract-common" version = "0.1.0" dependencies = [ + "cosmwasm-schema", "cosmwasm-std", "nym-multisig-contract-common", - "schemars", - "serde", ] [[package]] name = "nym-coconut-dkg-common" version = "0.1.0" dependencies = [ + "cosmwasm-schema", "cosmwasm-std", "cw-utils", "nym-contracts-common", "nym-multisig-contract-common", - "schemars", - "serde", ] [[package]] @@ -2613,6 +2612,7 @@ name = "nym-contracts-common" version = "0.5.0" dependencies = [ "bs58 0.4.0", + "cosmwasm-schema", "cosmwasm-std", "schemars", "serde", @@ -2757,13 +2757,14 @@ name = "nym-mixnet-contract-common" version = "0.6.0" dependencies = [ "bs58 0.4.0", + "cosmwasm-schema", "cosmwasm-std", "humantime-serde", "log", "nym-contracts-common", "schemars", "serde", - "serde-json-wasm 0.4.1", + "serde-json-wasm", "serde_repr", "thiserror", "time", @@ -2788,11 +2789,11 @@ dependencies = [ name = "nym-name-service-common" version = "0.1.0" dependencies = [ + "cosmwasm-schema", "cosmwasm-std", "cw-controllers", "cw-utils", "nym-contracts-common", - "schemars", "serde", "thiserror", ] @@ -2867,12 +2868,11 @@ dependencies = [ name = "nym-service-provider-directory-common" version = "0.1.0" dependencies = [ + "cosmwasm-schema", "cosmwasm-std", "cw-controllers", "cw-utils", "nym-contracts-common", - "schemars", - "serde", "thiserror", ] @@ -3096,7 +3096,6 @@ dependencies = [ "nym-name-service-common", "nym-network-defaults", "nym-service-provider-directory-common", - "nym-vesting-contract", "nym-vesting-contract-common", "openssl", "prost", @@ -3111,33 +3110,16 @@ dependencies = [ "zeroize", ] -[[package]] -name = "nym-vesting-contract" -version = "1.4.0" -dependencies = [ - "cosmwasm-derive", - "cosmwasm-std", - "cw-storage-plus", - "cw2", - "nym-contracts-common", - "nym-mixnet-contract-common", - "nym-vesting-contract-common", - "schemars", - "semver 1.0.17", - "serde", - "thiserror", - "vergen", -] - [[package]] name = "nym-vesting-contract-common" version = "0.7.0" dependencies = [ + "cosmwasm-schema", "cosmwasm-std", "nym-contracts-common", "nym-mixnet-contract-common", - "schemars", "serde", + "thiserror", ] [[package]] @@ -4061,18 +4043,9 @@ dependencies = [ [[package]] name = "serde-json-wasm" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479b4dbc401ca13ee8ce902851b834893251404c4f3c65370a49e047a6be09a5" -dependencies = [ - "serde", -] - -[[package]] -name = "serde-json-wasm" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16a62a1fad1e1828b24acac8f2b468971dade7b8c3c2e672bcadefefb1f8c137" +checksum = "a15bee9b04dd165c3f4e142628982ddde884c2022a89e8ddf99c4829bf2c3a58" dependencies = [ "serde", ] @@ -4516,12 +4489,6 @@ dependencies = [ "tokio-rustls 0.23.4", ] -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - [[package]] name = "stringprep" version = "0.1.2" @@ -4984,18 +4951,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" -[[package]] -name = "uint" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" -dependencies = [ - "byteorder", - "crunchy", - "hex", - "static_assertions", -] - [[package]] name = "unicode-bidi" version = "0.3.13" diff --git a/common/client-libs/validator-client/Cargo.toml b/common/client-libs/validator-client/Cargo.toml index 31475887bc..5ac785a9c7 100644 --- a/common/client-libs/validator-client/Cargo.toml +++ b/common/client-libs/validator-client/Cargo.toml @@ -20,7 +20,6 @@ nym-multisig-contract-common = { path = "../../cosmwasm-smart-contracts/multisig nym-name-service-common = { path = "../../cosmwasm-smart-contracts/name-service" } nym-group-contract-common = { path = "../../cosmwasm-smart-contracts/group-contract" } nym-service-provider-directory-common = { path = "../../cosmwasm-smart-contracts/service-provider-directory" } -nym-vesting-contract = { path = "../../../contracts/vesting" } serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true } reqwest = { version = "0.11", features = ["json"] } diff --git a/common/client-libs/validator-client/src/nyxd/fee/mod.rs b/common/client-libs/validator-client/src/nyxd/fee/mod.rs index 0d67544203..ee30d1ffe5 100644 --- a/common/client-libs/validator-client/src/nyxd/fee/mod.rs +++ b/common/client-libs/validator-client/src/nyxd/fee/mod.rs @@ -32,7 +32,7 @@ impl Display for AutoFeeGrant { #[derive(Debug, Clone, Serialize, Deserialize)] pub enum Fee { - Manual(#[serde(with = "sealed::TxFee")] tx::Fee), + Manual(tx::Fee), Auto(Option), PayerGranterAuto(AutoFeeGrant), } @@ -121,58 +121,3 @@ impl GasAdjustable for Gas { } } } - -// a workaround to provide serde implementation for tx::Fee. We don't want to ever expose any of those -// types to the public and ideally they will get replaced by proper implementation inside comrs -mod sealed { - use cosmrs::tx::{self}; - use cosmrs::{AccountId, Denom as CosmosDenom}; - use cosmrs::{Coin as CosmosCoin, Gas}; - use serde::{Deserialize, Deserializer, Serialize, Serializer}; - - #[derive(Serialize, Deserialize, Clone)] - struct Coin { - denom: CosmosDenom, - amount: u128, - } - - impl From for CosmosCoin { - fn from(val: Coin) -> Self { - CosmosCoin { - denom: val.denom, - amount: val.amount, - } - } - } - - impl From for Coin { - fn from(val: CosmosCoin) -> Self { - Coin { - denom: val.denom, - amount: val.amount, - } - } - } - - fn coin_vec_ser(val: &[CosmosCoin], serializer: S) -> Result { - let vec: Vec = val.iter().cloned().map(Into::into).collect(); - vec.serialize(serializer) - } - fn coin_vec_deser<'de, D: Deserializer<'de>>( - deserializer: D, - ) -> Result, D::Error> { - let vec: Vec = Deserialize::deserialize(deserializer)?; - Ok(vec.iter().cloned().map(Into::into).collect()) - } - - #[derive(Serialize, Deserialize)] - #[serde(remote = "tx::Fee")] - pub(super) struct TxFee { - #[serde(serialize_with = "coin_vec_ser")] - #[serde(deserialize_with = "coin_vec_deser")] - pub amount: Vec, - pub gas_limit: Gas, - pub payer: Option, - pub granter: Option, - } -} diff --git a/common/client-libs/validator-client/src/nyxd/traits/mixnet_query_client.rs b/common/client-libs/validator-client/src/nyxd/traits/mixnet_query_client.rs index 84e4defaee..0297b90452 100644 --- a/common/client-libs/validator-client/src/nyxd/traits/mixnet_query_client.rs +++ b/common/client-libs/validator-client/src/nyxd/traits/mixnet_query_client.rs @@ -8,10 +8,9 @@ use async_trait::async_trait; use cosmrs::AccountId; use nym_contracts_common::signing::Nonce; use nym_mixnet_contract_common::delegation::{MixNodeDelegationResponse, OwnerProxySubKey}; -use nym_mixnet_contract_common::families::Family; use nym_mixnet_contract_common::mixnode::{ - MixNodeDetails, MixnodeRewardingDetailsResponse, PagedMixnodesDetailsResponse, - PagedUnbondedMixnodesResponse, StakeSaturationResponse, UnbondedMixnodeResponse, + MixnodeRewardingDetailsResponse, PagedMixnodesDetailsResponse, PagedUnbondedMixnodesResponse, + StakeSaturationResponse, UnbondedMixnodeResponse, }; use nym_mixnet_contract_common::reward_params::{Performance, RewardingParams}; use nym_mixnet_contract_common::rewarding::{ @@ -19,14 +18,15 @@ use nym_mixnet_contract_common::rewarding::{ }; use nym_mixnet_contract_common::{ delegation, ContractBuildInformation, ContractState, ContractStateParams, - CurrentIntervalResponse, EpochEventId, EpochStatus, GatewayBondResponse, - GatewayOwnershipResponse, IdentityKey, IntervalEventId, LayerDistribution, MixId, - MixOwnershipResponse, MixnodeDetailsResponse, NumberOfPendingEventsResponse, - PagedAllDelegationsResponse, PagedDelegatorDelegationsResponse, PagedFamiliesResponse, - PagedGatewayResponse, PagedMembersResponse, PagedMixNodeDelegationsResponse, - PagedMixnodeBondsResponse, PagedRewardedSetResponse, PendingEpochEventResponse, - PendingEpochEventsResponse, PendingIntervalEventResponse, PendingIntervalEventsResponse, - QueryMsg as MixnetQueryMsg, + CurrentIntervalResponse, EpochEventId, EpochStatus, FamilyByHeadResponse, + FamilyByLabelResponse, FamilyMembersByHeadResponse, FamilyMembersByLabelResponse, + GatewayBondResponse, GatewayOwnershipResponse, IdentityKey, IntervalEventId, LayerDistribution, + MixId, MixOwnershipResponse, MixnodeDetailsByIdentityResponse, MixnodeDetailsResponse, + NumberOfPendingEventsResponse, PagedAllDelegationsResponse, PagedDelegatorDelegationsResponse, + PagedFamiliesResponse, PagedGatewayResponse, PagedMembersResponse, + PagedMixNodeDelegationsResponse, PagedMixnodeBondsResponse, PagedRewardedSetResponse, + PendingEpochEventResponse, PendingEpochEventsResponse, PendingIntervalEventResponse, + PendingIntervalEventsResponse, QueryMsg as MixnetQueryMsg, }; use serde::Deserialize; @@ -100,6 +100,24 @@ pub trait MixnetQueryClient { .await } + async fn get_family_members_by_head + Send>( + &self, + head: S, + ) -> Result { + self.query_mixnet_contract(MixnetQueryMsg::GetFamilyMembersByHead { head: head.into() }) + .await + } + + async fn get_family_members_by_label + Send>( + &self, + label: S, + ) -> Result { + self.query_mixnet_contract(MixnetQueryMsg::GetFamilyMembersByLabel { + label: label.into(), + }) + .await + } + // mixnode-related: async fn get_mixnode_bonds_paged( @@ -178,7 +196,7 @@ pub trait MixnetQueryClient { async fn get_mixnode_details_by_identity( &self, mix_identity: IdentityKey, - ) -> Result, NyxdError> { + ) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetBondedMixnodeDetailsByIdentity { mix_identity, }) @@ -415,14 +433,17 @@ pub trait MixnetQueryClient { .await } - async fn get_node_family_by_label(&self, label: &str) -> Result, NyxdError> { + async fn get_node_family_by_label( + &self, + label: &str, + ) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetFamilyByLabel { label: label.to_string(), }) .await } - async fn get_node_family_by_head(&self, head: &str) -> Result, NyxdError> { + async fn get_node_family_by_head(&self, head: &str) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetFamilyByHead { head: head.to_string(), }) diff --git a/common/client-libs/validator-client/src/nyxd/traits/vesting_query_client.rs b/common/client-libs/validator-client/src/nyxd/traits/vesting_query_client.rs index 2f8931f98a..c70f0a78ca 100644 --- a/common/client-libs/validator-client/src/nyxd/traits/vesting_query_client.rs +++ b/common/client-libs/validator-client/src/nyxd/traits/vesting_query_client.rs @@ -10,12 +10,11 @@ use cosmwasm_std::{Coin as CosmWasmCoin, Timestamp}; use nym_contracts_common::ContractBuildInformation; use nym_mixnet_contract_common::MixId; use nym_vesting_contract_common::{ - messages::QueryMsg as VestingQueryMsg, AccountVestingCoins, AccountsResponse, + messages::QueryMsg as VestingQueryMsg, Account, AccountVestingCoins, AccountsResponse, AllDelegationsResponse, BaseVestingAccountInfo, DelegationTimesResponse, OriginalVestingResponse, Period, PledgeData, VestingCoinsResponse, VestingDelegation, }; use serde::Deserialize; -use vesting_contract::vesting::Account; #[async_trait] pub trait VestingQueryClient { diff --git a/common/client-libs/validator-client/src/nyxd/traits/vesting_signing_client.rs b/common/client-libs/validator-client/src/nyxd/traits/vesting_signing_client.rs index aba0d219cf..f1354566dd 100644 --- a/common/client-libs/validator-client/src/nyxd/traits/vesting_signing_client.rs +++ b/common/client-libs/validator-client/src/nyxd/traits/vesting_signing_client.rs @@ -12,10 +12,8 @@ use nym_mixnet_contract_common::families::FamilyHead; use nym_mixnet_contract_common::gateway::GatewayConfigUpdate; use nym_mixnet_contract_common::mixnode::{MixNodeConfigUpdate, MixNodeCostParams}; use nym_mixnet_contract_common::{Gateway, MixId, MixNode}; -use nym_vesting_contract_common::messages::{ - ExecuteMsg as VestingExecuteMsg, VestingSpecification, -}; -use nym_vesting_contract_common::PledgeCap; +use nym_vesting_contract_common::messages::ExecuteMsg as VestingExecuteMsg; +use nym_vesting_contract_common::{PledgeCap, VestingSpecification}; #[async_trait] pub trait VestingSigningClient { diff --git a/common/commands/src/validator/mixnet/delegators/delegate_to_mixnode.rs b/common/commands/src/validator/mixnet/delegators/delegate_to_mixnode.rs index 6efa068545..f07cd21d5f 100644 --- a/common/commands/src/validator/mixnet/delegators/delegate_to_mixnode.rs +++ b/common/commands/src/validator/mixnet/delegators/delegate_to_mixnode.rs @@ -34,6 +34,7 @@ pub async fn delegate_to_mixnode(args: Args, client: SigningClient) { .get_mixnode_details_by_identity(identity_key) .await .expect("contract query failed") + .mixnode_details .expect("mixnode with the specified identity doesnt exist"); node_details.mix_id() } diff --git a/common/commands/src/validator/mixnet/delegators/rewards/claim_delegator_reward.rs b/common/commands/src/validator/mixnet/delegators/rewards/claim_delegator_reward.rs index 3f2ce6b197..61265c9ac5 100644 --- a/common/commands/src/validator/mixnet/delegators/rewards/claim_delegator_reward.rs +++ b/common/commands/src/validator/mixnet/delegators/rewards/claim_delegator_reward.rs @@ -29,6 +29,7 @@ pub async fn claim_delegator_reward(args: Args, client: SigningClient) { .get_mixnode_details_by_identity(identity_key) .await .expect("contract query failed") + .mixnode_details .expect("mixnode with the specified identity doesnt exist"); node_details.mix_id() } diff --git a/common/commands/src/validator/mixnet/delegators/rewards/vesting_claim_delegator_reward.rs b/common/commands/src/validator/mixnet/delegators/rewards/vesting_claim_delegator_reward.rs index 96733206f9..6d9e0bcbf7 100644 --- a/common/commands/src/validator/mixnet/delegators/rewards/vesting_claim_delegator_reward.rs +++ b/common/commands/src/validator/mixnet/delegators/rewards/vesting_claim_delegator_reward.rs @@ -29,6 +29,7 @@ pub async fn vesting_claim_delegator_reward(args: Args, client: SigningClient) { .get_mixnode_details_by_identity(identity_key) .await .expect("contract query failed") + .mixnode_details .expect("mixnode with the specified identity doesnt exist"); node_details.mix_id() } diff --git a/common/commands/src/validator/mixnet/delegators/undelegate_from_mixnode.rs b/common/commands/src/validator/mixnet/delegators/undelegate_from_mixnode.rs index 2e4ce7b8cd..790f518267 100644 --- a/common/commands/src/validator/mixnet/delegators/undelegate_from_mixnode.rs +++ b/common/commands/src/validator/mixnet/delegators/undelegate_from_mixnode.rs @@ -29,6 +29,7 @@ pub async fn undelegate_from_mixnode(args: Args, client: SigningClient) { .get_mixnode_details_by_identity(identity_key) .await .expect("contract query failed") + .mixnode_details .expect("mixnode with the specified identity doesnt exist"); node_details.mix_id() } diff --git a/common/commands/src/validator/mixnet/delegators/vesting_delegate_to_mixnode.rs b/common/commands/src/validator/mixnet/delegators/vesting_delegate_to_mixnode.rs index ec10a60193..41a992f0ed 100644 --- a/common/commands/src/validator/mixnet/delegators/vesting_delegate_to_mixnode.rs +++ b/common/commands/src/validator/mixnet/delegators/vesting_delegate_to_mixnode.rs @@ -40,6 +40,7 @@ pub async fn vesting_delegate_to_mixnode(args: Args, client: SigningClient) { .get_mixnode_details_by_identity(identity_key) .await .expect("contract query failed") + .mixnode_details .expect("mixnode with the specified identity doesnt exist"); node_details.mix_id() } diff --git a/common/commands/src/validator/mixnet/delegators/vesting_undelegate_from_mixnode.rs b/common/commands/src/validator/mixnet/delegators/vesting_undelegate_from_mixnode.rs index 4f8dac045e..42493f493d 100644 --- a/common/commands/src/validator/mixnet/delegators/vesting_undelegate_from_mixnode.rs +++ b/common/commands/src/validator/mixnet/delegators/vesting_undelegate_from_mixnode.rs @@ -34,6 +34,7 @@ pub async fn vesting_undelegate_from_mixnode(args: Args, client: SigningClient) .get_mixnode_details_by_identity(identity_key) .await .expect("contract query failed") + .mixnode_details .expect("mixnode with the specified identity doesnt exist"); node_details.mix_id() } diff --git a/common/commands/src/validator/mixnet/operators/mixnode/families/create_family_join_permit_sign_payload.rs b/common/commands/src/validator/mixnet/operators/mixnode/families/create_family_join_permit_sign_payload.rs index a305df4839..7b02731b30 100644 --- a/common/commands/src/validator/mixnet/operators/mixnode/families/create_family_join_permit_sign_payload.rs +++ b/common/commands/src/validator/mixnet/operators/mixnode/families/create_family_join_permit_sign_payload.rs @@ -50,6 +50,7 @@ pub async fn create_family_join_permit_sign_payload(args: Args, client: QueryCli .get_node_family_by_head(mixnode.bond_information.identity()) .await .unwrap() + .family .is_none() { eprintln!("{} does not even seem to own a family!", args.address); diff --git a/common/commands/src/validator/mixnet/operators/mixnode/families/join_family.rs b/common/commands/src/validator/mixnet/operators/mixnode/families/join_family.rs index 8b888e8bd6..b69dd7a4b2 100644 --- a/common/commands/src/validator/mixnet/operators/mixnode/families/join_family.rs +++ b/common/commands/src/validator/mixnet/operators/mixnode/families/join_family.rs @@ -28,7 +28,7 @@ pub struct Args { pub async fn join_family(args: Args, client: SigningClient) { info!("Join family"); - let family_head = FamilyHead::new(&args.family_head.to_base58_string()); + let family_head = FamilyHead::new(args.family_head.to_base58_string()); let res = if args.with_vesting_account { client diff --git a/common/commands/src/validator/mixnet/operators/mixnode/families/leave_family.rs b/common/commands/src/validator/mixnet/operators/mixnode/families/leave_family.rs index 5cb06e7762..193c003ab4 100644 --- a/common/commands/src/validator/mixnet/operators/mixnode/families/leave_family.rs +++ b/common/commands/src/validator/mixnet/operators/mixnode/families/leave_family.rs @@ -23,7 +23,7 @@ pub struct Args { pub async fn leave_family(args: Args, client: SigningClient) { info!("Leave family"); - let family_head = FamilyHead::new(&args.family_head.to_base58_string()); + let family_head = FamilyHead::new(args.family_head.to_base58_string()); let res = if args.with_vesting_account { client diff --git a/common/commands/src/validator/vesting/create_vesting_schedule.rs b/common/commands/src/validator/vesting/create_vesting_schedule.rs index 524cdf67e1..f7397bf14c 100644 --- a/common/commands/src/validator/vesting/create_vesting_schedule.rs +++ b/common/commands/src/validator/vesting/create_vesting_schedule.rs @@ -11,7 +11,7 @@ use nym_network_defaults::NymNetworkDetails; use nym_validator_client::nyxd::traits::VestingSigningClient; use nym_validator_client::nyxd::AccountId; use nym_validator_client::nyxd::{CosmosCoin, Denom}; -use nym_vesting_contract_common::messages::VestingSpecification; +use nym_vesting_contract_common::types::VestingSpecification; use nym_vesting_contract_common::PledgeCap; use crate::context::SigningClient; diff --git a/common/cosmwasm-smart-contracts/coconut-bandwidth-contract/Cargo.toml b/common/cosmwasm-smart-contracts/coconut-bandwidth-contract/Cargo.toml index fc5e1b43d7..90cf90ba17 100644 --- a/common/cosmwasm-smart-contracts/coconut-bandwidth-contract/Cargo.toml +++ b/common/cosmwasm-smart-contracts/coconut-bandwidth-contract/Cargo.toml @@ -7,6 +7,9 @@ edition = "2021" [dependencies] cosmwasm-std = { workspace = true } -schemars = "0.8" -serde = { version = "1.0.103", default-features = false, features = ["derive"] } +cosmwasm-schema = { workspace = true } +cw2 = { workspace = true, optional = true } nym-multisig-contract-common = { path = "../multisig-contract" } + +[features] +schema = ["cw2"] \ No newline at end of file diff --git a/common/cosmwasm-smart-contracts/coconut-bandwidth-contract/src/deposit.rs b/common/cosmwasm-smart-contracts/coconut-bandwidth-contract/src/deposit.rs index d0572c3c91..c0e3a4acd3 100644 --- a/common/cosmwasm-smart-contracts/coconut-bandwidth-contract/src/deposit.rs +++ b/common/cosmwasm-smart-contracts/coconut-bandwidth-contract/src/deposit.rs @@ -1,10 +1,9 @@ // Copyright 2021 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; +use cosmwasm_schema::cw_serde; -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[cw_serde] pub struct DepositData { deposit_info: String, identity_key: String, diff --git a/common/cosmwasm-smart-contracts/coconut-bandwidth-contract/src/msg.rs b/common/cosmwasm-smart-contracts/coconut-bandwidth-contract/src/msg.rs index 8fffcc81eb..8387ac4ec5 100644 --- a/common/cosmwasm-smart-contracts/coconut-bandwidth-contract/src/msg.rs +++ b/common/cosmwasm-smart-contracts/coconut-bandwidth-contract/src/msg.rs @@ -1,39 +1,41 @@ // Copyright 2021 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use cosmwasm_std::Coin; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - use crate::{deposit::DepositData, spend_credential::SpendCredentialData}; +use cosmwasm_schema::cw_serde; +use cosmwasm_std::Coin; -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[cfg(feature = "schema")] +use crate::spend_credential::{PagedSpendCredentialResponse, SpendCredentialResponse}; +#[cfg(feature = "schema")] +use cosmwasm_schema::QueryResponses; + +#[cw_serde] pub struct InstantiateMsg { pub multisig_addr: String, pub pool_addr: String, pub mix_denom: String, } -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] +#[cw_serde] pub enum ExecuteMsg { DepositFunds { data: DepositData }, SpendCredential { data: SpendCredentialData }, ReleaseFunds { funds: Coin }, } -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] +#[cw_serde] +#[cfg_attr(feature = "schema", derive(QueryResponses))] pub enum QueryMsg { - GetSpentCredential { - blinded_serial_number: String, - }, + #[cfg_attr(feature = "schema", returns(SpendCredentialResponse))] + GetSpentCredential { blinded_serial_number: String }, + + #[cfg_attr(feature = "schema", returns(PagedSpendCredentialResponse))] GetAllSpentCredentials { limit: Option, start_after: Option, }, } -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] +#[cw_serde] pub struct MigrateMsg {} diff --git a/common/cosmwasm-smart-contracts/coconut-bandwidth-contract/src/spend_credential.rs b/common/cosmwasm-smart-contracts/coconut-bandwidth-contract/src/spend_credential.rs index 7cb47dc73b..d8fc108d14 100644 --- a/common/cosmwasm-smart-contracts/coconut-bandwidth-contract/src/spend_credential.rs +++ b/common/cosmwasm-smart-contracts/coconut-bandwidth-contract/src/spend_credential.rs @@ -1,14 +1,13 @@ // Copyright 2022 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 +use cosmwasm_schema::cw_serde; use cosmwasm_std::{from_binary, to_binary, Addr, Coin, CosmosMsg, StdResult, WasmMsg}; use nym_multisig_contract_common::msg::ExecuteMsg as MultisigExecuteMsg; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; use crate::msg::ExecuteMsg; -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[cw_serde] pub struct SpendCredentialData { funds: Coin, blinded_serial_number: String, @@ -37,13 +36,14 @@ impl SpendCredentialData { } } -#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +#[cw_serde] +#[derive(Copy)] pub enum SpendCredentialStatus { InProgress, Spent, } -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +#[cw_serde] pub struct SpendCredential { funds: Coin, blinded_serial_number: String, @@ -74,10 +74,12 @@ impl SpendCredential { } } -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +#[cw_serde] pub struct PagedSpendCredentialResponse { pub spend_credentials: Vec, pub per_page: usize, + + /// Field indicating paging information for the following queries if the caller wishes to get further entries. pub start_next_after: Option, } @@ -95,7 +97,7 @@ impl PagedSpendCredentialResponse { } } -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +#[cw_serde] pub struct SpendCredentialResponse { pub spend_credential: Option, } diff --git a/common/cosmwasm-smart-contracts/coconut-dkg/Cargo.toml b/common/cosmwasm-smart-contracts/coconut-dkg/Cargo.toml index 1f6d6c3f3f..271d5b5bb9 100644 --- a/common/cosmwasm-smart-contracts/coconut-dkg/Cargo.toml +++ b/common/cosmwasm-smart-contracts/coconut-dkg/Cargo.toml @@ -6,10 +6,12 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +cosmwasm-schema = { workspace = true } cosmwasm-std = { workspace = true } cw-utils = { workspace = true } -schemars = "0.8" -serde = { version = "1.0.103", default-features = false, features = ["derive"] } contracts-common = { path = "../contracts-common", package = "nym-contracts-common" } nym-multisig-contract-common = { path = "../multisig-contract" } + +[features] +schema = [] \ No newline at end of file diff --git a/common/cosmwasm-smart-contracts/coconut-dkg/src/dealer.rs b/common/cosmwasm-smart-contracts/coconut-dkg/src/dealer.rs index 7b24be4869..3547345fa1 100644 --- a/common/cosmwasm-smart-contracts/coconut-dkg/src/dealer.rs +++ b/common/cosmwasm-smart-contracts/coconut-dkg/src/dealer.rs @@ -2,11 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 use crate::types::{ContractSafeBytes, EncodedBTEPublicKeyWithProof, NodeIndex}; +use cosmwasm_schema::cw_serde; use cosmwasm_std::Addr; -use serde::{Deserialize, Serialize}; -#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)] -#[serde(rename_all = "snake_case")] +#[cw_serde] pub struct DealerDetails { pub address: Addr, pub bte_public_key_with_proof: EncodedBTEPublicKeyWithProof, @@ -14,8 +13,8 @@ pub struct DealerDetails { pub assigned_index: NodeIndex, } -#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)] -#[serde(rename_all = "snake_case")] +#[cw_serde] +#[derive(Copy)] pub enum DealerType { Current, Past, @@ -28,8 +27,7 @@ impl DealerType { } } -#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] -#[serde(rename_all = "snake_case")] +#[cw_serde] pub struct DealerDetailsResponse { pub details: Option, pub dealer_type: DealerType, @@ -44,11 +42,12 @@ impl DealerDetailsResponse { } } -#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] -#[serde(rename_all = "snake_case")] +#[cw_serde] pub struct PagedDealerResponse { pub dealers: Vec, pub per_page: usize, + + /// Field indicating paging information for the following queries if the caller wishes to get further entries. pub start_next_after: Option, } @@ -66,8 +65,7 @@ impl PagedDealerResponse { } } -#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] -#[serde(rename_all = "snake_case")] +#[cw_serde] pub struct ContractDealing { pub dealing: ContractSafeBytes, pub dealer: Addr, @@ -79,11 +77,12 @@ impl ContractDealing { } } -#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] -#[serde(rename_all = "snake_case")] +#[cw_serde] pub struct PagedDealingsResponse { pub dealings: Vec, pub per_page: usize, + + /// Field indicating paging information for the following queries if the caller wishes to get further entries. pub start_next_after: Option, } diff --git a/common/cosmwasm-smart-contracts/coconut-dkg/src/msg.rs b/common/cosmwasm-smart-contracts/coconut-dkg/src/msg.rs index 62891e8fe7..076f84291c 100644 --- a/common/cosmwasm-smart-contracts/coconut-dkg/src/msg.rs +++ b/common/cosmwasm-smart-contracts/coconut-dkg/src/msg.rs @@ -3,11 +3,19 @@ use crate::types::{ContractSafeBytes, EncodedBTEPublicKeyWithProof, EpochId, TimeConfiguration}; use crate::verification_key::VerificationKeyShare; +use cosmwasm_schema::cw_serde; use cosmwasm_std::Addr; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[cfg(feature = "schema")] +use crate::{ + dealer::{DealerDetailsResponse, PagedDealerResponse, PagedDealingsResponse}, + types::{Epoch, InitialReplacementData}, + verification_key::PagedVKSharesResponse, +}; +#[cfg(feature = "schema")] +use cosmwasm_schema::QueryResponses; + +#[cw_serde] pub struct InstantiateMsg { pub group_addr: String, pub multisig_addr: String, @@ -15,8 +23,7 @@ pub struct InstantiateMsg { pub mix_denom: String, } -#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq, JsonSchema)] -#[serde(rename_all = "snake_case")] +#[cw_serde] pub enum ExecuteMsg { RegisterDealer { bte_key_with_proof: EncodedBTEPublicKeyWithProof, @@ -44,28 +51,41 @@ pub enum ExecuteMsg { AdvanceEpochState {}, } -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] +#[cw_serde] +#[cfg_attr(feature = "schema", derive(QueryResponses))] pub enum QueryMsg { + #[cfg_attr(feature = "schema", returns(Epoch))] GetCurrentEpochState {}, + + #[cfg_attr(feature = "schema", returns(u64))] GetCurrentEpochThreshold {}, + + #[cfg_attr(feature = "schema", returns(Option))] GetInitialDealers {}, - GetDealerDetails { - dealer_address: String, - }, + + #[cfg_attr(feature = "schema", returns(DealerDetailsResponse))] + GetDealerDetails { dealer_address: String }, + + #[cfg_attr(feature = "schema", returns(PagedDealerResponse))] GetCurrentDealers { limit: Option, start_after: Option, }, + + #[cfg_attr(feature = "schema", returns(PagedDealerResponse))] GetPastDealers { limit: Option, start_after: Option, }, + + #[cfg_attr(feature = "schema", returns(PagedDealingsResponse))] GetDealing { idx: u64, limit: Option, start_after: Option, }, + + #[cfg_attr(feature = "schema", returns(PagedVKSharesResponse))] GetVerificationKeys { epoch_id: EpochId, limit: Option, @@ -73,6 +93,5 @@ pub enum QueryMsg { }, } -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] +#[cw_serde] pub struct MigrateMsg {} diff --git a/common/cosmwasm-smart-contracts/coconut-dkg/src/types.rs b/common/cosmwasm-smart-contracts/coconut-dkg/src/types.rs index ee0b854eb9..b01f1101ab 100644 --- a/common/cosmwasm-smart-contracts/coconut-dkg/src/types.rs +++ b/common/cosmwasm-smart-contracts/coconut-dkg/src/types.rs @@ -1,8 +1,7 @@ -// Copyright 2022 - Nym Technologies SA +// Copyright 2022-2023 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; +use cosmwasm_schema::cw_serde; use std::fmt::{Display, Formatter}; use std::str::FromStr; @@ -18,15 +17,14 @@ pub type EpochId = u64; // 2 public attributes, 2 private attributes, 1 fixed for coconut credential pub const TOTAL_DEALINGS: usize = 2 + 2 + 1; -#[derive(Serialize, Deserialize, Default, Clone, Debug, PartialEq, Eq, Ord, PartialOrd)] +#[cw_serde] pub struct InitialReplacementData { pub initial_dealers: Vec, pub initial_height: u64, } -#[derive( - Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq, Ord, PartialOrd, JsonSchema, -)] +#[cw_serde] +#[derive(Copy)] pub struct TimeConfiguration { // The time sign-up is open for dealers to join pub public_key_submission_time_secs: u64, @@ -75,8 +73,8 @@ impl Default for TimeConfiguration { } } -#[derive(Serialize, Deserialize, Default, Clone, Copy, Debug, PartialEq, Eq, Ord, PartialOrd)] -#[serde(rename_all = "snake_case")] +#[cw_serde] +#[derive(Copy, Default)] pub struct Epoch { pub state: EpochState, pub epoch_id: EpochId, @@ -155,8 +153,8 @@ impl Epoch { // 8. InProgress -> all receivers have all their secrets derived and all is good // // Note: It's important that the variant ordering is not changed otherwise it would mess up the derived `PartialOrd` -#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq, Ord, PartialOrd)] -#[serde(rename_all = "snake_case")] +#[cw_serde] +#[derive(Copy)] pub enum EpochState { PublicKeySubmission { resharing: bool }, DealingExchange { resharing: bool }, diff --git a/common/cosmwasm-smart-contracts/coconut-dkg/src/verification_key.rs b/common/cosmwasm-smart-contracts/coconut-dkg/src/verification_key.rs index 9b8338b6f1..7a3d02f2e8 100644 --- a/common/cosmwasm-smart-contracts/coconut-dkg/src/verification_key.rs +++ b/common/cosmwasm-smart-contracts/coconut-dkg/src/verification_key.rs @@ -3,14 +3,14 @@ use crate::msg::ExecuteMsg; use crate::types::{EpochId, NodeIndex}; +use cosmwasm_schema::cw_serde; use cosmwasm_std::{from_binary, to_binary, Addr, CosmosMsg, StdResult, Timestamp, WasmMsg}; use cw_utils::Expiration; use nym_multisig_contract_common::msg::ExecuteMsg as MultisigExecuteMsg; -use serde::{Deserialize, Serialize}; pub type VerificationKeyShare = String; -#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] +#[cw_serde] pub struct ContractVKShare { pub share: VerificationKeyShare, pub announce_address: String, @@ -20,11 +20,12 @@ pub struct ContractVKShare { pub verified: bool, } -#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] -#[serde(rename_all = "snake_case")] +#[cw_serde] pub struct PagedVKSharesResponse { pub shares: Vec, pub per_page: usize, + + /// Field indicating paging information for the following queries if the caller wishes to get further entries. pub start_next_after: Option, } diff --git a/common/cosmwasm-smart-contracts/contracts-common/Cargo.toml b/common/cosmwasm-smart-contracts/contracts-common/Cargo.toml index 512c3edc6b..fc55402be0 100644 --- a/common/cosmwasm-smart-contracts/contracts-common/Cargo.toml +++ b/common/cosmwasm-smart-contracts/contracts-common/Cargo.toml @@ -10,9 +10,10 @@ repository = { workspace = true } [dependencies] bs58 = "0.4.0" cosmwasm-std = { workspace = true } +cosmwasm-schema = { workspace = true } schemars = "0.8" -serde = { version = "1.0", features = ["derive"] } -thiserror = "1" +serde = { workspace = true, features = ["derive"] } +thiserror = { workspace = true } [dev-dependencies] -serde_json = "1.0.0" +serde_json = { workspace = true } diff --git a/common/cosmwasm-smart-contracts/contracts-common/src/dealings.rs b/common/cosmwasm-smart-contracts/contracts-common/src/dealings.rs index 87251d38e7..8c79ccbcfc 100644 --- a/common/cosmwasm-smart-contracts/contracts-common/src/dealings.rs +++ b/common/cosmwasm-smart-contracts/contracts-common/src/dealings.rs @@ -1,8 +1,6 @@ // Copyright 2022 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -#[cfg(feature = "dkg")] -use nym_dkg::{error::DkgError, Dealing}; use schemars::JsonSchema; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use std::fmt::{Display, Formatter}; diff --git a/common/cosmwasm-smart-contracts/contracts-common/src/types.rs b/common/cosmwasm-smart-contracts/contracts-common/src/types.rs index 858907bafa..4dca6b173b 100644 --- a/common/cosmwasm-smart-contracts/contracts-common/src/types.rs +++ b/common/cosmwasm-smart-contracts/contracts-common/src/types.rs @@ -1,16 +1,17 @@ // Copyright 2022 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 +use cosmwasm_schema::cw_serde; use cosmwasm_std::Decimal; use cosmwasm_std::Uint128; -use schemars::JsonSchema; use serde::de::Error; -use serde::{Deserialize, Deserializer, Serialize}; +use serde::{Deserialize, Deserializer}; use std::fmt::{self, Display, Formatter}; use std::ops::Mul; use std::str::FromStr; use thiserror::Error; +/// Ed25519 public key strinfified into base58. pub type IdentityKey = String; pub type IdentityKeyRef<'a> = &'a str; @@ -32,9 +33,8 @@ pub enum ContractsCommonError { /// Percent represents a value between 0 and 100% /// (i.e. between 0.0 and 1.0) -#[derive( - Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Serialize, Deserialize, JsonSchema, -)] +#[cw_serde] +#[derive(Copy, Default, PartialOrd)] pub struct Percent(#[serde(deserialize_with = "de_decimal_percent")] Decimal); impl Percent { @@ -129,7 +129,7 @@ where // TODO: there's no reason this couldn't be used for proper binaries, but in that case // perhaps the struct should get renamed and moved to a "more" common crate -#[derive(Debug, Serialize, Deserialize)] +#[cw_serde] pub struct ContractBuildInformation { // VERGEN_BUILD_TIMESTAMP /// Provides the build timestamp, for example `2021-02-23T20:14:46.558472672+00:00`. diff --git a/common/cosmwasm-smart-contracts/mixnet-contract/Cargo.toml b/common/cosmwasm-smart-contracts/mixnet-contract/Cargo.toml index 736cedf911..47397d7b88 100644 --- a/common/cosmwasm-smart-contracts/mixnet-contract/Cargo.toml +++ b/common/cosmwasm-smart-contracts/mixnet-contract/Cargo.toml @@ -11,14 +11,16 @@ repository = { workspace = true } [dependencies] bs58 = "0.4.0" cosmwasm-std = { workspace = true } -serde = { version = "1.0", features = ["derive"] } +cosmwasm-schema = { workspace = true } +cw2 = { workspace = true, optional = true } +serde = { workspace = true, features = ["derive"] } serde_repr = "0.1" + +# we still have to preserve that import for `JsonSchema` for `Layer` type (since we can't use cw_serde macro due to custom serde impl) schemars = "0.8" thiserror = "1.0" contracts-common = { path = "../contracts-common", package = "nym-contracts-common", version = "0.5.0" } -# use 0.4.1 as that's the version used by cosmwasm-std 1.0.0 -# (and ideally we don't want to pull the same dependency twice) -serde-json-wasm = "=0.4.1" +serde-json-wasm = { workspace = true } humantime-serde = "1.1.1" # TO CHECK WHETHER STILL NEEDED: @@ -33,4 +35,5 @@ time = { version = "0.3.5", features = ["serde", "macros"] } [features] default = [] contract-testing = [] +schema = ["cw2"] generate-ts = ['ts-rs'] diff --git a/common/cosmwasm-smart-contracts/mixnet-contract/src/delegation.rs b/common/cosmwasm-smart-contracts/mixnet-contract/src/delegation.rs index 55294498b8..3a7cdd7702 100644 --- a/common/cosmwasm-smart-contracts/mixnet-contract/src/delegation.rs +++ b/common/cosmwasm-smart-contracts/mixnet-contract/src/delegation.rs @@ -1,15 +1,11 @@ // Copyright 2021-2023 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -// due to code generated by JsonSchema -#![allow(clippy::field_reassign_with_default)] - use crate::constants::TOKEN_SUPPLY; use crate::helpers::IntoBaseDecimal; use crate::{Addr, MixId}; +use cosmwasm_schema::cw_serde; use cosmwasm_std::{Coin, Decimal, StdResult}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; // just use a string representation of those so that we wouldn't need to bother with decoding bytes // and trying to figure out whether they're valid, etc @@ -37,7 +33,9 @@ pub fn generate_owner_storage_subkey( } } -#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, JsonSchema)] +/// Information about tokens being delegated towards given mixnode in order to accrue rewards +/// with their work. +#[cw_serde] pub struct Delegation { /// Address of the owner of this delegation. pub owner: Addr, @@ -114,9 +112,13 @@ impl Delegation { } } -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +/// Response containing paged list of all delegations made towards particular mixnode. +#[cw_serde] pub struct PagedMixNodeDelegationsResponse { + /// Each individual delegation made. pub delegations: Vec, + + /// Field indicating paging information for the following queries if the caller wishes to get further entries. pub start_next_after: Option, } @@ -129,9 +131,13 @@ impl PagedMixNodeDelegationsResponse { } } -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +/// Response containing paged list of all delegations made by the particular address. +#[cw_serde] pub struct PagedDelegatorDelegationsResponse { + /// Each individual delegation made. pub delegations: Vec, + + /// Field indicating paging information for the following queries if the caller wishes to get further entries. pub start_next_after: Option<(MixId, OwnerProxySubKey)>, } @@ -147,9 +153,13 @@ impl PagedDelegatorDelegationsResponse { } } -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +/// Response containing delegation details. +#[cw_serde] pub struct MixNodeDelegationResponse { + /// If the delegation exists, this field contains its detailed information. pub delegation: Option, + + /// Flag indicating whether the node towards which the delegation was made is still bonded in the network. pub mixnode_still_bonded: bool, } @@ -162,9 +172,13 @@ impl MixNodeDelegationResponse { } } -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +/// Response containing paged list of all delegations currently active. +#[cw_serde] pub struct PagedAllDelegationsResponse { + /// Each individual delegation made. pub delegations: Vec, + + /// Field indicating paging information for the following queries if the caller wishes to get further entries. pub start_next_after: Option, } diff --git a/common/cosmwasm-smart-contracts/mixnet-contract/src/error.rs b/common/cosmwasm-smart-contracts/mixnet-contract/src/error.rs index 0b572183ac..6007884cc8 100644 --- a/common/cosmwasm-smart-contracts/mixnet-contract/src/error.rs +++ b/common/cosmwasm-smart-contracts/mixnet-contract/src/error.rs @@ -165,6 +165,9 @@ pub enum MixnetContractError { #[error("Family with head {head} does not exist!")] FamilyDoesNotExist { head: String }, + #[error("Family with label {label} does not exist!")] + FamilyLabelDoesNotExist { label: String }, + #[error("Family with label '{0}' already exists")] FamilyWithLabelExists(String), diff --git a/common/cosmwasm-smart-contracts/mixnet-contract/src/families.rs b/common/cosmwasm-smart-contracts/mixnet-contract/src/families.rs index 122e1690f6..5b44483c83 100644 --- a/common/cosmwasm-smart-contracts/mixnet-contract/src/families.rs +++ b/common/cosmwasm-smart-contracts/mixnet-contract/src/families.rs @@ -1,22 +1,34 @@ +// Copyright 2022-2023 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + use crate::{IdentityKey, IdentityKeyRef}; +use cosmwasm_schema::cw_serde; use cosmwasm_std::Addr; use schemars::JsonSchema; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use std::fmt::{Display, Formatter}; use std::str::FromStr; +/// A group of mixnodes associated with particular staking entity. +/// When defined all nodes belonging to the same family will be prioritised to be put onto the same layer. #[cfg_attr(feature = "generate-ts", derive(ts_rs::TS))] #[cfg_attr( feature = "generate-ts", ts(export_to = "ts-packages/types/src/types/rust/NodeFamily.ts") )] -#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq, JsonSchema)] +#[cw_serde] pub struct Family { + /// Owner of this family. head: FamilyHead, + + /// Optional proxy (i.e. vesting contract address) used when creating the family. proxy: Option, + + /// Human readable label for this family. label: String, } +/// Head of particular family as identified by its identity key (i.e. public component of its ed25519 keypair stringified into base58). #[cfg_attr(feature = "generate-ts", derive(ts_rs::TS))] #[cfg_attr( feature = "generate-ts", @@ -62,8 +74,8 @@ impl Display for FamilyHead { } impl FamilyHead { - pub fn new(identity: IdentityKeyRef<'_>) -> Self { - FamilyHead(identity.to_string()) + pub fn new>(identity: S) -> Self { + FamilyHead(identity.into()) } pub fn identity(&self) -> IdentityKeyRef<'_> { @@ -99,6 +111,66 @@ impl Family { } } +/// Response containing paged list of all families registered in the contract. +#[cw_serde] +pub struct PagedFamiliesResponse { + /// The families registered in the contract. + pub families: Vec, + + /// Field indicating paging information for the following queries if the caller wishes to get further entries. + pub start_next_after: Option, +} + +/// Response containing paged list of all family members (of ALL families) registered in the contract. +#[cw_serde] +pub struct PagedMembersResponse { + /// The members alongside their family heads. + pub members: Vec<(IdentityKey, FamilyHead)>, + + /// Field indicating paging information for the following queries if the caller wishes to get further entries. + pub start_next_after: Option, +} + +/// Response containing family information. +#[cw_serde] +pub struct FamilyByHeadResponse { + /// The family head used for the query. + pub head: FamilyHead, + + /// If applicable, the family associated with the provided head. + pub family: Option, +} + +/// Response containing family information. +#[cw_serde] +pub struct FamilyByLabelResponse { + /// The family label used for the query. + pub label: String, + + /// If applicable, the family associated with the provided label. + pub family: Option, +} + +/// Response containing family members information. +#[cw_serde] +pub struct FamilyMembersByHeadResponse { + /// The family head used for the query. + pub head: FamilyHead, + + /// All members belonging to the specified family. + pub members: Vec, +} + +/// Response containing family members information. +#[cw_serde] +pub struct FamilyMembersByLabelResponse { + /// The family label used for the query. + pub label: String, + + /// All members belonging to the specified family. + pub members: Vec, +} + #[cfg(test)] mod tests { use super::*; diff --git a/common/cosmwasm-smart-contracts/mixnet-contract/src/gateway.rs b/common/cosmwasm-smart-contracts/mixnet-contract/src/gateway.rs index c312d42bf7..fd29090374 100644 --- a/common/cosmwasm-smart-contracts/mixnet-contract/src/gateway.rs +++ b/common/cosmwasm-smart-contracts/mixnet-contract/src/gateway.rs @@ -1,34 +1,56 @@ // Copyright 2021-2023 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -// due to code generated by JsonSchema -#![allow(clippy::field_reassign_with_default)] - use crate::{IdentityKey, SphinxKey}; +use cosmwasm_schema::cw_serde; use cosmwasm_std::{Addr, Coin}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; use std::cmp::Ordering; use std::fmt::Display; -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, PartialOrd, Serialize, JsonSchema)] +/// Information provided by the node operator during bonding that are used to allow other entities to use the services of this node. +#[cw_serde] +#[derive(PartialOrd)] pub struct Gateway { + /// Network address of this gateway, for example 1.1.1.1 or foo.gateway.com pub host: String, + + /// Port used by this gateway for listening for mix packets. pub mix_port: u16, + + /// Port used by this gateway for listening for client requests. pub clients_port: u16, + + /// The physical, self-reported, location of this gateway. + // this field should be deprecated in favour of externally hosted information, like the mixnodes'. pub location: String, + + /// Base58-encoded x25519 public key used for sphinx key derivation. pub sphinx_key: SphinxKey, + /// Base58 encoded ed25519 EdDSA public key of the gateway used to derive shared keys with clients pub identity_key: IdentityKey, + + /// The self-reported semver version of this gateway. pub version: String, } -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +/// Basic gateway information provided by the node operator. +#[cw_serde] pub struct GatewayBond { + /// Original amount pledged by the operator of this node. pub pledge_amount: Coin, + + /// Address of the owner of this gateway. pub owner: Addr, + + /// Block height at which this gateway has been bonded. pub block_height: u64, + + /// Information provided by the operator for the purposes of bonding. pub gateway: Gateway, + + /// Entity who bonded this gateway on behalf of the owner. + /// If exists, it's most likely the address of the vesting contract. pub proxy: Option, } @@ -117,7 +139,7 @@ impl Display for GatewayBond { feature = "generate-ts", ts(export_to = "ts-packages/types/src/types/rust/GatewayConfigUpdate.ts") )] -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +#[cw_serde] pub struct GatewayConfigUpdate { pub host: String, pub mix_port: u16, @@ -132,10 +154,17 @@ impl GatewayConfigUpdate { } } -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +/// Response containing paged list of all gateway bonds in the contract. +#[cw_serde] pub struct PagedGatewayResponse { + /// The gateway bond information present in the contract. pub nodes: Vec, + + /// Maximum number of entries that could be included in a response. `per_page <= nodes.len()` + // this field is rather redundant and should be deprecated. pub per_page: usize, + + /// Field indicating paging information for the following queries if the caller wishes to get further entries. pub start_next_after: Option, } @@ -153,15 +182,23 @@ impl PagedGatewayResponse { } } -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +/// Response containing details of a gateway belonging to the particular owner. +#[cw_serde] pub struct GatewayOwnershipResponse { + /// Validated address of the gateway owner. pub address: Addr, + + /// If the provided address owns a gateway, this field contains its details. pub gateway: Option, } -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +/// Response containing details of a gateway with the provided identity key. +#[cw_serde] pub struct GatewayBondResponse { + /// The identity key (base58-encoded ed25519 public key) of the gateway. pub identity: IdentityKey, + + /// If there exists a gateway with the provided identity key, this field contains its details. pub gateway: Option, } diff --git a/common/cosmwasm-smart-contracts/mixnet-contract/src/interval.rs b/common/cosmwasm-smart-contracts/mixnet-contract/src/interval.rs index 5afdbd827e..cee4cf02be 100644 --- a/common/cosmwasm-smart-contracts/mixnet-contract/src/interval.rs +++ b/common/cosmwasm-smart-contracts/mixnet-contract/src/interval.rs @@ -2,20 +2,20 @@ // SPDX-License-Identifier: Apache-2.0 use crate::error::MixnetContractError; -use crate::pending_events::{PendingEpochEvent, PendingIntervalEvent}; -use crate::{ - EpochEventId, EpochId, IntervalEventId, IntervalId, MixId, PendingEpochEventData, - PendingIntervalEventData, -}; +use crate::MixId; +use cosmwasm_schema::cw_serde; +use cosmwasm_schema::schemars::gen::SchemaGenerator; +use cosmwasm_schema::schemars::schema::{InstanceType, Schema, SchemaObject}; +use cosmwasm_schema::schemars::JsonSchema; use cosmwasm_std::{Addr, Env}; -use schemars::gen::SchemaGenerator; -use schemars::schema::{InstanceType, Schema, SchemaObject}; -use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use std::fmt::{Display, Formatter}; use std::time::Duration; use time::OffsetDateTime; +pub type EpochId = u32; +pub type IntervalId = u32; + // internally, since version 0.3.6, time uses deserialize_any for deserialization, which can't be handled // by serde wasm. We could just downgrade to 0.3.5 and call it a day, but then it would break // when we decided to upgrade it at some point in the future. And then it would have been more problematic @@ -64,12 +64,15 @@ pub(crate) mod string_rfc3339_offset_date_time { } } -#[derive(Debug, Serialize, Deserialize, Eq, PartialEq)] +/// The status of the current rewarding epoch. +#[cw_serde] pub struct EpochStatus { // TODO: introduce mechanism to allow another validator to take over if no progress has been made in X blocks / Y seconds /// Specifies either, which validator is currently performing progression into the following epoch (if the epoch is currently being progressed), /// or which validator was responsible for progressing into the current epoch (if the epoch is currently in progress) pub being_advanced_by: Addr, + + /// The concrete state of the epoch. pub state: EpochState, } @@ -150,7 +153,9 @@ impl EpochStatus { } } -#[derive(Debug, Clone, Copy, Serialize, Deserialize, Eq, PartialEq)] +/// The state of the current rewarding epoch. +#[cw_serde] +#[derive(Copy)] pub enum EpochState { /// Represents the state of an epoch that's in progress (well, duh.) /// All actions are allowed to be issued. @@ -159,8 +164,10 @@ pub enum EpochState { /// Represents the state of an epoch when the rewarding entity has been decided on, /// and the mixnodes are in the process of being rewarded for their work in this epoch. Rewarding { + /// The id of the last node that has already received its rewards. last_rewarded: MixId, + /// The id of the last node that's going to be rewarded before progressing into the next state. final_node_id: MixId, // total_rewarded: u32, }, @@ -191,6 +198,7 @@ impl Display for EpochState { } } +/// Specification of a rewarding interval. #[cfg_attr(feature = "generate-ts", derive(ts_rs::TS))] #[cfg_attr( feature = "generate-ts", @@ -198,7 +206,10 @@ impl Display for EpochState { )] #[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq, Serialize)] pub struct Interval { + /// Monotonously increasing id of this interval. id: IntervalId, + + /// Number of epochs in this interval. epochs_in_interval: u32, // TODO add a better TS type generation @@ -207,10 +218,17 @@ pub struct Interval { // note: the `ts-rs failed to parse this attribute. It will be ignored.` warning emitted during // compilation is fine (I guess). `ts-rs` can't handle `with` serde attribute, but that's okay // since we explicitly specified this field should correspond to typescript's string + /// The timestamp indicating the start of the current rewarding epoch. current_epoch_start: OffsetDateTime, + + /// Monotonously increasing id of the current epoch in this interval. current_epoch_id: EpochId, + + /// The duration of all epochs in this interval. #[cfg_attr(feature = "generate-ts", ts(type = "{ secs: number; nanos: number; }"))] epoch_length: Duration, + + /// The total amount of elapsed epochs since the first epoch of the first interval. total_elapsed_epochs: EpochId, } @@ -455,11 +473,19 @@ impl Display for Interval { } } -#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq, Serialize)] +/// Information about the current rewarding interval. +#[cw_serde] pub struct CurrentIntervalResponse { + /// Detailed information about the underlying interval. pub interval: Interval, + + /// The current blocktime pub current_blocktime: u64, + + /// Flag indicating whether the current interval is over and it should be advanced. pub is_current_interval_over: bool, + + /// Flag indicating whether the current epoch is over and it should be advanced. pub is_current_epoch_over: bool, } @@ -489,87 +515,6 @@ impl CurrentIntervalResponse { } } -#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -pub struct PendingEpochEventsResponse { - pub seconds_until_executable: i64, - pub events: Vec, - pub start_next_after: Option, -} - -impl PendingEpochEventsResponse { - pub fn new( - seconds_until_executable: i64, - events: Vec, - start_next_after: Option, - ) -> Self { - PendingEpochEventsResponse { - seconds_until_executable, - events, - start_next_after, - } - } -} - -#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -pub struct PendingIntervalEventsResponse { - pub seconds_until_executable: i64, - pub events: Vec, - pub start_next_after: Option, -} - -impl PendingIntervalEventsResponse { - pub fn new( - seconds_until_executable: i64, - events: Vec, - start_next_after: Option, - ) -> Self { - PendingIntervalEventsResponse { - seconds_until_executable, - events, - start_next_after, - } - } -} - -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub struct PendingEpochEventResponse { - pub event_id: EpochEventId, - pub event: Option, -} - -impl PendingEpochEventResponse { - pub fn new(event_id: EpochEventId, event: Option) -> Self { - PendingEpochEventResponse { event_id, event } - } -} - -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub struct PendingIntervalEventResponse { - pub event_id: IntervalEventId, - pub event: Option, -} - -impl PendingIntervalEventResponse { - pub fn new(event_id: IntervalEventId, event: Option) -> Self { - PendingIntervalEventResponse { event_id, event } - } -} - -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub struct NumberOfPendingEventsResponse { - pub epoch_events: u32, - pub interval_events: u32, -} - -impl NumberOfPendingEventsResponse { - pub fn new(epoch_events: u32, interval_events: u32) -> Self { - Self { - epoch_events, - interval_events, - } - } -} - #[cfg(test)] mod tests { use super::*; diff --git a/common/cosmwasm-smart-contracts/mixnet-contract/src/lib.rs b/common/cosmwasm-smart-contracts/mixnet-contract/src/lib.rs index e2a4a67a56..50a5e90aec 100644 --- a/common/cosmwasm-smart-contracts/mixnet-contract/src/lib.rs +++ b/common/cosmwasm-smart-contracts/mixnet-contract/src/lib.rs @@ -11,14 +11,14 @@ pub mod events; pub mod families; pub mod gateway; pub mod helpers; -mod interval; +pub mod interval; pub mod mixnode; -mod msg; +pub mod msg; pub mod pending_events; pub mod reward_params; pub mod rewarding; pub mod signing_types; -mod types; +pub mod types; pub use contracts_common::types::*; pub use cosmwasm_std::{Addr, Coin, Decimal, Fraction}; @@ -26,25 +26,32 @@ pub use delegation::{ Delegation, PagedAllDelegationsResponse, PagedDelegatorDelegationsResponse, PagedMixNodeDelegationsResponse, }; +pub use families::{ + Family, FamilyByHeadResponse, FamilyByLabelResponse, FamilyHead, FamilyMembersByHeadResponse, + FamilyMembersByLabelResponse, PagedFamiliesResponse, PagedMembersResponse, +}; pub use gateway::{ Gateway, GatewayBond, GatewayBondResponse, GatewayConfigUpdate, GatewayOwnershipResponse, PagedGatewayResponse, }; pub use interval::{ - CurrentIntervalResponse, EpochState, EpochStatus, Interval, NumberOfPendingEventsResponse, - PendingEpochEventResponse, PendingEpochEventsResponse, PendingIntervalEventResponse, - PendingIntervalEventsResponse, + CurrentIntervalResponse, EpochId, EpochState, EpochStatus, Interval, IntervalId, }; pub use mixnode::{ Layer, MixNode, MixNodeBond, MixNodeConfigUpdate, MixNodeCostParams, MixNodeDetails, - MixNodeRewarding, MixOwnershipResponse, MixnodeDetailsResponse, PagedMixnodeBondsResponse, - RewardedSetNodeStatus, UnbondedMixnode, + MixNodeRewarding, MixOwnershipResponse, MixnodeDetailsByIdentityResponse, + MixnodeDetailsResponse, PagedMixnodeBondsResponse, RewardedSetNodeStatus, UnbondedMixnode, }; pub use msg::*; pub use pending_events::{ - PendingEpochEvent, PendingEpochEventData, PendingEpochEventKind, PendingIntervalEvent, - PendingIntervalEventData, PendingIntervalEventKind, + EpochEventId, IntervalEventId, NumberOfPendingEventsResponse, PendingEpochEvent, + PendingEpochEventData, PendingEpochEventKind, PendingEpochEventResponse, + PendingEpochEventsResponse, PendingIntervalEvent, PendingIntervalEventData, + PendingIntervalEventKind, PendingIntervalEventResponse, PendingIntervalEventsResponse, }; pub use reward_params::{IntervalRewardParams, IntervalRewardingParamsUpdate, RewardingParams}; +pub use rewarding::{ + EstimatedCurrentEpochRewardResponse, PagedRewardedSetResponse, PendingRewardResponse, +}; pub use signing_types::*; pub use types::*; diff --git a/common/cosmwasm-smart-contracts/mixnet-contract/src/mixnode.rs b/common/cosmwasm-smart-contracts/mixnet-contract/src/mixnode.rs index 69f1a89209..248bc7e143 100644 --- a/common/cosmwasm-smart-contracts/mixnet-contract/src/mixnode.rs +++ b/common/cosmwasm-smart-contracts/mixnet-contract/src/mixnode.rs @@ -11,19 +11,24 @@ use crate::reward_params::{NodeRewardParams, RewardingParams}; use crate::rewarding::helpers::truncate_reward; use crate::rewarding::RewardDistribution; use crate::{Delegation, EpochEventId, EpochId, IdentityKey, MixId, Percent, SphinxKey}; +use cosmwasm_schema::cw_serde; use cosmwasm_std::{Addr, Coin, Decimal, StdResult, Uint128}; use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; use serde_repr::{Deserialize_repr, Serialize_repr}; +/// Current state of given node in the rewarded set. #[cfg_attr(feature = "generate-ts", derive(ts_rs::TS))] #[cfg_attr( feature = "generate-ts", ts(export_to = "ts-packages/types/src/types/rust/RewardedSetNodeStatus.ts") )] -#[derive(Clone, Copy, Debug, Deserialize, Serialize, JsonSchema, PartialEq, Eq)] +#[cw_serde] +#[derive(Copy)] pub enum RewardedSetNodeStatus { + /// Node that is currently active, i.e. is expected to be used by clients for mixing packets. Active, + + /// Node that is currently in standby, i.e. it's present in the rewarded set but is not active. Standby, } @@ -33,10 +38,16 @@ impl RewardedSetNodeStatus { } } -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +/// Full details associated with given mixnode. +#[cw_serde] pub struct MixNodeDetails { + /// Basic bond information of this mixnode, such as owner address, original pledge, etc. pub bond_information: MixNodeBond, + + /// Details used for computation of rewarding related data. pub rewarding_details: MixNodeRewarding, + + /// Adjustments to the mixnode that are ought to happen during future epoch transitions. #[serde(default)] pub pending_changes: PendingMixNodeChanges, } @@ -86,7 +97,7 @@ impl MixNodeDetails { } } -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +#[cw_serde] pub struct MixNodeRewarding { /// Information provided by the operator that influence the cost function. pub cost_params: MixNodeCostParams, @@ -464,8 +475,8 @@ impl MixNodeRewarding { } } -// operator information + data assigned by the contract(s) -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +/// Basic mixnode information provided by the node operator. +#[cw_serde] pub struct MixNodeBond { /// Unique id assigned to the bonded mixnode. pub mix_id: MixId, @@ -533,21 +544,24 @@ impl MixNodeBond { } } -// information provided by the operator -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +/// Information provided by the node operator during bonding that are used to allow other entities to use the services of this node. +#[cw_serde] #[cfg_attr(feature = "generate-ts", derive(ts_rs::TS))] #[cfg_attr( feature = "generate-ts", ts(export_to = "ts-packages/types/src/types/rust/Mixnode.ts") )] pub struct MixNode { - /// Network address of this mixnode, for example 1.1.1.1:1234 or foo.mixnode.com + /// Network address of this mixnode, for example 1.1.1.1 or foo.mixnode.com pub host: String, + /// Port used by this mixnode for listening for mix packets. pub mix_port: u16, + /// Port used by this mixnode for listening for verloc requests. pub verloc_port: u16, + /// Port used by this mixnode for its http(s) API pub http_api_port: u16, /// Base58-encoded x25519 public key used for sphinx key derivation. @@ -556,11 +570,15 @@ pub struct MixNode { /// Base58-encoded ed25519 EdDSA public key. pub identity_key: IdentityKey, + /// The self-reported semver version of this mixnode. pub version: String, } -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +/// The cost parameters, or the cost function, defined for the particular mixnode that influences +/// how the rewards should be split between the node operator and its delegators. +#[cw_serde] pub struct MixNodeCostParams { + /// The profit margin of the associated mixnode, i.e. the desired percent of the reward to be distributed to the operator. pub profit_margin_percent: Percent, /// Operating cost of the associated mixnode per the entire interval. @@ -633,7 +651,8 @@ impl From for u8 { feature = "generate-ts", ts(export_to = "ts-packages/types/src/types/rust/PendingMixnodeChanges.ts") )] -#[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +#[cw_serde] +#[derive(Default, Copy)] pub struct PendingMixNodeChanges { pub pledge_change: Option, // pub cost_params_change: Option, @@ -647,21 +666,27 @@ impl PendingMixNodeChanges { } } +/// Basic information of a node that used to be part of the mix network but has already unbonded. #[cfg_attr(feature = "generate-ts", derive(ts_rs::TS))] #[cfg_attr( feature = "generate-ts", ts(export_to = "ts-packages/types/src/types/rust/UnbondedMixnode.ts") )] -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +#[cw_serde] pub struct UnbondedMixnode { + /// Base58-encoded ed25519 EdDSA public key. pub identity_key: IdentityKey, + /// Address of the owner of this mixnode. #[cfg_attr(feature = "generate-ts", ts(type = "string"))] pub owner: Addr, + /// Entity who bonded this mixnode on behalf of the owner. + /// If exists, it's most likely the address of the vesting contract. #[cfg_attr(feature = "generate-ts", ts(type = "string | null"))] pub proxy: Option, + /// Block height at which this mixnode has unbonded. #[cfg_attr(feature = "generate-ts", ts(type = "number"))] pub unbonding_height: u64, } @@ -671,7 +696,7 @@ pub struct UnbondedMixnode { feature = "generate-ts", ts(export_to = "ts-packages/types/src/types/rust/MixNodeConfigUpdate.ts") )] -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +#[cw_serde] pub struct MixNodeConfigUpdate { pub host: String, pub mix_port: u16, @@ -686,10 +711,17 @@ impl MixNodeConfigUpdate { } } -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +/// Response containing paged list of all mixnode bonds in the contract. +#[cw_serde] pub struct PagedMixnodeBondsResponse { + /// The mixnode bond information present in the contract. pub nodes: Vec, + + /// Maximum number of entries that could be included in a response. `per_page <= nodes.len()` + // this field is rather redundant and should be deprecated. pub per_page: usize, + + /// Field indicating paging information for the following queries if the caller wishes to get further entries. pub start_next_after: Option, } @@ -703,10 +735,19 @@ impl PagedMixnodeBondsResponse { } } -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +/// Response containing paged list of all mixnode details in the contract. +#[cw_serde] pub struct PagedMixnodesDetailsResponse { + /// All mixnode details stored in the contract. + /// Apart from the basic bond information it also contains details required for all future reward calculation + /// as well as any pending changes requested by the operator. pub nodes: Vec, + + /// Maximum number of entries that could be included in a response. `per_page <= nodes.len()` + // this field is rather redundant and should be deprecated. pub per_page: usize, + + /// Field indicating paging information for the following queries if the caller wishes to get further entries. pub start_next_after: Option, } @@ -724,10 +765,17 @@ impl PagedMixnodesDetailsResponse { } } -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +/// Response containing paged list of all mixnodes that have ever unbonded. +#[cw_serde] pub struct PagedUnbondedMixnodesResponse { + /// The past ids of unbonded mixnodes alongside their basic information such as the owner or the identity key. pub nodes: Vec<(MixId, UnbondedMixnode)>, + + /// Maximum number of entries that could be included in a response. `per_page <= nodes.len()` + // this field is rather redundant and should be deprecated. pub per_page: usize, + + /// Field indicating paging information for the following queries if the caller wishes to get further entries. pub start_next_after: Option, } @@ -745,33 +793,68 @@ impl PagedUnbondedMixnodesResponse { } } -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +/// Response containing details of a mixnode belonging to the particular owner. +#[cw_serde] pub struct MixOwnershipResponse { + /// Validated address of the mixnode owner. pub address: Addr, + + /// If the provided address owns a mixnode, this field contains its detailed information. pub mixnode_details: Option, } -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +/// Response containing details of a mixnode with the provided id. +#[cw_serde] pub struct MixnodeDetailsResponse { + /// Id of the requested mixnode. pub mix_id: MixId, + + /// If there exists a mixnode with the provided id, this field contains its detailed information. pub mixnode_details: Option, } -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +/// Response containing details of a bonded mixnode with the provided identity key. +#[cw_serde] +pub struct MixnodeDetailsByIdentityResponse { + /// The identity key (base58-encoded ed25519 public key) of the mixnode. + pub identity_key: IdentityKey, + + /// If there exists a bonded mixnode with the provided identity key, this field contains its detailed information. + pub mixnode_details: Option, +} + +/// Response containing rewarding information of a mixnode with the provided id. +#[cw_serde] pub struct MixnodeRewardingDetailsResponse { + /// Id of the requested mixnode. pub mix_id: MixId, + + /// If there exists a mixnode with the provided id, this field contains its rewarding information. pub rewarding_details: Option, } -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +/// Response containing basic information of an unbonded mixnode with the provided id. +#[cw_serde] pub struct UnbondedMixnodeResponse { + /// Id of the requested mixnode. pub mix_id: MixId, + + /// If there existed a mixnode with the provided id, this field contains its basic information. pub unbonded_info: Option, } -#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +/// Response containing the current state of the stake saturation of a mixnode with the provided id. +#[cw_serde] pub struct StakeSaturationResponse { + /// Id of the requested mixnode. pub mix_id: MixId, + + /// The current stake saturation of this node that is indirectly used in reward calculation formulas. + /// Note that it can't be larger than 1. pub current_saturation: Option, + + /// The current, absolute, stake saturation of this node. + /// Note that as the name suggests it can be larger than 1. + /// However, anything beyond that value has no effect on the total node reward. pub uncapped_saturation: Option, } diff --git a/common/cosmwasm-smart-contracts/mixnet-contract/src/msg.rs b/common/cosmwasm-smart-contracts/mixnet-contract/src/msg.rs index 24603147a0..ca154e231b 100644 --- a/common/cosmwasm-smart-contracts/mixnet-contract/src/msg.rs +++ b/common/cosmwasm-smart-contracts/mixnet-contract/src/msg.rs @@ -1,28 +1,54 @@ // Copyright 2021-2023 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use crate::delegation::OwnerProxySubKey; +use crate::delegation::{self, OwnerProxySubKey}; use crate::error::MixnetContractError; use crate::families::FamilyHead; -use crate::gateway::GatewayConfigUpdate; +use crate::gateway::{Gateway, GatewayConfigUpdate}; use crate::helpers::IntoBaseDecimal; -use crate::mixnode::{MixNodeConfigUpdate, MixNodeCostParams}; +use crate::mixnode::{Layer, MixNode, MixNodeConfigUpdate, MixNodeCostParams}; +use crate::pending_events::{EpochEventId, IntervalEventId}; use crate::reward_params::{ IntervalRewardParams, IntervalRewardingParamsUpdate, Performance, RewardingParams, }; -use crate::{ - delegation, ContractStateParams, EpochEventId, IntervalEventId, Layer, LayerAssignment, MixId, - Percent, -}; -use crate::{Gateway, IdentityKey, MixNode}; -use contracts_common::signing::MessageSignature; +use crate::types::{ContractStateParams, LayerAssignment, MixId}; +use contracts_common::{signing::MessageSignature, IdentityKey, Percent}; +use cosmwasm_schema::cw_serde; use cosmwasm_std::{Coin, Decimal}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; use std::time::Duration; -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] +#[cfg(feature = "schema")] +use crate::{ + delegation::{ + MixNodeDelegationResponse, PagedAllDelegationsResponse, PagedDelegatorDelegationsResponse, + PagedMixNodeDelegationsResponse, + }, + families::{ + FamilyByHeadResponse, FamilyByLabelResponse, FamilyMembersByHeadResponse, + FamilyMembersByLabelResponse, PagedFamiliesResponse, PagedMembersResponse, + }, + gateway::{GatewayBondResponse, GatewayOwnershipResponse, PagedGatewayResponse}, + interval::{CurrentIntervalResponse, EpochStatus}, + mixnode::{ + MixOwnershipResponse, MixnodeDetailsByIdentityResponse, MixnodeDetailsResponse, + MixnodeRewardingDetailsResponse, PagedMixnodeBondsResponse, PagedMixnodesDetailsResponse, + PagedUnbondedMixnodesResponse, StakeSaturationResponse, UnbondedMixnodeResponse, + }, + pending_events::{ + NumberOfPendingEventsResponse, PendingEpochEventResponse, PendingEpochEventsResponse, + PendingIntervalEventResponse, PendingIntervalEventsResponse, + }, + rewarding::{ + EstimatedCurrentEpochRewardResponse, PagedRewardedSetResponse, PendingRewardResponse, + }, + types::{ContractState, LayerDistribution}, +}; +#[cfg(feature = "schema")] +use contracts_common::{signing::Nonce, ContractBuildInformation}; +#[cfg(feature = "schema")] +use cosmwasm_schema::QueryResponses; + +#[cw_serde] pub struct InstantiateMsg { pub rewarding_validator_address: String, pub vesting_contract_address: String, @@ -33,8 +59,7 @@ pub struct InstantiateMsg { pub initial_rewarding_params: InitialRewardingParams, } -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] +#[cw_serde] pub struct InitialRewardingParams { pub initial_reward_pool: Decimal, pub initial_staking_supply: Decimal, @@ -76,8 +101,7 @@ impl InitialRewardingParams { } } -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -#[serde(rename_all = "snake_case")] +#[cw_serde] pub enum ExecuteMsg { AssignNodeLayer { mix_id: MixId, @@ -365,177 +389,376 @@ impl ExecuteMsg { } } -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] +#[cw_serde] +#[cfg_attr(feature = "schema", derive(QueryResponses))] pub enum QueryMsg { // families + /// Gets the list of families registered in this contract. + #[cfg_attr(feature = "schema", returns(PagedFamiliesResponse))] GetAllFamiliesPaged { + /// Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default. limit: Option, + + /// Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response. start_after: Option, }, + + /// Gets the list of all family members registered in this contract. + #[cfg_attr(feature = "schema", returns(PagedMembersResponse))] GetAllMembersPaged { + /// Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default. limit: Option, + + /// Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response. start_after: Option, }, - GetFamilyByHead { - head: String, - }, - GetFamilyByLabel { - label: String, - }, - GetFamilyMembersByHead { - head: String, - }, - GetFamilyMembersByLabel { - label: String, - }, + + /// Attempts to lookup family information given the family head. + #[cfg_attr(feature = "schema", returns(FamilyByHeadResponse))] + GetFamilyByHead { head: String }, + + /// Attempts to lookup family information given the family label. + #[cfg_attr(feature = "schema", returns(FamilyByLabelResponse))] + GetFamilyByLabel { label: String }, + + /// Attempts to retrieve family members given the family head. + #[cfg_attr(feature = "schema", returns(FamilyMembersByHeadResponse))] + GetFamilyMembersByHead { head: String }, + + /// Attempts to retrieve family members given the family label. + #[cfg_attr(feature = "schema", returns(FamilyMembersByLabelResponse))] + GetFamilyMembersByLabel { label: String }, + // state/sys-params-related + /// Gets build information of this contract, such as the commit hash used for the build or rustc version. + #[cfg_attr(feature = "schema", returns(ContractBuildInformation))] GetContractVersion {}, + + /// Gets the stored contract version information that's required by the CW2 spec interface for migrations. #[serde(rename = "get_cw2_contract_version")] + #[cfg_attr(feature = "schema", returns(cw2::ContractVersion))] GetCW2ContractVersion {}, + + /// Gets the address of the validator that's allowed to send rewarding transactions and transition the epoch. + #[cfg_attr(feature = "schema", returns(String))] GetRewardingValidatorAddress {}, + + /// Gets the contract parameters that could be adjusted in a transaction by the contract admin. + #[cfg_attr(feature = "schema", returns(ContractStateParams))] GetStateParams {}, + + /// Gets the current state of the contract. + #[cfg_attr(feature = "schema", returns(ContractState))] GetState {}, + + /// Gets the current parameters used for reward calculation. + #[cfg_attr(feature = "schema", returns(RewardingParams))] GetRewardingParams {}, + + /// Gets the status of the current rewarding epoch. + #[cfg_attr(feature = "schema", returns(EpochStatus))] GetEpochStatus {}, + + /// Get the details of the current rewarding interval. + #[cfg_attr(feature = "schema", returns(CurrentIntervalResponse))] GetCurrentIntervalDetails {}, + + /// Gets the current list of mixnodes in the rewarded set. + #[cfg_attr(feature = "schema", returns(PagedRewardedSetResponse))] GetRewardedSet { + /// Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default. limit: Option, + + /// Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response. start_after: Option, }, // mixnode-related: + /// Gets the basic list of all currently bonded mixnodes. + #[cfg_attr(feature = "schema", returns(PagedMixnodeBondsResponse))] GetMixNodeBonds { + /// Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default. limit: Option, + + /// Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response. start_after: Option, }, + + /// Gets the detailed list of all currently bonded mixnodes. + #[cfg_attr(feature = "schema", returns(PagedMixnodesDetailsResponse))] GetMixNodesDetailed { + /// Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default. limit: Option, + + /// Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response. start_after: Option, }, + + /// Gets the basic list of all unbonded mixnodes. + #[cfg_attr(feature = "schema", returns(PagedUnbondedMixnodesResponse))] GetUnbondedMixNodes { + /// Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default. limit: Option, + + /// Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response. start_after: Option, }, + + /// Gets the basic list of all unbonded mixnodes that belonged to a particular owner. + #[cfg_attr(feature = "schema", returns(PagedUnbondedMixnodesResponse))] GetUnbondedMixNodesByOwner { + /// The address of the owner of the the mixnodes used for the query. owner: String, + + /// Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default. limit: Option, + + /// Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response. start_after: Option, }, + + /// Gets the basic list of all unbonded mixnodes that used the particular identity key. + #[cfg_attr(feature = "schema", returns(PagedUnbondedMixnodesResponse))] GetUnbondedMixNodesByIdentityKey { + /// The identity key (base58-encoded ed25519 public key) of the mixnode used for the query. identity_key: String, + + /// Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default. limit: Option, + + /// Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response. start_after: Option, }, + + /// Gets the detailed mixnode information belonging to the particular owner. + #[cfg_attr(feature = "schema", returns(MixOwnershipResponse))] GetOwnedMixnode { + /// Address of the mixnode owner to use for the query. address: String, }, + + /// Gets the detailed mixnode information of a node with the provided id. + #[cfg_attr(feature = "schema", returns(MixnodeDetailsResponse))] GetMixnodeDetails { + /// Id of the node to query. mix_id: MixId, }, + + /// Gets the rewarding information of a mixnode with the provided id. + #[cfg_attr(feature = "schema", returns(MixnodeRewardingDetailsResponse))] GetMixnodeRewardingDetails { + /// Id of the node to query. mix_id: MixId, }, + + /// Gets the stake saturation of a mixnode with the provided id. + #[cfg_attr(feature = "schema", returns(StakeSaturationResponse))] GetStakeSaturation { + /// Id of the node to query. mix_id: MixId, }, + + /// Gets the basic information of an unbonded mixnode with the provided id. + #[cfg_attr(feature = "schema", returns(UnbondedMixnodeResponse))] GetUnbondedMixNodeInformation { + /// Id of the node to query. mix_id: MixId, }, + + /// Gets the detailed mixnode information of a node given its current identity key. + #[cfg_attr(feature = "schema", returns(MixnodeDetailsByIdentityResponse))] GetBondedMixnodeDetailsByIdentity { + /// The identity key (base58-encoded ed25519 public key) of the mixnode used for the query. mix_identity: IdentityKey, }, + + /// Gets the current layer configuration of the mix network. + #[cfg_attr(feature = "schema", returns(LayerDistribution))] GetLayerDistribution {}, + // gateway-related: + /// Gets the basic list of all currently bonded gateways. + #[cfg_attr(feature = "schema", returns(PagedGatewayResponse))] GetGateways { + /// Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response. start_after: Option, + + /// Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default. limit: Option, }, + + /// Gets the gateway details of a node given its identity key. + #[cfg_attr(feature = "schema", returns(GatewayBondResponse))] GetGatewayBond { + /// The identity key (base58-encoded ed25519 public key) of the gateway used for the query. identity: IdentityKey, }, + + /// Gets the detailed gateway information belonging to the particular owner. + #[cfg_attr(feature = "schema", returns(GatewayOwnershipResponse))] GetOwnedGateway { + /// Address of the gateway owner to use for the query. address: String, }, // delegation-related: - // gets all [paged] delegations associated with particular mixnode + /// Gets all delegations associated with particular mixnode + #[cfg_attr(feature = "schema", returns(PagedMixNodeDelegationsResponse))] GetMixnodeDelegations { + /// Id of the node to query. mix_id: MixId, - // since `start_after` is user-provided input, we can't use `Addr` as we - // can't guarantee it's validated. - start_after: Option, + + /// Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response. + start_after: Option, + + /// Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default. limit: Option, }, - // gets all [paged] delegations associated with particular delegator + + /// Gets all delegations associated with particular delegator + #[cfg_attr(feature = "schema", returns(PagedDelegatorDelegationsResponse))] GetDelegatorDelegations { // since `delegator` is user-provided input, we can't use `Addr` as we // can't guarantee it's validated. + /// The address of the owner of the delegations. delegator: String, + + /// Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response. start_after: Option<(MixId, OwnerProxySubKey)>, + + /// Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default. limit: Option, }, - // gets delegation associated with particular mixnode, delegator pair + + /// Gets delegation information associated with particular mixnode - delegator pair + #[cfg_attr(feature = "schema", returns(MixNodeDelegationResponse))] GetDelegationDetails { + /// Id of the node to query. mix_id: MixId, + + /// The address of the owner of the delegation. delegator: String, + + /// Entity who made the delegation on behalf of the owner. + /// If present, it's most likely the address of the vesting contract. proxy: Option, }, - // gets all delegations in the system + + /// Gets all delegations in the system + #[cfg_attr(feature = "schema", returns(PagedAllDelegationsResponse))] GetAllDelegations { + /// Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response. start_after: Option, + + /// Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default. limit: Option, }, // rewards related + /// Gets the reward amount accrued by the node operator that has not yet been claimed. + #[cfg_attr(feature = "schema", returns(PendingRewardResponse))] GetPendingOperatorReward { + /// Address of the operator to use for the query. address: String, }, + + /// Gets the reward amount accrued by the particular mixnode that has not yet been claimed. + #[cfg_attr(feature = "schema", returns(PendingRewardResponse))] GetPendingMixNodeOperatorReward { + /// Id of the node to query. mix_id: MixId, }, + + /// Gets the reward amount accrued by the particular delegator that has not yet been claimed. + #[cfg_attr(feature = "schema", returns(PendingRewardResponse))] GetPendingDelegatorReward { + /// Address of the delegator to use for the query. address: String, + + /// Id of the node to query. mix_id: MixId, + + /// Entity who made the delegation on behalf of the owner. + /// If present, it's most likely the address of the vesting contract. proxy: Option, }, - // given the provided performance, estimate the reward at the end of the current epoch + + /// Given the provided node performance, attempt to estimate the operator reward for the current epoch. + #[cfg_attr(feature = "schema", returns(EstimatedCurrentEpochRewardResponse))] GetEstimatedCurrentEpochOperatorReward { + /// Id of the node to query. mix_id: MixId, + + /// The estimated performance for the current epoch of the given node. estimated_performance: Performance, }, + + /// Given the provided node performance, attempt to estimate the delegator reward for the current epoch. + #[cfg_attr(feature = "schema", returns(EstimatedCurrentEpochRewardResponse))] GetEstimatedCurrentEpochDelegatorReward { + /// Address of the delegator to use for the query. address: String, + + /// Id of the node to query. mix_id: MixId, + + /// Entity who made the delegation on behalf of the owner. + /// If present, it's most likely the address of the vesting contract. proxy: Option, + + /// The estimated performance for the current epoch of the given node. estimated_performance: Performance, }, // interval-related + /// Gets the list of all currently pending epoch events that will be resolved once the current epoch finishes. + #[cfg_attr(feature = "schema", returns(PendingEpochEventsResponse))] GetPendingEpochEvents { + /// Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default. limit: Option, + + /// Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response. start_after: Option, }, + + /// Gets the list of all currently pending interval events that will be resolved once the current interval finishes. + #[cfg_attr(feature = "schema", returns(PendingIntervalEventsResponse))] GetPendingIntervalEvents { + /// Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default. limit: Option, + + /// Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response. start_after: Option, }, + + /// Gets detailed information about a pending epoch event given its id. + #[cfg_attr(feature = "schema", returns(PendingEpochEventResponse))] GetPendingEpochEvent { + /// The unique id associated with the event. event_id: EpochEventId, }, + + /// Gets detailed information about a pending interval event given its id. + #[cfg_attr(feature = "schema", returns(PendingIntervalEventResponse))] GetPendingIntervalEvent { + /// The unique id associated with the event. event_id: IntervalEventId, }, + + /// Gets the information about the number of currently pending epoch and interval events. + #[cfg_attr(feature = "schema", returns(NumberOfPendingEventsResponse))] GetNumberOfPendingEvents {}, // signing-related + /// Gets the signing nonce associated with the particular cosmos address. + #[cfg_attr(feature = "schema", returns(Nonce))] GetSigningNonce { + /// Cosmos address used for the query of the signing nonce. address: String, }, } -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] +#[cw_serde] pub struct MigrateMsg { pub vesting_contract_address: Option, } diff --git a/common/cosmwasm-smart-contracts/mixnet-contract/src/pending_events.rs b/common/cosmwasm-smart-contracts/mixnet-contract/src/pending_events.rs index 5f4db1ab90..595839c99f 100644 --- a/common/cosmwasm-smart-contracts/mixnet-contract/src/pending_events.rs +++ b/common/cosmwasm-smart-contracts/mixnet-contract/src/pending_events.rs @@ -3,49 +3,95 @@ use crate::mixnode::MixNodeCostParams; use crate::reward_params::IntervalRewardingParamsUpdate; -use crate::{BlockHeight, EpochEventId, IntervalEventId, MixId}; +use crate::{BlockHeight, MixId}; +use cosmwasm_schema::cw_serde; use cosmwasm_std::{Addr, Coin}; -use serde::{Deserialize, Serialize}; -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] +pub type EpochEventId = u32; +pub type IntervalEventId = u32; + +/// A request made at some point in the current epoch that's going to get resolved once the epoch rolls over. +#[cw_serde] pub struct PendingEpochEvent { + /// The unique id associated with the event. pub id: EpochEventId, + + /// The underlying event details, containing its type and information on how it should get resolved. pub event: PendingEpochEventData, } -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] +/// Details of a particular pending epoch event. +#[cw_serde] pub struct PendingEpochEventData { + /// The block height at which the request has been made. pub created_at: BlockHeight, + + /// The underlying event data, containing its concrete type and information on how it should get resolved. pub kind: PendingEpochEventKind, } -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] +/// Enum encompassing all possible epoch events. +#[cw_serde] pub enum PendingEpochEventKind { // can't just pass the `Delegation` struct here as it's impossible to determine // `cumulative_reward_ratio` ahead of time + /// Request to create a delegation towards particular mixnode. + /// Note that if such delegation already exists, it will get updated with the provided token amount. Delegate { + /// The address of the owner of the delegation. owner: Addr, + + /// The id of the mixnode used for the delegation. mix_id: MixId, + + /// The amount of tokens to use for the delegation. amount: Coin, + + /// Entity who made the delegation on behalf of the owner. + /// If present, it's most likely the address of the vesting contract. proxy: Option, }, + + /// Request to remove delegation from particular mixnode. Undelegate { + /// The address of the owner of the delegation. owner: Addr, + + /// The id of the mixnode used for the delegation. mix_id: MixId, + + /// Entity who made the delegation on behalf of the owner. + /// If present, it's most likely the address of the vesting contract. proxy: Option, }, + + /// Request to pledge more tokens (by the node operator) towards its node. PledgeMore { + /// The id of the mixnode that will have its pledge updated. mix_id: MixId, + + /// The amount of additional tokens to use by the pledge. amount: Coin, }, + + /// Request to decrease amount of pledged tokens (by the node operator) from its node. DecreasePledge { + /// The id of the mixnode that will have its pledge updated. mix_id: MixId, + + /// The amount of tokens that should be removed from the pledge. decrease_by: Coin, }, + + /// Request to unbond a mixnode and completely remove it from the network. UnbondMixnode { + /// The id of the mixnode that will get unbonded. mix_id: MixId, }, + + /// Request to update the current size of the active set. UpdateActiveSetSize { + /// The new desired size of the active set. new_size: u32, }, } @@ -68,29 +114,50 @@ impl From<(EpochEventId, PendingEpochEventData)> for PendingEpochEvent { } } -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] +/// A request made at some point in the current interval that's going to get resolved once the interval rolls over. +#[cw_serde] pub struct PendingIntervalEvent { + /// The unique id associated with the event. pub id: IntervalEventId, + + /// The underlying event details, containing its type and information on how it should get resolved. pub event: PendingIntervalEventData, } -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] +/// Details of a particular pending interval event. +#[cw_serde] pub struct PendingIntervalEventData { + /// The block height at which the request has been made. pub created_at: BlockHeight, + + /// The underlying event data, containing its concrete type and information on how it should get resolved. pub kind: PendingIntervalEventKind, } -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] +/// Enum encompassing all possible interval events. +#[cw_serde] pub enum PendingIntervalEventKind { + /// Request to update cost parameters of given mixnode. ChangeMixCostParams { + /// The id of the mixnode that will have its cost parameters updated. mix_id: MixId, + + /// The new updated cost function of this mixnode. new_costs: MixNodeCostParams, }, + + /// Request to update the underlying rewarding parameters used by the system UpdateRewardingParams { + /// The detailed specification of the update. update: IntervalRewardingParamsUpdate, }, + + /// Request to change the next interval configuration. UpdateIntervalConfig { + /// The new number of epochs in intervals. epochs_in_interval: u32, + + /// The new epoch duration. epoch_duration_secs: u64, }, } @@ -112,3 +179,102 @@ impl From<(IntervalEventId, PendingIntervalEventData)> for PendingIntervalEvent } } } + +/// Response containing all currently pending epoch events that will be resolved once the current epoch finishes. +#[cw_serde] +pub struct PendingEpochEventsResponse { + /// Amount of seconds until the events would be eligible to be resolved. + /// It's equivalent to the time until the current epoch finishes. + pub seconds_until_executable: i64, + + /// The currently pending events. + pub events: Vec, + + /// Field indicating paging information for the following queries if the caller wishes to get further entries. + pub start_next_after: Option, +} + +impl PendingEpochEventsResponse { + pub fn new( + seconds_until_executable: i64, + events: Vec, + start_next_after: Option, + ) -> Self { + PendingEpochEventsResponse { + seconds_until_executable, + events, + start_next_after, + } + } +} + +/// Response containing all currently pending interval events that will be resolved once the current interval finishes. +#[cw_serde] +pub struct PendingIntervalEventsResponse { + /// Amount of seconds until the events would be eligible to be resolved. + /// It's equivalent to the time until the current interval finishes. + pub seconds_until_executable: i64, + + /// The currently pending events. + pub events: Vec, + + /// Field indicating paging information for the following queries if the caller wishes to get further entries. + pub start_next_after: Option, +} + +impl PendingIntervalEventsResponse { + pub fn new( + seconds_until_executable: i64, + events: Vec, + start_next_after: Option, + ) -> Self { + PendingIntervalEventsResponse { + seconds_until_executable, + events, + start_next_after, + } + } +} + +#[cw_serde] +pub struct PendingEpochEventResponse { + pub event_id: EpochEventId, + pub event: Option, +} + +impl PendingEpochEventResponse { + pub fn new(event_id: EpochEventId, event: Option) -> Self { + PendingEpochEventResponse { event_id, event } + } +} + +#[cw_serde] +pub struct PendingIntervalEventResponse { + pub event_id: IntervalEventId, + pub event: Option, +} + +impl PendingIntervalEventResponse { + pub fn new(event_id: IntervalEventId, event: Option) -> Self { + PendingIntervalEventResponse { event_id, event } + } +} + +/// Response containing number of currently pending epoch and interval events. +#[cw_serde] +pub struct NumberOfPendingEventsResponse { + /// The number of the currently pending epoch events. + pub epoch_events: u32, + + /// The number of the currently pending epoch events. + pub interval_events: u32, +} + +impl NumberOfPendingEventsResponse { + pub fn new(epoch_events: u32, interval_events: u32) -> Self { + Self { + epoch_events, + interval_events, + } + } +} diff --git a/common/cosmwasm-smart-contracts/mixnet-contract/src/reward_params.rs b/common/cosmwasm-smart-contracts/mixnet-contract/src/reward_params.rs index 74777eb99f..4928bd6a1e 100644 --- a/common/cosmwasm-smart-contracts/mixnet-contract/src/reward_params.rs +++ b/common/cosmwasm-smart-contracts/mixnet-contract/src/reward_params.rs @@ -3,9 +3,8 @@ use crate::helpers::IntoBaseDecimal; use crate::{error::MixnetContractError, Percent}; +use cosmwasm_schema::cw_serde; use cosmwasm_std::Decimal; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; pub type Performance = Percent; @@ -15,7 +14,8 @@ pub type Performance = Percent; feature = "generate-ts", ts(export_to = "ts-packages/types/src/types/rust/IntervalRewardParams.ts") )] -#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq, PartialOrd, Serialize, JsonSchema)] +#[cw_serde] +#[derive(Copy)] pub struct IntervalRewardParams { /// Current value of the rewarding pool. /// It is expected to be constant throughout the interval. @@ -74,21 +74,26 @@ impl IntervalRewardParams { } } +/// Parameters used for reward calculation. #[cfg_attr(feature = "generate-ts", derive(ts_rs::TS))] #[cfg_attr( feature = "generate-ts", ts(export_to = "ts-packages/types/src/types/rust/RewardingParams.ts") )] -#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq, PartialOrd, Serialize, JsonSchema)] +#[cw_serde] +#[derive(Copy)] pub struct RewardingParams { /// Parameters that should remain unchanged throughout an interval. pub interval: IntervalRewardParams, - // while the active set size can change between epochs to accommodate for bandwidth demands, + // while the rewarded set size can change between epochs to accommodate for bandwidth demands, // the active set size should be unchanged between epochs and should only be adjusted between // intervals. However, it makes more sense to keep both of those values together as they're // very strongly related to each other. + /// The expected number of mixnodes in the rewarded set (i.e. active + standby). pub rewarded_set_size: u32, + + /// The expected number of mixnodes in the active set. pub active_set_size: u32, } @@ -224,9 +229,14 @@ impl RewardingParams { } // TODO: possibly refactor this -#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq, PartialOrd, Serialize, JsonSchema)] +/// Parameters used for rewarding particular mixnode. +#[cw_serde] +#[derive(Copy)] pub struct NodeRewardParams { + /// Performance of the particular node in the current epoch. pub performance: Percent, + + /// Flag indicating whether the node has been in the active set during the epoch. pub in_active_set: bool, } @@ -239,33 +249,40 @@ impl NodeRewardParams { } } +/// Specification on how the rewarding params should be updated. #[cfg_attr(feature = "generate-ts", derive(ts_rs::TS))] #[cfg_attr( feature = "generate-ts", ts(export_to = "ts-packages/types/src/types/rust/IntervalRewardingParamsUpdate.ts") )] -#[derive( - Clone, Copy, Debug, Default, Deserialize, PartialEq, Eq, PartialOrd, Serialize, JsonSchema, -)] +#[cw_serde] +#[derive(Copy, Default)] pub struct IntervalRewardingParamsUpdate { #[cfg_attr(feature = "generate-ts", ts(type = "string | null"))] + /// Defines the new value of the reward pool. pub reward_pool: Option, #[cfg_attr(feature = "generate-ts", ts(type = "string | null"))] + /// Defines the new value of the staking supply. pub staking_supply: Option, #[cfg_attr(feature = "generate-ts", ts(type = "string | null"))] + /// Defines the new value of the staking supply scale factor. pub staking_supply_scale_factor: Option, #[cfg_attr(feature = "generate-ts", ts(type = "string | null"))] + /// Defines the new value of the sybil resistance percent. pub sybil_resistance_percent: Option, #[cfg_attr(feature = "generate-ts", ts(type = "string | null"))] + /// Defines the new value of the active set work factor. pub active_set_work_factor: Option, #[cfg_attr(feature = "generate-ts", ts(type = "string | null"))] + /// Defines the new value of the interval pool emission rate. pub interval_pool_emission: Option, + /// Defines the new size of the rewarded set. pub rewarded_set_size: Option, } diff --git a/common/cosmwasm-smart-contracts/mixnet-contract/src/rewarding/mod.rs b/common/cosmwasm-smart-contracts/mixnet-contract/src/rewarding/mod.rs index 650e39a2ff..4ef9cd433a 100644 --- a/common/cosmwasm-smart-contracts/mixnet-contract/src/rewarding/mod.rs +++ b/common/cosmwasm-smart-contracts/mixnet-contract/src/rewarding/mod.rs @@ -1,9 +1,9 @@ // Copyright 2022 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 +use crate::{MixId, RewardedSetNodeStatus}; +use cosmwasm_schema::cw_serde; use cosmwasm_std::{Coin, Decimal}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; pub mod helpers; pub mod simulator; @@ -13,32 +13,52 @@ pub mod simulator; feature = "generate-ts", ts(export_to = "ts-packages/types/src/types/rust/RewardEstimate.ts") )] -#[derive(Clone, Copy, Debug, Default, Deserialize, Serialize, JsonSchema, PartialEq, Eq)] +#[cw_serde] +#[derive(Copy, Default)] pub struct RewardEstimate { + /// The amount of **decimal** coins that are going to get distributed to the node, + /// i.e. the operator and all its delegators. #[cfg_attr(feature = "generate-ts", ts(type = "string"))] pub total_node_reward: Decimal, // note that operator reward includes the operating_cost, // i.e. say total_node_reward was `1nym` and operating_cost was `2nym` // in that case the operator reward would still be `1nym` as opposed to 0 + /// The share of the reward that is going to get distributed to the node operator. #[cfg_attr(feature = "generate-ts", ts(type = "string"))] pub operator: Decimal, + + /// The share of the reward that is going to get distributed among the node delegators. #[cfg_attr(feature = "generate-ts", ts(type = "string"))] pub delegates: Decimal, + + /// The operating cost of this node. Note: it's already included in the operator reward. #[cfg_attr(feature = "generate-ts", ts(type = "string"))] pub operating_cost: Decimal, } -#[derive(Clone, Copy, Debug, Default, Deserialize, Serialize, JsonSchema, PartialEq, Eq)] +#[cw_serde] +#[derive(Copy, Default)] pub struct RewardDistribution { + /// The share of the reward that is going to get distributed to the node operator. pub operator: Decimal, + + /// The share of the reward that is going to get distributed among the node delegators. pub delegates: Decimal, } -#[derive(Clone, Debug, Default, Deserialize, Serialize, JsonSchema, PartialEq, Eq)] +/// Response containing information about accrued rewards. +#[cw_serde] +#[derive(Default)] pub struct PendingRewardResponse { + /// The amount of tokens initially staked. pub amount_staked: Option, + + /// The amount of tokens that could be claimed. pub amount_earned: Option, + + /// The full pending rewards. Note that it's nearly identical to `amount_earned`, + /// however, it contains few additional decimal points for more accurate reward calculation. pub amount_earned_detailed: Option, /// The associated mixnode is still fully bonded, meaning it is neither unbonded @@ -46,14 +66,25 @@ pub struct PendingRewardResponse { pub mixnode_still_fully_bonded: bool, } -#[derive(Clone, Debug, Default, Deserialize, Serialize, JsonSchema, PartialEq, Eq)] +/// Response containing estimation of node rewards for the current epoch. +#[cw_serde] pub struct EstimatedCurrentEpochRewardResponse { + /// The amount of tokens initially staked. pub original_stake: Option, + /// The current stake value given all past rewarding and compounding since the original staking was performed. pub current_stake_value: Option, + + /// The current stake value. Note that it's nearly identical to `current_stake_value`, + /// however, it contains few additional decimal points for more accurate reward calculation. pub current_stake_value_detailed_amount: Option, + /// The reward estimation for the current epoch, i.e. the amount of tokens that could be claimable + /// after the epoch finishes and the state of the network does not change. pub estimation: Option, + + /// The full reward estimation. Note that it's nearly identical to `estimation`, + /// however, it contains few additional decimal points for more accurate reward calculation. pub detailed_estimation_amount: Option, } @@ -68,3 +99,13 @@ impl EstimatedCurrentEpochRewardResponse { } } } + +/// Response containing paged list of all mixnodes in the rewarded set. +#[cw_serde] +pub struct PagedRewardedSetResponse { + /// Nodes in the current rewarded set. + pub nodes: Vec<(MixId, RewardedSetNodeStatus)>, + + /// Field indicating paging information for the following queries if the caller wishes to get further entries. + pub start_next_after: Option, +} diff --git a/common/cosmwasm-smart-contracts/mixnet-contract/src/signing.rs b/common/cosmwasm-smart-contracts/mixnet-contract/src/signing.rs deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/common/cosmwasm-smart-contracts/mixnet-contract/src/types.rs b/common/cosmwasm-smart-contracts/mixnet-contract/src/types.rs index e0a8109f98..e1ff854bb9 100644 --- a/common/cosmwasm-smart-contracts/mixnet-contract/src/types.rs +++ b/common/cosmwasm-smart-contracts/mixnet-contract/src/types.rs @@ -2,29 +2,26 @@ // SPDX-License-Identifier: Apache-2.0 use crate::error::MixnetContractError; -use crate::families::{Family, FamilyHead}; -use crate::{Layer, RewardedSetNodeStatus}; -use contracts_common::IdentityKey; +use crate::Layer; +use cosmwasm_schema::cw_serde; use cosmwasm_std::Addr; use cosmwasm_std::Coin; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; use std::ops::Index; // type aliases for better reasoning about available data pub type SphinxKey = String; pub type SphinxKeyRef<'a> = &'a str; -pub type EpochId = u32; -pub type IntervalId = u32; + pub type MixId = u32; pub type BlockHeight = u64; -pub type EpochEventId = u32; -pub type IntervalEventId = u32; -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Serialize, Deserialize, Debug, Clone, JsonSchema, PartialEq, Eq)] +/// Specifies layer assignment for the given mixnode. +#[cw_serde] pub struct LayerAssignment { + /// The id of the mixnode. mix_id: MixId, + + /// The layer to which it's going to be assigned layer: Layer, } @@ -42,10 +39,17 @@ impl LayerAssignment { } } -#[derive(Debug, Default, Serialize, Deserialize, Copy, Clone, Eq, PartialEq)] +/// The current layer distribution of the mix network. +#[cw_serde] +#[derive(Copy, Default)] pub struct LayerDistribution { + /// Number of nodes on the first layer. pub layer1: u64, + + /// Number of nodes on the second layer. pub layer2: u64, + + /// Number of nodes on the third layer. pub layer3: u64, } @@ -118,19 +122,29 @@ impl Index for LayerDistribution { } } -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +/// The current state of the mixnet contract. +#[cw_serde] pub struct ContractState { - pub owner: Addr, // only the owner account can update state + /// Address of the contract owner. + pub owner: Addr, + + /// Address of "rewarding validator" (nym-api) that's allowed to send any rewarding-related transactions. pub rewarding_validator_address: Addr, /// Address of the vesting contract to which the mixnet contract would be sending all /// track-related messages. pub vesting_contract_address: Addr, + + /// The expected denom used for rewarding (and realistically any other operation). + /// Default: `unym` pub rewarding_denom: String, + + /// Contract parameters that could be adjusted in a transaction the contract admin. pub params: ContractStateParams, } -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +/// Contract parameters that could be adjusted in a transaction by the contract admin. +#[cw_serde] pub struct ContractStateParams { /// Minimum amount a delegator must stake in orders for his delegation to get accepted. pub minimum_mixnode_delegation: Option, @@ -141,21 +155,3 @@ pub struct ContractStateParams { /// Minimum amount a gateway must pledge to get into the system. pub minimum_gateway_pledge: Coin, } - -#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, JsonSchema)] -pub struct PagedRewardedSetResponse { - pub nodes: Vec<(MixId, RewardedSetNodeStatus)>, - pub start_next_after: Option, -} - -#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, JsonSchema)] -pub struct PagedFamiliesResponse { - pub families: Vec, - pub start_next_after: Option, -} - -#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, JsonSchema)] -pub struct PagedMembersResponse { - pub members: Vec<(IdentityKey, FamilyHead)>, - pub start_next_after: Option, -} diff --git a/common/cosmwasm-smart-contracts/multisig-contract/Cargo.toml b/common/cosmwasm-smart-contracts/multisig-contract/Cargo.toml index 2a6753267e..d419e25086 100644 --- a/common/cosmwasm-smart-contracts/multisig-contract/Cargo.toml +++ b/common/cosmwasm-smart-contracts/multisig-contract/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" [dependencies] cw-utils = { workspace = true } cw3 = { workspace = true } -cw4 = { workspace= true } +cw4 = { workspace = true } cw-storage-plus = { workspace = true } cosmwasm-schema = { workspace = true } cosmwasm-std = { workspace = true } diff --git a/common/cosmwasm-smart-contracts/name-service/Cargo.toml b/common/cosmwasm-smart-contracts/name-service/Cargo.toml index 23fb221e23..4af7d851f1 100644 --- a/common/cosmwasm-smart-contracts/name-service/Cargo.toml +++ b/common/cosmwasm-smart-contracts/name-service/Cargo.toml @@ -6,10 +6,14 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +cosmwasm-schema = { workspace = true } cosmwasm-std = { workspace = true } +cw2 = { workspace = true, optional = true } cw-controllers = { workspace = true } cw-utils = { workspace = true } nym-contracts-common = { path = "../contracts-common", version = "0.5.0" } -schemars = "0.8" serde = { workspace = true, features = ["derive"] } thiserror = { workspace = true } + +[features] +schema = ["cw2"] \ No newline at end of file diff --git a/common/cosmwasm-smart-contracts/name-service/src/msg.rs b/common/cosmwasm-smart-contracts/name-service/src/msg.rs index 9a8e2b8ecf..cdac95c215 100644 --- a/common/cosmwasm-smart-contracts/name-service/src/msg.rs +++ b/common/cosmwasm-smart-contracts/name-service/src/msg.rs @@ -1,10 +1,22 @@ +// Copyright 2023 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + use crate::{Address, NameDetails, NameId, NymName}; +use cosmwasm_schema::cw_serde; use cosmwasm_std::Coin; use nym_contracts_common::signing::MessageSignature; -use serde::{Deserialize, Serialize}; -#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] -#[serde(rename_all = "snake_case")] +#[cfg(feature = "schema")] +use crate::{ + response::{ConfigResponse, NamesListResponse, PagedNamesListResponse}, + types::RegisteredName, +}; +#[cfg(feature = "schema")] +use cosmwasm_schema::QueryResponses; +#[cfg(feature = "schema")] +use nym_contracts_common::{signing::Nonce, ContractBuildInformation}; + +#[cw_serde] pub struct InstantiateMsg { pub deposit_required: Coin, } @@ -15,22 +27,23 @@ impl InstantiateMsg { } } -#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] -#[serde(rename_all = "snake_case")] +#[cw_serde] pub struct MigrateMsg {} -#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] -#[serde(rename_all = "snake_case")] +#[cw_serde] pub enum ExecuteMsg { /// Announcing a name pointing to a nym-address Register { name: NameDetails, owner_signature: MessageSignature, }, + /// Delete a name entry by id DeleteId { name_id: NameId }, + /// Delete a name entry by name DeleteName { name: NymName }, + /// Change the deposit required for announcing a name UpdateDepositRequired { deposit_required: Coin }, } @@ -61,33 +74,42 @@ impl ExecuteMsg { } } -#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] -#[serde(rename_all = "snake_case")] +#[cw_serde] +#[cfg_attr(feature = "schema", derive(QueryResponses))] pub enum QueryMsg { /// Query the name by it's assigned id - NameId { - name_id: NameId, - }, - // Query the names by the registrator - ByOwner { - owner: String, - }, - ByName { - name: NymName, - }, - ByAddress { - address: Address, - }, + #[cfg_attr(feature = "schema", returns(RegisteredName))] + NameId { name_id: NameId }, + + /// Query the names by the registrator + #[cfg_attr(feature = "schema", returns(NamesListResponse))] + ByOwner { owner: String }, + + #[cfg_attr(feature = "schema", returns(RegisteredName))] + ByName { name: NymName }, + + #[cfg_attr(feature = "schema", returns(NamesListResponse))] + ByAddress { address: Address }, + + #[cfg_attr(feature = "schema", returns(PagedNamesListResponse))] All { limit: Option, start_after: Option, }, - SigningNonce { - address: String, - }, + + #[cfg_attr(feature = "schema", returns(Nonce))] + SigningNonce { address: String }, + + #[cfg_attr(feature = "schema", returns(ConfigResponse))] Config {}, + + /// Gets build information of this contract, such as the commit hash used for the build or rustc version. + #[cfg_attr(feature = "schema", returns(ContractBuildInformation))] GetContractVersion {}, + + /// Gets the stored contract version information that's required by the CW2 spec interface for migrations. #[serde(rename = "get_cw2_contract_version")] + #[cfg_attr(feature = "schema", returns(cw2::ContractVersion))] GetCW2ContractVersion {}, } diff --git a/common/cosmwasm-smart-contracts/name-service/src/response.rs b/common/cosmwasm-smart-contracts/name-service/src/response.rs index 8087195eee..162021d7c7 100644 --- a/common/cosmwasm-smart-contracts/name-service/src/response.rs +++ b/common/cosmwasm-smart-contracts/name-service/src/response.rs @@ -1,10 +1,11 @@ -use crate::{NameId, RegisteredName}; -use cosmwasm_std::Coin; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; +// Copyright 2023 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 -#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, JsonSchema)] -#[serde(rename_all = "snake_case")] +use crate::{NameId, RegisteredName}; +use cosmwasm_schema::cw_serde; +use cosmwasm_std::Coin; + +#[cw_serde] pub struct NamesListResponse { pub names: Vec, } @@ -23,11 +24,12 @@ impl From<&[RegisteredName]> for NamesListResponse { } } -#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] -#[serde(rename_all = "snake_case")] +#[cw_serde] pub struct PagedNamesListResponse { pub names: Vec, pub per_page: usize, + + /// Field indicating paging information for the following queries if the caller wishes to get further entries. pub start_next_after: Option, } @@ -45,8 +47,7 @@ impl PagedNamesListResponse { } } -#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] -#[serde(rename_all = "snake_case")] +#[cw_serde] pub struct ConfigResponse { pub deposit_required: Coin, } diff --git a/common/cosmwasm-smart-contracts/name-service/src/types.rs b/common/cosmwasm-smart-contracts/name-service/src/types.rs index dd44340815..c595e82452 100644 --- a/common/cosmwasm-smart-contracts/name-service/src/types.rs +++ b/common/cosmwasm-smart-contracts/name-service/src/types.rs @@ -1,14 +1,15 @@ -use std::fmt::{Display, Formatter}; +// Copyright 2023 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 +use cosmwasm_schema::cw_serde; use cosmwasm_std::{Addr, Coin}; use nym_contracts_common::IdentityKey; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; +use std::fmt::{Display, Formatter}; /// The directory of names are indexed by [`NameId`]. pub type NameId = u32; -#[derive(Serialize, Deserialize, Clone, PartialEq, Debug, JsonSchema)] +#[cw_serde] pub struct RegisteredName { /// Unique id assigned to the registerd name. pub id: NameId, @@ -33,7 +34,7 @@ impl RegisteredName { } } -#[derive(Serialize, Deserialize, Clone, PartialEq, Debug, JsonSchema)] +#[cw_serde] pub struct NameDetails { /// The name pointing to the nym address pub name: NymName, @@ -48,8 +49,7 @@ pub struct NameDetails { /// String representation of a nym address, which is of the form /// client_id.client_enc@gateway_id. /// NOTE: entirely unvalidated. -#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug, JsonSchema)] -#[serde(rename_all = "snake_case")] +#[cw_serde] pub enum Address { NymAddress(String), // Possible extension: @@ -83,8 +83,7 @@ impl Display for Address { } /// Name stored and pointing a to a nym-address -#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug, JsonSchema)] -#[serde(rename_all = "snake_case")] +#[cw_serde] pub struct NymName(String); #[derive(Debug)] diff --git a/common/cosmwasm-smart-contracts/service-provider-directory/Cargo.toml b/common/cosmwasm-smart-contracts/service-provider-directory/Cargo.toml index 3965734b2d..aed3912abd 100644 --- a/common/cosmwasm-smart-contracts/service-provider-directory/Cargo.toml +++ b/common/cosmwasm-smart-contracts/service-provider-directory/Cargo.toml @@ -6,10 +6,13 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +cosmwasm-schema = { workspace = true } cosmwasm-std = { workspace = true } +cw2 = { workspace = true, optional = true } cw-controllers = { workspace = true } cw-utils = { workspace = true } nym-contracts-common = { path = "../contracts-common", version = "0.5.0" } -schemars = "0.8" -serde = { workspace = true, features = ["derive"] } thiserror = { workspace = true } + +[features] +schema = ["cw2"] \ No newline at end of file diff --git a/common/cosmwasm-smart-contracts/service-provider-directory/src/msg.rs b/common/cosmwasm-smart-contracts/service-provider-directory/src/msg.rs index f66ad787a5..0c7928e079 100644 --- a/common/cosmwasm-smart-contracts/service-provider-directory/src/msg.rs +++ b/common/cosmwasm-smart-contracts/service-provider-directory/src/msg.rs @@ -1,10 +1,22 @@ +// Copyright 2023 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + use crate::{NymAddress, ServiceDetails, ServiceId}; +use cosmwasm_schema::cw_serde; use cosmwasm_std::Coin; use nym_contracts_common::signing::MessageSignature; -use serde::{Deserialize, Serialize}; -#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] -#[serde(rename_all = "snake_case")] +#[cfg(feature = "schema")] +use crate::{ + response::{ConfigResponse, PagedServicesListResponse, ServicesListResponse}, + types::Service, +}; +#[cfg(feature = "schema")] +use cosmwasm_schema::QueryResponses; +#[cfg(feature = "schema")] +use nym_contracts_common::{signing::Nonce, ContractBuildInformation}; + +#[cw_serde] pub struct InstantiateMsg { pub deposit_required: Coin, } @@ -15,12 +27,10 @@ impl InstantiateMsg { } } -#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] -#[serde(rename_all = "snake_case")] +#[cw_serde] pub struct MigrateMsg {} -#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] -#[serde(rename_all = "snake_case")] +#[cw_serde] pub enum ExecuteMsg { Announce { service: ServiceDetails, @@ -64,28 +74,37 @@ impl ExecuteMsg { } } -#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] -#[serde(rename_all = "snake_case")] +#[cw_serde] +#[cfg_attr(feature = "schema", derive(QueryResponses))] pub enum QueryMsg { - ServiceId { - service_id: ServiceId, - }, - ByAnnouncer { - announcer: String, - }, - ByNymAddress { - nym_address: NymAddress, - }, + #[cfg_attr(feature = "schema", returns(Service))] + ServiceId { service_id: ServiceId }, + + #[cfg_attr(feature = "schema", returns(ServicesListResponse))] + ByAnnouncer { announcer: String }, + + #[cfg_attr(feature = "schema", returns(ServicesListResponse))] + ByNymAddress { nym_address: NymAddress }, + + #[cfg_attr(feature = "schema", returns(PagedServicesListResponse))] All { limit: Option, start_after: Option, }, - SigningNonce { - address: String, - }, + + #[cfg_attr(feature = "schema", returns(Nonce))] + SigningNonce { address: String }, + + #[cfg_attr(feature = "schema", returns(ConfigResponse))] Config {}, + + /// Gets build information of this contract, such as the commit hash used for the build or rustc version. + #[cfg_attr(feature = "schema", returns(ContractBuildInformation))] GetContractVersion {}, + + /// Gets the stored contract version information that's required by the CW2 spec interface for migrations. #[serde(rename = "get_cw2_contract_version")] + #[cfg_attr(feature = "schema", returns(cw2::ContractVersion))] GetCW2ContractVersion {}, } diff --git a/common/cosmwasm-smart-contracts/service-provider-directory/src/response.rs b/common/cosmwasm-smart-contracts/service-provider-directory/src/response.rs index 8b6bf16fbf..dd9392c2d9 100644 --- a/common/cosmwasm-smart-contracts/service-provider-directory/src/response.rs +++ b/common/cosmwasm-smart-contracts/service-provider-directory/src/response.rs @@ -1,17 +1,17 @@ -use crate::{Service, ServiceId}; -use cosmwasm_std::Coin; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; +// Copyright 2023 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 -#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] -#[serde(rename_all = "snake_case")] +use crate::{Service, ServiceId}; +use cosmwasm_schema::cw_serde; +use cosmwasm_std::Coin; + +#[cw_serde] pub struct ServiceInfoResponse { pub service_id: ServiceId, pub service: Option, } -#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, JsonSchema)] -#[serde(rename_all = "snake_case")] +#[cw_serde] pub struct ServicesListResponse { pub services: Vec, } @@ -30,11 +30,12 @@ impl From<&[Service]> for ServicesListResponse { } } -#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] -#[serde(rename_all = "snake_case")] +#[cw_serde] pub struct PagedServicesListResponse { pub services: Vec, pub per_page: usize, + + /// Field indicating paging information for the following queries if the caller wishes to get further entries. pub start_next_after: Option, } @@ -52,8 +53,7 @@ impl PagedServicesListResponse { } } -#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] -#[serde(rename_all = "snake_case")] +#[cw_serde] pub struct ConfigResponse { pub deposit_required: Coin, } diff --git a/common/cosmwasm-smart-contracts/service-provider-directory/src/signing_types.rs b/common/cosmwasm-smart-contracts/service-provider-directory/src/signing_types.rs index 742470b2cd..fb9752d10a 100644 --- a/common/cosmwasm-smart-contracts/service-provider-directory/src/signing_types.rs +++ b/common/cosmwasm-smart-contracts/service-provider-directory/src/signing_types.rs @@ -1,15 +1,17 @@ +// Copyright 2023 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use crate::ServiceDetails; +use cosmwasm_schema::cw_serde; use cosmwasm_std::{Addr, Coin}; use nym_contracts_common::signing::{ ContractMessageContent, MessageType, Nonce, SignableMessage, SigningPurpose, }; -use serde::Serialize; - -use crate::ServiceDetails; pub type SignableServiceProviderAnnounceMsg = SignableMessage>; -#[derive(Serialize)] +#[cw_serde] pub struct ServiceProviderAnnounce { service: ServiceDetails, } diff --git a/common/cosmwasm-smart-contracts/service-provider-directory/src/types.rs b/common/cosmwasm-smart-contracts/service-provider-directory/src/types.rs index c3ad296fa2..845c05b768 100644 --- a/common/cosmwasm-smart-contracts/service-provider-directory/src/types.rs +++ b/common/cosmwasm-smart-contracts/service-provider-directory/src/types.rs @@ -1,14 +1,15 @@ -use std::fmt::{Display, Formatter}; +// Copyright 2023 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 +use cosmwasm_schema::cw_serde; use cosmwasm_std::{Addr, Coin}; use nym_contracts_common::IdentityKey; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; +use std::fmt::{Display, Formatter}; /// The directory of services are indexed by [`ServiceId`]. pub type ServiceId = u32; -#[derive(Serialize, Deserialize, Clone, PartialEq, Debug, JsonSchema)] +#[cw_serde] pub struct Service { /// Unique id assigned to the anounced service. pub service_id: ServiceId, @@ -22,7 +23,7 @@ pub struct Service { pub deposit: Coin, } -#[derive(Serialize, Deserialize, Clone, PartialEq, Debug, JsonSchema)] +#[cw_serde] pub struct ServiceDetails { /// The address of the service. pub nym_address: NymAddress, @@ -33,8 +34,7 @@ pub struct ServiceDetails { } /// The types of addresses supported. -#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug, JsonSchema)] -#[serde(rename_all = "snake_case")] +#[cw_serde] pub enum NymAddress { /// String representation of a nym address, which is of the form /// client_id.client_enc@gateway_id. @@ -64,8 +64,7 @@ impl Display for NymAddress { } /// The type of services provider supported -#[derive(Serialize, Deserialize, Copy, Clone, PartialEq, Eq, Debug, JsonSchema)] -#[serde(rename_all = "snake_case")] +#[cw_serde] pub enum ServiceType { NetworkRequester, } diff --git a/common/cosmwasm-smart-contracts/vesting-contract/Cargo.toml b/common/cosmwasm-smart-contracts/vesting-contract/Cargo.toml index 516f8a8e35..f5fa35df5f 100644 --- a/common/cosmwasm-smart-contracts/vesting-contract/Cargo.toml +++ b/common/cosmwasm-smart-contracts/vesting-contract/Cargo.toml @@ -9,11 +9,14 @@ repository = { workspace = true } [dependencies] cosmwasm-std = { workspace = true } +cosmwasm-schema = { workspace = true } +cw2 = { workspace = true, optional = true } mixnet-contract-common = { path = "../mixnet-contract", package = "nym-mixnet-contract-common", version = "0.6.0" } contracts-common = { path = "../contracts-common", package = "nym-contracts-common", version = "0.5.0" } serde = { version = "1.0", features = ["derive"] } -schemars = "0.8" +thiserror = "1.0" ts-rs = {version = "6.1.2", optional = true} [features] +schema = ["cw2"] generate-ts = ["ts-rs"] diff --git a/common/cosmwasm-smart-contracts/vesting-contract/src/account.rs b/common/cosmwasm-smart-contracts/vesting-contract/src/account.rs new file mode 100644 index 0000000000..0d1e5b754e --- /dev/null +++ b/common/cosmwasm-smart-contracts/vesting-contract/src/account.rs @@ -0,0 +1,124 @@ +// Copyright 2023 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use crate::{Period, PledgeCap, VestingContractError, VestingPeriod}; +use cosmwasm_schema::cw_serde; +use cosmwasm_std::{Addr, Coin, Timestamp}; + +// this shouldn't really be exposed like this, but we really don't want to migrate the contract just for this... +pub type VestingAccountStorageKey = u32; + +/// Vesting account information. +#[cw_serde] +pub struct Account { + /// Address of the owner of the vesting account. + pub owner_address: Addr, + + /// Optional address of an account allowed to perform staking on behalf of the owner. + pub staking_address: Option, + + /// The starting vesting time. + pub start_time: Timestamp, + + /// All vesting periods for this account. + pub periods: Vec, + + /// The initial amount of coins used creation of this account. + pub coin: Coin, + + /// The id/storage_key of this vesting account. + pub storage_key: VestingAccountStorageKey, + + /// Optional custom pledge cap of this vesting account. + #[serde(default)] + pub pledge_cap: Option, +} + +impl Account { + pub fn pledge_cap(&self) -> PledgeCap { + self.pledge_cap.clone().unwrap_or_default() + } + + pub fn coin(&self) -> Coin { + self.coin.clone() + } + + pub fn num_vesting_periods(&self) -> usize { + self.periods.len() + } + + pub fn period_duration(&self) -> Result { + self.periods + .get(0) + .ok_or(VestingContractError::UnpopulatedVestingPeriods { + owner: self.owner_address.clone(), + }) + .map(|p| p.period_seconds) + } + + pub fn storage_key(&self) -> u32 { + self.storage_key + } + + pub fn owner_address(&self) -> Addr { + self.owner_address.clone() + } + + pub fn staking_address(&self) -> Option<&Addr> { + self.staking_address.as_ref() + } + + pub fn periods(&self) -> Vec { + self.periods.clone() + } + + pub fn start_time(&self) -> Timestamp { + self.start_time + } + + pub fn tokens_per_period(&self) -> Result { + let amount = self.coin.amount.u128(); + if amount < self.num_vesting_periods() as u128 { + Err(VestingContractError::ImprobableVestingAmount(amount)) + } else { + // Remainder tokens will be lumped into the last period. + Ok(amount / self.num_vesting_periods() as u128) + } + } + + /// Returns the index of the next vesting period. Unless the current time is somehow in the past or vesting has not started yet. + /// In case vesting is over it will always return NUM_VESTING_PERIODS. + pub fn get_current_vesting_period( + &self, + block_time: Timestamp, + ) -> Result { + let first_period = + self.periods + .first() + .ok_or(VestingContractError::UnpopulatedVestingPeriods { + owner: self.owner_address.clone(), + })?; + + let last_period = + self.periods + .last() + .ok_or(VestingContractError::UnpopulatedVestingPeriods { + owner: self.owner_address.clone(), + })?; + + if block_time.seconds() < first_period.start_time { + Ok(Period::Before) + } else if last_period.end_time() < block_time { + Ok(Period::After) + } else { + let mut index = 0; + for period in &self.periods { + if block_time < period.end_time() { + break; + } + index += 1; + } + Ok(Period::In(index)) + } + } +} diff --git a/contracts/vesting/src/errors.rs b/common/cosmwasm-smart-contracts/vesting-contract/src/error.rs similarity index 92% rename from contracts/vesting/src/errors.rs rename to common/cosmwasm-smart-contracts/vesting-contract/src/error.rs index 2b92be0c8c..65825c6ad9 100644 --- a/contracts/vesting/src/errors.rs +++ b/common/cosmwasm-smart-contracts/vesting-contract/src/error.rs @@ -1,10 +1,13 @@ -use crate::storage::AccountStorageKey; +// Copyright 2023 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use crate::account::VestingAccountStorageKey; use cosmwasm_std::{Addr, Coin, OverflowError, StdError, Uint128}; use mixnet_contract_common::MixId; use thiserror::Error; #[derive(Error, Debug, PartialEq)] -pub enum ContractError { +pub enum VestingContractError { #[error("VESTING ({}): {0}", line!())] Std(#[from] StdError), @@ -27,7 +30,7 @@ pub enum ContractError { InsufficientSpendable(String, u128), #[error( - "VESTING ({}):Only delegation owner can perform delegation actions, {0} is not the delegation owner" + "VESTING ({}):Only delegation owner can perform delegation actions, {0} is not the delegation owner" , line!())] NotDelegate(String), @@ -91,7 +94,7 @@ pub enum ContractError { #[error("VESTING: {address} ({acc_id} has already performed {num} individual delegations towards {mix_id}. No further delegations are allowed. Please consider consolidating those delegations instead. The current cap is {cap}.")] TooManyDelegations { address: Addr, - acc_id: AccountStorageKey, + acc_id: VestingAccountStorageKey, mix_id: MixId, num: u32, cap: u32, diff --git a/common/cosmwasm-smart-contracts/vesting-contract/src/lib.rs b/common/cosmwasm-smart-contracts/vesting-contract/src/lib.rs index 6c456674a5..31fab7a7ef 100644 --- a/common/cosmwasm-smart-contracts/vesting-contract/src/lib.rs +++ b/common/cosmwasm-smart-contracts/vesting-contract/src/lib.rs @@ -4,83 +4,31 @@ #![warn(clippy::expect_used)] #![warn(clippy::unwrap_used)] -use contracts_common::Percent; -use cosmwasm_std::{Addr, Coin, Timestamp, Uint128}; +use cosmwasm_schema::cw_serde; +use cosmwasm_std::{Addr, Coin}; use mixnet_contract_common::MixId; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use std::str::FromStr; - -pub use messages::{ExecuteMsg, InitMsg, MigrateMsg, QueryMsg}; +pub mod account; +pub mod error; pub mod events; pub mod messages; +pub mod types; -#[cfg_attr(feature = "generate-ts", derive(ts_rs::TS))] -#[cfg_attr( - feature = "generate-ts", - ts(export_to = "ts-packages/types/src/types/rust/Period.ts") -)] -#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone, JsonSchema)] -pub enum Period { - Before, - In(usize), - After, -} +pub use account::Account; +pub use error::VestingContractError; +pub use messages::{ExecuteMsg, InitMsg, MigrateMsg, QueryMsg}; +pub use types::*; -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -pub struct PledgeData { - pub amount: Coin, - pub block_time: Timestamp, -} - -impl PledgeData { - pub fn amount(&self) -> Coin { - self.amount.clone() - } - - pub fn block_time(&self) -> Timestamp { - self.block_time - } - - pub fn new(amount: Coin, block_time: Timestamp) -> Self { - Self { amount, block_time } - } -} - -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -pub enum PledgeCap { - Percent(Percent), - Absolute(Uint128), // This has to be in unym -} - -impl FromStr for PledgeCap { - type Err = String; - - fn from_str(cap: &str) -> Result { - let cap = cap.replace('_', "").replace(',', "."); - match Percent::from_str(&cap) { - Ok(p) => Ok(PledgeCap::Percent(p)), - Err(_) => match cap.parse::() { - Ok(i) => Ok(PledgeCap::Absolute(Uint128::from(i))), - Err(_e) => Err(format!("Could not parse {cap} as Percent or Uint128")), - }, - } - } -} - -impl Default for PledgeCap { - fn default() -> Self { - #[allow(clippy::expect_used)] - PledgeCap::Percent(Percent::from_percentage_value(10).expect("This can never fail!")) - } -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +/// Details about the original vesting specification used when the account was created. +#[cw_serde] pub struct OriginalVestingResponse { + /// The original amount that was used for the creation of this vesting account pub amount: Coin, + + /// The number of vesting periods that the account was created with pub number_of_periods: usize, + + /// Duration of each vesting period in seconds pub period_duration: u64, } @@ -106,57 +54,73 @@ impl OriginalVestingResponse { } } -#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone, JsonSchema)] -pub struct VestingDelegation { - pub account_id: u32, - pub mix_id: MixId, - pub block_timestamp: u64, - pub amount: Uint128, -} - -impl VestingDelegation { - pub fn storage_key(&self) -> (u32, MixId, u64) { - (self.account_id, self.mix_id, self.block_timestamp) - } -} - -#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone, JsonSchema)] +/// Response containing timestamps of all delegations made towards particular mixnode by given vesting account. +#[cw_serde] pub struct DelegationTimesResponse { + /// Address of this account's owner pub owner: Addr, + + /// Id associated with this account pub account_id: u32, + + /// Id of the mixnode towards which the delegation was made pub mix_id: MixId, + + /// All timestamps where a delegation was made pub delegation_timestamps: Vec, } -#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone, JsonSchema)] +/// Response containing paged list of all vesting delegations made using vesting coins. +#[cw_serde] pub struct AllDelegationsResponse { + /// The actual vesting delegations made. pub delegations: Vec, + + /// Field indicating paging information for the following queries if the caller wishes to get further entries. pub start_next_after: Option<(u32, MixId, u64)>, } -#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema)] +/// Basic information regarding particular vesting account alongside the amount of vesting coins. +#[cw_serde] pub struct AccountVestingCoins { + /// Id associated with this account pub account_id: u32, + + /// Address of this account's owner pub owner: Addr, + + /// Coins that are still vesting belonging to this account. pub still_vesting: Coin, } -#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema)] +/// Response containing vesting coins held in this contract +#[cw_serde] pub struct VestingCoinsResponse { + /// The actual accounts, and their vesting coins, returned by the query. pub accounts: Vec, + + /// Field indicating paging information for the following queries if the caller wishes to get further entries. pub start_next_after: Option, } -#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema)] +/// Basic information regarding particular vesting account +#[cw_serde] pub struct BaseVestingAccountInfo { + /// Id associated with this account pub account_id: u32, + + /// Address of this account's owner pub owner: Addr, // TODO: should this particular query/response expose anything else? } -#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema)] +/// Response containing basic vesting account information +#[cw_serde] pub struct AccountsResponse { + /// The actual accounts returned by the query. pub accounts: Vec, + + /// Field indicating paging information for the following queries if the caller wishes to get further entries. pub start_next_after: Option, } diff --git a/common/cosmwasm-smart-contracts/vesting-contract/src/messages.rs b/common/cosmwasm-smart-contracts/vesting-contract/src/messages.rs index f4d7147e2c..6593926445 100644 --- a/common/cosmwasm-smart-contracts/vesting-contract/src/messages.rs +++ b/common/cosmwasm-smart-contracts/vesting-contract/src/messages.rs @@ -1,4 +1,9 @@ +// Copyright 2021-2023 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use crate::{PledgeCap, VestingSpecification}; use contracts_common::signing::MessageSignature; +use cosmwasm_schema::cw_serde; use cosmwasm_std::{Coin, Timestamp}; use mixnet_contract_common::families::FamilyHead; use mixnet_contract_common::{ @@ -6,57 +11,30 @@ use mixnet_contract_common::{ mixnode::{MixNodeConfigUpdate, MixNodeCostParams}, Gateway, IdentityKey, MixId, MixNode, }; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use crate::PledgeCap; +#[cfg(feature = "schema")] +use contracts_common::ContractBuildInformation; +#[cfg(feature = "schema")] +use cosmwasm_schema::QueryResponses; -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] +#[cfg(feature = "schema")] +use crate::{ + account::Account, + types::{Period, PledgeData, VestingDelegation}, + AccountsResponse, AllDelegationsResponse, DelegationTimesResponse, OriginalVestingResponse, + VestingCoinsResponse, +}; + +#[cw_serde] pub struct InitMsg { pub mixnet_contract_address: String, pub mix_denom: String, } -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] +#[cw_serde] pub struct MigrateMsg {} -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, Default)] -pub struct VestingSpecification { - start_time: Option, - period_seconds: Option, - num_periods: Option, -} - -impl VestingSpecification { - pub fn new( - start_time: Option, - period_seconds: Option, - num_periods: Option, - ) -> Self { - Self { - start_time, - period_seconds, - num_periods, - } - } - - pub fn start_time(&self) -> Option { - self.start_time - } - - pub fn period_seconds(&self) -> u64 { - self.period_seconds.unwrap_or(3 * 30 * 86400) - } - - pub fn num_periods(&self) -> u64 { - self.num_periods.unwrap_or(8) - } -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] +#[cw_serde] pub enum ExecuteMsg { // Families /// Only owner of the node can crate the family with node as head @@ -197,93 +175,226 @@ impl ExecuteMsg { } } -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] +/// Queries exposed by this contract. +#[cw_serde] +#[cfg_attr(feature = "schema", derive(QueryResponses))] pub enum QueryMsg { + /// Gets build information of this contract, such as the commit hash used for the build or rustc version. + #[cfg_attr(feature = "schema", returns(ContractBuildInformation))] GetContractVersion {}, + + /// Gets the stored contract version information that's required by the CW2 spec interface for migrations. #[serde(rename = "get_cw2_contract_version")] + #[cfg_attr(feature = "schema", returns(cw2::ContractVersion))] GetCW2ContractVersion {}, + + /// Gets the list of vesting accounts held in this contract. + #[cfg_attr(feature = "schema", returns(AccountsResponse))] GetAccountsPaged { + /// Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response. start_next_after: Option, + + /// Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default. limit: Option, }, + + /// Gets the list of coins that are still vesting for each account held in this contract. + #[cfg_attr(feature = "schema", returns(VestingCoinsResponse))] GetAccountsVestingCoinsPaged { + /// Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response. start_next_after: Option, + + /// Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default. limit: Option, }, + + /// Returns the amount of locked coins for the provided vesting account, + /// i.e. coins that are still vesting but have not been staked. + /// `locked_coins = vesting_coins - staked_coins` + #[cfg_attr(feature = "schema", returns(Coin))] LockedCoins { + /// Address of the vesting account in question. vesting_account_address: String, + + /// (deprecated) Optional argument specifying that the query should be performed against non-current block. block_time: Option, }, + + /// Returns the amount of spendable coins for the provided vesting account, + /// i.e. coins that could be withdrawn. + /// `spendable_coins = account_balance - locked_coins` + /// note: `account_balance` is the amount of coins still physically present in this contract, i.e. not withdrawn or staked. + #[cfg_attr(feature = "schema", returns(Coin))] SpendableCoins { + /// Address of the vesting account in question. vesting_account_address: String, + + /// (deprecated) Optional argument specifying that the query should be performed against non-current block. block_time: Option, }, + + /// Returns the amount of coins that have already vested for the provided vesting account address. + #[cfg_attr(feature = "schema", returns(Coin))] GetVestedCoins { + /// Address of the vesting account in question. vesting_account_address: String, + + /// (deprecated) Optional argument specifying that the query should be performed against non-current block. block_time: Option, }, + + /// Returns the amount of coins that are still vesting for the provided vesting account address. + #[cfg_attr(feature = "schema", returns(Coin))] GetVestingCoins { + /// Address of the vesting account in question. vesting_account_address: String, + + /// (deprecated) Optional argument specifying that the query should be performed against non-current block. block_time: Option, }, + + /// Returns the starting vesting time for the provided vesting account, + /// i.e. the beginning of the first vesting period. + #[cfg_attr(feature = "schema", returns(Timestamp))] GetStartTime { + /// Address of the vesting account in question. vesting_account_address: String, }, + + /// Returns the ending vesting time for the provided vesting account, + /// i.e. the end of the last vesting period. + #[cfg_attr(feature = "schema", returns(Timestamp))] GetEndTime { + /// Address of the vesting account in question. vesting_account_address: String, }, + + /// Returns the initial vesting specification used for the provided vesting account address. + #[cfg_attr(feature = "schema", returns(OriginalVestingResponse))] GetOriginalVesting { + /// Address of the vesting account in question. vesting_account_address: String, }, + + /// Returns the total amount of coins accrued through claimed staking rewards by the provided vesting account. + #[cfg_attr(feature = "schema", returns(Coin))] GetHistoricalVestingStakingReward { + /// Address of the vesting account in question. vesting_account_address: String, }, + + /// Returns the amount of spendable vesting coins for the provided vesting account, + /// i.e. coins that could be withdrawn that originated from the vesting specification. + #[cfg_attr(feature = "schema", returns(Coin))] GetSpendableVestedCoins { + /// Address of the vesting account in question. vesting_account_address: String, }, + + /// Returns the amount of spendable reward coins for the provided vesting account, + /// i.e. coins that could be withdrawn that originated from the claimed staking rewards. + #[cfg_attr(feature = "schema", returns(Coin))] GetSpendableRewardCoins { + /// Address of the vesting account in question. vesting_account_address: String, }, + + /// Returns the amount of coins that are currently delegated for the provided vesting account address. + #[cfg_attr(feature = "schema", returns(Coin))] GetDelegatedCoins { + /// Address of the vesting account in question. vesting_account_address: String, }, + + /// Returns the amount of coins that are currently pledged for the provided vesting account address. + #[cfg_attr(feature = "schema", returns(Coin))] GetPledgedCoins { + /// Address of the vesting account in question. vesting_account_address: String, }, + + /// Returns the amount of coins that are currently staked (i.e. delegations + pledges) for the provided vesting account address. + #[cfg_attr(feature = "schema", returns(Coin))] GetStakedCoins { + /// Address of the vesting account in question. vesting_account_address: String, }, + + /// Returns the amount of coins that got withdrawn for the provided vesting account address. + #[cfg_attr(feature = "schema", returns(Coin))] GetWithdrawnCoins { + /// Address of the vesting account in question. vesting_account_address: String, }, + + /// Returns detailed information associated with the account for the provided vesting account address. + #[cfg_attr(feature = "schema", returns(Account))] GetAccount { + /// Address of the vesting account in question. address: String, }, + + /// Returns pledge information (if applicable) for bonded mixnode for the provided vesting account address. + #[cfg_attr(feature = "schema", returns(Option))] GetMixnode { + /// Address of the vesting account in question. address: String, }, + + /// Returns pledge information (if applicable) for bonded gateway for the provided vesting account address. + #[cfg_attr(feature = "schema", returns(Option))] GetGateway { + /// Address of the vesting account in question. address: String, }, + + /// Returns the current vesting period for the provided vesting account address. + #[cfg_attr(feature = "schema", returns(Period))] GetCurrentVestingPeriod { + /// Address of the vesting account in question. address: String, }, + + /// Returns the information about particular vesting delegation. + #[cfg_attr(feature = "schema", returns(VestingDelegation))] GetDelegation { + /// Address of the vesting account in question. address: String, + + /// Id of the mixnode towards which the delegation has been made. mix_id: MixId, + + /// Block timestamp of the delegation. block_timestamp_secs: u64, }, + + /// Returns the total amount of coins delegated towards particular mixnode by the provided vesting account address. + #[cfg_attr(feature = "schema", returns(Coin))] GetTotalDelegationAmount { + /// Address of the vesting account in question. address: String, + + /// Id of the mixnode towards which the delegations have been made. mix_id: MixId, }, + + /// Returns timestamps of delegations made towards particular mixnode by the provided vesting account address. + #[cfg_attr(feature = "schema", returns(DelegationTimesResponse))] GetDelegationTimes { + /// Address of the vesting account in question. address: String, + + /// Id of the mixnode towards which the delegations have been made. mix_id: MixId, }, + + /// Returns all active delegations made with vesting tokens stored in this contract. + #[cfg_attr(feature = "schema", returns(AllDelegationsResponse))] GetAllDelegations { + /// Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response. start_after: Option<(u32, MixId, u64)>, + + /// Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default. limit: Option, }, } diff --git a/common/cosmwasm-smart-contracts/vesting-contract/src/types.rs b/common/cosmwasm-smart-contracts/vesting-contract/src/types.rs new file mode 100644 index 0000000000..60fd3c0aea --- /dev/null +++ b/common/cosmwasm-smart-contracts/vesting-contract/src/types.rs @@ -0,0 +1,166 @@ +// Copyright 2023 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use contracts_common::Percent; +use cosmwasm_schema::cw_serde; +use cosmwasm_std::{Coin, Timestamp, Uint128}; +use mixnet_contract_common::MixId; +use std::str::FromStr; + +#[cfg_attr(feature = "generate-ts", derive(ts_rs::TS))] +#[cfg_attr( + feature = "generate-ts", + ts(export_to = "ts-packages/types/src/types/rust/Period.ts") +)] +#[cw_serde] +/// The vesting period. +pub enum Period { + /// Defines a pre-vesting period. + Before, + + /// Defines currently active vesting period. + In(usize), + + /// Defines a post-vesting period. + After, +} + +/// Information regarding pledge (i.e. mixnode or gateway bonding) made with vesting tokens. +#[cw_serde] +pub struct PledgeData { + /// The amount pledged. + pub amount: Coin, + + /// The block timestamp where the pledge occurred. + pub block_time: Timestamp, +} + +impl PledgeData { + pub fn amount(&self) -> Coin { + self.amount.clone() + } + + pub fn block_time(&self) -> Timestamp { + self.block_time + } + + pub fn new(amount: Coin, block_time: Timestamp) -> Self { + Self { amount, block_time } + } +} + +/// Defines cap for pleding/staking tokens. +#[cw_serde] +pub enum PledgeCap { + /// Specifies a percent-based pledge cap, i.e. only given % of tokens could be pledged/staked. + Percent(Percent), + + /// Specifies an absolute pledge cap, i.e. an explicit value that could be pledged/staked. + Absolute(Uint128), // This has to be in unym +} + +impl FromStr for PledgeCap { + type Err = String; + + fn from_str(cap: &str) -> Result { + let cap = cap.replace('_', "").replace(',', "."); + match Percent::from_str(&cap) { + Ok(p) => Ok(PledgeCap::Percent(p)), + Err(_) => match cap.parse::() { + Ok(i) => Ok(PledgeCap::Absolute(Uint128::from(i))), + Err(_e) => Err(format!("Could not parse {cap} as Percent or Uint128")), + }, + } + } +} + +impl Default for PledgeCap { + fn default() -> Self { + #[allow(clippy::expect_used)] + PledgeCap::Percent(Percent::from_percentage_value(10).expect("This can never fail!")) + } +} + +/// Vesting period details. +#[cw_serde] +pub struct VestingPeriod { + /// The start time of this vesting period, as unix timestamp. + pub start_time: u64, + + /// The duration (in seconds) of the vesting period. + pub period_seconds: u64, +} + +impl VestingPeriod { + pub fn end_time(&self) -> Timestamp { + Timestamp::from_seconds(self.start_time + self.period_seconds) + } +} + +#[cw_serde] +#[derive(Default)] +pub struct VestingSpecification { + start_time: Option, + period_seconds: Option, + num_periods: Option, +} + +impl VestingSpecification { + pub fn new( + start_time: Option, + period_seconds: Option, + num_periods: Option, + ) -> Self { + Self { + start_time, + period_seconds, + num_periods, + } + } + + pub fn start_time(&self) -> Option { + self.start_time + } + + pub fn period_seconds(&self) -> u64 { + self.period_seconds.unwrap_or(3 * 30 * 86400) + } + + pub fn num_periods(&self) -> u64 { + self.num_periods.unwrap_or(8) + } + + pub fn populate_vesting_periods(&self, start_time: u64) -> Vec { + let mut periods = Vec::with_capacity(self.num_periods() as usize); + for i in 0..self.num_periods() { + let period = VestingPeriod { + start_time: start_time + i * self.period_seconds(), + period_seconds: self.period_seconds(), + }; + periods.push(period); + } + periods + } +} + +/// Details about particular vesting delegation. +#[cw_serde] +pub struct VestingDelegation { + /// The id of the vesting account that has made the delegation. + pub account_id: u32, + + /// The id of the mixnode towards which the delegation has been made. + pub mix_id: MixId, + + /// The block timestamp when the delegation has been made. + pub block_timestamp: u64, + + /// The raw amount delegated (interpreted to be in the same denom as the underlying vesting specification) + pub amount: Uint128, +} + +impl VestingDelegation { + pub fn storage_key(&self) -> (u32, MixId, u64) { + (self.account_id, self.mix_id, self.block_timestamp) + } +} diff --git a/common/types/Cargo.toml b/common/types/Cargo.toml index c99bbf3e30..cbf12b4364 100644 --- a/common/types/Cargo.toml +++ b/common/types/Cargo.toml @@ -27,8 +27,7 @@ nym-mixnet-contract-common = { path = "../../common/cosmwasm-smart-contracts/mix nym-vesting-contract-common = { path = "../../common/cosmwasm-smart-contracts/vesting-contract" } nym-config = { path = "../../common/config" } nym-coconut-interface = { path = "../../common/coconut-interface" } -# Used for Type conversion, can be extracted but its a lot of work -nym-vesting-contract = { path = "../../contracts/vesting" } + [dev-dependencies] tempfile = "3.3.0" diff --git a/common/types/src/delegation.rs b/common/types/src/delegation.rs index 399bf7b91b..550f17a261 100644 --- a/common/types/src/delegation.rs +++ b/common/types/src/delegation.rs @@ -41,7 +41,7 @@ impl Delegation { feature = "generate-ts", ts(export_to = "ts-packages/types/src/types/rust/DelegationWithEverything.ts") )] -#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, JsonSchema)] +#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, JsonSchema)] pub struct DelegationWithEverything { pub owner: String, pub mix_id: MixId, diff --git a/common/types/src/mixnode.rs b/common/types/src/mixnode.rs index 145f9c409f..02246aad68 100644 --- a/common/types/src/mixnode.rs +++ b/common/types/src/mixnode.rs @@ -20,7 +20,7 @@ use std::net::IpAddr; feature = "generate-ts", ts(export_to = "ts-packages/types/src/types/rust/MixNodeDetails.ts") )] -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +#[derive(Clone, Debug, Deserialize, PartialEq, Serialize, JsonSchema)] pub struct MixNodeDetails { pub bond_information: MixNodeBond, pub rewarding_details: MixNodeRewarding, @@ -49,7 +49,7 @@ impl MixNodeDetails { feature = "generate-ts", ts(export_to = "ts-packages/types/src/types/rust/MixNodeBond.ts") )] -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +#[derive(Clone, Debug, Deserialize, PartialEq, Serialize, JsonSchema)] pub struct MixNodeBond { pub mix_id: MixId, pub owner: String, @@ -85,7 +85,7 @@ impl MixNodeBond { feature = "generate-ts", ts(export_to = "ts-packages/types/src/types/rust/MixNodeRewarding.ts") )] -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +#[derive(Clone, Debug, Deserialize, PartialEq, Serialize, JsonSchema)] pub struct MixNodeRewarding { pub cost_params: MixNodeCostParams, @@ -131,7 +131,7 @@ impl MixNodeRewarding { feature = "generate-ts", ts(export_to = "ts-packages/types/src/types/rust/MixNodeCostParams.ts") )] -#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, JsonSchema)] +#[derive(Clone, Debug, Deserialize, PartialEq, Serialize, JsonSchema)] pub struct MixNodeCostParams { #[cfg_attr(feature = "generate-ts", ts(type = "string"))] pub profit_margin_percent: Percent, diff --git a/common/types/src/pending_events.rs b/common/types/src/pending_events.rs index 23ecdf4f19..f5789890bf 100644 --- a/common/types/src/pending_events.rs +++ b/common/types/src/pending_events.rs @@ -127,7 +127,7 @@ impl PendingEpochEventData { feature = "generate-ts", ts(export_to = "ts-packages/types/src/types/rust/PendingIntervalEvent.ts") )] -#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, JsonSchema)] +#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, JsonSchema)] pub struct PendingIntervalEvent { pub id: IntervalEventId, pub created_at: BlockHeight, @@ -155,7 +155,7 @@ impl PendingIntervalEvent { feature = "generate-ts", ts(export_to = "ts-packages/types/src/types/rust/PendingIntervalEventData.ts") )] -#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, JsonSchema)] +#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, JsonSchema)] pub enum PendingIntervalEventData { ChangeMixCostParams { mix_id: MixId, diff --git a/common/types/src/vesting.rs b/common/types/src/vesting.rs index 9be8ef03da..1071b21324 100644 --- a/common/types/src/vesting.rs +++ b/common/types/src/vesting.rs @@ -1,10 +1,10 @@ use crate::currency::{DecCoin, RegisteredCoins}; use crate::error::TypesError; +use nym_vesting_contract_common::account::Account as ContractVestingAccount; +use nym_vesting_contract_common::types::VestingPeriod as ContractVestingPeriod; use nym_vesting_contract_common::OriginalVestingResponse as ContractOriginalVestingResponse; use nym_vesting_contract_common::PledgeData as ContractPledgeData; use serde::{Deserialize, Serialize}; -use vesting_contract::vesting::Account as ContractVestingAccount; -use vesting_contract::vesting::VestingPeriod as ContractVestingPeriod; #[cfg_attr(feature = "generate-ts", derive(ts_rs::TS))] #[cfg_attr( diff --git a/contracts/Cargo.lock b/contracts/Cargo.lock index 3d719dd6dc..1a87652242 100644 --- a/contracts/Cargo.lock +++ b/contracts/Cargo.lock @@ -73,6 +73,12 @@ dependencies = [ "generic-array", ] +[[package]] +name = "bnum" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "845141a4fade3f790628b7daaaa298a25b204fb28907eb54febe5142db6ce653" + [[package]] name = "bs58" version = "0.4.0" @@ -145,9 +151,9 @@ checksum = "520fbf3c07483f94e3e3ca9d0cfd913d7718ef2483d2cfd91c0d9e91474ab913" [[package]] name = "cosmwasm-crypto" -version = "1.2.5" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75836a10cb9654c54e77ee56da94d592923092a10b369cdb0dbd56acefc16340" +checksum = "0d076a08ec01ed23c4396aca98ec73a38fa1fee5f310465add52b4108181c7a8" dependencies = [ "digest 0.10.7", "ed25519-zebra", @@ -158,18 +164,18 @@ dependencies = [ [[package]] name = "cosmwasm-derive" -version = "1.2.5" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c9f7f0e51bfc7295f7b2664fe8513c966428642aa765dad8a74acdab5e0c773" +checksum = "dec361f3c09d7b41221948fc17be9b3c96cb58e55a02f82da36f888a651f2584" dependencies = [ "syn 1.0.109", ] [[package]] name = "cosmwasm-schema" -version = "1.2.5" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f00b363610218eea83f24bbab09e1a7c3920b79f068334fdfcc62f6129ef9fc" +checksum = "bb6b2fb76758ef59cddc77f2e2ae91c22f77da49037e9f182e9c2833f0e959b1" dependencies = [ "cosmwasm-schema-derive", "schemars", @@ -180,9 +186,9 @@ dependencies = [ [[package]] name = "cosmwasm-schema-derive" -version = "1.2.5" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae38f909b2822d32b275c9e2db9728497aa33ffe67dd463bc67c6a3b7092785c" +checksum = "2bfa39422f0d9f1c9a6fd3711573258495314dfa3aae738ea825ecd9964bc659" dependencies = [ "proc-macro2", "quote", @@ -191,11 +197,12 @@ dependencies = [ [[package]] name = "cosmwasm-std" -version = "1.2.5" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a49b85345e811c8e80ec55d0d091e4fcb4f00f97ab058f9be5f614c444a730cb" +checksum = "1f6dc2ee23313add5ecacc3ccac217b9967ad9d2d11bd56e5da6aa65a9da6138" dependencies = [ "base64 0.13.1", + "bnum", "cosmwasm-crypto", "cosmwasm-derive", "derivative", @@ -203,17 +210,16 @@ dependencies = [ "hex", "schemars", "serde", - "serde-json-wasm 0.5.1", + "serde-json-wasm", "sha2 0.10.6", "thiserror", - "uint", ] [[package]] name = "cosmwasm-storage" -version = "1.2.5" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3737a3aac48f5ed883b5b73bfb731e77feebd8fc6b43419844ec2971072164d" +checksum = "7ade8cae79dc08a06bcf119c0854ffaed11bd8cb1013c6b04abfe1f51f36211e" dependencies = [ "cosmwasm-std", "serde", @@ -228,12 +234,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - [[package]] name = "crypto-bigint" version = "0.4.9" @@ -271,9 +271,9 @@ dependencies = [ [[package]] name = "cw-controllers" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91440ce8ec4f0642798bc8c8cb6b9b53c1926c6dadaf0eed267a5145cd529071" +checksum = "d5d8edce4b78785f36413f67387e4be7d0cb7d032b5d4164bcc024f9c3f3f2ea" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -305,9 +305,9 @@ dependencies = [ [[package]] name = "cw-storage-plus" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053a5083c258acd68386734f428a5a171b29f7d733151ae83090c6fcc9417ffa" +checksum = "3f0e92a069d62067f3472c62e30adedb4cab1754725c0f2a682b3128d2bf3c79" dependencies = [ "cosmwasm-std", "schemars", @@ -331,22 +331,23 @@ dependencies = [ [[package]] name = "cw2" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fb70cee2cf0b4a8ff7253e6bc6647107905e8eb37208f87d54f67810faa62f8" +checksum = "29ac2dc7a55ad64173ca1e0a46697c31b7a5c51342f55a1e84a724da4eb99908" dependencies = [ "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus", "schemars", "serde", + "thiserror", ] [[package]] name = "cw20" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91666da6c7b40c8dd5ff94df655a28114efc10c79b70b4d06f13c31e37d60609" +checksum = "011c45920f8200bd5d32d4fe52502506f64f2f75651ab408054d4cfc75ca3a9b" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -375,9 +376,9 @@ dependencies = [ [[package]] name = "cw3" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fe0b587008aa221cd2a2579a21990a28c4347dc53ad43167c68ad765f5b6efa" +checksum = "171af3d9127de6805a7dd819fb070c7d2f6c3ea85f4193f42cef259f0a7f33d5" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -390,9 +391,9 @@ dependencies = [ [[package]] name = "cw3-fixed-multisig" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9e2415adb201e5e89dab34edf59d7dc166bc558526de009a49ae66276c9119a" +checksum = "705875c68f95870e9707e7b72b50631ddc58c07517d6cc43758306e38921118e" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -409,6 +410,7 @@ dependencies = [ name = "cw3-flex-multisig" version = "1.0.0" dependencies = [ + "cosmwasm-schema", "cosmwasm-std", "cw-multi-test", "cw-storage-plus", @@ -422,14 +424,13 @@ dependencies = [ "cw4-group", "nym-group-contract-common", "nym-multisig-contract-common", - "schemars", ] [[package]] name = "cw4" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c236e0bae02ce97e89235a681dd0e07d099524b369f1ef908d704db3e6b049b" +checksum = "a398696307efadaaa2d0850076f865fa706c959d493cb4203314f72be6b77a64" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -1022,13 +1023,13 @@ dependencies = [ name = "nym-coconut-bandwidth" version = "0.1.0" dependencies = [ + "cosmwasm-schema", "cosmwasm-std", "cosmwasm-storage", "cw-controllers", "cw-storage-plus", "nym-coconut-bandwidth-contract-common", "nym-multisig-contract-common", - "schemars", "serde", "thiserror", ] @@ -1037,16 +1038,17 @@ dependencies = [ name = "nym-coconut-bandwidth-contract-common" version = "0.1.0" dependencies = [ + "cosmwasm-schema", "cosmwasm-std", + "cw2", "nym-multisig-contract-common", - "schemars", - "serde", ] [[package]] name = "nym-coconut-dkg" version = "0.1.0" dependencies = [ + "cosmwasm-schema", "cosmwasm-std", "cosmwasm-storage", "cw-controllers", @@ -1058,7 +1060,6 @@ dependencies = [ "nym-coconut-dkg-common", "nym-group-contract-common", "rusty-fork", - "schemars", "serde", "thiserror", ] @@ -1067,12 +1068,11 @@ dependencies = [ name = "nym-coconut-dkg-common" version = "0.1.0" dependencies = [ + "cosmwasm-schema", "cosmwasm-std", "cw-utils", "nym-contracts-common", "nym-multisig-contract-common", - "schemars", - "serde", ] [[package]] @@ -1080,6 +1080,7 @@ name = "nym-contracts-common" version = "0.5.0" dependencies = [ "bs58", + "cosmwasm-schema", "cosmwasm-std", "schemars", "serde", @@ -1128,7 +1129,6 @@ dependencies = [ "nym-mixnet-contract-common", "nym-vesting-contract-common", "rand_chacha 0.2.2", - "schemars", "semver", "serde", "thiserror", @@ -1141,13 +1141,15 @@ name = "nym-mixnet-contract-common" version = "0.6.0" dependencies = [ "bs58", + "cosmwasm-schema", "cosmwasm-std", + "cw2", "humantime-serde", "log", "nym-contracts-common", "schemars", "serde", - "serde-json-wasm 0.4.1", + "serde-json-wasm", "serde_repr", "thiserror", "time", @@ -1174,6 +1176,7 @@ version = "0.1.0" dependencies = [ "anyhow", "bs58", + "cosmwasm-schema", "cosmwasm-std", "cw-controllers", "cw-multi-test", @@ -1196,11 +1199,12 @@ dependencies = [ name = "nym-name-service-common" version = "0.1.0" dependencies = [ + "cosmwasm-schema", "cosmwasm-std", "cw-controllers", "cw-utils", + "cw2", "nym-contracts-common", - "schemars", "serde", "thiserror", ] @@ -1218,6 +1222,7 @@ version = "0.1.0" dependencies = [ "anyhow", "bs58", + "cosmwasm-schema", "cosmwasm-std", "cw-controllers", "cw-multi-test", @@ -1239,12 +1244,12 @@ dependencies = [ name = "nym-service-provider-directory-common" version = "0.1.0" dependencies = [ + "cosmwasm-schema", "cosmwasm-std", "cw-controllers", "cw-utils", + "cw2", "nym-contracts-common", - "schemars", - "serde", "thiserror", ] @@ -1262,6 +1267,7 @@ dependencies = [ "base64 0.21.0", "cosmwasm-crypto", "cosmwasm-derive", + "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus", "cw2", @@ -1270,7 +1276,6 @@ dependencies = [ "nym-mixnet-contract-common", "nym-vesting-contract-common", "rand_chacha 0.3.1", - "schemars", "semver", "serde", "serde_json", @@ -1282,11 +1287,13 @@ dependencies = [ name = "nym-vesting-contract-common" version = "0.7.0" dependencies = [ + "cosmwasm-schema", "cosmwasm-std", + "cw2", "nym-contracts-common", "nym-mixnet-contract-common", - "schemars", "serde", + "thiserror", ] [[package]] @@ -1657,18 +1664,9 @@ dependencies = [ [[package]] name = "serde-json-wasm" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479b4dbc401ca13ee8ce902851b834893251404c4f3c65370a49e047a6be09a5" -dependencies = [ - "serde", -] - -[[package]] -name = "serde-json-wasm" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16a62a1fad1e1828b24acac8f2b468971dade7b8c3c2e672bcadefefb1f8c137" +checksum = "a15bee9b04dd165c3f4e142628982ddde884c2022a89e8ddf99c4829bf2c3a58" dependencies = [ "serde", ] @@ -1770,12 +1768,6 @@ dependencies = [ "der", ] -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - [[package]] name = "subtle" version = "2.4.1" @@ -1894,18 +1886,6 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" -[[package]] -name = "uint" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" -dependencies = [ - "byteorder", - "crunchy", - "hex", - "static_assertions", -] - [[package]] name = "unicode-bidi" version = "0.3.12" diff --git a/contracts/Cargo.toml b/contracts/Cargo.toml index 1b20380ad7..0887794260 100644 --- a/contracts/Cargo.toml +++ b/contracts/Cargo.toml @@ -32,17 +32,17 @@ incremental = false overflow-checks = true [workspace.dependencies] -cosmwasm-crypto = "=1.2.5" -cosmwasm-derive = "=1.2.5" -cosmwasm-schema = "=1.2.5" -cosmwasm-std = "=1.2.5" -cosmwasm-storage = "=1.2.5" -cw-controllers = "=1.0.1" +cosmwasm-crypto = "=1.3.0" +cosmwasm-derive = "=1.3.0" +cosmwasm-schema = "=1.3.0" +cosmwasm-std = "=1.3.0" +cosmwasm-storage = "=1.3.0" +cw-controllers = "=1.1.0" cw-multi-test = "=0.16.4" -cw-storage-plus = "=1.0.1" +cw-storage-plus = "=1.1.0" cw-utils = "=1.0.1" -cw2 = "=1.0.1" -cw3 = "=1.0.1" -cw3-fixed-multisig = "=1.0.1" -cw4 = "=1.0.1" -cw20 = "=1.0.1" +cw2 = "=1.1.0" +cw3 = "=1.1.0" +cw3-fixed-multisig = "=1.1.0" +cw4 = "=1.1.0" +cw20 = "=1.1.0" diff --git a/contracts/Makefile b/contracts/Makefile new file mode 100644 index 0000000000..941959bf0c --- /dev/null +++ b/contracts/Makefile @@ -0,0 +1,25 @@ +schema: coconut-bandwidth-schema coconut-dkg-schema mixnet-schema name-service-schema service-provider-directory-schema vesting-schema multisig-schema group-schema + +coconut-bandwidth-schema: + $(MAKE) -C coconut-bandwidth generate-schema + +coconut-dkg-schema: + $(MAKE) -C coconut-dkg generate-schema + +mixnet-schema: + $(MAKE) -C mixnet generate-schema + +name-service-schema: + $(MAKE) -C name-service generate-schema + +service-provider-directory-schema: + $(MAKE) -C service-provider-directory generate-schema + +vesting-schema: + $(MAKE) -C vesting generate-schema + +multisig-schema: + $(MAKE) -C multisig/cw3-flex-multisig generate-schema + +group-schema: + $(MAKE) -C multisig/cw4-group generate-schema diff --git a/contracts/coconut-bandwidth/.cargo/config b/contracts/coconut-bandwidth/.cargo/config new file mode 100644 index 0000000000..2fb2c1afdb --- /dev/null +++ b/contracts/coconut-bandwidth/.cargo/config @@ -0,0 +1,4 @@ +[alias] +wasm = "build --release --lib --target wasm32-unknown-unknown" +unit-test = "test --lib" +schema = "run --bin schema --features=schema-gen" \ No newline at end of file diff --git a/contracts/coconut-bandwidth/Cargo.toml b/contracts/coconut-bandwidth/Cargo.toml index 69bb7088d5..5ed8e5f98b 100644 --- a/contracts/coconut-bandwidth/Cargo.toml +++ b/contracts/coconut-bandwidth/Cargo.toml @@ -5,6 +5,10 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[[bin]] +name = "schema" +required-features = ["schema-gen"] + [lib] crate-type = ["cdylib", "rlib"] @@ -13,10 +17,13 @@ nym-coconut-bandwidth-contract-common = { path = "../../common/cosmwasm-smart-co nym-multisig-contract-common = { path = "../../common/cosmwasm-smart-contracts/multisig-contract" } cosmwasm-std = { workspace = true } +cosmwasm-schema = { workspace = true, optional = true } cosmwasm-storage = { workspace = true } cw-storage-plus = { workspace = true } cw-controllers = { workspace = true } -schemars = "0.8" serde = { version = "1.0.103", default-features = false, features = ["derive"] } thiserror = "1.0.23" + +[features] +schema-gen = ["nym-coconut-bandwidth-contract-common/schema", "cosmwasm-schema"] \ No newline at end of file diff --git a/contracts/coconut-bandwidth/Makefile b/contracts/coconut-bandwidth/Makefile new file mode 100644 index 0000000000..f138e2c879 --- /dev/null +++ b/contracts/coconut-bandwidth/Makefile @@ -0,0 +1,2 @@ +generate-schema: + cargo schema \ No newline at end of file diff --git a/contracts/coconut-bandwidth/schema/nym-coconut-bandwidth.json b/contracts/coconut-bandwidth/schema/nym-coconut-bandwidth.json new file mode 100644 index 0000000000..1b210e85f9 --- /dev/null +++ b/contracts/coconut-bandwidth/schema/nym-coconut-bandwidth.json @@ -0,0 +1,382 @@ +{ + "contract_name": "nym-coconut-bandwidth", + "contract_version": "0.1.0", + "idl_version": "1.0.0", + "instantiate": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "mix_denom", + "multisig_addr", + "pool_addr" + ], + "properties": { + "mix_denom": { + "type": "string" + }, + "multisig_addr": { + "type": "string" + }, + "pool_addr": { + "type": "string" + } + }, + "additionalProperties": false + }, + "execute": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "deposit_funds" + ], + "properties": { + "deposit_funds": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "$ref": "#/definitions/DepositData" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "spend_credential" + ], + "properties": { + "spend_credential": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "$ref": "#/definitions/SpendCredentialData" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "release_funds" + ], + "properties": { + "release_funds": { + "type": "object", + "required": [ + "funds" + ], + "properties": { + "funds": { + "$ref": "#/definitions/Coin" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "DepositData": { + "type": "object", + "required": [ + "deposit_info", + "encryption_key", + "identity_key" + ], + "properties": { + "deposit_info": { + "type": "string" + }, + "encryption_key": { + "type": "string" + }, + "identity_key": { + "type": "string" + } + }, + "additionalProperties": false + }, + "SpendCredentialData": { + "type": "object", + "required": [ + "blinded_serial_number", + "funds", + "gateway_cosmos_address" + ], + "properties": { + "blinded_serial_number": { + "type": "string" + }, + "funds": { + "$ref": "#/definitions/Coin" + }, + "gateway_cosmos_address": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "query": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "get_spent_credential" + ], + "properties": { + "get_spent_credential": { + "type": "object", + "required": [ + "blinded_serial_number" + ], + "properties": { + "blinded_serial_number": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_all_spent_credentials" + ], + "properties": { + "get_all_spent_credentials": { + "type": "object", + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "migrate": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MigrateMsg", + "type": "object", + "additionalProperties": false + }, + "sudo": null, + "responses": { + "get_all_spent_credentials": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedSpendCredentialResponse", + "type": "object", + "required": [ + "per_page", + "spend_credentials" + ], + "properties": { + "per_page": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "spend_credentials": { + "type": "array", + "items": { + "$ref": "#/definitions/SpendCredential" + } + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "SpendCredential": { + "type": "object", + "required": [ + "blinded_serial_number", + "funds", + "gateway_cosmos_address", + "status" + ], + "properties": { + "blinded_serial_number": { + "type": "string" + }, + "funds": { + "$ref": "#/definitions/Coin" + }, + "gateway_cosmos_address": { + "$ref": "#/definitions/Addr" + }, + "status": { + "$ref": "#/definitions/SpendCredentialStatus" + } + }, + "additionalProperties": false + }, + "SpendCredentialStatus": { + "type": "string", + "enum": [ + "in_progress", + "spent" + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_spent_credential": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "SpendCredentialResponse", + "type": "object", + "properties": { + "spend_credential": { + "anyOf": [ + { + "$ref": "#/definitions/SpendCredential" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "SpendCredential": { + "type": "object", + "required": [ + "blinded_serial_number", + "funds", + "gateway_cosmos_address", + "status" + ], + "properties": { + "blinded_serial_number": { + "type": "string" + }, + "funds": { + "$ref": "#/definitions/Coin" + }, + "gateway_cosmos_address": { + "$ref": "#/definitions/Addr" + }, + "status": { + "$ref": "#/definitions/SpendCredentialStatus" + } + }, + "additionalProperties": false + }, + "SpendCredentialStatus": { + "type": "string", + "enum": [ + "in_progress", + "spent" + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + } + } +} diff --git a/contracts/coconut-bandwidth/schema/raw/execute.json b/contracts/coconut-bandwidth/schema/raw/execute.json new file mode 100644 index 0000000000..027b423f7a --- /dev/null +++ b/contracts/coconut-bandwidth/schema/raw/execute.json @@ -0,0 +1,130 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "deposit_funds" + ], + "properties": { + "deposit_funds": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "$ref": "#/definitions/DepositData" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "spend_credential" + ], + "properties": { + "spend_credential": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "$ref": "#/definitions/SpendCredentialData" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "release_funds" + ], + "properties": { + "release_funds": { + "type": "object", + "required": [ + "funds" + ], + "properties": { + "funds": { + "$ref": "#/definitions/Coin" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "DepositData": { + "type": "object", + "required": [ + "deposit_info", + "encryption_key", + "identity_key" + ], + "properties": { + "deposit_info": { + "type": "string" + }, + "encryption_key": { + "type": "string" + }, + "identity_key": { + "type": "string" + } + }, + "additionalProperties": false + }, + "SpendCredentialData": { + "type": "object", + "required": [ + "blinded_serial_number", + "funds", + "gateway_cosmos_address" + ], + "properties": { + "blinded_serial_number": { + "type": "string" + }, + "funds": { + "$ref": "#/definitions/Coin" + }, + "gateway_cosmos_address": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/coconut-bandwidth/schema/raw/instantiate.json b/contracts/coconut-bandwidth/schema/raw/instantiate.json new file mode 100644 index 0000000000..172dc76d79 --- /dev/null +++ b/contracts/coconut-bandwidth/schema/raw/instantiate.json @@ -0,0 +1,22 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "mix_denom", + "multisig_addr", + "pool_addr" + ], + "properties": { + "mix_denom": { + "type": "string" + }, + "multisig_addr": { + "type": "string" + }, + "pool_addr": { + "type": "string" + } + }, + "additionalProperties": false +} diff --git a/contracts/coconut-bandwidth/schema/raw/migrate.json b/contracts/coconut-bandwidth/schema/raw/migrate.json new file mode 100644 index 0000000000..7fbe8c5708 --- /dev/null +++ b/contracts/coconut-bandwidth/schema/raw/migrate.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MigrateMsg", + "type": "object", + "additionalProperties": false +} diff --git a/contracts/coconut-bandwidth/schema/raw/query.json b/contracts/coconut-bandwidth/schema/raw/query.json new file mode 100644 index 0000000000..afdfae331d --- /dev/null +++ b/contracts/coconut-bandwidth/schema/raw/query.json @@ -0,0 +1,56 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "get_spent_credential" + ], + "properties": { + "get_spent_credential": { + "type": "object", + "required": [ + "blinded_serial_number" + ], + "properties": { + "blinded_serial_number": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_all_spent_credentials" + ], + "properties": { + "get_all_spent_credentials": { + "type": "object", + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] +} diff --git a/contracts/coconut-bandwidth/schema/raw/response_to_get_all_spent_credentials.json b/contracts/coconut-bandwidth/schema/raw/response_to_get_all_spent_credentials.json new file mode 100644 index 0000000000..733da87081 --- /dev/null +++ b/contracts/coconut-bandwidth/schema/raw/response_to_get_all_spent_credentials.json @@ -0,0 +1,86 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedSpendCredentialResponse", + "type": "object", + "required": [ + "per_page", + "spend_credentials" + ], + "properties": { + "per_page": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "spend_credentials": { + "type": "array", + "items": { + "$ref": "#/definitions/SpendCredential" + } + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "SpendCredential": { + "type": "object", + "required": [ + "blinded_serial_number", + "funds", + "gateway_cosmos_address", + "status" + ], + "properties": { + "blinded_serial_number": { + "type": "string" + }, + "funds": { + "$ref": "#/definitions/Coin" + }, + "gateway_cosmos_address": { + "$ref": "#/definitions/Addr" + }, + "status": { + "$ref": "#/definitions/SpendCredentialStatus" + } + }, + "additionalProperties": false + }, + "SpendCredentialStatus": { + "type": "string", + "enum": [ + "in_progress", + "spent" + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/coconut-bandwidth/schema/raw/response_to_get_spent_credential.json b/contracts/coconut-bandwidth/schema/raw/response_to_get_spent_credential.json new file mode 100644 index 0000000000..9af4def85b --- /dev/null +++ b/contracts/coconut-bandwidth/schema/raw/response_to_get_spent_credential.json @@ -0,0 +1,74 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "SpendCredentialResponse", + "type": "object", + "properties": { + "spend_credential": { + "anyOf": [ + { + "$ref": "#/definitions/SpendCredential" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "SpendCredential": { + "type": "object", + "required": [ + "blinded_serial_number", + "funds", + "gateway_cosmos_address", + "status" + ], + "properties": { + "blinded_serial_number": { + "type": "string" + }, + "funds": { + "$ref": "#/definitions/Coin" + }, + "gateway_cosmos_address": { + "$ref": "#/definitions/Addr" + }, + "status": { + "$ref": "#/definitions/SpendCredentialStatus" + } + }, + "additionalProperties": false + }, + "SpendCredentialStatus": { + "type": "string", + "enum": [ + "in_progress", + "spent" + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/coconut-bandwidth/src/bin/schema.rs b/contracts/coconut-bandwidth/src/bin/schema.rs new file mode 100644 index 0000000000..4956eb33f4 --- /dev/null +++ b/contracts/coconut-bandwidth/src/bin/schema.rs @@ -0,0 +1,16 @@ +// Copyright 2023 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use cosmwasm_schema::write_api; +use nym_coconut_bandwidth_contract_common::msg::{ + ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg, +}; + +fn main() { + write_api! { + instantiate: InstantiateMsg, + query: QueryMsg, + execute: ExecuteMsg, + migrate: MigrateMsg, + } +} diff --git a/contracts/coconut-bandwidth/src/state.rs b/contracts/coconut-bandwidth/src/state.rs index 74b969341c..855d9fa07a 100644 --- a/contracts/coconut-bandwidth/src/state.rs +++ b/contracts/coconut-bandwidth/src/state.rs @@ -4,12 +4,11 @@ use cosmwasm_std::Addr; use cw_controllers::Admin; use cw_storage_plus::Item; -use schemars::JsonSchema; use serde::{Deserialize, Serialize}; pub const ADMIN: Admin = Admin::new("admin"); -#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug)] +#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug)] pub struct Config { pub multisig_addr: Addr, pub pool_addr: Addr, diff --git a/contracts/coconut-dkg/.cargo/config b/contracts/coconut-dkg/.cargo/config new file mode 100644 index 0000000000..2f698e22b3 --- /dev/null +++ b/contracts/coconut-dkg/.cargo/config @@ -0,0 +1,5 @@ +[alias] +wasm = "build --release --lib --target wasm32-unknown-unknown" +wasm-debug = "build --target wasm32-unknown-unknown" +unit-test = "test --lib" +schema = "run --bin schema --features=schema-gen" \ No newline at end of file diff --git a/contracts/coconut-dkg/Cargo.toml b/contracts/coconut-dkg/Cargo.toml index f877df138d..794c1f3a0f 100644 --- a/contracts/coconut-dkg/Cargo.toml +++ b/contracts/coconut-dkg/Cargo.toml @@ -5,19 +5,22 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[[bin]] +name = "schema" +required-features = ["schema-gen"] + [lib] crate-type = ["cdylib", "rlib"] [dependencies] nym-coconut-dkg-common = { path = "../../common/cosmwasm-smart-contracts/coconut-dkg" } +cosmwasm-schema = { workspace = true, optional = true } cosmwasm-std = { workspace = true } cosmwasm-storage = { workspace = true } cw-storage-plus = { workspace = true } cw-controllers = { workspace = true } cw4 = { workspace = true } - -schemars = "0.8" serde = { version = "1.0.103", default-features = false, features = ["derive"] } thiserror = "1.0.23" @@ -27,3 +30,7 @@ cw4-group = { path = "../multisig/cw4-group" } nym-group-contract-common = { path = "../../common/cosmwasm-smart-contracts/group-contract" } lazy_static = "1.4" rusty-fork = "0.3" + +[features] +schema-gen = ["nym-coconut-dkg-common/schema", "cosmwasm-schema"] + diff --git a/contracts/coconut-dkg/Makefile b/contracts/coconut-dkg/Makefile new file mode 100644 index 0000000000..f138e2c879 --- /dev/null +++ b/contracts/coconut-dkg/Makefile @@ -0,0 +1,2 @@ +generate-schema: + cargo schema \ No newline at end of file diff --git a/contracts/coconut-dkg/schema/nym-coconut-dkg.json b/contracts/coconut-dkg/schema/nym-coconut-dkg.json new file mode 100644 index 0000000000..035f1bfe8f --- /dev/null +++ b/contracts/coconut-dkg/schema/nym-coconut-dkg.json @@ -0,0 +1,1023 @@ +{ + "contract_name": "nym-coconut-dkg", + "contract_version": "0.1.0", + "idl_version": "1.0.0", + "instantiate": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "group_addr", + "mix_denom", + "multisig_addr" + ], + "properties": { + "group_addr": { + "type": "string" + }, + "mix_denom": { + "type": "string" + }, + "multisig_addr": { + "type": "string" + }, + "time_configuration": { + "anyOf": [ + { + "$ref": "#/definitions/TimeConfiguration" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "TimeConfiguration": { + "type": "object", + "required": [ + "dealing_exchange_time_secs", + "in_progress_time_secs", + "public_key_submission_time_secs", + "verification_key_finalization_time_secs", + "verification_key_submission_time_secs", + "verification_key_validation_time_secs" + ], + "properties": { + "dealing_exchange_time_secs": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "in_progress_time_secs": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "public_key_submission_time_secs": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "verification_key_finalization_time_secs": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "verification_key_submission_time_secs": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "verification_key_validation_time_secs": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } + }, + "execute": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "register_dealer" + ], + "properties": { + "register_dealer": { + "type": "object", + "required": [ + "announce_address", + "bte_key_with_proof", + "resharing" + ], + "properties": { + "announce_address": { + "type": "string" + }, + "bte_key_with_proof": { + "type": "string" + }, + "resharing": { + "type": "boolean" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "commit_dealing" + ], + "properties": { + "commit_dealing": { + "type": "object", + "required": [ + "dealing_bytes", + "resharing" + ], + "properties": { + "dealing_bytes": { + "$ref": "#/definitions/ContractSafeBytes" + }, + "resharing": { + "type": "boolean" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "commit_verification_key_share" + ], + "properties": { + "commit_verification_key_share": { + "type": "object", + "required": [ + "resharing", + "share" + ], + "properties": { + "resharing": { + "type": "boolean" + }, + "share": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "verify_verification_key_share" + ], + "properties": { + "verify_verification_key_share": { + "type": "object", + "required": [ + "owner", + "resharing" + ], + "properties": { + "owner": { + "$ref": "#/definitions/Addr" + }, + "resharing": { + "type": "boolean" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "surpassed_threshold" + ], + "properties": { + "surpassed_threshold": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "advance_epoch_state" + ], + "properties": { + "advance_epoch_state": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "ContractSafeBytes": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + } + } + }, + "query": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "get_current_epoch_state" + ], + "properties": { + "get_current_epoch_state": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_current_epoch_threshold" + ], + "properties": { + "get_current_epoch_threshold": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_initial_dealers" + ], + "properties": { + "get_initial_dealers": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_dealer_details" + ], + "properties": { + "get_dealer_details": { + "type": "object", + "required": [ + "dealer_address" + ], + "properties": { + "dealer_address": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_current_dealers" + ], + "properties": { + "get_current_dealers": { + "type": "object", + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_past_dealers" + ], + "properties": { + "get_past_dealers": { + "type": "object", + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_dealing" + ], + "properties": { + "get_dealing": { + "type": "object", + "required": [ + "idx" + ], + "properties": { + "idx": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_verification_keys" + ], + "properties": { + "get_verification_keys": { + "type": "object", + "required": [ + "epoch_id" + ], + "properties": { + "epoch_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "migrate": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MigrateMsg", + "type": "object", + "additionalProperties": false + }, + "sudo": null, + "responses": { + "get_current_dealers": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedDealerResponse", + "type": "object", + "required": [ + "dealers", + "per_page" + ], + "properties": { + "dealers": { + "type": "array", + "items": { + "$ref": "#/definitions/DealerDetails" + } + }, + "per_page": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "DealerDetails": { + "type": "object", + "required": [ + "address", + "announce_address", + "assigned_index", + "bte_public_key_with_proof" + ], + "properties": { + "address": { + "$ref": "#/definitions/Addr" + }, + "announce_address": { + "type": "string" + }, + "assigned_index": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "bte_public_key_with_proof": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "get_current_epoch_state": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Epoch", + "type": "object", + "required": [ + "epoch_id", + "finish_timestamp", + "state", + "time_configuration" + ], + "properties": { + "epoch_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "finish_timestamp": { + "$ref": "#/definitions/Timestamp" + }, + "state": { + "$ref": "#/definitions/EpochState" + }, + "time_configuration": { + "$ref": "#/definitions/TimeConfiguration" + } + }, + "additionalProperties": false, + "definitions": { + "EpochState": { + "oneOf": [ + { + "type": "string", + "enum": [ + "in_progress" + ] + }, + { + "type": "object", + "required": [ + "public_key_submission" + ], + "properties": { + "public_key_submission": { + "type": "object", + "required": [ + "resharing" + ], + "properties": { + "resharing": { + "type": "boolean" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "dealing_exchange" + ], + "properties": { + "dealing_exchange": { + "type": "object", + "required": [ + "resharing" + ], + "properties": { + "resharing": { + "type": "boolean" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "verification_key_submission" + ], + "properties": { + "verification_key_submission": { + "type": "object", + "required": [ + "resharing" + ], + "properties": { + "resharing": { + "type": "boolean" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "verification_key_validation" + ], + "properties": { + "verification_key_validation": { + "type": "object", + "required": [ + "resharing" + ], + "properties": { + "resharing": { + "type": "boolean" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "verification_key_finalization" + ], + "properties": { + "verification_key_finalization": { + "type": "object", + "required": [ + "resharing" + ], + "properties": { + "resharing": { + "type": "boolean" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "TimeConfiguration": { + "type": "object", + "required": [ + "dealing_exchange_time_secs", + "in_progress_time_secs", + "public_key_submission_time_secs", + "verification_key_finalization_time_secs", + "verification_key_submission_time_secs", + "verification_key_validation_time_secs" + ], + "properties": { + "dealing_exchange_time_secs": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "in_progress_time_secs": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "public_key_submission_time_secs": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "verification_key_finalization_time_secs": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "verification_key_submission_time_secs": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "verification_key_validation_time_secs": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } + }, + "get_current_epoch_threshold": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "uint64", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "get_dealer_details": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "DealerDetailsResponse", + "type": "object", + "required": [ + "dealer_type" + ], + "properties": { + "dealer_type": { + "$ref": "#/definitions/DealerType" + }, + "details": { + "anyOf": [ + { + "$ref": "#/definitions/DealerDetails" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "DealerDetails": { + "type": "object", + "required": [ + "address", + "announce_address", + "assigned_index", + "bte_public_key_with_proof" + ], + "properties": { + "address": { + "$ref": "#/definitions/Addr" + }, + "announce_address": { + "type": "string" + }, + "assigned_index": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "bte_public_key_with_proof": { + "type": "string" + } + }, + "additionalProperties": false + }, + "DealerType": { + "type": "string", + "enum": [ + "current", + "past", + "unknown" + ] + } + } + }, + "get_dealing": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedDealingsResponse", + "type": "object", + "required": [ + "dealings", + "per_page" + ], + "properties": { + "dealings": { + "type": "array", + "items": { + "$ref": "#/definitions/ContractDealing" + } + }, + "per_page": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "ContractDealing": { + "type": "object", + "required": [ + "dealer", + "dealing" + ], + "properties": { + "dealer": { + "$ref": "#/definitions/Addr" + }, + "dealing": { + "$ref": "#/definitions/ContractSafeBytes" + } + }, + "additionalProperties": false + }, + "ContractSafeBytes": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + } + } + }, + "get_initial_dealers": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Nullable_InitialReplacementData", + "anyOf": [ + { + "$ref": "#/definitions/InitialReplacementData" + }, + { + "type": "null" + } + ], + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "InitialReplacementData": { + "type": "object", + "required": [ + "initial_dealers", + "initial_height" + ], + "properties": { + "initial_dealers": { + "type": "array", + "items": { + "$ref": "#/definitions/Addr" + } + }, + "initial_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } + }, + "get_past_dealers": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedDealerResponse", + "type": "object", + "required": [ + "dealers", + "per_page" + ], + "properties": { + "dealers": { + "type": "array", + "items": { + "$ref": "#/definitions/DealerDetails" + } + }, + "per_page": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "DealerDetails": { + "type": "object", + "required": [ + "address", + "announce_address", + "assigned_index", + "bte_public_key_with_proof" + ], + "properties": { + "address": { + "$ref": "#/definitions/Addr" + }, + "announce_address": { + "type": "string" + }, + "assigned_index": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "bte_public_key_with_proof": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "get_verification_keys": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedVKSharesResponse", + "type": "object", + "required": [ + "per_page", + "shares" + ], + "properties": { + "per_page": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "shares": { + "type": "array", + "items": { + "$ref": "#/definitions/ContractVKShare" + } + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "ContractVKShare": { + "type": "object", + "required": [ + "announce_address", + "epoch_id", + "node_index", + "owner", + "share", + "verified" + ], + "properties": { + "announce_address": { + "type": "string" + }, + "epoch_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "node_index": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "owner": { + "$ref": "#/definitions/Addr" + }, + "share": { + "type": "string" + }, + "verified": { + "type": "boolean" + } + }, + "additionalProperties": false + } + } + } + } +} diff --git a/contracts/coconut-dkg/schema/raw/execute.json b/contracts/coconut-dkg/schema/raw/execute.json new file mode 100644 index 0000000000..5e87d1dc07 --- /dev/null +++ b/contracts/coconut-dkg/schema/raw/execute.json @@ -0,0 +1,150 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "register_dealer" + ], + "properties": { + "register_dealer": { + "type": "object", + "required": [ + "announce_address", + "bte_key_with_proof", + "resharing" + ], + "properties": { + "announce_address": { + "type": "string" + }, + "bte_key_with_proof": { + "type": "string" + }, + "resharing": { + "type": "boolean" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "commit_dealing" + ], + "properties": { + "commit_dealing": { + "type": "object", + "required": [ + "dealing_bytes", + "resharing" + ], + "properties": { + "dealing_bytes": { + "$ref": "#/definitions/ContractSafeBytes" + }, + "resharing": { + "type": "boolean" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "commit_verification_key_share" + ], + "properties": { + "commit_verification_key_share": { + "type": "object", + "required": [ + "resharing", + "share" + ], + "properties": { + "resharing": { + "type": "boolean" + }, + "share": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "verify_verification_key_share" + ], + "properties": { + "verify_verification_key_share": { + "type": "object", + "required": [ + "owner", + "resharing" + ], + "properties": { + "owner": { + "$ref": "#/definitions/Addr" + }, + "resharing": { + "type": "boolean" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "surpassed_threshold" + ], + "properties": { + "surpassed_threshold": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "advance_epoch_state" + ], + "properties": { + "advance_epoch_state": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "ContractSafeBytes": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + } + } +} diff --git a/contracts/coconut-dkg/schema/raw/instantiate.json b/contracts/coconut-dkg/schema/raw/instantiate.json new file mode 100644 index 0000000000..af468be6c6 --- /dev/null +++ b/contracts/coconut-dkg/schema/raw/instantiate.json @@ -0,0 +1,78 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "group_addr", + "mix_denom", + "multisig_addr" + ], + "properties": { + "group_addr": { + "type": "string" + }, + "mix_denom": { + "type": "string" + }, + "multisig_addr": { + "type": "string" + }, + "time_configuration": { + "anyOf": [ + { + "$ref": "#/definitions/TimeConfiguration" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "TimeConfiguration": { + "type": "object", + "required": [ + "dealing_exchange_time_secs", + "in_progress_time_secs", + "public_key_submission_time_secs", + "verification_key_finalization_time_secs", + "verification_key_submission_time_secs", + "verification_key_validation_time_secs" + ], + "properties": { + "dealing_exchange_time_secs": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "in_progress_time_secs": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "public_key_submission_time_secs": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "verification_key_finalization_time_secs": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "verification_key_submission_time_secs": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "verification_key_validation_time_secs": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/coconut-dkg/schema/raw/migrate.json b/contracts/coconut-dkg/schema/raw/migrate.json new file mode 100644 index 0000000000..7fbe8c5708 --- /dev/null +++ b/contracts/coconut-dkg/schema/raw/migrate.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MigrateMsg", + "type": "object", + "additionalProperties": false +} diff --git a/contracts/coconut-dkg/schema/raw/query.json b/contracts/coconut-dkg/schema/raw/query.json new file mode 100644 index 0000000000..c165069598 --- /dev/null +++ b/contracts/coconut-dkg/schema/raw/query.json @@ -0,0 +1,198 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "get_current_epoch_state" + ], + "properties": { + "get_current_epoch_state": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_current_epoch_threshold" + ], + "properties": { + "get_current_epoch_threshold": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_initial_dealers" + ], + "properties": { + "get_initial_dealers": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_dealer_details" + ], + "properties": { + "get_dealer_details": { + "type": "object", + "required": [ + "dealer_address" + ], + "properties": { + "dealer_address": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_current_dealers" + ], + "properties": { + "get_current_dealers": { + "type": "object", + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_past_dealers" + ], + "properties": { + "get_past_dealers": { + "type": "object", + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_dealing" + ], + "properties": { + "get_dealing": { + "type": "object", + "required": [ + "idx" + ], + "properties": { + "idx": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_verification_keys" + ], + "properties": { + "get_verification_keys": { + "type": "object", + "required": [ + "epoch_id" + ], + "properties": { + "epoch_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] +} diff --git a/contracts/coconut-dkg/schema/raw/response_to_get_current_dealers.json b/contracts/coconut-dkg/schema/raw/response_to_get_current_dealers.json new file mode 100644 index 0000000000..e08ceedf09 --- /dev/null +++ b/contracts/coconut-dkg/schema/raw/response_to_get_current_dealers.json @@ -0,0 +1,66 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedDealerResponse", + "type": "object", + "required": [ + "dealers", + "per_page" + ], + "properties": { + "dealers": { + "type": "array", + "items": { + "$ref": "#/definitions/DealerDetails" + } + }, + "per_page": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "DealerDetails": { + "type": "object", + "required": [ + "address", + "announce_address", + "assigned_index", + "bte_public_key_with_proof" + ], + "properties": { + "address": { + "$ref": "#/definitions/Addr" + }, + "announce_address": { + "type": "string" + }, + "assigned_index": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "bte_public_key_with_proof": { + "type": "string" + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/coconut-dkg/schema/raw/response_to_get_current_epoch_state.json b/contracts/coconut-dkg/schema/raw/response_to_get_current_epoch_state.json new file mode 100644 index 0000000000..8af981b9db --- /dev/null +++ b/contracts/coconut-dkg/schema/raw/response_to_get_current_epoch_state.json @@ -0,0 +1,201 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Epoch", + "type": "object", + "required": [ + "epoch_id", + "finish_timestamp", + "state", + "time_configuration" + ], + "properties": { + "epoch_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "finish_timestamp": { + "$ref": "#/definitions/Timestamp" + }, + "state": { + "$ref": "#/definitions/EpochState" + }, + "time_configuration": { + "$ref": "#/definitions/TimeConfiguration" + } + }, + "additionalProperties": false, + "definitions": { + "EpochState": { + "oneOf": [ + { + "type": "string", + "enum": [ + "in_progress" + ] + }, + { + "type": "object", + "required": [ + "public_key_submission" + ], + "properties": { + "public_key_submission": { + "type": "object", + "required": [ + "resharing" + ], + "properties": { + "resharing": { + "type": "boolean" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "dealing_exchange" + ], + "properties": { + "dealing_exchange": { + "type": "object", + "required": [ + "resharing" + ], + "properties": { + "resharing": { + "type": "boolean" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "verification_key_submission" + ], + "properties": { + "verification_key_submission": { + "type": "object", + "required": [ + "resharing" + ], + "properties": { + "resharing": { + "type": "boolean" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "verification_key_validation" + ], + "properties": { + "verification_key_validation": { + "type": "object", + "required": [ + "resharing" + ], + "properties": { + "resharing": { + "type": "boolean" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "verification_key_finalization" + ], + "properties": { + "verification_key_finalization": { + "type": "object", + "required": [ + "resharing" + ], + "properties": { + "resharing": { + "type": "boolean" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "TimeConfiguration": { + "type": "object", + "required": [ + "dealing_exchange_time_secs", + "in_progress_time_secs", + "public_key_submission_time_secs", + "verification_key_finalization_time_secs", + "verification_key_submission_time_secs", + "verification_key_validation_time_secs" + ], + "properties": { + "dealing_exchange_time_secs": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "in_progress_time_secs": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "public_key_submission_time_secs": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "verification_key_finalization_time_secs": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "verification_key_submission_time_secs": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "verification_key_validation_time_secs": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/coconut-dkg/schema/raw/response_to_get_current_epoch_threshold.json b/contracts/coconut-dkg/schema/raw/response_to_get_current_epoch_threshold.json new file mode 100644 index 0000000000..7b729a7b96 --- /dev/null +++ b/contracts/coconut-dkg/schema/raw/response_to_get_current_epoch_threshold.json @@ -0,0 +1,7 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "uint64", + "type": "integer", + "format": "uint64", + "minimum": 0.0 +} diff --git a/contracts/coconut-dkg/schema/raw/response_to_get_dealer_details.json b/contracts/coconut-dkg/schema/raw/response_to_get_dealer_details.json new file mode 100644 index 0000000000..474a247a99 --- /dev/null +++ b/contracts/coconut-dkg/schema/raw/response_to_get_dealer_details.json @@ -0,0 +1,64 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "DealerDetailsResponse", + "type": "object", + "required": [ + "dealer_type" + ], + "properties": { + "dealer_type": { + "$ref": "#/definitions/DealerType" + }, + "details": { + "anyOf": [ + { + "$ref": "#/definitions/DealerDetails" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "DealerDetails": { + "type": "object", + "required": [ + "address", + "announce_address", + "assigned_index", + "bte_public_key_with_proof" + ], + "properties": { + "address": { + "$ref": "#/definitions/Addr" + }, + "announce_address": { + "type": "string" + }, + "assigned_index": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "bte_public_key_with_proof": { + "type": "string" + } + }, + "additionalProperties": false + }, + "DealerType": { + "type": "string", + "enum": [ + "current", + "past", + "unknown" + ] + } + } +} diff --git a/contracts/coconut-dkg/schema/raw/response_to_get_dealing.json b/contracts/coconut-dkg/schema/raw/response_to_get_dealing.json new file mode 100644 index 0000000000..8fc350b74c --- /dev/null +++ b/contracts/coconut-dkg/schema/raw/response_to_get_dealing.json @@ -0,0 +1,64 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedDealingsResponse", + "type": "object", + "required": [ + "dealings", + "per_page" + ], + "properties": { + "dealings": { + "type": "array", + "items": { + "$ref": "#/definitions/ContractDealing" + } + }, + "per_page": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "ContractDealing": { + "type": "object", + "required": [ + "dealer", + "dealing" + ], + "properties": { + "dealer": { + "$ref": "#/definitions/Addr" + }, + "dealing": { + "$ref": "#/definitions/ContractSafeBytes" + } + }, + "additionalProperties": false + }, + "ContractSafeBytes": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + } + } +} diff --git a/contracts/coconut-dkg/schema/raw/response_to_get_initial_dealers.json b/contracts/coconut-dkg/schema/raw/response_to_get_initial_dealers.json new file mode 100644 index 0000000000..cd8c3df351 --- /dev/null +++ b/contracts/coconut-dkg/schema/raw/response_to_get_initial_dealers.json @@ -0,0 +1,39 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Nullable_InitialReplacementData", + "anyOf": [ + { + "$ref": "#/definitions/InitialReplacementData" + }, + { + "type": "null" + } + ], + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "InitialReplacementData": { + "type": "object", + "required": [ + "initial_dealers", + "initial_height" + ], + "properties": { + "initial_dealers": { + "type": "array", + "items": { + "$ref": "#/definitions/Addr" + } + }, + "initial_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/coconut-dkg/schema/raw/response_to_get_past_dealers.json b/contracts/coconut-dkg/schema/raw/response_to_get_past_dealers.json new file mode 100644 index 0000000000..e08ceedf09 --- /dev/null +++ b/contracts/coconut-dkg/schema/raw/response_to_get_past_dealers.json @@ -0,0 +1,66 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedDealerResponse", + "type": "object", + "required": [ + "dealers", + "per_page" + ], + "properties": { + "dealers": { + "type": "array", + "items": { + "$ref": "#/definitions/DealerDetails" + } + }, + "per_page": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "DealerDetails": { + "type": "object", + "required": [ + "address", + "announce_address", + "assigned_index", + "bte_public_key_with_proof" + ], + "properties": { + "address": { + "$ref": "#/definitions/Addr" + }, + "announce_address": { + "type": "string" + }, + "assigned_index": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "bte_public_key_with_proof": { + "type": "string" + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/coconut-dkg/schema/raw/response_to_get_verification_keys.json b/contracts/coconut-dkg/schema/raw/response_to_get_verification_keys.json new file mode 100644 index 0000000000..d0fc6e1deb --- /dev/null +++ b/contracts/coconut-dkg/schema/raw/response_to_get_verification_keys.json @@ -0,0 +1,76 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedVKSharesResponse", + "type": "object", + "required": [ + "per_page", + "shares" + ], + "properties": { + "per_page": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "shares": { + "type": "array", + "items": { + "$ref": "#/definitions/ContractVKShare" + } + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "ContractVKShare": { + "type": "object", + "required": [ + "announce_address", + "epoch_id", + "node_index", + "owner", + "share", + "verified" + ], + "properties": { + "announce_address": { + "type": "string" + }, + "epoch_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "node_index": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "owner": { + "$ref": "#/definitions/Addr" + }, + "share": { + "type": "string" + }, + "verified": { + "type": "boolean" + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/coconut-dkg/src/bin/schema.rs b/contracts/coconut-dkg/src/bin/schema.rs new file mode 100644 index 0000000000..7a66216cfa --- /dev/null +++ b/contracts/coconut-dkg/src/bin/schema.rs @@ -0,0 +1,14 @@ +// Copyright 2023 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use cosmwasm_schema::write_api; +use nym_coconut_dkg_common::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}; + +fn main() { + write_api! { + instantiate: InstantiateMsg, + query: QueryMsg, + execute: ExecuteMsg, + migrate: MigrateMsg, + } +} diff --git a/contracts/coconut-dkg/src/state/mod.rs b/contracts/coconut-dkg/src/state/mod.rs index 533bd98a0a..90abdc3711 100644 --- a/contracts/coconut-dkg/src/state/mod.rs +++ b/contracts/coconut-dkg/src/state/mod.rs @@ -5,14 +5,13 @@ use cosmwasm_std::Addr; use cw4::Cw4Contract; use cw_controllers::Admin; use cw_storage_plus::Item; -use schemars::JsonSchema; use serde::{Deserialize, Serialize}; // unique items pub const STATE: Item = Item::new("state"); pub const MULTISIG: Admin = Admin::new("multisig"); -#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)] +#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)] pub struct State { pub mix_denom: String, pub multisig_addr: Addr, diff --git a/contracts/mixnet-vesting-integration-tests/src/decrease_mixnode_pledge.rs b/contracts/mixnet-vesting-integration-tests/src/decrease_mixnode_pledge.rs index c2ec5bd71b..a9930e23f7 100644 --- a/contracts/mixnet-vesting-integration-tests/src/decrease_mixnode_pledge.rs +++ b/contracts/mixnet-vesting-integration-tests/src/decrease_mixnode_pledge.rs @@ -9,8 +9,7 @@ use nym_contracts_common::Percent; use nym_mixnet_contract_common::error::MixnetContractError; use nym_mixnet_contract_common::{ContractStateParams, MixNodeCostParams}; use nym_mixnet_contract_common::{MixOwnershipResponse, QueryMsg as MixnetQueryMsg}; -use nym_vesting_contract_common::ExecuteMsg as VestingExecuteMsg; -use vesting_contract::errors::ContractError as VestingContractError; +use nym_vesting_contract_common::{ExecuteMsg as VestingExecuteMsg, VestingContractError}; #[test] fn decrease_mixnode_pledge_from_vesting_account_with_minimum_pledge() { diff --git a/contracts/mixnet/.cargo/config b/contracts/mixnet/.cargo/config index 336b618a17..2fb2c1afdb 100644 --- a/contracts/mixnet/.cargo/config +++ b/contracts/mixnet/.cargo/config @@ -1,4 +1,4 @@ [alias] -wasm = "build --release --target wasm32-unknown-unknown" +wasm = "build --release --lib --target wasm32-unknown-unknown" unit-test = "test --lib" -schema = "run --example schema" +schema = "run --bin schema --features=schema-gen" \ No newline at end of file diff --git a/contracts/mixnet/Cargo.toml b/contracts/mixnet/Cargo.toml index acdbfd4617..999ef93c8b 100644 --- a/contracts/mixnet/Cargo.toml +++ b/contracts/mixnet/Cargo.toml @@ -17,6 +17,10 @@ exclude = [ # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[[bin]] +name = "schema" +required-features = ["schema-gen"] + [lib] name = "mixnet_contract" crate-type = ["cdylib", "rlib"] @@ -26,6 +30,7 @@ mixnet-contract-common = { path = "../../common/cosmwasm-smart-contracts/mixnet- vesting-contract-common = { path = "../../common/cosmwasm-smart-contracts/vesting-contract", package = "nym-vesting-contract-common", version = "0.7.0" } nym-contracts-common = { path = "../../common/cosmwasm-smart-contracts/contracts-common", version = "0.5.0" } +cosmwasm-schema = { workspace = true, optional = true } cosmwasm-std = { workspace = true } cosmwasm-storage = { workspace = true } cosmwasm-derive = { workspace = true } @@ -33,14 +38,12 @@ cw2 = { workspace = true } cw-storage-plus = { workspace = true } bs58 = "0.4.0" -schemars = "0.8" serde = { version = "1.0.103", default-features = false, features = ["derive"] } thiserror = { version = "1.0.23" } time = { version = "0.3", features = ["macros"] } semver = { version = "1.0.16", default-features = false } [dev-dependencies] -cosmwasm-schema = { workspace = true } rand_chacha = "0.2" nym-crypto = { path = "../../common/crypto", features = ["asymmetric", "rand"] } @@ -50,6 +53,9 @@ vergen = { version = "=7.4.3", default-features = false, features = ["build", "g [features] default = [] contract-testing = ["mixnet-contract-common/contract-testing"] +schema-gen = ["mixnet-contract-common/schema", "cosmwasm-schema"] [profile.release] overflow-checks = true + + diff --git a/contracts/mixnet/Makefile b/contracts/mixnet/Makefile index 7741d05913..01452be701 100644 --- a/contracts/mixnet/Makefile +++ b/contracts/mixnet/Makefile @@ -3,3 +3,6 @@ opt: wasm wasm: RUSTFLAGS='-C link-arg=-s' cargo build --release --target wasm32-unknown-unknown + +generate-schema: + cargo schema \ No newline at end of file diff --git a/contracts/mixnet/examples/schema.rs b/contracts/mixnet/examples/schema.rs deleted file mode 100644 index 46e555aff3..0000000000 --- a/contracts/mixnet/examples/schema.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2021 - Nym Technologies SA -// SPDX-License-Identifier: Apache-2.0 - -use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; -use mixnet_contract_common::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}; -use std::env::current_dir; -use std::fs::create_dir_all; - -fn main() { - let mut out_dir = current_dir().unwrap(); - out_dir.push("schema"); - create_dir_all(&out_dir).unwrap(); - remove_schemas(&out_dir).unwrap(); - - export_schema(&schema_for!(InstantiateMsg), &out_dir); - export_schema(&schema_for!(ExecuteMsg), &out_dir); - export_schema(&schema_for!(QueryMsg), &out_dir); - export_schema(&schema_for!(MigrateMsg), &out_dir); -} diff --git a/contracts/mixnet/schema/nym-mixnet-contract.json b/contracts/mixnet/schema/nym-mixnet-contract.json new file mode 100644 index 0000000000..22cf2a118d --- /dev/null +++ b/contracts/mixnet/schema/nym-mixnet-contract.json @@ -0,0 +1,8507 @@ +{ + "contract_name": "nym-mixnet-contract", + "contract_version": "1.4.0", + "idl_version": "1.0.0", + "instantiate": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "epoch_duration", + "epochs_in_interval", + "initial_rewarding_params", + "rewarding_denom", + "rewarding_validator_address", + "vesting_contract_address" + ], + "properties": { + "epoch_duration": { + "$ref": "#/definitions/Duration" + }, + "epochs_in_interval": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "initial_rewarding_params": { + "$ref": "#/definitions/InitialRewardingParams" + }, + "rewarding_denom": { + "type": "string" + }, + "rewarding_validator_address": { + "type": "string" + }, + "vesting_contract_address": { + "type": "string" + } + }, + "additionalProperties": false, + "definitions": { + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Duration": { + "type": "object", + "required": [ + "nanos", + "secs" + ], + "properties": { + "nanos": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "secs": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "InitialRewardingParams": { + "type": "object", + "required": [ + "active_set_size", + "active_set_work_factor", + "initial_reward_pool", + "initial_staking_supply", + "interval_pool_emission", + "rewarded_set_size", + "staking_supply_scale_factor", + "sybil_resistance" + ], + "properties": { + "active_set_size": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "active_set_work_factor": { + "$ref": "#/definitions/Decimal" + }, + "initial_reward_pool": { + "$ref": "#/definitions/Decimal" + }, + "initial_staking_supply": { + "$ref": "#/definitions/Decimal" + }, + "interval_pool_emission": { + "$ref": "#/definitions/Percent" + }, + "rewarded_set_size": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "staking_supply_scale_factor": { + "$ref": "#/definitions/Percent" + }, + "sybil_resistance": { + "$ref": "#/definitions/Percent" + } + }, + "additionalProperties": false + }, + "Percent": { + "description": "Percent represents a value between 0 and 100% (i.e. between 0.0 and 1.0)", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + } + } + }, + "execute": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "assign_node_layer" + ], + "properties": { + "assign_node_layer": { + "type": "object", + "required": [ + "layer", + "mix_id" + ], + "properties": { + "layer": { + "$ref": "#/definitions/Layer" + }, + "mix_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Only owner of the node can crate the family with node as head", + "type": "object", + "required": [ + "create_family" + ], + "properties": { + "create_family": { + "type": "object", + "required": [ + "label" + ], + "properties": { + "label": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Family head needs to sign the joining node IdentityKey", + "type": "object", + "required": [ + "join_family" + ], + "properties": { + "join_family": { + "type": "object", + "required": [ + "family_head", + "join_permit" + ], + "properties": { + "family_head": { + "$ref": "#/definitions/FamilyHead" + }, + "join_permit": { + "$ref": "#/definitions/MessageSignature" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "leave_family" + ], + "properties": { + "leave_family": { + "type": "object", + "required": [ + "family_head" + ], + "properties": { + "family_head": { + "$ref": "#/definitions/FamilyHead" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "kick_family_member" + ], + "properties": { + "kick_family_member": { + "type": "object", + "required": [ + "member" + ], + "properties": { + "member": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "create_family_on_behalf" + ], + "properties": { + "create_family_on_behalf": { + "type": "object", + "required": [ + "label", + "owner_address" + ], + "properties": { + "label": { + "type": "string" + }, + "owner_address": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Family head needs to sign the joining node IdentityKey, MixNode needs to provide its signature proving that it wants to join the family", + "type": "object", + "required": [ + "join_family_on_behalf" + ], + "properties": { + "join_family_on_behalf": { + "type": "object", + "required": [ + "family_head", + "join_permit", + "member_address" + ], + "properties": { + "family_head": { + "$ref": "#/definitions/FamilyHead" + }, + "join_permit": { + "$ref": "#/definitions/MessageSignature" + }, + "member_address": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "leave_family_on_behalf" + ], + "properties": { + "leave_family_on_behalf": { + "type": "object", + "required": [ + "family_head", + "member_address" + ], + "properties": { + "family_head": { + "$ref": "#/definitions/FamilyHead" + }, + "member_address": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "kick_family_member_on_behalf" + ], + "properties": { + "kick_family_member_on_behalf": { + "type": "object", + "required": [ + "head_address", + "member" + ], + "properties": { + "head_address": { + "type": "string" + }, + "member": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_rewarding_validator_address" + ], + "properties": { + "update_rewarding_validator_address": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_contract_state_params" + ], + "properties": { + "update_contract_state_params": { + "type": "object", + "required": [ + "updated_parameters" + ], + "properties": { + "updated_parameters": { + "$ref": "#/definitions/ContractStateParams" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_active_set_size" + ], + "properties": { + "update_active_set_size": { + "type": "object", + "required": [ + "active_set_size", + "force_immediately" + ], + "properties": { + "active_set_size": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "force_immediately": { + "type": "boolean" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_rewarding_params" + ], + "properties": { + "update_rewarding_params": { + "type": "object", + "required": [ + "force_immediately", + "updated_params" + ], + "properties": { + "force_immediately": { + "type": "boolean" + }, + "updated_params": { + "$ref": "#/definitions/IntervalRewardingParamsUpdate" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_interval_config" + ], + "properties": { + "update_interval_config": { + "type": "object", + "required": [ + "epoch_duration_secs", + "epochs_in_interval", + "force_immediately" + ], + "properties": { + "epoch_duration_secs": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "epochs_in_interval": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "force_immediately": { + "type": "boolean" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "begin_epoch_transition" + ], + "properties": { + "begin_epoch_transition": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "advance_current_epoch" + ], + "properties": { + "advance_current_epoch": { + "type": "object", + "required": [ + "expected_active_set_size", + "new_rewarded_set" + ], + "properties": { + "expected_active_set_size": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "new_rewarded_set": { + "type": "array", + "items": { + "$ref": "#/definitions/LayerAssignment" + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "reconcile_epoch_events" + ], + "properties": { + "reconcile_epoch_events": { + "type": "object", + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "bond_mixnode" + ], + "properties": { + "bond_mixnode": { + "type": "object", + "required": [ + "cost_params", + "mix_node", + "owner_signature" + ], + "properties": { + "cost_params": { + "$ref": "#/definitions/MixNodeCostParams" + }, + "mix_node": { + "$ref": "#/definitions/MixNode" + }, + "owner_signature": { + "$ref": "#/definitions/MessageSignature" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "bond_mixnode_on_behalf" + ], + "properties": { + "bond_mixnode_on_behalf": { + "type": "object", + "required": [ + "cost_params", + "mix_node", + "owner", + "owner_signature" + ], + "properties": { + "cost_params": { + "$ref": "#/definitions/MixNodeCostParams" + }, + "mix_node": { + "$ref": "#/definitions/MixNode" + }, + "owner": { + "type": "string" + }, + "owner_signature": { + "$ref": "#/definitions/MessageSignature" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "pledge_more" + ], + "properties": { + "pledge_more": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "pledge_more_on_behalf" + ], + "properties": { + "pledge_more_on_behalf": { + "type": "object", + "required": [ + "owner" + ], + "properties": { + "owner": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "decrease_pledge" + ], + "properties": { + "decrease_pledge": { + "type": "object", + "required": [ + "decrease_by" + ], + "properties": { + "decrease_by": { + "$ref": "#/definitions/Coin" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "decrease_pledge_on_behalf" + ], + "properties": { + "decrease_pledge_on_behalf": { + "type": "object", + "required": [ + "decrease_by", + "owner" + ], + "properties": { + "decrease_by": { + "$ref": "#/definitions/Coin" + }, + "owner": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "unbond_mixnode" + ], + "properties": { + "unbond_mixnode": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "unbond_mixnode_on_behalf" + ], + "properties": { + "unbond_mixnode_on_behalf": { + "type": "object", + "required": [ + "owner" + ], + "properties": { + "owner": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_mixnode_cost_params" + ], + "properties": { + "update_mixnode_cost_params": { + "type": "object", + "required": [ + "new_costs" + ], + "properties": { + "new_costs": { + "$ref": "#/definitions/MixNodeCostParams" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_mixnode_cost_params_on_behalf" + ], + "properties": { + "update_mixnode_cost_params_on_behalf": { + "type": "object", + "required": [ + "new_costs", + "owner" + ], + "properties": { + "new_costs": { + "$ref": "#/definitions/MixNodeCostParams" + }, + "owner": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_mixnode_config" + ], + "properties": { + "update_mixnode_config": { + "type": "object", + "required": [ + "new_config" + ], + "properties": { + "new_config": { + "$ref": "#/definitions/MixNodeConfigUpdate" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_mixnode_config_on_behalf" + ], + "properties": { + "update_mixnode_config_on_behalf": { + "type": "object", + "required": [ + "new_config", + "owner" + ], + "properties": { + "new_config": { + "$ref": "#/definitions/MixNodeConfigUpdate" + }, + "owner": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "bond_gateway" + ], + "properties": { + "bond_gateway": { + "type": "object", + "required": [ + "gateway", + "owner_signature" + ], + "properties": { + "gateway": { + "$ref": "#/definitions/Gateway" + }, + "owner_signature": { + "$ref": "#/definitions/MessageSignature" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "bond_gateway_on_behalf" + ], + "properties": { + "bond_gateway_on_behalf": { + "type": "object", + "required": [ + "gateway", + "owner", + "owner_signature" + ], + "properties": { + "gateway": { + "$ref": "#/definitions/Gateway" + }, + "owner": { + "type": "string" + }, + "owner_signature": { + "$ref": "#/definitions/MessageSignature" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "unbond_gateway" + ], + "properties": { + "unbond_gateway": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "unbond_gateway_on_behalf" + ], + "properties": { + "unbond_gateway_on_behalf": { + "type": "object", + "required": [ + "owner" + ], + "properties": { + "owner": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_gateway_config" + ], + "properties": { + "update_gateway_config": { + "type": "object", + "required": [ + "new_config" + ], + "properties": { + "new_config": { + "$ref": "#/definitions/GatewayConfigUpdate" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_gateway_config_on_behalf" + ], + "properties": { + "update_gateway_config_on_behalf": { + "type": "object", + "required": [ + "new_config", + "owner" + ], + "properties": { + "new_config": { + "$ref": "#/definitions/GatewayConfigUpdate" + }, + "owner": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "delegate_to_mixnode" + ], + "properties": { + "delegate_to_mixnode": { + "type": "object", + "required": [ + "mix_id" + ], + "properties": { + "mix_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "delegate_to_mixnode_on_behalf" + ], + "properties": { + "delegate_to_mixnode_on_behalf": { + "type": "object", + "required": [ + "delegate", + "mix_id" + ], + "properties": { + "delegate": { + "type": "string" + }, + "mix_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "undelegate_from_mixnode" + ], + "properties": { + "undelegate_from_mixnode": { + "type": "object", + "required": [ + "mix_id" + ], + "properties": { + "mix_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "undelegate_from_mixnode_on_behalf" + ], + "properties": { + "undelegate_from_mixnode_on_behalf": { + "type": "object", + "required": [ + "delegate", + "mix_id" + ], + "properties": { + "delegate": { + "type": "string" + }, + "mix_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "reward_mixnode" + ], + "properties": { + "reward_mixnode": { + "type": "object", + "required": [ + "mix_id", + "performance" + ], + "properties": { + "mix_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "performance": { + "$ref": "#/definitions/Percent" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "withdraw_operator_reward" + ], + "properties": { + "withdraw_operator_reward": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "withdraw_operator_reward_on_behalf" + ], + "properties": { + "withdraw_operator_reward_on_behalf": { + "type": "object", + "required": [ + "owner" + ], + "properties": { + "owner": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "withdraw_delegator_reward" + ], + "properties": { + "withdraw_delegator_reward": { + "type": "object", + "required": [ + "mix_id" + ], + "properties": { + "mix_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "withdraw_delegator_reward_on_behalf" + ], + "properties": { + "withdraw_delegator_reward_on_behalf": { + "type": "object", + "required": [ + "mix_id", + "owner" + ], + "properties": { + "mix_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "ContractStateParams": { + "description": "Contract parameters that could be adjusted in a transaction by the contract admin.", + "type": "object", + "required": [ + "minimum_gateway_pledge", + "minimum_mixnode_pledge" + ], + "properties": { + "minimum_gateway_pledge": { + "description": "Minimum amount a gateway must pledge to get into the system.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "minimum_mixnode_delegation": { + "description": "Minimum amount a delegator must stake in orders for his delegation to get accepted.", + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + }, + "minimum_mixnode_pledge": { + "description": "Minimum amount a mixnode must pledge to get into the system.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + } + }, + "additionalProperties": false + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "FamilyHead": { + "description": "Head of particular family as identified by its identity key (i.e. public component of its ed25519 keypair stringified into base58).", + "type": "string" + }, + "Gateway": { + "description": "Information provided by the node operator during bonding that are used to allow other entities to use the services of this node.", + "type": "object", + "required": [ + "clients_port", + "host", + "identity_key", + "location", + "mix_port", + "sphinx_key", + "version" + ], + "properties": { + "clients_port": { + "description": "Port used by this gateway for listening for client requests.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "host": { + "description": "Network address of this gateway, for example 1.1.1.1 or foo.gateway.com", + "type": "string" + }, + "identity_key": { + "description": "Base58 encoded ed25519 EdDSA public key of the gateway used to derive shared keys with clients", + "type": "string" + }, + "location": { + "description": "The physical, self-reported, location of this gateway.", + "type": "string" + }, + "mix_port": { + "description": "Port used by this gateway for listening for mix packets.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "sphinx_key": { + "description": "Base58-encoded x25519 public key used for sphinx key derivation.", + "type": "string" + }, + "version": { + "description": "The self-reported semver version of this gateway.", + "type": "string" + } + }, + "additionalProperties": false + }, + "GatewayConfigUpdate": { + "type": "object", + "required": [ + "clients_port", + "host", + "location", + "mix_port", + "version" + ], + "properties": { + "clients_port": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "host": { + "type": "string" + }, + "location": { + "type": "string" + }, + "mix_port": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "version": { + "type": "string" + } + }, + "additionalProperties": false + }, + "IntervalRewardingParamsUpdate": { + "description": "Specification on how the rewarding params should be updated.", + "type": "object", + "properties": { + "active_set_work_factor": { + "description": "Defines the new value of the active set work factor.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "interval_pool_emission": { + "description": "Defines the new value of the interval pool emission rate.", + "anyOf": [ + { + "$ref": "#/definitions/Percent" + }, + { + "type": "null" + } + ] + }, + "reward_pool": { + "description": "Defines the new value of the reward pool.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "rewarded_set_size": { + "description": "Defines the new size of the rewarded set.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "staking_supply": { + "description": "Defines the new value of the staking supply.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "staking_supply_scale_factor": { + "description": "Defines the new value of the staking supply scale factor.", + "anyOf": [ + { + "$ref": "#/definitions/Percent" + }, + { + "type": "null" + } + ] + }, + "sybil_resistance_percent": { + "description": "Defines the new value of the sybil resistance percent.", + "anyOf": [ + { + "$ref": "#/definitions/Percent" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "Layer": { + "type": "string", + "enum": [ + "One", + "Two", + "Three" + ] + }, + "LayerAssignment": { + "description": "Specifies layer assignment for the given mixnode.", + "type": "object", + "required": [ + "layer", + "mix_id" + ], + "properties": { + "layer": { + "description": "The layer to which it's going to be assigned", + "allOf": [ + { + "$ref": "#/definitions/Layer" + } + ] + }, + "mix_id": { + "description": "The id of the mixnode.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "MessageSignature": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + }, + "MixNode": { + "description": "Information provided by the node operator during bonding that are used to allow other entities to use the services of this node.", + "type": "object", + "required": [ + "host", + "http_api_port", + "identity_key", + "mix_port", + "sphinx_key", + "verloc_port", + "version" + ], + "properties": { + "host": { + "description": "Network address of this mixnode, for example 1.1.1.1 or foo.mixnode.com", + "type": "string" + }, + "http_api_port": { + "description": "Port used by this mixnode for its http(s) API", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "identity_key": { + "description": "Base58-encoded ed25519 EdDSA public key.", + "type": "string" + }, + "mix_port": { + "description": "Port used by this mixnode for listening for mix packets.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "sphinx_key": { + "description": "Base58-encoded x25519 public key used for sphinx key derivation.", + "type": "string" + }, + "verloc_port": { + "description": "Port used by this mixnode for listening for verloc requests.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "version": { + "description": "The self-reported semver version of this mixnode.", + "type": "string" + } + }, + "additionalProperties": false + }, + "MixNodeConfigUpdate": { + "type": "object", + "required": [ + "host", + "http_api_port", + "mix_port", + "verloc_port", + "version" + ], + "properties": { + "host": { + "type": "string" + }, + "http_api_port": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "mix_port": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "verloc_port": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "version": { + "type": "string" + } + }, + "additionalProperties": false + }, + "MixNodeCostParams": { + "description": "The cost parameters, or the cost function, defined for the particular mixnode that influences how the rewards should be split between the node operator and its delegators.", + "type": "object", + "required": [ + "interval_operating_cost", + "profit_margin_percent" + ], + "properties": { + "interval_operating_cost": { + "description": "Operating cost of the associated mixnode per the entire interval.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "profit_margin_percent": { + "description": "The profit margin of the associated mixnode, i.e. the desired percent of the reward to be distributed to the operator.", + "allOf": [ + { + "$ref": "#/definitions/Percent" + } + ] + } + }, + "additionalProperties": false + }, + "Percent": { + "description": "Percent represents a value between 0 and 100% (i.e. between 0.0 and 1.0)", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "query": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "description": "Gets the list of families registered in this contract.", + "type": "object", + "required": [ + "get_all_families_paged" + ], + "properties": { + "get_all_families_paged": { + "type": "object", + "properties": { + "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the list of all family members registered in this contract.", + "type": "object", + "required": [ + "get_all_members_paged" + ], + "properties": { + "get_all_members_paged": { + "type": "object", + "properties": { + "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Attempts to lookup family information given the family head.", + "type": "object", + "required": [ + "get_family_by_head" + ], + "properties": { + "get_family_by_head": { + "type": "object", + "required": [ + "head" + ], + "properties": { + "head": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Attempts to lookup family information given the family label.", + "type": "object", + "required": [ + "get_family_by_label" + ], + "properties": { + "get_family_by_label": { + "type": "object", + "required": [ + "label" + ], + "properties": { + "label": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Attempts to retrieve family members given the family head.", + "type": "object", + "required": [ + "get_family_members_by_head" + ], + "properties": { + "get_family_members_by_head": { + "type": "object", + "required": [ + "head" + ], + "properties": { + "head": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Attempts to retrieve family members given the family label.", + "type": "object", + "required": [ + "get_family_members_by_label" + ], + "properties": { + "get_family_members_by_label": { + "type": "object", + "required": [ + "label" + ], + "properties": { + "label": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets build information of this contract, such as the commit hash used for the build or rustc version.", + "type": "object", + "required": [ + "get_contract_version" + ], + "properties": { + "get_contract_version": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the stored contract version information that's required by the CW2 spec interface for migrations.", + "type": "object", + "required": [ + "get_cw2_contract_version" + ], + "properties": { + "get_cw2_contract_version": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the address of the validator that's allowed to send rewarding transactions and transition the epoch.", + "type": "object", + "required": [ + "get_rewarding_validator_address" + ], + "properties": { + "get_rewarding_validator_address": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the contract parameters that could be adjusted in a transaction by the contract admin.", + "type": "object", + "required": [ + "get_state_params" + ], + "properties": { + "get_state_params": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the current state of the contract.", + "type": "object", + "required": [ + "get_state" + ], + "properties": { + "get_state": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the current parameters used for reward calculation.", + "type": "object", + "required": [ + "get_rewarding_params" + ], + "properties": { + "get_rewarding_params": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the status of the current rewarding epoch.", + "type": "object", + "required": [ + "get_epoch_status" + ], + "properties": { + "get_epoch_status": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Get the details of the current rewarding interval.", + "type": "object", + "required": [ + "get_current_interval_details" + ], + "properties": { + "get_current_interval_details": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the current list of mixnodes in the rewarded set.", + "type": "object", + "required": [ + "get_rewarded_set" + ], + "properties": { + "get_rewarded_set": { + "type": "object", + "properties": { + "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the basic list of all currently bonded mixnodes.", + "type": "object", + "required": [ + "get_mix_node_bonds" + ], + "properties": { + "get_mix_node_bonds": { + "type": "object", + "properties": { + "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the detailed list of all currently bonded mixnodes.", + "type": "object", + "required": [ + "get_mix_nodes_detailed" + ], + "properties": { + "get_mix_nodes_detailed": { + "type": "object", + "properties": { + "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the basic list of all unbonded mixnodes.", + "type": "object", + "required": [ + "get_unbonded_mix_nodes" + ], + "properties": { + "get_unbonded_mix_nodes": { + "type": "object", + "properties": { + "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the basic list of all unbonded mixnodes that belonged to a particular owner.", + "type": "object", + "required": [ + "get_unbonded_mix_nodes_by_owner" + ], + "properties": { + "get_unbonded_mix_nodes_by_owner": { + "type": "object", + "required": [ + "owner" + ], + "properties": { + "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "description": "The address of the owner of the the mixnodes used for the query.", + "type": "string" + }, + "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the basic list of all unbonded mixnodes that used the particular identity key.", + "type": "object", + "required": [ + "get_unbonded_mix_nodes_by_identity_key" + ], + "properties": { + "get_unbonded_mix_nodes_by_identity_key": { + "type": "object", + "required": [ + "identity_key" + ], + "properties": { + "identity_key": { + "description": "The identity key (base58-encoded ed25519 public key) of the mixnode used for the query.", + "type": "string" + }, + "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the detailed mixnode information belonging to the particular owner.", + "type": "object", + "required": [ + "get_owned_mixnode" + ], + "properties": { + "get_owned_mixnode": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "description": "Address of the mixnode owner to use for the query.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the detailed mixnode information of a node with the provided id.", + "type": "object", + "required": [ + "get_mixnode_details" + ], + "properties": { + "get_mixnode_details": { + "type": "object", + "required": [ + "mix_id" + ], + "properties": { + "mix_id": { + "description": "Id of the node to query.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the rewarding information of a mixnode with the provided id.", + "type": "object", + "required": [ + "get_mixnode_rewarding_details" + ], + "properties": { + "get_mixnode_rewarding_details": { + "type": "object", + "required": [ + "mix_id" + ], + "properties": { + "mix_id": { + "description": "Id of the node to query.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the stake saturation of a mixnode with the provided id.", + "type": "object", + "required": [ + "get_stake_saturation" + ], + "properties": { + "get_stake_saturation": { + "type": "object", + "required": [ + "mix_id" + ], + "properties": { + "mix_id": { + "description": "Id of the node to query.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the basic information of an unbonded mixnode with the provided id.", + "type": "object", + "required": [ + "get_unbonded_mix_node_information" + ], + "properties": { + "get_unbonded_mix_node_information": { + "type": "object", + "required": [ + "mix_id" + ], + "properties": { + "mix_id": { + "description": "Id of the node to query.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the detailed mixnode information of a node given its current identity key.", + "type": "object", + "required": [ + "get_bonded_mixnode_details_by_identity" + ], + "properties": { + "get_bonded_mixnode_details_by_identity": { + "type": "object", + "required": [ + "mix_identity" + ], + "properties": { + "mix_identity": { + "description": "The identity key (base58-encoded ed25519 public key) of the mixnode used for the query.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the current layer configuration of the mix network.", + "type": "object", + "required": [ + "get_layer_distribution" + ], + "properties": { + "get_layer_distribution": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the basic list of all currently bonded gateways.", + "type": "object", + "required": [ + "get_gateways" + ], + "properties": { + "get_gateways": { + "type": "object", + "properties": { + "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the gateway details of a node given its identity key.", + "type": "object", + "required": [ + "get_gateway_bond" + ], + "properties": { + "get_gateway_bond": { + "type": "object", + "required": [ + "identity" + ], + "properties": { + "identity": { + "description": "The identity key (base58-encoded ed25519 public key) of the gateway used for the query.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the detailed gateway information belonging to the particular owner.", + "type": "object", + "required": [ + "get_owned_gateway" + ], + "properties": { + "get_owned_gateway": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "description": "Address of the gateway owner to use for the query.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets all delegations associated with particular mixnode", + "type": "object", + "required": [ + "get_mixnode_delegations" + ], + "properties": { + "get_mixnode_delegations": { + "type": "object", + "required": [ + "mix_id" + ], + "properties": { + "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "mix_id": { + "description": "Id of the node to query.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets all delegations associated with particular delegator", + "type": "object", + "required": [ + "get_delegator_delegations" + ], + "properties": { + "get_delegator_delegations": { + "type": "object", + "required": [ + "delegator" + ], + "properties": { + "delegator": { + "description": "The address of the owner of the delegations.", + "type": "string" + }, + "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", + "type": [ + "array", + "null" + ], + "items": [ + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + { + "type": "string" + } + ], + "maxItems": 2, + "minItems": 2 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets delegation information associated with particular mixnode - delegator pair", + "type": "object", + "required": [ + "get_delegation_details" + ], + "properties": { + "get_delegation_details": { + "type": "object", + "required": [ + "delegator", + "mix_id" + ], + "properties": { + "delegator": { + "description": "The address of the owner of the delegation.", + "type": "string" + }, + "mix_id": { + "description": "Id of the node to query.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "proxy": { + "description": "Entity who made the delegation on behalf of the owner. If present, it's most likely the address of the vesting contract.", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets all delegations in the system", + "type": "object", + "required": [ + "get_all_delegations" + ], + "properties": { + "get_all_delegations": { + "type": "object", + "properties": { + "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", + "type": [ + "array", + "null" + ], + "items": [ + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + { + "type": "string" + } + ], + "maxItems": 2, + "minItems": 2 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the reward amount accrued by the node operator that has not yet been claimed.", + "type": "object", + "required": [ + "get_pending_operator_reward" + ], + "properties": { + "get_pending_operator_reward": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "description": "Address of the operator to use for the query.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the reward amount accrued by the particular mixnode that has not yet been claimed.", + "type": "object", + "required": [ + "get_pending_mix_node_operator_reward" + ], + "properties": { + "get_pending_mix_node_operator_reward": { + "type": "object", + "required": [ + "mix_id" + ], + "properties": { + "mix_id": { + "description": "Id of the node to query.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the reward amount accrued by the particular delegator that has not yet been claimed.", + "type": "object", + "required": [ + "get_pending_delegator_reward" + ], + "properties": { + "get_pending_delegator_reward": { + "type": "object", + "required": [ + "address", + "mix_id" + ], + "properties": { + "address": { + "description": "Address of the delegator to use for the query.", + "type": "string" + }, + "mix_id": { + "description": "Id of the node to query.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "proxy": { + "description": "Entity who made the delegation on behalf of the owner. If present, it's most likely the address of the vesting contract.", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Given the provided node performance, attempt to estimate the operator reward for the current epoch.", + "type": "object", + "required": [ + "get_estimated_current_epoch_operator_reward" + ], + "properties": { + "get_estimated_current_epoch_operator_reward": { + "type": "object", + "required": [ + "estimated_performance", + "mix_id" + ], + "properties": { + "estimated_performance": { + "description": "The estimated performance for the current epoch of the given node.", + "allOf": [ + { + "$ref": "#/definitions/Percent" + } + ] + }, + "mix_id": { + "description": "Id of the node to query.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Given the provided node performance, attempt to estimate the delegator reward for the current epoch.", + "type": "object", + "required": [ + "get_estimated_current_epoch_delegator_reward" + ], + "properties": { + "get_estimated_current_epoch_delegator_reward": { + "type": "object", + "required": [ + "address", + "estimated_performance", + "mix_id" + ], + "properties": { + "address": { + "description": "Address of the delegator to use for the query.", + "type": "string" + }, + "estimated_performance": { + "description": "The estimated performance for the current epoch of the given node.", + "allOf": [ + { + "$ref": "#/definitions/Percent" + } + ] + }, + "mix_id": { + "description": "Id of the node to query.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "proxy": { + "description": "Entity who made the delegation on behalf of the owner. If present, it's most likely the address of the vesting contract.", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the list of all currently pending epoch events that will be resolved once the current epoch finishes.", + "type": "object", + "required": [ + "get_pending_epoch_events" + ], + "properties": { + "get_pending_epoch_events": { + "type": "object", + "properties": { + "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the list of all currently pending interval events that will be resolved once the current interval finishes.", + "type": "object", + "required": [ + "get_pending_interval_events" + ], + "properties": { + "get_pending_interval_events": { + "type": "object", + "properties": { + "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets detailed information about a pending epoch event given its id.", + "type": "object", + "required": [ + "get_pending_epoch_event" + ], + "properties": { + "get_pending_epoch_event": { + "type": "object", + "required": [ + "event_id" + ], + "properties": { + "event_id": { + "description": "The unique id associated with the event.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets detailed information about a pending interval event given its id.", + "type": "object", + "required": [ + "get_pending_interval_event" + ], + "properties": { + "get_pending_interval_event": { + "type": "object", + "required": [ + "event_id" + ], + "properties": { + "event_id": { + "description": "The unique id associated with the event.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the information about the number of currently pending epoch and interval events.", + "type": "object", + "required": [ + "get_number_of_pending_events" + ], + "properties": { + "get_number_of_pending_events": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the signing nonce associated with the particular cosmos address.", + "type": "object", + "required": [ + "get_signing_nonce" + ], + "properties": { + "get_signing_nonce": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "description": "Cosmos address used for the query of the signing nonce.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Percent": { + "description": "Percent represents a value between 0 and 100% (i.e. between 0.0 and 1.0)", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + } + } + }, + "migrate": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MigrateMsg", + "type": "object", + "properties": { + "vesting_contract_address": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + }, + "sudo": null, + "responses": { + "get_all_delegations": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedAllDelegationsResponse", + "description": "Response containing paged list of all delegations currently active.", + "type": "object", + "required": [ + "delegations" + ], + "properties": { + "delegations": { + "description": "Each individual delegation made.", + "type": "array", + "items": { + "$ref": "#/definitions/Delegation" + } + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "array", + "null" + ], + "items": [ + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + { + "type": "string" + } + ], + "maxItems": 2, + "minItems": 2 + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Delegation": { + "description": "Information about tokens being delegated towards given mixnode in order to accrue rewards with their work.", + "type": "object", + "required": [ + "amount", + "cumulative_reward_ratio", + "height", + "mix_id", + "owner" + ], + "properties": { + "amount": { + "description": "Original delegation amount. Note that it is never mutated as delegation accumulates rewards.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "cumulative_reward_ratio": { + "description": "Value of the \"unit delegation\" associated with the mixnode at the time of delegation.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "height": { + "description": "Block height where this delegation occurred.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "mix_id": { + "description": "Id of the MixNode that this delegation was performed against.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "description": "Address of the owner of this delegation.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Proxy address used to delegate the funds on behalf of another address", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_all_families_paged": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedFamiliesResponse", + "description": "Response containing paged list of all families registered in the contract.", + "type": "object", + "required": [ + "families" + ], + "properties": { + "families": { + "description": "The families registered in the contract.", + "type": "array", + "items": { + "$ref": "#/definitions/Family" + } + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false, + "definitions": { + "Family": { + "description": "A group of mixnodes associated with particular staking entity. When defined all nodes belonging to the same family will be prioritised to be put onto the same layer.", + "type": "object", + "required": [ + "head", + "label" + ], + "properties": { + "head": { + "description": "Owner of this family.", + "allOf": [ + { + "$ref": "#/definitions/FamilyHead" + } + ] + }, + "label": { + "description": "Human readable label for this family.", + "type": "string" + }, + "proxy": { + "description": "Optional proxy (i.e. vesting contract address) used when creating the family.", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + }, + "FamilyHead": { + "description": "Head of particular family as identified by its identity key (i.e. public component of its ed25519 keypair stringified into base58).", + "type": "string" + } + } + }, + "get_all_members_paged": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedMembersResponse", + "description": "Response containing paged list of all family members (of ALL families) registered in the contract.", + "type": "object", + "required": [ + "members" + ], + "properties": { + "members": { + "description": "The members alongside their family heads.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/FamilyHead" + } + ], + "maxItems": 2, + "minItems": 2 + } + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false, + "definitions": { + "FamilyHead": { + "description": "Head of particular family as identified by its identity key (i.e. public component of its ed25519 keypair stringified into base58).", + "type": "string" + } + } + }, + "get_bonded_mixnode_details_by_identity": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MixnodeDetailsByIdentityResponse", + "description": "Response containing details of a bonded mixnode with the provided identity key.", + "type": "object", + "required": [ + "identity_key" + ], + "properties": { + "identity_key": { + "description": "The identity key (base58-encoded ed25519 public key) of the mixnode.", + "type": "string" + }, + "mixnode_details": { + "description": "If there exists a bonded mixnode with the provided identity key, this field contains its detailed information.", + "anyOf": [ + { + "$ref": "#/definitions/MixNodeDetails" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Layer": { + "type": "string", + "enum": [ + "One", + "Two", + "Three" + ] + }, + "MixNode": { + "description": "Information provided by the node operator during bonding that are used to allow other entities to use the services of this node.", + "type": "object", + "required": [ + "host", + "http_api_port", + "identity_key", + "mix_port", + "sphinx_key", + "verloc_port", + "version" + ], + "properties": { + "host": { + "description": "Network address of this mixnode, for example 1.1.1.1 or foo.mixnode.com", + "type": "string" + }, + "http_api_port": { + "description": "Port used by this mixnode for its http(s) API", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "identity_key": { + "description": "Base58-encoded ed25519 EdDSA public key.", + "type": "string" + }, + "mix_port": { + "description": "Port used by this mixnode for listening for mix packets.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "sphinx_key": { + "description": "Base58-encoded x25519 public key used for sphinx key derivation.", + "type": "string" + }, + "verloc_port": { + "description": "Port used by this mixnode for listening for verloc requests.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "version": { + "description": "The self-reported semver version of this mixnode.", + "type": "string" + } + }, + "additionalProperties": false + }, + "MixNodeBond": { + "description": "Basic mixnode information provided by the node operator.", + "type": "object", + "required": [ + "bonding_height", + "is_unbonding", + "layer", + "mix_id", + "mix_node", + "original_pledge", + "owner" + ], + "properties": { + "bonding_height": { + "description": "Block height at which this mixnode has been bonded.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "is_unbonding": { + "description": "Flag to indicate whether this node is in the process of unbonding, that will conclude upon the epoch finishing.", + "type": "boolean" + }, + "layer": { + "description": "Layer assigned to this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/Layer" + } + ] + }, + "mix_id": { + "description": "Unique id assigned to the bonded mixnode.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "mix_node": { + "description": "Information provided by the operator for the purposes of bonding.", + "allOf": [ + { + "$ref": "#/definitions/MixNode" + } + ] + }, + "original_pledge": { + "description": "Original amount pledged by the operator of this node.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "owner": { + "description": "Address of the owner of this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Entity who bonded this mixnode on behalf of the owner. If exists, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeCostParams": { + "description": "The cost parameters, or the cost function, defined for the particular mixnode that influences how the rewards should be split between the node operator and its delegators.", + "type": "object", + "required": [ + "interval_operating_cost", + "profit_margin_percent" + ], + "properties": { + "interval_operating_cost": { + "description": "Operating cost of the associated mixnode per the entire interval.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "profit_margin_percent": { + "description": "The profit margin of the associated mixnode, i.e. the desired percent of the reward to be distributed to the operator.", + "allOf": [ + { + "$ref": "#/definitions/Percent" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeDetails": { + "description": "Full details associated with given mixnode.", + "type": "object", + "required": [ + "bond_information", + "rewarding_details" + ], + "properties": { + "bond_information": { + "description": "Basic bond information of this mixnode, such as owner address, original pledge, etc.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeBond" + } + ] + }, + "pending_changes": { + "description": "Adjustments to the mixnode that are ought to happen during future epoch transitions.", + "default": { + "pledge_change": null + }, + "allOf": [ + { + "$ref": "#/definitions/PendingMixNodeChanges" + } + ] + }, + "rewarding_details": { + "description": "Details used for computation of rewarding related data.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeRewarding" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeRewarding": { + "type": "object", + "required": [ + "cost_params", + "delegates", + "last_rewarded_epoch", + "operator", + "total_unit_reward", + "unique_delegations", + "unit_delegation" + ], + "properties": { + "cost_params": { + "description": "Information provided by the operator that influence the cost function.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeCostParams" + } + ] + }, + "delegates": { + "description": "Total delegation and compounded reward earned by all node delegators.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "last_rewarded_epoch": { + "description": "Marks the epoch when this node was last rewarded so that we wouldn't accidentally attempt to reward it multiple times in the same epoch.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "operator": { + "description": "Total pledge and compounded reward earned by the node operator.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "total_unit_reward": { + "description": "Cumulative reward earned by the \"unit delegation\" since the block 0.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "unique_delegations": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "unit_delegation": { + "description": "Value of the theoretical \"unit delegation\" that has delegated to this mixnode at block 0.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + } + }, + "additionalProperties": false + }, + "PendingMixNodeChanges": { + "type": "object", + "properties": { + "pledge_change": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "Percent": { + "description": "Percent represents a value between 0 and 100% (i.e. between 0.0 and 1.0)", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_c_w2_contract_version": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ContractVersion", + "type": "object", + "required": [ + "contract", + "version" + ], + "properties": { + "contract": { + "description": "contract is the crate name of the implementing contract, eg. `crate:cw20-base` we will use other prefixes for other languages, and their standard global namespacing", + "type": "string" + }, + "version": { + "description": "version is any string that this implementation knows. It may be simple counter \"1\", \"2\". or semantic version on release tags \"v0.7.0\", or some custom feature flag list. the only code that needs to understand the version parsing is code that knows how to migrate from the given contract (and is tied to it's implementation somehow)", + "type": "string" + } + }, + "additionalProperties": false + }, + "get_contract_version": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ContractBuildInformation", + "type": "object", + "required": [ + "build_timestamp", + "build_version", + "commit_branch", + "commit_sha", + "commit_timestamp", + "rustc_version" + ], + "properties": { + "build_timestamp": { + "description": "Provides the build timestamp, for example `2021-02-23T20:14:46.558472672+00:00`.", + "type": "string" + }, + "build_version": { + "description": "Provides the build version, for example `0.1.0-9-g46f83e1`.", + "type": "string" + }, + "commit_branch": { + "description": "Provides the name of the git branch that was used for the build, for example `master`.", + "type": "string" + }, + "commit_sha": { + "description": "Provides the hash of the commit that was used for the build, for example `46f83e112520533338245862d366f6a02cef07d4`.", + "type": "string" + }, + "commit_timestamp": { + "description": "Provides the timestamp of the commit that was used for the build, for example `2021-02-23T08:08:02-05:00`.", + "type": "string" + }, + "rustc_version": { + "description": "Provides the rustc version that was used for the build, for example `1.52.0-nightly`.", + "type": "string" + } + }, + "additionalProperties": false + }, + "get_current_interval_details": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "CurrentIntervalResponse", + "description": "Information about the current rewarding interval.", + "type": "object", + "required": [ + "current_blocktime", + "interval", + "is_current_epoch_over", + "is_current_interval_over" + ], + "properties": { + "current_blocktime": { + "description": "The current blocktime", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "interval": { + "description": "Detailed information about the underlying interval.", + "allOf": [ + { + "$ref": "#/definitions/Interval" + } + ] + }, + "is_current_epoch_over": { + "description": "Flag indicating whether the current epoch is over and it should be advanced.", + "type": "boolean" + }, + "is_current_interval_over": { + "description": "Flag indicating whether the current interval is over and it should be advanced.", + "type": "boolean" + } + }, + "additionalProperties": false, + "definitions": { + "Duration": { + "type": "object", + "required": [ + "nanos", + "secs" + ], + "properties": { + "nanos": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "secs": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "Interval": { + "type": "object", + "required": [ + "current_epoch_id", + "current_epoch_start", + "epoch_length", + "epochs_in_interval", + "id", + "total_elapsed_epochs" + ], + "properties": { + "current_epoch_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "current_epoch_start": { + "type": "string" + }, + "epoch_length": { + "$ref": "#/definitions/Duration" + }, + "epochs_in_interval": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "total_elapsed_epochs": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + } + } + }, + "get_delegation_details": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MixNodeDelegationResponse", + "description": "Response containing delegation details.", + "type": "object", + "required": [ + "mixnode_still_bonded" + ], + "properties": { + "delegation": { + "description": "If the delegation exists, this field contains its detailed information.", + "anyOf": [ + { + "$ref": "#/definitions/Delegation" + }, + { + "type": "null" + } + ] + }, + "mixnode_still_bonded": { + "description": "Flag indicating whether the node towards which the delegation was made is still bonded in the network.", + "type": "boolean" + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Delegation": { + "description": "Information about tokens being delegated towards given mixnode in order to accrue rewards with their work.", + "type": "object", + "required": [ + "amount", + "cumulative_reward_ratio", + "height", + "mix_id", + "owner" + ], + "properties": { + "amount": { + "description": "Original delegation amount. Note that it is never mutated as delegation accumulates rewards.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "cumulative_reward_ratio": { + "description": "Value of the \"unit delegation\" associated with the mixnode at the time of delegation.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "height": { + "description": "Block height where this delegation occurred.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "mix_id": { + "description": "Id of the MixNode that this delegation was performed against.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "description": "Address of the owner of this delegation.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Proxy address used to delegate the funds on behalf of another address", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_delegator_delegations": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedDelegatorDelegationsResponse", + "description": "Response containing paged list of all delegations made by the particular address.", + "type": "object", + "required": [ + "delegations" + ], + "properties": { + "delegations": { + "description": "Each individual delegation made.", + "type": "array", + "items": { + "$ref": "#/definitions/Delegation" + } + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "array", + "null" + ], + "items": [ + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + { + "type": "string" + } + ], + "maxItems": 2, + "minItems": 2 + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Delegation": { + "description": "Information about tokens being delegated towards given mixnode in order to accrue rewards with their work.", + "type": "object", + "required": [ + "amount", + "cumulative_reward_ratio", + "height", + "mix_id", + "owner" + ], + "properties": { + "amount": { + "description": "Original delegation amount. Note that it is never mutated as delegation accumulates rewards.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "cumulative_reward_ratio": { + "description": "Value of the \"unit delegation\" associated with the mixnode at the time of delegation.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "height": { + "description": "Block height where this delegation occurred.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "mix_id": { + "description": "Id of the MixNode that this delegation was performed against.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "description": "Address of the owner of this delegation.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Proxy address used to delegate the funds on behalf of another address", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_epoch_status": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "EpochStatus", + "description": "The status of the current rewarding epoch.", + "type": "object", + "required": [ + "being_advanced_by", + "state" + ], + "properties": { + "being_advanced_by": { + "description": "Specifies either, which validator is currently performing progression into the following epoch (if the epoch is currently being progressed), or which validator was responsible for progressing into the current epoch (if the epoch is currently in progress)", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "state": { + "description": "The concrete state of the epoch.", + "allOf": [ + { + "$ref": "#/definitions/EpochState" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "EpochState": { + "description": "The state of the current rewarding epoch.", + "oneOf": [ + { + "description": "Represents the state of an epoch that's in progress (well, duh.) All actions are allowed to be issued.", + "type": "string", + "enum": [ + "in_progress" + ] + }, + { + "description": "Represents the state of an epoch when the rewarding entity has been decided on, and the mixnodes are in the process of being rewarded for their work in this epoch.", + "type": "object", + "required": [ + "rewarding" + ], + "properties": { + "rewarding": { + "type": "object", + "required": [ + "final_node_id", + "last_rewarded" + ], + "properties": { + "final_node_id": { + "description": "The id of the last node that's going to be rewarded before progressing into the next state.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "last_rewarded": { + "description": "The id of the last node that has already received its rewards.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Represents the state of an epoch when all mixnodes have already been rewarded for their work in this epoch and all issued actions should now get resolved before being allowed to advance into the next epoch.", + "type": "string", + "enum": [ + "reconciling_events" + ] + }, + { + "description": "Represents the state of an epoch when all mixnodes have already been rewarded for their work in this epoch, all issued actions got resolved and the epoch should now be advanced whilst assigning new rewarded set.", + "type": "string", + "enum": [ + "advancing_epoch" + ] + } + ] + } + } + }, + "get_estimated_current_epoch_delegator_reward": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "EstimatedCurrentEpochRewardResponse", + "description": "Response containing estimation of node rewards for the current epoch.", + "type": "object", + "properties": { + "current_stake_value": { + "description": "The current stake value given all past rewarding and compounding since the original staking was performed.", + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + }, + "current_stake_value_detailed_amount": { + "description": "The current stake value. Note that it's nearly identical to `current_stake_value`, however, it contains few additional decimal points for more accurate reward calculation.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "detailed_estimation_amount": { + "description": "The full reward estimation. Note that it's nearly identical to `estimation`, however, it contains few additional decimal points for more accurate reward calculation.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "estimation": { + "description": "The reward estimation for the current epoch, i.e. the amount of tokens that could be claimable after the epoch finishes and the state of the network does not change.", + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + }, + "original_stake": { + "description": "The amount of tokens initially staked.", + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_estimated_current_epoch_operator_reward": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "EstimatedCurrentEpochRewardResponse", + "description": "Response containing estimation of node rewards for the current epoch.", + "type": "object", + "properties": { + "current_stake_value": { + "description": "The current stake value given all past rewarding and compounding since the original staking was performed.", + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + }, + "current_stake_value_detailed_amount": { + "description": "The current stake value. Note that it's nearly identical to `current_stake_value`, however, it contains few additional decimal points for more accurate reward calculation.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "detailed_estimation_amount": { + "description": "The full reward estimation. Note that it's nearly identical to `estimation`, however, it contains few additional decimal points for more accurate reward calculation.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "estimation": { + "description": "The reward estimation for the current epoch, i.e. the amount of tokens that could be claimable after the epoch finishes and the state of the network does not change.", + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + }, + "original_stake": { + "description": "The amount of tokens initially staked.", + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_family_by_head": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "FamilyByHeadResponse", + "description": "Response containing family information.", + "type": "object", + "required": [ + "head" + ], + "properties": { + "family": { + "description": "If applicable, the family associated with the provided head.", + "anyOf": [ + { + "$ref": "#/definitions/Family" + }, + { + "type": "null" + } + ] + }, + "head": { + "description": "The family head used for the query.", + "allOf": [ + { + "$ref": "#/definitions/FamilyHead" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Family": { + "description": "A group of mixnodes associated with particular staking entity. When defined all nodes belonging to the same family will be prioritised to be put onto the same layer.", + "type": "object", + "required": [ + "head", + "label" + ], + "properties": { + "head": { + "description": "Owner of this family.", + "allOf": [ + { + "$ref": "#/definitions/FamilyHead" + } + ] + }, + "label": { + "description": "Human readable label for this family.", + "type": "string" + }, + "proxy": { + "description": "Optional proxy (i.e. vesting contract address) used when creating the family.", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + }, + "FamilyHead": { + "description": "Head of particular family as identified by its identity key (i.e. public component of its ed25519 keypair stringified into base58).", + "type": "string" + } + } + }, + "get_family_by_label": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "FamilyByLabelResponse", + "description": "Response containing family information.", + "type": "object", + "required": [ + "label" + ], + "properties": { + "family": { + "description": "If applicable, the family associated with the provided label.", + "anyOf": [ + { + "$ref": "#/definitions/Family" + }, + { + "type": "null" + } + ] + }, + "label": { + "description": "The family label used for the query.", + "type": "string" + } + }, + "additionalProperties": false, + "definitions": { + "Family": { + "description": "A group of mixnodes associated with particular staking entity. When defined all nodes belonging to the same family will be prioritised to be put onto the same layer.", + "type": "object", + "required": [ + "head", + "label" + ], + "properties": { + "head": { + "description": "Owner of this family.", + "allOf": [ + { + "$ref": "#/definitions/FamilyHead" + } + ] + }, + "label": { + "description": "Human readable label for this family.", + "type": "string" + }, + "proxy": { + "description": "Optional proxy (i.e. vesting contract address) used when creating the family.", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + }, + "FamilyHead": { + "description": "Head of particular family as identified by its identity key (i.e. public component of its ed25519 keypair stringified into base58).", + "type": "string" + } + } + }, + "get_family_members_by_head": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "FamilyMembersByHeadResponse", + "description": "Response containing family members information.", + "type": "object", + "required": [ + "head", + "members" + ], + "properties": { + "head": { + "description": "The family head used for the query.", + "allOf": [ + { + "$ref": "#/definitions/FamilyHead" + } + ] + }, + "members": { + "description": "All members belonging to the specified family.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "definitions": { + "FamilyHead": { + "description": "Head of particular family as identified by its identity key (i.e. public component of its ed25519 keypair stringified into base58).", + "type": "string" + } + } + }, + "get_family_members_by_label": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "FamilyMembersByLabelResponse", + "description": "Response containing family members information.", + "type": "object", + "required": [ + "label", + "members" + ], + "properties": { + "label": { + "description": "The family label used for the query.", + "type": "string" + }, + "members": { + "description": "All members belonging to the specified family.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "get_gateway_bond": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "GatewayBondResponse", + "description": "Response containing details of a gateway with the provided identity key.", + "type": "object", + "required": [ + "identity" + ], + "properties": { + "gateway": { + "description": "If there exists a gateway with the provided identity key, this field contains its details.", + "anyOf": [ + { + "$ref": "#/definitions/GatewayBond" + }, + { + "type": "null" + } + ] + }, + "identity": { + "description": "The identity key (base58-encoded ed25519 public key) of the gateway.", + "type": "string" + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Gateway": { + "description": "Information provided by the node operator during bonding that are used to allow other entities to use the services of this node.", + "type": "object", + "required": [ + "clients_port", + "host", + "identity_key", + "location", + "mix_port", + "sphinx_key", + "version" + ], + "properties": { + "clients_port": { + "description": "Port used by this gateway for listening for client requests.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "host": { + "description": "Network address of this gateway, for example 1.1.1.1 or foo.gateway.com", + "type": "string" + }, + "identity_key": { + "description": "Base58 encoded ed25519 EdDSA public key of the gateway used to derive shared keys with clients", + "type": "string" + }, + "location": { + "description": "The physical, self-reported, location of this gateway.", + "type": "string" + }, + "mix_port": { + "description": "Port used by this gateway for listening for mix packets.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "sphinx_key": { + "description": "Base58-encoded x25519 public key used for sphinx key derivation.", + "type": "string" + }, + "version": { + "description": "The self-reported semver version of this gateway.", + "type": "string" + } + }, + "additionalProperties": false + }, + "GatewayBond": { + "description": "Basic gateway information provided by the node operator.", + "type": "object", + "required": [ + "block_height", + "gateway", + "owner", + "pledge_amount" + ], + "properties": { + "block_height": { + "description": "Block height at which this gateway has been bonded.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "gateway": { + "description": "Information provided by the operator for the purposes of bonding.", + "allOf": [ + { + "$ref": "#/definitions/Gateway" + } + ] + }, + "owner": { + "description": "Address of the owner of this gateway.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "pledge_amount": { + "description": "Original amount pledged by the operator of this node.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "proxy": { + "description": "Entity who bonded this gateway on behalf of the owner. If exists, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_gateways": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedGatewayResponse", + "description": "Response containing paged list of all gateway bonds in the contract.", + "type": "object", + "required": [ + "nodes", + "per_page" + ], + "properties": { + "nodes": { + "description": "The gateway bond information present in the contract.", + "type": "array", + "items": { + "$ref": "#/definitions/GatewayBond" + } + }, + "per_page": { + "description": "Maximum number of entries that could be included in a response. `per_page <= nodes.len()`", + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Gateway": { + "description": "Information provided by the node operator during bonding that are used to allow other entities to use the services of this node.", + "type": "object", + "required": [ + "clients_port", + "host", + "identity_key", + "location", + "mix_port", + "sphinx_key", + "version" + ], + "properties": { + "clients_port": { + "description": "Port used by this gateway for listening for client requests.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "host": { + "description": "Network address of this gateway, for example 1.1.1.1 or foo.gateway.com", + "type": "string" + }, + "identity_key": { + "description": "Base58 encoded ed25519 EdDSA public key of the gateway used to derive shared keys with clients", + "type": "string" + }, + "location": { + "description": "The physical, self-reported, location of this gateway.", + "type": "string" + }, + "mix_port": { + "description": "Port used by this gateway for listening for mix packets.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "sphinx_key": { + "description": "Base58-encoded x25519 public key used for sphinx key derivation.", + "type": "string" + }, + "version": { + "description": "The self-reported semver version of this gateway.", + "type": "string" + } + }, + "additionalProperties": false + }, + "GatewayBond": { + "description": "Basic gateway information provided by the node operator.", + "type": "object", + "required": [ + "block_height", + "gateway", + "owner", + "pledge_amount" + ], + "properties": { + "block_height": { + "description": "Block height at which this gateway has been bonded.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "gateway": { + "description": "Information provided by the operator for the purposes of bonding.", + "allOf": [ + { + "$ref": "#/definitions/Gateway" + } + ] + }, + "owner": { + "description": "Address of the owner of this gateway.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "pledge_amount": { + "description": "Original amount pledged by the operator of this node.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "proxy": { + "description": "Entity who bonded this gateway on behalf of the owner. If exists, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_layer_distribution": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "LayerDistribution", + "description": "The current layer distribution of the mix network.", + "type": "object", + "required": [ + "layer1", + "layer2", + "layer3" + ], + "properties": { + "layer1": { + "description": "Number of nodes on the first layer.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "layer2": { + "description": "Number of nodes on the second layer.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "layer3": { + "description": "Number of nodes on the third layer.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "get_mix_node_bonds": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedMixnodeBondsResponse", + "description": "Response containing paged list of all mixnode bonds in the contract.", + "type": "object", + "required": [ + "nodes", + "per_page" + ], + "properties": { + "nodes": { + "description": "The mixnode bond information present in the contract.", + "type": "array", + "items": { + "$ref": "#/definitions/MixNodeBond" + } + }, + "per_page": { + "description": "Maximum number of entries that could be included in a response. `per_page <= nodes.len()`", + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Layer": { + "type": "string", + "enum": [ + "One", + "Two", + "Three" + ] + }, + "MixNode": { + "description": "Information provided by the node operator during bonding that are used to allow other entities to use the services of this node.", + "type": "object", + "required": [ + "host", + "http_api_port", + "identity_key", + "mix_port", + "sphinx_key", + "verloc_port", + "version" + ], + "properties": { + "host": { + "description": "Network address of this mixnode, for example 1.1.1.1 or foo.mixnode.com", + "type": "string" + }, + "http_api_port": { + "description": "Port used by this mixnode for its http(s) API", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "identity_key": { + "description": "Base58-encoded ed25519 EdDSA public key.", + "type": "string" + }, + "mix_port": { + "description": "Port used by this mixnode for listening for mix packets.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "sphinx_key": { + "description": "Base58-encoded x25519 public key used for sphinx key derivation.", + "type": "string" + }, + "verloc_port": { + "description": "Port used by this mixnode for listening for verloc requests.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "version": { + "description": "The self-reported semver version of this mixnode.", + "type": "string" + } + }, + "additionalProperties": false + }, + "MixNodeBond": { + "description": "Basic mixnode information provided by the node operator.", + "type": "object", + "required": [ + "bonding_height", + "is_unbonding", + "layer", + "mix_id", + "mix_node", + "original_pledge", + "owner" + ], + "properties": { + "bonding_height": { + "description": "Block height at which this mixnode has been bonded.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "is_unbonding": { + "description": "Flag to indicate whether this node is in the process of unbonding, that will conclude upon the epoch finishing.", + "type": "boolean" + }, + "layer": { + "description": "Layer assigned to this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/Layer" + } + ] + }, + "mix_id": { + "description": "Unique id assigned to the bonded mixnode.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "mix_node": { + "description": "Information provided by the operator for the purposes of bonding.", + "allOf": [ + { + "$ref": "#/definitions/MixNode" + } + ] + }, + "original_pledge": { + "description": "Original amount pledged by the operator of this node.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "owner": { + "description": "Address of the owner of this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Entity who bonded this mixnode on behalf of the owner. If exists, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_mix_nodes_detailed": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedMixnodesDetailsResponse", + "description": "Response containing paged list of all mixnode details in the contract.", + "type": "object", + "required": [ + "nodes", + "per_page" + ], + "properties": { + "nodes": { + "description": "All mixnode details stored in the contract. Apart from the basic bond information it also contains details required for all future reward calculation as well as any pending changes requested by the operator.", + "type": "array", + "items": { + "$ref": "#/definitions/MixNodeDetails" + } + }, + "per_page": { + "description": "Maximum number of entries that could be included in a response. `per_page <= nodes.len()`", + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Layer": { + "type": "string", + "enum": [ + "One", + "Two", + "Three" + ] + }, + "MixNode": { + "description": "Information provided by the node operator during bonding that are used to allow other entities to use the services of this node.", + "type": "object", + "required": [ + "host", + "http_api_port", + "identity_key", + "mix_port", + "sphinx_key", + "verloc_port", + "version" + ], + "properties": { + "host": { + "description": "Network address of this mixnode, for example 1.1.1.1 or foo.mixnode.com", + "type": "string" + }, + "http_api_port": { + "description": "Port used by this mixnode for its http(s) API", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "identity_key": { + "description": "Base58-encoded ed25519 EdDSA public key.", + "type": "string" + }, + "mix_port": { + "description": "Port used by this mixnode for listening for mix packets.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "sphinx_key": { + "description": "Base58-encoded x25519 public key used for sphinx key derivation.", + "type": "string" + }, + "verloc_port": { + "description": "Port used by this mixnode for listening for verloc requests.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "version": { + "description": "The self-reported semver version of this mixnode.", + "type": "string" + } + }, + "additionalProperties": false + }, + "MixNodeBond": { + "description": "Basic mixnode information provided by the node operator.", + "type": "object", + "required": [ + "bonding_height", + "is_unbonding", + "layer", + "mix_id", + "mix_node", + "original_pledge", + "owner" + ], + "properties": { + "bonding_height": { + "description": "Block height at which this mixnode has been bonded.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "is_unbonding": { + "description": "Flag to indicate whether this node is in the process of unbonding, that will conclude upon the epoch finishing.", + "type": "boolean" + }, + "layer": { + "description": "Layer assigned to this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/Layer" + } + ] + }, + "mix_id": { + "description": "Unique id assigned to the bonded mixnode.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "mix_node": { + "description": "Information provided by the operator for the purposes of bonding.", + "allOf": [ + { + "$ref": "#/definitions/MixNode" + } + ] + }, + "original_pledge": { + "description": "Original amount pledged by the operator of this node.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "owner": { + "description": "Address of the owner of this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Entity who bonded this mixnode on behalf of the owner. If exists, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeCostParams": { + "description": "The cost parameters, or the cost function, defined for the particular mixnode that influences how the rewards should be split between the node operator and its delegators.", + "type": "object", + "required": [ + "interval_operating_cost", + "profit_margin_percent" + ], + "properties": { + "interval_operating_cost": { + "description": "Operating cost of the associated mixnode per the entire interval.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "profit_margin_percent": { + "description": "The profit margin of the associated mixnode, i.e. the desired percent of the reward to be distributed to the operator.", + "allOf": [ + { + "$ref": "#/definitions/Percent" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeDetails": { + "description": "Full details associated with given mixnode.", + "type": "object", + "required": [ + "bond_information", + "rewarding_details" + ], + "properties": { + "bond_information": { + "description": "Basic bond information of this mixnode, such as owner address, original pledge, etc.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeBond" + } + ] + }, + "pending_changes": { + "description": "Adjustments to the mixnode that are ought to happen during future epoch transitions.", + "default": { + "pledge_change": null + }, + "allOf": [ + { + "$ref": "#/definitions/PendingMixNodeChanges" + } + ] + }, + "rewarding_details": { + "description": "Details used for computation of rewarding related data.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeRewarding" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeRewarding": { + "type": "object", + "required": [ + "cost_params", + "delegates", + "last_rewarded_epoch", + "operator", + "total_unit_reward", + "unique_delegations", + "unit_delegation" + ], + "properties": { + "cost_params": { + "description": "Information provided by the operator that influence the cost function.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeCostParams" + } + ] + }, + "delegates": { + "description": "Total delegation and compounded reward earned by all node delegators.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "last_rewarded_epoch": { + "description": "Marks the epoch when this node was last rewarded so that we wouldn't accidentally attempt to reward it multiple times in the same epoch.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "operator": { + "description": "Total pledge and compounded reward earned by the node operator.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "total_unit_reward": { + "description": "Cumulative reward earned by the \"unit delegation\" since the block 0.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "unique_delegations": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "unit_delegation": { + "description": "Value of the theoretical \"unit delegation\" that has delegated to this mixnode at block 0.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + } + }, + "additionalProperties": false + }, + "PendingMixNodeChanges": { + "type": "object", + "properties": { + "pledge_change": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "Percent": { + "description": "Percent represents a value between 0 and 100% (i.e. between 0.0 and 1.0)", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_mixnode_delegations": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedMixNodeDelegationsResponse", + "description": "Response containing paged list of all delegations made towards particular mixnode.", + "type": "object", + "required": [ + "delegations" + ], + "properties": { + "delegations": { + "description": "Each individual delegation made.", + "type": "array", + "items": { + "$ref": "#/definitions/Delegation" + } + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Delegation": { + "description": "Information about tokens being delegated towards given mixnode in order to accrue rewards with their work.", + "type": "object", + "required": [ + "amount", + "cumulative_reward_ratio", + "height", + "mix_id", + "owner" + ], + "properties": { + "amount": { + "description": "Original delegation amount. Note that it is never mutated as delegation accumulates rewards.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "cumulative_reward_ratio": { + "description": "Value of the \"unit delegation\" associated with the mixnode at the time of delegation.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "height": { + "description": "Block height where this delegation occurred.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "mix_id": { + "description": "Id of the MixNode that this delegation was performed against.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "description": "Address of the owner of this delegation.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Proxy address used to delegate the funds on behalf of another address", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_mixnode_details": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MixnodeDetailsResponse", + "description": "Response containing details of a mixnode with the provided id.", + "type": "object", + "required": [ + "mix_id" + ], + "properties": { + "mix_id": { + "description": "Id of the requested mixnode.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "mixnode_details": { + "description": "If there exists a mixnode with the provided id, this field contains its detailed information.", + "anyOf": [ + { + "$ref": "#/definitions/MixNodeDetails" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Layer": { + "type": "string", + "enum": [ + "One", + "Two", + "Three" + ] + }, + "MixNode": { + "description": "Information provided by the node operator during bonding that are used to allow other entities to use the services of this node.", + "type": "object", + "required": [ + "host", + "http_api_port", + "identity_key", + "mix_port", + "sphinx_key", + "verloc_port", + "version" + ], + "properties": { + "host": { + "description": "Network address of this mixnode, for example 1.1.1.1 or foo.mixnode.com", + "type": "string" + }, + "http_api_port": { + "description": "Port used by this mixnode for its http(s) API", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "identity_key": { + "description": "Base58-encoded ed25519 EdDSA public key.", + "type": "string" + }, + "mix_port": { + "description": "Port used by this mixnode for listening for mix packets.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "sphinx_key": { + "description": "Base58-encoded x25519 public key used for sphinx key derivation.", + "type": "string" + }, + "verloc_port": { + "description": "Port used by this mixnode for listening for verloc requests.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "version": { + "description": "The self-reported semver version of this mixnode.", + "type": "string" + } + }, + "additionalProperties": false + }, + "MixNodeBond": { + "description": "Basic mixnode information provided by the node operator.", + "type": "object", + "required": [ + "bonding_height", + "is_unbonding", + "layer", + "mix_id", + "mix_node", + "original_pledge", + "owner" + ], + "properties": { + "bonding_height": { + "description": "Block height at which this mixnode has been bonded.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "is_unbonding": { + "description": "Flag to indicate whether this node is in the process of unbonding, that will conclude upon the epoch finishing.", + "type": "boolean" + }, + "layer": { + "description": "Layer assigned to this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/Layer" + } + ] + }, + "mix_id": { + "description": "Unique id assigned to the bonded mixnode.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "mix_node": { + "description": "Information provided by the operator for the purposes of bonding.", + "allOf": [ + { + "$ref": "#/definitions/MixNode" + } + ] + }, + "original_pledge": { + "description": "Original amount pledged by the operator of this node.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "owner": { + "description": "Address of the owner of this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Entity who bonded this mixnode on behalf of the owner. If exists, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeCostParams": { + "description": "The cost parameters, or the cost function, defined for the particular mixnode that influences how the rewards should be split between the node operator and its delegators.", + "type": "object", + "required": [ + "interval_operating_cost", + "profit_margin_percent" + ], + "properties": { + "interval_operating_cost": { + "description": "Operating cost of the associated mixnode per the entire interval.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "profit_margin_percent": { + "description": "The profit margin of the associated mixnode, i.e. the desired percent of the reward to be distributed to the operator.", + "allOf": [ + { + "$ref": "#/definitions/Percent" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeDetails": { + "description": "Full details associated with given mixnode.", + "type": "object", + "required": [ + "bond_information", + "rewarding_details" + ], + "properties": { + "bond_information": { + "description": "Basic bond information of this mixnode, such as owner address, original pledge, etc.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeBond" + } + ] + }, + "pending_changes": { + "description": "Adjustments to the mixnode that are ought to happen during future epoch transitions.", + "default": { + "pledge_change": null + }, + "allOf": [ + { + "$ref": "#/definitions/PendingMixNodeChanges" + } + ] + }, + "rewarding_details": { + "description": "Details used for computation of rewarding related data.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeRewarding" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeRewarding": { + "type": "object", + "required": [ + "cost_params", + "delegates", + "last_rewarded_epoch", + "operator", + "total_unit_reward", + "unique_delegations", + "unit_delegation" + ], + "properties": { + "cost_params": { + "description": "Information provided by the operator that influence the cost function.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeCostParams" + } + ] + }, + "delegates": { + "description": "Total delegation and compounded reward earned by all node delegators.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "last_rewarded_epoch": { + "description": "Marks the epoch when this node was last rewarded so that we wouldn't accidentally attempt to reward it multiple times in the same epoch.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "operator": { + "description": "Total pledge and compounded reward earned by the node operator.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "total_unit_reward": { + "description": "Cumulative reward earned by the \"unit delegation\" since the block 0.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "unique_delegations": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "unit_delegation": { + "description": "Value of the theoretical \"unit delegation\" that has delegated to this mixnode at block 0.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + } + }, + "additionalProperties": false + }, + "PendingMixNodeChanges": { + "type": "object", + "properties": { + "pledge_change": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "Percent": { + "description": "Percent represents a value between 0 and 100% (i.e. between 0.0 and 1.0)", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_mixnode_rewarding_details": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MixnodeRewardingDetailsResponse", + "description": "Response containing rewarding information of a mixnode with the provided id.", + "type": "object", + "required": [ + "mix_id" + ], + "properties": { + "mix_id": { + "description": "Id of the requested mixnode.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "rewarding_details": { + "description": "If there exists a mixnode with the provided id, this field contains its rewarding information.", + "anyOf": [ + { + "$ref": "#/definitions/MixNodeRewarding" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "MixNodeCostParams": { + "description": "The cost parameters, or the cost function, defined for the particular mixnode that influences how the rewards should be split between the node operator and its delegators.", + "type": "object", + "required": [ + "interval_operating_cost", + "profit_margin_percent" + ], + "properties": { + "interval_operating_cost": { + "description": "Operating cost of the associated mixnode per the entire interval.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "profit_margin_percent": { + "description": "The profit margin of the associated mixnode, i.e. the desired percent of the reward to be distributed to the operator.", + "allOf": [ + { + "$ref": "#/definitions/Percent" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeRewarding": { + "type": "object", + "required": [ + "cost_params", + "delegates", + "last_rewarded_epoch", + "operator", + "total_unit_reward", + "unique_delegations", + "unit_delegation" + ], + "properties": { + "cost_params": { + "description": "Information provided by the operator that influence the cost function.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeCostParams" + } + ] + }, + "delegates": { + "description": "Total delegation and compounded reward earned by all node delegators.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "last_rewarded_epoch": { + "description": "Marks the epoch when this node was last rewarded so that we wouldn't accidentally attempt to reward it multiple times in the same epoch.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "operator": { + "description": "Total pledge and compounded reward earned by the node operator.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "total_unit_reward": { + "description": "Cumulative reward earned by the \"unit delegation\" since the block 0.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "unique_delegations": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "unit_delegation": { + "description": "Value of the theoretical \"unit delegation\" that has delegated to this mixnode at block 0.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + } + }, + "additionalProperties": false + }, + "Percent": { + "description": "Percent represents a value between 0 and 100% (i.e. between 0.0 and 1.0)", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_number_of_pending_events": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "NumberOfPendingEventsResponse", + "description": "Response containing number of currently pending epoch and interval events.", + "type": "object", + "required": [ + "epoch_events", + "interval_events" + ], + "properties": { + "epoch_events": { + "description": "The number of the currently pending epoch events.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "interval_events": { + "description": "The number of the currently pending epoch events.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "get_owned_gateway": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "GatewayOwnershipResponse", + "description": "Response containing details of a gateway belonging to the particular owner.", + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "description": "Validated address of the gateway owner.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "gateway": { + "description": "If the provided address owns a gateway, this field contains its details.", + "anyOf": [ + { + "$ref": "#/definitions/GatewayBond" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Gateway": { + "description": "Information provided by the node operator during bonding that are used to allow other entities to use the services of this node.", + "type": "object", + "required": [ + "clients_port", + "host", + "identity_key", + "location", + "mix_port", + "sphinx_key", + "version" + ], + "properties": { + "clients_port": { + "description": "Port used by this gateway for listening for client requests.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "host": { + "description": "Network address of this gateway, for example 1.1.1.1 or foo.gateway.com", + "type": "string" + }, + "identity_key": { + "description": "Base58 encoded ed25519 EdDSA public key of the gateway used to derive shared keys with clients", + "type": "string" + }, + "location": { + "description": "The physical, self-reported, location of this gateway.", + "type": "string" + }, + "mix_port": { + "description": "Port used by this gateway for listening for mix packets.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "sphinx_key": { + "description": "Base58-encoded x25519 public key used for sphinx key derivation.", + "type": "string" + }, + "version": { + "description": "The self-reported semver version of this gateway.", + "type": "string" + } + }, + "additionalProperties": false + }, + "GatewayBond": { + "description": "Basic gateway information provided by the node operator.", + "type": "object", + "required": [ + "block_height", + "gateway", + "owner", + "pledge_amount" + ], + "properties": { + "block_height": { + "description": "Block height at which this gateway has been bonded.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "gateway": { + "description": "Information provided by the operator for the purposes of bonding.", + "allOf": [ + { + "$ref": "#/definitions/Gateway" + } + ] + }, + "owner": { + "description": "Address of the owner of this gateway.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "pledge_amount": { + "description": "Original amount pledged by the operator of this node.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "proxy": { + "description": "Entity who bonded this gateway on behalf of the owner. If exists, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_owned_mixnode": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MixOwnershipResponse", + "description": "Response containing details of a mixnode belonging to the particular owner.", + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "description": "Validated address of the mixnode owner.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "mixnode_details": { + "description": "If the provided address owns a mixnode, this field contains its detailed information.", + "anyOf": [ + { + "$ref": "#/definitions/MixNodeDetails" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Layer": { + "type": "string", + "enum": [ + "One", + "Two", + "Three" + ] + }, + "MixNode": { + "description": "Information provided by the node operator during bonding that are used to allow other entities to use the services of this node.", + "type": "object", + "required": [ + "host", + "http_api_port", + "identity_key", + "mix_port", + "sphinx_key", + "verloc_port", + "version" + ], + "properties": { + "host": { + "description": "Network address of this mixnode, for example 1.1.1.1 or foo.mixnode.com", + "type": "string" + }, + "http_api_port": { + "description": "Port used by this mixnode for its http(s) API", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "identity_key": { + "description": "Base58-encoded ed25519 EdDSA public key.", + "type": "string" + }, + "mix_port": { + "description": "Port used by this mixnode for listening for mix packets.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "sphinx_key": { + "description": "Base58-encoded x25519 public key used for sphinx key derivation.", + "type": "string" + }, + "verloc_port": { + "description": "Port used by this mixnode for listening for verloc requests.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "version": { + "description": "The self-reported semver version of this mixnode.", + "type": "string" + } + }, + "additionalProperties": false + }, + "MixNodeBond": { + "description": "Basic mixnode information provided by the node operator.", + "type": "object", + "required": [ + "bonding_height", + "is_unbonding", + "layer", + "mix_id", + "mix_node", + "original_pledge", + "owner" + ], + "properties": { + "bonding_height": { + "description": "Block height at which this mixnode has been bonded.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "is_unbonding": { + "description": "Flag to indicate whether this node is in the process of unbonding, that will conclude upon the epoch finishing.", + "type": "boolean" + }, + "layer": { + "description": "Layer assigned to this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/Layer" + } + ] + }, + "mix_id": { + "description": "Unique id assigned to the bonded mixnode.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "mix_node": { + "description": "Information provided by the operator for the purposes of bonding.", + "allOf": [ + { + "$ref": "#/definitions/MixNode" + } + ] + }, + "original_pledge": { + "description": "Original amount pledged by the operator of this node.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "owner": { + "description": "Address of the owner of this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Entity who bonded this mixnode on behalf of the owner. If exists, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeCostParams": { + "description": "The cost parameters, or the cost function, defined for the particular mixnode that influences how the rewards should be split between the node operator and its delegators.", + "type": "object", + "required": [ + "interval_operating_cost", + "profit_margin_percent" + ], + "properties": { + "interval_operating_cost": { + "description": "Operating cost of the associated mixnode per the entire interval.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "profit_margin_percent": { + "description": "The profit margin of the associated mixnode, i.e. the desired percent of the reward to be distributed to the operator.", + "allOf": [ + { + "$ref": "#/definitions/Percent" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeDetails": { + "description": "Full details associated with given mixnode.", + "type": "object", + "required": [ + "bond_information", + "rewarding_details" + ], + "properties": { + "bond_information": { + "description": "Basic bond information of this mixnode, such as owner address, original pledge, etc.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeBond" + } + ] + }, + "pending_changes": { + "description": "Adjustments to the mixnode that are ought to happen during future epoch transitions.", + "default": { + "pledge_change": null + }, + "allOf": [ + { + "$ref": "#/definitions/PendingMixNodeChanges" + } + ] + }, + "rewarding_details": { + "description": "Details used for computation of rewarding related data.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeRewarding" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeRewarding": { + "type": "object", + "required": [ + "cost_params", + "delegates", + "last_rewarded_epoch", + "operator", + "total_unit_reward", + "unique_delegations", + "unit_delegation" + ], + "properties": { + "cost_params": { + "description": "Information provided by the operator that influence the cost function.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeCostParams" + } + ] + }, + "delegates": { + "description": "Total delegation and compounded reward earned by all node delegators.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "last_rewarded_epoch": { + "description": "Marks the epoch when this node was last rewarded so that we wouldn't accidentally attempt to reward it multiple times in the same epoch.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "operator": { + "description": "Total pledge and compounded reward earned by the node operator.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "total_unit_reward": { + "description": "Cumulative reward earned by the \"unit delegation\" since the block 0.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "unique_delegations": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "unit_delegation": { + "description": "Value of the theoretical \"unit delegation\" that has delegated to this mixnode at block 0.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + } + }, + "additionalProperties": false + }, + "PendingMixNodeChanges": { + "type": "object", + "properties": { + "pledge_change": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "Percent": { + "description": "Percent represents a value between 0 and 100% (i.e. between 0.0 and 1.0)", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_pending_delegator_reward": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PendingRewardResponse", + "description": "Response containing information about accrued rewards.", + "type": "object", + "required": [ + "mixnode_still_fully_bonded" + ], + "properties": { + "amount_earned": { + "description": "The amount of tokens that could be claimed.", + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + }, + "amount_earned_detailed": { + "description": "The full pending rewards. Note that it's nearly identical to `amount_earned`, however, it contains few additional decimal points for more accurate reward calculation.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "amount_staked": { + "description": "The amount of tokens initially staked.", + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + }, + "mixnode_still_fully_bonded": { + "description": "The associated mixnode is still fully bonded, meaning it is neither unbonded nor in the process of unbonding that would have finished at the epoch transition.", + "type": "boolean" + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_pending_epoch_event": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PendingEpochEventResponse", + "type": "object", + "required": [ + "event_id" + ], + "properties": { + "event": { + "anyOf": [ + { + "$ref": "#/definitions/PendingEpochEventData" + }, + { + "type": "null" + } + ] + }, + "event_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "PendingEpochEventData": { + "description": "Details of a particular pending epoch event.", + "type": "object", + "required": [ + "created_at", + "kind" + ], + "properties": { + "created_at": { + "description": "The block height at which the request has been made.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "kind": { + "description": "The underlying event data, containing its concrete type and information on how it should get resolved.", + "allOf": [ + { + "$ref": "#/definitions/PendingEpochEventKind" + } + ] + } + }, + "additionalProperties": false + }, + "PendingEpochEventKind": { + "description": "Enum encompassing all possible epoch events.", + "oneOf": [ + { + "description": "Request to create a delegation towards particular mixnode. Note that if such delegation already exists, it will get updated with the provided token amount.", + "type": "object", + "required": [ + "delegate" + ], + "properties": { + "delegate": { + "type": "object", + "required": [ + "amount", + "mix_id", + "owner" + ], + "properties": { + "amount": { + "description": "The amount of tokens to use for the delegation.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "mix_id": { + "description": "The id of the mixnode used for the delegation.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "description": "The address of the owner of the delegation.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Entity who made the delegation on behalf of the owner. If present, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Request to remove delegation from particular mixnode.", + "type": "object", + "required": [ + "undelegate" + ], + "properties": { + "undelegate": { + "type": "object", + "required": [ + "mix_id", + "owner" + ], + "properties": { + "mix_id": { + "description": "The id of the mixnode used for the delegation.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "description": "The address of the owner of the delegation.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Entity who made the delegation on behalf of the owner. If present, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Request to pledge more tokens (by the node operator) towards its node.", + "type": "object", + "required": [ + "pledge_more" + ], + "properties": { + "pledge_more": { + "type": "object", + "required": [ + "amount", + "mix_id" + ], + "properties": { + "amount": { + "description": "The amount of additional tokens to use by the pledge.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "mix_id": { + "description": "The id of the mixnode that will have its pledge updated.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Request to decrease amount of pledged tokens (by the node operator) from its node.", + "type": "object", + "required": [ + "decrease_pledge" + ], + "properties": { + "decrease_pledge": { + "type": "object", + "required": [ + "decrease_by", + "mix_id" + ], + "properties": { + "decrease_by": { + "description": "The amount of tokens that should be removed from the pledge.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "mix_id": { + "description": "The id of the mixnode that will have its pledge updated.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Request to unbond a mixnode and completely remove it from the network.", + "type": "object", + "required": [ + "unbond_mixnode" + ], + "properties": { + "unbond_mixnode": { + "type": "object", + "required": [ + "mix_id" + ], + "properties": { + "mix_id": { + "description": "The id of the mixnode that will get unbonded.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Request to update the current size of the active set.", + "type": "object", + "required": [ + "update_active_set_size" + ], + "properties": { + "update_active_set_size": { + "type": "object", + "required": [ + "new_size" + ], + "properties": { + "new_size": { + "description": "The new desired size of the active set.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_pending_epoch_events": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PendingEpochEventsResponse", + "description": "Response containing all currently pending epoch events that will be resolved once the current epoch finishes.", + "type": "object", + "required": [ + "events", + "seconds_until_executable" + ], + "properties": { + "events": { + "description": "The currently pending events.", + "type": "array", + "items": { + "$ref": "#/definitions/PendingEpochEvent" + } + }, + "seconds_until_executable": { + "description": "Amount of seconds until the events would be eligible to be resolved. It's equivalent to the time until the current epoch finishes.", + "type": "integer", + "format": "int64" + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "PendingEpochEvent": { + "description": "A request made at some point in the current epoch that's going to get resolved once the epoch rolls over.", + "type": "object", + "required": [ + "event", + "id" + ], + "properties": { + "event": { + "description": "The underlying event details, containing its type and information on how it should get resolved.", + "allOf": [ + { + "$ref": "#/definitions/PendingEpochEventData" + } + ] + }, + "id": { + "description": "The unique id associated with the event.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "PendingEpochEventData": { + "description": "Details of a particular pending epoch event.", + "type": "object", + "required": [ + "created_at", + "kind" + ], + "properties": { + "created_at": { + "description": "The block height at which the request has been made.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "kind": { + "description": "The underlying event data, containing its concrete type and information on how it should get resolved.", + "allOf": [ + { + "$ref": "#/definitions/PendingEpochEventKind" + } + ] + } + }, + "additionalProperties": false + }, + "PendingEpochEventKind": { + "description": "Enum encompassing all possible epoch events.", + "oneOf": [ + { + "description": "Request to create a delegation towards particular mixnode. Note that if such delegation already exists, it will get updated with the provided token amount.", + "type": "object", + "required": [ + "delegate" + ], + "properties": { + "delegate": { + "type": "object", + "required": [ + "amount", + "mix_id", + "owner" + ], + "properties": { + "amount": { + "description": "The amount of tokens to use for the delegation.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "mix_id": { + "description": "The id of the mixnode used for the delegation.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "description": "The address of the owner of the delegation.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Entity who made the delegation on behalf of the owner. If present, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Request to remove delegation from particular mixnode.", + "type": "object", + "required": [ + "undelegate" + ], + "properties": { + "undelegate": { + "type": "object", + "required": [ + "mix_id", + "owner" + ], + "properties": { + "mix_id": { + "description": "The id of the mixnode used for the delegation.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "description": "The address of the owner of the delegation.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Entity who made the delegation on behalf of the owner. If present, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Request to pledge more tokens (by the node operator) towards its node.", + "type": "object", + "required": [ + "pledge_more" + ], + "properties": { + "pledge_more": { + "type": "object", + "required": [ + "amount", + "mix_id" + ], + "properties": { + "amount": { + "description": "The amount of additional tokens to use by the pledge.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "mix_id": { + "description": "The id of the mixnode that will have its pledge updated.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Request to decrease amount of pledged tokens (by the node operator) from its node.", + "type": "object", + "required": [ + "decrease_pledge" + ], + "properties": { + "decrease_pledge": { + "type": "object", + "required": [ + "decrease_by", + "mix_id" + ], + "properties": { + "decrease_by": { + "description": "The amount of tokens that should be removed from the pledge.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "mix_id": { + "description": "The id of the mixnode that will have its pledge updated.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Request to unbond a mixnode and completely remove it from the network.", + "type": "object", + "required": [ + "unbond_mixnode" + ], + "properties": { + "unbond_mixnode": { + "type": "object", + "required": [ + "mix_id" + ], + "properties": { + "mix_id": { + "description": "The id of the mixnode that will get unbonded.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Request to update the current size of the active set.", + "type": "object", + "required": [ + "update_active_set_size" + ], + "properties": { + "update_active_set_size": { + "type": "object", + "required": [ + "new_size" + ], + "properties": { + "new_size": { + "description": "The new desired size of the active set.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_pending_interval_event": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PendingIntervalEventResponse", + "type": "object", + "required": [ + "event_id" + ], + "properties": { + "event": { + "anyOf": [ + { + "$ref": "#/definitions/PendingIntervalEventData" + }, + { + "type": "null" + } + ] + }, + "event_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "IntervalRewardingParamsUpdate": { + "description": "Specification on how the rewarding params should be updated.", + "type": "object", + "properties": { + "active_set_work_factor": { + "description": "Defines the new value of the active set work factor.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "interval_pool_emission": { + "description": "Defines the new value of the interval pool emission rate.", + "anyOf": [ + { + "$ref": "#/definitions/Percent" + }, + { + "type": "null" + } + ] + }, + "reward_pool": { + "description": "Defines the new value of the reward pool.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "rewarded_set_size": { + "description": "Defines the new size of the rewarded set.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "staking_supply": { + "description": "Defines the new value of the staking supply.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "staking_supply_scale_factor": { + "description": "Defines the new value of the staking supply scale factor.", + "anyOf": [ + { + "$ref": "#/definitions/Percent" + }, + { + "type": "null" + } + ] + }, + "sybil_resistance_percent": { + "description": "Defines the new value of the sybil resistance percent.", + "anyOf": [ + { + "$ref": "#/definitions/Percent" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeCostParams": { + "description": "The cost parameters, or the cost function, defined for the particular mixnode that influences how the rewards should be split between the node operator and its delegators.", + "type": "object", + "required": [ + "interval_operating_cost", + "profit_margin_percent" + ], + "properties": { + "interval_operating_cost": { + "description": "Operating cost of the associated mixnode per the entire interval.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "profit_margin_percent": { + "description": "The profit margin of the associated mixnode, i.e. the desired percent of the reward to be distributed to the operator.", + "allOf": [ + { + "$ref": "#/definitions/Percent" + } + ] + } + }, + "additionalProperties": false + }, + "PendingIntervalEventData": { + "description": "Details of a particular pending interval event.", + "type": "object", + "required": [ + "created_at", + "kind" + ], + "properties": { + "created_at": { + "description": "The block height at which the request has been made.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "kind": { + "description": "The underlying event data, containing its concrete type and information on how it should get resolved.", + "allOf": [ + { + "$ref": "#/definitions/PendingIntervalEventKind" + } + ] + } + }, + "additionalProperties": false + }, + "PendingIntervalEventKind": { + "description": "Enum encompassing all possible interval events.", + "oneOf": [ + { + "description": "Request to update cost parameters of given mixnode.", + "type": "object", + "required": [ + "change_mix_cost_params" + ], + "properties": { + "change_mix_cost_params": { + "type": "object", + "required": [ + "mix_id", + "new_costs" + ], + "properties": { + "mix_id": { + "description": "The id of the mixnode that will have its cost parameters updated.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "new_costs": { + "description": "The new updated cost function of this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeCostParams" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Request to update the underlying rewarding parameters used by the system", + "type": "object", + "required": [ + "update_rewarding_params" + ], + "properties": { + "update_rewarding_params": { + "type": "object", + "required": [ + "update" + ], + "properties": { + "update": { + "description": "The detailed specification of the update.", + "allOf": [ + { + "$ref": "#/definitions/IntervalRewardingParamsUpdate" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Request to change the next interval configuration.", + "type": "object", + "required": [ + "update_interval_config" + ], + "properties": { + "update_interval_config": { + "type": "object", + "required": [ + "epoch_duration_secs", + "epochs_in_interval" + ], + "properties": { + "epoch_duration_secs": { + "description": "The new epoch duration.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "epochs_in_interval": { + "description": "The new number of epochs in intervals.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Percent": { + "description": "Percent represents a value between 0 and 100% (i.e. between 0.0 and 1.0)", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_pending_interval_events": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PendingIntervalEventsResponse", + "description": "Response containing all currently pending interval events that will be resolved once the current interval finishes.", + "type": "object", + "required": [ + "events", + "seconds_until_executable" + ], + "properties": { + "events": { + "description": "The currently pending events.", + "type": "array", + "items": { + "$ref": "#/definitions/PendingIntervalEvent" + } + }, + "seconds_until_executable": { + "description": "Amount of seconds until the events would be eligible to be resolved. It's equivalent to the time until the current interval finishes.", + "type": "integer", + "format": "int64" + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "IntervalRewardingParamsUpdate": { + "description": "Specification on how the rewarding params should be updated.", + "type": "object", + "properties": { + "active_set_work_factor": { + "description": "Defines the new value of the active set work factor.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "interval_pool_emission": { + "description": "Defines the new value of the interval pool emission rate.", + "anyOf": [ + { + "$ref": "#/definitions/Percent" + }, + { + "type": "null" + } + ] + }, + "reward_pool": { + "description": "Defines the new value of the reward pool.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "rewarded_set_size": { + "description": "Defines the new size of the rewarded set.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "staking_supply": { + "description": "Defines the new value of the staking supply.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "staking_supply_scale_factor": { + "description": "Defines the new value of the staking supply scale factor.", + "anyOf": [ + { + "$ref": "#/definitions/Percent" + }, + { + "type": "null" + } + ] + }, + "sybil_resistance_percent": { + "description": "Defines the new value of the sybil resistance percent.", + "anyOf": [ + { + "$ref": "#/definitions/Percent" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeCostParams": { + "description": "The cost parameters, or the cost function, defined for the particular mixnode that influences how the rewards should be split between the node operator and its delegators.", + "type": "object", + "required": [ + "interval_operating_cost", + "profit_margin_percent" + ], + "properties": { + "interval_operating_cost": { + "description": "Operating cost of the associated mixnode per the entire interval.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "profit_margin_percent": { + "description": "The profit margin of the associated mixnode, i.e. the desired percent of the reward to be distributed to the operator.", + "allOf": [ + { + "$ref": "#/definitions/Percent" + } + ] + } + }, + "additionalProperties": false + }, + "PendingIntervalEvent": { + "description": "A request made at some point in the current interval that's going to get resolved once the interval rolls over.", + "type": "object", + "required": [ + "event", + "id" + ], + "properties": { + "event": { + "description": "The underlying event details, containing its type and information on how it should get resolved.", + "allOf": [ + { + "$ref": "#/definitions/PendingIntervalEventData" + } + ] + }, + "id": { + "description": "The unique id associated with the event.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "PendingIntervalEventData": { + "description": "Details of a particular pending interval event.", + "type": "object", + "required": [ + "created_at", + "kind" + ], + "properties": { + "created_at": { + "description": "The block height at which the request has been made.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "kind": { + "description": "The underlying event data, containing its concrete type and information on how it should get resolved.", + "allOf": [ + { + "$ref": "#/definitions/PendingIntervalEventKind" + } + ] + } + }, + "additionalProperties": false + }, + "PendingIntervalEventKind": { + "description": "Enum encompassing all possible interval events.", + "oneOf": [ + { + "description": "Request to update cost parameters of given mixnode.", + "type": "object", + "required": [ + "change_mix_cost_params" + ], + "properties": { + "change_mix_cost_params": { + "type": "object", + "required": [ + "mix_id", + "new_costs" + ], + "properties": { + "mix_id": { + "description": "The id of the mixnode that will have its cost parameters updated.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "new_costs": { + "description": "The new updated cost function of this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeCostParams" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Request to update the underlying rewarding parameters used by the system", + "type": "object", + "required": [ + "update_rewarding_params" + ], + "properties": { + "update_rewarding_params": { + "type": "object", + "required": [ + "update" + ], + "properties": { + "update": { + "description": "The detailed specification of the update.", + "allOf": [ + { + "$ref": "#/definitions/IntervalRewardingParamsUpdate" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Request to change the next interval configuration.", + "type": "object", + "required": [ + "update_interval_config" + ], + "properties": { + "update_interval_config": { + "type": "object", + "required": [ + "epoch_duration_secs", + "epochs_in_interval" + ], + "properties": { + "epoch_duration_secs": { + "description": "The new epoch duration.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "epochs_in_interval": { + "description": "The new number of epochs in intervals.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Percent": { + "description": "Percent represents a value between 0 and 100% (i.e. between 0.0 and 1.0)", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_pending_mix_node_operator_reward": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PendingRewardResponse", + "description": "Response containing information about accrued rewards.", + "type": "object", + "required": [ + "mixnode_still_fully_bonded" + ], + "properties": { + "amount_earned": { + "description": "The amount of tokens that could be claimed.", + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + }, + "amount_earned_detailed": { + "description": "The full pending rewards. Note that it's nearly identical to `amount_earned`, however, it contains few additional decimal points for more accurate reward calculation.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "amount_staked": { + "description": "The amount of tokens initially staked.", + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + }, + "mixnode_still_fully_bonded": { + "description": "The associated mixnode is still fully bonded, meaning it is neither unbonded nor in the process of unbonding that would have finished at the epoch transition.", + "type": "boolean" + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_pending_operator_reward": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PendingRewardResponse", + "description": "Response containing information about accrued rewards.", + "type": "object", + "required": [ + "mixnode_still_fully_bonded" + ], + "properties": { + "amount_earned": { + "description": "The amount of tokens that could be claimed.", + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + }, + "amount_earned_detailed": { + "description": "The full pending rewards. Note that it's nearly identical to `amount_earned`, however, it contains few additional decimal points for more accurate reward calculation.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "amount_staked": { + "description": "The amount of tokens initially staked.", + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + }, + "mixnode_still_fully_bonded": { + "description": "The associated mixnode is still fully bonded, meaning it is neither unbonded nor in the process of unbonding that would have finished at the epoch transition.", + "type": "boolean" + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_rewarded_set": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedRewardedSetResponse", + "description": "Response containing paged list of all mixnodes in the rewarded set.", + "type": "object", + "required": [ + "nodes" + ], + "properties": { + "nodes": { + "description": "Nodes in the current rewarded set.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + { + "$ref": "#/definitions/RewardedSetNodeStatus" + } + ], + "maxItems": 2, + "minItems": 2 + } + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "RewardedSetNodeStatus": { + "description": "Current state of given node in the rewarded set.", + "oneOf": [ + { + "description": "Node that is currently active, i.e. is expected to be used by clients for mixing packets.", + "type": "string", + "enum": [ + "active" + ] + }, + { + "description": "Node that is currently in standby, i.e. it's present in the rewarded set but is not active.", + "type": "string", + "enum": [ + "standby" + ] + } + ] + } + } + }, + "get_rewarding_params": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "RewardingParams", + "description": "Parameters used for reward calculation.", + "type": "object", + "required": [ + "active_set_size", + "interval", + "rewarded_set_size" + ], + "properties": { + "active_set_size": { + "description": "The expected number of mixnodes in the active set.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "interval": { + "description": "Parameters that should remain unchanged throughout an interval.", + "allOf": [ + { + "$ref": "#/definitions/IntervalRewardParams" + } + ] + }, + "rewarded_set_size": { + "description": "The expected number of mixnodes in the rewarded set (i.e. active + standby).", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "IntervalRewardParams": { + "description": "Parameters required by the mix-mining reward distribution that do not change during an interval.", + "type": "object", + "required": [ + "active_set_work_factor", + "epoch_reward_budget", + "interval_pool_emission", + "reward_pool", + "stake_saturation_point", + "staking_supply", + "staking_supply_scale_factor", + "sybil_resistance" + ], + "properties": { + "active_set_work_factor": { + "description": "Current active set work factor. It is not really expected to be changing very often. As a matter of fact, unless there's a very specific reason, it should remain constant.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "epoch_reward_budget": { + "description": "Current value of the computed reward budget per epoch, per node. It is expected to be constant throughout the interval.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "interval_pool_emission": { + "description": "Current maximum interval pool emission. Assuming all nodes in the rewarded set are fully saturated and have 100% performance, this % of the reward pool would get distributed in rewards to all operators and its delegators. It is not really expected to be changing very often. As a matter of fact, unless there's a very specific reason, it should remain constant.", + "allOf": [ + { + "$ref": "#/definitions/Percent" + } + ] + }, + "reward_pool": { + "description": "Current value of the rewarding pool. It is expected to be constant throughout the interval.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "stake_saturation_point": { + "description": "Current value of the stake saturation point. It is expected to be constant throughout the interval.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "staking_supply": { + "description": "Current value of the staking supply. It is expected to be constant throughout the interval.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "staking_supply_scale_factor": { + "description": "Defines the percentage of stake needed to reach saturation for all of the nodes in the rewarded set. Also known as `beta`.", + "allOf": [ + { + "$ref": "#/definitions/Percent" + } + ] + }, + "sybil_resistance": { + "description": "Current value of the sybil resistance percent (`alpha`). It is not really expected to be changing very often. As a matter of fact, unless there's a very specific reason, it should remain constant.", + "allOf": [ + { + "$ref": "#/definitions/Percent" + } + ] + } + }, + "additionalProperties": false + }, + "Percent": { + "description": "Percent represents a value between 0 and 100% (i.e. between 0.0 and 1.0)", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + } + } + }, + "get_rewarding_validator_address": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "String", + "type": "string" + }, + "get_signing_nonce": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "uint32", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "get_stake_saturation": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "StakeSaturationResponse", + "description": "Response containing the current state of the stake saturation of a mixnode with the provided id.", + "type": "object", + "required": [ + "mix_id" + ], + "properties": { + "current_saturation": { + "description": "The current stake saturation of this node that is indirectly used in reward calculation formulas. Note that it can't be larger than 1.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "mix_id": { + "description": "Id of the requested mixnode.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "uncapped_saturation": { + "description": "The current, absolute, stake saturation of this node. Note that as the name suggests it can be larger than 1. However, anything beyond that value has no effect on the total node reward.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + } + } + }, + "get_state": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ContractState", + "description": "The current state of the mixnet contract.", + "type": "object", + "required": [ + "owner", + "params", + "rewarding_denom", + "rewarding_validator_address", + "vesting_contract_address" + ], + "properties": { + "owner": { + "description": "Address of the contract owner.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "params": { + "description": "Contract parameters that could be adjusted in a transaction the contract admin.", + "allOf": [ + { + "$ref": "#/definitions/ContractStateParams" + } + ] + }, + "rewarding_denom": { + "description": "The expected denom used for rewarding (and realistically any other operation). Default: `unym`", + "type": "string" + }, + "rewarding_validator_address": { + "description": "Address of \"rewarding validator\" (nym-api) that's allowed to send any rewarding-related transactions.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "vesting_contract_address": { + "description": "Address of the vesting contract to which the mixnet contract would be sending all track-related messages.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "ContractStateParams": { + "description": "Contract parameters that could be adjusted in a transaction by the contract admin.", + "type": "object", + "required": [ + "minimum_gateway_pledge", + "minimum_mixnode_pledge" + ], + "properties": { + "minimum_gateway_pledge": { + "description": "Minimum amount a gateway must pledge to get into the system.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "minimum_mixnode_delegation": { + "description": "Minimum amount a delegator must stake in orders for his delegation to get accepted.", + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + }, + "minimum_mixnode_pledge": { + "description": "Minimum amount a mixnode must pledge to get into the system.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + } + }, + "additionalProperties": false + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_state_params": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ContractStateParams", + "description": "Contract parameters that could be adjusted in a transaction by the contract admin.", + "type": "object", + "required": [ + "minimum_gateway_pledge", + "minimum_mixnode_pledge" + ], + "properties": { + "minimum_gateway_pledge": { + "description": "Minimum amount a gateway must pledge to get into the system.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "minimum_mixnode_delegation": { + "description": "Minimum amount a delegator must stake in orders for his delegation to get accepted.", + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + }, + "minimum_mixnode_pledge": { + "description": "Minimum amount a mixnode must pledge to get into the system.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_unbonded_mix_node_information": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "UnbondedMixnodeResponse", + "description": "Response containing basic information of an unbonded mixnode with the provided id.", + "type": "object", + "required": [ + "mix_id" + ], + "properties": { + "mix_id": { + "description": "Id of the requested mixnode.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "unbonded_info": { + "description": "If there existed a mixnode with the provided id, this field contains its basic information.", + "anyOf": [ + { + "$ref": "#/definitions/UnbondedMixnode" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "UnbondedMixnode": { + "description": "Basic information of a node that used to be part of the mix network but has already unbonded.", + "type": "object", + "required": [ + "identity_key", + "owner", + "unbonding_height" + ], + "properties": { + "identity_key": { + "description": "Base58-encoded ed25519 EdDSA public key.", + "type": "string" + }, + "owner": { + "description": "Address of the owner of this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Entity who bonded this mixnode on behalf of the owner. If exists, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + }, + "unbonding_height": { + "description": "Block height at which this mixnode has unbonded.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } + }, + "get_unbonded_mix_nodes": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedUnbondedMixnodesResponse", + "description": "Response containing paged list of all mixnodes that have ever unbonded.", + "type": "object", + "required": [ + "nodes", + "per_page" + ], + "properties": { + "nodes": { + "description": "The past ids of unbonded mixnodes alongside their basic information such as the owner or the identity key.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + { + "$ref": "#/definitions/UnbondedMixnode" + } + ], + "maxItems": 2, + "minItems": 2 + } + }, + "per_page": { + "description": "Maximum number of entries that could be included in a response. `per_page <= nodes.len()`", + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "UnbondedMixnode": { + "description": "Basic information of a node that used to be part of the mix network but has already unbonded.", + "type": "object", + "required": [ + "identity_key", + "owner", + "unbonding_height" + ], + "properties": { + "identity_key": { + "description": "Base58-encoded ed25519 EdDSA public key.", + "type": "string" + }, + "owner": { + "description": "Address of the owner of this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Entity who bonded this mixnode on behalf of the owner. If exists, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + }, + "unbonding_height": { + "description": "Block height at which this mixnode has unbonded.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } + }, + "get_unbonded_mix_nodes_by_identity_key": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedUnbondedMixnodesResponse", + "description": "Response containing paged list of all mixnodes that have ever unbonded.", + "type": "object", + "required": [ + "nodes", + "per_page" + ], + "properties": { + "nodes": { + "description": "The past ids of unbonded mixnodes alongside their basic information such as the owner or the identity key.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + { + "$ref": "#/definitions/UnbondedMixnode" + } + ], + "maxItems": 2, + "minItems": 2 + } + }, + "per_page": { + "description": "Maximum number of entries that could be included in a response. `per_page <= nodes.len()`", + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "UnbondedMixnode": { + "description": "Basic information of a node that used to be part of the mix network but has already unbonded.", + "type": "object", + "required": [ + "identity_key", + "owner", + "unbonding_height" + ], + "properties": { + "identity_key": { + "description": "Base58-encoded ed25519 EdDSA public key.", + "type": "string" + }, + "owner": { + "description": "Address of the owner of this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Entity who bonded this mixnode on behalf of the owner. If exists, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + }, + "unbonding_height": { + "description": "Block height at which this mixnode has unbonded.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } + }, + "get_unbonded_mix_nodes_by_owner": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedUnbondedMixnodesResponse", + "description": "Response containing paged list of all mixnodes that have ever unbonded.", + "type": "object", + "required": [ + "nodes", + "per_page" + ], + "properties": { + "nodes": { + "description": "The past ids of unbonded mixnodes alongside their basic information such as the owner or the identity key.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + { + "$ref": "#/definitions/UnbondedMixnode" + } + ], + "maxItems": 2, + "minItems": 2 + } + }, + "per_page": { + "description": "Maximum number of entries that could be included in a response. `per_page <= nodes.len()`", + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "UnbondedMixnode": { + "description": "Basic information of a node that used to be part of the mix network but has already unbonded.", + "type": "object", + "required": [ + "identity_key", + "owner", + "unbonding_height" + ], + "properties": { + "identity_key": { + "description": "Base58-encoded ed25519 EdDSA public key.", + "type": "string" + }, + "owner": { + "description": "Address of the owner of this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Entity who bonded this mixnode on behalf of the owner. If exists, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + }, + "unbonding_height": { + "description": "Block height at which this mixnode has unbonded.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } + } + } +} diff --git a/contracts/mixnet/schema/execute_msg.json b/contracts/mixnet/schema/raw/execute.json similarity index 73% rename from contracts/mixnet/schema/execute_msg.json rename to contracts/mixnet/schema/raw/execute.json index b50d74a447..c4f1817fc9 100644 --- a/contracts/mixnet/schema/execute_msg.json +++ b/contracts/mixnet/schema/raw/execute.json @@ -23,7 +23,8 @@ "format": "uint32", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -38,17 +39,14 @@ "create_family": { "type": "object", "required": [ - "label", - "owner_signature" + "label" ], "properties": { "label": { "type": "string" - }, - "owner_signature": { - "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -64,16 +62,17 @@ "type": "object", "required": [ "family_head", - "signature" + "join_permit" ], "properties": { "family_head": { - "type": "string" + "$ref": "#/definitions/FamilyHead" }, - "signature": { - "type": "string" + "join_permit": { + "$ref": "#/definitions/MessageSignature" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -87,17 +86,14 @@ "leave_family": { "type": "object", "required": [ - "family_head", - "signature" + "family_head" ], "properties": { "family_head": { - "type": "string" - }, - "signature": { - "type": "string" + "$ref": "#/definitions/FamilyHead" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -111,17 +107,14 @@ "kick_family_member": { "type": "object", "required": [ - "member", - "signature" + "member" ], "properties": { "member": { "type": "string" - }, - "signature": { - "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -136,8 +129,7 @@ "type": "object", "required": [ "label", - "owner_address", - "owner_signature" + "owner_address" ], "properties": { "label": { @@ -145,17 +137,15 @@ }, "owner_address": { "type": "string" - }, - "owner_signature": { - "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { - "description": "Family head needs to sign the joining node IdentityKey", + "description": "Family head needs to sign the joining node IdentityKey, MixNode needs to provide its signature proving that it wants to join the family", "type": "object", "required": [ "join_family_on_behalf" @@ -165,20 +155,21 @@ "type": "object", "required": [ "family_head", - "member_address", - "signature" + "join_permit", + "member_address" ], "properties": { "family_head": { - "type": "string" + "$ref": "#/definitions/FamilyHead" + }, + "join_permit": { + "$ref": "#/definitions/MessageSignature" }, "member_address": { "type": "string" - }, - "signature": { - "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -193,20 +184,17 @@ "type": "object", "required": [ "family_head", - "member_address", - "signature" + "member_address" ], "properties": { "family_head": { - "type": "string" + "$ref": "#/definitions/FamilyHead" }, "member_address": { "type": "string" - }, - "signature": { - "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -221,8 +209,7 @@ "type": "object", "required": [ "head_address", - "member", - "signature" + "member" ], "properties": { "head_address": { @@ -230,11 +217,9 @@ }, "member": { "type": "string" - }, - "signature": { - "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -254,7 +239,8 @@ "address": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -274,7 +260,8 @@ "updated_parameters": { "$ref": "#/definitions/ContractStateParams" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -300,7 +287,8 @@ "force_immediately": { "type": "boolean" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -324,7 +312,8 @@ "updated_params": { "$ref": "#/definitions/IntervalRewardingParamsUpdate" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -356,7 +345,21 @@ "force_immediately": { "type": "boolean" } - } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "begin_epoch_transition" + ], + "properties": { + "begin_epoch_transition": { + "type": "object", + "additionalProperties": false } }, "additionalProperties": false @@ -385,7 +388,8 @@ "$ref": "#/definitions/LayerAssignment" } } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -407,7 +411,8 @@ "format": "uint32", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -433,9 +438,10 @@ "$ref": "#/definitions/MixNode" }, "owner_signature": { - "type": "string" + "$ref": "#/definitions/MessageSignature" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -465,9 +471,10 @@ "type": "string" }, "owner_signature": { - "type": "string" + "$ref": "#/definitions/MessageSignature" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -479,7 +486,8 @@ ], "properties": { "pledge_more": { - "type": "object" + "type": "object", + "additionalProperties": false } }, "additionalProperties": false @@ -499,7 +507,54 @@ "owner": { "type": "string" } - } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "decrease_pledge" + ], + "properties": { + "decrease_pledge": { + "type": "object", + "required": [ + "decrease_by" + ], + "properties": { + "decrease_by": { + "$ref": "#/definitions/Coin" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "decrease_pledge_on_behalf" + ], + "properties": { + "decrease_pledge_on_behalf": { + "type": "object", + "required": [ + "decrease_by", + "owner" + ], + "properties": { + "decrease_by": { + "$ref": "#/definitions/Coin" + }, + "owner": { + "type": "string" + } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -511,7 +566,8 @@ ], "properties": { "unbond_mixnode": { - "type": "object" + "type": "object", + "additionalProperties": false } }, "additionalProperties": false @@ -531,7 +587,8 @@ "owner": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -551,7 +608,8 @@ "new_costs": { "$ref": "#/definitions/MixNodeCostParams" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -575,7 +633,8 @@ "owner": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -595,7 +654,8 @@ "new_config": { "$ref": "#/definitions/MixNodeConfigUpdate" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -619,7 +679,8 @@ "owner": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -641,9 +702,10 @@ "$ref": "#/definitions/Gateway" }, "owner_signature": { - "type": "string" + "$ref": "#/definitions/MessageSignature" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -669,9 +731,10 @@ "type": "string" }, "owner_signature": { - "type": "string" + "$ref": "#/definitions/MessageSignature" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -683,7 +746,8 @@ ], "properties": { "unbond_gateway": { - "type": "object" + "type": "object", + "additionalProperties": false } }, "additionalProperties": false @@ -703,7 +767,54 @@ "owner": { "type": "string" } - } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_gateway_config" + ], + "properties": { + "update_gateway_config": { + "type": "object", + "required": [ + "new_config" + ], + "properties": { + "new_config": { + "$ref": "#/definitions/GatewayConfigUpdate" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_gateway_config_on_behalf" + ], + "properties": { + "update_gateway_config_on_behalf": { + "type": "object", + "required": [ + "new_config", + "owner" + ], + "properties": { + "new_config": { + "$ref": "#/definitions/GatewayConfigUpdate" + }, + "owner": { + "type": "string" + } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -725,7 +836,8 @@ "format": "uint32", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -751,7 +863,8 @@ "format": "uint32", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -773,7 +886,8 @@ "format": "uint32", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -799,7 +913,8 @@ "format": "uint32", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -825,7 +940,8 @@ "performance": { "$ref": "#/definitions/Percent" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -837,7 +953,8 @@ ], "properties": { "withdraw_operator_reward": { - "type": "object" + "type": "object", + "additionalProperties": false } }, "additionalProperties": false @@ -857,7 +974,8 @@ "owner": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -879,7 +997,8 @@ "format": "uint32", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -905,7 +1024,8 @@ "owner": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -928,6 +1048,7 @@ } }, "ContractStateParams": { + "description": "Contract parameters that could be adjusted in a transaction by the contract admin.", "type": "object", "required": [ "minimum_gateway_pledge", @@ -961,13 +1082,19 @@ } ] } - } + }, + "additionalProperties": false }, "Decimal": { "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", "type": "string" }, + "FamilyHead": { + "description": "Head of particular family as identified by its identity key (i.e. public component of its ed25519 keypair stringified into base58).", + "type": "string" + }, "Gateway": { + "description": "Information provided by the node operator during bonding that are used to allow other entities to use the services of this node.", "type": "object", "required": [ "clients_port", @@ -980,17 +1107,58 @@ ], "properties": { "clients_port": { + "description": "Port used by this gateway for listening for client requests.", "type": "integer", "format": "uint16", "minimum": 0.0 }, "host": { + "description": "Network address of this gateway, for example 1.1.1.1 or foo.gateway.com", "type": "string" }, "identity_key": { "description": "Base58 encoded ed25519 EdDSA public key of the gateway used to derive shared keys with clients", "type": "string" }, + "location": { + "description": "The physical, self-reported, location of this gateway.", + "type": "string" + }, + "mix_port": { + "description": "Port used by this gateway for listening for mix packets.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "sphinx_key": { + "description": "Base58-encoded x25519 public key used for sphinx key derivation.", + "type": "string" + }, + "version": { + "description": "The self-reported semver version of this gateway.", + "type": "string" + } + }, + "additionalProperties": false + }, + "GatewayConfigUpdate": { + "type": "object", + "required": [ + "clients_port", + "host", + "location", + "mix_port", + "version" + ], + "properties": { + "clients_port": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "host": { + "type": "string" + }, "location": { "type": "string" }, @@ -999,18 +1167,18 @@ "format": "uint16", "minimum": 0.0 }, - "sphinx_key": { - "type": "string" - }, "version": { "type": "string" } - } + }, + "additionalProperties": false }, "IntervalRewardingParamsUpdate": { + "description": "Specification on how the rewarding params should be updated.", "type": "object", "properties": { "active_set_work_factor": { + "description": "Defines the new value of the active set work factor.", "anyOf": [ { "$ref": "#/definitions/Decimal" @@ -1021,6 +1189,7 @@ ] }, "interval_pool_emission": { + "description": "Defines the new value of the interval pool emission rate.", "anyOf": [ { "$ref": "#/definitions/Percent" @@ -1031,6 +1200,7 @@ ] }, "reward_pool": { + "description": "Defines the new value of the reward pool.", "anyOf": [ { "$ref": "#/definitions/Decimal" @@ -1041,6 +1211,7 @@ ] }, "rewarded_set_size": { + "description": "Defines the new size of the rewarded set.", "type": [ "integer", "null" @@ -1049,6 +1220,7 @@ "minimum": 0.0 }, "staking_supply": { + "description": "Defines the new value of the staking supply.", "anyOf": [ { "$ref": "#/definitions/Decimal" @@ -1059,6 +1231,7 @@ ] }, "staking_supply_scale_factor": { + "description": "Defines the new value of the staking supply scale factor.", "anyOf": [ { "$ref": "#/definitions/Percent" @@ -1069,6 +1242,7 @@ ] }, "sybil_resistance_percent": { + "description": "Defines the new value of the sybil resistance percent.", "anyOf": [ { "$ref": "#/definitions/Percent" @@ -1078,7 +1252,8 @@ } ] } - } + }, + "additionalProperties": false }, "Layer": { "type": "string", @@ -1089,6 +1264,7 @@ ] }, "LayerAssignment": { + "description": "Specifies layer assignment for the given mixnode.", "type": "object", "required": [ "layer", @@ -1096,16 +1272,32 @@ ], "properties": { "layer": { - "$ref": "#/definitions/Layer" + "description": "The layer to which it's going to be assigned", + "allOf": [ + { + "$ref": "#/definitions/Layer" + } + ] }, "mix_id": { + "description": "The id of the mixnode.", "type": "integer", "format": "uint32", "minimum": 0.0 } + }, + "additionalProperties": false + }, + "MessageSignature": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 } }, "MixNode": { + "description": "Information provided by the node operator during bonding that are used to allow other entities to use the services of this node.", "type": "object", "required": [ "host", @@ -1118,10 +1310,11 @@ ], "properties": { "host": { - "description": "Network address of this mixnode, for example 1.1.1.1:1234 or foo.mixnode.com", + "description": "Network address of this mixnode, for example 1.1.1.1 or foo.mixnode.com", "type": "string" }, "http_api_port": { + "description": "Port used by this mixnode for its http(s) API", "type": "integer", "format": "uint16", "minimum": 0.0 @@ -1131,6 +1324,7 @@ "type": "string" }, "mix_port": { + "description": "Port used by this mixnode for listening for mix packets.", "type": "integer", "format": "uint16", "minimum": 0.0 @@ -1140,14 +1334,17 @@ "type": "string" }, "verloc_port": { + "description": "Port used by this mixnode for listening for verloc requests.", "type": "integer", "format": "uint16", "minimum": 0.0 }, "version": { + "description": "The self-reported semver version of this mixnode.", "type": "string" } - } + }, + "additionalProperties": false }, "MixNodeConfigUpdate": { "type": "object", @@ -1180,9 +1377,11 @@ "version": { "type": "string" } - } + }, + "additionalProperties": false }, "MixNodeCostParams": { + "description": "The cost parameters, or the cost function, defined for the particular mixnode that influences how the rewards should be split between the node operator and its delegators.", "type": "object", "required": [ "interval_operating_cost", @@ -1198,9 +1397,15 @@ ] }, "profit_margin_percent": { - "$ref": "#/definitions/Percent" + "description": "The profit margin of the associated mixnode, i.e. the desired percent of the reward to be distributed to the operator.", + "allOf": [ + { + "$ref": "#/definitions/Percent" + } + ] } - } + }, + "additionalProperties": false }, "Percent": { "description": "Percent represents a value between 0 and 100% (i.e. between 0.0 and 1.0)", diff --git a/contracts/mixnet/schema/instantiate_msg.json b/contracts/mixnet/schema/raw/instantiate.json similarity index 97% rename from contracts/mixnet/schema/instantiate_msg.json rename to contracts/mixnet/schema/raw/instantiate.json index 6d7c0ea33a..60cf202f08 100644 --- a/contracts/mixnet/schema/instantiate_msg.json +++ b/contracts/mixnet/schema/raw/instantiate.json @@ -32,6 +32,7 @@ "type": "string" } }, + "additionalProperties": false, "definitions": { "Decimal": { "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", @@ -97,7 +98,8 @@ "sybil_resistance": { "$ref": "#/definitions/Percent" } - } + }, + "additionalProperties": false }, "Percent": { "description": "Percent represents a value between 0 and 100% (i.e. between 0.0 and 1.0)", diff --git a/contracts/mixnet/schema/migrate_msg.json b/contracts/mixnet/schema/raw/migrate.json similarity index 85% rename from contracts/mixnet/schema/migrate_msg.json rename to contracts/mixnet/schema/raw/migrate.json index d1975efa64..e9962aaf92 100644 --- a/contracts/mixnet/schema/migrate_msg.json +++ b/contracts/mixnet/schema/raw/migrate.json @@ -9,5 +9,6 @@ "null" ] } - } + }, + "additionalProperties": false } diff --git a/contracts/mixnet/schema/query_msg.json b/contracts/mixnet/schema/raw/query.json similarity index 56% rename from contracts/mixnet/schema/query_msg.json rename to contracts/mixnet/schema/raw/query.json index a8dde27e0a..f4738a91fe 100644 --- a/contracts/mixnet/schema/query_msg.json +++ b/contracts/mixnet/schema/raw/query.json @@ -3,6 +3,7 @@ "title": "QueryMsg", "oneOf": [ { + "description": "Gets the list of families registered in this contract.", "type": "object", "required": [ "get_all_families_paged" @@ -12,6 +13,7 @@ "type": "object", "properties": { "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", "type": [ "integer", "null" @@ -20,17 +22,20 @@ "minimum": 0.0 }, "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", "type": [ "string", "null" ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets the list of all family members registered in this contract.", "type": "object", "required": [ "get_all_members_paged" @@ -40,6 +45,7 @@ "type": "object", "properties": { "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", "type": [ "integer", "null" @@ -48,17 +54,20 @@ "minimum": 0.0 }, "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", "type": [ "string", "null" ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Attempts to lookup family information given the family head.", "type": "object", "required": [ "get_family_by_head" @@ -73,12 +82,14 @@ "head": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Attempts to lookup family information given the family label.", "type": "object", "required": [ "get_family_by_label" @@ -93,12 +104,14 @@ "label": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Attempts to retrieve family members given the family head.", "type": "object", "required": [ "get_family_members_by_head" @@ -113,12 +126,14 @@ "head": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Attempts to retrieve family members given the family label.", "type": "object", "required": [ "get_family_members_by_label" @@ -133,84 +148,126 @@ "label": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets build information of this contract, such as the commit hash used for the build or rustc version.", "type": "object", "required": [ "get_contract_version" ], "properties": { "get_contract_version": { - "type": "object" + "type": "object", + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets the stored contract version information that's required by the CW2 spec interface for migrations.", + "type": "object", + "required": [ + "get_cw2_contract_version" + ], + "properties": { + "get_cw2_contract_version": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the address of the validator that's allowed to send rewarding transactions and transition the epoch.", "type": "object", "required": [ "get_rewarding_validator_address" ], "properties": { "get_rewarding_validator_address": { - "type": "object" + "type": "object", + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets the contract parameters that could be adjusted in a transaction by the contract admin.", "type": "object", "required": [ "get_state_params" ], "properties": { "get_state_params": { - "type": "object" + "type": "object", + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets the current state of the contract.", "type": "object", "required": [ "get_state" ], "properties": { "get_state": { - "type": "object" + "type": "object", + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets the current parameters used for reward calculation.", "type": "object", "required": [ "get_rewarding_params" ], "properties": { "get_rewarding_params": { - "type": "object" + "type": "object", + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets the status of the current rewarding epoch.", + "type": "object", + "required": [ + "get_epoch_status" + ], + "properties": { + "get_epoch_status": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Get the details of the current rewarding interval.", "type": "object", "required": [ "get_current_interval_details" ], "properties": { "get_current_interval_details": { - "type": "object" + "type": "object", + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets the current list of mixnodes in the rewarded set.", "type": "object", "required": [ "get_rewarded_set" @@ -220,6 +277,7 @@ "type": "object", "properties": { "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", "type": [ "integer", "null" @@ -228,6 +286,7 @@ "minimum": 0.0 }, "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", "type": [ "integer", "null" @@ -235,12 +294,14 @@ "format": "uint32", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets the basic list of all currently bonded mixnodes.", "type": "object", "required": [ "get_mix_node_bonds" @@ -250,6 +311,7 @@ "type": "object", "properties": { "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", "type": [ "integer", "null" @@ -258,6 +320,7 @@ "minimum": 0.0 }, "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", "type": [ "integer", "null" @@ -265,12 +328,14 @@ "format": "uint32", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets the detailed list of all currently bonded mixnodes.", "type": "object", "required": [ "get_mix_nodes_detailed" @@ -280,6 +345,7 @@ "type": "object", "properties": { "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", "type": [ "integer", "null" @@ -288,6 +354,7 @@ "minimum": 0.0 }, "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", "type": [ "integer", "null" @@ -295,12 +362,14 @@ "format": "uint32", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets the basic list of all unbonded mixnodes.", "type": "object", "required": [ "get_unbonded_mix_nodes" @@ -310,6 +379,7 @@ "type": "object", "properties": { "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", "type": [ "integer", "null" @@ -318,6 +388,7 @@ "minimum": 0.0 }, "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", "type": [ "integer", "null" @@ -325,12 +396,14 @@ "format": "uint32", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets the basic list of all unbonded mixnodes that belonged to a particular owner.", "type": "object", "required": [ "get_unbonded_mix_nodes_by_owner" @@ -343,6 +416,7 @@ ], "properties": { "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", "type": [ "integer", "null" @@ -351,9 +425,11 @@ "minimum": 0.0 }, "owner": { + "description": "The address of the owner of the the mixnodes used for the query.", "type": "string" }, "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", "type": [ "integer", "null" @@ -361,12 +437,14 @@ "format": "uint32", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets the basic list of all unbonded mixnodes that used the particular identity key.", "type": "object", "required": [ "get_unbonded_mix_nodes_by_identity_key" @@ -379,9 +457,11 @@ ], "properties": { "identity_key": { + "description": "The identity key (base58-encoded ed25519 public key) of the mixnode used for the query.", "type": "string" }, "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", "type": [ "integer", "null" @@ -390,6 +470,7 @@ "minimum": 0.0 }, "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", "type": [ "integer", "null" @@ -397,12 +478,14 @@ "format": "uint32", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets the detailed mixnode information belonging to the particular owner.", "type": "object", "required": [ "get_owned_mixnode" @@ -415,14 +498,17 @@ ], "properties": { "address": { + "description": "Address of the mixnode owner to use for the query.", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets the detailed mixnode information of a node with the provided id.", "type": "object", "required": [ "get_mixnode_details" @@ -435,16 +521,19 @@ ], "properties": { "mix_id": { + "description": "Id of the node to query.", "type": "integer", "format": "uint32", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets the rewarding information of a mixnode with the provided id.", "type": "object", "required": [ "get_mixnode_rewarding_details" @@ -457,16 +546,19 @@ ], "properties": { "mix_id": { + "description": "Id of the node to query.", "type": "integer", "format": "uint32", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets the stake saturation of a mixnode with the provided id.", "type": "object", "required": [ "get_stake_saturation" @@ -479,16 +571,19 @@ ], "properties": { "mix_id": { + "description": "Id of the node to query.", "type": "integer", "format": "uint32", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets the basic information of an unbonded mixnode with the provided id.", "type": "object", "required": [ "get_unbonded_mix_node_information" @@ -501,16 +596,19 @@ ], "properties": { "mix_id": { + "description": "Id of the node to query.", "type": "integer", "format": "uint32", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets the detailed mixnode information of a node given its current identity key.", "type": "object", "required": [ "get_bonded_mixnode_details_by_identity" @@ -523,26 +621,31 @@ ], "properties": { "mix_identity": { + "description": "The identity key (base58-encoded ed25519 public key) of the mixnode used for the query.", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets the current layer configuration of the mix network.", "type": "object", "required": [ "get_layer_distribution" ], "properties": { "get_layer_distribution": { - "type": "object" + "type": "object", + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets the basic list of all currently bonded gateways.", "type": "object", "required": [ "get_gateways" @@ -552,6 +655,7 @@ "type": "object", "properties": { "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", "type": [ "integer", "null" @@ -560,17 +664,20 @@ "minimum": 0.0 }, "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", "type": [ "string", "null" ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets the gateway details of a node given its identity key.", "type": "object", "required": [ "get_gateway_bond" @@ -583,14 +690,17 @@ ], "properties": { "identity": { + "description": "The identity key (base58-encoded ed25519 public key) of the gateway used for the query.", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets the detailed gateway information belonging to the particular owner.", "type": "object", "required": [ "get_owned_gateway" @@ -603,14 +713,17 @@ ], "properties": { "address": { + "description": "Address of the gateway owner to use for the query.", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets all delegations associated with particular mixnode", "type": "object", "required": [ "get_mixnode_delegations" @@ -623,6 +736,7 @@ ], "properties": { "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", "type": [ "integer", "null" @@ -631,22 +745,26 @@ "minimum": 0.0 }, "mix_id": { + "description": "Id of the node to query.", "type": "integer", "format": "uint32", "minimum": 0.0 }, "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", "type": [ "string", "null" ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets all delegations associated with particular delegator", "type": "object", "required": [ "get_delegator_delegations" @@ -659,9 +777,11 @@ ], "properties": { "delegator": { + "description": "The address of the owner of the delegations.", "type": "string" }, "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", "type": [ "integer", "null" @@ -670,6 +790,7 @@ "minimum": 0.0 }, "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", "type": [ "array", "null" @@ -687,12 +808,14 @@ "maxItems": 2, "minItems": 2 } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets delegation information associated with particular mixnode - delegator pair", "type": "object", "required": [ "get_delegation_details" @@ -706,25 +829,30 @@ ], "properties": { "delegator": { + "description": "The address of the owner of the delegation.", "type": "string" }, "mix_id": { + "description": "Id of the node to query.", "type": "integer", "format": "uint32", "minimum": 0.0 }, "proxy": { + "description": "Entity who made the delegation on behalf of the owner. If present, it's most likely the address of the vesting contract.", "type": [ "string", "null" ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets all delegations in the system", "type": "object", "required": [ "get_all_delegations" @@ -734,6 +862,7 @@ "type": "object", "properties": { "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", "type": [ "integer", "null" @@ -742,6 +871,7 @@ "minimum": 0.0 }, "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", "type": [ "array", "null" @@ -759,12 +889,14 @@ "maxItems": 2, "minItems": 2 } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets the reward amount accrued by the node operator that has not yet been claimed.", "type": "object", "required": [ "get_pending_operator_reward" @@ -777,14 +909,17 @@ ], "properties": { "address": { + "description": "Address of the operator to use for the query.", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets the reward amount accrued by the particular mixnode that has not yet been claimed.", "type": "object", "required": [ "get_pending_mix_node_operator_reward" @@ -797,16 +932,19 @@ ], "properties": { "mix_id": { + "description": "Id of the node to query.", "type": "integer", "format": "uint32", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets the reward amount accrued by the particular delegator that has not yet been claimed.", "type": "object", "required": [ "get_pending_delegator_reward" @@ -820,25 +958,30 @@ ], "properties": { "address": { + "description": "Address of the delegator to use for the query.", "type": "string" }, "mix_id": { + "description": "Id of the node to query.", "type": "integer", "format": "uint32", "minimum": 0.0 }, "proxy": { + "description": "Entity who made the delegation on behalf of the owner. If present, it's most likely the address of the vesting contract.", "type": [ "string", "null" ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Given the provided node performance, attempt to estimate the operator reward for the current epoch.", "type": "object", "required": [ "get_estimated_current_epoch_operator_reward" @@ -852,19 +995,27 @@ ], "properties": { "estimated_performance": { - "$ref": "#/definitions/Percent" + "description": "The estimated performance for the current epoch of the given node.", + "allOf": [ + { + "$ref": "#/definitions/Percent" + } + ] }, "mix_id": { + "description": "Id of the node to query.", "type": "integer", "format": "uint32", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Given the provided node performance, attempt to estimate the delegator reward for the current epoch.", "type": "object", "required": [ "get_estimated_current_epoch_delegator_reward" @@ -879,28 +1030,38 @@ ], "properties": { "address": { + "description": "Address of the delegator to use for the query.", "type": "string" }, "estimated_performance": { - "$ref": "#/definitions/Percent" + "description": "The estimated performance for the current epoch of the given node.", + "allOf": [ + { + "$ref": "#/definitions/Percent" + } + ] }, "mix_id": { + "description": "Id of the node to query.", "type": "integer", "format": "uint32", "minimum": 0.0 }, "proxy": { + "description": "Entity who made the delegation on behalf of the owner. If present, it's most likely the address of the vesting contract.", "type": [ "string", "null" ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets the list of all currently pending epoch events that will be resolved once the current epoch finishes.", "type": "object", "required": [ "get_pending_epoch_events" @@ -910,6 +1071,7 @@ "type": "object", "properties": { "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", "type": [ "integer", "null" @@ -918,6 +1080,7 @@ "minimum": 0.0 }, "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", "type": [ "integer", "null" @@ -925,12 +1088,14 @@ "format": "uint32", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Gets the list of all currently pending interval events that will be resolved once the current interval finishes.", "type": "object", "required": [ "get_pending_interval_events" @@ -940,6 +1105,7 @@ "type": "object", "properties": { "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", "type": [ "integer", "null" @@ -948,6 +1114,7 @@ "minimum": 0.0 }, "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", "type": [ "integer", "null" @@ -955,7 +1122,95 @@ "format": "uint32", "minimum": 0.0 } - } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets detailed information about a pending epoch event given its id.", + "type": "object", + "required": [ + "get_pending_epoch_event" + ], + "properties": { + "get_pending_epoch_event": { + "type": "object", + "required": [ + "event_id" + ], + "properties": { + "event_id": { + "description": "The unique id associated with the event.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets detailed information about a pending interval event given its id.", + "type": "object", + "required": [ + "get_pending_interval_event" + ], + "properties": { + "get_pending_interval_event": { + "type": "object", + "required": [ + "event_id" + ], + "properties": { + "event_id": { + "description": "The unique id associated with the event.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the information about the number of currently pending epoch and interval events.", + "type": "object", + "required": [ + "get_number_of_pending_events" + ], + "properties": { + "get_number_of_pending_events": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the signing nonce associated with the particular cosmos address.", + "type": "object", + "required": [ + "get_signing_nonce" + ], + "properties": { + "get_signing_nonce": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "description": "Cosmos address used for the query of the signing nonce.", + "type": "string" + } + }, + "additionalProperties": false } }, "additionalProperties": false diff --git a/contracts/mixnet/schema/raw/response_to_get_all_delegations.json b/contracts/mixnet/schema/raw/response_to_get_all_delegations.json new file mode 100644 index 0000000000..a919220c46 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_all_delegations.json @@ -0,0 +1,128 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedAllDelegationsResponse", + "description": "Response containing paged list of all delegations currently active.", + "type": "object", + "required": [ + "delegations" + ], + "properties": { + "delegations": { + "description": "Each individual delegation made.", + "type": "array", + "items": { + "$ref": "#/definitions/Delegation" + } + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "array", + "null" + ], + "items": [ + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + { + "type": "string" + } + ], + "maxItems": 2, + "minItems": 2 + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Delegation": { + "description": "Information about tokens being delegated towards given mixnode in order to accrue rewards with their work.", + "type": "object", + "required": [ + "amount", + "cumulative_reward_ratio", + "height", + "mix_id", + "owner" + ], + "properties": { + "amount": { + "description": "Original delegation amount. Note that it is never mutated as delegation accumulates rewards.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "cumulative_reward_ratio": { + "description": "Value of the \"unit delegation\" associated with the mixnode at the time of delegation.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "height": { + "description": "Block height where this delegation occurred.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "mix_id": { + "description": "Id of the MixNode that this delegation was performed against.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "description": "Address of the owner of this delegation.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Proxy address used to delegate the funds on behalf of another address", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_all_families_paged.json b/contracts/mixnet/schema/raw/response_to_get_all_families_paged.json new file mode 100644 index 0000000000..6744e15be6 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_all_families_paged.json @@ -0,0 +1,62 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedFamiliesResponse", + "description": "Response containing paged list of all families registered in the contract.", + "type": "object", + "required": [ + "families" + ], + "properties": { + "families": { + "description": "The families registered in the contract.", + "type": "array", + "items": { + "$ref": "#/definitions/Family" + } + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false, + "definitions": { + "Family": { + "description": "A group of mixnodes associated with particular staking entity. When defined all nodes belonging to the same family will be prioritised to be put onto the same layer.", + "type": "object", + "required": [ + "head", + "label" + ], + "properties": { + "head": { + "description": "Owner of this family.", + "allOf": [ + { + "$ref": "#/definitions/FamilyHead" + } + ] + }, + "label": { + "description": "Human readable label for this family.", + "type": "string" + }, + "proxy": { + "description": "Optional proxy (i.e. vesting contract address) used when creating the family.", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + }, + "FamilyHead": { + "description": "Head of particular family as identified by its identity key (i.e. public component of its ed25519 keypair stringified into base58).", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_all_members_paged.json b/contracts/mixnet/schema/raw/response_to_get_all_members_paged.json new file mode 100644 index 0000000000..69da663f92 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_all_members_paged.json @@ -0,0 +1,42 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedMembersResponse", + "description": "Response containing paged list of all family members (of ALL families) registered in the contract.", + "type": "object", + "required": [ + "members" + ], + "properties": { + "members": { + "description": "The members alongside their family heads.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/FamilyHead" + } + ], + "maxItems": 2, + "minItems": 2 + } + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false, + "definitions": { + "FamilyHead": { + "description": "Head of particular family as identified by its identity key (i.e. public component of its ed25519 keypair stringified into base58).", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_bonded_mixnode_details_by_identity.json b/contracts/mixnet/schema/raw/response_to_get_bonded_mixnode_details_by_identity.json new file mode 100644 index 0000000000..59fc029331 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_bonded_mixnode_details_by_identity.json @@ -0,0 +1,342 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MixnodeDetailsByIdentityResponse", + "description": "Response containing details of a bonded mixnode with the provided identity key.", + "type": "object", + "required": [ + "identity_key" + ], + "properties": { + "identity_key": { + "description": "The identity key (base58-encoded ed25519 public key) of the mixnode.", + "type": "string" + }, + "mixnode_details": { + "description": "If there exists a bonded mixnode with the provided identity key, this field contains its detailed information.", + "anyOf": [ + { + "$ref": "#/definitions/MixNodeDetails" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Layer": { + "type": "string", + "enum": [ + "One", + "Two", + "Three" + ] + }, + "MixNode": { + "description": "Information provided by the node operator during bonding that are used to allow other entities to use the services of this node.", + "type": "object", + "required": [ + "host", + "http_api_port", + "identity_key", + "mix_port", + "sphinx_key", + "verloc_port", + "version" + ], + "properties": { + "host": { + "description": "Network address of this mixnode, for example 1.1.1.1 or foo.mixnode.com", + "type": "string" + }, + "http_api_port": { + "description": "Port used by this mixnode for its http(s) API", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "identity_key": { + "description": "Base58-encoded ed25519 EdDSA public key.", + "type": "string" + }, + "mix_port": { + "description": "Port used by this mixnode for listening for mix packets.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "sphinx_key": { + "description": "Base58-encoded x25519 public key used for sphinx key derivation.", + "type": "string" + }, + "verloc_port": { + "description": "Port used by this mixnode for listening for verloc requests.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "version": { + "description": "The self-reported semver version of this mixnode.", + "type": "string" + } + }, + "additionalProperties": false + }, + "MixNodeBond": { + "description": "Basic mixnode information provided by the node operator.", + "type": "object", + "required": [ + "bonding_height", + "is_unbonding", + "layer", + "mix_id", + "mix_node", + "original_pledge", + "owner" + ], + "properties": { + "bonding_height": { + "description": "Block height at which this mixnode has been bonded.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "is_unbonding": { + "description": "Flag to indicate whether this node is in the process of unbonding, that will conclude upon the epoch finishing.", + "type": "boolean" + }, + "layer": { + "description": "Layer assigned to this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/Layer" + } + ] + }, + "mix_id": { + "description": "Unique id assigned to the bonded mixnode.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "mix_node": { + "description": "Information provided by the operator for the purposes of bonding.", + "allOf": [ + { + "$ref": "#/definitions/MixNode" + } + ] + }, + "original_pledge": { + "description": "Original amount pledged by the operator of this node.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "owner": { + "description": "Address of the owner of this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Entity who bonded this mixnode on behalf of the owner. If exists, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeCostParams": { + "description": "The cost parameters, or the cost function, defined for the particular mixnode that influences how the rewards should be split between the node operator and its delegators.", + "type": "object", + "required": [ + "interval_operating_cost", + "profit_margin_percent" + ], + "properties": { + "interval_operating_cost": { + "description": "Operating cost of the associated mixnode per the entire interval.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "profit_margin_percent": { + "description": "The profit margin of the associated mixnode, i.e. the desired percent of the reward to be distributed to the operator.", + "allOf": [ + { + "$ref": "#/definitions/Percent" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeDetails": { + "description": "Full details associated with given mixnode.", + "type": "object", + "required": [ + "bond_information", + "rewarding_details" + ], + "properties": { + "bond_information": { + "description": "Basic bond information of this mixnode, such as owner address, original pledge, etc.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeBond" + } + ] + }, + "pending_changes": { + "description": "Adjustments to the mixnode that are ought to happen during future epoch transitions.", + "default": { + "pledge_change": null + }, + "allOf": [ + { + "$ref": "#/definitions/PendingMixNodeChanges" + } + ] + }, + "rewarding_details": { + "description": "Details used for computation of rewarding related data.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeRewarding" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeRewarding": { + "type": "object", + "required": [ + "cost_params", + "delegates", + "last_rewarded_epoch", + "operator", + "total_unit_reward", + "unique_delegations", + "unit_delegation" + ], + "properties": { + "cost_params": { + "description": "Information provided by the operator that influence the cost function.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeCostParams" + } + ] + }, + "delegates": { + "description": "Total delegation and compounded reward earned by all node delegators.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "last_rewarded_epoch": { + "description": "Marks the epoch when this node was last rewarded so that we wouldn't accidentally attempt to reward it multiple times in the same epoch.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "operator": { + "description": "Total pledge and compounded reward earned by the node operator.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "total_unit_reward": { + "description": "Cumulative reward earned by the \"unit delegation\" since the block 0.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "unique_delegations": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "unit_delegation": { + "description": "Value of the theoretical \"unit delegation\" that has delegated to this mixnode at block 0.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + } + }, + "additionalProperties": false + }, + "PendingMixNodeChanges": { + "type": "object", + "properties": { + "pledge_change": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "Percent": { + "description": "Percent represents a value between 0 and 100% (i.e. between 0.0 and 1.0)", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_c_w2_contract_version.json b/contracts/mixnet/schema/raw/response_to_get_c_w2_contract_version.json new file mode 100644 index 0000000000..3ded8c84d9 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_c_w2_contract_version.json @@ -0,0 +1,20 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ContractVersion", + "type": "object", + "required": [ + "contract", + "version" + ], + "properties": { + "contract": { + "description": "contract is the crate name of the implementing contract, eg. `crate:cw20-base` we will use other prefixes for other languages, and their standard global namespacing", + "type": "string" + }, + "version": { + "description": "version is any string that this implementation knows. It may be simple counter \"1\", \"2\". or semantic version on release tags \"v0.7.0\", or some custom feature flag list. the only code that needs to understand the version parsing is code that knows how to migrate from the given contract (and is tied to it's implementation somehow)", + "type": "string" + } + }, + "additionalProperties": false +} diff --git a/contracts/mixnet/schema/raw/response_to_get_contract_version.json b/contracts/mixnet/schema/raw/response_to_get_contract_version.json new file mode 100644 index 0000000000..60ae65f3d1 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_contract_version.json @@ -0,0 +1,40 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ContractBuildInformation", + "type": "object", + "required": [ + "build_timestamp", + "build_version", + "commit_branch", + "commit_sha", + "commit_timestamp", + "rustc_version" + ], + "properties": { + "build_timestamp": { + "description": "Provides the build timestamp, for example `2021-02-23T20:14:46.558472672+00:00`.", + "type": "string" + }, + "build_version": { + "description": "Provides the build version, for example `0.1.0-9-g46f83e1`.", + "type": "string" + }, + "commit_branch": { + "description": "Provides the name of the git branch that was used for the build, for example `master`.", + "type": "string" + }, + "commit_sha": { + "description": "Provides the hash of the commit that was used for the build, for example `46f83e112520533338245862d366f6a02cef07d4`.", + "type": "string" + }, + "commit_timestamp": { + "description": "Provides the timestamp of the commit that was used for the build, for example `2021-02-23T08:08:02-05:00`.", + "type": "string" + }, + "rustc_version": { + "description": "Provides the rustc version that was used for the build, for example `1.52.0-nightly`.", + "type": "string" + } + }, + "additionalProperties": false +} diff --git a/contracts/mixnet/schema/raw/response_to_get_current_interval_details.json b/contracts/mixnet/schema/raw/response_to_get_current_interval_details.json new file mode 100644 index 0000000000..1a90ceb1eb --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_current_interval_details.json @@ -0,0 +1,97 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "CurrentIntervalResponse", + "description": "Information about the current rewarding interval.", + "type": "object", + "required": [ + "current_blocktime", + "interval", + "is_current_epoch_over", + "is_current_interval_over" + ], + "properties": { + "current_blocktime": { + "description": "The current blocktime", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "interval": { + "description": "Detailed information about the underlying interval.", + "allOf": [ + { + "$ref": "#/definitions/Interval" + } + ] + }, + "is_current_epoch_over": { + "description": "Flag indicating whether the current epoch is over and it should be advanced.", + "type": "boolean" + }, + "is_current_interval_over": { + "description": "Flag indicating whether the current interval is over and it should be advanced.", + "type": "boolean" + } + }, + "additionalProperties": false, + "definitions": { + "Duration": { + "type": "object", + "required": [ + "nanos", + "secs" + ], + "properties": { + "nanos": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "secs": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "Interval": { + "type": "object", + "required": [ + "current_epoch_id", + "current_epoch_start", + "epoch_length", + "epochs_in_interval", + "id", + "total_elapsed_epochs" + ], + "properties": { + "current_epoch_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "current_epoch_start": { + "type": "string" + }, + "epoch_length": { + "$ref": "#/definitions/Duration" + }, + "epochs_in_interval": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "total_elapsed_epochs": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_delegation_details.json b/contracts/mixnet/schema/raw/response_to_get_delegation_details.json new file mode 100644 index 0000000000..8371493b30 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_delegation_details.json @@ -0,0 +1,117 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MixNodeDelegationResponse", + "description": "Response containing delegation details.", + "type": "object", + "required": [ + "mixnode_still_bonded" + ], + "properties": { + "delegation": { + "description": "If the delegation exists, this field contains its detailed information.", + "anyOf": [ + { + "$ref": "#/definitions/Delegation" + }, + { + "type": "null" + } + ] + }, + "mixnode_still_bonded": { + "description": "Flag indicating whether the node towards which the delegation was made is still bonded in the network.", + "type": "boolean" + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Delegation": { + "description": "Information about tokens being delegated towards given mixnode in order to accrue rewards with their work.", + "type": "object", + "required": [ + "amount", + "cumulative_reward_ratio", + "height", + "mix_id", + "owner" + ], + "properties": { + "amount": { + "description": "Original delegation amount. Note that it is never mutated as delegation accumulates rewards.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "cumulative_reward_ratio": { + "description": "Value of the \"unit delegation\" associated with the mixnode at the time of delegation.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "height": { + "description": "Block height where this delegation occurred.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "mix_id": { + "description": "Id of the MixNode that this delegation was performed against.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "description": "Address of the owner of this delegation.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Proxy address used to delegate the funds on behalf of another address", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_delegator_delegations.json b/contracts/mixnet/schema/raw/response_to_get_delegator_delegations.json new file mode 100644 index 0000000000..b6e7e7a6ee --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_delegator_delegations.json @@ -0,0 +1,128 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedDelegatorDelegationsResponse", + "description": "Response containing paged list of all delegations made by the particular address.", + "type": "object", + "required": [ + "delegations" + ], + "properties": { + "delegations": { + "description": "Each individual delegation made.", + "type": "array", + "items": { + "$ref": "#/definitions/Delegation" + } + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "array", + "null" + ], + "items": [ + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + { + "type": "string" + } + ], + "maxItems": 2, + "minItems": 2 + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Delegation": { + "description": "Information about tokens being delegated towards given mixnode in order to accrue rewards with their work.", + "type": "object", + "required": [ + "amount", + "cumulative_reward_ratio", + "height", + "mix_id", + "owner" + ], + "properties": { + "amount": { + "description": "Original delegation amount. Note that it is never mutated as delegation accumulates rewards.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "cumulative_reward_ratio": { + "description": "Value of the \"unit delegation\" associated with the mixnode at the time of delegation.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "height": { + "description": "Block height where this delegation occurred.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "mix_id": { + "description": "Id of the MixNode that this delegation was performed against.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "description": "Address of the owner of this delegation.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Proxy address used to delegate the funds on behalf of another address", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_epoch_status.json b/contracts/mixnet/schema/raw/response_to_get_epoch_status.json new file mode 100644 index 0000000000..1a85e633bf --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_epoch_status.json @@ -0,0 +1,93 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "EpochStatus", + "description": "The status of the current rewarding epoch.", + "type": "object", + "required": [ + "being_advanced_by", + "state" + ], + "properties": { + "being_advanced_by": { + "description": "Specifies either, which validator is currently performing progression into the following epoch (if the epoch is currently being progressed), or which validator was responsible for progressing into the current epoch (if the epoch is currently in progress)", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "state": { + "description": "The concrete state of the epoch.", + "allOf": [ + { + "$ref": "#/definitions/EpochState" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "EpochState": { + "description": "The state of the current rewarding epoch.", + "oneOf": [ + { + "description": "Represents the state of an epoch that's in progress (well, duh.) All actions are allowed to be issued.", + "type": "string", + "enum": [ + "in_progress" + ] + }, + { + "description": "Represents the state of an epoch when the rewarding entity has been decided on, and the mixnodes are in the process of being rewarded for their work in this epoch.", + "type": "object", + "required": [ + "rewarding" + ], + "properties": { + "rewarding": { + "type": "object", + "required": [ + "final_node_id", + "last_rewarded" + ], + "properties": { + "final_node_id": { + "description": "The id of the last node that's going to be rewarded before progressing into the next state.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "last_rewarded": { + "description": "The id of the last node that has already received its rewards.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Represents the state of an epoch when all mixnodes have already been rewarded for their work in this epoch and all issued actions should now get resolved before being allowed to advance into the next epoch.", + "type": "string", + "enum": [ + "reconciling_events" + ] + }, + { + "description": "Represents the state of an epoch when all mixnodes have already been rewarded for their work in this epoch, all issued actions got resolved and the epoch should now be advanced whilst assigning new rewarded set.", + "type": "string", + "enum": [ + "advancing_epoch" + ] + } + ] + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_estimated_current_epoch_delegator_reward.json b/contracts/mixnet/schema/raw/response_to_get_estimated_current_epoch_delegator_reward.json new file mode 100644 index 0000000000..94ca8beb78 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_estimated_current_epoch_delegator_reward.json @@ -0,0 +1,89 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "EstimatedCurrentEpochRewardResponse", + "description": "Response containing estimation of node rewards for the current epoch.", + "type": "object", + "properties": { + "current_stake_value": { + "description": "The current stake value given all past rewarding and compounding since the original staking was performed.", + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + }, + "current_stake_value_detailed_amount": { + "description": "The current stake value. Note that it's nearly identical to `current_stake_value`, however, it contains few additional decimal points for more accurate reward calculation.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "detailed_estimation_amount": { + "description": "The full reward estimation. Note that it's nearly identical to `estimation`, however, it contains few additional decimal points for more accurate reward calculation.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "estimation": { + "description": "The reward estimation for the current epoch, i.e. the amount of tokens that could be claimable after the epoch finishes and the state of the network does not change.", + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + }, + "original_stake": { + "description": "The amount of tokens initially staked.", + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_estimated_current_epoch_operator_reward.json b/contracts/mixnet/schema/raw/response_to_get_estimated_current_epoch_operator_reward.json new file mode 100644 index 0000000000..94ca8beb78 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_estimated_current_epoch_operator_reward.json @@ -0,0 +1,89 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "EstimatedCurrentEpochRewardResponse", + "description": "Response containing estimation of node rewards for the current epoch.", + "type": "object", + "properties": { + "current_stake_value": { + "description": "The current stake value given all past rewarding and compounding since the original staking was performed.", + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + }, + "current_stake_value_detailed_amount": { + "description": "The current stake value. Note that it's nearly identical to `current_stake_value`, however, it contains few additional decimal points for more accurate reward calculation.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "detailed_estimation_amount": { + "description": "The full reward estimation. Note that it's nearly identical to `estimation`, however, it contains few additional decimal points for more accurate reward calculation.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "estimation": { + "description": "The reward estimation for the current epoch, i.e. the amount of tokens that could be claimable after the epoch finishes and the state of the network does not change.", + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + }, + "original_stake": { + "description": "The amount of tokens initially staked.", + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_family_by_head.json b/contracts/mixnet/schema/raw/response_to_get_family_by_head.json new file mode 100644 index 0000000000..d7bc69b639 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_family_by_head.json @@ -0,0 +1,67 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "FamilyByHeadResponse", + "description": "Response containing family information.", + "type": "object", + "required": [ + "head" + ], + "properties": { + "family": { + "description": "If applicable, the family associated with the provided head.", + "anyOf": [ + { + "$ref": "#/definitions/Family" + }, + { + "type": "null" + } + ] + }, + "head": { + "description": "The family head used for the query.", + "allOf": [ + { + "$ref": "#/definitions/FamilyHead" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Family": { + "description": "A group of mixnodes associated with particular staking entity. When defined all nodes belonging to the same family will be prioritised to be put onto the same layer.", + "type": "object", + "required": [ + "head", + "label" + ], + "properties": { + "head": { + "description": "Owner of this family.", + "allOf": [ + { + "$ref": "#/definitions/FamilyHead" + } + ] + }, + "label": { + "description": "Human readable label for this family.", + "type": "string" + }, + "proxy": { + "description": "Optional proxy (i.e. vesting contract address) used when creating the family.", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + }, + "FamilyHead": { + "description": "Head of particular family as identified by its identity key (i.e. public component of its ed25519 keypair stringified into base58).", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_family_by_label.json b/contracts/mixnet/schema/raw/response_to_get_family_by_label.json new file mode 100644 index 0000000000..c007bd05dc --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_family_by_label.json @@ -0,0 +1,63 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "FamilyByLabelResponse", + "description": "Response containing family information.", + "type": "object", + "required": [ + "label" + ], + "properties": { + "family": { + "description": "If applicable, the family associated with the provided label.", + "anyOf": [ + { + "$ref": "#/definitions/Family" + }, + { + "type": "null" + } + ] + }, + "label": { + "description": "The family label used for the query.", + "type": "string" + } + }, + "additionalProperties": false, + "definitions": { + "Family": { + "description": "A group of mixnodes associated with particular staking entity. When defined all nodes belonging to the same family will be prioritised to be put onto the same layer.", + "type": "object", + "required": [ + "head", + "label" + ], + "properties": { + "head": { + "description": "Owner of this family.", + "allOf": [ + { + "$ref": "#/definitions/FamilyHead" + } + ] + }, + "label": { + "description": "Human readable label for this family.", + "type": "string" + }, + "proxy": { + "description": "Optional proxy (i.e. vesting contract address) used when creating the family.", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + }, + "FamilyHead": { + "description": "Head of particular family as identified by its identity key (i.e. public component of its ed25519 keypair stringified into base58).", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_family_members_by_head.json b/contracts/mixnet/schema/raw/response_to_get_family_members_by_head.json new file mode 100644 index 0000000000..7975599604 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_family_members_by_head.json @@ -0,0 +1,34 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "FamilyMembersByHeadResponse", + "description": "Response containing family members information.", + "type": "object", + "required": [ + "head", + "members" + ], + "properties": { + "head": { + "description": "The family head used for the query.", + "allOf": [ + { + "$ref": "#/definitions/FamilyHead" + } + ] + }, + "members": { + "description": "All members belonging to the specified family.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "definitions": { + "FamilyHead": { + "description": "Head of particular family as identified by its identity key (i.e. public component of its ed25519 keypair stringified into base58).", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_family_members_by_label.json b/contracts/mixnet/schema/raw/response_to_get_family_members_by_label.json new file mode 100644 index 0000000000..a76bb07f7d --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_family_members_by_label.json @@ -0,0 +1,24 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "FamilyMembersByLabelResponse", + "description": "Response containing family members information.", + "type": "object", + "required": [ + "label", + "members" + ], + "properties": { + "label": { + "description": "The family label used for the query.", + "type": "string" + }, + "members": { + "description": "All members belonging to the specified family.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false +} diff --git a/contracts/mixnet/schema/raw/response_to_get_gateway_bond.json b/contracts/mixnet/schema/raw/response_to_get_gateway_bond.json new file mode 100644 index 0000000000..dd7f99b4a4 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_gateway_bond.json @@ -0,0 +1,154 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "GatewayBondResponse", + "description": "Response containing details of a gateway with the provided identity key.", + "type": "object", + "required": [ + "identity" + ], + "properties": { + "gateway": { + "description": "If there exists a gateway with the provided identity key, this field contains its details.", + "anyOf": [ + { + "$ref": "#/definitions/GatewayBond" + }, + { + "type": "null" + } + ] + }, + "identity": { + "description": "The identity key (base58-encoded ed25519 public key) of the gateway.", + "type": "string" + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Gateway": { + "description": "Information provided by the node operator during bonding that are used to allow other entities to use the services of this node.", + "type": "object", + "required": [ + "clients_port", + "host", + "identity_key", + "location", + "mix_port", + "sphinx_key", + "version" + ], + "properties": { + "clients_port": { + "description": "Port used by this gateway for listening for client requests.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "host": { + "description": "Network address of this gateway, for example 1.1.1.1 or foo.gateway.com", + "type": "string" + }, + "identity_key": { + "description": "Base58 encoded ed25519 EdDSA public key of the gateway used to derive shared keys with clients", + "type": "string" + }, + "location": { + "description": "The physical, self-reported, location of this gateway.", + "type": "string" + }, + "mix_port": { + "description": "Port used by this gateway for listening for mix packets.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "sphinx_key": { + "description": "Base58-encoded x25519 public key used for sphinx key derivation.", + "type": "string" + }, + "version": { + "description": "The self-reported semver version of this gateway.", + "type": "string" + } + }, + "additionalProperties": false + }, + "GatewayBond": { + "description": "Basic gateway information provided by the node operator.", + "type": "object", + "required": [ + "block_height", + "gateway", + "owner", + "pledge_amount" + ], + "properties": { + "block_height": { + "description": "Block height at which this gateway has been bonded.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "gateway": { + "description": "Information provided by the operator for the purposes of bonding.", + "allOf": [ + { + "$ref": "#/definitions/Gateway" + } + ] + }, + "owner": { + "description": "Address of the owner of this gateway.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "pledge_amount": { + "description": "Original amount pledged by the operator of this node.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "proxy": { + "description": "Entity who bonded this gateway on behalf of the owner. If exists, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_gateways.json b/contracts/mixnet/schema/raw/response_to_get_gateways.json new file mode 100644 index 0000000000..0ec50135b6 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_gateways.json @@ -0,0 +1,160 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedGatewayResponse", + "description": "Response containing paged list of all gateway bonds in the contract.", + "type": "object", + "required": [ + "nodes", + "per_page" + ], + "properties": { + "nodes": { + "description": "The gateway bond information present in the contract.", + "type": "array", + "items": { + "$ref": "#/definitions/GatewayBond" + } + }, + "per_page": { + "description": "Maximum number of entries that could be included in a response. `per_page <= nodes.len()`", + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Gateway": { + "description": "Information provided by the node operator during bonding that are used to allow other entities to use the services of this node.", + "type": "object", + "required": [ + "clients_port", + "host", + "identity_key", + "location", + "mix_port", + "sphinx_key", + "version" + ], + "properties": { + "clients_port": { + "description": "Port used by this gateway for listening for client requests.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "host": { + "description": "Network address of this gateway, for example 1.1.1.1 or foo.gateway.com", + "type": "string" + }, + "identity_key": { + "description": "Base58 encoded ed25519 EdDSA public key of the gateway used to derive shared keys with clients", + "type": "string" + }, + "location": { + "description": "The physical, self-reported, location of this gateway.", + "type": "string" + }, + "mix_port": { + "description": "Port used by this gateway for listening for mix packets.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "sphinx_key": { + "description": "Base58-encoded x25519 public key used for sphinx key derivation.", + "type": "string" + }, + "version": { + "description": "The self-reported semver version of this gateway.", + "type": "string" + } + }, + "additionalProperties": false + }, + "GatewayBond": { + "description": "Basic gateway information provided by the node operator.", + "type": "object", + "required": [ + "block_height", + "gateway", + "owner", + "pledge_amount" + ], + "properties": { + "block_height": { + "description": "Block height at which this gateway has been bonded.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "gateway": { + "description": "Information provided by the operator for the purposes of bonding.", + "allOf": [ + { + "$ref": "#/definitions/Gateway" + } + ] + }, + "owner": { + "description": "Address of the owner of this gateway.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "pledge_amount": { + "description": "Original amount pledged by the operator of this node.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "proxy": { + "description": "Entity who bonded this gateway on behalf of the owner. If exists, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_layer_distribution.json b/contracts/mixnet/schema/raw/response_to_get_layer_distribution.json new file mode 100644 index 0000000000..0ed27f33cb --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_layer_distribution.json @@ -0,0 +1,32 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "LayerDistribution", + "description": "The current layer distribution of the mix network.", + "type": "object", + "required": [ + "layer1", + "layer2", + "layer3" + ], + "properties": { + "layer1": { + "description": "Number of nodes on the first layer.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "layer2": { + "description": "Number of nodes on the second layer.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "layer3": { + "description": "Number of nodes on the third layer.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false +} diff --git a/contracts/mixnet/schema/raw/response_to_get_mix_node_bonds.json b/contracts/mixnet/schema/raw/response_to_get_mix_node_bonds.json new file mode 100644 index 0000000000..61bdf6b3f1 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_mix_node_bonds.json @@ -0,0 +1,193 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedMixnodeBondsResponse", + "description": "Response containing paged list of all mixnode bonds in the contract.", + "type": "object", + "required": [ + "nodes", + "per_page" + ], + "properties": { + "nodes": { + "description": "The mixnode bond information present in the contract.", + "type": "array", + "items": { + "$ref": "#/definitions/MixNodeBond" + } + }, + "per_page": { + "description": "Maximum number of entries that could be included in a response. `per_page <= nodes.len()`", + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Layer": { + "type": "string", + "enum": [ + "One", + "Two", + "Three" + ] + }, + "MixNode": { + "description": "Information provided by the node operator during bonding that are used to allow other entities to use the services of this node.", + "type": "object", + "required": [ + "host", + "http_api_port", + "identity_key", + "mix_port", + "sphinx_key", + "verloc_port", + "version" + ], + "properties": { + "host": { + "description": "Network address of this mixnode, for example 1.1.1.1 or foo.mixnode.com", + "type": "string" + }, + "http_api_port": { + "description": "Port used by this mixnode for its http(s) API", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "identity_key": { + "description": "Base58-encoded ed25519 EdDSA public key.", + "type": "string" + }, + "mix_port": { + "description": "Port used by this mixnode for listening for mix packets.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "sphinx_key": { + "description": "Base58-encoded x25519 public key used for sphinx key derivation.", + "type": "string" + }, + "verloc_port": { + "description": "Port used by this mixnode for listening for verloc requests.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "version": { + "description": "The self-reported semver version of this mixnode.", + "type": "string" + } + }, + "additionalProperties": false + }, + "MixNodeBond": { + "description": "Basic mixnode information provided by the node operator.", + "type": "object", + "required": [ + "bonding_height", + "is_unbonding", + "layer", + "mix_id", + "mix_node", + "original_pledge", + "owner" + ], + "properties": { + "bonding_height": { + "description": "Block height at which this mixnode has been bonded.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "is_unbonding": { + "description": "Flag to indicate whether this node is in the process of unbonding, that will conclude upon the epoch finishing.", + "type": "boolean" + }, + "layer": { + "description": "Layer assigned to this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/Layer" + } + ] + }, + "mix_id": { + "description": "Unique id assigned to the bonded mixnode.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "mix_node": { + "description": "Information provided by the operator for the purposes of bonding.", + "allOf": [ + { + "$ref": "#/definitions/MixNode" + } + ] + }, + "original_pledge": { + "description": "Original amount pledged by the operator of this node.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "owner": { + "description": "Address of the owner of this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Entity who bonded this mixnode on behalf of the owner. If exists, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_mix_nodes_detailed.json b/contracts/mixnet/schema/raw/response_to_get_mix_nodes_detailed.json new file mode 100644 index 0000000000..bc95bb0839 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_mix_nodes_detailed.json @@ -0,0 +1,350 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedMixnodesDetailsResponse", + "description": "Response containing paged list of all mixnode details in the contract.", + "type": "object", + "required": [ + "nodes", + "per_page" + ], + "properties": { + "nodes": { + "description": "All mixnode details stored in the contract. Apart from the basic bond information it also contains details required for all future reward calculation as well as any pending changes requested by the operator.", + "type": "array", + "items": { + "$ref": "#/definitions/MixNodeDetails" + } + }, + "per_page": { + "description": "Maximum number of entries that could be included in a response. `per_page <= nodes.len()`", + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Layer": { + "type": "string", + "enum": [ + "One", + "Two", + "Three" + ] + }, + "MixNode": { + "description": "Information provided by the node operator during bonding that are used to allow other entities to use the services of this node.", + "type": "object", + "required": [ + "host", + "http_api_port", + "identity_key", + "mix_port", + "sphinx_key", + "verloc_port", + "version" + ], + "properties": { + "host": { + "description": "Network address of this mixnode, for example 1.1.1.1 or foo.mixnode.com", + "type": "string" + }, + "http_api_port": { + "description": "Port used by this mixnode for its http(s) API", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "identity_key": { + "description": "Base58-encoded ed25519 EdDSA public key.", + "type": "string" + }, + "mix_port": { + "description": "Port used by this mixnode for listening for mix packets.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "sphinx_key": { + "description": "Base58-encoded x25519 public key used for sphinx key derivation.", + "type": "string" + }, + "verloc_port": { + "description": "Port used by this mixnode for listening for verloc requests.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "version": { + "description": "The self-reported semver version of this mixnode.", + "type": "string" + } + }, + "additionalProperties": false + }, + "MixNodeBond": { + "description": "Basic mixnode information provided by the node operator.", + "type": "object", + "required": [ + "bonding_height", + "is_unbonding", + "layer", + "mix_id", + "mix_node", + "original_pledge", + "owner" + ], + "properties": { + "bonding_height": { + "description": "Block height at which this mixnode has been bonded.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "is_unbonding": { + "description": "Flag to indicate whether this node is in the process of unbonding, that will conclude upon the epoch finishing.", + "type": "boolean" + }, + "layer": { + "description": "Layer assigned to this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/Layer" + } + ] + }, + "mix_id": { + "description": "Unique id assigned to the bonded mixnode.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "mix_node": { + "description": "Information provided by the operator for the purposes of bonding.", + "allOf": [ + { + "$ref": "#/definitions/MixNode" + } + ] + }, + "original_pledge": { + "description": "Original amount pledged by the operator of this node.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "owner": { + "description": "Address of the owner of this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Entity who bonded this mixnode on behalf of the owner. If exists, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeCostParams": { + "description": "The cost parameters, or the cost function, defined for the particular mixnode that influences how the rewards should be split between the node operator and its delegators.", + "type": "object", + "required": [ + "interval_operating_cost", + "profit_margin_percent" + ], + "properties": { + "interval_operating_cost": { + "description": "Operating cost of the associated mixnode per the entire interval.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "profit_margin_percent": { + "description": "The profit margin of the associated mixnode, i.e. the desired percent of the reward to be distributed to the operator.", + "allOf": [ + { + "$ref": "#/definitions/Percent" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeDetails": { + "description": "Full details associated with given mixnode.", + "type": "object", + "required": [ + "bond_information", + "rewarding_details" + ], + "properties": { + "bond_information": { + "description": "Basic bond information of this mixnode, such as owner address, original pledge, etc.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeBond" + } + ] + }, + "pending_changes": { + "description": "Adjustments to the mixnode that are ought to happen during future epoch transitions.", + "default": { + "pledge_change": null + }, + "allOf": [ + { + "$ref": "#/definitions/PendingMixNodeChanges" + } + ] + }, + "rewarding_details": { + "description": "Details used for computation of rewarding related data.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeRewarding" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeRewarding": { + "type": "object", + "required": [ + "cost_params", + "delegates", + "last_rewarded_epoch", + "operator", + "total_unit_reward", + "unique_delegations", + "unit_delegation" + ], + "properties": { + "cost_params": { + "description": "Information provided by the operator that influence the cost function.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeCostParams" + } + ] + }, + "delegates": { + "description": "Total delegation and compounded reward earned by all node delegators.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "last_rewarded_epoch": { + "description": "Marks the epoch when this node was last rewarded so that we wouldn't accidentally attempt to reward it multiple times in the same epoch.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "operator": { + "description": "Total pledge and compounded reward earned by the node operator.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "total_unit_reward": { + "description": "Cumulative reward earned by the \"unit delegation\" since the block 0.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "unique_delegations": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "unit_delegation": { + "description": "Value of the theoretical \"unit delegation\" that has delegated to this mixnode at block 0.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + } + }, + "additionalProperties": false + }, + "PendingMixNodeChanges": { + "type": "object", + "properties": { + "pledge_change": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "Percent": { + "description": "Percent represents a value between 0 and 100% (i.e. between 0.0 and 1.0)", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_mixnode_delegations.json b/contracts/mixnet/schema/raw/response_to_get_mixnode_delegations.json new file mode 100644 index 0000000000..82d8c56b90 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_mixnode_delegations.json @@ -0,0 +1,116 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedMixNodeDelegationsResponse", + "description": "Response containing paged list of all delegations made towards particular mixnode.", + "type": "object", + "required": [ + "delegations" + ], + "properties": { + "delegations": { + "description": "Each individual delegation made.", + "type": "array", + "items": { + "$ref": "#/definitions/Delegation" + } + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Delegation": { + "description": "Information about tokens being delegated towards given mixnode in order to accrue rewards with their work.", + "type": "object", + "required": [ + "amount", + "cumulative_reward_ratio", + "height", + "mix_id", + "owner" + ], + "properties": { + "amount": { + "description": "Original delegation amount. Note that it is never mutated as delegation accumulates rewards.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "cumulative_reward_ratio": { + "description": "Value of the \"unit delegation\" associated with the mixnode at the time of delegation.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "height": { + "description": "Block height where this delegation occurred.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "mix_id": { + "description": "Id of the MixNode that this delegation was performed against.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "description": "Address of the owner of this delegation.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Proxy address used to delegate the funds on behalf of another address", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_mixnode_details.json b/contracts/mixnet/schema/raw/response_to_get_mixnode_details.json new file mode 100644 index 0000000000..4d7bd42da4 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_mixnode_details.json @@ -0,0 +1,344 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MixnodeDetailsResponse", + "description": "Response containing details of a mixnode with the provided id.", + "type": "object", + "required": [ + "mix_id" + ], + "properties": { + "mix_id": { + "description": "Id of the requested mixnode.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "mixnode_details": { + "description": "If there exists a mixnode with the provided id, this field contains its detailed information.", + "anyOf": [ + { + "$ref": "#/definitions/MixNodeDetails" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Layer": { + "type": "string", + "enum": [ + "One", + "Two", + "Three" + ] + }, + "MixNode": { + "description": "Information provided by the node operator during bonding that are used to allow other entities to use the services of this node.", + "type": "object", + "required": [ + "host", + "http_api_port", + "identity_key", + "mix_port", + "sphinx_key", + "verloc_port", + "version" + ], + "properties": { + "host": { + "description": "Network address of this mixnode, for example 1.1.1.1 or foo.mixnode.com", + "type": "string" + }, + "http_api_port": { + "description": "Port used by this mixnode for its http(s) API", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "identity_key": { + "description": "Base58-encoded ed25519 EdDSA public key.", + "type": "string" + }, + "mix_port": { + "description": "Port used by this mixnode for listening for mix packets.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "sphinx_key": { + "description": "Base58-encoded x25519 public key used for sphinx key derivation.", + "type": "string" + }, + "verloc_port": { + "description": "Port used by this mixnode for listening for verloc requests.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "version": { + "description": "The self-reported semver version of this mixnode.", + "type": "string" + } + }, + "additionalProperties": false + }, + "MixNodeBond": { + "description": "Basic mixnode information provided by the node operator.", + "type": "object", + "required": [ + "bonding_height", + "is_unbonding", + "layer", + "mix_id", + "mix_node", + "original_pledge", + "owner" + ], + "properties": { + "bonding_height": { + "description": "Block height at which this mixnode has been bonded.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "is_unbonding": { + "description": "Flag to indicate whether this node is in the process of unbonding, that will conclude upon the epoch finishing.", + "type": "boolean" + }, + "layer": { + "description": "Layer assigned to this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/Layer" + } + ] + }, + "mix_id": { + "description": "Unique id assigned to the bonded mixnode.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "mix_node": { + "description": "Information provided by the operator for the purposes of bonding.", + "allOf": [ + { + "$ref": "#/definitions/MixNode" + } + ] + }, + "original_pledge": { + "description": "Original amount pledged by the operator of this node.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "owner": { + "description": "Address of the owner of this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Entity who bonded this mixnode on behalf of the owner. If exists, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeCostParams": { + "description": "The cost parameters, or the cost function, defined for the particular mixnode that influences how the rewards should be split between the node operator and its delegators.", + "type": "object", + "required": [ + "interval_operating_cost", + "profit_margin_percent" + ], + "properties": { + "interval_operating_cost": { + "description": "Operating cost of the associated mixnode per the entire interval.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "profit_margin_percent": { + "description": "The profit margin of the associated mixnode, i.e. the desired percent of the reward to be distributed to the operator.", + "allOf": [ + { + "$ref": "#/definitions/Percent" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeDetails": { + "description": "Full details associated with given mixnode.", + "type": "object", + "required": [ + "bond_information", + "rewarding_details" + ], + "properties": { + "bond_information": { + "description": "Basic bond information of this mixnode, such as owner address, original pledge, etc.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeBond" + } + ] + }, + "pending_changes": { + "description": "Adjustments to the mixnode that are ought to happen during future epoch transitions.", + "default": { + "pledge_change": null + }, + "allOf": [ + { + "$ref": "#/definitions/PendingMixNodeChanges" + } + ] + }, + "rewarding_details": { + "description": "Details used for computation of rewarding related data.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeRewarding" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeRewarding": { + "type": "object", + "required": [ + "cost_params", + "delegates", + "last_rewarded_epoch", + "operator", + "total_unit_reward", + "unique_delegations", + "unit_delegation" + ], + "properties": { + "cost_params": { + "description": "Information provided by the operator that influence the cost function.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeCostParams" + } + ] + }, + "delegates": { + "description": "Total delegation and compounded reward earned by all node delegators.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "last_rewarded_epoch": { + "description": "Marks the epoch when this node was last rewarded so that we wouldn't accidentally attempt to reward it multiple times in the same epoch.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "operator": { + "description": "Total pledge and compounded reward earned by the node operator.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "total_unit_reward": { + "description": "Cumulative reward earned by the \"unit delegation\" since the block 0.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "unique_delegations": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "unit_delegation": { + "description": "Value of the theoretical \"unit delegation\" that has delegated to this mixnode at block 0.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + } + }, + "additionalProperties": false + }, + "PendingMixNodeChanges": { + "type": "object", + "properties": { + "pledge_change": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "Percent": { + "description": "Percent represents a value between 0 and 100% (i.e. between 0.0 and 1.0)", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_mixnode_rewarding_details.json b/contracts/mixnet/schema/raw/response_to_get_mixnode_rewarding_details.json new file mode 100644 index 0000000000..9b30dc4a75 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_mixnode_rewarding_details.json @@ -0,0 +1,155 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MixnodeRewardingDetailsResponse", + "description": "Response containing rewarding information of a mixnode with the provided id.", + "type": "object", + "required": [ + "mix_id" + ], + "properties": { + "mix_id": { + "description": "Id of the requested mixnode.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "rewarding_details": { + "description": "If there exists a mixnode with the provided id, this field contains its rewarding information.", + "anyOf": [ + { + "$ref": "#/definitions/MixNodeRewarding" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "MixNodeCostParams": { + "description": "The cost parameters, or the cost function, defined for the particular mixnode that influences how the rewards should be split between the node operator and its delegators.", + "type": "object", + "required": [ + "interval_operating_cost", + "profit_margin_percent" + ], + "properties": { + "interval_operating_cost": { + "description": "Operating cost of the associated mixnode per the entire interval.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "profit_margin_percent": { + "description": "The profit margin of the associated mixnode, i.e. the desired percent of the reward to be distributed to the operator.", + "allOf": [ + { + "$ref": "#/definitions/Percent" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeRewarding": { + "type": "object", + "required": [ + "cost_params", + "delegates", + "last_rewarded_epoch", + "operator", + "total_unit_reward", + "unique_delegations", + "unit_delegation" + ], + "properties": { + "cost_params": { + "description": "Information provided by the operator that influence the cost function.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeCostParams" + } + ] + }, + "delegates": { + "description": "Total delegation and compounded reward earned by all node delegators.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "last_rewarded_epoch": { + "description": "Marks the epoch when this node was last rewarded so that we wouldn't accidentally attempt to reward it multiple times in the same epoch.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "operator": { + "description": "Total pledge and compounded reward earned by the node operator.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "total_unit_reward": { + "description": "Cumulative reward earned by the \"unit delegation\" since the block 0.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "unique_delegations": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "unit_delegation": { + "description": "Value of the theoretical \"unit delegation\" that has delegated to this mixnode at block 0.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + } + }, + "additionalProperties": false + }, + "Percent": { + "description": "Percent represents a value between 0 and 100% (i.e. between 0.0 and 1.0)", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_number_of_pending_events.json b/contracts/mixnet/schema/raw/response_to_get_number_of_pending_events.json new file mode 100644 index 0000000000..520dbce29c --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_number_of_pending_events.json @@ -0,0 +1,25 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "NumberOfPendingEventsResponse", + "description": "Response containing number of currently pending epoch and interval events.", + "type": "object", + "required": [ + "epoch_events", + "interval_events" + ], + "properties": { + "epoch_events": { + "description": "The number of the currently pending epoch events.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "interval_events": { + "description": "The number of the currently pending epoch events.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false +} diff --git a/contracts/mixnet/schema/raw/response_to_get_owned_gateway.json b/contracts/mixnet/schema/raw/response_to_get_owned_gateway.json new file mode 100644 index 0000000000..50f2bbd4ad --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_owned_gateway.json @@ -0,0 +1,158 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "GatewayOwnershipResponse", + "description": "Response containing details of a gateway belonging to the particular owner.", + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "description": "Validated address of the gateway owner.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "gateway": { + "description": "If the provided address owns a gateway, this field contains its details.", + "anyOf": [ + { + "$ref": "#/definitions/GatewayBond" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Gateway": { + "description": "Information provided by the node operator during bonding that are used to allow other entities to use the services of this node.", + "type": "object", + "required": [ + "clients_port", + "host", + "identity_key", + "location", + "mix_port", + "sphinx_key", + "version" + ], + "properties": { + "clients_port": { + "description": "Port used by this gateway for listening for client requests.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "host": { + "description": "Network address of this gateway, for example 1.1.1.1 or foo.gateway.com", + "type": "string" + }, + "identity_key": { + "description": "Base58 encoded ed25519 EdDSA public key of the gateway used to derive shared keys with clients", + "type": "string" + }, + "location": { + "description": "The physical, self-reported, location of this gateway.", + "type": "string" + }, + "mix_port": { + "description": "Port used by this gateway for listening for mix packets.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "sphinx_key": { + "description": "Base58-encoded x25519 public key used for sphinx key derivation.", + "type": "string" + }, + "version": { + "description": "The self-reported semver version of this gateway.", + "type": "string" + } + }, + "additionalProperties": false + }, + "GatewayBond": { + "description": "Basic gateway information provided by the node operator.", + "type": "object", + "required": [ + "block_height", + "gateway", + "owner", + "pledge_amount" + ], + "properties": { + "block_height": { + "description": "Block height at which this gateway has been bonded.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "gateway": { + "description": "Information provided by the operator for the purposes of bonding.", + "allOf": [ + { + "$ref": "#/definitions/Gateway" + } + ] + }, + "owner": { + "description": "Address of the owner of this gateway.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "pledge_amount": { + "description": "Original amount pledged by the operator of this node.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "proxy": { + "description": "Entity who bonded this gateway on behalf of the owner. If exists, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_owned_mixnode.json b/contracts/mixnet/schema/raw/response_to_get_owned_mixnode.json new file mode 100644 index 0000000000..da895c4bf4 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_owned_mixnode.json @@ -0,0 +1,346 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MixOwnershipResponse", + "description": "Response containing details of a mixnode belonging to the particular owner.", + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "description": "Validated address of the mixnode owner.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "mixnode_details": { + "description": "If the provided address owns a mixnode, this field contains its detailed information.", + "anyOf": [ + { + "$ref": "#/definitions/MixNodeDetails" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Layer": { + "type": "string", + "enum": [ + "One", + "Two", + "Three" + ] + }, + "MixNode": { + "description": "Information provided by the node operator during bonding that are used to allow other entities to use the services of this node.", + "type": "object", + "required": [ + "host", + "http_api_port", + "identity_key", + "mix_port", + "sphinx_key", + "verloc_port", + "version" + ], + "properties": { + "host": { + "description": "Network address of this mixnode, for example 1.1.1.1 or foo.mixnode.com", + "type": "string" + }, + "http_api_port": { + "description": "Port used by this mixnode for its http(s) API", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "identity_key": { + "description": "Base58-encoded ed25519 EdDSA public key.", + "type": "string" + }, + "mix_port": { + "description": "Port used by this mixnode for listening for mix packets.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "sphinx_key": { + "description": "Base58-encoded x25519 public key used for sphinx key derivation.", + "type": "string" + }, + "verloc_port": { + "description": "Port used by this mixnode for listening for verloc requests.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "version": { + "description": "The self-reported semver version of this mixnode.", + "type": "string" + } + }, + "additionalProperties": false + }, + "MixNodeBond": { + "description": "Basic mixnode information provided by the node operator.", + "type": "object", + "required": [ + "bonding_height", + "is_unbonding", + "layer", + "mix_id", + "mix_node", + "original_pledge", + "owner" + ], + "properties": { + "bonding_height": { + "description": "Block height at which this mixnode has been bonded.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "is_unbonding": { + "description": "Flag to indicate whether this node is in the process of unbonding, that will conclude upon the epoch finishing.", + "type": "boolean" + }, + "layer": { + "description": "Layer assigned to this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/Layer" + } + ] + }, + "mix_id": { + "description": "Unique id assigned to the bonded mixnode.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "mix_node": { + "description": "Information provided by the operator for the purposes of bonding.", + "allOf": [ + { + "$ref": "#/definitions/MixNode" + } + ] + }, + "original_pledge": { + "description": "Original amount pledged by the operator of this node.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "owner": { + "description": "Address of the owner of this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Entity who bonded this mixnode on behalf of the owner. If exists, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeCostParams": { + "description": "The cost parameters, or the cost function, defined for the particular mixnode that influences how the rewards should be split between the node operator and its delegators.", + "type": "object", + "required": [ + "interval_operating_cost", + "profit_margin_percent" + ], + "properties": { + "interval_operating_cost": { + "description": "Operating cost of the associated mixnode per the entire interval.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "profit_margin_percent": { + "description": "The profit margin of the associated mixnode, i.e. the desired percent of the reward to be distributed to the operator.", + "allOf": [ + { + "$ref": "#/definitions/Percent" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeDetails": { + "description": "Full details associated with given mixnode.", + "type": "object", + "required": [ + "bond_information", + "rewarding_details" + ], + "properties": { + "bond_information": { + "description": "Basic bond information of this mixnode, such as owner address, original pledge, etc.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeBond" + } + ] + }, + "pending_changes": { + "description": "Adjustments to the mixnode that are ought to happen during future epoch transitions.", + "default": { + "pledge_change": null + }, + "allOf": [ + { + "$ref": "#/definitions/PendingMixNodeChanges" + } + ] + }, + "rewarding_details": { + "description": "Details used for computation of rewarding related data.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeRewarding" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeRewarding": { + "type": "object", + "required": [ + "cost_params", + "delegates", + "last_rewarded_epoch", + "operator", + "total_unit_reward", + "unique_delegations", + "unit_delegation" + ], + "properties": { + "cost_params": { + "description": "Information provided by the operator that influence the cost function.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeCostParams" + } + ] + }, + "delegates": { + "description": "Total delegation and compounded reward earned by all node delegators.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "last_rewarded_epoch": { + "description": "Marks the epoch when this node was last rewarded so that we wouldn't accidentally attempt to reward it multiple times in the same epoch.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "operator": { + "description": "Total pledge and compounded reward earned by the node operator.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "total_unit_reward": { + "description": "Cumulative reward earned by the \"unit delegation\" since the block 0.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "unique_delegations": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "unit_delegation": { + "description": "Value of the theoretical \"unit delegation\" that has delegated to this mixnode at block 0.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + } + }, + "additionalProperties": false + }, + "PendingMixNodeChanges": { + "type": "object", + "properties": { + "pledge_change": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "Percent": { + "description": "Percent represents a value between 0 and 100% (i.e. between 0.0 and 1.0)", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_pending_delegator_reward.json b/contracts/mixnet/schema/raw/response_to_get_pending_delegator_reward.json new file mode 100644 index 0000000000..e885d5976c --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_pending_delegator_reward.json @@ -0,0 +1,74 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PendingRewardResponse", + "description": "Response containing information about accrued rewards.", + "type": "object", + "required": [ + "mixnode_still_fully_bonded" + ], + "properties": { + "amount_earned": { + "description": "The amount of tokens that could be claimed.", + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + }, + "amount_earned_detailed": { + "description": "The full pending rewards. Note that it's nearly identical to `amount_earned`, however, it contains few additional decimal points for more accurate reward calculation.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "amount_staked": { + "description": "The amount of tokens initially staked.", + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + }, + "mixnode_still_fully_bonded": { + "description": "The associated mixnode is still fully bonded, meaning it is neither unbonded nor in the process of unbonding that would have finished at the epoch transition.", + "type": "boolean" + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_pending_epoch_event.json b/contracts/mixnet/schema/raw/response_to_get_pending_epoch_event.json new file mode 100644 index 0000000000..7588cad3e9 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_pending_epoch_event.json @@ -0,0 +1,298 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PendingEpochEventResponse", + "type": "object", + "required": [ + "event_id" + ], + "properties": { + "event": { + "anyOf": [ + { + "$ref": "#/definitions/PendingEpochEventData" + }, + { + "type": "null" + } + ] + }, + "event_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "PendingEpochEventData": { + "description": "Details of a particular pending epoch event.", + "type": "object", + "required": [ + "created_at", + "kind" + ], + "properties": { + "created_at": { + "description": "The block height at which the request has been made.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "kind": { + "description": "The underlying event data, containing its concrete type and information on how it should get resolved.", + "allOf": [ + { + "$ref": "#/definitions/PendingEpochEventKind" + } + ] + } + }, + "additionalProperties": false + }, + "PendingEpochEventKind": { + "description": "Enum encompassing all possible epoch events.", + "oneOf": [ + { + "description": "Request to create a delegation towards particular mixnode. Note that if such delegation already exists, it will get updated with the provided token amount.", + "type": "object", + "required": [ + "delegate" + ], + "properties": { + "delegate": { + "type": "object", + "required": [ + "amount", + "mix_id", + "owner" + ], + "properties": { + "amount": { + "description": "The amount of tokens to use for the delegation.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "mix_id": { + "description": "The id of the mixnode used for the delegation.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "description": "The address of the owner of the delegation.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Entity who made the delegation on behalf of the owner. If present, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Request to remove delegation from particular mixnode.", + "type": "object", + "required": [ + "undelegate" + ], + "properties": { + "undelegate": { + "type": "object", + "required": [ + "mix_id", + "owner" + ], + "properties": { + "mix_id": { + "description": "The id of the mixnode used for the delegation.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "description": "The address of the owner of the delegation.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Entity who made the delegation on behalf of the owner. If present, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Request to pledge more tokens (by the node operator) towards its node.", + "type": "object", + "required": [ + "pledge_more" + ], + "properties": { + "pledge_more": { + "type": "object", + "required": [ + "amount", + "mix_id" + ], + "properties": { + "amount": { + "description": "The amount of additional tokens to use by the pledge.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "mix_id": { + "description": "The id of the mixnode that will have its pledge updated.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Request to decrease amount of pledged tokens (by the node operator) from its node.", + "type": "object", + "required": [ + "decrease_pledge" + ], + "properties": { + "decrease_pledge": { + "type": "object", + "required": [ + "decrease_by", + "mix_id" + ], + "properties": { + "decrease_by": { + "description": "The amount of tokens that should be removed from the pledge.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "mix_id": { + "description": "The id of the mixnode that will have its pledge updated.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Request to unbond a mixnode and completely remove it from the network.", + "type": "object", + "required": [ + "unbond_mixnode" + ], + "properties": { + "unbond_mixnode": { + "type": "object", + "required": [ + "mix_id" + ], + "properties": { + "mix_id": { + "description": "The id of the mixnode that will get unbonded.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Request to update the current size of the active set.", + "type": "object", + "required": [ + "update_active_set_size" + ], + "properties": { + "update_active_set_size": { + "type": "object", + "required": [ + "new_size" + ], + "properties": { + "new_size": { + "description": "The new desired size of the active set.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_pending_epoch_events.json b/contracts/mixnet/schema/raw/response_to_get_pending_epoch_events.json new file mode 100644 index 0000000000..09a4d03787 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_pending_epoch_events.json @@ -0,0 +1,331 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PendingEpochEventsResponse", + "description": "Response containing all currently pending epoch events that will be resolved once the current epoch finishes.", + "type": "object", + "required": [ + "events", + "seconds_until_executable" + ], + "properties": { + "events": { + "description": "The currently pending events.", + "type": "array", + "items": { + "$ref": "#/definitions/PendingEpochEvent" + } + }, + "seconds_until_executable": { + "description": "Amount of seconds until the events would be eligible to be resolved. It's equivalent to the time until the current epoch finishes.", + "type": "integer", + "format": "int64" + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "PendingEpochEvent": { + "description": "A request made at some point in the current epoch that's going to get resolved once the epoch rolls over.", + "type": "object", + "required": [ + "event", + "id" + ], + "properties": { + "event": { + "description": "The underlying event details, containing its type and information on how it should get resolved.", + "allOf": [ + { + "$ref": "#/definitions/PendingEpochEventData" + } + ] + }, + "id": { + "description": "The unique id associated with the event.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "PendingEpochEventData": { + "description": "Details of a particular pending epoch event.", + "type": "object", + "required": [ + "created_at", + "kind" + ], + "properties": { + "created_at": { + "description": "The block height at which the request has been made.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "kind": { + "description": "The underlying event data, containing its concrete type and information on how it should get resolved.", + "allOf": [ + { + "$ref": "#/definitions/PendingEpochEventKind" + } + ] + } + }, + "additionalProperties": false + }, + "PendingEpochEventKind": { + "description": "Enum encompassing all possible epoch events.", + "oneOf": [ + { + "description": "Request to create a delegation towards particular mixnode. Note that if such delegation already exists, it will get updated with the provided token amount.", + "type": "object", + "required": [ + "delegate" + ], + "properties": { + "delegate": { + "type": "object", + "required": [ + "amount", + "mix_id", + "owner" + ], + "properties": { + "amount": { + "description": "The amount of tokens to use for the delegation.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "mix_id": { + "description": "The id of the mixnode used for the delegation.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "description": "The address of the owner of the delegation.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Entity who made the delegation on behalf of the owner. If present, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Request to remove delegation from particular mixnode.", + "type": "object", + "required": [ + "undelegate" + ], + "properties": { + "undelegate": { + "type": "object", + "required": [ + "mix_id", + "owner" + ], + "properties": { + "mix_id": { + "description": "The id of the mixnode used for the delegation.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "description": "The address of the owner of the delegation.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Entity who made the delegation on behalf of the owner. If present, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Request to pledge more tokens (by the node operator) towards its node.", + "type": "object", + "required": [ + "pledge_more" + ], + "properties": { + "pledge_more": { + "type": "object", + "required": [ + "amount", + "mix_id" + ], + "properties": { + "amount": { + "description": "The amount of additional tokens to use by the pledge.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "mix_id": { + "description": "The id of the mixnode that will have its pledge updated.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Request to decrease amount of pledged tokens (by the node operator) from its node.", + "type": "object", + "required": [ + "decrease_pledge" + ], + "properties": { + "decrease_pledge": { + "type": "object", + "required": [ + "decrease_by", + "mix_id" + ], + "properties": { + "decrease_by": { + "description": "The amount of tokens that should be removed from the pledge.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "mix_id": { + "description": "The id of the mixnode that will have its pledge updated.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Request to unbond a mixnode and completely remove it from the network.", + "type": "object", + "required": [ + "unbond_mixnode" + ], + "properties": { + "unbond_mixnode": { + "type": "object", + "required": [ + "mix_id" + ], + "properties": { + "mix_id": { + "description": "The id of the mixnode that will get unbonded.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Request to update the current size of the active set.", + "type": "object", + "required": [ + "update_active_set_size" + ], + "properties": { + "update_active_set_size": { + "type": "object", + "required": [ + "new_size" + ], + "properties": { + "new_size": { + "description": "The new desired size of the active set.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_pending_interval_event.json b/contracts/mixnet/schema/raw/response_to_get_pending_interval_event.json new file mode 100644 index 0000000000..a0877027a9 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_pending_interval_event.json @@ -0,0 +1,291 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PendingIntervalEventResponse", + "type": "object", + "required": [ + "event_id" + ], + "properties": { + "event": { + "anyOf": [ + { + "$ref": "#/definitions/PendingIntervalEventData" + }, + { + "type": "null" + } + ] + }, + "event_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "IntervalRewardingParamsUpdate": { + "description": "Specification on how the rewarding params should be updated.", + "type": "object", + "properties": { + "active_set_work_factor": { + "description": "Defines the new value of the active set work factor.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "interval_pool_emission": { + "description": "Defines the new value of the interval pool emission rate.", + "anyOf": [ + { + "$ref": "#/definitions/Percent" + }, + { + "type": "null" + } + ] + }, + "reward_pool": { + "description": "Defines the new value of the reward pool.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "rewarded_set_size": { + "description": "Defines the new size of the rewarded set.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "staking_supply": { + "description": "Defines the new value of the staking supply.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "staking_supply_scale_factor": { + "description": "Defines the new value of the staking supply scale factor.", + "anyOf": [ + { + "$ref": "#/definitions/Percent" + }, + { + "type": "null" + } + ] + }, + "sybil_resistance_percent": { + "description": "Defines the new value of the sybil resistance percent.", + "anyOf": [ + { + "$ref": "#/definitions/Percent" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeCostParams": { + "description": "The cost parameters, or the cost function, defined for the particular mixnode that influences how the rewards should be split between the node operator and its delegators.", + "type": "object", + "required": [ + "interval_operating_cost", + "profit_margin_percent" + ], + "properties": { + "interval_operating_cost": { + "description": "Operating cost of the associated mixnode per the entire interval.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "profit_margin_percent": { + "description": "The profit margin of the associated mixnode, i.e. the desired percent of the reward to be distributed to the operator.", + "allOf": [ + { + "$ref": "#/definitions/Percent" + } + ] + } + }, + "additionalProperties": false + }, + "PendingIntervalEventData": { + "description": "Details of a particular pending interval event.", + "type": "object", + "required": [ + "created_at", + "kind" + ], + "properties": { + "created_at": { + "description": "The block height at which the request has been made.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "kind": { + "description": "The underlying event data, containing its concrete type and information on how it should get resolved.", + "allOf": [ + { + "$ref": "#/definitions/PendingIntervalEventKind" + } + ] + } + }, + "additionalProperties": false + }, + "PendingIntervalEventKind": { + "description": "Enum encompassing all possible interval events.", + "oneOf": [ + { + "description": "Request to update cost parameters of given mixnode.", + "type": "object", + "required": [ + "change_mix_cost_params" + ], + "properties": { + "change_mix_cost_params": { + "type": "object", + "required": [ + "mix_id", + "new_costs" + ], + "properties": { + "mix_id": { + "description": "The id of the mixnode that will have its cost parameters updated.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "new_costs": { + "description": "The new updated cost function of this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeCostParams" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Request to update the underlying rewarding parameters used by the system", + "type": "object", + "required": [ + "update_rewarding_params" + ], + "properties": { + "update_rewarding_params": { + "type": "object", + "required": [ + "update" + ], + "properties": { + "update": { + "description": "The detailed specification of the update.", + "allOf": [ + { + "$ref": "#/definitions/IntervalRewardingParamsUpdate" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Request to change the next interval configuration.", + "type": "object", + "required": [ + "update_interval_config" + ], + "properties": { + "update_interval_config": { + "type": "object", + "required": [ + "epoch_duration_secs", + "epochs_in_interval" + ], + "properties": { + "epoch_duration_secs": { + "description": "The new epoch duration.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "epochs_in_interval": { + "description": "The new number of epochs in intervals.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Percent": { + "description": "Percent represents a value between 0 and 100% (i.e. between 0.0 and 1.0)", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_pending_interval_events.json b/contracts/mixnet/schema/raw/response_to_get_pending_interval_events.json new file mode 100644 index 0000000000..ccbdc22178 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_pending_interval_events.json @@ -0,0 +1,324 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PendingIntervalEventsResponse", + "description": "Response containing all currently pending interval events that will be resolved once the current interval finishes.", + "type": "object", + "required": [ + "events", + "seconds_until_executable" + ], + "properties": { + "events": { + "description": "The currently pending events.", + "type": "array", + "items": { + "$ref": "#/definitions/PendingIntervalEvent" + } + }, + "seconds_until_executable": { + "description": "Amount of seconds until the events would be eligible to be resolved. It's equivalent to the time until the current interval finishes.", + "type": "integer", + "format": "int64" + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "IntervalRewardingParamsUpdate": { + "description": "Specification on how the rewarding params should be updated.", + "type": "object", + "properties": { + "active_set_work_factor": { + "description": "Defines the new value of the active set work factor.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "interval_pool_emission": { + "description": "Defines the new value of the interval pool emission rate.", + "anyOf": [ + { + "$ref": "#/definitions/Percent" + }, + { + "type": "null" + } + ] + }, + "reward_pool": { + "description": "Defines the new value of the reward pool.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "rewarded_set_size": { + "description": "Defines the new size of the rewarded set.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "staking_supply": { + "description": "Defines the new value of the staking supply.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "staking_supply_scale_factor": { + "description": "Defines the new value of the staking supply scale factor.", + "anyOf": [ + { + "$ref": "#/definitions/Percent" + }, + { + "type": "null" + } + ] + }, + "sybil_resistance_percent": { + "description": "Defines the new value of the sybil resistance percent.", + "anyOf": [ + { + "$ref": "#/definitions/Percent" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "MixNodeCostParams": { + "description": "The cost parameters, or the cost function, defined for the particular mixnode that influences how the rewards should be split between the node operator and its delegators.", + "type": "object", + "required": [ + "interval_operating_cost", + "profit_margin_percent" + ], + "properties": { + "interval_operating_cost": { + "description": "Operating cost of the associated mixnode per the entire interval.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "profit_margin_percent": { + "description": "The profit margin of the associated mixnode, i.e. the desired percent of the reward to be distributed to the operator.", + "allOf": [ + { + "$ref": "#/definitions/Percent" + } + ] + } + }, + "additionalProperties": false + }, + "PendingIntervalEvent": { + "description": "A request made at some point in the current interval that's going to get resolved once the interval rolls over.", + "type": "object", + "required": [ + "event", + "id" + ], + "properties": { + "event": { + "description": "The underlying event details, containing its type and information on how it should get resolved.", + "allOf": [ + { + "$ref": "#/definitions/PendingIntervalEventData" + } + ] + }, + "id": { + "description": "The unique id associated with the event.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "PendingIntervalEventData": { + "description": "Details of a particular pending interval event.", + "type": "object", + "required": [ + "created_at", + "kind" + ], + "properties": { + "created_at": { + "description": "The block height at which the request has been made.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "kind": { + "description": "The underlying event data, containing its concrete type and information on how it should get resolved.", + "allOf": [ + { + "$ref": "#/definitions/PendingIntervalEventKind" + } + ] + } + }, + "additionalProperties": false + }, + "PendingIntervalEventKind": { + "description": "Enum encompassing all possible interval events.", + "oneOf": [ + { + "description": "Request to update cost parameters of given mixnode.", + "type": "object", + "required": [ + "change_mix_cost_params" + ], + "properties": { + "change_mix_cost_params": { + "type": "object", + "required": [ + "mix_id", + "new_costs" + ], + "properties": { + "mix_id": { + "description": "The id of the mixnode that will have its cost parameters updated.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "new_costs": { + "description": "The new updated cost function of this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/MixNodeCostParams" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Request to update the underlying rewarding parameters used by the system", + "type": "object", + "required": [ + "update_rewarding_params" + ], + "properties": { + "update_rewarding_params": { + "type": "object", + "required": [ + "update" + ], + "properties": { + "update": { + "description": "The detailed specification of the update.", + "allOf": [ + { + "$ref": "#/definitions/IntervalRewardingParamsUpdate" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Request to change the next interval configuration.", + "type": "object", + "required": [ + "update_interval_config" + ], + "properties": { + "update_interval_config": { + "type": "object", + "required": [ + "epoch_duration_secs", + "epochs_in_interval" + ], + "properties": { + "epoch_duration_secs": { + "description": "The new epoch duration.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "epochs_in_interval": { + "description": "The new number of epochs in intervals.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Percent": { + "description": "Percent represents a value between 0 and 100% (i.e. between 0.0 and 1.0)", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_pending_mix_node_operator_reward.json b/contracts/mixnet/schema/raw/response_to_get_pending_mix_node_operator_reward.json new file mode 100644 index 0000000000..e885d5976c --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_pending_mix_node_operator_reward.json @@ -0,0 +1,74 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PendingRewardResponse", + "description": "Response containing information about accrued rewards.", + "type": "object", + "required": [ + "mixnode_still_fully_bonded" + ], + "properties": { + "amount_earned": { + "description": "The amount of tokens that could be claimed.", + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + }, + "amount_earned_detailed": { + "description": "The full pending rewards. Note that it's nearly identical to `amount_earned`, however, it contains few additional decimal points for more accurate reward calculation.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "amount_staked": { + "description": "The amount of tokens initially staked.", + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + }, + "mixnode_still_fully_bonded": { + "description": "The associated mixnode is still fully bonded, meaning it is neither unbonded nor in the process of unbonding that would have finished at the epoch transition.", + "type": "boolean" + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_pending_operator_reward.json b/contracts/mixnet/schema/raw/response_to_get_pending_operator_reward.json new file mode 100644 index 0000000000..e885d5976c --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_pending_operator_reward.json @@ -0,0 +1,74 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PendingRewardResponse", + "description": "Response containing information about accrued rewards.", + "type": "object", + "required": [ + "mixnode_still_fully_bonded" + ], + "properties": { + "amount_earned": { + "description": "The amount of tokens that could be claimed.", + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + }, + "amount_earned_detailed": { + "description": "The full pending rewards. Note that it's nearly identical to `amount_earned`, however, it contains few additional decimal points for more accurate reward calculation.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "amount_staked": { + "description": "The amount of tokens initially staked.", + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + }, + "mixnode_still_fully_bonded": { + "description": "The associated mixnode is still fully bonded, meaning it is neither unbonded nor in the process of unbonding that would have finished at the epoch transition.", + "type": "boolean" + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_rewarded_set.json b/contracts/mixnet/schema/raw/response_to_get_rewarded_set.json new file mode 100644 index 0000000000..e623d3c1a8 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_rewarded_set.json @@ -0,0 +1,61 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedRewardedSetResponse", + "description": "Response containing paged list of all mixnodes in the rewarded set.", + "type": "object", + "required": [ + "nodes" + ], + "properties": { + "nodes": { + "description": "Nodes in the current rewarded set.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + { + "$ref": "#/definitions/RewardedSetNodeStatus" + } + ], + "maxItems": 2, + "minItems": 2 + } + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "RewardedSetNodeStatus": { + "description": "Current state of given node in the rewarded set.", + "oneOf": [ + { + "description": "Node that is currently active, i.e. is expected to be used by clients for mixing packets.", + "type": "string", + "enum": [ + "active" + ] + }, + { + "description": "Node that is currently in standby, i.e. it's present in the rewarded set but is not active.", + "type": "string", + "enum": [ + "standby" + ] + } + ] + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_rewarding_params.json b/contracts/mixnet/schema/raw/response_to_get_rewarding_params.json new file mode 100644 index 0000000000..8840bc31f2 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_rewarding_params.json @@ -0,0 +1,129 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "RewardingParams", + "description": "Parameters used for reward calculation.", + "type": "object", + "required": [ + "active_set_size", + "interval", + "rewarded_set_size" + ], + "properties": { + "active_set_size": { + "description": "The expected number of mixnodes in the active set.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "interval": { + "description": "Parameters that should remain unchanged throughout an interval.", + "allOf": [ + { + "$ref": "#/definitions/IntervalRewardParams" + } + ] + }, + "rewarded_set_size": { + "description": "The expected number of mixnodes in the rewarded set (i.e. active + standby).", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "IntervalRewardParams": { + "description": "Parameters required by the mix-mining reward distribution that do not change during an interval.", + "type": "object", + "required": [ + "active_set_work_factor", + "epoch_reward_budget", + "interval_pool_emission", + "reward_pool", + "stake_saturation_point", + "staking_supply", + "staking_supply_scale_factor", + "sybil_resistance" + ], + "properties": { + "active_set_work_factor": { + "description": "Current active set work factor. It is not really expected to be changing very often. As a matter of fact, unless there's a very specific reason, it should remain constant.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "epoch_reward_budget": { + "description": "Current value of the computed reward budget per epoch, per node. It is expected to be constant throughout the interval.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "interval_pool_emission": { + "description": "Current maximum interval pool emission. Assuming all nodes in the rewarded set are fully saturated and have 100% performance, this % of the reward pool would get distributed in rewards to all operators and its delegators. It is not really expected to be changing very often. As a matter of fact, unless there's a very specific reason, it should remain constant.", + "allOf": [ + { + "$ref": "#/definitions/Percent" + } + ] + }, + "reward_pool": { + "description": "Current value of the rewarding pool. It is expected to be constant throughout the interval.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "stake_saturation_point": { + "description": "Current value of the stake saturation point. It is expected to be constant throughout the interval.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "staking_supply": { + "description": "Current value of the staking supply. It is expected to be constant throughout the interval.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "staking_supply_scale_factor": { + "description": "Defines the percentage of stake needed to reach saturation for all of the nodes in the rewarded set. Also known as `beta`.", + "allOf": [ + { + "$ref": "#/definitions/Percent" + } + ] + }, + "sybil_resistance": { + "description": "Current value of the sybil resistance percent (`alpha`). It is not really expected to be changing very often. As a matter of fact, unless there's a very specific reason, it should remain constant.", + "allOf": [ + { + "$ref": "#/definitions/Percent" + } + ] + } + }, + "additionalProperties": false + }, + "Percent": { + "description": "Percent represents a value between 0 and 100% (i.e. between 0.0 and 1.0)", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_rewarding_validator_address.json b/contracts/mixnet/schema/raw/response_to_get_rewarding_validator_address.json new file mode 100644 index 0000000000..f689acebfd --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_rewarding_validator_address.json @@ -0,0 +1,5 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "String", + "type": "string" +} diff --git a/contracts/mixnet/schema/raw/response_to_get_signing_nonce.json b/contracts/mixnet/schema/raw/response_to_get_signing_nonce.json new file mode 100644 index 0000000000..de85c3e56e --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_signing_nonce.json @@ -0,0 +1,7 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "uint32", + "type": "integer", + "format": "uint32", + "minimum": 0.0 +} diff --git a/contracts/mixnet/schema/raw/response_to_get_stake_saturation.json b/contracts/mixnet/schema/raw/response_to_get_stake_saturation.json new file mode 100644 index 0000000000..4a86c03934 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_stake_saturation.json @@ -0,0 +1,46 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "StakeSaturationResponse", + "description": "Response containing the current state of the stake saturation of a mixnode with the provided id.", + "type": "object", + "required": [ + "mix_id" + ], + "properties": { + "current_saturation": { + "description": "The current stake saturation of this node that is indirectly used in reward calculation formulas. Note that it can't be larger than 1.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "mix_id": { + "description": "Id of the requested mixnode.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "uncapped_saturation": { + "description": "The current, absolute, stake saturation of this node. Note that as the name suggests it can be larger than 1. However, anything beyond that value has no effect on the total node reward.", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_state.json b/contracts/mixnet/schema/raw/response_to_get_state.json new file mode 100644 index 0000000000..0888e30787 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_state.json @@ -0,0 +1,115 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ContractState", + "description": "The current state of the mixnet contract.", + "type": "object", + "required": [ + "owner", + "params", + "rewarding_denom", + "rewarding_validator_address", + "vesting_contract_address" + ], + "properties": { + "owner": { + "description": "Address of the contract owner.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "params": { + "description": "Contract parameters that could be adjusted in a transaction the contract admin.", + "allOf": [ + { + "$ref": "#/definitions/ContractStateParams" + } + ] + }, + "rewarding_denom": { + "description": "The expected denom used for rewarding (and realistically any other operation). Default: `unym`", + "type": "string" + }, + "rewarding_validator_address": { + "description": "Address of \"rewarding validator\" (nym-api) that's allowed to send any rewarding-related transactions.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "vesting_contract_address": { + "description": "Address of the vesting contract to which the mixnet contract would be sending all track-related messages.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "ContractStateParams": { + "description": "Contract parameters that could be adjusted in a transaction by the contract admin.", + "type": "object", + "required": [ + "minimum_gateway_pledge", + "minimum_mixnode_pledge" + ], + "properties": { + "minimum_gateway_pledge": { + "description": "Minimum amount a gateway must pledge to get into the system.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "minimum_mixnode_delegation": { + "description": "Minimum amount a delegator must stake in orders for his delegation to get accepted.", + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + }, + "minimum_mixnode_pledge": { + "description": "Minimum amount a mixnode must pledge to get into the system.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + } + }, + "additionalProperties": false + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_state_params.json b/contracts/mixnet/schema/raw/response_to_get_state_params.json new file mode 100644 index 0000000000..6e05de3035 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_state_params.json @@ -0,0 +1,61 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ContractStateParams", + "description": "Contract parameters that could be adjusted in a transaction by the contract admin.", + "type": "object", + "required": [ + "minimum_gateway_pledge", + "minimum_mixnode_pledge" + ], + "properties": { + "minimum_gateway_pledge": { + "description": "Minimum amount a gateway must pledge to get into the system.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "minimum_mixnode_delegation": { + "description": "Minimum amount a delegator must stake in orders for his delegation to get accepted.", + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + }, + "minimum_mixnode_pledge": { + "description": "Minimum amount a mixnode must pledge to get into the system.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_unbonded_mix_node_information.json b/contracts/mixnet/schema/raw/response_to_get_unbonded_mix_node_information.json new file mode 100644 index 0000000000..9fa546e39c --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_unbonded_mix_node_information.json @@ -0,0 +1,76 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "UnbondedMixnodeResponse", + "description": "Response containing basic information of an unbonded mixnode with the provided id.", + "type": "object", + "required": [ + "mix_id" + ], + "properties": { + "mix_id": { + "description": "Id of the requested mixnode.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "unbonded_info": { + "description": "If there existed a mixnode with the provided id, this field contains its basic information.", + "anyOf": [ + { + "$ref": "#/definitions/UnbondedMixnode" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "UnbondedMixnode": { + "description": "Basic information of a node that used to be part of the mix network but has already unbonded.", + "type": "object", + "required": [ + "identity_key", + "owner", + "unbonding_height" + ], + "properties": { + "identity_key": { + "description": "Base58-encoded ed25519 EdDSA public key.", + "type": "string" + }, + "owner": { + "description": "Address of the owner of this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Entity who bonded this mixnode on behalf of the owner. If exists, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + }, + "unbonding_height": { + "description": "Block height at which this mixnode has unbonded.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_unbonded_mix_nodes.json b/contracts/mixnet/schema/raw/response_to_get_unbonded_mix_nodes.json new file mode 100644 index 0000000000..6209bcc677 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_unbonded_mix_nodes.json @@ -0,0 +1,94 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedUnbondedMixnodesResponse", + "description": "Response containing paged list of all mixnodes that have ever unbonded.", + "type": "object", + "required": [ + "nodes", + "per_page" + ], + "properties": { + "nodes": { + "description": "The past ids of unbonded mixnodes alongside their basic information such as the owner or the identity key.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + { + "$ref": "#/definitions/UnbondedMixnode" + } + ], + "maxItems": 2, + "minItems": 2 + } + }, + "per_page": { + "description": "Maximum number of entries that could be included in a response. `per_page <= nodes.len()`", + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "UnbondedMixnode": { + "description": "Basic information of a node that used to be part of the mix network but has already unbonded.", + "type": "object", + "required": [ + "identity_key", + "owner", + "unbonding_height" + ], + "properties": { + "identity_key": { + "description": "Base58-encoded ed25519 EdDSA public key.", + "type": "string" + }, + "owner": { + "description": "Address of the owner of this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Entity who bonded this mixnode on behalf of the owner. If exists, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + }, + "unbonding_height": { + "description": "Block height at which this mixnode has unbonded.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_unbonded_mix_nodes_by_identity_key.json b/contracts/mixnet/schema/raw/response_to_get_unbonded_mix_nodes_by_identity_key.json new file mode 100644 index 0000000000..6209bcc677 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_unbonded_mix_nodes_by_identity_key.json @@ -0,0 +1,94 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedUnbondedMixnodesResponse", + "description": "Response containing paged list of all mixnodes that have ever unbonded.", + "type": "object", + "required": [ + "nodes", + "per_page" + ], + "properties": { + "nodes": { + "description": "The past ids of unbonded mixnodes alongside their basic information such as the owner or the identity key.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + { + "$ref": "#/definitions/UnbondedMixnode" + } + ], + "maxItems": 2, + "minItems": 2 + } + }, + "per_page": { + "description": "Maximum number of entries that could be included in a response. `per_page <= nodes.len()`", + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "UnbondedMixnode": { + "description": "Basic information of a node that used to be part of the mix network but has already unbonded.", + "type": "object", + "required": [ + "identity_key", + "owner", + "unbonding_height" + ], + "properties": { + "identity_key": { + "description": "Base58-encoded ed25519 EdDSA public key.", + "type": "string" + }, + "owner": { + "description": "Address of the owner of this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Entity who bonded this mixnode on behalf of the owner. If exists, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + }, + "unbonding_height": { + "description": "Block height at which this mixnode has unbonded.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/mixnet/schema/raw/response_to_get_unbonded_mix_nodes_by_owner.json b/contracts/mixnet/schema/raw/response_to_get_unbonded_mix_nodes_by_owner.json new file mode 100644 index 0000000000..6209bcc677 --- /dev/null +++ b/contracts/mixnet/schema/raw/response_to_get_unbonded_mix_nodes_by_owner.json @@ -0,0 +1,94 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedUnbondedMixnodesResponse", + "description": "Response containing paged list of all mixnodes that have ever unbonded.", + "type": "object", + "required": [ + "nodes", + "per_page" + ], + "properties": { + "nodes": { + "description": "The past ids of unbonded mixnodes alongside their basic information such as the owner or the identity key.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + { + "$ref": "#/definitions/UnbondedMixnode" + } + ], + "maxItems": 2, + "minItems": 2 + } + }, + "per_page": { + "description": "Maximum number of entries that could be included in a response. `per_page <= nodes.len()`", + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "UnbondedMixnode": { + "description": "Basic information of a node that used to be part of the mix network but has already unbonded.", + "type": "object", + "required": [ + "identity_key", + "owner", + "unbonding_height" + ], + "properties": { + "identity_key": { + "description": "Base58-encoded ed25519 EdDSA public key.", + "type": "string" + }, + "owner": { + "description": "Address of the owner of this mixnode.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "proxy": { + "description": "Entity who bonded this mixnode on behalf of the owner. If exists, it's most likely the address of the vesting contract.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + }, + "unbonding_height": { + "description": "Block height at which this mixnode has unbonded.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/mixnet/src/bin/schema.rs b/contracts/mixnet/src/bin/schema.rs new file mode 100644 index 0000000000..c1e48ba16a --- /dev/null +++ b/contracts/mixnet/src/bin/schema.rs @@ -0,0 +1,14 @@ +// Copyright 2023 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use cosmwasm_schema::write_api; +use mixnet_contract_common::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}; + +fn main() { + write_api! { + instantiate: InstantiateMsg, + query: QueryMsg, + execute: ExecuteMsg, + migrate: MigrateMsg, + } +} diff --git a/contracts/mixnet/src/contract.rs b/contracts/mixnet/src/contract.rs index f380b316f2..892f4d2298 100644 --- a/contracts/mixnet/src/contract.rs +++ b/contracts/mixnet/src/contract.rs @@ -404,12 +404,12 @@ pub fn query( to_binary(&crate::mixnet_contract_settings::queries::query_contract_version()) } QueryMsg::GetCW2ContractVersion {} => to_binary(&cw2::get_contract_version(deps.storage)?), - QueryMsg::GetStateParams {} => to_binary( - &crate::mixnet_contract_settings::queries::query_contract_settings_params(deps)?, - ), QueryMsg::GetRewardingValidatorAddress {} => to_binary( &crate::mixnet_contract_settings::queries::query_rewarding_validator_address(deps)?, ), + QueryMsg::GetStateParams {} => to_binary( + &crate::mixnet_contract_settings::queries::query_contract_settings_params(deps)?, + ), QueryMsg::GetState {} => { to_binary(&crate::mixnet_contract_settings::queries::query_contract_state(deps)?) } @@ -594,6 +594,8 @@ pub fn query( QueryMsg::GetNumberOfPendingEvents {} => to_binary( &crate::interval::queries::query_number_of_pending_events(deps)?, ), + + // signing-related QueryMsg::GetSigningNonce { address } => to_binary( &crate::signing::queries::query_current_signing_nonce(deps, address)?, ), diff --git a/contracts/mixnet/src/families/queries.rs b/contracts/mixnet/src/families/queries.rs index dc4799f0b9..96c7f79e23 100644 --- a/contracts/mixnet/src/families/queries.rs +++ b/contracts/mixnet/src/families/queries.rs @@ -1,47 +1,65 @@ // Copyright 2022-2023 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use super::storage::{families, get_family, get_members, MEMBERS}; +use super::storage::{families, get_members, must_get_family, MEMBERS}; use crate::constants::{FAMILIES_DEFAULT_RETRIEVAL_LIMIT, FAMILIES_MAX_RETRIEVAL_LIMIT}; +use crate::families::storage::must_get_family_by_label; use cosmwasm_std::{Order, Storage}; use cw_storage_plus::Bound; -use mixnet_contract_common::families::{Family, FamilyHead}; +use mixnet_contract_common::families::{ + Family, FamilyByHeadResponse, FamilyByLabelResponse, FamilyHead, FamilyMembersByHeadResponse, + PagedFamiliesResponse, PagedMembersResponse, +}; use mixnet_contract_common::{error::MixnetContractError, IdentityKeyRef}; -use mixnet_contract_common::{IdentityKey, PagedFamiliesResponse, PagedMembersResponse}; -use std::collections::HashSet; +use mixnet_contract_common::{FamilyMembersByLabelResponse, IdentityKey}; pub fn get_family_by_label( label: String, storage: &dyn Storage, -) -> Result, MixnetContractError> { - Ok(families().idx.label.item(storage, label)?.map(|o| o.1)) +) -> Result { + let family = families() + .idx + .label + .item(storage, label.clone())? + .map(|o| o.1); + Ok(FamilyByLabelResponse { label, family }) } pub fn get_family_by_head( head: IdentityKeyRef<'_>, storage: &dyn Storage, -) -> Result, MixnetContractError> { - Ok(families().may_load(storage, head.to_string())?) +) -> Result { + let family = families().may_load(storage, head.to_string())?; + Ok(FamilyByHeadResponse { + head: FamilyHead::new(head), + family, + }) } +// TODO: this should be returning a paged response! pub fn get_family_members_by_head( head: IdentityKeyRef<'_>, storage: &dyn Storage, -) -> Result, MixnetContractError> { +) -> Result { let family_head = FamilyHead::new(head); - let family = get_family(&family_head, storage)?; - get_members(&family, storage) + let family = must_get_family(&family_head, storage)?; + let members = get_members(&family, storage)?; + + Ok(FamilyMembersByHeadResponse { + head: family.head().to_owned(), + members, + }) } +// TODO: this should be returning a paged response! pub fn get_family_members_by_label( label: String, storage: &dyn Storage, -) -> Result>, MixnetContractError> { - if let Some(family) = families().idx.label.item(storage, label)?.map(|o| o.1) { - Ok(Some(get_members(&family, storage)?)) - } else { - Ok(None) - } +) -> Result { + let family = must_get_family_by_label(label.clone(), storage)?; + let members = get_members(&family, storage)?; + + Ok(FamilyMembersByLabelResponse { label, members }) } pub fn get_all_families_paged( diff --git a/contracts/mixnet/src/families/storage.rs b/contracts/mixnet/src/families/storage.rs index 1bdd421206..05b9566b7d 100644 --- a/contracts/mixnet/src/families/storage.rs +++ b/contracts/mixnet/src/families/storage.rs @@ -5,12 +5,13 @@ use cosmwasm_std::{Order, Storage}; use cw_storage_plus::{Index, IndexList, IndexedMap, Map, UniqueIndex}; use mixnet_contract_common::families::{Family, FamilyHead}; use mixnet_contract_common::{error::MixnetContractError, IdentityKey, IdentityKeyRef}; -use std::collections::HashSet; use crate::constants::{FAMILIES_INDEX_NAMESPACE, FAMILIES_MAP_NAMESPACE, MEMBERS_MAP_NAMESPACE}; +type FamilyHeadKey = IdentityKey; + pub struct FamilyIndex<'a> { - pub label: UniqueIndex<'a, String, Family>, + pub label: UniqueIndex<'a, FamilyHeadKey, Family>, } impl<'a> IndexList for FamilyIndex<'a> { @@ -21,7 +22,7 @@ impl<'a> IndexList for FamilyIndex<'a> { } // storage access function. -pub fn families<'a>() -> IndexedMap<'a, String, Family, FamilyIndex<'a>> { +pub fn families<'a>() -> IndexedMap<'a, FamilyHeadKey, Family, FamilyIndex<'a>> { let indexes = FamilyIndex { label: UniqueIndex::new(|d| d.label().to_string(), FAMILIES_INDEX_NAMESPACE), }; @@ -30,10 +31,11 @@ pub fn families<'a>() -> IndexedMap<'a, String, Family, FamilyIndex<'a>> { pub const MEMBERS: Map = Map::new(MEMBERS_MAP_NAMESPACE); +// TODO: this introduces an unbounded query. We should redesign it. pub fn get_members( family: &Family, store: &dyn Storage, -) -> Result, MixnetContractError> { +) -> Result, MixnetContractError> { Ok(MEMBERS .range(store, None, None, Order::Ascending) .filter_map(|res| res.ok()) @@ -42,15 +44,29 @@ pub fn get_members( .collect()) } -pub fn get_family(head: &FamilyHead, store: &dyn Storage) -> Result { +pub fn must_get_family( + head: &FamilyHead, + store: &dyn Storage, +) -> Result { let key = head.identity(); - if let Some(family) = families().may_load(store, key.to_string())? { - Ok(family) - } else { - Err(MixnetContractError::FamilyDoesNotExist { + + families() + .may_load(store, key.to_string())? + .ok_or(MixnetContractError::FamilyDoesNotExist { head: head.identity().to_string(), }) - } +} + +pub fn must_get_family_by_label( + label: String, + store: &dyn Storage, +) -> Result { + families() + .idx + .label + .item(store, label.clone())? + .map(|record| record.1) + .ok_or(MixnetContractError::FamilyLabelDoesNotExist { label }) } pub fn save_family(f: &Family, store: &mut dyn Storage) -> Result<(), MixnetContractError> { diff --git a/contracts/mixnet/src/families/transactions.rs b/contracts/mixnet/src/families/transactions.rs index 5a6a9b28e0..912cbc7146 100644 --- a/contracts/mixnet/src/families/transactions.rs +++ b/contracts/mixnet/src/families/transactions.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use super::storage::{ - add_family_member, get_family, is_any_member, is_family_member, remove_family_member, + add_family_member, is_any_member, is_family_member, must_get_family, remove_family_member, save_family, }; use crate::families::queries::get_family_by_label; @@ -48,12 +48,15 @@ fn _try_create_family( let family_head = FamilyHead::new(existing_bond.identity()); // can't overwrite existing family - if get_family(&family_head, deps.storage).is_ok() { + if must_get_family(&family_head, deps.storage).is_ok() { return Err(MixnetContractError::FamilyCanHaveOnlyOne); } // the label must be unique - if get_family_by_label(label.clone(), deps.storage)?.is_some() { + if get_family_by_label(label.clone(), deps.storage)? + .family + .is_some() + { return Err(MixnetContractError::FamilyWithLabelExists(label)); } @@ -118,7 +121,7 @@ fn _try_join_family( join_permit, )?; - let family = get_family(&family_head, deps.storage)?; + let family = must_get_family(&family_head, deps.storage)?; add_family_member(&family, deps.storage, existing_bond.identity())?; @@ -162,7 +165,7 @@ fn _try_leave_family( }); } - let family = get_family(&family_head, deps.storage)?; + let family = must_get_family(&family_head, deps.storage)?; if !is_family_member(deps.storage, &family, existing_bond.identity())? { return Err(MixnetContractError::NotAMember { head: family_head.identity().to_string(), @@ -215,7 +218,7 @@ fn _try_head_kick_member( // get the family details let family_head = FamilyHead::new(head_bond.identity()); - let family = get_family(&family_head, deps.storage)?; + let family = must_get_family(&family_head, deps.storage)?; // make sure the member we're trying to kick is an actual member if !is_family_member(deps.storage, &family, &member)? { @@ -290,7 +293,7 @@ mod test { try_create_family(test.deps_mut(), mock_info(head, &[]), "test".to_string()).unwrap(); let family_head = FamilyHead::new(&head_mixnode.identity_key); - assert!(get_family(&family_head, test.deps().storage).is_ok()); + assert!(must_get_family(&family_head, test.deps().storage).is_ok()); let nope = try_create_family( test.deps_mut(), @@ -306,12 +309,15 @@ mod test { }, } - let family = get_family_by_label("test".to_string(), test.deps().storage).unwrap(); + let family = get_family_by_label("test".to_string(), test.deps().storage) + .unwrap() + .family; assert!(family.is_some()); assert_eq!(family.unwrap().head_identity(), family_head.identity()); let family = get_family_by_head(family_head.identity(), test.deps().storage) .unwrap() + .family .unwrap(); assert_eq!(family.head_identity(), family_head.identity()); @@ -326,7 +332,7 @@ mod test { ) .unwrap(); - let family = get_family(&family_head, test.deps().storage).unwrap(); + let family = must_get_family(&family_head, test.deps().storage).unwrap(); assert!( is_family_member(test.deps().storage, &family, &member_mixnode.identity_key).unwrap() @@ -334,7 +340,7 @@ mod test { try_leave_family(test.deps_mut(), mock_info(member, &[]), family_head.clone()).unwrap(); - let family = get_family(&family_head, test.deps().storage).unwrap(); + let family = must_get_family(&family_head, test.deps().storage).unwrap(); assert!( !is_family_member(test.deps().storage, &family, &member_mixnode.identity_key).unwrap() ); @@ -350,7 +356,7 @@ mod test { ) .unwrap(); - let family = get_family(&family_head, test.deps().storage).unwrap(); + let family = must_get_family(&family_head, test.deps().storage).unwrap(); assert!( is_family_member(test.deps().storage, &family, &member_mixnode.identity_key).unwrap() @@ -363,7 +369,7 @@ mod test { ) .unwrap(); - let family = get_family(&family_head, test.deps().storage).unwrap(); + let family = must_get_family(&family_head, test.deps().storage).unwrap(); assert!( !is_family_member(test.deps().storage, &family, &member_mixnode.identity_key).unwrap() ); @@ -429,7 +435,7 @@ mod test { ); let head_identity = head_keys.public_key().to_base58_string(); - let family_head = FamilyHead::new(&head_identity); + let family_head = FamilyHead::new(head_identity); let res = try_join_family_on_behalf( test.deps_mut(), mock_info(illegal_proxy.as_ref(), &[]), @@ -475,7 +481,7 @@ mod test { ); let head_identity = head_keys.public_key().to_base58_string(); - let family_head = FamilyHead::new(&head_identity); + let family_head = FamilyHead::new(head_identity); try_join_family_on_behalf( test.deps_mut(), mock_info(vesting_contract.as_ref(), &[]), @@ -529,7 +535,7 @@ mod test { ); let head_identity = head_keys.public_key().to_base58_string(); - let family_head = FamilyHead::new(&head_identity); + let family_head = FamilyHead::new(head_identity); try_join_family_on_behalf( test.deps_mut(), diff --git a/contracts/mixnet/src/mixnodes/queries.rs b/contracts/mixnet/src/mixnodes/queries.rs index 5bf845c4a9..5d7b61054d 100644 --- a/contracts/mixnet/src/mixnodes/queries.rs +++ b/contracts/mixnet/src/mixnodes/queries.rs @@ -19,8 +19,8 @@ use mixnet_contract_common::mixnode::{ PagedUnbondedMixnodesResponse, StakeSaturationResponse, UnbondedMixnodeResponse, }; use mixnet_contract_common::{ - IdentityKey, LayerDistribution, MixId, MixOwnershipResponse, MixnodeDetailsResponse, - PagedMixnodeBondsResponse, + IdentityKey, LayerDistribution, MixId, MixOwnershipResponse, MixnodeDetailsByIdentityResponse, + MixnodeDetailsResponse, PagedMixnodeBondsResponse, }; pub fn query_mixnode_bonds_paged( @@ -189,12 +189,16 @@ pub fn query_mixnode_details(deps: Deps<'_>, mix_id: MixId) -> StdResult, - mix_identity: IdentityKey, -) -> StdResult> { - get_mixnode_details_by_identity(deps.storage, mix_identity) + identity_key: IdentityKey, +) -> StdResult { + let mixnode_details = get_mixnode_details_by_identity(deps.storage, identity_key.clone())?; + + Ok(MixnodeDetailsByIdentityResponse { + identity_key, + mixnode_details, + }) } pub fn query_mixnode_rewarding_details( @@ -1110,7 +1114,9 @@ pub(crate) mod tests { let mut test = TestSetup::new(); // no node under this identity - let res = query_mixnode_details_by_identity(test.deps(), "foomp".into()).unwrap(); + let res = query_mixnode_details_by_identity(test.deps(), "foomp".into()) + .unwrap() + .mixnode_details; assert!(res.is_none()); // it exists @@ -1122,7 +1128,9 @@ pub(crate) mod tests { .unwrap(); let mix_identity = expected.bond_information.identity(); - let res = query_mixnode_details_by_identity(test.deps(), mix_identity.into()).unwrap(); + let res = query_mixnode_details_by_identity(test.deps(), mix_identity.into()) + .unwrap() + .mixnode_details; assert_eq!(expected, res.unwrap()); } diff --git a/contracts/mixnet/src/support/tests/mod.rs b/contracts/mixnet/src/support/tests/mod.rs index 6b0e838a1a..851d394bfe 100644 --- a/contracts/mixnet/src/support/tests/mod.rs +++ b/contracts/mixnet/src/support/tests/mod.rs @@ -224,7 +224,7 @@ pub mod test_helpers { let join_permit = self.generate_family_join_permit(head_keys, &member_identity, vesting); - let family_head = FamilyHead::new(&head_identity); + let family_head = FamilyHead::new(head_identity); try_join_family( self.deps_mut(), diff --git a/contracts/multisig/cw3-flex-multisig/.cargo/config b/contracts/multisig/cw3-flex-multisig/.cargo/config index 8d4bc738b1..dbc331ef7a 100644 --- a/contracts/multisig/cw3-flex-multisig/.cargo/config +++ b/contracts/multisig/cw3-flex-multisig/.cargo/config @@ -1,6 +1,6 @@ [alias] -wasm = "build --release --target wasm32-unknown-unknown" -wasm-debug = "build --target wasm32-unknown-unknown" +wasm = "build --release --lib --target wasm32-unknown-unknown" +wasm-debug = "build --lib --target wasm32-unknown-unknown" unit-test = "test --lib" integration-test = "test --test integration" -schema = "run --example schema" +schema = "run --bin schema --features=schema-gen" \ No newline at end of file diff --git a/contracts/multisig/cw3-flex-multisig/Cargo.toml b/contracts/multisig/cw3-flex-multisig/Cargo.toml index b849828069..bd0e980bde 100644 --- a/contracts/multisig/cw3-flex-multisig/Cargo.toml +++ b/contracts/multisig/cw3-flex-multisig/Cargo.toml @@ -9,6 +9,10 @@ repository = "https://github.com/CosmWasm/cw-plus" homepage = "https://cosmwasm.com" documentation = "https://docs.cosmwasm.com" +[[bin]] +name = "schema" +required-features = ["schema-gen"] + [lib] crate-type = ["cdylib", "rlib"] @@ -16,6 +20,7 @@ crate-type = ["cdylib", "rlib"] backtraces = ["cosmwasm-std/backtraces"] # use library feature to disable all instantiate/execute/query exports library = [] +schema-gen = ["cosmwasm-schema"] [dependencies] cw-utils = { workspace = true } @@ -25,8 +30,8 @@ cw3-fixed-multisig = { workspace = true, features = ["library"] } cw4 = { workspace = true } cw20 = { workspace = true } cw-storage-plus = { workspace = true } +cosmwasm-schema = { workspace = true, optional = true } cosmwasm-std = { workspace = true } -schemars = "0.8.1" nym-group-contract-common = { path = "../../../common/cosmwasm-smart-contracts/group-contract" } nym-multisig-contract-common = { path= "../../../common/cosmwasm-smart-contracts/multisig-contract" } diff --git a/contracts/multisig/cw3-flex-multisig/Makefile b/contracts/multisig/cw3-flex-multisig/Makefile new file mode 100644 index 0000000000..f138e2c879 --- /dev/null +++ b/contracts/multisig/cw3-flex-multisig/Makefile @@ -0,0 +1,2 @@ +generate-schema: + cargo schema \ No newline at end of file diff --git a/contracts/multisig/cw3-flex-multisig/schema/cw3-flex-multisig.json b/contracts/multisig/cw3-flex-multisig/schema/cw3-flex-multisig.json new file mode 100644 index 0000000000..7f49430331 --- /dev/null +++ b/contracts/multisig/cw3-flex-multisig/schema/cw3-flex-multisig.json @@ -0,0 +1,5201 @@ +{ + "contract_name": "cw3-flex-multisig", + "contract_version": "1.0.0", + "idl_version": "1.0.0", + "instantiate": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "coconut_bandwidth_contract_address", + "coconut_dkg_contract_address", + "group_addr", + "max_voting_period", + "threshold" + ], + "properties": { + "coconut_bandwidth_contract_address": { + "type": "string" + }, + "coconut_dkg_contract_address": { + "type": "string" + }, + "executor": { + "anyOf": [ + { + "$ref": "#/definitions/Executor" + }, + { + "type": "null" + } + ] + }, + "group_addr": { + "type": "string" + }, + "max_voting_period": { + "$ref": "#/definitions/Duration" + }, + "proposal_deposit": { + "description": "The cost of creating a proposal (if any).", + "anyOf": [ + { + "$ref": "#/definitions/UncheckedDepositInfo" + }, + { + "type": "null" + } + ] + }, + "threshold": { + "$ref": "#/definitions/Threshold" + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Duration": { + "description": "Duration is a delta of time. You can add it to a BlockInfo or Expiration to move that further in the future. Note that an height-based Duration and a time-based Expiration cannot be combined", + "oneOf": [ + { + "type": "object", + "required": [ + "height" + ], + "properties": { + "height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "Time in seconds", + "type": "object", + "required": [ + "time" + ], + "properties": { + "time": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + ] + }, + "Executor": { + "description": "Defines who is able to execute proposals once passed", + "oneOf": [ + { + "description": "Any member of the voting group, even with 0 points", + "type": "string", + "enum": [ + "member" + ] + }, + { + "description": "Only the given address", + "type": "object", + "required": [ + "only" + ], + "properties": { + "only": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + ] + }, + "Threshold": { + "description": "This defines the different ways tallies can happen.\n\nThe total_weight used for calculating success as well as the weights of each individual voter used in tallying should be snapshotted at the beginning of the block at which the proposal starts (this is likely the responsibility of a correct cw4 implementation). See also `ThresholdResponse` in the cw3 spec.", + "oneOf": [ + { + "description": "Declares that a fixed weight of Yes votes is needed to pass. See `ThresholdResponse.AbsoluteCount` in the cw3 spec for details.", + "type": "object", + "required": [ + "absolute_count" + ], + "properties": { + "absolute_count": { + "type": "object", + "required": [ + "weight" + ], + "properties": { + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Declares a percentage of the total weight that must cast Yes votes in order for a proposal to pass. See `ThresholdResponse.AbsolutePercentage` in the cw3 spec for details.", + "type": "object", + "required": [ + "absolute_percentage" + ], + "properties": { + "absolute_percentage": { + "type": "object", + "required": [ + "percentage" + ], + "properties": { + "percentage": { + "$ref": "#/definitions/Decimal" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Declares a `quorum` of the total votes that must participate in the election in order for the vote to be considered at all. See `ThresholdResponse.ThresholdQuorum` in the cw3 spec for details.", + "type": "object", + "required": [ + "threshold_quorum" + ], + "properties": { + "threshold_quorum": { + "type": "object", + "required": [ + "quorum", + "threshold" + ], + "properties": { + "quorum": { + "$ref": "#/definitions/Decimal" + }, + "threshold": { + "$ref": "#/definitions/Decimal" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "UncheckedDenom": { + "oneOf": [ + { + "type": "object", + "required": [ + "native" + ], + "properties": { + "native": { + "type": "string" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "cw20" + ], + "properties": { + "cw20": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "UncheckedDepositInfo": { + "description": "Information about the deposit required to create a proposal. For use in messages. To validate, transform into `DepositInfo` via `into_checked()`.", + "type": "object", + "required": [ + "amount", + "denom", + "refund_failed_proposals" + ], + "properties": { + "amount": { + "description": "The number tokens required for payment.", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "denom": { + "description": "The denom of the deposit payment.", + "allOf": [ + { + "$ref": "#/definitions/UncheckedDenom" + } + ] + }, + "refund_failed_proposals": { + "description": "Should failed proposals have their deposits refunded?", + "type": "boolean" + } + }, + "additionalProperties": false + } + } + }, + "execute": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "propose" + ], + "properties": { + "propose": { + "type": "object", + "required": [ + "description", + "msgs", + "title" + ], + "properties": { + "description": { + "type": "string" + }, + "latest": { + "anyOf": [ + { + "$ref": "#/definitions/Expiration" + }, + { + "type": "null" + } + ] + }, + "msgs": { + "type": "array", + "items": { + "$ref": "#/definitions/CosmosMsg_for_Empty" + } + }, + "title": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "vote" + ], + "properties": { + "vote": { + "type": "object", + "required": [ + "proposal_id", + "vote" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "vote": { + "$ref": "#/definitions/Vote" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "execute" + ], + "properties": { + "execute": { + "type": "object", + "required": [ + "proposal_id" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "close" + ], + "properties": { + "close": { + "type": "object", + "required": [ + "proposal_id" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Handles update hook messages from the group contract", + "type": "object", + "required": [ + "member_changed_hook" + ], + "properties": { + "member_changed_hook": { + "$ref": "#/definitions/MemberChangedHookMsg" + } + }, + "additionalProperties": false + } + ], + "definitions": { + "BankMsg": { + "description": "The message types of the bank module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto", + "oneOf": [ + { + "description": "Sends native tokens from the contract to the given address.\n\nThis is translated to a [MsgSend](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto#L19-L28). `from_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "send" + ], + "properties": { + "send": { + "type": "object", + "required": [ + "amount", + "to_address" + ], + "properties": { + "amount": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "to_address": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This will burn the given coins from the contract's account. There is no Cosmos SDK message that performs this, but it can be done by calling the bank keeper. Important if a contract controls significant token supply that must be retired.", + "type": "object", + "required": [ + "burn" + ], + "properties": { + "burn": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Binary": { + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "CosmosMsg_for_Empty": { + "oneOf": [ + { + "type": "object", + "required": [ + "bank" + ], + "properties": { + "bank": { + "$ref": "#/definitions/BankMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "custom" + ], + "properties": { + "custom": { + "$ref": "#/definitions/Empty" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "staking" + ], + "properties": { + "staking": { + "$ref": "#/definitions/StakingMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "distribution" + ], + "properties": { + "distribution": { + "$ref": "#/definitions/DistributionMsg" + } + }, + "additionalProperties": false + }, + { + "description": "A Stargate message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)", + "type": "object", + "required": [ + "stargate" + ], + "properties": { + "stargate": { + "type": "object", + "required": [ + "type_url", + "value" + ], + "properties": { + "type_url": { + "type": "string" + }, + "value": { + "$ref": "#/definitions/Binary" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "ibc" + ], + "properties": { + "ibc": { + "$ref": "#/definitions/IbcMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "wasm" + ], + "properties": { + "wasm": { + "$ref": "#/definitions/WasmMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "gov" + ], + "properties": { + "gov": { + "$ref": "#/definitions/GovMsg" + } + }, + "additionalProperties": false + } + ] + }, + "DistributionMsg": { + "description": "The message types of the distribution module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto", + "oneOf": [ + { + "description": "This is translated to a [MsgSetWithdrawAddress](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#L29-L37). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "set_withdraw_address" + ], + "properties": { + "set_withdraw_address": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "description": "The `withdraw_address`", + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [[MsgWithdrawDelegatorReward](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#L42-L50). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "withdraw_delegator_reward" + ], + "properties": { + "withdraw_delegator_reward": { + "type": "object", + "required": [ + "validator" + ], + "properties": { + "validator": { + "description": "The `validator_address`", + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Empty": { + "description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)", + "type": "object" + }, + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "GovMsg": { + "description": "This message type allows the contract interact with the [x/gov] module in order to cast votes.\n\n[x/gov]: https://github.com/cosmos/cosmos-sdk/tree/v0.45.12/x/gov\n\n## Examples\n\nCast a simple vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); use cosmwasm_std::{GovMsg, VoteOption};\n\n#[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::Vote { proposal_id: 4, vote: VoteOption::Yes, })) } ```\n\nCast a weighted vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); # #[cfg(feature = \"cosmwasm_1_2\")] use cosmwasm_std::{Decimal, GovMsg, VoteOption, WeightedVoteOption};\n\n# #[cfg(feature = \"cosmwasm_1_2\")] #[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::VoteWeighted { proposal_id: 4, options: vec![ WeightedVoteOption { option: VoteOption::Yes, weight: Decimal::percent(65), }, WeightedVoteOption { option: VoteOption::Abstain, weight: Decimal::percent(35), }, ], })) } ```", + "oneOf": [ + { + "description": "This maps directly to [MsgVote](https://github.com/cosmos/cosmos-sdk/blob/v0.42.5/proto/cosmos/gov/v1beta1/tx.proto#L46-L56) in the Cosmos SDK with voter set to the contract address.", + "type": "object", + "required": [ + "vote" + ], + "properties": { + "vote": { + "type": "object", + "required": [ + "proposal_id", + "vote" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "vote": { + "description": "The vote option.\n\nThis should be called \"option\" for consistency with Cosmos SDK. Sorry for that. See .", + "allOf": [ + { + "$ref": "#/definitions/VoteOption" + } + ] + } + } + } + }, + "additionalProperties": false + } + ] + }, + "IbcMsg": { + "description": "These are messages in the IBC lifecycle. Only usable by IBC-enabled contracts (contracts that directly speak the IBC protocol via 6 entry points)", + "oneOf": [ + { + "description": "Sends bank tokens owned by the contract to the given address on another chain. The channel must already be established between the ibctransfer module on this chain and a matching module on the remote chain. We cannot select the port_id, this is whatever the local chain has bound the ibctransfer module to.", + "type": "object", + "required": [ + "transfer" + ], + "properties": { + "transfer": { + "type": "object", + "required": [ + "amount", + "channel_id", + "timeout", + "to_address" + ], + "properties": { + "amount": { + "description": "packet data only supports one coin https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/ibc/applications/transfer/v1/transfer.proto#L11-L20", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "channel_id": { + "description": "exisiting channel to send the tokens over", + "type": "string" + }, + "timeout": { + "description": "when packet times out, measured on remote chain", + "allOf": [ + { + "$ref": "#/definitions/IbcTimeout" + } + ] + }, + "to_address": { + "description": "address on the remote chain to receive these tokens", + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Sends an IBC packet with given data over the existing channel. Data should be encoded in a format defined by the channel version, and the module on the other side should know how to parse this.", + "type": "object", + "required": [ + "send_packet" + ], + "properties": { + "send_packet": { + "type": "object", + "required": [ + "channel_id", + "data", + "timeout" + ], + "properties": { + "channel_id": { + "type": "string" + }, + "data": { + "$ref": "#/definitions/Binary" + }, + "timeout": { + "description": "when packet times out, measured on remote chain", + "allOf": [ + { + "$ref": "#/definitions/IbcTimeout" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This will close an existing channel that is owned by this contract. Port is auto-assigned to the contract's IBC port", + "type": "object", + "required": [ + "close_channel" + ], + "properties": { + "close_channel": { + "type": "object", + "required": [ + "channel_id" + ], + "properties": { + "channel_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "IbcTimeout": { + "description": "In IBC each package must set at least one type of timeout: the timestamp or the block height. Using this rather complex enum instead of two timeout fields we ensure that at least one timeout is set.", + "type": "object", + "properties": { + "block": { + "anyOf": [ + { + "$ref": "#/definitions/IbcTimeoutBlock" + }, + { + "type": "null" + } + ] + }, + "timestamp": { + "anyOf": [ + { + "$ref": "#/definitions/Timestamp" + }, + { + "type": "null" + } + ] + } + } + }, + "IbcTimeoutBlock": { + "description": "IBCTimeoutHeight Height is a monotonically increasing data type that can be compared against another Height for the purposes of updating and freezing clients. Ordering is (revision_number, timeout_height)", + "type": "object", + "required": [ + "height", + "revision" + ], + "properties": { + "height": { + "description": "block height after which the packet times out. the height within the given revision", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "revision": { + "description": "the version that the client is currently on (eg. after reseting the chain this could increment 1 as height drops to 0)", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "MemberChangedHookMsg": { + "description": "MemberChangedHookMsg should be de/serialized under `MemberChangedHook()` variant in a ExecuteMsg. This contains a list of all diffs on the given transaction.", + "type": "object", + "required": [ + "diffs" + ], + "properties": { + "diffs": { + "type": "array", + "items": { + "$ref": "#/definitions/MemberDiff" + } + } + }, + "additionalProperties": false + }, + "MemberDiff": { + "description": "MemberDiff shows the old and new states for a given cw4 member They cannot both be None. old = None, new = Some -> Insert old = Some, new = Some -> Update old = Some, new = None -> Delete", + "type": "object", + "required": [ + "key" + ], + "properties": { + "key": { + "type": "string" + }, + "new": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "old": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "StakingMsg": { + "description": "The message types of the staking module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto", + "oneOf": [ + { + "description": "This is translated to a [MsgDelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L81-L90). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "delegate" + ], + "properties": { + "delegate": { + "type": "object", + "required": [ + "amount", + "validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [MsgUndelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L112-L121). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "undelegate" + ], + "properties": { + "undelegate": { + "type": "object", + "required": [ + "amount", + "validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [MsgBeginRedelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L95-L105). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "redelegate" + ], + "properties": { + "redelegate": { + "type": "object", + "required": [ + "amount", + "dst_validator", + "src_validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "dst_validator": { + "type": "string" + }, + "src_validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + }, + "Vote": { + "oneOf": [ + { + "description": "Marks support for the proposal.", + "type": "string", + "enum": [ + "yes" + ] + }, + { + "description": "Marks opposition to the proposal.", + "type": "string", + "enum": [ + "no" + ] + }, + { + "description": "Marks participation but does not count towards the ratio of support / opposed", + "type": "string", + "enum": [ + "abstain" + ] + }, + { + "description": "Veto is generally to be treated as a No vote. Some implementations may allow certain voters to be able to Veto, or them to be counted stronger than No in some way.", + "type": "string", + "enum": [ + "veto" + ] + } + ] + }, + "VoteOption": { + "type": "string", + "enum": [ + "yes", + "no", + "abstain", + "no_with_veto" + ] + }, + "WasmMsg": { + "description": "The message types of the wasm module.\n\nSee https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto", + "oneOf": [ + { + "description": "Dispatches a call to another contract at a known address (with known ABI).\n\nThis is translated to a [MsgExecuteContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L68-L78). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "execute" + ], + "properties": { + "execute": { + "type": "object", + "required": [ + "contract_addr", + "funds", + "msg" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "funds": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "msg": { + "description": "msg is the json-encoded ExecuteMsg struct (as raw Binary)", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThe contract address is non-predictable. But it is guaranteed that when emitting the same Instantiate message multiple times, multiple instances on different addresses will be generated. See also Instantiate2.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L53-L71). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "instantiate" + ], + "properties": { + "instantiate": { + "type": "object", + "required": [ + "code_id", + "funds", + "label", + "msg" + ], + "properties": { + "admin": { + "type": [ + "string", + "null" + ] + }, + "code_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "funds": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "label": { + "description": "A human-readbale label for the contract", + "type": "string" + }, + "msg": { + "description": "msg is the JSON-encoded InstantiateMsg struct (as raw Binary)", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Migrates a given contracts to use new wasm code. Passes a MigrateMsg to allow us to customize behavior.\n\nOnly the contract admin (as defined in wasmd), if any, is able to make this call.\n\nThis is translated to a [MsgMigrateContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L86-L96). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "migrate" + ], + "properties": { + "migrate": { + "type": "object", + "required": [ + "contract_addr", + "msg", + "new_code_id" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "msg": { + "description": "msg is the json-encoded MigrateMsg struct that will be passed to the new code", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "new_code_id": { + "description": "the code_id of the new logic to place in the given contract", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Sets a new admin (for migrate) on the given contract. Fails if this contract is not currently admin of the target contract.", + "type": "object", + "required": [ + "update_admin" + ], + "properties": { + "update_admin": { + "type": "object", + "required": [ + "admin", + "contract_addr" + ], + "properties": { + "admin": { + "type": "string" + }, + "contract_addr": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Clears the admin on the given contract, so no more migration possible. Fails if this contract is not currently admin of the target contract.", + "type": "object", + "required": [ + "clear_admin" + ], + "properties": { + "clear_admin": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + } + } + }, + "query": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "threshold" + ], + "properties": { + "threshold": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "proposal" + ], + "properties": { + "proposal": { + "type": "object", + "required": [ + "proposal_id" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "list_proposals" + ], + "properties": { + "list_proposals": { + "type": "object", + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "reverse_proposals" + ], + "properties": { + "reverse_proposals": { + "type": "object", + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_before": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "vote" + ], + "properties": { + "vote": { + "type": "object", + "required": [ + "proposal_id", + "voter" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "voter": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "list_votes" + ], + "properties": { + "list_votes": { + "type": "object", + "required": [ + "proposal_id" + ], + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "voter" + ], + "properties": { + "voter": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "list_voters" + ], + "properties": { + "list_voters": { + "type": "object", + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the current configuration.", + "type": "object", + "required": [ + "config" + ], + "properties": { + "config": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "migrate": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MigrateMsg", + "type": "object", + "required": [ + "coconut_bandwidth_address", + "coconut_dkg_address" + ], + "properties": { + "coconut_bandwidth_address": { + "type": "string" + }, + "coconut_dkg_address": { + "type": "string" + } + }, + "additionalProperties": false + }, + "sudo": null, + "responses": { + "config": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Config", + "type": "object", + "required": [ + "coconut_bandwidth_addr", + "coconut_dkg_addr", + "group_addr", + "max_voting_period", + "threshold" + ], + "properties": { + "coconut_bandwidth_addr": { + "$ref": "#/definitions/Addr" + }, + "coconut_dkg_addr": { + "$ref": "#/definitions/Addr" + }, + "executor": { + "anyOf": [ + { + "$ref": "#/definitions/Executor" + }, + { + "type": "null" + } + ] + }, + "group_addr": { + "$ref": "#/definitions/Cw4Contract" + }, + "max_voting_period": { + "$ref": "#/definitions/Duration" + }, + "proposal_deposit": { + "description": "The price, if any, of creating a new proposal.", + "anyOf": [ + { + "$ref": "#/definitions/DepositInfo" + }, + { + "type": "null" + } + ] + }, + "threshold": { + "$ref": "#/definitions/Threshold" + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Cw4Contract": { + "description": "Cw4Contract is a wrapper around Addr that provides a lot of helpers for working with cw4 contracts\n\nIf you wish to persist this, convert to Cw4CanonicalContract via .canonical()", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Denom": { + "oneOf": [ + { + "type": "object", + "required": [ + "native" + ], + "properties": { + "native": { + "type": "string" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "cw20" + ], + "properties": { + "cw20": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + ] + }, + "DepositInfo": { + "description": "Information about the deposit required to create a proposal.", + "type": "object", + "required": [ + "amount", + "denom", + "refund_failed_proposals" + ], + "properties": { + "amount": { + "description": "The number tokens required for payment.", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "denom": { + "description": "The denom of the deposit payment.", + "allOf": [ + { + "$ref": "#/definitions/Denom" + } + ] + }, + "refund_failed_proposals": { + "description": "Should failed proposals have their deposits refunded?", + "type": "boolean" + } + }, + "additionalProperties": false + }, + "Duration": { + "description": "Duration is a delta of time. You can add it to a BlockInfo or Expiration to move that further in the future. Note that an height-based Duration and a time-based Expiration cannot be combined", + "oneOf": [ + { + "type": "object", + "required": [ + "height" + ], + "properties": { + "height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "Time in seconds", + "type": "object", + "required": [ + "time" + ], + "properties": { + "time": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + ] + }, + "Executor": { + "description": "Defines who is able to execute proposals once passed", + "oneOf": [ + { + "description": "Any member of the voting group, even with 0 points", + "type": "string", + "enum": [ + "member" + ] + }, + { + "description": "Only the given address", + "type": "object", + "required": [ + "only" + ], + "properties": { + "only": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + ] + }, + "Threshold": { + "description": "This defines the different ways tallies can happen.\n\nThe total_weight used for calculating success as well as the weights of each individual voter used in tallying should be snapshotted at the beginning of the block at which the proposal starts (this is likely the responsibility of a correct cw4 implementation). See also `ThresholdResponse` in the cw3 spec.", + "oneOf": [ + { + "description": "Declares that a fixed weight of Yes votes is needed to pass. See `ThresholdResponse.AbsoluteCount` in the cw3 spec for details.", + "type": "object", + "required": [ + "absolute_count" + ], + "properties": { + "absolute_count": { + "type": "object", + "required": [ + "weight" + ], + "properties": { + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Declares a percentage of the total weight that must cast Yes votes in order for a proposal to pass. See `ThresholdResponse.AbsolutePercentage` in the cw3 spec for details.", + "type": "object", + "required": [ + "absolute_percentage" + ], + "properties": { + "absolute_percentage": { + "type": "object", + "required": [ + "percentage" + ], + "properties": { + "percentage": { + "$ref": "#/definitions/Decimal" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Declares a `quorum` of the total votes that must participate in the election in order for the vote to be considered at all. See `ThresholdResponse.ThresholdQuorum` in the cw3 spec for details.", + "type": "object", + "required": [ + "threshold_quorum" + ], + "properties": { + "threshold_quorum": { + "type": "object", + "required": [ + "quorum", + "threshold" + ], + "properties": { + "quorum": { + "$ref": "#/definitions/Decimal" + }, + "threshold": { + "$ref": "#/definitions/Decimal" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "list_proposals": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ProposalListResponse_for_Empty", + "type": "object", + "required": [ + "proposals" + ], + "properties": { + "proposals": { + "type": "array", + "items": { + "$ref": "#/definitions/ProposalResponse_for_Empty" + } + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "BankMsg": { + "description": "The message types of the bank module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto", + "oneOf": [ + { + "description": "Sends native tokens from the contract to the given address.\n\nThis is translated to a [MsgSend](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto#L19-L28). `from_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "send" + ], + "properties": { + "send": { + "type": "object", + "required": [ + "amount", + "to_address" + ], + "properties": { + "amount": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "to_address": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This will burn the given coins from the contract's account. There is no Cosmos SDK message that performs this, but it can be done by calling the bank keeper. Important if a contract controls significant token supply that must be retired.", + "type": "object", + "required": [ + "burn" + ], + "properties": { + "burn": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Binary": { + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "CosmosMsg_for_Empty": { + "oneOf": [ + { + "type": "object", + "required": [ + "bank" + ], + "properties": { + "bank": { + "$ref": "#/definitions/BankMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "custom" + ], + "properties": { + "custom": { + "$ref": "#/definitions/Empty" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "staking" + ], + "properties": { + "staking": { + "$ref": "#/definitions/StakingMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "distribution" + ], + "properties": { + "distribution": { + "$ref": "#/definitions/DistributionMsg" + } + }, + "additionalProperties": false + }, + { + "description": "A Stargate message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)", + "type": "object", + "required": [ + "stargate" + ], + "properties": { + "stargate": { + "type": "object", + "required": [ + "type_url", + "value" + ], + "properties": { + "type_url": { + "type": "string" + }, + "value": { + "$ref": "#/definitions/Binary" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "ibc" + ], + "properties": { + "ibc": { + "$ref": "#/definitions/IbcMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "wasm" + ], + "properties": { + "wasm": { + "$ref": "#/definitions/WasmMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "gov" + ], + "properties": { + "gov": { + "$ref": "#/definitions/GovMsg" + } + }, + "additionalProperties": false + } + ] + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Denom": { + "oneOf": [ + { + "type": "object", + "required": [ + "native" + ], + "properties": { + "native": { + "type": "string" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "cw20" + ], + "properties": { + "cw20": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + ] + }, + "DepositInfo": { + "description": "Information about the deposit required to create a proposal.", + "type": "object", + "required": [ + "amount", + "denom", + "refund_failed_proposals" + ], + "properties": { + "amount": { + "description": "The number tokens required for payment.", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "denom": { + "description": "The denom of the deposit payment.", + "allOf": [ + { + "$ref": "#/definitions/Denom" + } + ] + }, + "refund_failed_proposals": { + "description": "Should failed proposals have their deposits refunded?", + "type": "boolean" + } + }, + "additionalProperties": false + }, + "DistributionMsg": { + "description": "The message types of the distribution module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto", + "oneOf": [ + { + "description": "This is translated to a [MsgSetWithdrawAddress](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#L29-L37). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "set_withdraw_address" + ], + "properties": { + "set_withdraw_address": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "description": "The `withdraw_address`", + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [[MsgWithdrawDelegatorReward](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#L42-L50). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "withdraw_delegator_reward" + ], + "properties": { + "withdraw_delegator_reward": { + "type": "object", + "required": [ + "validator" + ], + "properties": { + "validator": { + "description": "The `validator_address`", + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Empty": { + "description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)", + "type": "object" + }, + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "GovMsg": { + "description": "This message type allows the contract interact with the [x/gov] module in order to cast votes.\n\n[x/gov]: https://github.com/cosmos/cosmos-sdk/tree/v0.45.12/x/gov\n\n## Examples\n\nCast a simple vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); use cosmwasm_std::{GovMsg, VoteOption};\n\n#[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::Vote { proposal_id: 4, vote: VoteOption::Yes, })) } ```\n\nCast a weighted vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); # #[cfg(feature = \"cosmwasm_1_2\")] use cosmwasm_std::{Decimal, GovMsg, VoteOption, WeightedVoteOption};\n\n# #[cfg(feature = \"cosmwasm_1_2\")] #[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::VoteWeighted { proposal_id: 4, options: vec![ WeightedVoteOption { option: VoteOption::Yes, weight: Decimal::percent(65), }, WeightedVoteOption { option: VoteOption::Abstain, weight: Decimal::percent(35), }, ], })) } ```", + "oneOf": [ + { + "description": "This maps directly to [MsgVote](https://github.com/cosmos/cosmos-sdk/blob/v0.42.5/proto/cosmos/gov/v1beta1/tx.proto#L46-L56) in the Cosmos SDK with voter set to the contract address.", + "type": "object", + "required": [ + "vote" + ], + "properties": { + "vote": { + "type": "object", + "required": [ + "proposal_id", + "vote" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "vote": { + "description": "The vote option.\n\nThis should be called \"option\" for consistency with Cosmos SDK. Sorry for that. See .", + "allOf": [ + { + "$ref": "#/definitions/VoteOption" + } + ] + } + } + } + }, + "additionalProperties": false + } + ] + }, + "IbcMsg": { + "description": "These are messages in the IBC lifecycle. Only usable by IBC-enabled contracts (contracts that directly speak the IBC protocol via 6 entry points)", + "oneOf": [ + { + "description": "Sends bank tokens owned by the contract to the given address on another chain. The channel must already be established between the ibctransfer module on this chain and a matching module on the remote chain. We cannot select the port_id, this is whatever the local chain has bound the ibctransfer module to.", + "type": "object", + "required": [ + "transfer" + ], + "properties": { + "transfer": { + "type": "object", + "required": [ + "amount", + "channel_id", + "timeout", + "to_address" + ], + "properties": { + "amount": { + "description": "packet data only supports one coin https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/ibc/applications/transfer/v1/transfer.proto#L11-L20", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "channel_id": { + "description": "exisiting channel to send the tokens over", + "type": "string" + }, + "timeout": { + "description": "when packet times out, measured on remote chain", + "allOf": [ + { + "$ref": "#/definitions/IbcTimeout" + } + ] + }, + "to_address": { + "description": "address on the remote chain to receive these tokens", + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Sends an IBC packet with given data over the existing channel. Data should be encoded in a format defined by the channel version, and the module on the other side should know how to parse this.", + "type": "object", + "required": [ + "send_packet" + ], + "properties": { + "send_packet": { + "type": "object", + "required": [ + "channel_id", + "data", + "timeout" + ], + "properties": { + "channel_id": { + "type": "string" + }, + "data": { + "$ref": "#/definitions/Binary" + }, + "timeout": { + "description": "when packet times out, measured on remote chain", + "allOf": [ + { + "$ref": "#/definitions/IbcTimeout" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This will close an existing channel that is owned by this contract. Port is auto-assigned to the contract's IBC port", + "type": "object", + "required": [ + "close_channel" + ], + "properties": { + "close_channel": { + "type": "object", + "required": [ + "channel_id" + ], + "properties": { + "channel_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "IbcTimeout": { + "description": "In IBC each package must set at least one type of timeout: the timestamp or the block height. Using this rather complex enum instead of two timeout fields we ensure that at least one timeout is set.", + "type": "object", + "properties": { + "block": { + "anyOf": [ + { + "$ref": "#/definitions/IbcTimeoutBlock" + }, + { + "type": "null" + } + ] + }, + "timestamp": { + "anyOf": [ + { + "$ref": "#/definitions/Timestamp" + }, + { + "type": "null" + } + ] + } + } + }, + "IbcTimeoutBlock": { + "description": "IBCTimeoutHeight Height is a monotonically increasing data type that can be compared against another Height for the purposes of updating and freezing clients. Ordering is (revision_number, timeout_height)", + "type": "object", + "required": [ + "height", + "revision" + ], + "properties": { + "height": { + "description": "block height after which the packet times out. the height within the given revision", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "revision": { + "description": "the version that the client is currently on (eg. after reseting the chain this could increment 1 as height drops to 0)", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "ProposalResponse_for_Empty": { + "description": "Note, if you are storing custom messages in the proposal, the querier needs to know what possible custom message types those are in order to parse the response", + "type": "object", + "required": [ + "description", + "expires", + "id", + "msgs", + "proposer", + "status", + "threshold", + "title" + ], + "properties": { + "deposit": { + "anyOf": [ + { + "$ref": "#/definitions/DepositInfo" + }, + { + "type": "null" + } + ] + }, + "description": { + "type": "string" + }, + "expires": { + "$ref": "#/definitions/Expiration" + }, + "id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "msgs": { + "type": "array", + "items": { + "$ref": "#/definitions/CosmosMsg_for_Empty" + } + }, + "proposer": { + "$ref": "#/definitions/Addr" + }, + "status": { + "$ref": "#/definitions/Status" + }, + "threshold": { + "description": "This is the threshold that is applied to this proposal. Both the rules of the voting contract, as well as the total_weight of the voting group may have changed since this time. That means that the generic `Threshold{}` query does not provide valid information for existing proposals.", + "allOf": [ + { + "$ref": "#/definitions/ThresholdResponse" + } + ] + }, + "title": { + "type": "string" + } + }, + "additionalProperties": false + }, + "StakingMsg": { + "description": "The message types of the staking module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto", + "oneOf": [ + { + "description": "This is translated to a [MsgDelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L81-L90). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "delegate" + ], + "properties": { + "delegate": { + "type": "object", + "required": [ + "amount", + "validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [MsgUndelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L112-L121). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "undelegate" + ], + "properties": { + "undelegate": { + "type": "object", + "required": [ + "amount", + "validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [MsgBeginRedelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L95-L105). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "redelegate" + ], + "properties": { + "redelegate": { + "type": "object", + "required": [ + "amount", + "dst_validator", + "src_validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "dst_validator": { + "type": "string" + }, + "src_validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Status": { + "oneOf": [ + { + "description": "proposal was created, but voting has not yet begun for whatever reason", + "type": "string", + "enum": [ + "pending" + ] + }, + { + "description": "you can vote on this", + "type": "string", + "enum": [ + "open" + ] + }, + { + "description": "voting is over and it did not pass", + "type": "string", + "enum": [ + "rejected" + ] + }, + { + "description": "voting is over and it did pass, but has not yet executed", + "type": "string", + "enum": [ + "passed" + ] + }, + { + "description": "voting is over it passed, and the proposal was executed", + "type": "string", + "enum": [ + "executed" + ] + } + ] + }, + "ThresholdResponse": { + "description": "This defines the different ways tallies can happen. Every contract should support a subset of these, ideally all.\n\nThe total_weight used for calculating success as well as the weights of each individual voter used in tallying should be snapshotted at the beginning of the block at which the proposal starts (this is likely the responsibility of a correct cw4 implementation).", + "oneOf": [ + { + "description": "Declares that a fixed weight of yes votes is needed to pass. It does not matter how many no votes are cast, or how many do not vote, as long as `weight` yes votes are cast.\n\nThis is the simplest format and usually suitable for small multisigs of trusted parties, like 3 of 5. (weight: 3, total_weight: 5)\n\nA proposal of this type can pass early as soon as the needed weight of yes votes has been cast.", + "type": "object", + "required": [ + "absolute_count" + ], + "properties": { + "absolute_count": { + "type": "object", + "required": [ + "total_weight", + "weight" + ], + "properties": { + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Declares a percentage of the total weight that must cast Yes votes, in order for a proposal to pass. The passing weight is computed over the total weight minus the weight of the abstained votes.\n\nThis is useful for similar circumstances as `AbsoluteCount`, where we have a relatively small set of voters, and participation is required. It is understood that if the voting set (group) changes between different proposals that refer to the same group, each proposal will work with a different set of voter weights (the ones snapshotted at proposal creation), and the passing weight for each proposal will be computed based on the absolute percentage, times the total weights of the members at the time of each proposal creation.\n\nExample: we set `percentage` to 51%. Proposal 1 starts when there is a `total_weight` of 5. This will require 3 weight of Yes votes in order to pass. Later, the Proposal 2 starts but the `total_weight` of the group has increased to 9. That proposal will then automatically require 5 Yes of 9 to pass, rather than 3 yes of 9 as would be the case with `AbsoluteCount`.", + "type": "object", + "required": [ + "absolute_percentage" + ], + "properties": { + "absolute_percentage": { + "type": "object", + "required": [ + "percentage", + "total_weight" + ], + "properties": { + "percentage": { + "$ref": "#/definitions/Decimal" + }, + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "In addition to a `threshold`, declares a `quorum` of the total votes that must participate in the election in order for the vote to be considered at all. Within the votes that were cast, it requires `threshold` votes in favor. That is calculated by ignoring the Abstain votes (they count towards `quorum`, but do not influence `threshold`). That is, we calculate `Yes / (Yes + No + Veto)` and compare it with `threshold` to consider if the proposal was passed.\n\nIt is rather difficult for a proposal of this type to pass early. That can only happen if the required quorum has been already met, and there are already enough Yes votes for the proposal to pass.\n\n30% Yes votes, 10% No votes, and 20% Abstain would pass early if quorum <= 60% (who has cast votes) and if the threshold is <= 37.5% (the remaining 40% voting no => 30% yes + 50% no). Once the voting period has passed with no additional votes, that same proposal would be considered successful if quorum <= 60% and threshold <= 75% (percent in favor if we ignore abstain votes).\n\nThis type is more common in general elections, where participation is often expected to be low, and `AbsolutePercentage` would either be too high to pass anything, or allow low percentages to pass, independently of if there was high participation in the election or not.", + "type": "object", + "required": [ + "threshold_quorum" + ], + "properties": { + "threshold_quorum": { + "type": "object", + "required": [ + "quorum", + "threshold", + "total_weight" + ], + "properties": { + "quorum": { + "$ref": "#/definitions/Decimal" + }, + "threshold": { + "$ref": "#/definitions/Decimal" + }, + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + }, + "VoteOption": { + "type": "string", + "enum": [ + "yes", + "no", + "abstain", + "no_with_veto" + ] + }, + "WasmMsg": { + "description": "The message types of the wasm module.\n\nSee https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto", + "oneOf": [ + { + "description": "Dispatches a call to another contract at a known address (with known ABI).\n\nThis is translated to a [MsgExecuteContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L68-L78). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "execute" + ], + "properties": { + "execute": { + "type": "object", + "required": [ + "contract_addr", + "funds", + "msg" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "funds": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "msg": { + "description": "msg is the json-encoded ExecuteMsg struct (as raw Binary)", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThe contract address is non-predictable. But it is guaranteed that when emitting the same Instantiate message multiple times, multiple instances on different addresses will be generated. See also Instantiate2.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L53-L71). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "instantiate" + ], + "properties": { + "instantiate": { + "type": "object", + "required": [ + "code_id", + "funds", + "label", + "msg" + ], + "properties": { + "admin": { + "type": [ + "string", + "null" + ] + }, + "code_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "funds": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "label": { + "description": "A human-readbale label for the contract", + "type": "string" + }, + "msg": { + "description": "msg is the JSON-encoded InstantiateMsg struct (as raw Binary)", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Migrates a given contracts to use new wasm code. Passes a MigrateMsg to allow us to customize behavior.\n\nOnly the contract admin (as defined in wasmd), if any, is able to make this call.\n\nThis is translated to a [MsgMigrateContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L86-L96). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "migrate" + ], + "properties": { + "migrate": { + "type": "object", + "required": [ + "contract_addr", + "msg", + "new_code_id" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "msg": { + "description": "msg is the json-encoded MigrateMsg struct that will be passed to the new code", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "new_code_id": { + "description": "the code_id of the new logic to place in the given contract", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Sets a new admin (for migrate) on the given contract. Fails if this contract is not currently admin of the target contract.", + "type": "object", + "required": [ + "update_admin" + ], + "properties": { + "update_admin": { + "type": "object", + "required": [ + "admin", + "contract_addr" + ], + "properties": { + "admin": { + "type": "string" + }, + "contract_addr": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Clears the admin on the given contract, so no more migration possible. Fails if this contract is not currently admin of the target contract.", + "type": "object", + "required": [ + "clear_admin" + ], + "properties": { + "clear_admin": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + } + } + }, + "list_voters": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "VoterListResponse", + "type": "object", + "required": [ + "voters" + ], + "properties": { + "voters": { + "type": "array", + "items": { + "$ref": "#/definitions/VoterDetail" + } + } + }, + "additionalProperties": false, + "definitions": { + "VoterDetail": { + "type": "object", + "required": [ + "addr", + "weight" + ], + "properties": { + "addr": { + "type": "string" + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } + }, + "list_votes": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "VoteListResponse", + "type": "object", + "required": [ + "votes" + ], + "properties": { + "votes": { + "type": "array", + "items": { + "$ref": "#/definitions/VoteInfo" + } + } + }, + "additionalProperties": false, + "definitions": { + "Vote": { + "oneOf": [ + { + "description": "Marks support for the proposal.", + "type": "string", + "enum": [ + "yes" + ] + }, + { + "description": "Marks opposition to the proposal.", + "type": "string", + "enum": [ + "no" + ] + }, + { + "description": "Marks participation but does not count towards the ratio of support / opposed", + "type": "string", + "enum": [ + "abstain" + ] + }, + { + "description": "Veto is generally to be treated as a No vote. Some implementations may allow certain voters to be able to Veto, or them to be counted stronger than No in some way.", + "type": "string", + "enum": [ + "veto" + ] + } + ] + }, + "VoteInfo": { + "description": "Returns the vote (opinion as well as weight counted) as well as the address of the voter who submitted it", + "type": "object", + "required": [ + "proposal_id", + "vote", + "voter", + "weight" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "vote": { + "$ref": "#/definitions/Vote" + }, + "voter": { + "type": "string" + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } + }, + "proposal": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ProposalResponse_for_Empty", + "description": "Note, if you are storing custom messages in the proposal, the querier needs to know what possible custom message types those are in order to parse the response", + "type": "object", + "required": [ + "description", + "expires", + "id", + "msgs", + "proposer", + "status", + "threshold", + "title" + ], + "properties": { + "deposit": { + "anyOf": [ + { + "$ref": "#/definitions/DepositInfo" + }, + { + "type": "null" + } + ] + }, + "description": { + "type": "string" + }, + "expires": { + "$ref": "#/definitions/Expiration" + }, + "id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "msgs": { + "type": "array", + "items": { + "$ref": "#/definitions/CosmosMsg_for_Empty" + } + }, + "proposer": { + "$ref": "#/definitions/Addr" + }, + "status": { + "$ref": "#/definitions/Status" + }, + "threshold": { + "description": "This is the threshold that is applied to this proposal. Both the rules of the voting contract, as well as the total_weight of the voting group may have changed since this time. That means that the generic `Threshold{}` query does not provide valid information for existing proposals.", + "allOf": [ + { + "$ref": "#/definitions/ThresholdResponse" + } + ] + }, + "title": { + "type": "string" + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "BankMsg": { + "description": "The message types of the bank module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto", + "oneOf": [ + { + "description": "Sends native tokens from the contract to the given address.\n\nThis is translated to a [MsgSend](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto#L19-L28). `from_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "send" + ], + "properties": { + "send": { + "type": "object", + "required": [ + "amount", + "to_address" + ], + "properties": { + "amount": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "to_address": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This will burn the given coins from the contract's account. There is no Cosmos SDK message that performs this, but it can be done by calling the bank keeper. Important if a contract controls significant token supply that must be retired.", + "type": "object", + "required": [ + "burn" + ], + "properties": { + "burn": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Binary": { + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "CosmosMsg_for_Empty": { + "oneOf": [ + { + "type": "object", + "required": [ + "bank" + ], + "properties": { + "bank": { + "$ref": "#/definitions/BankMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "custom" + ], + "properties": { + "custom": { + "$ref": "#/definitions/Empty" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "staking" + ], + "properties": { + "staking": { + "$ref": "#/definitions/StakingMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "distribution" + ], + "properties": { + "distribution": { + "$ref": "#/definitions/DistributionMsg" + } + }, + "additionalProperties": false + }, + { + "description": "A Stargate message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)", + "type": "object", + "required": [ + "stargate" + ], + "properties": { + "stargate": { + "type": "object", + "required": [ + "type_url", + "value" + ], + "properties": { + "type_url": { + "type": "string" + }, + "value": { + "$ref": "#/definitions/Binary" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "ibc" + ], + "properties": { + "ibc": { + "$ref": "#/definitions/IbcMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "wasm" + ], + "properties": { + "wasm": { + "$ref": "#/definitions/WasmMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "gov" + ], + "properties": { + "gov": { + "$ref": "#/definitions/GovMsg" + } + }, + "additionalProperties": false + } + ] + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Denom": { + "oneOf": [ + { + "type": "object", + "required": [ + "native" + ], + "properties": { + "native": { + "type": "string" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "cw20" + ], + "properties": { + "cw20": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + ] + }, + "DepositInfo": { + "description": "Information about the deposit required to create a proposal.", + "type": "object", + "required": [ + "amount", + "denom", + "refund_failed_proposals" + ], + "properties": { + "amount": { + "description": "The number tokens required for payment.", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "denom": { + "description": "The denom of the deposit payment.", + "allOf": [ + { + "$ref": "#/definitions/Denom" + } + ] + }, + "refund_failed_proposals": { + "description": "Should failed proposals have their deposits refunded?", + "type": "boolean" + } + }, + "additionalProperties": false + }, + "DistributionMsg": { + "description": "The message types of the distribution module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto", + "oneOf": [ + { + "description": "This is translated to a [MsgSetWithdrawAddress](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#L29-L37). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "set_withdraw_address" + ], + "properties": { + "set_withdraw_address": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "description": "The `withdraw_address`", + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [[MsgWithdrawDelegatorReward](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#L42-L50). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "withdraw_delegator_reward" + ], + "properties": { + "withdraw_delegator_reward": { + "type": "object", + "required": [ + "validator" + ], + "properties": { + "validator": { + "description": "The `validator_address`", + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Empty": { + "description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)", + "type": "object" + }, + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "GovMsg": { + "description": "This message type allows the contract interact with the [x/gov] module in order to cast votes.\n\n[x/gov]: https://github.com/cosmos/cosmos-sdk/tree/v0.45.12/x/gov\n\n## Examples\n\nCast a simple vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); use cosmwasm_std::{GovMsg, VoteOption};\n\n#[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::Vote { proposal_id: 4, vote: VoteOption::Yes, })) } ```\n\nCast a weighted vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); # #[cfg(feature = \"cosmwasm_1_2\")] use cosmwasm_std::{Decimal, GovMsg, VoteOption, WeightedVoteOption};\n\n# #[cfg(feature = \"cosmwasm_1_2\")] #[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::VoteWeighted { proposal_id: 4, options: vec![ WeightedVoteOption { option: VoteOption::Yes, weight: Decimal::percent(65), }, WeightedVoteOption { option: VoteOption::Abstain, weight: Decimal::percent(35), }, ], })) } ```", + "oneOf": [ + { + "description": "This maps directly to [MsgVote](https://github.com/cosmos/cosmos-sdk/blob/v0.42.5/proto/cosmos/gov/v1beta1/tx.proto#L46-L56) in the Cosmos SDK with voter set to the contract address.", + "type": "object", + "required": [ + "vote" + ], + "properties": { + "vote": { + "type": "object", + "required": [ + "proposal_id", + "vote" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "vote": { + "description": "The vote option.\n\nThis should be called \"option\" for consistency with Cosmos SDK. Sorry for that. See .", + "allOf": [ + { + "$ref": "#/definitions/VoteOption" + } + ] + } + } + } + }, + "additionalProperties": false + } + ] + }, + "IbcMsg": { + "description": "These are messages in the IBC lifecycle. Only usable by IBC-enabled contracts (contracts that directly speak the IBC protocol via 6 entry points)", + "oneOf": [ + { + "description": "Sends bank tokens owned by the contract to the given address on another chain. The channel must already be established between the ibctransfer module on this chain and a matching module on the remote chain. We cannot select the port_id, this is whatever the local chain has bound the ibctransfer module to.", + "type": "object", + "required": [ + "transfer" + ], + "properties": { + "transfer": { + "type": "object", + "required": [ + "amount", + "channel_id", + "timeout", + "to_address" + ], + "properties": { + "amount": { + "description": "packet data only supports one coin https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/ibc/applications/transfer/v1/transfer.proto#L11-L20", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "channel_id": { + "description": "exisiting channel to send the tokens over", + "type": "string" + }, + "timeout": { + "description": "when packet times out, measured on remote chain", + "allOf": [ + { + "$ref": "#/definitions/IbcTimeout" + } + ] + }, + "to_address": { + "description": "address on the remote chain to receive these tokens", + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Sends an IBC packet with given data over the existing channel. Data should be encoded in a format defined by the channel version, and the module on the other side should know how to parse this.", + "type": "object", + "required": [ + "send_packet" + ], + "properties": { + "send_packet": { + "type": "object", + "required": [ + "channel_id", + "data", + "timeout" + ], + "properties": { + "channel_id": { + "type": "string" + }, + "data": { + "$ref": "#/definitions/Binary" + }, + "timeout": { + "description": "when packet times out, measured on remote chain", + "allOf": [ + { + "$ref": "#/definitions/IbcTimeout" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This will close an existing channel that is owned by this contract. Port is auto-assigned to the contract's IBC port", + "type": "object", + "required": [ + "close_channel" + ], + "properties": { + "close_channel": { + "type": "object", + "required": [ + "channel_id" + ], + "properties": { + "channel_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "IbcTimeout": { + "description": "In IBC each package must set at least one type of timeout: the timestamp or the block height. Using this rather complex enum instead of two timeout fields we ensure that at least one timeout is set.", + "type": "object", + "properties": { + "block": { + "anyOf": [ + { + "$ref": "#/definitions/IbcTimeoutBlock" + }, + { + "type": "null" + } + ] + }, + "timestamp": { + "anyOf": [ + { + "$ref": "#/definitions/Timestamp" + }, + { + "type": "null" + } + ] + } + } + }, + "IbcTimeoutBlock": { + "description": "IBCTimeoutHeight Height is a monotonically increasing data type that can be compared against another Height for the purposes of updating and freezing clients. Ordering is (revision_number, timeout_height)", + "type": "object", + "required": [ + "height", + "revision" + ], + "properties": { + "height": { + "description": "block height after which the packet times out. the height within the given revision", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "revision": { + "description": "the version that the client is currently on (eg. after reseting the chain this could increment 1 as height drops to 0)", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "StakingMsg": { + "description": "The message types of the staking module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto", + "oneOf": [ + { + "description": "This is translated to a [MsgDelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L81-L90). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "delegate" + ], + "properties": { + "delegate": { + "type": "object", + "required": [ + "amount", + "validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [MsgUndelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L112-L121). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "undelegate" + ], + "properties": { + "undelegate": { + "type": "object", + "required": [ + "amount", + "validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [MsgBeginRedelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L95-L105). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "redelegate" + ], + "properties": { + "redelegate": { + "type": "object", + "required": [ + "amount", + "dst_validator", + "src_validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "dst_validator": { + "type": "string" + }, + "src_validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Status": { + "oneOf": [ + { + "description": "proposal was created, but voting has not yet begun for whatever reason", + "type": "string", + "enum": [ + "pending" + ] + }, + { + "description": "you can vote on this", + "type": "string", + "enum": [ + "open" + ] + }, + { + "description": "voting is over and it did not pass", + "type": "string", + "enum": [ + "rejected" + ] + }, + { + "description": "voting is over and it did pass, but has not yet executed", + "type": "string", + "enum": [ + "passed" + ] + }, + { + "description": "voting is over it passed, and the proposal was executed", + "type": "string", + "enum": [ + "executed" + ] + } + ] + }, + "ThresholdResponse": { + "description": "This defines the different ways tallies can happen. Every contract should support a subset of these, ideally all.\n\nThe total_weight used for calculating success as well as the weights of each individual voter used in tallying should be snapshotted at the beginning of the block at which the proposal starts (this is likely the responsibility of a correct cw4 implementation).", + "oneOf": [ + { + "description": "Declares that a fixed weight of yes votes is needed to pass. It does not matter how many no votes are cast, or how many do not vote, as long as `weight` yes votes are cast.\n\nThis is the simplest format and usually suitable for small multisigs of trusted parties, like 3 of 5. (weight: 3, total_weight: 5)\n\nA proposal of this type can pass early as soon as the needed weight of yes votes has been cast.", + "type": "object", + "required": [ + "absolute_count" + ], + "properties": { + "absolute_count": { + "type": "object", + "required": [ + "total_weight", + "weight" + ], + "properties": { + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Declares a percentage of the total weight that must cast Yes votes, in order for a proposal to pass. The passing weight is computed over the total weight minus the weight of the abstained votes.\n\nThis is useful for similar circumstances as `AbsoluteCount`, where we have a relatively small set of voters, and participation is required. It is understood that if the voting set (group) changes between different proposals that refer to the same group, each proposal will work with a different set of voter weights (the ones snapshotted at proposal creation), and the passing weight for each proposal will be computed based on the absolute percentage, times the total weights of the members at the time of each proposal creation.\n\nExample: we set `percentage` to 51%. Proposal 1 starts when there is a `total_weight` of 5. This will require 3 weight of Yes votes in order to pass. Later, the Proposal 2 starts but the `total_weight` of the group has increased to 9. That proposal will then automatically require 5 Yes of 9 to pass, rather than 3 yes of 9 as would be the case with `AbsoluteCount`.", + "type": "object", + "required": [ + "absolute_percentage" + ], + "properties": { + "absolute_percentage": { + "type": "object", + "required": [ + "percentage", + "total_weight" + ], + "properties": { + "percentage": { + "$ref": "#/definitions/Decimal" + }, + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "In addition to a `threshold`, declares a `quorum` of the total votes that must participate in the election in order for the vote to be considered at all. Within the votes that were cast, it requires `threshold` votes in favor. That is calculated by ignoring the Abstain votes (they count towards `quorum`, but do not influence `threshold`). That is, we calculate `Yes / (Yes + No + Veto)` and compare it with `threshold` to consider if the proposal was passed.\n\nIt is rather difficult for a proposal of this type to pass early. That can only happen if the required quorum has been already met, and there are already enough Yes votes for the proposal to pass.\n\n30% Yes votes, 10% No votes, and 20% Abstain would pass early if quorum <= 60% (who has cast votes) and if the threshold is <= 37.5% (the remaining 40% voting no => 30% yes + 50% no). Once the voting period has passed with no additional votes, that same proposal would be considered successful if quorum <= 60% and threshold <= 75% (percent in favor if we ignore abstain votes).\n\nThis type is more common in general elections, where participation is often expected to be low, and `AbsolutePercentage` would either be too high to pass anything, or allow low percentages to pass, independently of if there was high participation in the election or not.", + "type": "object", + "required": [ + "threshold_quorum" + ], + "properties": { + "threshold_quorum": { + "type": "object", + "required": [ + "quorum", + "threshold", + "total_weight" + ], + "properties": { + "quorum": { + "$ref": "#/definitions/Decimal" + }, + "threshold": { + "$ref": "#/definitions/Decimal" + }, + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + }, + "VoteOption": { + "type": "string", + "enum": [ + "yes", + "no", + "abstain", + "no_with_veto" + ] + }, + "WasmMsg": { + "description": "The message types of the wasm module.\n\nSee https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto", + "oneOf": [ + { + "description": "Dispatches a call to another contract at a known address (with known ABI).\n\nThis is translated to a [MsgExecuteContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L68-L78). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "execute" + ], + "properties": { + "execute": { + "type": "object", + "required": [ + "contract_addr", + "funds", + "msg" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "funds": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "msg": { + "description": "msg is the json-encoded ExecuteMsg struct (as raw Binary)", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThe contract address is non-predictable. But it is guaranteed that when emitting the same Instantiate message multiple times, multiple instances on different addresses will be generated. See also Instantiate2.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L53-L71). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "instantiate" + ], + "properties": { + "instantiate": { + "type": "object", + "required": [ + "code_id", + "funds", + "label", + "msg" + ], + "properties": { + "admin": { + "type": [ + "string", + "null" + ] + }, + "code_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "funds": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "label": { + "description": "A human-readbale label for the contract", + "type": "string" + }, + "msg": { + "description": "msg is the JSON-encoded InstantiateMsg struct (as raw Binary)", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Migrates a given contracts to use new wasm code. Passes a MigrateMsg to allow us to customize behavior.\n\nOnly the contract admin (as defined in wasmd), if any, is able to make this call.\n\nThis is translated to a [MsgMigrateContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L86-L96). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "migrate" + ], + "properties": { + "migrate": { + "type": "object", + "required": [ + "contract_addr", + "msg", + "new_code_id" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "msg": { + "description": "msg is the json-encoded MigrateMsg struct that will be passed to the new code", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "new_code_id": { + "description": "the code_id of the new logic to place in the given contract", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Sets a new admin (for migrate) on the given contract. Fails if this contract is not currently admin of the target contract.", + "type": "object", + "required": [ + "update_admin" + ], + "properties": { + "update_admin": { + "type": "object", + "required": [ + "admin", + "contract_addr" + ], + "properties": { + "admin": { + "type": "string" + }, + "contract_addr": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Clears the admin on the given contract, so no more migration possible. Fails if this contract is not currently admin of the target contract.", + "type": "object", + "required": [ + "clear_admin" + ], + "properties": { + "clear_admin": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + } + } + }, + "reverse_proposals": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ProposalListResponse_for_Empty", + "type": "object", + "required": [ + "proposals" + ], + "properties": { + "proposals": { + "type": "array", + "items": { + "$ref": "#/definitions/ProposalResponse_for_Empty" + } + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "BankMsg": { + "description": "The message types of the bank module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto", + "oneOf": [ + { + "description": "Sends native tokens from the contract to the given address.\n\nThis is translated to a [MsgSend](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto#L19-L28). `from_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "send" + ], + "properties": { + "send": { + "type": "object", + "required": [ + "amount", + "to_address" + ], + "properties": { + "amount": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "to_address": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This will burn the given coins from the contract's account. There is no Cosmos SDK message that performs this, but it can be done by calling the bank keeper. Important if a contract controls significant token supply that must be retired.", + "type": "object", + "required": [ + "burn" + ], + "properties": { + "burn": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Binary": { + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "CosmosMsg_for_Empty": { + "oneOf": [ + { + "type": "object", + "required": [ + "bank" + ], + "properties": { + "bank": { + "$ref": "#/definitions/BankMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "custom" + ], + "properties": { + "custom": { + "$ref": "#/definitions/Empty" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "staking" + ], + "properties": { + "staking": { + "$ref": "#/definitions/StakingMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "distribution" + ], + "properties": { + "distribution": { + "$ref": "#/definitions/DistributionMsg" + } + }, + "additionalProperties": false + }, + { + "description": "A Stargate message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)", + "type": "object", + "required": [ + "stargate" + ], + "properties": { + "stargate": { + "type": "object", + "required": [ + "type_url", + "value" + ], + "properties": { + "type_url": { + "type": "string" + }, + "value": { + "$ref": "#/definitions/Binary" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "ibc" + ], + "properties": { + "ibc": { + "$ref": "#/definitions/IbcMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "wasm" + ], + "properties": { + "wasm": { + "$ref": "#/definitions/WasmMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "gov" + ], + "properties": { + "gov": { + "$ref": "#/definitions/GovMsg" + } + }, + "additionalProperties": false + } + ] + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Denom": { + "oneOf": [ + { + "type": "object", + "required": [ + "native" + ], + "properties": { + "native": { + "type": "string" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "cw20" + ], + "properties": { + "cw20": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + ] + }, + "DepositInfo": { + "description": "Information about the deposit required to create a proposal.", + "type": "object", + "required": [ + "amount", + "denom", + "refund_failed_proposals" + ], + "properties": { + "amount": { + "description": "The number tokens required for payment.", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "denom": { + "description": "The denom of the deposit payment.", + "allOf": [ + { + "$ref": "#/definitions/Denom" + } + ] + }, + "refund_failed_proposals": { + "description": "Should failed proposals have their deposits refunded?", + "type": "boolean" + } + }, + "additionalProperties": false + }, + "DistributionMsg": { + "description": "The message types of the distribution module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto", + "oneOf": [ + { + "description": "This is translated to a [MsgSetWithdrawAddress](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#L29-L37). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "set_withdraw_address" + ], + "properties": { + "set_withdraw_address": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "description": "The `withdraw_address`", + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [[MsgWithdrawDelegatorReward](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#L42-L50). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "withdraw_delegator_reward" + ], + "properties": { + "withdraw_delegator_reward": { + "type": "object", + "required": [ + "validator" + ], + "properties": { + "validator": { + "description": "The `validator_address`", + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Empty": { + "description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)", + "type": "object" + }, + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "GovMsg": { + "description": "This message type allows the contract interact with the [x/gov] module in order to cast votes.\n\n[x/gov]: https://github.com/cosmos/cosmos-sdk/tree/v0.45.12/x/gov\n\n## Examples\n\nCast a simple vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); use cosmwasm_std::{GovMsg, VoteOption};\n\n#[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::Vote { proposal_id: 4, vote: VoteOption::Yes, })) } ```\n\nCast a weighted vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); # #[cfg(feature = \"cosmwasm_1_2\")] use cosmwasm_std::{Decimal, GovMsg, VoteOption, WeightedVoteOption};\n\n# #[cfg(feature = \"cosmwasm_1_2\")] #[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::VoteWeighted { proposal_id: 4, options: vec![ WeightedVoteOption { option: VoteOption::Yes, weight: Decimal::percent(65), }, WeightedVoteOption { option: VoteOption::Abstain, weight: Decimal::percent(35), }, ], })) } ```", + "oneOf": [ + { + "description": "This maps directly to [MsgVote](https://github.com/cosmos/cosmos-sdk/blob/v0.42.5/proto/cosmos/gov/v1beta1/tx.proto#L46-L56) in the Cosmos SDK with voter set to the contract address.", + "type": "object", + "required": [ + "vote" + ], + "properties": { + "vote": { + "type": "object", + "required": [ + "proposal_id", + "vote" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "vote": { + "description": "The vote option.\n\nThis should be called \"option\" for consistency with Cosmos SDK. Sorry for that. See .", + "allOf": [ + { + "$ref": "#/definitions/VoteOption" + } + ] + } + } + } + }, + "additionalProperties": false + } + ] + }, + "IbcMsg": { + "description": "These are messages in the IBC lifecycle. Only usable by IBC-enabled contracts (contracts that directly speak the IBC protocol via 6 entry points)", + "oneOf": [ + { + "description": "Sends bank tokens owned by the contract to the given address on another chain. The channel must already be established between the ibctransfer module on this chain and a matching module on the remote chain. We cannot select the port_id, this is whatever the local chain has bound the ibctransfer module to.", + "type": "object", + "required": [ + "transfer" + ], + "properties": { + "transfer": { + "type": "object", + "required": [ + "amount", + "channel_id", + "timeout", + "to_address" + ], + "properties": { + "amount": { + "description": "packet data only supports one coin https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/ibc/applications/transfer/v1/transfer.proto#L11-L20", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "channel_id": { + "description": "exisiting channel to send the tokens over", + "type": "string" + }, + "timeout": { + "description": "when packet times out, measured on remote chain", + "allOf": [ + { + "$ref": "#/definitions/IbcTimeout" + } + ] + }, + "to_address": { + "description": "address on the remote chain to receive these tokens", + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Sends an IBC packet with given data over the existing channel. Data should be encoded in a format defined by the channel version, and the module on the other side should know how to parse this.", + "type": "object", + "required": [ + "send_packet" + ], + "properties": { + "send_packet": { + "type": "object", + "required": [ + "channel_id", + "data", + "timeout" + ], + "properties": { + "channel_id": { + "type": "string" + }, + "data": { + "$ref": "#/definitions/Binary" + }, + "timeout": { + "description": "when packet times out, measured on remote chain", + "allOf": [ + { + "$ref": "#/definitions/IbcTimeout" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This will close an existing channel that is owned by this contract. Port is auto-assigned to the contract's IBC port", + "type": "object", + "required": [ + "close_channel" + ], + "properties": { + "close_channel": { + "type": "object", + "required": [ + "channel_id" + ], + "properties": { + "channel_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "IbcTimeout": { + "description": "In IBC each package must set at least one type of timeout: the timestamp or the block height. Using this rather complex enum instead of two timeout fields we ensure that at least one timeout is set.", + "type": "object", + "properties": { + "block": { + "anyOf": [ + { + "$ref": "#/definitions/IbcTimeoutBlock" + }, + { + "type": "null" + } + ] + }, + "timestamp": { + "anyOf": [ + { + "$ref": "#/definitions/Timestamp" + }, + { + "type": "null" + } + ] + } + } + }, + "IbcTimeoutBlock": { + "description": "IBCTimeoutHeight Height is a monotonically increasing data type that can be compared against another Height for the purposes of updating and freezing clients. Ordering is (revision_number, timeout_height)", + "type": "object", + "required": [ + "height", + "revision" + ], + "properties": { + "height": { + "description": "block height after which the packet times out. the height within the given revision", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "revision": { + "description": "the version that the client is currently on (eg. after reseting the chain this could increment 1 as height drops to 0)", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "ProposalResponse_for_Empty": { + "description": "Note, if you are storing custom messages in the proposal, the querier needs to know what possible custom message types those are in order to parse the response", + "type": "object", + "required": [ + "description", + "expires", + "id", + "msgs", + "proposer", + "status", + "threshold", + "title" + ], + "properties": { + "deposit": { + "anyOf": [ + { + "$ref": "#/definitions/DepositInfo" + }, + { + "type": "null" + } + ] + }, + "description": { + "type": "string" + }, + "expires": { + "$ref": "#/definitions/Expiration" + }, + "id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "msgs": { + "type": "array", + "items": { + "$ref": "#/definitions/CosmosMsg_for_Empty" + } + }, + "proposer": { + "$ref": "#/definitions/Addr" + }, + "status": { + "$ref": "#/definitions/Status" + }, + "threshold": { + "description": "This is the threshold that is applied to this proposal. Both the rules of the voting contract, as well as the total_weight of the voting group may have changed since this time. That means that the generic `Threshold{}` query does not provide valid information for existing proposals.", + "allOf": [ + { + "$ref": "#/definitions/ThresholdResponse" + } + ] + }, + "title": { + "type": "string" + } + }, + "additionalProperties": false + }, + "StakingMsg": { + "description": "The message types of the staking module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto", + "oneOf": [ + { + "description": "This is translated to a [MsgDelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L81-L90). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "delegate" + ], + "properties": { + "delegate": { + "type": "object", + "required": [ + "amount", + "validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [MsgUndelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L112-L121). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "undelegate" + ], + "properties": { + "undelegate": { + "type": "object", + "required": [ + "amount", + "validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [MsgBeginRedelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L95-L105). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "redelegate" + ], + "properties": { + "redelegate": { + "type": "object", + "required": [ + "amount", + "dst_validator", + "src_validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "dst_validator": { + "type": "string" + }, + "src_validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Status": { + "oneOf": [ + { + "description": "proposal was created, but voting has not yet begun for whatever reason", + "type": "string", + "enum": [ + "pending" + ] + }, + { + "description": "you can vote on this", + "type": "string", + "enum": [ + "open" + ] + }, + { + "description": "voting is over and it did not pass", + "type": "string", + "enum": [ + "rejected" + ] + }, + { + "description": "voting is over and it did pass, but has not yet executed", + "type": "string", + "enum": [ + "passed" + ] + }, + { + "description": "voting is over it passed, and the proposal was executed", + "type": "string", + "enum": [ + "executed" + ] + } + ] + }, + "ThresholdResponse": { + "description": "This defines the different ways tallies can happen. Every contract should support a subset of these, ideally all.\n\nThe total_weight used for calculating success as well as the weights of each individual voter used in tallying should be snapshotted at the beginning of the block at which the proposal starts (this is likely the responsibility of a correct cw4 implementation).", + "oneOf": [ + { + "description": "Declares that a fixed weight of yes votes is needed to pass. It does not matter how many no votes are cast, or how many do not vote, as long as `weight` yes votes are cast.\n\nThis is the simplest format and usually suitable for small multisigs of trusted parties, like 3 of 5. (weight: 3, total_weight: 5)\n\nA proposal of this type can pass early as soon as the needed weight of yes votes has been cast.", + "type": "object", + "required": [ + "absolute_count" + ], + "properties": { + "absolute_count": { + "type": "object", + "required": [ + "total_weight", + "weight" + ], + "properties": { + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Declares a percentage of the total weight that must cast Yes votes, in order for a proposal to pass. The passing weight is computed over the total weight minus the weight of the abstained votes.\n\nThis is useful for similar circumstances as `AbsoluteCount`, where we have a relatively small set of voters, and participation is required. It is understood that if the voting set (group) changes between different proposals that refer to the same group, each proposal will work with a different set of voter weights (the ones snapshotted at proposal creation), and the passing weight for each proposal will be computed based on the absolute percentage, times the total weights of the members at the time of each proposal creation.\n\nExample: we set `percentage` to 51%. Proposal 1 starts when there is a `total_weight` of 5. This will require 3 weight of Yes votes in order to pass. Later, the Proposal 2 starts but the `total_weight` of the group has increased to 9. That proposal will then automatically require 5 Yes of 9 to pass, rather than 3 yes of 9 as would be the case with `AbsoluteCount`.", + "type": "object", + "required": [ + "absolute_percentage" + ], + "properties": { + "absolute_percentage": { + "type": "object", + "required": [ + "percentage", + "total_weight" + ], + "properties": { + "percentage": { + "$ref": "#/definitions/Decimal" + }, + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "In addition to a `threshold`, declares a `quorum` of the total votes that must participate in the election in order for the vote to be considered at all. Within the votes that were cast, it requires `threshold` votes in favor. That is calculated by ignoring the Abstain votes (they count towards `quorum`, but do not influence `threshold`). That is, we calculate `Yes / (Yes + No + Veto)` and compare it with `threshold` to consider if the proposal was passed.\n\nIt is rather difficult for a proposal of this type to pass early. That can only happen if the required quorum has been already met, and there are already enough Yes votes for the proposal to pass.\n\n30% Yes votes, 10% No votes, and 20% Abstain would pass early if quorum <= 60% (who has cast votes) and if the threshold is <= 37.5% (the remaining 40% voting no => 30% yes + 50% no). Once the voting period has passed with no additional votes, that same proposal would be considered successful if quorum <= 60% and threshold <= 75% (percent in favor if we ignore abstain votes).\n\nThis type is more common in general elections, where participation is often expected to be low, and `AbsolutePercentage` would either be too high to pass anything, or allow low percentages to pass, independently of if there was high participation in the election or not.", + "type": "object", + "required": [ + "threshold_quorum" + ], + "properties": { + "threshold_quorum": { + "type": "object", + "required": [ + "quorum", + "threshold", + "total_weight" + ], + "properties": { + "quorum": { + "$ref": "#/definitions/Decimal" + }, + "threshold": { + "$ref": "#/definitions/Decimal" + }, + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + }, + "VoteOption": { + "type": "string", + "enum": [ + "yes", + "no", + "abstain", + "no_with_veto" + ] + }, + "WasmMsg": { + "description": "The message types of the wasm module.\n\nSee https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto", + "oneOf": [ + { + "description": "Dispatches a call to another contract at a known address (with known ABI).\n\nThis is translated to a [MsgExecuteContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L68-L78). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "execute" + ], + "properties": { + "execute": { + "type": "object", + "required": [ + "contract_addr", + "funds", + "msg" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "funds": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "msg": { + "description": "msg is the json-encoded ExecuteMsg struct (as raw Binary)", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThe contract address is non-predictable. But it is guaranteed that when emitting the same Instantiate message multiple times, multiple instances on different addresses will be generated. See also Instantiate2.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L53-L71). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "instantiate" + ], + "properties": { + "instantiate": { + "type": "object", + "required": [ + "code_id", + "funds", + "label", + "msg" + ], + "properties": { + "admin": { + "type": [ + "string", + "null" + ] + }, + "code_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "funds": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "label": { + "description": "A human-readbale label for the contract", + "type": "string" + }, + "msg": { + "description": "msg is the JSON-encoded InstantiateMsg struct (as raw Binary)", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Migrates a given contracts to use new wasm code. Passes a MigrateMsg to allow us to customize behavior.\n\nOnly the contract admin (as defined in wasmd), if any, is able to make this call.\n\nThis is translated to a [MsgMigrateContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L86-L96). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "migrate" + ], + "properties": { + "migrate": { + "type": "object", + "required": [ + "contract_addr", + "msg", + "new_code_id" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "msg": { + "description": "msg is the json-encoded MigrateMsg struct that will be passed to the new code", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "new_code_id": { + "description": "the code_id of the new logic to place in the given contract", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Sets a new admin (for migrate) on the given contract. Fails if this contract is not currently admin of the target contract.", + "type": "object", + "required": [ + "update_admin" + ], + "properties": { + "update_admin": { + "type": "object", + "required": [ + "admin", + "contract_addr" + ], + "properties": { + "admin": { + "type": "string" + }, + "contract_addr": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Clears the admin on the given contract, so no more migration possible. Fails if this contract is not currently admin of the target contract.", + "type": "object", + "required": [ + "clear_admin" + ], + "properties": { + "clear_admin": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + } + } + }, + "threshold": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ThresholdResponse", + "description": "This defines the different ways tallies can happen. Every contract should support a subset of these, ideally all.\n\nThe total_weight used for calculating success as well as the weights of each individual voter used in tallying should be snapshotted at the beginning of the block at which the proposal starts (this is likely the responsibility of a correct cw4 implementation).", + "oneOf": [ + { + "description": "Declares that a fixed weight of yes votes is needed to pass. It does not matter how many no votes are cast, or how many do not vote, as long as `weight` yes votes are cast.\n\nThis is the simplest format and usually suitable for small multisigs of trusted parties, like 3 of 5. (weight: 3, total_weight: 5)\n\nA proposal of this type can pass early as soon as the needed weight of yes votes has been cast.", + "type": "object", + "required": [ + "absolute_count" + ], + "properties": { + "absolute_count": { + "type": "object", + "required": [ + "total_weight", + "weight" + ], + "properties": { + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Declares a percentage of the total weight that must cast Yes votes, in order for a proposal to pass. The passing weight is computed over the total weight minus the weight of the abstained votes.\n\nThis is useful for similar circumstances as `AbsoluteCount`, where we have a relatively small set of voters, and participation is required. It is understood that if the voting set (group) changes between different proposals that refer to the same group, each proposal will work with a different set of voter weights (the ones snapshotted at proposal creation), and the passing weight for each proposal will be computed based on the absolute percentage, times the total weights of the members at the time of each proposal creation.\n\nExample: we set `percentage` to 51%. Proposal 1 starts when there is a `total_weight` of 5. This will require 3 weight of Yes votes in order to pass. Later, the Proposal 2 starts but the `total_weight` of the group has increased to 9. That proposal will then automatically require 5 Yes of 9 to pass, rather than 3 yes of 9 as would be the case with `AbsoluteCount`.", + "type": "object", + "required": [ + "absolute_percentage" + ], + "properties": { + "absolute_percentage": { + "type": "object", + "required": [ + "percentage", + "total_weight" + ], + "properties": { + "percentage": { + "$ref": "#/definitions/Decimal" + }, + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "In addition to a `threshold`, declares a `quorum` of the total votes that must participate in the election in order for the vote to be considered at all. Within the votes that were cast, it requires `threshold` votes in favor. That is calculated by ignoring the Abstain votes (they count towards `quorum`, but do not influence `threshold`). That is, we calculate `Yes / (Yes + No + Veto)` and compare it with `threshold` to consider if the proposal was passed.\n\nIt is rather difficult for a proposal of this type to pass early. That can only happen if the required quorum has been already met, and there are already enough Yes votes for the proposal to pass.\n\n30% Yes votes, 10% No votes, and 20% Abstain would pass early if quorum <= 60% (who has cast votes) and if the threshold is <= 37.5% (the remaining 40% voting no => 30% yes + 50% no). Once the voting period has passed with no additional votes, that same proposal would be considered successful if quorum <= 60% and threshold <= 75% (percent in favor if we ignore abstain votes).\n\nThis type is more common in general elections, where participation is often expected to be low, and `AbsolutePercentage` would either be too high to pass anything, or allow low percentages to pass, independently of if there was high participation in the election or not.", + "type": "object", + "required": [ + "threshold_quorum" + ], + "properties": { + "threshold_quorum": { + "type": "object", + "required": [ + "quorum", + "threshold", + "total_weight" + ], + "properties": { + "quorum": { + "$ref": "#/definitions/Decimal" + }, + "threshold": { + "$ref": "#/definitions/Decimal" + }, + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + } + } + }, + "vote": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "VoteResponse", + "type": "object", + "properties": { + "vote": { + "anyOf": [ + { + "$ref": "#/definitions/VoteInfo" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Vote": { + "oneOf": [ + { + "description": "Marks support for the proposal.", + "type": "string", + "enum": [ + "yes" + ] + }, + { + "description": "Marks opposition to the proposal.", + "type": "string", + "enum": [ + "no" + ] + }, + { + "description": "Marks participation but does not count towards the ratio of support / opposed", + "type": "string", + "enum": [ + "abstain" + ] + }, + { + "description": "Veto is generally to be treated as a No vote. Some implementations may allow certain voters to be able to Veto, or them to be counted stronger than No in some way.", + "type": "string", + "enum": [ + "veto" + ] + } + ] + }, + "VoteInfo": { + "description": "Returns the vote (opinion as well as weight counted) as well as the address of the voter who submitted it", + "type": "object", + "required": [ + "proposal_id", + "vote", + "voter", + "weight" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "vote": { + "$ref": "#/definitions/Vote" + }, + "voter": { + "type": "string" + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } + }, + "voter": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "VoterResponse", + "type": "object", + "properties": { + "weight": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/multisig/cw3-flex-multisig/schema/raw/execute.json b/contracts/multisig/cw3-flex-multisig/schema/raw/execute.json new file mode 100644 index 0000000000..8c5eb3cdae --- /dev/null +++ b/contracts/multisig/cw3-flex-multisig/schema/raw/execute.json @@ -0,0 +1,976 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "propose" + ], + "properties": { + "propose": { + "type": "object", + "required": [ + "description", + "msgs", + "title" + ], + "properties": { + "description": { + "type": "string" + }, + "latest": { + "anyOf": [ + { + "$ref": "#/definitions/Expiration" + }, + { + "type": "null" + } + ] + }, + "msgs": { + "type": "array", + "items": { + "$ref": "#/definitions/CosmosMsg_for_Empty" + } + }, + "title": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "vote" + ], + "properties": { + "vote": { + "type": "object", + "required": [ + "proposal_id", + "vote" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "vote": { + "$ref": "#/definitions/Vote" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "execute" + ], + "properties": { + "execute": { + "type": "object", + "required": [ + "proposal_id" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "close" + ], + "properties": { + "close": { + "type": "object", + "required": [ + "proposal_id" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Handles update hook messages from the group contract", + "type": "object", + "required": [ + "member_changed_hook" + ], + "properties": { + "member_changed_hook": { + "$ref": "#/definitions/MemberChangedHookMsg" + } + }, + "additionalProperties": false + } + ], + "definitions": { + "BankMsg": { + "description": "The message types of the bank module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto", + "oneOf": [ + { + "description": "Sends native tokens from the contract to the given address.\n\nThis is translated to a [MsgSend](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto#L19-L28). `from_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "send" + ], + "properties": { + "send": { + "type": "object", + "required": [ + "amount", + "to_address" + ], + "properties": { + "amount": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "to_address": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This will burn the given coins from the contract's account. There is no Cosmos SDK message that performs this, but it can be done by calling the bank keeper. Important if a contract controls significant token supply that must be retired.", + "type": "object", + "required": [ + "burn" + ], + "properties": { + "burn": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Binary": { + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "CosmosMsg_for_Empty": { + "oneOf": [ + { + "type": "object", + "required": [ + "bank" + ], + "properties": { + "bank": { + "$ref": "#/definitions/BankMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "custom" + ], + "properties": { + "custom": { + "$ref": "#/definitions/Empty" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "staking" + ], + "properties": { + "staking": { + "$ref": "#/definitions/StakingMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "distribution" + ], + "properties": { + "distribution": { + "$ref": "#/definitions/DistributionMsg" + } + }, + "additionalProperties": false + }, + { + "description": "A Stargate message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)", + "type": "object", + "required": [ + "stargate" + ], + "properties": { + "stargate": { + "type": "object", + "required": [ + "type_url", + "value" + ], + "properties": { + "type_url": { + "type": "string" + }, + "value": { + "$ref": "#/definitions/Binary" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "ibc" + ], + "properties": { + "ibc": { + "$ref": "#/definitions/IbcMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "wasm" + ], + "properties": { + "wasm": { + "$ref": "#/definitions/WasmMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "gov" + ], + "properties": { + "gov": { + "$ref": "#/definitions/GovMsg" + } + }, + "additionalProperties": false + } + ] + }, + "DistributionMsg": { + "description": "The message types of the distribution module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto", + "oneOf": [ + { + "description": "This is translated to a [MsgSetWithdrawAddress](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#L29-L37). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "set_withdraw_address" + ], + "properties": { + "set_withdraw_address": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "description": "The `withdraw_address`", + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [[MsgWithdrawDelegatorReward](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#L42-L50). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "withdraw_delegator_reward" + ], + "properties": { + "withdraw_delegator_reward": { + "type": "object", + "required": [ + "validator" + ], + "properties": { + "validator": { + "description": "The `validator_address`", + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Empty": { + "description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)", + "type": "object" + }, + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "GovMsg": { + "description": "This message type allows the contract interact with the [x/gov] module in order to cast votes.\n\n[x/gov]: https://github.com/cosmos/cosmos-sdk/tree/v0.45.12/x/gov\n\n## Examples\n\nCast a simple vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); use cosmwasm_std::{GovMsg, VoteOption};\n\n#[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::Vote { proposal_id: 4, vote: VoteOption::Yes, })) } ```\n\nCast a weighted vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); # #[cfg(feature = \"cosmwasm_1_2\")] use cosmwasm_std::{Decimal, GovMsg, VoteOption, WeightedVoteOption};\n\n# #[cfg(feature = \"cosmwasm_1_2\")] #[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::VoteWeighted { proposal_id: 4, options: vec![ WeightedVoteOption { option: VoteOption::Yes, weight: Decimal::percent(65), }, WeightedVoteOption { option: VoteOption::Abstain, weight: Decimal::percent(35), }, ], })) } ```", + "oneOf": [ + { + "description": "This maps directly to [MsgVote](https://github.com/cosmos/cosmos-sdk/blob/v0.42.5/proto/cosmos/gov/v1beta1/tx.proto#L46-L56) in the Cosmos SDK with voter set to the contract address.", + "type": "object", + "required": [ + "vote" + ], + "properties": { + "vote": { + "type": "object", + "required": [ + "proposal_id", + "vote" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "vote": { + "description": "The vote option.\n\nThis should be called \"option\" for consistency with Cosmos SDK. Sorry for that. See .", + "allOf": [ + { + "$ref": "#/definitions/VoteOption" + } + ] + } + } + } + }, + "additionalProperties": false + } + ] + }, + "IbcMsg": { + "description": "These are messages in the IBC lifecycle. Only usable by IBC-enabled contracts (contracts that directly speak the IBC protocol via 6 entry points)", + "oneOf": [ + { + "description": "Sends bank tokens owned by the contract to the given address on another chain. The channel must already be established between the ibctransfer module on this chain and a matching module on the remote chain. We cannot select the port_id, this is whatever the local chain has bound the ibctransfer module to.", + "type": "object", + "required": [ + "transfer" + ], + "properties": { + "transfer": { + "type": "object", + "required": [ + "amount", + "channel_id", + "timeout", + "to_address" + ], + "properties": { + "amount": { + "description": "packet data only supports one coin https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/ibc/applications/transfer/v1/transfer.proto#L11-L20", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "channel_id": { + "description": "exisiting channel to send the tokens over", + "type": "string" + }, + "timeout": { + "description": "when packet times out, measured on remote chain", + "allOf": [ + { + "$ref": "#/definitions/IbcTimeout" + } + ] + }, + "to_address": { + "description": "address on the remote chain to receive these tokens", + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Sends an IBC packet with given data over the existing channel. Data should be encoded in a format defined by the channel version, and the module on the other side should know how to parse this.", + "type": "object", + "required": [ + "send_packet" + ], + "properties": { + "send_packet": { + "type": "object", + "required": [ + "channel_id", + "data", + "timeout" + ], + "properties": { + "channel_id": { + "type": "string" + }, + "data": { + "$ref": "#/definitions/Binary" + }, + "timeout": { + "description": "when packet times out, measured on remote chain", + "allOf": [ + { + "$ref": "#/definitions/IbcTimeout" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This will close an existing channel that is owned by this contract. Port is auto-assigned to the contract's IBC port", + "type": "object", + "required": [ + "close_channel" + ], + "properties": { + "close_channel": { + "type": "object", + "required": [ + "channel_id" + ], + "properties": { + "channel_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "IbcTimeout": { + "description": "In IBC each package must set at least one type of timeout: the timestamp or the block height. Using this rather complex enum instead of two timeout fields we ensure that at least one timeout is set.", + "type": "object", + "properties": { + "block": { + "anyOf": [ + { + "$ref": "#/definitions/IbcTimeoutBlock" + }, + { + "type": "null" + } + ] + }, + "timestamp": { + "anyOf": [ + { + "$ref": "#/definitions/Timestamp" + }, + { + "type": "null" + } + ] + } + } + }, + "IbcTimeoutBlock": { + "description": "IBCTimeoutHeight Height is a monotonically increasing data type that can be compared against another Height for the purposes of updating and freezing clients. Ordering is (revision_number, timeout_height)", + "type": "object", + "required": [ + "height", + "revision" + ], + "properties": { + "height": { + "description": "block height after which the packet times out. the height within the given revision", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "revision": { + "description": "the version that the client is currently on (eg. after reseting the chain this could increment 1 as height drops to 0)", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "MemberChangedHookMsg": { + "description": "MemberChangedHookMsg should be de/serialized under `MemberChangedHook()` variant in a ExecuteMsg. This contains a list of all diffs on the given transaction.", + "type": "object", + "required": [ + "diffs" + ], + "properties": { + "diffs": { + "type": "array", + "items": { + "$ref": "#/definitions/MemberDiff" + } + } + }, + "additionalProperties": false + }, + "MemberDiff": { + "description": "MemberDiff shows the old and new states for a given cw4 member They cannot both be None. old = None, new = Some -> Insert old = Some, new = Some -> Update old = Some, new = None -> Delete", + "type": "object", + "required": [ + "key" + ], + "properties": { + "key": { + "type": "string" + }, + "new": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "old": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "StakingMsg": { + "description": "The message types of the staking module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto", + "oneOf": [ + { + "description": "This is translated to a [MsgDelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L81-L90). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "delegate" + ], + "properties": { + "delegate": { + "type": "object", + "required": [ + "amount", + "validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [MsgUndelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L112-L121). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "undelegate" + ], + "properties": { + "undelegate": { + "type": "object", + "required": [ + "amount", + "validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [MsgBeginRedelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L95-L105). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "redelegate" + ], + "properties": { + "redelegate": { + "type": "object", + "required": [ + "amount", + "dst_validator", + "src_validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "dst_validator": { + "type": "string" + }, + "src_validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + }, + "Vote": { + "oneOf": [ + { + "description": "Marks support for the proposal.", + "type": "string", + "enum": [ + "yes" + ] + }, + { + "description": "Marks opposition to the proposal.", + "type": "string", + "enum": [ + "no" + ] + }, + { + "description": "Marks participation but does not count towards the ratio of support / opposed", + "type": "string", + "enum": [ + "abstain" + ] + }, + { + "description": "Veto is generally to be treated as a No vote. Some implementations may allow certain voters to be able to Veto, or them to be counted stronger than No in some way.", + "type": "string", + "enum": [ + "veto" + ] + } + ] + }, + "VoteOption": { + "type": "string", + "enum": [ + "yes", + "no", + "abstain", + "no_with_veto" + ] + }, + "WasmMsg": { + "description": "The message types of the wasm module.\n\nSee https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto", + "oneOf": [ + { + "description": "Dispatches a call to another contract at a known address (with known ABI).\n\nThis is translated to a [MsgExecuteContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L68-L78). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "execute" + ], + "properties": { + "execute": { + "type": "object", + "required": [ + "contract_addr", + "funds", + "msg" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "funds": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "msg": { + "description": "msg is the json-encoded ExecuteMsg struct (as raw Binary)", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThe contract address is non-predictable. But it is guaranteed that when emitting the same Instantiate message multiple times, multiple instances on different addresses will be generated. See also Instantiate2.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L53-L71). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "instantiate" + ], + "properties": { + "instantiate": { + "type": "object", + "required": [ + "code_id", + "funds", + "label", + "msg" + ], + "properties": { + "admin": { + "type": [ + "string", + "null" + ] + }, + "code_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "funds": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "label": { + "description": "A human-readbale label for the contract", + "type": "string" + }, + "msg": { + "description": "msg is the JSON-encoded InstantiateMsg struct (as raw Binary)", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Migrates a given contracts to use new wasm code. Passes a MigrateMsg to allow us to customize behavior.\n\nOnly the contract admin (as defined in wasmd), if any, is able to make this call.\n\nThis is translated to a [MsgMigrateContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L86-L96). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "migrate" + ], + "properties": { + "migrate": { + "type": "object", + "required": [ + "contract_addr", + "msg", + "new_code_id" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "msg": { + "description": "msg is the json-encoded MigrateMsg struct that will be passed to the new code", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "new_code_id": { + "description": "the code_id of the new logic to place in the given contract", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Sets a new admin (for migrate) on the given contract. Fails if this contract is not currently admin of the target contract.", + "type": "object", + "required": [ + "update_admin" + ], + "properties": { + "update_admin": { + "type": "object", + "required": [ + "admin", + "contract_addr" + ], + "properties": { + "admin": { + "type": "string" + }, + "contract_addr": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Clears the admin on the given contract, so no more migration possible. Fails if this contract is not currently admin of the target contract.", + "type": "object", + "required": [ + "clear_admin" + ], + "properties": { + "clear_admin": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + } + } +} diff --git a/contracts/multisig/cw3-flex-multisig/schema/raw/instantiate.json b/contracts/multisig/cw3-flex-multisig/schema/raw/instantiate.json new file mode 100644 index 0000000000..90fa8736e6 --- /dev/null +++ b/contracts/multisig/cw3-flex-multisig/schema/raw/instantiate.json @@ -0,0 +1,261 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "coconut_bandwidth_contract_address", + "coconut_dkg_contract_address", + "group_addr", + "max_voting_period", + "threshold" + ], + "properties": { + "coconut_bandwidth_contract_address": { + "type": "string" + }, + "coconut_dkg_contract_address": { + "type": "string" + }, + "executor": { + "anyOf": [ + { + "$ref": "#/definitions/Executor" + }, + { + "type": "null" + } + ] + }, + "group_addr": { + "type": "string" + }, + "max_voting_period": { + "$ref": "#/definitions/Duration" + }, + "proposal_deposit": { + "description": "The cost of creating a proposal (if any).", + "anyOf": [ + { + "$ref": "#/definitions/UncheckedDepositInfo" + }, + { + "type": "null" + } + ] + }, + "threshold": { + "$ref": "#/definitions/Threshold" + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Duration": { + "description": "Duration is a delta of time. You can add it to a BlockInfo or Expiration to move that further in the future. Note that an height-based Duration and a time-based Expiration cannot be combined", + "oneOf": [ + { + "type": "object", + "required": [ + "height" + ], + "properties": { + "height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "Time in seconds", + "type": "object", + "required": [ + "time" + ], + "properties": { + "time": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + ] + }, + "Executor": { + "description": "Defines who is able to execute proposals once passed", + "oneOf": [ + { + "description": "Any member of the voting group, even with 0 points", + "type": "string", + "enum": [ + "member" + ] + }, + { + "description": "Only the given address", + "type": "object", + "required": [ + "only" + ], + "properties": { + "only": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + ] + }, + "Threshold": { + "description": "This defines the different ways tallies can happen.\n\nThe total_weight used for calculating success as well as the weights of each individual voter used in tallying should be snapshotted at the beginning of the block at which the proposal starts (this is likely the responsibility of a correct cw4 implementation). See also `ThresholdResponse` in the cw3 spec.", + "oneOf": [ + { + "description": "Declares that a fixed weight of Yes votes is needed to pass. See `ThresholdResponse.AbsoluteCount` in the cw3 spec for details.", + "type": "object", + "required": [ + "absolute_count" + ], + "properties": { + "absolute_count": { + "type": "object", + "required": [ + "weight" + ], + "properties": { + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Declares a percentage of the total weight that must cast Yes votes in order for a proposal to pass. See `ThresholdResponse.AbsolutePercentage` in the cw3 spec for details.", + "type": "object", + "required": [ + "absolute_percentage" + ], + "properties": { + "absolute_percentage": { + "type": "object", + "required": [ + "percentage" + ], + "properties": { + "percentage": { + "$ref": "#/definitions/Decimal" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Declares a `quorum` of the total votes that must participate in the election in order for the vote to be considered at all. See `ThresholdResponse.ThresholdQuorum` in the cw3 spec for details.", + "type": "object", + "required": [ + "threshold_quorum" + ], + "properties": { + "threshold_quorum": { + "type": "object", + "required": [ + "quorum", + "threshold" + ], + "properties": { + "quorum": { + "$ref": "#/definitions/Decimal" + }, + "threshold": { + "$ref": "#/definitions/Decimal" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "UncheckedDenom": { + "oneOf": [ + { + "type": "object", + "required": [ + "native" + ], + "properties": { + "native": { + "type": "string" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "cw20" + ], + "properties": { + "cw20": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "UncheckedDepositInfo": { + "description": "Information about the deposit required to create a proposal. For use in messages. To validate, transform into `DepositInfo` via `into_checked()`.", + "type": "object", + "required": [ + "amount", + "denom", + "refund_failed_proposals" + ], + "properties": { + "amount": { + "description": "The number tokens required for payment.", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "denom": { + "description": "The denom of the deposit payment.", + "allOf": [ + { + "$ref": "#/definitions/UncheckedDenom" + } + ] + }, + "refund_failed_proposals": { + "description": "Should failed proposals have their deposits refunded?", + "type": "boolean" + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/multisig/cw3-flex-multisig/schema/raw/migrate.json b/contracts/multisig/cw3-flex-multisig/schema/raw/migrate.json new file mode 100644 index 0000000000..b983a8e05c --- /dev/null +++ b/contracts/multisig/cw3-flex-multisig/schema/raw/migrate.json @@ -0,0 +1,18 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MigrateMsg", + "type": "object", + "required": [ + "coconut_bandwidth_address", + "coconut_dkg_address" + ], + "properties": { + "coconut_bandwidth_address": { + "type": "string" + }, + "coconut_dkg_address": { + "type": "string" + } + }, + "additionalProperties": false +} diff --git a/contracts/multisig/cw3-flex-multisig/schema/raw/query.json b/contracts/multisig/cw3-flex-multisig/schema/raw/query.json new file mode 100644 index 0000000000..570a727999 --- /dev/null +++ b/contracts/multisig/cw3-flex-multisig/schema/raw/query.json @@ -0,0 +1,232 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "threshold" + ], + "properties": { + "threshold": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "proposal" + ], + "properties": { + "proposal": { + "type": "object", + "required": [ + "proposal_id" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "list_proposals" + ], + "properties": { + "list_proposals": { + "type": "object", + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "reverse_proposals" + ], + "properties": { + "reverse_proposals": { + "type": "object", + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_before": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "vote" + ], + "properties": { + "vote": { + "type": "object", + "required": [ + "proposal_id", + "voter" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "voter": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "list_votes" + ], + "properties": { + "list_votes": { + "type": "object", + "required": [ + "proposal_id" + ], + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "voter" + ], + "properties": { + "voter": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "list_voters" + ], + "properties": { + "list_voters": { + "type": "object", + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the current configuration.", + "type": "object", + "required": [ + "config" + ], + "properties": { + "config": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] +} diff --git a/contracts/multisig/cw3-flex-multisig/schema/raw/response_to_config.json b/contracts/multisig/cw3-flex-multisig/schema/raw/response_to_config.json new file mode 100644 index 0000000000..b5388ddae1 --- /dev/null +++ b/contracts/multisig/cw3-flex-multisig/schema/raw/response_to_config.json @@ -0,0 +1,269 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Config", + "type": "object", + "required": [ + "coconut_bandwidth_addr", + "coconut_dkg_addr", + "group_addr", + "max_voting_period", + "threshold" + ], + "properties": { + "coconut_bandwidth_addr": { + "$ref": "#/definitions/Addr" + }, + "coconut_dkg_addr": { + "$ref": "#/definitions/Addr" + }, + "executor": { + "anyOf": [ + { + "$ref": "#/definitions/Executor" + }, + { + "type": "null" + } + ] + }, + "group_addr": { + "$ref": "#/definitions/Cw4Contract" + }, + "max_voting_period": { + "$ref": "#/definitions/Duration" + }, + "proposal_deposit": { + "description": "The price, if any, of creating a new proposal.", + "anyOf": [ + { + "$ref": "#/definitions/DepositInfo" + }, + { + "type": "null" + } + ] + }, + "threshold": { + "$ref": "#/definitions/Threshold" + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Cw4Contract": { + "description": "Cw4Contract is a wrapper around Addr that provides a lot of helpers for working with cw4 contracts\n\nIf you wish to persist this, convert to Cw4CanonicalContract via .canonical()", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Denom": { + "oneOf": [ + { + "type": "object", + "required": [ + "native" + ], + "properties": { + "native": { + "type": "string" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "cw20" + ], + "properties": { + "cw20": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + ] + }, + "DepositInfo": { + "description": "Information about the deposit required to create a proposal.", + "type": "object", + "required": [ + "amount", + "denom", + "refund_failed_proposals" + ], + "properties": { + "amount": { + "description": "The number tokens required for payment.", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "denom": { + "description": "The denom of the deposit payment.", + "allOf": [ + { + "$ref": "#/definitions/Denom" + } + ] + }, + "refund_failed_proposals": { + "description": "Should failed proposals have their deposits refunded?", + "type": "boolean" + } + }, + "additionalProperties": false + }, + "Duration": { + "description": "Duration is a delta of time. You can add it to a BlockInfo or Expiration to move that further in the future. Note that an height-based Duration and a time-based Expiration cannot be combined", + "oneOf": [ + { + "type": "object", + "required": [ + "height" + ], + "properties": { + "height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "Time in seconds", + "type": "object", + "required": [ + "time" + ], + "properties": { + "time": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + ] + }, + "Executor": { + "description": "Defines who is able to execute proposals once passed", + "oneOf": [ + { + "description": "Any member of the voting group, even with 0 points", + "type": "string", + "enum": [ + "member" + ] + }, + { + "description": "Only the given address", + "type": "object", + "required": [ + "only" + ], + "properties": { + "only": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + ] + }, + "Threshold": { + "description": "This defines the different ways tallies can happen.\n\nThe total_weight used for calculating success as well as the weights of each individual voter used in tallying should be snapshotted at the beginning of the block at which the proposal starts (this is likely the responsibility of a correct cw4 implementation). See also `ThresholdResponse` in the cw3 spec.", + "oneOf": [ + { + "description": "Declares that a fixed weight of Yes votes is needed to pass. See `ThresholdResponse.AbsoluteCount` in the cw3 spec for details.", + "type": "object", + "required": [ + "absolute_count" + ], + "properties": { + "absolute_count": { + "type": "object", + "required": [ + "weight" + ], + "properties": { + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Declares a percentage of the total weight that must cast Yes votes in order for a proposal to pass. See `ThresholdResponse.AbsolutePercentage` in the cw3 spec for details.", + "type": "object", + "required": [ + "absolute_percentage" + ], + "properties": { + "absolute_percentage": { + "type": "object", + "required": [ + "percentage" + ], + "properties": { + "percentage": { + "$ref": "#/definitions/Decimal" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Declares a `quorum` of the total votes that must participate in the election in order for the vote to be considered at all. See `ThresholdResponse.ThresholdQuorum` in the cw3 spec for details.", + "type": "object", + "required": [ + "threshold_quorum" + ], + "properties": { + "threshold_quorum": { + "type": "object", + "required": [ + "quorum", + "threshold" + ], + "properties": { + "quorum": { + "$ref": "#/definitions/Decimal" + }, + "threshold": { + "$ref": "#/definitions/Decimal" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/multisig/cw3-flex-multisig/schema/raw/response_to_list_proposals.json b/contracts/multisig/cw3-flex-multisig/schema/raw/response_to_list_proposals.json new file mode 100644 index 0000000000..0012bec80b --- /dev/null +++ b/contracts/multisig/cw3-flex-multisig/schema/raw/response_to_list_proposals.json @@ -0,0 +1,1045 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ProposalListResponse_for_Empty", + "type": "object", + "required": [ + "proposals" + ], + "properties": { + "proposals": { + "type": "array", + "items": { + "$ref": "#/definitions/ProposalResponse_for_Empty" + } + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "BankMsg": { + "description": "The message types of the bank module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto", + "oneOf": [ + { + "description": "Sends native tokens from the contract to the given address.\n\nThis is translated to a [MsgSend](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto#L19-L28). `from_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "send" + ], + "properties": { + "send": { + "type": "object", + "required": [ + "amount", + "to_address" + ], + "properties": { + "amount": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "to_address": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This will burn the given coins from the contract's account. There is no Cosmos SDK message that performs this, but it can be done by calling the bank keeper. Important if a contract controls significant token supply that must be retired.", + "type": "object", + "required": [ + "burn" + ], + "properties": { + "burn": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Binary": { + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "CosmosMsg_for_Empty": { + "oneOf": [ + { + "type": "object", + "required": [ + "bank" + ], + "properties": { + "bank": { + "$ref": "#/definitions/BankMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "custom" + ], + "properties": { + "custom": { + "$ref": "#/definitions/Empty" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "staking" + ], + "properties": { + "staking": { + "$ref": "#/definitions/StakingMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "distribution" + ], + "properties": { + "distribution": { + "$ref": "#/definitions/DistributionMsg" + } + }, + "additionalProperties": false + }, + { + "description": "A Stargate message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)", + "type": "object", + "required": [ + "stargate" + ], + "properties": { + "stargate": { + "type": "object", + "required": [ + "type_url", + "value" + ], + "properties": { + "type_url": { + "type": "string" + }, + "value": { + "$ref": "#/definitions/Binary" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "ibc" + ], + "properties": { + "ibc": { + "$ref": "#/definitions/IbcMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "wasm" + ], + "properties": { + "wasm": { + "$ref": "#/definitions/WasmMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "gov" + ], + "properties": { + "gov": { + "$ref": "#/definitions/GovMsg" + } + }, + "additionalProperties": false + } + ] + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Denom": { + "oneOf": [ + { + "type": "object", + "required": [ + "native" + ], + "properties": { + "native": { + "type": "string" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "cw20" + ], + "properties": { + "cw20": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + ] + }, + "DepositInfo": { + "description": "Information about the deposit required to create a proposal.", + "type": "object", + "required": [ + "amount", + "denom", + "refund_failed_proposals" + ], + "properties": { + "amount": { + "description": "The number tokens required for payment.", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "denom": { + "description": "The denom of the deposit payment.", + "allOf": [ + { + "$ref": "#/definitions/Denom" + } + ] + }, + "refund_failed_proposals": { + "description": "Should failed proposals have their deposits refunded?", + "type": "boolean" + } + }, + "additionalProperties": false + }, + "DistributionMsg": { + "description": "The message types of the distribution module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto", + "oneOf": [ + { + "description": "This is translated to a [MsgSetWithdrawAddress](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#L29-L37). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "set_withdraw_address" + ], + "properties": { + "set_withdraw_address": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "description": "The `withdraw_address`", + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [[MsgWithdrawDelegatorReward](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#L42-L50). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "withdraw_delegator_reward" + ], + "properties": { + "withdraw_delegator_reward": { + "type": "object", + "required": [ + "validator" + ], + "properties": { + "validator": { + "description": "The `validator_address`", + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Empty": { + "description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)", + "type": "object" + }, + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "GovMsg": { + "description": "This message type allows the contract interact with the [x/gov] module in order to cast votes.\n\n[x/gov]: https://github.com/cosmos/cosmos-sdk/tree/v0.45.12/x/gov\n\n## Examples\n\nCast a simple vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); use cosmwasm_std::{GovMsg, VoteOption};\n\n#[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::Vote { proposal_id: 4, vote: VoteOption::Yes, })) } ```\n\nCast a weighted vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); # #[cfg(feature = \"cosmwasm_1_2\")] use cosmwasm_std::{Decimal, GovMsg, VoteOption, WeightedVoteOption};\n\n# #[cfg(feature = \"cosmwasm_1_2\")] #[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::VoteWeighted { proposal_id: 4, options: vec![ WeightedVoteOption { option: VoteOption::Yes, weight: Decimal::percent(65), }, WeightedVoteOption { option: VoteOption::Abstain, weight: Decimal::percent(35), }, ], })) } ```", + "oneOf": [ + { + "description": "This maps directly to [MsgVote](https://github.com/cosmos/cosmos-sdk/blob/v0.42.5/proto/cosmos/gov/v1beta1/tx.proto#L46-L56) in the Cosmos SDK with voter set to the contract address.", + "type": "object", + "required": [ + "vote" + ], + "properties": { + "vote": { + "type": "object", + "required": [ + "proposal_id", + "vote" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "vote": { + "description": "The vote option.\n\nThis should be called \"option\" for consistency with Cosmos SDK. Sorry for that. See .", + "allOf": [ + { + "$ref": "#/definitions/VoteOption" + } + ] + } + } + } + }, + "additionalProperties": false + } + ] + }, + "IbcMsg": { + "description": "These are messages in the IBC lifecycle. Only usable by IBC-enabled contracts (contracts that directly speak the IBC protocol via 6 entry points)", + "oneOf": [ + { + "description": "Sends bank tokens owned by the contract to the given address on another chain. The channel must already be established between the ibctransfer module on this chain and a matching module on the remote chain. We cannot select the port_id, this is whatever the local chain has bound the ibctransfer module to.", + "type": "object", + "required": [ + "transfer" + ], + "properties": { + "transfer": { + "type": "object", + "required": [ + "amount", + "channel_id", + "timeout", + "to_address" + ], + "properties": { + "amount": { + "description": "packet data only supports one coin https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/ibc/applications/transfer/v1/transfer.proto#L11-L20", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "channel_id": { + "description": "exisiting channel to send the tokens over", + "type": "string" + }, + "timeout": { + "description": "when packet times out, measured on remote chain", + "allOf": [ + { + "$ref": "#/definitions/IbcTimeout" + } + ] + }, + "to_address": { + "description": "address on the remote chain to receive these tokens", + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Sends an IBC packet with given data over the existing channel. Data should be encoded in a format defined by the channel version, and the module on the other side should know how to parse this.", + "type": "object", + "required": [ + "send_packet" + ], + "properties": { + "send_packet": { + "type": "object", + "required": [ + "channel_id", + "data", + "timeout" + ], + "properties": { + "channel_id": { + "type": "string" + }, + "data": { + "$ref": "#/definitions/Binary" + }, + "timeout": { + "description": "when packet times out, measured on remote chain", + "allOf": [ + { + "$ref": "#/definitions/IbcTimeout" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This will close an existing channel that is owned by this contract. Port is auto-assigned to the contract's IBC port", + "type": "object", + "required": [ + "close_channel" + ], + "properties": { + "close_channel": { + "type": "object", + "required": [ + "channel_id" + ], + "properties": { + "channel_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "IbcTimeout": { + "description": "In IBC each package must set at least one type of timeout: the timestamp or the block height. Using this rather complex enum instead of two timeout fields we ensure that at least one timeout is set.", + "type": "object", + "properties": { + "block": { + "anyOf": [ + { + "$ref": "#/definitions/IbcTimeoutBlock" + }, + { + "type": "null" + } + ] + }, + "timestamp": { + "anyOf": [ + { + "$ref": "#/definitions/Timestamp" + }, + { + "type": "null" + } + ] + } + } + }, + "IbcTimeoutBlock": { + "description": "IBCTimeoutHeight Height is a monotonically increasing data type that can be compared against another Height for the purposes of updating and freezing clients. Ordering is (revision_number, timeout_height)", + "type": "object", + "required": [ + "height", + "revision" + ], + "properties": { + "height": { + "description": "block height after which the packet times out. the height within the given revision", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "revision": { + "description": "the version that the client is currently on (eg. after reseting the chain this could increment 1 as height drops to 0)", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "ProposalResponse_for_Empty": { + "description": "Note, if you are storing custom messages in the proposal, the querier needs to know what possible custom message types those are in order to parse the response", + "type": "object", + "required": [ + "description", + "expires", + "id", + "msgs", + "proposer", + "status", + "threshold", + "title" + ], + "properties": { + "deposit": { + "anyOf": [ + { + "$ref": "#/definitions/DepositInfo" + }, + { + "type": "null" + } + ] + }, + "description": { + "type": "string" + }, + "expires": { + "$ref": "#/definitions/Expiration" + }, + "id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "msgs": { + "type": "array", + "items": { + "$ref": "#/definitions/CosmosMsg_for_Empty" + } + }, + "proposer": { + "$ref": "#/definitions/Addr" + }, + "status": { + "$ref": "#/definitions/Status" + }, + "threshold": { + "description": "This is the threshold that is applied to this proposal. Both the rules of the voting contract, as well as the total_weight of the voting group may have changed since this time. That means that the generic `Threshold{}` query does not provide valid information for existing proposals.", + "allOf": [ + { + "$ref": "#/definitions/ThresholdResponse" + } + ] + }, + "title": { + "type": "string" + } + }, + "additionalProperties": false + }, + "StakingMsg": { + "description": "The message types of the staking module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto", + "oneOf": [ + { + "description": "This is translated to a [MsgDelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L81-L90). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "delegate" + ], + "properties": { + "delegate": { + "type": "object", + "required": [ + "amount", + "validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [MsgUndelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L112-L121). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "undelegate" + ], + "properties": { + "undelegate": { + "type": "object", + "required": [ + "amount", + "validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [MsgBeginRedelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L95-L105). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "redelegate" + ], + "properties": { + "redelegate": { + "type": "object", + "required": [ + "amount", + "dst_validator", + "src_validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "dst_validator": { + "type": "string" + }, + "src_validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Status": { + "oneOf": [ + { + "description": "proposal was created, but voting has not yet begun for whatever reason", + "type": "string", + "enum": [ + "pending" + ] + }, + { + "description": "you can vote on this", + "type": "string", + "enum": [ + "open" + ] + }, + { + "description": "voting is over and it did not pass", + "type": "string", + "enum": [ + "rejected" + ] + }, + { + "description": "voting is over and it did pass, but has not yet executed", + "type": "string", + "enum": [ + "passed" + ] + }, + { + "description": "voting is over it passed, and the proposal was executed", + "type": "string", + "enum": [ + "executed" + ] + } + ] + }, + "ThresholdResponse": { + "description": "This defines the different ways tallies can happen. Every contract should support a subset of these, ideally all.\n\nThe total_weight used for calculating success as well as the weights of each individual voter used in tallying should be snapshotted at the beginning of the block at which the proposal starts (this is likely the responsibility of a correct cw4 implementation).", + "oneOf": [ + { + "description": "Declares that a fixed weight of yes votes is needed to pass. It does not matter how many no votes are cast, or how many do not vote, as long as `weight` yes votes are cast.\n\nThis is the simplest format and usually suitable for small multisigs of trusted parties, like 3 of 5. (weight: 3, total_weight: 5)\n\nA proposal of this type can pass early as soon as the needed weight of yes votes has been cast.", + "type": "object", + "required": [ + "absolute_count" + ], + "properties": { + "absolute_count": { + "type": "object", + "required": [ + "total_weight", + "weight" + ], + "properties": { + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Declares a percentage of the total weight that must cast Yes votes, in order for a proposal to pass. The passing weight is computed over the total weight minus the weight of the abstained votes.\n\nThis is useful for similar circumstances as `AbsoluteCount`, where we have a relatively small set of voters, and participation is required. It is understood that if the voting set (group) changes between different proposals that refer to the same group, each proposal will work with a different set of voter weights (the ones snapshotted at proposal creation), and the passing weight for each proposal will be computed based on the absolute percentage, times the total weights of the members at the time of each proposal creation.\n\nExample: we set `percentage` to 51%. Proposal 1 starts when there is a `total_weight` of 5. This will require 3 weight of Yes votes in order to pass. Later, the Proposal 2 starts but the `total_weight` of the group has increased to 9. That proposal will then automatically require 5 Yes of 9 to pass, rather than 3 yes of 9 as would be the case with `AbsoluteCount`.", + "type": "object", + "required": [ + "absolute_percentage" + ], + "properties": { + "absolute_percentage": { + "type": "object", + "required": [ + "percentage", + "total_weight" + ], + "properties": { + "percentage": { + "$ref": "#/definitions/Decimal" + }, + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "In addition to a `threshold`, declares a `quorum` of the total votes that must participate in the election in order for the vote to be considered at all. Within the votes that were cast, it requires `threshold` votes in favor. That is calculated by ignoring the Abstain votes (they count towards `quorum`, but do not influence `threshold`). That is, we calculate `Yes / (Yes + No + Veto)` and compare it with `threshold` to consider if the proposal was passed.\n\nIt is rather difficult for a proposal of this type to pass early. That can only happen if the required quorum has been already met, and there are already enough Yes votes for the proposal to pass.\n\n30% Yes votes, 10% No votes, and 20% Abstain would pass early if quorum <= 60% (who has cast votes) and if the threshold is <= 37.5% (the remaining 40% voting no => 30% yes + 50% no). Once the voting period has passed with no additional votes, that same proposal would be considered successful if quorum <= 60% and threshold <= 75% (percent in favor if we ignore abstain votes).\n\nThis type is more common in general elections, where participation is often expected to be low, and `AbsolutePercentage` would either be too high to pass anything, or allow low percentages to pass, independently of if there was high participation in the election or not.", + "type": "object", + "required": [ + "threshold_quorum" + ], + "properties": { + "threshold_quorum": { + "type": "object", + "required": [ + "quorum", + "threshold", + "total_weight" + ], + "properties": { + "quorum": { + "$ref": "#/definitions/Decimal" + }, + "threshold": { + "$ref": "#/definitions/Decimal" + }, + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + }, + "VoteOption": { + "type": "string", + "enum": [ + "yes", + "no", + "abstain", + "no_with_veto" + ] + }, + "WasmMsg": { + "description": "The message types of the wasm module.\n\nSee https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto", + "oneOf": [ + { + "description": "Dispatches a call to another contract at a known address (with known ABI).\n\nThis is translated to a [MsgExecuteContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L68-L78). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "execute" + ], + "properties": { + "execute": { + "type": "object", + "required": [ + "contract_addr", + "funds", + "msg" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "funds": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "msg": { + "description": "msg is the json-encoded ExecuteMsg struct (as raw Binary)", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThe contract address is non-predictable. But it is guaranteed that when emitting the same Instantiate message multiple times, multiple instances on different addresses will be generated. See also Instantiate2.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L53-L71). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "instantiate" + ], + "properties": { + "instantiate": { + "type": "object", + "required": [ + "code_id", + "funds", + "label", + "msg" + ], + "properties": { + "admin": { + "type": [ + "string", + "null" + ] + }, + "code_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "funds": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "label": { + "description": "A human-readbale label for the contract", + "type": "string" + }, + "msg": { + "description": "msg is the JSON-encoded InstantiateMsg struct (as raw Binary)", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Migrates a given contracts to use new wasm code. Passes a MigrateMsg to allow us to customize behavior.\n\nOnly the contract admin (as defined in wasmd), if any, is able to make this call.\n\nThis is translated to a [MsgMigrateContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L86-L96). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "migrate" + ], + "properties": { + "migrate": { + "type": "object", + "required": [ + "contract_addr", + "msg", + "new_code_id" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "msg": { + "description": "msg is the json-encoded MigrateMsg struct that will be passed to the new code", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "new_code_id": { + "description": "the code_id of the new logic to place in the given contract", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Sets a new admin (for migrate) on the given contract. Fails if this contract is not currently admin of the target contract.", + "type": "object", + "required": [ + "update_admin" + ], + "properties": { + "update_admin": { + "type": "object", + "required": [ + "admin", + "contract_addr" + ], + "properties": { + "admin": { + "type": "string" + }, + "contract_addr": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Clears the admin on the given contract, so no more migration possible. Fails if this contract is not currently admin of the target contract.", + "type": "object", + "required": [ + "clear_admin" + ], + "properties": { + "clear_admin": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + } + } +} diff --git a/contracts/multisig/cw3-flex-multisig/schema/raw/response_to_list_voters.json b/contracts/multisig/cw3-flex-multisig/schema/raw/response_to_list_voters.json new file mode 100644 index 0000000000..9e337d64ea --- /dev/null +++ b/contracts/multisig/cw3-flex-multisig/schema/raw/response_to_list_voters.json @@ -0,0 +1,37 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "VoterListResponse", + "type": "object", + "required": [ + "voters" + ], + "properties": { + "voters": { + "type": "array", + "items": { + "$ref": "#/definitions/VoterDetail" + } + } + }, + "additionalProperties": false, + "definitions": { + "VoterDetail": { + "type": "object", + "required": [ + "addr", + "weight" + ], + "properties": { + "addr": { + "type": "string" + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/multisig/cw3-flex-multisig/schema/raw/response_to_list_votes.json b/contracts/multisig/cw3-flex-multisig/schema/raw/response_to_list_votes.json new file mode 100644 index 0000000000..90a4c459b0 --- /dev/null +++ b/contracts/multisig/cw3-flex-multisig/schema/raw/response_to_list_votes.json @@ -0,0 +1,80 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "VoteListResponse", + "type": "object", + "required": [ + "votes" + ], + "properties": { + "votes": { + "type": "array", + "items": { + "$ref": "#/definitions/VoteInfo" + } + } + }, + "additionalProperties": false, + "definitions": { + "Vote": { + "oneOf": [ + { + "description": "Marks support for the proposal.", + "type": "string", + "enum": [ + "yes" + ] + }, + { + "description": "Marks opposition to the proposal.", + "type": "string", + "enum": [ + "no" + ] + }, + { + "description": "Marks participation but does not count towards the ratio of support / opposed", + "type": "string", + "enum": [ + "abstain" + ] + }, + { + "description": "Veto is generally to be treated as a No vote. Some implementations may allow certain voters to be able to Veto, or them to be counted stronger than No in some way.", + "type": "string", + "enum": [ + "veto" + ] + } + ] + }, + "VoteInfo": { + "description": "Returns the vote (opinion as well as weight counted) as well as the address of the voter who submitted it", + "type": "object", + "required": [ + "proposal_id", + "vote", + "voter", + "weight" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "vote": { + "$ref": "#/definitions/Vote" + }, + "voter": { + "type": "string" + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/multisig/cw3-flex-multisig/schema/raw/response_to_proposal.json b/contracts/multisig/cw3-flex-multisig/schema/raw/response_to_proposal.json new file mode 100644 index 0000000000..751ed3c7bc --- /dev/null +++ b/contracts/multisig/cw3-flex-multisig/schema/raw/response_to_proposal.json @@ -0,0 +1,1030 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ProposalResponse_for_Empty", + "description": "Note, if you are storing custom messages in the proposal, the querier needs to know what possible custom message types those are in order to parse the response", + "type": "object", + "required": [ + "description", + "expires", + "id", + "msgs", + "proposer", + "status", + "threshold", + "title" + ], + "properties": { + "deposit": { + "anyOf": [ + { + "$ref": "#/definitions/DepositInfo" + }, + { + "type": "null" + } + ] + }, + "description": { + "type": "string" + }, + "expires": { + "$ref": "#/definitions/Expiration" + }, + "id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "msgs": { + "type": "array", + "items": { + "$ref": "#/definitions/CosmosMsg_for_Empty" + } + }, + "proposer": { + "$ref": "#/definitions/Addr" + }, + "status": { + "$ref": "#/definitions/Status" + }, + "threshold": { + "description": "This is the threshold that is applied to this proposal. Both the rules of the voting contract, as well as the total_weight of the voting group may have changed since this time. That means that the generic `Threshold{}` query does not provide valid information for existing proposals.", + "allOf": [ + { + "$ref": "#/definitions/ThresholdResponse" + } + ] + }, + "title": { + "type": "string" + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "BankMsg": { + "description": "The message types of the bank module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto", + "oneOf": [ + { + "description": "Sends native tokens from the contract to the given address.\n\nThis is translated to a [MsgSend](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto#L19-L28). `from_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "send" + ], + "properties": { + "send": { + "type": "object", + "required": [ + "amount", + "to_address" + ], + "properties": { + "amount": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "to_address": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This will burn the given coins from the contract's account. There is no Cosmos SDK message that performs this, but it can be done by calling the bank keeper. Important if a contract controls significant token supply that must be retired.", + "type": "object", + "required": [ + "burn" + ], + "properties": { + "burn": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Binary": { + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "CosmosMsg_for_Empty": { + "oneOf": [ + { + "type": "object", + "required": [ + "bank" + ], + "properties": { + "bank": { + "$ref": "#/definitions/BankMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "custom" + ], + "properties": { + "custom": { + "$ref": "#/definitions/Empty" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "staking" + ], + "properties": { + "staking": { + "$ref": "#/definitions/StakingMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "distribution" + ], + "properties": { + "distribution": { + "$ref": "#/definitions/DistributionMsg" + } + }, + "additionalProperties": false + }, + { + "description": "A Stargate message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)", + "type": "object", + "required": [ + "stargate" + ], + "properties": { + "stargate": { + "type": "object", + "required": [ + "type_url", + "value" + ], + "properties": { + "type_url": { + "type": "string" + }, + "value": { + "$ref": "#/definitions/Binary" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "ibc" + ], + "properties": { + "ibc": { + "$ref": "#/definitions/IbcMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "wasm" + ], + "properties": { + "wasm": { + "$ref": "#/definitions/WasmMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "gov" + ], + "properties": { + "gov": { + "$ref": "#/definitions/GovMsg" + } + }, + "additionalProperties": false + } + ] + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Denom": { + "oneOf": [ + { + "type": "object", + "required": [ + "native" + ], + "properties": { + "native": { + "type": "string" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "cw20" + ], + "properties": { + "cw20": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + ] + }, + "DepositInfo": { + "description": "Information about the deposit required to create a proposal.", + "type": "object", + "required": [ + "amount", + "denom", + "refund_failed_proposals" + ], + "properties": { + "amount": { + "description": "The number tokens required for payment.", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "denom": { + "description": "The denom of the deposit payment.", + "allOf": [ + { + "$ref": "#/definitions/Denom" + } + ] + }, + "refund_failed_proposals": { + "description": "Should failed proposals have their deposits refunded?", + "type": "boolean" + } + }, + "additionalProperties": false + }, + "DistributionMsg": { + "description": "The message types of the distribution module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto", + "oneOf": [ + { + "description": "This is translated to a [MsgSetWithdrawAddress](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#L29-L37). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "set_withdraw_address" + ], + "properties": { + "set_withdraw_address": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "description": "The `withdraw_address`", + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [[MsgWithdrawDelegatorReward](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#L42-L50). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "withdraw_delegator_reward" + ], + "properties": { + "withdraw_delegator_reward": { + "type": "object", + "required": [ + "validator" + ], + "properties": { + "validator": { + "description": "The `validator_address`", + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Empty": { + "description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)", + "type": "object" + }, + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "GovMsg": { + "description": "This message type allows the contract interact with the [x/gov] module in order to cast votes.\n\n[x/gov]: https://github.com/cosmos/cosmos-sdk/tree/v0.45.12/x/gov\n\n## Examples\n\nCast a simple vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); use cosmwasm_std::{GovMsg, VoteOption};\n\n#[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::Vote { proposal_id: 4, vote: VoteOption::Yes, })) } ```\n\nCast a weighted vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); # #[cfg(feature = \"cosmwasm_1_2\")] use cosmwasm_std::{Decimal, GovMsg, VoteOption, WeightedVoteOption};\n\n# #[cfg(feature = \"cosmwasm_1_2\")] #[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::VoteWeighted { proposal_id: 4, options: vec![ WeightedVoteOption { option: VoteOption::Yes, weight: Decimal::percent(65), }, WeightedVoteOption { option: VoteOption::Abstain, weight: Decimal::percent(35), }, ], })) } ```", + "oneOf": [ + { + "description": "This maps directly to [MsgVote](https://github.com/cosmos/cosmos-sdk/blob/v0.42.5/proto/cosmos/gov/v1beta1/tx.proto#L46-L56) in the Cosmos SDK with voter set to the contract address.", + "type": "object", + "required": [ + "vote" + ], + "properties": { + "vote": { + "type": "object", + "required": [ + "proposal_id", + "vote" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "vote": { + "description": "The vote option.\n\nThis should be called \"option\" for consistency with Cosmos SDK. Sorry for that. See .", + "allOf": [ + { + "$ref": "#/definitions/VoteOption" + } + ] + } + } + } + }, + "additionalProperties": false + } + ] + }, + "IbcMsg": { + "description": "These are messages in the IBC lifecycle. Only usable by IBC-enabled contracts (contracts that directly speak the IBC protocol via 6 entry points)", + "oneOf": [ + { + "description": "Sends bank tokens owned by the contract to the given address on another chain. The channel must already be established between the ibctransfer module on this chain and a matching module on the remote chain. We cannot select the port_id, this is whatever the local chain has bound the ibctransfer module to.", + "type": "object", + "required": [ + "transfer" + ], + "properties": { + "transfer": { + "type": "object", + "required": [ + "amount", + "channel_id", + "timeout", + "to_address" + ], + "properties": { + "amount": { + "description": "packet data only supports one coin https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/ibc/applications/transfer/v1/transfer.proto#L11-L20", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "channel_id": { + "description": "exisiting channel to send the tokens over", + "type": "string" + }, + "timeout": { + "description": "when packet times out, measured on remote chain", + "allOf": [ + { + "$ref": "#/definitions/IbcTimeout" + } + ] + }, + "to_address": { + "description": "address on the remote chain to receive these tokens", + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Sends an IBC packet with given data over the existing channel. Data should be encoded in a format defined by the channel version, and the module on the other side should know how to parse this.", + "type": "object", + "required": [ + "send_packet" + ], + "properties": { + "send_packet": { + "type": "object", + "required": [ + "channel_id", + "data", + "timeout" + ], + "properties": { + "channel_id": { + "type": "string" + }, + "data": { + "$ref": "#/definitions/Binary" + }, + "timeout": { + "description": "when packet times out, measured on remote chain", + "allOf": [ + { + "$ref": "#/definitions/IbcTimeout" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This will close an existing channel that is owned by this contract. Port is auto-assigned to the contract's IBC port", + "type": "object", + "required": [ + "close_channel" + ], + "properties": { + "close_channel": { + "type": "object", + "required": [ + "channel_id" + ], + "properties": { + "channel_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "IbcTimeout": { + "description": "In IBC each package must set at least one type of timeout: the timestamp or the block height. Using this rather complex enum instead of two timeout fields we ensure that at least one timeout is set.", + "type": "object", + "properties": { + "block": { + "anyOf": [ + { + "$ref": "#/definitions/IbcTimeoutBlock" + }, + { + "type": "null" + } + ] + }, + "timestamp": { + "anyOf": [ + { + "$ref": "#/definitions/Timestamp" + }, + { + "type": "null" + } + ] + } + } + }, + "IbcTimeoutBlock": { + "description": "IBCTimeoutHeight Height is a monotonically increasing data type that can be compared against another Height for the purposes of updating and freezing clients. Ordering is (revision_number, timeout_height)", + "type": "object", + "required": [ + "height", + "revision" + ], + "properties": { + "height": { + "description": "block height after which the packet times out. the height within the given revision", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "revision": { + "description": "the version that the client is currently on (eg. after reseting the chain this could increment 1 as height drops to 0)", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "StakingMsg": { + "description": "The message types of the staking module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto", + "oneOf": [ + { + "description": "This is translated to a [MsgDelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L81-L90). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "delegate" + ], + "properties": { + "delegate": { + "type": "object", + "required": [ + "amount", + "validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [MsgUndelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L112-L121). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "undelegate" + ], + "properties": { + "undelegate": { + "type": "object", + "required": [ + "amount", + "validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [MsgBeginRedelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L95-L105). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "redelegate" + ], + "properties": { + "redelegate": { + "type": "object", + "required": [ + "amount", + "dst_validator", + "src_validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "dst_validator": { + "type": "string" + }, + "src_validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Status": { + "oneOf": [ + { + "description": "proposal was created, but voting has not yet begun for whatever reason", + "type": "string", + "enum": [ + "pending" + ] + }, + { + "description": "you can vote on this", + "type": "string", + "enum": [ + "open" + ] + }, + { + "description": "voting is over and it did not pass", + "type": "string", + "enum": [ + "rejected" + ] + }, + { + "description": "voting is over and it did pass, but has not yet executed", + "type": "string", + "enum": [ + "passed" + ] + }, + { + "description": "voting is over it passed, and the proposal was executed", + "type": "string", + "enum": [ + "executed" + ] + } + ] + }, + "ThresholdResponse": { + "description": "This defines the different ways tallies can happen. Every contract should support a subset of these, ideally all.\n\nThe total_weight used for calculating success as well as the weights of each individual voter used in tallying should be snapshotted at the beginning of the block at which the proposal starts (this is likely the responsibility of a correct cw4 implementation).", + "oneOf": [ + { + "description": "Declares that a fixed weight of yes votes is needed to pass. It does not matter how many no votes are cast, or how many do not vote, as long as `weight` yes votes are cast.\n\nThis is the simplest format and usually suitable for small multisigs of trusted parties, like 3 of 5. (weight: 3, total_weight: 5)\n\nA proposal of this type can pass early as soon as the needed weight of yes votes has been cast.", + "type": "object", + "required": [ + "absolute_count" + ], + "properties": { + "absolute_count": { + "type": "object", + "required": [ + "total_weight", + "weight" + ], + "properties": { + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Declares a percentage of the total weight that must cast Yes votes, in order for a proposal to pass. The passing weight is computed over the total weight minus the weight of the abstained votes.\n\nThis is useful for similar circumstances as `AbsoluteCount`, where we have a relatively small set of voters, and participation is required. It is understood that if the voting set (group) changes between different proposals that refer to the same group, each proposal will work with a different set of voter weights (the ones snapshotted at proposal creation), and the passing weight for each proposal will be computed based on the absolute percentage, times the total weights of the members at the time of each proposal creation.\n\nExample: we set `percentage` to 51%. Proposal 1 starts when there is a `total_weight` of 5. This will require 3 weight of Yes votes in order to pass. Later, the Proposal 2 starts but the `total_weight` of the group has increased to 9. That proposal will then automatically require 5 Yes of 9 to pass, rather than 3 yes of 9 as would be the case with `AbsoluteCount`.", + "type": "object", + "required": [ + "absolute_percentage" + ], + "properties": { + "absolute_percentage": { + "type": "object", + "required": [ + "percentage", + "total_weight" + ], + "properties": { + "percentage": { + "$ref": "#/definitions/Decimal" + }, + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "In addition to a `threshold`, declares a `quorum` of the total votes that must participate in the election in order for the vote to be considered at all. Within the votes that were cast, it requires `threshold` votes in favor. That is calculated by ignoring the Abstain votes (they count towards `quorum`, but do not influence `threshold`). That is, we calculate `Yes / (Yes + No + Veto)` and compare it with `threshold` to consider if the proposal was passed.\n\nIt is rather difficult for a proposal of this type to pass early. That can only happen if the required quorum has been already met, and there are already enough Yes votes for the proposal to pass.\n\n30% Yes votes, 10% No votes, and 20% Abstain would pass early if quorum <= 60% (who has cast votes) and if the threshold is <= 37.5% (the remaining 40% voting no => 30% yes + 50% no). Once the voting period has passed with no additional votes, that same proposal would be considered successful if quorum <= 60% and threshold <= 75% (percent in favor if we ignore abstain votes).\n\nThis type is more common in general elections, where participation is often expected to be low, and `AbsolutePercentage` would either be too high to pass anything, or allow low percentages to pass, independently of if there was high participation in the election or not.", + "type": "object", + "required": [ + "threshold_quorum" + ], + "properties": { + "threshold_quorum": { + "type": "object", + "required": [ + "quorum", + "threshold", + "total_weight" + ], + "properties": { + "quorum": { + "$ref": "#/definitions/Decimal" + }, + "threshold": { + "$ref": "#/definitions/Decimal" + }, + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + }, + "VoteOption": { + "type": "string", + "enum": [ + "yes", + "no", + "abstain", + "no_with_veto" + ] + }, + "WasmMsg": { + "description": "The message types of the wasm module.\n\nSee https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto", + "oneOf": [ + { + "description": "Dispatches a call to another contract at a known address (with known ABI).\n\nThis is translated to a [MsgExecuteContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L68-L78). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "execute" + ], + "properties": { + "execute": { + "type": "object", + "required": [ + "contract_addr", + "funds", + "msg" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "funds": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "msg": { + "description": "msg is the json-encoded ExecuteMsg struct (as raw Binary)", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThe contract address is non-predictable. But it is guaranteed that when emitting the same Instantiate message multiple times, multiple instances on different addresses will be generated. See also Instantiate2.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L53-L71). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "instantiate" + ], + "properties": { + "instantiate": { + "type": "object", + "required": [ + "code_id", + "funds", + "label", + "msg" + ], + "properties": { + "admin": { + "type": [ + "string", + "null" + ] + }, + "code_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "funds": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "label": { + "description": "A human-readbale label for the contract", + "type": "string" + }, + "msg": { + "description": "msg is the JSON-encoded InstantiateMsg struct (as raw Binary)", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Migrates a given contracts to use new wasm code. Passes a MigrateMsg to allow us to customize behavior.\n\nOnly the contract admin (as defined in wasmd), if any, is able to make this call.\n\nThis is translated to a [MsgMigrateContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L86-L96). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "migrate" + ], + "properties": { + "migrate": { + "type": "object", + "required": [ + "contract_addr", + "msg", + "new_code_id" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "msg": { + "description": "msg is the json-encoded MigrateMsg struct that will be passed to the new code", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "new_code_id": { + "description": "the code_id of the new logic to place in the given contract", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Sets a new admin (for migrate) on the given contract. Fails if this contract is not currently admin of the target contract.", + "type": "object", + "required": [ + "update_admin" + ], + "properties": { + "update_admin": { + "type": "object", + "required": [ + "admin", + "contract_addr" + ], + "properties": { + "admin": { + "type": "string" + }, + "contract_addr": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Clears the admin on the given contract, so no more migration possible. Fails if this contract is not currently admin of the target contract.", + "type": "object", + "required": [ + "clear_admin" + ], + "properties": { + "clear_admin": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + } + } +} diff --git a/contracts/multisig/cw3-flex-multisig/schema/raw/response_to_reverse_proposals.json b/contracts/multisig/cw3-flex-multisig/schema/raw/response_to_reverse_proposals.json new file mode 100644 index 0000000000..0012bec80b --- /dev/null +++ b/contracts/multisig/cw3-flex-multisig/schema/raw/response_to_reverse_proposals.json @@ -0,0 +1,1045 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ProposalListResponse_for_Empty", + "type": "object", + "required": [ + "proposals" + ], + "properties": { + "proposals": { + "type": "array", + "items": { + "$ref": "#/definitions/ProposalResponse_for_Empty" + } + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "BankMsg": { + "description": "The message types of the bank module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto", + "oneOf": [ + { + "description": "Sends native tokens from the contract to the given address.\n\nThis is translated to a [MsgSend](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto#L19-L28). `from_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "send" + ], + "properties": { + "send": { + "type": "object", + "required": [ + "amount", + "to_address" + ], + "properties": { + "amount": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "to_address": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This will burn the given coins from the contract's account. There is no Cosmos SDK message that performs this, but it can be done by calling the bank keeper. Important if a contract controls significant token supply that must be retired.", + "type": "object", + "required": [ + "burn" + ], + "properties": { + "burn": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Binary": { + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "CosmosMsg_for_Empty": { + "oneOf": [ + { + "type": "object", + "required": [ + "bank" + ], + "properties": { + "bank": { + "$ref": "#/definitions/BankMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "custom" + ], + "properties": { + "custom": { + "$ref": "#/definitions/Empty" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "staking" + ], + "properties": { + "staking": { + "$ref": "#/definitions/StakingMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "distribution" + ], + "properties": { + "distribution": { + "$ref": "#/definitions/DistributionMsg" + } + }, + "additionalProperties": false + }, + { + "description": "A Stargate message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)", + "type": "object", + "required": [ + "stargate" + ], + "properties": { + "stargate": { + "type": "object", + "required": [ + "type_url", + "value" + ], + "properties": { + "type_url": { + "type": "string" + }, + "value": { + "$ref": "#/definitions/Binary" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "ibc" + ], + "properties": { + "ibc": { + "$ref": "#/definitions/IbcMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "wasm" + ], + "properties": { + "wasm": { + "$ref": "#/definitions/WasmMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "gov" + ], + "properties": { + "gov": { + "$ref": "#/definitions/GovMsg" + } + }, + "additionalProperties": false + } + ] + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Denom": { + "oneOf": [ + { + "type": "object", + "required": [ + "native" + ], + "properties": { + "native": { + "type": "string" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "cw20" + ], + "properties": { + "cw20": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + ] + }, + "DepositInfo": { + "description": "Information about the deposit required to create a proposal.", + "type": "object", + "required": [ + "amount", + "denom", + "refund_failed_proposals" + ], + "properties": { + "amount": { + "description": "The number tokens required for payment.", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "denom": { + "description": "The denom of the deposit payment.", + "allOf": [ + { + "$ref": "#/definitions/Denom" + } + ] + }, + "refund_failed_proposals": { + "description": "Should failed proposals have their deposits refunded?", + "type": "boolean" + } + }, + "additionalProperties": false + }, + "DistributionMsg": { + "description": "The message types of the distribution module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto", + "oneOf": [ + { + "description": "This is translated to a [MsgSetWithdrawAddress](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#L29-L37). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "set_withdraw_address" + ], + "properties": { + "set_withdraw_address": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "description": "The `withdraw_address`", + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [[MsgWithdrawDelegatorReward](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#L42-L50). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "withdraw_delegator_reward" + ], + "properties": { + "withdraw_delegator_reward": { + "type": "object", + "required": [ + "validator" + ], + "properties": { + "validator": { + "description": "The `validator_address`", + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Empty": { + "description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)", + "type": "object" + }, + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "GovMsg": { + "description": "This message type allows the contract interact with the [x/gov] module in order to cast votes.\n\n[x/gov]: https://github.com/cosmos/cosmos-sdk/tree/v0.45.12/x/gov\n\n## Examples\n\nCast a simple vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); use cosmwasm_std::{GovMsg, VoteOption};\n\n#[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::Vote { proposal_id: 4, vote: VoteOption::Yes, })) } ```\n\nCast a weighted vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); # #[cfg(feature = \"cosmwasm_1_2\")] use cosmwasm_std::{Decimal, GovMsg, VoteOption, WeightedVoteOption};\n\n# #[cfg(feature = \"cosmwasm_1_2\")] #[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::VoteWeighted { proposal_id: 4, options: vec![ WeightedVoteOption { option: VoteOption::Yes, weight: Decimal::percent(65), }, WeightedVoteOption { option: VoteOption::Abstain, weight: Decimal::percent(35), }, ], })) } ```", + "oneOf": [ + { + "description": "This maps directly to [MsgVote](https://github.com/cosmos/cosmos-sdk/blob/v0.42.5/proto/cosmos/gov/v1beta1/tx.proto#L46-L56) in the Cosmos SDK with voter set to the contract address.", + "type": "object", + "required": [ + "vote" + ], + "properties": { + "vote": { + "type": "object", + "required": [ + "proposal_id", + "vote" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "vote": { + "description": "The vote option.\n\nThis should be called \"option\" for consistency with Cosmos SDK. Sorry for that. See .", + "allOf": [ + { + "$ref": "#/definitions/VoteOption" + } + ] + } + } + } + }, + "additionalProperties": false + } + ] + }, + "IbcMsg": { + "description": "These are messages in the IBC lifecycle. Only usable by IBC-enabled contracts (contracts that directly speak the IBC protocol via 6 entry points)", + "oneOf": [ + { + "description": "Sends bank tokens owned by the contract to the given address on another chain. The channel must already be established between the ibctransfer module on this chain and a matching module on the remote chain. We cannot select the port_id, this is whatever the local chain has bound the ibctransfer module to.", + "type": "object", + "required": [ + "transfer" + ], + "properties": { + "transfer": { + "type": "object", + "required": [ + "amount", + "channel_id", + "timeout", + "to_address" + ], + "properties": { + "amount": { + "description": "packet data only supports one coin https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/ibc/applications/transfer/v1/transfer.proto#L11-L20", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "channel_id": { + "description": "exisiting channel to send the tokens over", + "type": "string" + }, + "timeout": { + "description": "when packet times out, measured on remote chain", + "allOf": [ + { + "$ref": "#/definitions/IbcTimeout" + } + ] + }, + "to_address": { + "description": "address on the remote chain to receive these tokens", + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Sends an IBC packet with given data over the existing channel. Data should be encoded in a format defined by the channel version, and the module on the other side should know how to parse this.", + "type": "object", + "required": [ + "send_packet" + ], + "properties": { + "send_packet": { + "type": "object", + "required": [ + "channel_id", + "data", + "timeout" + ], + "properties": { + "channel_id": { + "type": "string" + }, + "data": { + "$ref": "#/definitions/Binary" + }, + "timeout": { + "description": "when packet times out, measured on remote chain", + "allOf": [ + { + "$ref": "#/definitions/IbcTimeout" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This will close an existing channel that is owned by this contract. Port is auto-assigned to the contract's IBC port", + "type": "object", + "required": [ + "close_channel" + ], + "properties": { + "close_channel": { + "type": "object", + "required": [ + "channel_id" + ], + "properties": { + "channel_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "IbcTimeout": { + "description": "In IBC each package must set at least one type of timeout: the timestamp or the block height. Using this rather complex enum instead of two timeout fields we ensure that at least one timeout is set.", + "type": "object", + "properties": { + "block": { + "anyOf": [ + { + "$ref": "#/definitions/IbcTimeoutBlock" + }, + { + "type": "null" + } + ] + }, + "timestamp": { + "anyOf": [ + { + "$ref": "#/definitions/Timestamp" + }, + { + "type": "null" + } + ] + } + } + }, + "IbcTimeoutBlock": { + "description": "IBCTimeoutHeight Height is a monotonically increasing data type that can be compared against another Height for the purposes of updating and freezing clients. Ordering is (revision_number, timeout_height)", + "type": "object", + "required": [ + "height", + "revision" + ], + "properties": { + "height": { + "description": "block height after which the packet times out. the height within the given revision", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "revision": { + "description": "the version that the client is currently on (eg. after reseting the chain this could increment 1 as height drops to 0)", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "ProposalResponse_for_Empty": { + "description": "Note, if you are storing custom messages in the proposal, the querier needs to know what possible custom message types those are in order to parse the response", + "type": "object", + "required": [ + "description", + "expires", + "id", + "msgs", + "proposer", + "status", + "threshold", + "title" + ], + "properties": { + "deposit": { + "anyOf": [ + { + "$ref": "#/definitions/DepositInfo" + }, + { + "type": "null" + } + ] + }, + "description": { + "type": "string" + }, + "expires": { + "$ref": "#/definitions/Expiration" + }, + "id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "msgs": { + "type": "array", + "items": { + "$ref": "#/definitions/CosmosMsg_for_Empty" + } + }, + "proposer": { + "$ref": "#/definitions/Addr" + }, + "status": { + "$ref": "#/definitions/Status" + }, + "threshold": { + "description": "This is the threshold that is applied to this proposal. Both the rules of the voting contract, as well as the total_weight of the voting group may have changed since this time. That means that the generic `Threshold{}` query does not provide valid information for existing proposals.", + "allOf": [ + { + "$ref": "#/definitions/ThresholdResponse" + } + ] + }, + "title": { + "type": "string" + } + }, + "additionalProperties": false + }, + "StakingMsg": { + "description": "The message types of the staking module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto", + "oneOf": [ + { + "description": "This is translated to a [MsgDelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L81-L90). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "delegate" + ], + "properties": { + "delegate": { + "type": "object", + "required": [ + "amount", + "validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [MsgUndelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L112-L121). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "undelegate" + ], + "properties": { + "undelegate": { + "type": "object", + "required": [ + "amount", + "validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [MsgBeginRedelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L95-L105). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "redelegate" + ], + "properties": { + "redelegate": { + "type": "object", + "required": [ + "amount", + "dst_validator", + "src_validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "dst_validator": { + "type": "string" + }, + "src_validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Status": { + "oneOf": [ + { + "description": "proposal was created, but voting has not yet begun for whatever reason", + "type": "string", + "enum": [ + "pending" + ] + }, + { + "description": "you can vote on this", + "type": "string", + "enum": [ + "open" + ] + }, + { + "description": "voting is over and it did not pass", + "type": "string", + "enum": [ + "rejected" + ] + }, + { + "description": "voting is over and it did pass, but has not yet executed", + "type": "string", + "enum": [ + "passed" + ] + }, + { + "description": "voting is over it passed, and the proposal was executed", + "type": "string", + "enum": [ + "executed" + ] + } + ] + }, + "ThresholdResponse": { + "description": "This defines the different ways tallies can happen. Every contract should support a subset of these, ideally all.\n\nThe total_weight used for calculating success as well as the weights of each individual voter used in tallying should be snapshotted at the beginning of the block at which the proposal starts (this is likely the responsibility of a correct cw4 implementation).", + "oneOf": [ + { + "description": "Declares that a fixed weight of yes votes is needed to pass. It does not matter how many no votes are cast, or how many do not vote, as long as `weight` yes votes are cast.\n\nThis is the simplest format and usually suitable for small multisigs of trusted parties, like 3 of 5. (weight: 3, total_weight: 5)\n\nA proposal of this type can pass early as soon as the needed weight of yes votes has been cast.", + "type": "object", + "required": [ + "absolute_count" + ], + "properties": { + "absolute_count": { + "type": "object", + "required": [ + "total_weight", + "weight" + ], + "properties": { + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Declares a percentage of the total weight that must cast Yes votes, in order for a proposal to pass. The passing weight is computed over the total weight minus the weight of the abstained votes.\n\nThis is useful for similar circumstances as `AbsoluteCount`, where we have a relatively small set of voters, and participation is required. It is understood that if the voting set (group) changes between different proposals that refer to the same group, each proposal will work with a different set of voter weights (the ones snapshotted at proposal creation), and the passing weight for each proposal will be computed based on the absolute percentage, times the total weights of the members at the time of each proposal creation.\n\nExample: we set `percentage` to 51%. Proposal 1 starts when there is a `total_weight` of 5. This will require 3 weight of Yes votes in order to pass. Later, the Proposal 2 starts but the `total_weight` of the group has increased to 9. That proposal will then automatically require 5 Yes of 9 to pass, rather than 3 yes of 9 as would be the case with `AbsoluteCount`.", + "type": "object", + "required": [ + "absolute_percentage" + ], + "properties": { + "absolute_percentage": { + "type": "object", + "required": [ + "percentage", + "total_weight" + ], + "properties": { + "percentage": { + "$ref": "#/definitions/Decimal" + }, + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "In addition to a `threshold`, declares a `quorum` of the total votes that must participate in the election in order for the vote to be considered at all. Within the votes that were cast, it requires `threshold` votes in favor. That is calculated by ignoring the Abstain votes (they count towards `quorum`, but do not influence `threshold`). That is, we calculate `Yes / (Yes + No + Veto)` and compare it with `threshold` to consider if the proposal was passed.\n\nIt is rather difficult for a proposal of this type to pass early. That can only happen if the required quorum has been already met, and there are already enough Yes votes for the proposal to pass.\n\n30% Yes votes, 10% No votes, and 20% Abstain would pass early if quorum <= 60% (who has cast votes) and if the threshold is <= 37.5% (the remaining 40% voting no => 30% yes + 50% no). Once the voting period has passed with no additional votes, that same proposal would be considered successful if quorum <= 60% and threshold <= 75% (percent in favor if we ignore abstain votes).\n\nThis type is more common in general elections, where participation is often expected to be low, and `AbsolutePercentage` would either be too high to pass anything, or allow low percentages to pass, independently of if there was high participation in the election or not.", + "type": "object", + "required": [ + "threshold_quorum" + ], + "properties": { + "threshold_quorum": { + "type": "object", + "required": [ + "quorum", + "threshold", + "total_weight" + ], + "properties": { + "quorum": { + "$ref": "#/definitions/Decimal" + }, + "threshold": { + "$ref": "#/definitions/Decimal" + }, + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + }, + "VoteOption": { + "type": "string", + "enum": [ + "yes", + "no", + "abstain", + "no_with_veto" + ] + }, + "WasmMsg": { + "description": "The message types of the wasm module.\n\nSee https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto", + "oneOf": [ + { + "description": "Dispatches a call to another contract at a known address (with known ABI).\n\nThis is translated to a [MsgExecuteContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L68-L78). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "execute" + ], + "properties": { + "execute": { + "type": "object", + "required": [ + "contract_addr", + "funds", + "msg" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "funds": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "msg": { + "description": "msg is the json-encoded ExecuteMsg struct (as raw Binary)", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThe contract address is non-predictable. But it is guaranteed that when emitting the same Instantiate message multiple times, multiple instances on different addresses will be generated. See also Instantiate2.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L53-L71). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "instantiate" + ], + "properties": { + "instantiate": { + "type": "object", + "required": [ + "code_id", + "funds", + "label", + "msg" + ], + "properties": { + "admin": { + "type": [ + "string", + "null" + ] + }, + "code_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "funds": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "label": { + "description": "A human-readbale label for the contract", + "type": "string" + }, + "msg": { + "description": "msg is the JSON-encoded InstantiateMsg struct (as raw Binary)", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Migrates a given contracts to use new wasm code. Passes a MigrateMsg to allow us to customize behavior.\n\nOnly the contract admin (as defined in wasmd), if any, is able to make this call.\n\nThis is translated to a [MsgMigrateContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L86-L96). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "migrate" + ], + "properties": { + "migrate": { + "type": "object", + "required": [ + "contract_addr", + "msg", + "new_code_id" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "msg": { + "description": "msg is the json-encoded MigrateMsg struct that will be passed to the new code", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "new_code_id": { + "description": "the code_id of the new logic to place in the given contract", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Sets a new admin (for migrate) on the given contract. Fails if this contract is not currently admin of the target contract.", + "type": "object", + "required": [ + "update_admin" + ], + "properties": { + "update_admin": { + "type": "object", + "required": [ + "admin", + "contract_addr" + ], + "properties": { + "admin": { + "type": "string" + }, + "contract_addr": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Clears the admin on the given contract, so no more migration possible. Fails if this contract is not currently admin of the target contract.", + "type": "object", + "required": [ + "clear_admin" + ], + "properties": { + "clear_admin": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + } + } +} diff --git a/contracts/multisig/cw3-flex-multisig/schema/raw/response_to_threshold.json b/contracts/multisig/cw3-flex-multisig/schema/raw/response_to_threshold.json new file mode 100644 index 0000000000..3c7dae60fe --- /dev/null +++ b/contracts/multisig/cw3-flex-multisig/schema/raw/response_to_threshold.json @@ -0,0 +1,103 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ThresholdResponse", + "description": "This defines the different ways tallies can happen. Every contract should support a subset of these, ideally all.\n\nThe total_weight used for calculating success as well as the weights of each individual voter used in tallying should be snapshotted at the beginning of the block at which the proposal starts (this is likely the responsibility of a correct cw4 implementation).", + "oneOf": [ + { + "description": "Declares that a fixed weight of yes votes is needed to pass. It does not matter how many no votes are cast, or how many do not vote, as long as `weight` yes votes are cast.\n\nThis is the simplest format and usually suitable for small multisigs of trusted parties, like 3 of 5. (weight: 3, total_weight: 5)\n\nA proposal of this type can pass early as soon as the needed weight of yes votes has been cast.", + "type": "object", + "required": [ + "absolute_count" + ], + "properties": { + "absolute_count": { + "type": "object", + "required": [ + "total_weight", + "weight" + ], + "properties": { + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Declares a percentage of the total weight that must cast Yes votes, in order for a proposal to pass. The passing weight is computed over the total weight minus the weight of the abstained votes.\n\nThis is useful for similar circumstances as `AbsoluteCount`, where we have a relatively small set of voters, and participation is required. It is understood that if the voting set (group) changes between different proposals that refer to the same group, each proposal will work with a different set of voter weights (the ones snapshotted at proposal creation), and the passing weight for each proposal will be computed based on the absolute percentage, times the total weights of the members at the time of each proposal creation.\n\nExample: we set `percentage` to 51%. Proposal 1 starts when there is a `total_weight` of 5. This will require 3 weight of Yes votes in order to pass. Later, the Proposal 2 starts but the `total_weight` of the group has increased to 9. That proposal will then automatically require 5 Yes of 9 to pass, rather than 3 yes of 9 as would be the case with `AbsoluteCount`.", + "type": "object", + "required": [ + "absolute_percentage" + ], + "properties": { + "absolute_percentage": { + "type": "object", + "required": [ + "percentage", + "total_weight" + ], + "properties": { + "percentage": { + "$ref": "#/definitions/Decimal" + }, + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "In addition to a `threshold`, declares a `quorum` of the total votes that must participate in the election in order for the vote to be considered at all. Within the votes that were cast, it requires `threshold` votes in favor. That is calculated by ignoring the Abstain votes (they count towards `quorum`, but do not influence `threshold`). That is, we calculate `Yes / (Yes + No + Veto)` and compare it with `threshold` to consider if the proposal was passed.\n\nIt is rather difficult for a proposal of this type to pass early. That can only happen if the required quorum has been already met, and there are already enough Yes votes for the proposal to pass.\n\n30% Yes votes, 10% No votes, and 20% Abstain would pass early if quorum <= 60% (who has cast votes) and if the threshold is <= 37.5% (the remaining 40% voting no => 30% yes + 50% no). Once the voting period has passed with no additional votes, that same proposal would be considered successful if quorum <= 60% and threshold <= 75% (percent in favor if we ignore abstain votes).\n\nThis type is more common in general elections, where participation is often expected to be low, and `AbsolutePercentage` would either be too high to pass anything, or allow low percentages to pass, independently of if there was high participation in the election or not.", + "type": "object", + "required": [ + "threshold_quorum" + ], + "properties": { + "threshold_quorum": { + "type": "object", + "required": [ + "quorum", + "threshold", + "total_weight" + ], + "properties": { + "quorum": { + "$ref": "#/definitions/Decimal" + }, + "threshold": { + "$ref": "#/definitions/Decimal" + }, + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + } + } +} diff --git a/contracts/multisig/cw3-flex-multisig/schema/raw/response_to_vote.json b/contracts/multisig/cw3-flex-multisig/schema/raw/response_to_vote.json new file mode 100644 index 0000000000..ba779b7a0d --- /dev/null +++ b/contracts/multisig/cw3-flex-multisig/schema/raw/response_to_vote.json @@ -0,0 +1,81 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "VoteResponse", + "type": "object", + "properties": { + "vote": { + "anyOf": [ + { + "$ref": "#/definitions/VoteInfo" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Vote": { + "oneOf": [ + { + "description": "Marks support for the proposal.", + "type": "string", + "enum": [ + "yes" + ] + }, + { + "description": "Marks opposition to the proposal.", + "type": "string", + "enum": [ + "no" + ] + }, + { + "description": "Marks participation but does not count towards the ratio of support / opposed", + "type": "string", + "enum": [ + "abstain" + ] + }, + { + "description": "Veto is generally to be treated as a No vote. Some implementations may allow certain voters to be able to Veto, or them to be counted stronger than No in some way.", + "type": "string", + "enum": [ + "veto" + ] + } + ] + }, + "VoteInfo": { + "description": "Returns the vote (opinion as well as weight counted) as well as the address of the voter who submitted it", + "type": "object", + "required": [ + "proposal_id", + "vote", + "voter", + "weight" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "vote": { + "$ref": "#/definitions/Vote" + }, + "voter": { + "type": "string" + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/multisig/cw3-flex-multisig/schema/raw/response_to_voter.json b/contracts/multisig/cw3-flex-multisig/schema/raw/response_to_voter.json new file mode 100644 index 0000000000..125b4e1430 --- /dev/null +++ b/contracts/multisig/cw3-flex-multisig/schema/raw/response_to_voter.json @@ -0,0 +1,16 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "VoterResponse", + "type": "object", + "properties": { + "weight": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false +} diff --git a/contracts/multisig/cw3-flex-multisig/src/bin/schema.rs b/contracts/multisig/cw3-flex-multisig/src/bin/schema.rs new file mode 100644 index 0000000000..869f53b3a6 --- /dev/null +++ b/contracts/multisig/cw3-flex-multisig/src/bin/schema.rs @@ -0,0 +1,14 @@ +// Copyright 2023 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use cosmwasm_schema::write_api; +use nym_multisig_contract_common::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}; + +fn main() { + write_api! { + instantiate: InstantiateMsg, + query: QueryMsg, + execute: ExecuteMsg, + migrate: MigrateMsg, + } +} diff --git a/contracts/multisig/cw4-group/Cargo.toml b/contracts/multisig/cw4-group/Cargo.toml index 180ee66b9d..a2897779b9 100644 --- a/contracts/multisig/cw4-group/Cargo.toml +++ b/contracts/multisig/cw4-group/Cargo.toml @@ -16,6 +16,9 @@ exclude = [ # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[[bin]] +name = "schema" + [lib] crate-type = ["cdylib", "rlib"] @@ -25,6 +28,7 @@ backtraces = ["cosmwasm-std/backtraces"] # use library feature to disable all instantiate/execute/query exports library = [] + [dependencies] nym-group-contract-common = { path = "../../../common/cosmwasm-smart-contracts/group-contract" } @@ -38,3 +42,4 @@ cosmwasm-std = { workspace = true } schemars = "0.8.1" serde = { version = "1.0.103", default-features = false, features = ["derive"] } thiserror = { version = "1.0.23" } + diff --git a/contracts/multisig/cw4-group/Makefile b/contracts/multisig/cw4-group/Makefile new file mode 100644 index 0000000000..f138e2c879 --- /dev/null +++ b/contracts/multisig/cw4-group/Makefile @@ -0,0 +1,2 @@ +generate-schema: + cargo schema \ No newline at end of file diff --git a/contracts/multisig/cw4-group/schema/cw4-group.json b/contracts/multisig/cw4-group/schema/cw4-group.json new file mode 100644 index 0000000000..5e0f5af99b --- /dev/null +++ b/contracts/multisig/cw4-group/schema/cw4-group.json @@ -0,0 +1,395 @@ +{ + "contract_name": "cw4-group", + "contract_version": "1.0.0", + "idl_version": "1.0.0", + "instantiate": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "members" + ], + "properties": { + "admin": { + "description": "The admin is the only account that can update the group state. Omit it to make the group immutable.", + "type": [ + "string", + "null" + ] + }, + "members": { + "type": "array", + "items": { + "$ref": "#/definitions/Member" + } + } + }, + "additionalProperties": false, + "definitions": { + "Member": { + "description": "A group member has a weight associated with them. This may all be equal, or may have meaning in the app that makes use of the group (eg. voting power)", + "type": "object", + "required": [ + "addr", + "weight" + ], + "properties": { + "addr": { + "type": "string" + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } + }, + "execute": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "description": "Change the admin", + "type": "object", + "required": [ + "update_admin" + ], + "properties": { + "update_admin": { + "type": "object", + "properties": { + "admin": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "apply a diff to the existing members. remove is applied after add, so if an address is in both, it is removed", + "type": "object", + "required": [ + "update_members" + ], + "properties": { + "update_members": { + "type": "object", + "required": [ + "add", + "remove" + ], + "properties": { + "add": { + "type": "array", + "items": { + "$ref": "#/definitions/Member" + } + }, + "remove": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Add a new hook to be informed of all membership changes. Must be called by Admin", + "type": "object", + "required": [ + "add_hook" + ], + "properties": { + "add_hook": { + "type": "object", + "required": [ + "addr" + ], + "properties": { + "addr": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Remove a hook. Must be called by Admin", + "type": "object", + "required": [ + "remove_hook" + ], + "properties": { + "remove_hook": { + "type": "object", + "required": [ + "addr" + ], + "properties": { + "addr": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Member": { + "description": "A group member has a weight associated with them. This may all be equal, or may have meaning in the app that makes use of the group (eg. voting power)", + "type": "object", + "required": [ + "addr", + "weight" + ], + "properties": { + "addr": { + "type": "string" + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } + }, + "query": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "admin" + ], + "properties": { + "admin": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "total_weight" + ], + "properties": { + "total_weight": { + "type": "object", + "properties": { + "at_height": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "list_members" + ], + "properties": { + "list_members": { + "type": "object", + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "member" + ], + "properties": { + "member": { + "type": "object", + "required": [ + "addr" + ], + "properties": { + "addr": { + "type": "string" + }, + "at_height": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Shows all registered hooks.", + "type": "object", + "required": [ + "hooks" + ], + "properties": { + "hooks": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "migrate": null, + "sudo": null, + "responses": { + "admin": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "AdminResponse", + "description": "Returned from Admin.query_admin()", + "type": "object", + "properties": { + "admin": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + }, + "hooks": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "HooksResponse", + "type": "object", + "required": [ + "hooks" + ], + "properties": { + "hooks": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "list_members": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MemberListResponse", + "type": "object", + "required": [ + "members" + ], + "properties": { + "members": { + "type": "array", + "items": { + "$ref": "#/definitions/Member" + } + } + }, + "additionalProperties": false, + "definitions": { + "Member": { + "description": "A group member has a weight associated with them. This may all be equal, or may have meaning in the app that makes use of the group (eg. voting power)", + "type": "object", + "required": [ + "addr", + "weight" + ], + "properties": { + "addr": { + "type": "string" + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } + }, + "member": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MemberResponse", + "type": "object", + "properties": { + "weight": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "total_weight": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "TotalWeightResponse", + "type": "object", + "required": [ + "weight" + ], + "properties": { + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/multisig/cw4-group/schema/raw/execute.json b/contracts/multisig/cw4-group/schema/raw/execute.json new file mode 100644 index 0000000000..526169f1bf --- /dev/null +++ b/contracts/multisig/cw4-group/schema/raw/execute.json @@ -0,0 +1,125 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "description": "Change the admin", + "type": "object", + "required": [ + "update_admin" + ], + "properties": { + "update_admin": { + "type": "object", + "properties": { + "admin": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "apply a diff to the existing members. remove is applied after add, so if an address is in both, it is removed", + "type": "object", + "required": [ + "update_members" + ], + "properties": { + "update_members": { + "type": "object", + "required": [ + "add", + "remove" + ], + "properties": { + "add": { + "type": "array", + "items": { + "$ref": "#/definitions/Member" + } + }, + "remove": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Add a new hook to be informed of all membership changes. Must be called by Admin", + "type": "object", + "required": [ + "add_hook" + ], + "properties": { + "add_hook": { + "type": "object", + "required": [ + "addr" + ], + "properties": { + "addr": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Remove a hook. Must be called by Admin", + "type": "object", + "required": [ + "remove_hook" + ], + "properties": { + "remove_hook": { + "type": "object", + "required": [ + "addr" + ], + "properties": { + "addr": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Member": { + "description": "A group member has a weight associated with them. This may all be equal, or may have meaning in the app that makes use of the group (eg. voting power)", + "type": "object", + "required": [ + "addr", + "weight" + ], + "properties": { + "addr": { + "type": "string" + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/multisig/cw4-group/schema/raw/instantiate.json b/contracts/multisig/cw4-group/schema/raw/instantiate.json new file mode 100644 index 0000000000..bba7b445a7 --- /dev/null +++ b/contracts/multisig/cw4-group/schema/raw/instantiate.json @@ -0,0 +1,45 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "members" + ], + "properties": { + "admin": { + "description": "The admin is the only account that can update the group state. Omit it to make the group immutable.", + "type": [ + "string", + "null" + ] + }, + "members": { + "type": "array", + "items": { + "$ref": "#/definitions/Member" + } + } + }, + "additionalProperties": false, + "definitions": { + "Member": { + "description": "A group member has a weight associated with them. This may all be equal, or may have meaning in the app that makes use of the group (eg. voting power)", + "type": "object", + "required": [ + "addr", + "weight" + ], + "properties": { + "addr": { + "type": "string" + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/multisig/cw4-group/schema/raw/query.json b/contracts/multisig/cw4-group/schema/raw/query.json new file mode 100644 index 0000000000..ec6abedb8d --- /dev/null +++ b/contracts/multisig/cw4-group/schema/raw/query.json @@ -0,0 +1,114 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "admin" + ], + "properties": { + "admin": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "total_weight" + ], + "properties": { + "total_weight": { + "type": "object", + "properties": { + "at_height": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "list_members" + ], + "properties": { + "list_members": { + "type": "object", + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "member" + ], + "properties": { + "member": { + "type": "object", + "required": [ + "addr" + ], + "properties": { + "addr": { + "type": "string" + }, + "at_height": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Shows all registered hooks.", + "type": "object", + "required": [ + "hooks" + ], + "properties": { + "hooks": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] +} diff --git a/contracts/multisig/cw4-group/schema/raw/response_to_admin.json b/contracts/multisig/cw4-group/schema/raw/response_to_admin.json new file mode 100644 index 0000000000..c73969ab04 --- /dev/null +++ b/contracts/multisig/cw4-group/schema/raw/response_to_admin.json @@ -0,0 +1,15 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "AdminResponse", + "description": "Returned from Admin.query_admin()", + "type": "object", + "properties": { + "admin": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false +} diff --git a/contracts/multisig/cw4-group/schema/raw/response_to_hooks.json b/contracts/multisig/cw4-group/schema/raw/response_to_hooks.json new file mode 100644 index 0000000000..6d46524400 --- /dev/null +++ b/contracts/multisig/cw4-group/schema/raw/response_to_hooks.json @@ -0,0 +1,17 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "HooksResponse", + "type": "object", + "required": [ + "hooks" + ], + "properties": { + "hooks": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false +} diff --git a/contracts/multisig/cw4-group/schema/raw/response_to_list_members.json b/contracts/multisig/cw4-group/schema/raw/response_to_list_members.json new file mode 100644 index 0000000000..39617c0538 --- /dev/null +++ b/contracts/multisig/cw4-group/schema/raw/response_to_list_members.json @@ -0,0 +1,38 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MemberListResponse", + "type": "object", + "required": [ + "members" + ], + "properties": { + "members": { + "type": "array", + "items": { + "$ref": "#/definitions/Member" + } + } + }, + "additionalProperties": false, + "definitions": { + "Member": { + "description": "A group member has a weight associated with them. This may all be equal, or may have meaning in the app that makes use of the group (eg. voting power)", + "type": "object", + "required": [ + "addr", + "weight" + ], + "properties": { + "addr": { + "type": "string" + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/multisig/cw4-group/schema/raw/response_to_member.json b/contracts/multisig/cw4-group/schema/raw/response_to_member.json new file mode 100644 index 0000000000..0de8fdcfde --- /dev/null +++ b/contracts/multisig/cw4-group/schema/raw/response_to_member.json @@ -0,0 +1,16 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MemberResponse", + "type": "object", + "properties": { + "weight": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false +} diff --git a/contracts/multisig/cw4-group/schema/raw/response_to_total_weight.json b/contracts/multisig/cw4-group/schema/raw/response_to_total_weight.json new file mode 100644 index 0000000000..9b1f597629 --- /dev/null +++ b/contracts/multisig/cw4-group/schema/raw/response_to_total_weight.json @@ -0,0 +1,16 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "TotalWeightResponse", + "type": "object", + "required": [ + "weight" + ], + "properties": { + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false +} diff --git a/contracts/multisig/cw4-group/src/bin/schema.rs b/contracts/multisig/cw4-group/src/bin/schema.rs new file mode 100644 index 0000000000..a46ff6cf2e --- /dev/null +++ b/contracts/multisig/cw4-group/src/bin/schema.rs @@ -0,0 +1,13 @@ +// Copyright 2023 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use cosmwasm_schema::write_api; +use nym_group_contract_common::msg::{ExecuteMsg, InstantiateMsg, QueryMsg}; + +fn main() { + write_api! { + instantiate: InstantiateMsg, + query: QueryMsg, + execute: ExecuteMsg, + } +} diff --git a/contracts/name-service/.cargo/config b/contracts/name-service/.cargo/config new file mode 100644 index 0000000000..2fb2c1afdb --- /dev/null +++ b/contracts/name-service/.cargo/config @@ -0,0 +1,4 @@ +[alias] +wasm = "build --release --lib --target wasm32-unknown-unknown" +unit-test = "test --lib" +schema = "run --bin schema --features=schema-gen" \ No newline at end of file diff --git a/contracts/name-service/Cargo.toml b/contracts/name-service/Cargo.toml index 56fe0145cf..7bbacf8ba1 100644 --- a/contracts/name-service/Cargo.toml +++ b/contracts/name-service/Cargo.toml @@ -3,11 +3,16 @@ name = "nym-name-service" version = "0.1.0" edition = "2021" +[[bin]] +name = "schema" +required-features = ["schema-gen"] + [lib] crate-type = ["cdylib", "rlib"] [dependencies] bs58 = "0.4.0" +cosmwasm-schema = { workspace = true, optional = true } cosmwasm-std = { workspace = true } cw-controllers = { workspace = true } cw-storage-plus = { workspace = true } @@ -29,3 +34,6 @@ nym-crypto = { path = "../../common/crypto", features = ["asymmetric", "rand"] } rand = "0.8.5" rand_chacha = "0.2" rstest = "0.17.0" + +[features] +schema-gen = ["nym-name-service-common/schema", "cosmwasm-schema"] diff --git a/contracts/name-service/Makefile b/contracts/name-service/Makefile new file mode 100644 index 0000000000..f138e2c879 --- /dev/null +++ b/contracts/name-service/Makefile @@ -0,0 +1,2 @@ +generate-schema: + cargo schema \ No newline at end of file diff --git a/contracts/name-service/schema/nym-name-service.json b/contracts/name-service/schema/nym-name-service.json new file mode 100644 index 0000000000..f9da4f3cf8 --- /dev/null +++ b/contracts/name-service/schema/nym-name-service.json @@ -0,0 +1,1242 @@ +{ + "contract_name": "nym-name-service", + "contract_version": "0.1.0", + "idl_version": "1.0.0", + "instantiate": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "deposit_required" + ], + "properties": { + "deposit_required": { + "$ref": "#/definitions/Coin" + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "execute": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "description": "Announcing a name pointing to a nym-address", + "type": "object", + "required": [ + "register" + ], + "properties": { + "register": { + "type": "object", + "required": [ + "name", + "owner_signature" + ], + "properties": { + "name": { + "$ref": "#/definitions/NameDetails" + }, + "owner_signature": { + "$ref": "#/definitions/MessageSignature" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Delete a name entry by id", + "type": "object", + "required": [ + "delete_id" + ], + "properties": { + "delete_id": { + "type": "object", + "required": [ + "name_id" + ], + "properties": { + "name_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Delete a name entry by name", + "type": "object", + "required": [ + "delete_name" + ], + "properties": { + "delete_name": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "$ref": "#/definitions/NymName" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Change the deposit required for announcing a name", + "type": "object", + "required": [ + "update_deposit_required" + ], + "properties": { + "update_deposit_required": { + "type": "object", + "required": [ + "deposit_required" + ], + "properties": { + "deposit_required": { + "$ref": "#/definitions/Coin" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Address": { + "description": "String representation of a nym address, which is of the form client_id.client_enc@gateway_id. NOTE: entirely unvalidated.", + "oneOf": [ + { + "type": "object", + "required": [ + "nym_address" + ], + "properties": { + "nym_address": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "MessageSignature": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + }, + "NameDetails": { + "type": "object", + "required": [ + "address", + "identity_key", + "name" + ], + "properties": { + "address": { + "description": "The address of the name alias.", + "allOf": [ + { + "$ref": "#/definitions/Address" + } + ] + }, + "identity_key": { + "description": "The identity key of the registered name.", + "type": "string" + }, + "name": { + "description": "The name pointing to the nym address", + "allOf": [ + { + "$ref": "#/definitions/NymName" + } + ] + } + }, + "additionalProperties": false + }, + "NymName": { + "description": "Name stored and pointing a to a nym-address", + "type": "string" + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "query": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "description": "Query the name by it's assigned id", + "type": "object", + "required": [ + "name_id" + ], + "properties": { + "name_id": { + "type": "object", + "required": [ + "name_id" + ], + "properties": { + "name_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Query the names by the registrator", + "type": "object", + "required": [ + "by_owner" + ], + "properties": { + "by_owner": { + "type": "object", + "required": [ + "owner" + ], + "properties": { + "owner": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "by_name" + ], + "properties": { + "by_name": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "$ref": "#/definitions/NymName" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "by_address" + ], + "properties": { + "by_address": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "$ref": "#/definitions/Address" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "all" + ], + "properties": { + "all": { + "type": "object", + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "signing_nonce" + ], + "properties": { + "signing_nonce": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "config" + ], + "properties": { + "config": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets build information of this contract, such as the commit hash used for the build or rustc version.", + "type": "object", + "required": [ + "get_contract_version" + ], + "properties": { + "get_contract_version": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the stored contract version information that's required by the CW2 spec interface for migrations.", + "type": "object", + "required": [ + "get_cw2_contract_version" + ], + "properties": { + "get_cw2_contract_version": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Address": { + "description": "String representation of a nym address, which is of the form client_id.client_enc@gateway_id. NOTE: entirely unvalidated.", + "oneOf": [ + { + "type": "object", + "required": [ + "nym_address" + ], + "properties": { + "nym_address": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "NymName": { + "description": "Name stored and pointing a to a nym-address", + "type": "string" + } + } + }, + "migrate": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MigrateMsg", + "type": "object", + "additionalProperties": false + }, + "sudo": null, + "responses": { + "all": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedNamesListResponse", + "type": "object", + "required": [ + "names", + "per_page" + ], + "properties": { + "names": { + "type": "array", + "items": { + "$ref": "#/definitions/RegisteredName" + } + }, + "per_page": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Address": { + "description": "String representation of a nym address, which is of the form client_id.client_enc@gateway_id. NOTE: entirely unvalidated.", + "oneOf": [ + { + "type": "object", + "required": [ + "nym_address" + ], + "properties": { + "nym_address": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "NameDetails": { + "type": "object", + "required": [ + "address", + "identity_key", + "name" + ], + "properties": { + "address": { + "description": "The address of the name alias.", + "allOf": [ + { + "$ref": "#/definitions/Address" + } + ] + }, + "identity_key": { + "description": "The identity key of the registered name.", + "type": "string" + }, + "name": { + "description": "The name pointing to the nym address", + "allOf": [ + { + "$ref": "#/definitions/NymName" + } + ] + } + }, + "additionalProperties": false + }, + "NymName": { + "description": "Name stored and pointing a to a nym-address", + "type": "string" + }, + "RegisteredName": { + "type": "object", + "required": [ + "block_height", + "deposit", + "id", + "name", + "owner" + ], + "properties": { + "block_height": { + "description": "Block height at which the name was added.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "deposit": { + "description": "The deposit used to announce the name.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "id": { + "description": "Unique id assigned to the registerd name.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "name": { + "description": "The registerd name details.", + "allOf": [ + { + "$ref": "#/definitions/NameDetails" + } + ] + }, + "owner": { + "description": "name owner.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + } + }, + "additionalProperties": false + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "by_address": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "NamesListResponse", + "type": "object", + "required": [ + "names" + ], + "properties": { + "names": { + "type": "array", + "items": { + "$ref": "#/definitions/RegisteredName" + } + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Address": { + "description": "String representation of a nym address, which is of the form client_id.client_enc@gateway_id. NOTE: entirely unvalidated.", + "oneOf": [ + { + "type": "object", + "required": [ + "nym_address" + ], + "properties": { + "nym_address": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "NameDetails": { + "type": "object", + "required": [ + "address", + "identity_key", + "name" + ], + "properties": { + "address": { + "description": "The address of the name alias.", + "allOf": [ + { + "$ref": "#/definitions/Address" + } + ] + }, + "identity_key": { + "description": "The identity key of the registered name.", + "type": "string" + }, + "name": { + "description": "The name pointing to the nym address", + "allOf": [ + { + "$ref": "#/definitions/NymName" + } + ] + } + }, + "additionalProperties": false + }, + "NymName": { + "description": "Name stored and pointing a to a nym-address", + "type": "string" + }, + "RegisteredName": { + "type": "object", + "required": [ + "block_height", + "deposit", + "id", + "name", + "owner" + ], + "properties": { + "block_height": { + "description": "Block height at which the name was added.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "deposit": { + "description": "The deposit used to announce the name.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "id": { + "description": "Unique id assigned to the registerd name.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "name": { + "description": "The registerd name details.", + "allOf": [ + { + "$ref": "#/definitions/NameDetails" + } + ] + }, + "owner": { + "description": "name owner.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + } + }, + "additionalProperties": false + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "by_name": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "RegisteredName", + "type": "object", + "required": [ + "block_height", + "deposit", + "id", + "name", + "owner" + ], + "properties": { + "block_height": { + "description": "Block height at which the name was added.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "deposit": { + "description": "The deposit used to announce the name.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "id": { + "description": "Unique id assigned to the registerd name.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "name": { + "description": "The registerd name details.", + "allOf": [ + { + "$ref": "#/definitions/NameDetails" + } + ] + }, + "owner": { + "description": "name owner.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Address": { + "description": "String representation of a nym address, which is of the form client_id.client_enc@gateway_id. NOTE: entirely unvalidated.", + "oneOf": [ + { + "type": "object", + "required": [ + "nym_address" + ], + "properties": { + "nym_address": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "NameDetails": { + "type": "object", + "required": [ + "address", + "identity_key", + "name" + ], + "properties": { + "address": { + "description": "The address of the name alias.", + "allOf": [ + { + "$ref": "#/definitions/Address" + } + ] + }, + "identity_key": { + "description": "The identity key of the registered name.", + "type": "string" + }, + "name": { + "description": "The name pointing to the nym address", + "allOf": [ + { + "$ref": "#/definitions/NymName" + } + ] + } + }, + "additionalProperties": false + }, + "NymName": { + "description": "Name stored and pointing a to a nym-address", + "type": "string" + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "by_owner": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "NamesListResponse", + "type": "object", + "required": [ + "names" + ], + "properties": { + "names": { + "type": "array", + "items": { + "$ref": "#/definitions/RegisteredName" + } + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Address": { + "description": "String representation of a nym address, which is of the form client_id.client_enc@gateway_id. NOTE: entirely unvalidated.", + "oneOf": [ + { + "type": "object", + "required": [ + "nym_address" + ], + "properties": { + "nym_address": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "NameDetails": { + "type": "object", + "required": [ + "address", + "identity_key", + "name" + ], + "properties": { + "address": { + "description": "The address of the name alias.", + "allOf": [ + { + "$ref": "#/definitions/Address" + } + ] + }, + "identity_key": { + "description": "The identity key of the registered name.", + "type": "string" + }, + "name": { + "description": "The name pointing to the nym address", + "allOf": [ + { + "$ref": "#/definitions/NymName" + } + ] + } + }, + "additionalProperties": false + }, + "NymName": { + "description": "Name stored and pointing a to a nym-address", + "type": "string" + }, + "RegisteredName": { + "type": "object", + "required": [ + "block_height", + "deposit", + "id", + "name", + "owner" + ], + "properties": { + "block_height": { + "description": "Block height at which the name was added.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "deposit": { + "description": "The deposit used to announce the name.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "id": { + "description": "Unique id assigned to the registerd name.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "name": { + "description": "The registerd name details.", + "allOf": [ + { + "$ref": "#/definitions/NameDetails" + } + ] + }, + "owner": { + "description": "name owner.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + } + }, + "additionalProperties": false + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "config": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ConfigResponse", + "type": "object", + "required": [ + "deposit_required" + ], + "properties": { + "deposit_required": { + "$ref": "#/definitions/Coin" + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_c_w2_contract_version": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ContractVersion", + "type": "object", + "required": [ + "contract", + "version" + ], + "properties": { + "contract": { + "description": "contract is the crate name of the implementing contract, eg. `crate:cw20-base` we will use other prefixes for other languages, and their standard global namespacing", + "type": "string" + }, + "version": { + "description": "version is any string that this implementation knows. It may be simple counter \"1\", \"2\". or semantic version on release tags \"v0.7.0\", or some custom feature flag list. the only code that needs to understand the version parsing is code that knows how to migrate from the given contract (and is tied to it's implementation somehow)", + "type": "string" + } + }, + "additionalProperties": false + }, + "get_contract_version": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ContractBuildInformation", + "type": "object", + "required": [ + "build_timestamp", + "build_version", + "commit_branch", + "commit_sha", + "commit_timestamp", + "rustc_version" + ], + "properties": { + "build_timestamp": { + "description": "Provides the build timestamp, for example `2021-02-23T20:14:46.558472672+00:00`.", + "type": "string" + }, + "build_version": { + "description": "Provides the build version, for example `0.1.0-9-g46f83e1`.", + "type": "string" + }, + "commit_branch": { + "description": "Provides the name of the git branch that was used for the build, for example `master`.", + "type": "string" + }, + "commit_sha": { + "description": "Provides the hash of the commit that was used for the build, for example `46f83e112520533338245862d366f6a02cef07d4`.", + "type": "string" + }, + "commit_timestamp": { + "description": "Provides the timestamp of the commit that was used for the build, for example `2021-02-23T08:08:02-05:00`.", + "type": "string" + }, + "rustc_version": { + "description": "Provides the rustc version that was used for the build, for example `1.52.0-nightly`.", + "type": "string" + } + }, + "additionalProperties": false + }, + "name_id": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "RegisteredName", + "type": "object", + "required": [ + "block_height", + "deposit", + "id", + "name", + "owner" + ], + "properties": { + "block_height": { + "description": "Block height at which the name was added.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "deposit": { + "description": "The deposit used to announce the name.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "id": { + "description": "Unique id assigned to the registerd name.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "name": { + "description": "The registerd name details.", + "allOf": [ + { + "$ref": "#/definitions/NameDetails" + } + ] + }, + "owner": { + "description": "name owner.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Address": { + "description": "String representation of a nym address, which is of the form client_id.client_enc@gateway_id. NOTE: entirely unvalidated.", + "oneOf": [ + { + "type": "object", + "required": [ + "nym_address" + ], + "properties": { + "nym_address": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "NameDetails": { + "type": "object", + "required": [ + "address", + "identity_key", + "name" + ], + "properties": { + "address": { + "description": "The address of the name alias.", + "allOf": [ + { + "$ref": "#/definitions/Address" + } + ] + }, + "identity_key": { + "description": "The identity key of the registered name.", + "type": "string" + }, + "name": { + "description": "The name pointing to the nym address", + "allOf": [ + { + "$ref": "#/definitions/NymName" + } + ] + } + }, + "additionalProperties": false + }, + "NymName": { + "description": "Name stored and pointing a to a nym-address", + "type": "string" + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "signing_nonce": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "uint32", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } +} diff --git a/contracts/name-service/schema/raw/execute.json b/contracts/name-service/schema/raw/execute.json new file mode 100644 index 0000000000..c902157b43 --- /dev/null +++ b/contracts/name-service/schema/raw/execute.json @@ -0,0 +1,181 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "description": "Announcing a name pointing to a nym-address", + "type": "object", + "required": [ + "register" + ], + "properties": { + "register": { + "type": "object", + "required": [ + "name", + "owner_signature" + ], + "properties": { + "name": { + "$ref": "#/definitions/NameDetails" + }, + "owner_signature": { + "$ref": "#/definitions/MessageSignature" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Delete a name entry by id", + "type": "object", + "required": [ + "delete_id" + ], + "properties": { + "delete_id": { + "type": "object", + "required": [ + "name_id" + ], + "properties": { + "name_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Delete a name entry by name", + "type": "object", + "required": [ + "delete_name" + ], + "properties": { + "delete_name": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "$ref": "#/definitions/NymName" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Change the deposit required for announcing a name", + "type": "object", + "required": [ + "update_deposit_required" + ], + "properties": { + "update_deposit_required": { + "type": "object", + "required": [ + "deposit_required" + ], + "properties": { + "deposit_required": { + "$ref": "#/definitions/Coin" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Address": { + "description": "String representation of a nym address, which is of the form client_id.client_enc@gateway_id. NOTE: entirely unvalidated.", + "oneOf": [ + { + "type": "object", + "required": [ + "nym_address" + ], + "properties": { + "nym_address": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "MessageSignature": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + }, + "NameDetails": { + "type": "object", + "required": [ + "address", + "identity_key", + "name" + ], + "properties": { + "address": { + "description": "The address of the name alias.", + "allOf": [ + { + "$ref": "#/definitions/Address" + } + ] + }, + "identity_key": { + "description": "The identity key of the registered name.", + "type": "string" + }, + "name": { + "description": "The name pointing to the nym address", + "allOf": [ + { + "$ref": "#/definitions/NymName" + } + ] + } + }, + "additionalProperties": false + }, + "NymName": { + "description": "Name stored and pointing a to a nym-address", + "type": "string" + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/name-service/schema/raw/instantiate.json b/contracts/name-service/schema/raw/instantiate.json new file mode 100644 index 0000000000..73867fda63 --- /dev/null +++ b/contracts/name-service/schema/raw/instantiate.json @@ -0,0 +1,35 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "deposit_required" + ], + "properties": { + "deposit_required": { + "$ref": "#/definitions/Coin" + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/name-service/schema/raw/migrate.json b/contracts/name-service/schema/raw/migrate.json new file mode 100644 index 0000000000..7fbe8c5708 --- /dev/null +++ b/contracts/name-service/schema/raw/migrate.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MigrateMsg", + "type": "object", + "additionalProperties": false +} diff --git a/contracts/name-service/schema/raw/query.json b/contracts/name-service/schema/raw/query.json new file mode 100644 index 0000000000..1c4efca8df --- /dev/null +++ b/contracts/name-service/schema/raw/query.json @@ -0,0 +1,210 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "description": "Query the name by it's assigned id", + "type": "object", + "required": [ + "name_id" + ], + "properties": { + "name_id": { + "type": "object", + "required": [ + "name_id" + ], + "properties": { + "name_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Query the names by the registrator", + "type": "object", + "required": [ + "by_owner" + ], + "properties": { + "by_owner": { + "type": "object", + "required": [ + "owner" + ], + "properties": { + "owner": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "by_name" + ], + "properties": { + "by_name": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "$ref": "#/definitions/NymName" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "by_address" + ], + "properties": { + "by_address": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "$ref": "#/definitions/Address" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "all" + ], + "properties": { + "all": { + "type": "object", + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "signing_nonce" + ], + "properties": { + "signing_nonce": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "config" + ], + "properties": { + "config": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets build information of this contract, such as the commit hash used for the build or rustc version.", + "type": "object", + "required": [ + "get_contract_version" + ], + "properties": { + "get_contract_version": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the stored contract version information that's required by the CW2 spec interface for migrations.", + "type": "object", + "required": [ + "get_cw2_contract_version" + ], + "properties": { + "get_cw2_contract_version": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Address": { + "description": "String representation of a nym address, which is of the form client_id.client_enc@gateway_id. NOTE: entirely unvalidated.", + "oneOf": [ + { + "type": "object", + "required": [ + "nym_address" + ], + "properties": { + "nym_address": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "NymName": { + "description": "Name stored and pointing a to a nym-address", + "type": "string" + } + } +} diff --git a/contracts/name-service/schema/raw/response_to_all.json b/contracts/name-service/schema/raw/response_to_all.json new file mode 100644 index 0000000000..5d4ab85d35 --- /dev/null +++ b/contracts/name-service/schema/raw/response_to_all.json @@ -0,0 +1,158 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedNamesListResponse", + "type": "object", + "required": [ + "names", + "per_page" + ], + "properties": { + "names": { + "type": "array", + "items": { + "$ref": "#/definitions/RegisteredName" + } + }, + "per_page": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Address": { + "description": "String representation of a nym address, which is of the form client_id.client_enc@gateway_id. NOTE: entirely unvalidated.", + "oneOf": [ + { + "type": "object", + "required": [ + "nym_address" + ], + "properties": { + "nym_address": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "NameDetails": { + "type": "object", + "required": [ + "address", + "identity_key", + "name" + ], + "properties": { + "address": { + "description": "The address of the name alias.", + "allOf": [ + { + "$ref": "#/definitions/Address" + } + ] + }, + "identity_key": { + "description": "The identity key of the registered name.", + "type": "string" + }, + "name": { + "description": "The name pointing to the nym address", + "allOf": [ + { + "$ref": "#/definitions/NymName" + } + ] + } + }, + "additionalProperties": false + }, + "NymName": { + "description": "Name stored and pointing a to a nym-address", + "type": "string" + }, + "RegisteredName": { + "type": "object", + "required": [ + "block_height", + "deposit", + "id", + "name", + "owner" + ], + "properties": { + "block_height": { + "description": "Block height at which the name was added.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "deposit": { + "description": "The deposit used to announce the name.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "id": { + "description": "Unique id assigned to the registerd name.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "name": { + "description": "The registerd name details.", + "allOf": [ + { + "$ref": "#/definitions/NameDetails" + } + ] + }, + "owner": { + "description": "name owner.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + } + }, + "additionalProperties": false + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/name-service/schema/raw/response_to_by_address.json b/contracts/name-service/schema/raw/response_to_by_address.json new file mode 100644 index 0000000000..0e44754b87 --- /dev/null +++ b/contracts/name-service/schema/raw/response_to_by_address.json @@ -0,0 +1,143 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "NamesListResponse", + "type": "object", + "required": [ + "names" + ], + "properties": { + "names": { + "type": "array", + "items": { + "$ref": "#/definitions/RegisteredName" + } + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Address": { + "description": "String representation of a nym address, which is of the form client_id.client_enc@gateway_id. NOTE: entirely unvalidated.", + "oneOf": [ + { + "type": "object", + "required": [ + "nym_address" + ], + "properties": { + "nym_address": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "NameDetails": { + "type": "object", + "required": [ + "address", + "identity_key", + "name" + ], + "properties": { + "address": { + "description": "The address of the name alias.", + "allOf": [ + { + "$ref": "#/definitions/Address" + } + ] + }, + "identity_key": { + "description": "The identity key of the registered name.", + "type": "string" + }, + "name": { + "description": "The name pointing to the nym address", + "allOf": [ + { + "$ref": "#/definitions/NymName" + } + ] + } + }, + "additionalProperties": false + }, + "NymName": { + "description": "Name stored and pointing a to a nym-address", + "type": "string" + }, + "RegisteredName": { + "type": "object", + "required": [ + "block_height", + "deposit", + "id", + "name", + "owner" + ], + "properties": { + "block_height": { + "description": "Block height at which the name was added.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "deposit": { + "description": "The deposit used to announce the name.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "id": { + "description": "Unique id assigned to the registerd name.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "name": { + "description": "The registerd name details.", + "allOf": [ + { + "$ref": "#/definitions/NameDetails" + } + ] + }, + "owner": { + "description": "name owner.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + } + }, + "additionalProperties": false + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/name-service/schema/raw/response_to_by_name.json b/contracts/name-service/schema/raw/response_to_by_name.json new file mode 100644 index 0000000000..4dfc8752ee --- /dev/null +++ b/contracts/name-service/schema/raw/response_to_by_name.json @@ -0,0 +1,128 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "RegisteredName", + "type": "object", + "required": [ + "block_height", + "deposit", + "id", + "name", + "owner" + ], + "properties": { + "block_height": { + "description": "Block height at which the name was added.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "deposit": { + "description": "The deposit used to announce the name.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "id": { + "description": "Unique id assigned to the registerd name.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "name": { + "description": "The registerd name details.", + "allOf": [ + { + "$ref": "#/definitions/NameDetails" + } + ] + }, + "owner": { + "description": "name owner.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Address": { + "description": "String representation of a nym address, which is of the form client_id.client_enc@gateway_id. NOTE: entirely unvalidated.", + "oneOf": [ + { + "type": "object", + "required": [ + "nym_address" + ], + "properties": { + "nym_address": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "NameDetails": { + "type": "object", + "required": [ + "address", + "identity_key", + "name" + ], + "properties": { + "address": { + "description": "The address of the name alias.", + "allOf": [ + { + "$ref": "#/definitions/Address" + } + ] + }, + "identity_key": { + "description": "The identity key of the registered name.", + "type": "string" + }, + "name": { + "description": "The name pointing to the nym address", + "allOf": [ + { + "$ref": "#/definitions/NymName" + } + ] + } + }, + "additionalProperties": false + }, + "NymName": { + "description": "Name stored and pointing a to a nym-address", + "type": "string" + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/name-service/schema/raw/response_to_by_owner.json b/contracts/name-service/schema/raw/response_to_by_owner.json new file mode 100644 index 0000000000..0e44754b87 --- /dev/null +++ b/contracts/name-service/schema/raw/response_to_by_owner.json @@ -0,0 +1,143 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "NamesListResponse", + "type": "object", + "required": [ + "names" + ], + "properties": { + "names": { + "type": "array", + "items": { + "$ref": "#/definitions/RegisteredName" + } + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Address": { + "description": "String representation of a nym address, which is of the form client_id.client_enc@gateway_id. NOTE: entirely unvalidated.", + "oneOf": [ + { + "type": "object", + "required": [ + "nym_address" + ], + "properties": { + "nym_address": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "NameDetails": { + "type": "object", + "required": [ + "address", + "identity_key", + "name" + ], + "properties": { + "address": { + "description": "The address of the name alias.", + "allOf": [ + { + "$ref": "#/definitions/Address" + } + ] + }, + "identity_key": { + "description": "The identity key of the registered name.", + "type": "string" + }, + "name": { + "description": "The name pointing to the nym address", + "allOf": [ + { + "$ref": "#/definitions/NymName" + } + ] + } + }, + "additionalProperties": false + }, + "NymName": { + "description": "Name stored and pointing a to a nym-address", + "type": "string" + }, + "RegisteredName": { + "type": "object", + "required": [ + "block_height", + "deposit", + "id", + "name", + "owner" + ], + "properties": { + "block_height": { + "description": "Block height at which the name was added.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "deposit": { + "description": "The deposit used to announce the name.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "id": { + "description": "Unique id assigned to the registerd name.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "name": { + "description": "The registerd name details.", + "allOf": [ + { + "$ref": "#/definitions/NameDetails" + } + ] + }, + "owner": { + "description": "name owner.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + } + }, + "additionalProperties": false + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/name-service/schema/raw/response_to_config.json b/contracts/name-service/schema/raw/response_to_config.json new file mode 100644 index 0000000000..16420c1130 --- /dev/null +++ b/contracts/name-service/schema/raw/response_to_config.json @@ -0,0 +1,35 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ConfigResponse", + "type": "object", + "required": [ + "deposit_required" + ], + "properties": { + "deposit_required": { + "$ref": "#/definitions/Coin" + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/name-service/schema/raw/response_to_get_c_w2_contract_version.json b/contracts/name-service/schema/raw/response_to_get_c_w2_contract_version.json new file mode 100644 index 0000000000..3ded8c84d9 --- /dev/null +++ b/contracts/name-service/schema/raw/response_to_get_c_w2_contract_version.json @@ -0,0 +1,20 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ContractVersion", + "type": "object", + "required": [ + "contract", + "version" + ], + "properties": { + "contract": { + "description": "contract is the crate name of the implementing contract, eg. `crate:cw20-base` we will use other prefixes for other languages, and their standard global namespacing", + "type": "string" + }, + "version": { + "description": "version is any string that this implementation knows. It may be simple counter \"1\", \"2\". or semantic version on release tags \"v0.7.0\", or some custom feature flag list. the only code that needs to understand the version parsing is code that knows how to migrate from the given contract (and is tied to it's implementation somehow)", + "type": "string" + } + }, + "additionalProperties": false +} diff --git a/contracts/name-service/schema/raw/response_to_get_contract_version.json b/contracts/name-service/schema/raw/response_to_get_contract_version.json new file mode 100644 index 0000000000..60ae65f3d1 --- /dev/null +++ b/contracts/name-service/schema/raw/response_to_get_contract_version.json @@ -0,0 +1,40 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ContractBuildInformation", + "type": "object", + "required": [ + "build_timestamp", + "build_version", + "commit_branch", + "commit_sha", + "commit_timestamp", + "rustc_version" + ], + "properties": { + "build_timestamp": { + "description": "Provides the build timestamp, for example `2021-02-23T20:14:46.558472672+00:00`.", + "type": "string" + }, + "build_version": { + "description": "Provides the build version, for example `0.1.0-9-g46f83e1`.", + "type": "string" + }, + "commit_branch": { + "description": "Provides the name of the git branch that was used for the build, for example `master`.", + "type": "string" + }, + "commit_sha": { + "description": "Provides the hash of the commit that was used for the build, for example `46f83e112520533338245862d366f6a02cef07d4`.", + "type": "string" + }, + "commit_timestamp": { + "description": "Provides the timestamp of the commit that was used for the build, for example `2021-02-23T08:08:02-05:00`.", + "type": "string" + }, + "rustc_version": { + "description": "Provides the rustc version that was used for the build, for example `1.52.0-nightly`.", + "type": "string" + } + }, + "additionalProperties": false +} diff --git a/contracts/name-service/schema/raw/response_to_name_id.json b/contracts/name-service/schema/raw/response_to_name_id.json new file mode 100644 index 0000000000..4dfc8752ee --- /dev/null +++ b/contracts/name-service/schema/raw/response_to_name_id.json @@ -0,0 +1,128 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "RegisteredName", + "type": "object", + "required": [ + "block_height", + "deposit", + "id", + "name", + "owner" + ], + "properties": { + "block_height": { + "description": "Block height at which the name was added.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "deposit": { + "description": "The deposit used to announce the name.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "id": { + "description": "Unique id assigned to the registerd name.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "name": { + "description": "The registerd name details.", + "allOf": [ + { + "$ref": "#/definitions/NameDetails" + } + ] + }, + "owner": { + "description": "name owner.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Address": { + "description": "String representation of a nym address, which is of the form client_id.client_enc@gateway_id. NOTE: entirely unvalidated.", + "oneOf": [ + { + "type": "object", + "required": [ + "nym_address" + ], + "properties": { + "nym_address": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "NameDetails": { + "type": "object", + "required": [ + "address", + "identity_key", + "name" + ], + "properties": { + "address": { + "description": "The address of the name alias.", + "allOf": [ + { + "$ref": "#/definitions/Address" + } + ] + }, + "identity_key": { + "description": "The identity key of the registered name.", + "type": "string" + }, + "name": { + "description": "The name pointing to the nym address", + "allOf": [ + { + "$ref": "#/definitions/NymName" + } + ] + } + }, + "additionalProperties": false + }, + "NymName": { + "description": "Name stored and pointing a to a nym-address", + "type": "string" + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/name-service/schema/raw/response_to_signing_nonce.json b/contracts/name-service/schema/raw/response_to_signing_nonce.json new file mode 100644 index 0000000000..de85c3e56e --- /dev/null +++ b/contracts/name-service/schema/raw/response_to_signing_nonce.json @@ -0,0 +1,7 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "uint32", + "type": "integer", + "format": "uint32", + "minimum": 0.0 +} diff --git a/contracts/name-service/src/bin/schema.rs b/contracts/name-service/src/bin/schema.rs new file mode 100644 index 0000000000..92f8f3f6ab --- /dev/null +++ b/contracts/name-service/src/bin/schema.rs @@ -0,0 +1,14 @@ +// Copyright 2023 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use cosmwasm_schema::write_api; +use nym_name_service_common::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}; + +fn main() { + write_api! { + instantiate: InstantiateMsg, + query: QueryMsg, + execute: ExecuteMsg, + migrate: MigrateMsg, + } +} diff --git a/contracts/name-service/src/state/names.rs b/contracts/name-service/src/state/names.rs index 3b2b02f82d..41c68bf714 100644 --- a/contracts/name-service/src/state/names.rs +++ b/contracts/name-service/src/state/names.rs @@ -120,6 +120,8 @@ pub fn load_owner(store: &dyn Storage, owner: Addr) -> Result, pub limit: usize, + + /// Field indicating paging information for the following queries if the caller wishes to get further entries. pub start_next_after: Option, } diff --git a/contracts/service-provider-directory/.cargo/config b/contracts/service-provider-directory/.cargo/config index 4fa7f37d4a..2f698e22b3 100644 --- a/contracts/service-provider-directory/.cargo/config +++ b/contracts/service-provider-directory/.cargo/config @@ -2,4 +2,4 @@ wasm = "build --release --lib --target wasm32-unknown-unknown" wasm-debug = "build --target wasm32-unknown-unknown" unit-test = "test --lib" -schema = "run --bin schema" +schema = "run --bin schema --features=schema-gen" \ No newline at end of file diff --git a/contracts/service-provider-directory/Cargo.toml b/contracts/service-provider-directory/Cargo.toml index cadc17d708..39ffcaf6f7 100644 --- a/contracts/service-provider-directory/Cargo.toml +++ b/contracts/service-provider-directory/Cargo.toml @@ -3,11 +3,16 @@ name = "nym-service-provider-directory" version = "0.1.0" edition = "2021" +[[bin]] +name = "schema" +required-features = ["schema-gen"] + [lib] crate-type = ["cdylib", "rlib"] [dependencies] bs58 = "0.4.0" +cosmwasm-schema = { workspace = true, optional = true } cosmwasm-std = { workspace = true } cw-controllers = { workspace = true } cw-storage-plus = { workspace = true } @@ -28,3 +33,6 @@ cw-multi-test = { workspace = true } nym-crypto = { path = "../../common/crypto", features = ["asymmetric", "rand"] } rand_chacha = "0.2" rstest = "0.17.0" + +[features] +schema-gen = ["nym-service-provider-directory-common/schema", "cosmwasm-schema"] diff --git a/contracts/service-provider-directory/Makefile b/contracts/service-provider-directory/Makefile new file mode 100644 index 0000000000..f138e2c879 --- /dev/null +++ b/contracts/service-provider-directory/Makefile @@ -0,0 +1,2 @@ +generate-schema: + cargo schema \ No newline at end of file diff --git a/contracts/service-provider-directory/schema/nym-service-provider-directory.json b/contracts/service-provider-directory/schema/nym-service-provider-directory.json new file mode 100644 index 0000000000..d923ef3f99 --- /dev/null +++ b/contracts/service-provider-directory/schema/nym-service-provider-directory.json @@ -0,0 +1,1104 @@ +{ + "contract_name": "nym-service-provider-directory", + "contract_version": "0.1.0", + "idl_version": "1.0.0", + "instantiate": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "deposit_required" + ], + "properties": { + "deposit_required": { + "$ref": "#/definitions/Coin" + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "execute": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "announce" + ], + "properties": { + "announce": { + "type": "object", + "required": [ + "owner_signature", + "service" + ], + "properties": { + "owner_signature": { + "$ref": "#/definitions/MessageSignature" + }, + "service": { + "$ref": "#/definitions/ServiceDetails" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "delete_id" + ], + "properties": { + "delete_id": { + "type": "object", + "required": [ + "service_id" + ], + "properties": { + "service_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "delete_nym_address" + ], + "properties": { + "delete_nym_address": { + "type": "object", + "required": [ + "nym_address" + ], + "properties": { + "nym_address": { + "$ref": "#/definitions/NymAddress" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_deposit_required" + ], + "properties": { + "update_deposit_required": { + "type": "object", + "required": [ + "deposit_required" + ], + "properties": { + "deposit_required": { + "$ref": "#/definitions/Coin" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "MessageSignature": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + }, + "NymAddress": { + "description": "The types of addresses supported.", + "oneOf": [ + { + "description": "String representation of a nym address, which is of the form client_id.client_enc@gateway_id.", + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "ServiceDetails": { + "type": "object", + "required": [ + "identity_key", + "nym_address", + "service_type" + ], + "properties": { + "identity_key": { + "description": "The identity key of the service.", + "type": "string" + }, + "nym_address": { + "description": "The address of the service.", + "allOf": [ + { + "$ref": "#/definitions/NymAddress" + } + ] + }, + "service_type": { + "description": "The service type.", + "allOf": [ + { + "$ref": "#/definitions/ServiceType" + } + ] + } + }, + "additionalProperties": false + }, + "ServiceType": { + "description": "The type of services provider supported", + "type": "string", + "enum": [ + "network_requester" + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "query": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "service_id" + ], + "properties": { + "service_id": { + "type": "object", + "required": [ + "service_id" + ], + "properties": { + "service_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "by_announcer" + ], + "properties": { + "by_announcer": { + "type": "object", + "required": [ + "announcer" + ], + "properties": { + "announcer": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "by_nym_address" + ], + "properties": { + "by_nym_address": { + "type": "object", + "required": [ + "nym_address" + ], + "properties": { + "nym_address": { + "$ref": "#/definitions/NymAddress" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "all" + ], + "properties": { + "all": { + "type": "object", + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "signing_nonce" + ], + "properties": { + "signing_nonce": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "config" + ], + "properties": { + "config": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets build information of this contract, such as the commit hash used for the build or rustc version.", + "type": "object", + "required": [ + "get_contract_version" + ], + "properties": { + "get_contract_version": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the stored contract version information that's required by the CW2 spec interface for migrations.", + "type": "object", + "required": [ + "get_cw2_contract_version" + ], + "properties": { + "get_cw2_contract_version": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "NymAddress": { + "description": "The types of addresses supported.", + "oneOf": [ + { + "description": "String representation of a nym address, which is of the form client_id.client_enc@gateway_id.", + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + } + } + }, + "migrate": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MigrateMsg", + "type": "object", + "additionalProperties": false + }, + "sudo": null, + "responses": { + "all": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedServicesListResponse", + "type": "object", + "required": [ + "per_page", + "services" + ], + "properties": { + "per_page": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "services": { + "type": "array", + "items": { + "$ref": "#/definitions/Service" + } + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "NymAddress": { + "description": "The types of addresses supported.", + "oneOf": [ + { + "description": "String representation of a nym address, which is of the form client_id.client_enc@gateway_id.", + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "Service": { + "type": "object", + "required": [ + "announcer", + "block_height", + "deposit", + "service", + "service_id" + ], + "properties": { + "announcer": { + "description": "Address of the service owner.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "block_height": { + "description": "Block height at which the service was added.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "deposit": { + "description": "The deposit used to announce the service.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "service": { + "description": "The announced service.", + "allOf": [ + { + "$ref": "#/definitions/ServiceDetails" + } + ] + }, + "service_id": { + "description": "Unique id assigned to the anounced service.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "ServiceDetails": { + "type": "object", + "required": [ + "identity_key", + "nym_address", + "service_type" + ], + "properties": { + "identity_key": { + "description": "The identity key of the service.", + "type": "string" + }, + "nym_address": { + "description": "The address of the service.", + "allOf": [ + { + "$ref": "#/definitions/NymAddress" + } + ] + }, + "service_type": { + "description": "The service type.", + "allOf": [ + { + "$ref": "#/definitions/ServiceType" + } + ] + } + }, + "additionalProperties": false + }, + "ServiceType": { + "description": "The type of services provider supported", + "type": "string", + "enum": [ + "network_requester" + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "by_announcer": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ServicesListResponse", + "type": "object", + "required": [ + "services" + ], + "properties": { + "services": { + "type": "array", + "items": { + "$ref": "#/definitions/Service" + } + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "NymAddress": { + "description": "The types of addresses supported.", + "oneOf": [ + { + "description": "String representation of a nym address, which is of the form client_id.client_enc@gateway_id.", + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "Service": { + "type": "object", + "required": [ + "announcer", + "block_height", + "deposit", + "service", + "service_id" + ], + "properties": { + "announcer": { + "description": "Address of the service owner.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "block_height": { + "description": "Block height at which the service was added.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "deposit": { + "description": "The deposit used to announce the service.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "service": { + "description": "The announced service.", + "allOf": [ + { + "$ref": "#/definitions/ServiceDetails" + } + ] + }, + "service_id": { + "description": "Unique id assigned to the anounced service.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "ServiceDetails": { + "type": "object", + "required": [ + "identity_key", + "nym_address", + "service_type" + ], + "properties": { + "identity_key": { + "description": "The identity key of the service.", + "type": "string" + }, + "nym_address": { + "description": "The address of the service.", + "allOf": [ + { + "$ref": "#/definitions/NymAddress" + } + ] + }, + "service_type": { + "description": "The service type.", + "allOf": [ + { + "$ref": "#/definitions/ServiceType" + } + ] + } + }, + "additionalProperties": false + }, + "ServiceType": { + "description": "The type of services provider supported", + "type": "string", + "enum": [ + "network_requester" + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "by_nym_address": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ServicesListResponse", + "type": "object", + "required": [ + "services" + ], + "properties": { + "services": { + "type": "array", + "items": { + "$ref": "#/definitions/Service" + } + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "NymAddress": { + "description": "The types of addresses supported.", + "oneOf": [ + { + "description": "String representation of a nym address, which is of the form client_id.client_enc@gateway_id.", + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "Service": { + "type": "object", + "required": [ + "announcer", + "block_height", + "deposit", + "service", + "service_id" + ], + "properties": { + "announcer": { + "description": "Address of the service owner.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "block_height": { + "description": "Block height at which the service was added.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "deposit": { + "description": "The deposit used to announce the service.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "service": { + "description": "The announced service.", + "allOf": [ + { + "$ref": "#/definitions/ServiceDetails" + } + ] + }, + "service_id": { + "description": "Unique id assigned to the anounced service.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "ServiceDetails": { + "type": "object", + "required": [ + "identity_key", + "nym_address", + "service_type" + ], + "properties": { + "identity_key": { + "description": "The identity key of the service.", + "type": "string" + }, + "nym_address": { + "description": "The address of the service.", + "allOf": [ + { + "$ref": "#/definitions/NymAddress" + } + ] + }, + "service_type": { + "description": "The service type.", + "allOf": [ + { + "$ref": "#/definitions/ServiceType" + } + ] + } + }, + "additionalProperties": false + }, + "ServiceType": { + "description": "The type of services provider supported", + "type": "string", + "enum": [ + "network_requester" + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "config": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ConfigResponse", + "type": "object", + "required": [ + "deposit_required" + ], + "properties": { + "deposit_required": { + "$ref": "#/definitions/Coin" + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_c_w2_contract_version": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ContractVersion", + "type": "object", + "required": [ + "contract", + "version" + ], + "properties": { + "contract": { + "description": "contract is the crate name of the implementing contract, eg. `crate:cw20-base` we will use other prefixes for other languages, and their standard global namespacing", + "type": "string" + }, + "version": { + "description": "version is any string that this implementation knows. It may be simple counter \"1\", \"2\". or semantic version on release tags \"v0.7.0\", or some custom feature flag list. the only code that needs to understand the version parsing is code that knows how to migrate from the given contract (and is tied to it's implementation somehow)", + "type": "string" + } + }, + "additionalProperties": false + }, + "get_contract_version": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ContractBuildInformation", + "type": "object", + "required": [ + "build_timestamp", + "build_version", + "commit_branch", + "commit_sha", + "commit_timestamp", + "rustc_version" + ], + "properties": { + "build_timestamp": { + "description": "Provides the build timestamp, for example `2021-02-23T20:14:46.558472672+00:00`.", + "type": "string" + }, + "build_version": { + "description": "Provides the build version, for example `0.1.0-9-g46f83e1`.", + "type": "string" + }, + "commit_branch": { + "description": "Provides the name of the git branch that was used for the build, for example `master`.", + "type": "string" + }, + "commit_sha": { + "description": "Provides the hash of the commit that was used for the build, for example `46f83e112520533338245862d366f6a02cef07d4`.", + "type": "string" + }, + "commit_timestamp": { + "description": "Provides the timestamp of the commit that was used for the build, for example `2021-02-23T08:08:02-05:00`.", + "type": "string" + }, + "rustc_version": { + "description": "Provides the rustc version that was used for the build, for example `1.52.0-nightly`.", + "type": "string" + } + }, + "additionalProperties": false + }, + "service_id": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Service", + "type": "object", + "required": [ + "announcer", + "block_height", + "deposit", + "service", + "service_id" + ], + "properties": { + "announcer": { + "description": "Address of the service owner.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "block_height": { + "description": "Block height at which the service was added.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "deposit": { + "description": "The deposit used to announce the service.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "service": { + "description": "The announced service.", + "allOf": [ + { + "$ref": "#/definitions/ServiceDetails" + } + ] + }, + "service_id": { + "description": "Unique id assigned to the anounced service.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "NymAddress": { + "description": "The types of addresses supported.", + "oneOf": [ + { + "description": "String representation of a nym address, which is of the form client_id.client_enc@gateway_id.", + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "ServiceDetails": { + "type": "object", + "required": [ + "identity_key", + "nym_address", + "service_type" + ], + "properties": { + "identity_key": { + "description": "The identity key of the service.", + "type": "string" + }, + "nym_address": { + "description": "The address of the service.", + "allOf": [ + { + "$ref": "#/definitions/NymAddress" + } + ] + }, + "service_type": { + "description": "The service type.", + "allOf": [ + { + "$ref": "#/definitions/ServiceType" + } + ] + } + }, + "additionalProperties": false + }, + "ServiceType": { + "description": "The type of services provider supported", + "type": "string", + "enum": [ + "network_requester" + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "signing_nonce": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "uint32", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } +} diff --git a/contracts/service-provider-directory/schema/raw/execute.json b/contracts/service-provider-directory/schema/raw/execute.json new file mode 100644 index 0000000000..995ede2a3a --- /dev/null +++ b/contracts/service-provider-directory/schema/raw/execute.json @@ -0,0 +1,181 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "announce" + ], + "properties": { + "announce": { + "type": "object", + "required": [ + "owner_signature", + "service" + ], + "properties": { + "owner_signature": { + "$ref": "#/definitions/MessageSignature" + }, + "service": { + "$ref": "#/definitions/ServiceDetails" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "delete_id" + ], + "properties": { + "delete_id": { + "type": "object", + "required": [ + "service_id" + ], + "properties": { + "service_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "delete_nym_address" + ], + "properties": { + "delete_nym_address": { + "type": "object", + "required": [ + "nym_address" + ], + "properties": { + "nym_address": { + "$ref": "#/definitions/NymAddress" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_deposit_required" + ], + "properties": { + "update_deposit_required": { + "type": "object", + "required": [ + "deposit_required" + ], + "properties": { + "deposit_required": { + "$ref": "#/definitions/Coin" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "MessageSignature": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + }, + "NymAddress": { + "description": "The types of addresses supported.", + "oneOf": [ + { + "description": "String representation of a nym address, which is of the form client_id.client_enc@gateway_id.", + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "ServiceDetails": { + "type": "object", + "required": [ + "identity_key", + "nym_address", + "service_type" + ], + "properties": { + "identity_key": { + "description": "The identity key of the service.", + "type": "string" + }, + "nym_address": { + "description": "The address of the service.", + "allOf": [ + { + "$ref": "#/definitions/NymAddress" + } + ] + }, + "service_type": { + "description": "The service type.", + "allOf": [ + { + "$ref": "#/definitions/ServiceType" + } + ] + } + }, + "additionalProperties": false + }, + "ServiceType": { + "description": "The type of services provider supported", + "type": "string", + "enum": [ + "network_requester" + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/service-provider-directory/schema/raw/instantiate.json b/contracts/service-provider-directory/schema/raw/instantiate.json new file mode 100644 index 0000000000..73867fda63 --- /dev/null +++ b/contracts/service-provider-directory/schema/raw/instantiate.json @@ -0,0 +1,35 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "deposit_required" + ], + "properties": { + "deposit_required": { + "$ref": "#/definitions/Coin" + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/service-provider-directory/schema/raw/migrate.json b/contracts/service-provider-directory/schema/raw/migrate.json new file mode 100644 index 0000000000..7fbe8c5708 --- /dev/null +++ b/contracts/service-provider-directory/schema/raw/migrate.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MigrateMsg", + "type": "object", + "additionalProperties": false +} diff --git a/contracts/service-provider-directory/schema/raw/query.json b/contracts/service-provider-directory/schema/raw/query.json new file mode 100644 index 0000000000..f6abe3d45e --- /dev/null +++ b/contracts/service-provider-directory/schema/raw/query.json @@ -0,0 +1,184 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "service_id" + ], + "properties": { + "service_id": { + "type": "object", + "required": [ + "service_id" + ], + "properties": { + "service_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "by_announcer" + ], + "properties": { + "by_announcer": { + "type": "object", + "required": [ + "announcer" + ], + "properties": { + "announcer": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "by_nym_address" + ], + "properties": { + "by_nym_address": { + "type": "object", + "required": [ + "nym_address" + ], + "properties": { + "nym_address": { + "$ref": "#/definitions/NymAddress" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "all" + ], + "properties": { + "all": { + "type": "object", + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "signing_nonce" + ], + "properties": { + "signing_nonce": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "config" + ], + "properties": { + "config": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets build information of this contract, such as the commit hash used for the build or rustc version.", + "type": "object", + "required": [ + "get_contract_version" + ], + "properties": { + "get_contract_version": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the stored contract version information that's required by the CW2 spec interface for migrations.", + "type": "object", + "required": [ + "get_cw2_contract_version" + ], + "properties": { + "get_cw2_contract_version": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "NymAddress": { + "description": "The types of addresses supported.", + "oneOf": [ + { + "description": "String representation of a nym address, which is of the form client_id.client_enc@gateway_id.", + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + } + } +} diff --git a/contracts/service-provider-directory/schema/raw/response_to_all.json b/contracts/service-provider-directory/schema/raw/response_to_all.json new file mode 100644 index 0000000000..e9d7c842dd --- /dev/null +++ b/contracts/service-provider-directory/schema/raw/response_to_all.json @@ -0,0 +1,162 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PagedServicesListResponse", + "type": "object", + "required": [ + "per_page", + "services" + ], + "properties": { + "per_page": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "services": { + "type": "array", + "items": { + "$ref": "#/definitions/Service" + } + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "NymAddress": { + "description": "The types of addresses supported.", + "oneOf": [ + { + "description": "String representation of a nym address, which is of the form client_id.client_enc@gateway_id.", + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "Service": { + "type": "object", + "required": [ + "announcer", + "block_height", + "deposit", + "service", + "service_id" + ], + "properties": { + "announcer": { + "description": "Address of the service owner.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "block_height": { + "description": "Block height at which the service was added.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "deposit": { + "description": "The deposit used to announce the service.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "service": { + "description": "The announced service.", + "allOf": [ + { + "$ref": "#/definitions/ServiceDetails" + } + ] + }, + "service_id": { + "description": "Unique id assigned to the anounced service.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "ServiceDetails": { + "type": "object", + "required": [ + "identity_key", + "nym_address", + "service_type" + ], + "properties": { + "identity_key": { + "description": "The identity key of the service.", + "type": "string" + }, + "nym_address": { + "description": "The address of the service.", + "allOf": [ + { + "$ref": "#/definitions/NymAddress" + } + ] + }, + "service_type": { + "description": "The service type.", + "allOf": [ + { + "$ref": "#/definitions/ServiceType" + } + ] + } + }, + "additionalProperties": false + }, + "ServiceType": { + "description": "The type of services provider supported", + "type": "string", + "enum": [ + "network_requester" + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/service-provider-directory/schema/raw/response_to_by_announcer.json b/contracts/service-provider-directory/schema/raw/response_to_by_announcer.json new file mode 100644 index 0000000000..a0092cef6b --- /dev/null +++ b/contracts/service-provider-directory/schema/raw/response_to_by_announcer.json @@ -0,0 +1,147 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ServicesListResponse", + "type": "object", + "required": [ + "services" + ], + "properties": { + "services": { + "type": "array", + "items": { + "$ref": "#/definitions/Service" + } + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "NymAddress": { + "description": "The types of addresses supported.", + "oneOf": [ + { + "description": "String representation of a nym address, which is of the form client_id.client_enc@gateway_id.", + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "Service": { + "type": "object", + "required": [ + "announcer", + "block_height", + "deposit", + "service", + "service_id" + ], + "properties": { + "announcer": { + "description": "Address of the service owner.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "block_height": { + "description": "Block height at which the service was added.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "deposit": { + "description": "The deposit used to announce the service.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "service": { + "description": "The announced service.", + "allOf": [ + { + "$ref": "#/definitions/ServiceDetails" + } + ] + }, + "service_id": { + "description": "Unique id assigned to the anounced service.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "ServiceDetails": { + "type": "object", + "required": [ + "identity_key", + "nym_address", + "service_type" + ], + "properties": { + "identity_key": { + "description": "The identity key of the service.", + "type": "string" + }, + "nym_address": { + "description": "The address of the service.", + "allOf": [ + { + "$ref": "#/definitions/NymAddress" + } + ] + }, + "service_type": { + "description": "The service type.", + "allOf": [ + { + "$ref": "#/definitions/ServiceType" + } + ] + } + }, + "additionalProperties": false + }, + "ServiceType": { + "description": "The type of services provider supported", + "type": "string", + "enum": [ + "network_requester" + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/service-provider-directory/schema/raw/response_to_by_nym_address.json b/contracts/service-provider-directory/schema/raw/response_to_by_nym_address.json new file mode 100644 index 0000000000..a0092cef6b --- /dev/null +++ b/contracts/service-provider-directory/schema/raw/response_to_by_nym_address.json @@ -0,0 +1,147 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ServicesListResponse", + "type": "object", + "required": [ + "services" + ], + "properties": { + "services": { + "type": "array", + "items": { + "$ref": "#/definitions/Service" + } + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "NymAddress": { + "description": "The types of addresses supported.", + "oneOf": [ + { + "description": "String representation of a nym address, which is of the form client_id.client_enc@gateway_id.", + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "Service": { + "type": "object", + "required": [ + "announcer", + "block_height", + "deposit", + "service", + "service_id" + ], + "properties": { + "announcer": { + "description": "Address of the service owner.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "block_height": { + "description": "Block height at which the service was added.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "deposit": { + "description": "The deposit used to announce the service.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "service": { + "description": "The announced service.", + "allOf": [ + { + "$ref": "#/definitions/ServiceDetails" + } + ] + }, + "service_id": { + "description": "Unique id assigned to the anounced service.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "ServiceDetails": { + "type": "object", + "required": [ + "identity_key", + "nym_address", + "service_type" + ], + "properties": { + "identity_key": { + "description": "The identity key of the service.", + "type": "string" + }, + "nym_address": { + "description": "The address of the service.", + "allOf": [ + { + "$ref": "#/definitions/NymAddress" + } + ] + }, + "service_type": { + "description": "The service type.", + "allOf": [ + { + "$ref": "#/definitions/ServiceType" + } + ] + } + }, + "additionalProperties": false + }, + "ServiceType": { + "description": "The type of services provider supported", + "type": "string", + "enum": [ + "network_requester" + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/service-provider-directory/schema/raw/response_to_config.json b/contracts/service-provider-directory/schema/raw/response_to_config.json new file mode 100644 index 0000000000..16420c1130 --- /dev/null +++ b/contracts/service-provider-directory/schema/raw/response_to_config.json @@ -0,0 +1,35 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ConfigResponse", + "type": "object", + "required": [ + "deposit_required" + ], + "properties": { + "deposit_required": { + "$ref": "#/definitions/Coin" + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/service-provider-directory/schema/raw/response_to_get_c_w2_contract_version.json b/contracts/service-provider-directory/schema/raw/response_to_get_c_w2_contract_version.json new file mode 100644 index 0000000000..3ded8c84d9 --- /dev/null +++ b/contracts/service-provider-directory/schema/raw/response_to_get_c_w2_contract_version.json @@ -0,0 +1,20 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ContractVersion", + "type": "object", + "required": [ + "contract", + "version" + ], + "properties": { + "contract": { + "description": "contract is the crate name of the implementing contract, eg. `crate:cw20-base` we will use other prefixes for other languages, and their standard global namespacing", + "type": "string" + }, + "version": { + "description": "version is any string that this implementation knows. It may be simple counter \"1\", \"2\". or semantic version on release tags \"v0.7.0\", or some custom feature flag list. the only code that needs to understand the version parsing is code that knows how to migrate from the given contract (and is tied to it's implementation somehow)", + "type": "string" + } + }, + "additionalProperties": false +} diff --git a/contracts/service-provider-directory/schema/raw/response_to_get_contract_version.json b/contracts/service-provider-directory/schema/raw/response_to_get_contract_version.json new file mode 100644 index 0000000000..60ae65f3d1 --- /dev/null +++ b/contracts/service-provider-directory/schema/raw/response_to_get_contract_version.json @@ -0,0 +1,40 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ContractBuildInformation", + "type": "object", + "required": [ + "build_timestamp", + "build_version", + "commit_branch", + "commit_sha", + "commit_timestamp", + "rustc_version" + ], + "properties": { + "build_timestamp": { + "description": "Provides the build timestamp, for example `2021-02-23T20:14:46.558472672+00:00`.", + "type": "string" + }, + "build_version": { + "description": "Provides the build version, for example `0.1.0-9-g46f83e1`.", + "type": "string" + }, + "commit_branch": { + "description": "Provides the name of the git branch that was used for the build, for example `master`.", + "type": "string" + }, + "commit_sha": { + "description": "Provides the hash of the commit that was used for the build, for example `46f83e112520533338245862d366f6a02cef07d4`.", + "type": "string" + }, + "commit_timestamp": { + "description": "Provides the timestamp of the commit that was used for the build, for example `2021-02-23T08:08:02-05:00`.", + "type": "string" + }, + "rustc_version": { + "description": "Provides the rustc version that was used for the build, for example `1.52.0-nightly`.", + "type": "string" + } + }, + "additionalProperties": false +} diff --git a/contracts/service-provider-directory/schema/raw/response_to_service_id.json b/contracts/service-provider-directory/schema/raw/response_to_service_id.json new file mode 100644 index 0000000000..68f5ff143b --- /dev/null +++ b/contracts/service-provider-directory/schema/raw/response_to_service_id.json @@ -0,0 +1,132 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Service", + "type": "object", + "required": [ + "announcer", + "block_height", + "deposit", + "service", + "service_id" + ], + "properties": { + "announcer": { + "description": "Address of the service owner.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "block_height": { + "description": "Block height at which the service was added.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "deposit": { + "description": "The deposit used to announce the service.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "service": { + "description": "The announced service.", + "allOf": [ + { + "$ref": "#/definitions/ServiceDetails" + } + ] + }, + "service_id": { + "description": "Unique id assigned to the anounced service.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "NymAddress": { + "description": "The types of addresses supported.", + "oneOf": [ + { + "description": "String representation of a nym address, which is of the form client_id.client_enc@gateway_id.", + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "ServiceDetails": { + "type": "object", + "required": [ + "identity_key", + "nym_address", + "service_type" + ], + "properties": { + "identity_key": { + "description": "The identity key of the service.", + "type": "string" + }, + "nym_address": { + "description": "The address of the service.", + "allOf": [ + { + "$ref": "#/definitions/NymAddress" + } + ] + }, + "service_type": { + "description": "The service type.", + "allOf": [ + { + "$ref": "#/definitions/ServiceType" + } + ] + } + }, + "additionalProperties": false + }, + "ServiceType": { + "description": "The type of services provider supported", + "type": "string", + "enum": [ + "network_requester" + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/service-provider-directory/schema/raw/response_to_signing_nonce.json b/contracts/service-provider-directory/schema/raw/response_to_signing_nonce.json new file mode 100644 index 0000000000..de85c3e56e --- /dev/null +++ b/contracts/service-provider-directory/schema/raw/response_to_signing_nonce.json @@ -0,0 +1,7 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "uint32", + "type": "integer", + "format": "uint32", + "minimum": 0.0 +} diff --git a/contracts/service-provider-directory/src/bin/schema.rs b/contracts/service-provider-directory/src/bin/schema.rs new file mode 100644 index 0000000000..0adf4b8827 --- /dev/null +++ b/contracts/service-provider-directory/src/bin/schema.rs @@ -0,0 +1,16 @@ +// Copyright 2023 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use cosmwasm_schema::write_api; +use nym_service_provider_directory_common::msg::{ + ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg, +}; + +fn main() { + write_api! { + instantiate: InstantiateMsg, + query: QueryMsg, + execute: ExecuteMsg, + migrate: MigrateMsg, + } +} diff --git a/contracts/service-provider-directory/src/state/services.rs b/contracts/service-provider-directory/src/state/services.rs index e5e68a21ff..d88ebf6722 100644 --- a/contracts/service-provider-directory/src/state/services.rs +++ b/contracts/service-provider-directory/src/state/services.rs @@ -88,6 +88,8 @@ pub fn load_nym_address(store: &dyn Storage, nym_address: NymAddress) -> Result< pub struct PagedLoad { pub services: Vec, pub limit: usize, + + /// Field indicating paging information for the following queries if the caller wishes to get further entries. pub start_next_after: Option, } diff --git a/contracts/vesting/.cargo/config b/contracts/vesting/.cargo/config new file mode 100644 index 0000000000..2c25b8a87e --- /dev/null +++ b/contracts/vesting/.cargo/config @@ -0,0 +1,4 @@ +[alias] +wasm = "build --release --target wasm32-unknown-unknown" +unit-test = "test --lib" +schema = "run --bin schema --features=schema-gen" \ No newline at end of file diff --git a/contracts/vesting/Cargo.toml b/contracts/vesting/Cargo.toml index 5f988b6431..5998e5d773 100644 --- a/contracts/vesting/Cargo.toml +++ b/contracts/vesting/Cargo.toml @@ -15,6 +15,10 @@ exclude = [ "artifacts", ] +[[bin]] +name = "schema" +required-features = ["schema-gen"] + [lib] name = "vesting_contract" crate-type = ["cdylib", "rlib"] @@ -24,12 +28,12 @@ mixnet-contract-common = { path = "../../common/cosmwasm-smart-contracts/mixnet- contracts-common = { path = "../../common/cosmwasm-smart-contracts/contracts-common", package = "nym-contracts-common", version = "0.5.0" } vesting-contract-common = { path = "../../common/cosmwasm-smart-contracts/vesting-contract", package = "nym-vesting-contract-common", version = "0.7.0" } +cosmwasm-schema = { workspace = true, optional = true } cosmwasm-std = { workspace = true } cosmwasm-derive = { workspace = true } cw2 = { workspace = true } cw-storage-plus = { workspace = true, features = ["iterator"] } -schemars = "0.8" serde = { version = "1.0", default-features = false, features = ["derive"] } thiserror = { version = "1.0" } semver = { version = "1.0.16", default-features = false } @@ -46,3 +50,6 @@ vergen = { version = "=7.4.3", default-features = false, features = ["build", "g [profile.release] overflow-checks = true + +[features] +schema-gen = ["vesting-contract-common/schema", "cosmwasm-schema"] \ No newline at end of file diff --git a/contracts/vesting/Makefile b/contracts/vesting/Makefile index a00097bc65..8ca651ccec 100644 --- a/contracts/vesting/Makefile +++ b/contracts/vesting/Makefile @@ -1,2 +1,5 @@ wasm: - RUSTFLAGS='-C link-arg=-s' cargo build --release --target wasm32-unknown-unknown \ No newline at end of file + RUSTFLAGS='-C link-arg=-s' cargo build --release --target wasm32-unknown-unknown + +generate-schema: + cargo schema \ No newline at end of file diff --git a/contracts/vesting/schema/nym-vesting-contract.json b/contracts/vesting/schema/nym-vesting-contract.json new file mode 100644 index 0000000000..87967fb410 --- /dev/null +++ b/contracts/vesting/schema/nym-vesting-contract.json @@ -0,0 +1,2841 @@ +{ + "contract_name": "nym-vesting-contract", + "contract_version": "1.4.0", + "idl_version": "1.0.0", + "instantiate": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "mix_denom", + "mixnet_contract_address" + ], + "properties": { + "mix_denom": { + "type": "string" + }, + "mixnet_contract_address": { + "type": "string" + } + }, + "additionalProperties": false + }, + "execute": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "description": "Only owner of the node can crate the family with node as head", + "type": "object", + "required": [ + "create_family" + ], + "properties": { + "create_family": { + "type": "object", + "required": [ + "label" + ], + "properties": { + "label": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Family head needs to sign the joining node IdentityKey, the Node provides its signature signaling consent to join the family", + "type": "object", + "required": [ + "join_family" + ], + "properties": { + "join_family": { + "type": "object", + "required": [ + "family_head", + "join_permit" + ], + "properties": { + "family_head": { + "$ref": "#/definitions/FamilyHead" + }, + "join_permit": { + "$ref": "#/definitions/MessageSignature" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "leave_family" + ], + "properties": { + "leave_family": { + "type": "object", + "required": [ + "family_head" + ], + "properties": { + "family_head": { + "$ref": "#/definitions/FamilyHead" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "kick_family_member" + ], + "properties": { + "kick_family_member": { + "type": "object", + "required": [ + "member" + ], + "properties": { + "member": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "track_reward" + ], + "properties": { + "track_reward": { + "type": "object", + "required": [ + "address", + "amount" + ], + "properties": { + "address": { + "type": "string" + }, + "amount": { + "$ref": "#/definitions/Coin" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "claim_operator_reward" + ], + "properties": { + "claim_operator_reward": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "claim_delegator_reward" + ], + "properties": { + "claim_delegator_reward": { + "type": "object", + "required": [ + "mix_id" + ], + "properties": { + "mix_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_mixnode_cost_params" + ], + "properties": { + "update_mixnode_cost_params": { + "type": "object", + "required": [ + "new_costs" + ], + "properties": { + "new_costs": { + "$ref": "#/definitions/MixNodeCostParams" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_mixnode_config" + ], + "properties": { + "update_mixnode_config": { + "type": "object", + "required": [ + "new_config" + ], + "properties": { + "new_config": { + "$ref": "#/definitions/MixNodeConfigUpdate" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_mixnet_address" + ], + "properties": { + "update_mixnet_address": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "delegate_to_mixnode" + ], + "properties": { + "delegate_to_mixnode": { + "type": "object", + "required": [ + "amount", + "mix_id" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "mix_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "on_behalf_of": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "undelegate_from_mixnode" + ], + "properties": { + "undelegate_from_mixnode": { + "type": "object", + "required": [ + "mix_id" + ], + "properties": { + "mix_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "on_behalf_of": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "create_account" + ], + "properties": { + "create_account": { + "type": "object", + "required": [ + "owner_address" + ], + "properties": { + "cap": { + "anyOf": [ + { + "$ref": "#/definitions/PledgeCap" + }, + { + "type": "null" + } + ] + }, + "owner_address": { + "type": "string" + }, + "staking_address": { + "type": [ + "string", + "null" + ] + }, + "vesting_spec": { + "anyOf": [ + { + "$ref": "#/definitions/VestingSpecification" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "withdraw_vested_coins" + ], + "properties": { + "withdraw_vested_coins": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "track_undelegation" + ], + "properties": { + "track_undelegation": { + "type": "object", + "required": [ + "amount", + "mix_id", + "owner" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "mix_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "bond_mixnode" + ], + "properties": { + "bond_mixnode": { + "type": "object", + "required": [ + "amount", + "cost_params", + "mix_node", + "owner_signature" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "cost_params": { + "$ref": "#/definitions/MixNodeCostParams" + }, + "mix_node": { + "$ref": "#/definitions/MixNode" + }, + "owner_signature": { + "$ref": "#/definitions/MessageSignature" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "pledge_more" + ], + "properties": { + "pledge_more": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "decrease_pledge" + ], + "properties": { + "decrease_pledge": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "unbond_mixnode" + ], + "properties": { + "unbond_mixnode": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "track_unbond_mixnode" + ], + "properties": { + "track_unbond_mixnode": { + "type": "object", + "required": [ + "amount", + "owner" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "owner": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "track_decrease_pledge" + ], + "properties": { + "track_decrease_pledge": { + "type": "object", + "required": [ + "amount", + "owner" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "owner": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "bond_gateway" + ], + "properties": { + "bond_gateway": { + "type": "object", + "required": [ + "amount", + "gateway", + "owner_signature" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "gateway": { + "$ref": "#/definitions/Gateway" + }, + "owner_signature": { + "$ref": "#/definitions/MessageSignature" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "unbond_gateway" + ], + "properties": { + "unbond_gateway": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "track_unbond_gateway" + ], + "properties": { + "track_unbond_gateway": { + "type": "object", + "required": [ + "amount", + "owner" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "owner": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_gateway_config" + ], + "properties": { + "update_gateway_config": { + "type": "object", + "required": [ + "new_config" + ], + "properties": { + "new_config": { + "$ref": "#/definitions/GatewayConfigUpdate" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "transfer_ownership" + ], + "properties": { + "transfer_ownership": { + "type": "object", + "required": [ + "to_address" + ], + "properties": { + "to_address": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_staking_address" + ], + "properties": { + "update_staking_address": { + "type": "object", + "properties": { + "to_address": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_locked_pledge_cap" + ], + "properties": { + "update_locked_pledge_cap": { + "type": "object", + "required": [ + "address", + "cap" + ], + "properties": { + "address": { + "type": "string" + }, + "cap": { + "$ref": "#/definitions/PledgeCap" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "FamilyHead": { + "description": "Head of particular family as identified by its identity key (i.e. public component of its ed25519 keypair stringified into base58).", + "type": "string" + }, + "Gateway": { + "description": "Information provided by the node operator during bonding that are used to allow other entities to use the services of this node.", + "type": "object", + "required": [ + "clients_port", + "host", + "identity_key", + "location", + "mix_port", + "sphinx_key", + "version" + ], + "properties": { + "clients_port": { + "description": "Port used by this gateway for listening for client requests.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "host": { + "description": "Network address of this gateway, for example 1.1.1.1 or foo.gateway.com", + "type": "string" + }, + "identity_key": { + "description": "Base58 encoded ed25519 EdDSA public key of the gateway used to derive shared keys with clients", + "type": "string" + }, + "location": { + "description": "The physical, self-reported, location of this gateway.", + "type": "string" + }, + "mix_port": { + "description": "Port used by this gateway for listening for mix packets.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "sphinx_key": { + "description": "Base58-encoded x25519 public key used for sphinx key derivation.", + "type": "string" + }, + "version": { + "description": "The self-reported semver version of this gateway.", + "type": "string" + } + }, + "additionalProperties": false + }, + "GatewayConfigUpdate": { + "type": "object", + "required": [ + "clients_port", + "host", + "location", + "mix_port", + "version" + ], + "properties": { + "clients_port": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "host": { + "type": "string" + }, + "location": { + "type": "string" + }, + "mix_port": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "version": { + "type": "string" + } + }, + "additionalProperties": false + }, + "MessageSignature": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + }, + "MixNode": { + "description": "Information provided by the node operator during bonding that are used to allow other entities to use the services of this node.", + "type": "object", + "required": [ + "host", + "http_api_port", + "identity_key", + "mix_port", + "sphinx_key", + "verloc_port", + "version" + ], + "properties": { + "host": { + "description": "Network address of this mixnode, for example 1.1.1.1 or foo.mixnode.com", + "type": "string" + }, + "http_api_port": { + "description": "Port used by this mixnode for its http(s) API", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "identity_key": { + "description": "Base58-encoded ed25519 EdDSA public key.", + "type": "string" + }, + "mix_port": { + "description": "Port used by this mixnode for listening for mix packets.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "sphinx_key": { + "description": "Base58-encoded x25519 public key used for sphinx key derivation.", + "type": "string" + }, + "verloc_port": { + "description": "Port used by this mixnode for listening for verloc requests.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "version": { + "description": "The self-reported semver version of this mixnode.", + "type": "string" + } + }, + "additionalProperties": false + }, + "MixNodeConfigUpdate": { + "type": "object", + "required": [ + "host", + "http_api_port", + "mix_port", + "verloc_port", + "version" + ], + "properties": { + "host": { + "type": "string" + }, + "http_api_port": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "mix_port": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "verloc_port": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "version": { + "type": "string" + } + }, + "additionalProperties": false + }, + "MixNodeCostParams": { + "description": "The cost parameters, or the cost function, defined for the particular mixnode that influences how the rewards should be split between the node operator and its delegators.", + "type": "object", + "required": [ + "interval_operating_cost", + "profit_margin_percent" + ], + "properties": { + "interval_operating_cost": { + "description": "Operating cost of the associated mixnode per the entire interval.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "profit_margin_percent": { + "description": "The profit margin of the associated mixnode, i.e. the desired percent of the reward to be distributed to the operator.", + "allOf": [ + { + "$ref": "#/definitions/Percent" + } + ] + } + }, + "additionalProperties": false + }, + "Percent": { + "description": "Percent represents a value between 0 and 100% (i.e. between 0.0 and 1.0)", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "PledgeCap": { + "description": "Defines cap for pleding/staking tokens.", + "oneOf": [ + { + "description": "Specifies a percent-based pledge cap, i.e. only given % of tokens could be pledged/staked.", + "type": "object", + "required": [ + "percent" + ], + "properties": { + "percent": { + "$ref": "#/definitions/Percent" + } + }, + "additionalProperties": false + }, + { + "description": "Specifies an absolute pledge cap, i.e. an explicit value that could be pledged/staked.", + "type": "object", + "required": [ + "absolute" + ], + "properties": { + "absolute": { + "$ref": "#/definitions/Uint128" + } + }, + "additionalProperties": false + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "VestingSpecification": { + "type": "object", + "properties": { + "num_periods": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "period_seconds": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "start_time": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } + }, + "query": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "description": "Queries exposed by this contract.", + "oneOf": [ + { + "description": "Gets build information of this contract, such as the commit hash used for the build or rustc version.", + "type": "object", + "required": [ + "get_contract_version" + ], + "properties": { + "get_contract_version": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the stored contract version information that's required by the CW2 spec interface for migrations.", + "type": "object", + "required": [ + "get_cw2_contract_version" + ], + "properties": { + "get_cw2_contract_version": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the list of vesting accounts held in this contract.", + "type": "object", + "required": [ + "get_accounts_paged" + ], + "properties": { + "get_accounts_paged": { + "type": "object", + "properties": { + "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_next_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the list of coins that are still vesting for each account held in this contract.", + "type": "object", + "required": [ + "get_accounts_vesting_coins_paged" + ], + "properties": { + "get_accounts_vesting_coins_paged": { + "type": "object", + "properties": { + "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_next_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the amount of locked coins for the provided vesting account, i.e. coins that are still vesting but have not been staked. `locked_coins = vesting_coins - staked_coins`", + "type": "object", + "required": [ + "locked_coins" + ], + "properties": { + "locked_coins": { + "type": "object", + "required": [ + "vesting_account_address" + ], + "properties": { + "block_time": { + "description": "(deprecated) Optional argument specifying that the query should be performed against non-current block.", + "anyOf": [ + { + "$ref": "#/definitions/Timestamp" + }, + { + "type": "null" + } + ] + }, + "vesting_account_address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the amount of spendable coins for the provided vesting account, i.e. coins that could be withdrawn. `spendable_coins = account_balance - locked_coins` note: `account_balance` is the amount of coins still physically present in this contract, i.e. not withdrawn or staked.", + "type": "object", + "required": [ + "spendable_coins" + ], + "properties": { + "spendable_coins": { + "type": "object", + "required": [ + "vesting_account_address" + ], + "properties": { + "block_time": { + "description": "(deprecated) Optional argument specifying that the query should be performed against non-current block.", + "anyOf": [ + { + "$ref": "#/definitions/Timestamp" + }, + { + "type": "null" + } + ] + }, + "vesting_account_address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the amount of coins that have already vested for the provided vesting account address.", + "type": "object", + "required": [ + "get_vested_coins" + ], + "properties": { + "get_vested_coins": { + "type": "object", + "required": [ + "vesting_account_address" + ], + "properties": { + "block_time": { + "description": "(deprecated) Optional argument specifying that the query should be performed against non-current block.", + "anyOf": [ + { + "$ref": "#/definitions/Timestamp" + }, + { + "type": "null" + } + ] + }, + "vesting_account_address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the amount of coins that are still vesting for the provided vesting account address.", + "type": "object", + "required": [ + "get_vesting_coins" + ], + "properties": { + "get_vesting_coins": { + "type": "object", + "required": [ + "vesting_account_address" + ], + "properties": { + "block_time": { + "description": "(deprecated) Optional argument specifying that the query should be performed against non-current block.", + "anyOf": [ + { + "$ref": "#/definitions/Timestamp" + }, + { + "type": "null" + } + ] + }, + "vesting_account_address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the starting vesting time for the provided vesting account, i.e. the beginning of the first vesting period.", + "type": "object", + "required": [ + "get_start_time" + ], + "properties": { + "get_start_time": { + "type": "object", + "required": [ + "vesting_account_address" + ], + "properties": { + "vesting_account_address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the ending vesting time for the provided vesting account, i.e. the end of the last vesting period.", + "type": "object", + "required": [ + "get_end_time" + ], + "properties": { + "get_end_time": { + "type": "object", + "required": [ + "vesting_account_address" + ], + "properties": { + "vesting_account_address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the initial vesting specification used for the provided vesting account address.", + "type": "object", + "required": [ + "get_original_vesting" + ], + "properties": { + "get_original_vesting": { + "type": "object", + "required": [ + "vesting_account_address" + ], + "properties": { + "vesting_account_address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the total amount of coins accrued through claimed staking rewards by the provided vesting account.", + "type": "object", + "required": [ + "get_historical_vesting_staking_reward" + ], + "properties": { + "get_historical_vesting_staking_reward": { + "type": "object", + "required": [ + "vesting_account_address" + ], + "properties": { + "vesting_account_address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the amount of spendable vesting coins for the provided vesting account, i.e. coins that could be withdrawn that originated from the vesting specification.", + "type": "object", + "required": [ + "get_spendable_vested_coins" + ], + "properties": { + "get_spendable_vested_coins": { + "type": "object", + "required": [ + "vesting_account_address" + ], + "properties": { + "vesting_account_address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the amount of spendable reward coins for the provided vesting account, i.e. coins that could be withdrawn that originated from the claimed staking rewards.", + "type": "object", + "required": [ + "get_spendable_reward_coins" + ], + "properties": { + "get_spendable_reward_coins": { + "type": "object", + "required": [ + "vesting_account_address" + ], + "properties": { + "vesting_account_address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the amount of coins that are currently delegated for the provided vesting account address.", + "type": "object", + "required": [ + "get_delegated_coins" + ], + "properties": { + "get_delegated_coins": { + "type": "object", + "required": [ + "vesting_account_address" + ], + "properties": { + "vesting_account_address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the amount of coins that are currently pledged for the provided vesting account address.", + "type": "object", + "required": [ + "get_pledged_coins" + ], + "properties": { + "get_pledged_coins": { + "type": "object", + "required": [ + "vesting_account_address" + ], + "properties": { + "vesting_account_address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the amount of coins that are currently staked (i.e. delegations + pledges) for the provided vesting account address.", + "type": "object", + "required": [ + "get_staked_coins" + ], + "properties": { + "get_staked_coins": { + "type": "object", + "required": [ + "vesting_account_address" + ], + "properties": { + "vesting_account_address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the amount of coins that got withdrawn for the provided vesting account address.", + "type": "object", + "required": [ + "get_withdrawn_coins" + ], + "properties": { + "get_withdrawn_coins": { + "type": "object", + "required": [ + "vesting_account_address" + ], + "properties": { + "vesting_account_address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns detailed information associated with the account for the provided vesting account address.", + "type": "object", + "required": [ + "get_account" + ], + "properties": { + "get_account": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns pledge information (if applicable) for bonded mixnode for the provided vesting account address.", + "type": "object", + "required": [ + "get_mixnode" + ], + "properties": { + "get_mixnode": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns pledge information (if applicable) for bonded gateway for the provided vesting account address.", + "type": "object", + "required": [ + "get_gateway" + ], + "properties": { + "get_gateway": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the current vesting period for the provided vesting account address.", + "type": "object", + "required": [ + "get_current_vesting_period" + ], + "properties": { + "get_current_vesting_period": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the information about particular vesting delegation.", + "type": "object", + "required": [ + "get_delegation" + ], + "properties": { + "get_delegation": { + "type": "object", + "required": [ + "address", + "block_timestamp_secs", + "mix_id" + ], + "properties": { + "address": { + "description": "Address of the vesting account in question.", + "type": "string" + }, + "block_timestamp_secs": { + "description": "Block timestamp of the delegation.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "mix_id": { + "description": "Id of the mixnode towards which the delegation has been made.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the total amount of coins delegated towards particular mixnode by the provided vesting account address.", + "type": "object", + "required": [ + "get_total_delegation_amount" + ], + "properties": { + "get_total_delegation_amount": { + "type": "object", + "required": [ + "address", + "mix_id" + ], + "properties": { + "address": { + "description": "Address of the vesting account in question.", + "type": "string" + }, + "mix_id": { + "description": "Id of the mixnode towards which the delegations have been made.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns timestamps of delegations made towards particular mixnode by the provided vesting account address.", + "type": "object", + "required": [ + "get_delegation_times" + ], + "properties": { + "get_delegation_times": { + "type": "object", + "required": [ + "address", + "mix_id" + ], + "properties": { + "address": { + "description": "Address of the vesting account in question.", + "type": "string" + }, + "mix_id": { + "description": "Id of the mixnode towards which the delegations have been made.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns all active delegations made with vesting tokens stored in this contract.", + "type": "object", + "required": [ + "get_all_delegations" + ], + "properties": { + "get_all_delegations": { + "type": "object", + "properties": { + "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", + "type": [ + "array", + "null" + ], + "items": [ + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + ], + "maxItems": 3, + "minItems": 3 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } + }, + "migrate": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MigrateMsg", + "type": "object", + "additionalProperties": false + }, + "sudo": null, + "responses": { + "get_account": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Account", + "description": "Vesting account information.", + "type": "object", + "required": [ + "coin", + "owner_address", + "periods", + "start_time", + "storage_key" + ], + "properties": { + "coin": { + "description": "The initial amount of coins used creation of this account.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "owner_address": { + "description": "Address of the owner of the vesting account.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "periods": { + "description": "All vesting periods for this account.", + "type": "array", + "items": { + "$ref": "#/definitions/VestingPeriod" + } + }, + "pledge_cap": { + "description": "Optional custom pledge cap of this vesting account.", + "default": null, + "anyOf": [ + { + "$ref": "#/definitions/PledgeCap" + }, + { + "type": "null" + } + ] + }, + "staking_address": { + "description": "Optional address of an account allowed to perform staking on behalf of the owner.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + }, + "start_time": { + "description": "The starting vesting time.", + "allOf": [ + { + "$ref": "#/definitions/Timestamp" + } + ] + }, + "storage_key": { + "description": "The id/storage_key of this vesting account.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Percent": { + "description": "Percent represents a value between 0 and 100% (i.e. between 0.0 and 1.0)", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "PledgeCap": { + "description": "Defines cap for pleding/staking tokens.", + "oneOf": [ + { + "description": "Specifies a percent-based pledge cap, i.e. only given % of tokens could be pledged/staked.", + "type": "object", + "required": [ + "percent" + ], + "properties": { + "percent": { + "$ref": "#/definitions/Percent" + } + }, + "additionalProperties": false + }, + { + "description": "Specifies an absolute pledge cap, i.e. an explicit value that could be pledged/staked.", + "type": "object", + "required": [ + "absolute" + ], + "properties": { + "absolute": { + "$ref": "#/definitions/Uint128" + } + }, + "additionalProperties": false + } + ] + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + }, + "VestingPeriod": { + "description": "Vesting period details.", + "type": "object", + "required": [ + "period_seconds", + "start_time" + ], + "properties": { + "period_seconds": { + "description": "The duration (in seconds) of the vesting period.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "start_time": { + "description": "The start time of this vesting period, as unix timestamp.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } + }, + "get_accounts_paged": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "AccountsResponse", + "description": "Response containing basic vesting account information", + "type": "object", + "required": [ + "accounts" + ], + "properties": { + "accounts": { + "description": "The actual accounts returned by the query.", + "type": "array", + "items": { + "$ref": "#/definitions/BaseVestingAccountInfo" + } + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "BaseVestingAccountInfo": { + "description": "Basic information regarding particular vesting account", + "type": "object", + "required": [ + "account_id", + "owner" + ], + "properties": { + "account_id": { + "description": "Id associated with this account", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "description": "Address of this account's owner", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + } + }, + "additionalProperties": false + } + } + }, + "get_accounts_vesting_coins_paged": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "VestingCoinsResponse", + "description": "Response containing vesting coins held in this contract", + "type": "object", + "required": [ + "accounts" + ], + "properties": { + "accounts": { + "description": "The actual accounts, and their vesting coins, returned by the query.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountVestingCoins" + } + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "AccountVestingCoins": { + "description": "Basic information regarding particular vesting account alongside the amount of vesting coins.", + "type": "object", + "required": [ + "account_id", + "owner", + "still_vesting" + ], + "properties": { + "account_id": { + "description": "Id associated with this account", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "description": "Address of this account's owner", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "still_vesting": { + "description": "Coins that are still vesting belonging to this account.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + } + }, + "additionalProperties": false + }, + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_all_delegations": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "AllDelegationsResponse", + "description": "Response containing paged list of all vesting delegations made using vesting coins.", + "type": "object", + "required": [ + "delegations" + ], + "properties": { + "delegations": { + "description": "The actual vesting delegations made.", + "type": "array", + "items": { + "$ref": "#/definitions/VestingDelegation" + } + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "array", + "null" + ], + "items": [ + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + ], + "maxItems": 3, + "minItems": 3 + } + }, + "additionalProperties": false, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "VestingDelegation": { + "description": "Details about particular vesting delegation.", + "type": "object", + "required": [ + "account_id", + "amount", + "block_timestamp", + "mix_id" + ], + "properties": { + "account_id": { + "description": "The id of the vesting account that has made the delegation.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "amount": { + "description": "The raw amount delegated (interpreted to be in the same denom as the underlying vesting specification)", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "block_timestamp": { + "description": "The block timestamp when the delegation has been made.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "mix_id": { + "description": "The id of the mixnode towards which the delegation has been made.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } + }, + "get_c_w2_contract_version": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ContractVersion", + "type": "object", + "required": [ + "contract", + "version" + ], + "properties": { + "contract": { + "description": "contract is the crate name of the implementing contract, eg. `crate:cw20-base` we will use other prefixes for other languages, and their standard global namespacing", + "type": "string" + }, + "version": { + "description": "version is any string that this implementation knows. It may be simple counter \"1\", \"2\". or semantic version on release tags \"v0.7.0\", or some custom feature flag list. the only code that needs to understand the version parsing is code that knows how to migrate from the given contract (and is tied to it's implementation somehow)", + "type": "string" + } + }, + "additionalProperties": false + }, + "get_contract_version": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ContractBuildInformation", + "type": "object", + "required": [ + "build_timestamp", + "build_version", + "commit_branch", + "commit_sha", + "commit_timestamp", + "rustc_version" + ], + "properties": { + "build_timestamp": { + "description": "Provides the build timestamp, for example `2021-02-23T20:14:46.558472672+00:00`.", + "type": "string" + }, + "build_version": { + "description": "Provides the build version, for example `0.1.0-9-g46f83e1`.", + "type": "string" + }, + "commit_branch": { + "description": "Provides the name of the git branch that was used for the build, for example `master`.", + "type": "string" + }, + "commit_sha": { + "description": "Provides the hash of the commit that was used for the build, for example `46f83e112520533338245862d366f6a02cef07d4`.", + "type": "string" + }, + "commit_timestamp": { + "description": "Provides the timestamp of the commit that was used for the build, for example `2021-02-23T08:08:02-05:00`.", + "type": "string" + }, + "rustc_version": { + "description": "Provides the rustc version that was used for the build, for example `1.52.0-nightly`.", + "type": "string" + } + }, + "additionalProperties": false + }, + "get_current_vesting_period": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Period", + "description": "The vesting period.", + "oneOf": [ + { + "description": "Defines a pre-vesting period.", + "type": "string", + "enum": [ + "before" + ] + }, + { + "description": "Defines currently active vesting period.", + "type": "object", + "required": [ + "in" + ], + "properties": { + "in": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "Defines a post-vesting period.", + "type": "string", + "enum": [ + "after" + ] + } + ] + }, + "get_delegated_coins": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Coin", + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + }, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_delegation": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "VestingDelegation", + "description": "Details about particular vesting delegation.", + "type": "object", + "required": [ + "account_id", + "amount", + "block_timestamp", + "mix_id" + ], + "properties": { + "account_id": { + "description": "The id of the vesting account that has made the delegation.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "amount": { + "description": "The raw amount delegated (interpreted to be in the same denom as the underlying vesting specification)", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "block_timestamp": { + "description": "The block timestamp when the delegation has been made.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "mix_id": { + "description": "The id of the mixnode towards which the delegation has been made.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_delegation_times": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "DelegationTimesResponse", + "description": "Response containing timestamps of all delegations made towards particular mixnode by given vesting account.", + "type": "object", + "required": [ + "account_id", + "delegation_timestamps", + "mix_id", + "owner" + ], + "properties": { + "account_id": { + "description": "Id associated with this account", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "delegation_timestamps": { + "description": "All timestamps where a delegation was made", + "type": "array", + "items": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "mix_id": { + "description": "Id of the mixnode towards which the delegation was made", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "description": "Address of this account's owner", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + } + } + }, + "get_end_time": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Timestamp", + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ], + "definitions": { + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } + }, + "get_gateway": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Nullable_PledgeData", + "anyOf": [ + { + "$ref": "#/definitions/PledgeData" + }, + { + "type": "null" + } + ], + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "PledgeData": { + "description": "Information regarding pledge (i.e. mixnode or gateway bonding) made with vesting tokens.", + "type": "object", + "required": [ + "amount", + "block_time" + ], + "properties": { + "amount": { + "description": "The amount pledged.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "block_time": { + "description": "The block timestamp where the pledge occurred.", + "allOf": [ + { + "$ref": "#/definitions/Timestamp" + } + ] + } + }, + "additionalProperties": false + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } + }, + "get_historical_vesting_staking_reward": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Coin", + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + }, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_mixnode": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Nullable_PledgeData", + "anyOf": [ + { + "$ref": "#/definitions/PledgeData" + }, + { + "type": "null" + } + ], + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "PledgeData": { + "description": "Information regarding pledge (i.e. mixnode or gateway bonding) made with vesting tokens.", + "type": "object", + "required": [ + "amount", + "block_time" + ], + "properties": { + "amount": { + "description": "The amount pledged.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "block_time": { + "description": "The block timestamp where the pledge occurred.", + "allOf": [ + { + "$ref": "#/definitions/Timestamp" + } + ] + } + }, + "additionalProperties": false + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } + }, + "get_original_vesting": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "OriginalVestingResponse", + "description": "Details about the original vesting specification used when the account was created.", + "type": "object", + "required": [ + "amount", + "number_of_periods", + "period_duration" + ], + "properties": { + "amount": { + "description": "The original amount that was used for the creation of this vesting account", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "number_of_periods": { + "description": "The number of vesting periods that the account was created with", + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "period_duration": { + "description": "Duration of each vesting period in seconds", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_pledged_coins": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Coin", + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + }, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_spendable_reward_coins": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Coin", + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + }, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_spendable_vested_coins": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Coin", + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + }, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_staked_coins": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Coin", + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + }, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_start_time": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Timestamp", + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ], + "definitions": { + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } + }, + "get_total_delegation_amount": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Coin", + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + }, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_vested_coins": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Coin", + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + }, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_vesting_coins": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Coin", + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + }, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "get_withdrawn_coins": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Coin", + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + }, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "locked_coins": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Coin", + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + }, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + }, + "spendable_coins": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Coin", + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + }, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } + } + } +} diff --git a/contracts/vesting/schema/raw/execute.json b/contracts/vesting/schema/raw/execute.json new file mode 100644 index 0000000000..be6d6a73ff --- /dev/null +++ b/contracts/vesting/schema/raw/execute.json @@ -0,0 +1,971 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "description": "Only owner of the node can crate the family with node as head", + "type": "object", + "required": [ + "create_family" + ], + "properties": { + "create_family": { + "type": "object", + "required": [ + "label" + ], + "properties": { + "label": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Family head needs to sign the joining node IdentityKey, the Node provides its signature signaling consent to join the family", + "type": "object", + "required": [ + "join_family" + ], + "properties": { + "join_family": { + "type": "object", + "required": [ + "family_head", + "join_permit" + ], + "properties": { + "family_head": { + "$ref": "#/definitions/FamilyHead" + }, + "join_permit": { + "$ref": "#/definitions/MessageSignature" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "leave_family" + ], + "properties": { + "leave_family": { + "type": "object", + "required": [ + "family_head" + ], + "properties": { + "family_head": { + "$ref": "#/definitions/FamilyHead" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "kick_family_member" + ], + "properties": { + "kick_family_member": { + "type": "object", + "required": [ + "member" + ], + "properties": { + "member": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "track_reward" + ], + "properties": { + "track_reward": { + "type": "object", + "required": [ + "address", + "amount" + ], + "properties": { + "address": { + "type": "string" + }, + "amount": { + "$ref": "#/definitions/Coin" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "claim_operator_reward" + ], + "properties": { + "claim_operator_reward": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "claim_delegator_reward" + ], + "properties": { + "claim_delegator_reward": { + "type": "object", + "required": [ + "mix_id" + ], + "properties": { + "mix_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_mixnode_cost_params" + ], + "properties": { + "update_mixnode_cost_params": { + "type": "object", + "required": [ + "new_costs" + ], + "properties": { + "new_costs": { + "$ref": "#/definitions/MixNodeCostParams" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_mixnode_config" + ], + "properties": { + "update_mixnode_config": { + "type": "object", + "required": [ + "new_config" + ], + "properties": { + "new_config": { + "$ref": "#/definitions/MixNodeConfigUpdate" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_mixnet_address" + ], + "properties": { + "update_mixnet_address": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "delegate_to_mixnode" + ], + "properties": { + "delegate_to_mixnode": { + "type": "object", + "required": [ + "amount", + "mix_id" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "mix_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "on_behalf_of": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "undelegate_from_mixnode" + ], + "properties": { + "undelegate_from_mixnode": { + "type": "object", + "required": [ + "mix_id" + ], + "properties": { + "mix_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "on_behalf_of": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "create_account" + ], + "properties": { + "create_account": { + "type": "object", + "required": [ + "owner_address" + ], + "properties": { + "cap": { + "anyOf": [ + { + "$ref": "#/definitions/PledgeCap" + }, + { + "type": "null" + } + ] + }, + "owner_address": { + "type": "string" + }, + "staking_address": { + "type": [ + "string", + "null" + ] + }, + "vesting_spec": { + "anyOf": [ + { + "$ref": "#/definitions/VestingSpecification" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "withdraw_vested_coins" + ], + "properties": { + "withdraw_vested_coins": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "track_undelegation" + ], + "properties": { + "track_undelegation": { + "type": "object", + "required": [ + "amount", + "mix_id", + "owner" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "mix_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "bond_mixnode" + ], + "properties": { + "bond_mixnode": { + "type": "object", + "required": [ + "amount", + "cost_params", + "mix_node", + "owner_signature" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "cost_params": { + "$ref": "#/definitions/MixNodeCostParams" + }, + "mix_node": { + "$ref": "#/definitions/MixNode" + }, + "owner_signature": { + "$ref": "#/definitions/MessageSignature" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "pledge_more" + ], + "properties": { + "pledge_more": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "decrease_pledge" + ], + "properties": { + "decrease_pledge": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "unbond_mixnode" + ], + "properties": { + "unbond_mixnode": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "track_unbond_mixnode" + ], + "properties": { + "track_unbond_mixnode": { + "type": "object", + "required": [ + "amount", + "owner" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "owner": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "track_decrease_pledge" + ], + "properties": { + "track_decrease_pledge": { + "type": "object", + "required": [ + "amount", + "owner" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "owner": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "bond_gateway" + ], + "properties": { + "bond_gateway": { + "type": "object", + "required": [ + "amount", + "gateway", + "owner_signature" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "gateway": { + "$ref": "#/definitions/Gateway" + }, + "owner_signature": { + "$ref": "#/definitions/MessageSignature" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "unbond_gateway" + ], + "properties": { + "unbond_gateway": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "track_unbond_gateway" + ], + "properties": { + "track_unbond_gateway": { + "type": "object", + "required": [ + "amount", + "owner" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "owner": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_gateway_config" + ], + "properties": { + "update_gateway_config": { + "type": "object", + "required": [ + "new_config" + ], + "properties": { + "new_config": { + "$ref": "#/definitions/GatewayConfigUpdate" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "transfer_ownership" + ], + "properties": { + "transfer_ownership": { + "type": "object", + "required": [ + "to_address" + ], + "properties": { + "to_address": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_staking_address" + ], + "properties": { + "update_staking_address": { + "type": "object", + "properties": { + "to_address": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_locked_pledge_cap" + ], + "properties": { + "update_locked_pledge_cap": { + "type": "object", + "required": [ + "address", + "cap" + ], + "properties": { + "address": { + "type": "string" + }, + "cap": { + "$ref": "#/definitions/PledgeCap" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "FamilyHead": { + "description": "Head of particular family as identified by its identity key (i.e. public component of its ed25519 keypair stringified into base58).", + "type": "string" + }, + "Gateway": { + "description": "Information provided by the node operator during bonding that are used to allow other entities to use the services of this node.", + "type": "object", + "required": [ + "clients_port", + "host", + "identity_key", + "location", + "mix_port", + "sphinx_key", + "version" + ], + "properties": { + "clients_port": { + "description": "Port used by this gateway for listening for client requests.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "host": { + "description": "Network address of this gateway, for example 1.1.1.1 or foo.gateway.com", + "type": "string" + }, + "identity_key": { + "description": "Base58 encoded ed25519 EdDSA public key of the gateway used to derive shared keys with clients", + "type": "string" + }, + "location": { + "description": "The physical, self-reported, location of this gateway.", + "type": "string" + }, + "mix_port": { + "description": "Port used by this gateway for listening for mix packets.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "sphinx_key": { + "description": "Base58-encoded x25519 public key used for sphinx key derivation.", + "type": "string" + }, + "version": { + "description": "The self-reported semver version of this gateway.", + "type": "string" + } + }, + "additionalProperties": false + }, + "GatewayConfigUpdate": { + "type": "object", + "required": [ + "clients_port", + "host", + "location", + "mix_port", + "version" + ], + "properties": { + "clients_port": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "host": { + "type": "string" + }, + "location": { + "type": "string" + }, + "mix_port": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "version": { + "type": "string" + } + }, + "additionalProperties": false + }, + "MessageSignature": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + }, + "MixNode": { + "description": "Information provided by the node operator during bonding that are used to allow other entities to use the services of this node.", + "type": "object", + "required": [ + "host", + "http_api_port", + "identity_key", + "mix_port", + "sphinx_key", + "verloc_port", + "version" + ], + "properties": { + "host": { + "description": "Network address of this mixnode, for example 1.1.1.1 or foo.mixnode.com", + "type": "string" + }, + "http_api_port": { + "description": "Port used by this mixnode for its http(s) API", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "identity_key": { + "description": "Base58-encoded ed25519 EdDSA public key.", + "type": "string" + }, + "mix_port": { + "description": "Port used by this mixnode for listening for mix packets.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "sphinx_key": { + "description": "Base58-encoded x25519 public key used for sphinx key derivation.", + "type": "string" + }, + "verloc_port": { + "description": "Port used by this mixnode for listening for verloc requests.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "version": { + "description": "The self-reported semver version of this mixnode.", + "type": "string" + } + }, + "additionalProperties": false + }, + "MixNodeConfigUpdate": { + "type": "object", + "required": [ + "host", + "http_api_port", + "mix_port", + "verloc_port", + "version" + ], + "properties": { + "host": { + "type": "string" + }, + "http_api_port": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "mix_port": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "verloc_port": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "version": { + "type": "string" + } + }, + "additionalProperties": false + }, + "MixNodeCostParams": { + "description": "The cost parameters, or the cost function, defined for the particular mixnode that influences how the rewards should be split between the node operator and its delegators.", + "type": "object", + "required": [ + "interval_operating_cost", + "profit_margin_percent" + ], + "properties": { + "interval_operating_cost": { + "description": "Operating cost of the associated mixnode per the entire interval.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "profit_margin_percent": { + "description": "The profit margin of the associated mixnode, i.e. the desired percent of the reward to be distributed to the operator.", + "allOf": [ + { + "$ref": "#/definitions/Percent" + } + ] + } + }, + "additionalProperties": false + }, + "Percent": { + "description": "Percent represents a value between 0 and 100% (i.e. between 0.0 and 1.0)", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "PledgeCap": { + "description": "Defines cap for pleding/staking tokens.", + "oneOf": [ + { + "description": "Specifies a percent-based pledge cap, i.e. only given % of tokens could be pledged/staked.", + "type": "object", + "required": [ + "percent" + ], + "properties": { + "percent": { + "$ref": "#/definitions/Percent" + } + }, + "additionalProperties": false + }, + { + "description": "Specifies an absolute pledge cap, i.e. an explicit value that could be pledged/staked.", + "type": "object", + "required": [ + "absolute" + ], + "properties": { + "absolute": { + "$ref": "#/definitions/Uint128" + } + }, + "additionalProperties": false + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "VestingSpecification": { + "type": "object", + "properties": { + "num_periods": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "period_seconds": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "start_time": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/vesting/schema/raw/instantiate.json b/contracts/vesting/schema/raw/instantiate.json new file mode 100644 index 0000000000..09b7526278 --- /dev/null +++ b/contracts/vesting/schema/raw/instantiate.json @@ -0,0 +1,18 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "mix_denom", + "mixnet_contract_address" + ], + "properties": { + "mix_denom": { + "type": "string" + }, + "mixnet_contract_address": { + "type": "string" + } + }, + "additionalProperties": false +} diff --git a/contracts/vesting/schema/raw/migrate.json b/contracts/vesting/schema/raw/migrate.json new file mode 100644 index 0000000000..7fbe8c5708 --- /dev/null +++ b/contracts/vesting/schema/raw/migrate.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MigrateMsg", + "type": "object", + "additionalProperties": false +} diff --git a/contracts/vesting/schema/raw/query.json b/contracts/vesting/schema/raw/query.json new file mode 100644 index 0000000000..42b1cd94ea --- /dev/null +++ b/contracts/vesting/schema/raw/query.json @@ -0,0 +1,719 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "description": "Queries exposed by this contract.", + "oneOf": [ + { + "description": "Gets build information of this contract, such as the commit hash used for the build or rustc version.", + "type": "object", + "required": [ + "get_contract_version" + ], + "properties": { + "get_contract_version": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the stored contract version information that's required by the CW2 spec interface for migrations.", + "type": "object", + "required": [ + "get_cw2_contract_version" + ], + "properties": { + "get_cw2_contract_version": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the list of vesting accounts held in this contract.", + "type": "object", + "required": [ + "get_accounts_paged" + ], + "properties": { + "get_accounts_paged": { + "type": "object", + "properties": { + "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_next_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Gets the list of coins that are still vesting for each account held in this contract.", + "type": "object", + "required": [ + "get_accounts_vesting_coins_paged" + ], + "properties": { + "get_accounts_vesting_coins_paged": { + "type": "object", + "properties": { + "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_next_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the amount of locked coins for the provided vesting account, i.e. coins that are still vesting but have not been staked. `locked_coins = vesting_coins - staked_coins`", + "type": "object", + "required": [ + "locked_coins" + ], + "properties": { + "locked_coins": { + "type": "object", + "required": [ + "vesting_account_address" + ], + "properties": { + "block_time": { + "description": "(deprecated) Optional argument specifying that the query should be performed against non-current block.", + "anyOf": [ + { + "$ref": "#/definitions/Timestamp" + }, + { + "type": "null" + } + ] + }, + "vesting_account_address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the amount of spendable coins for the provided vesting account, i.e. coins that could be withdrawn. `spendable_coins = account_balance - locked_coins` note: `account_balance` is the amount of coins still physically present in this contract, i.e. not withdrawn or staked.", + "type": "object", + "required": [ + "spendable_coins" + ], + "properties": { + "spendable_coins": { + "type": "object", + "required": [ + "vesting_account_address" + ], + "properties": { + "block_time": { + "description": "(deprecated) Optional argument specifying that the query should be performed against non-current block.", + "anyOf": [ + { + "$ref": "#/definitions/Timestamp" + }, + { + "type": "null" + } + ] + }, + "vesting_account_address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the amount of coins that have already vested for the provided vesting account address.", + "type": "object", + "required": [ + "get_vested_coins" + ], + "properties": { + "get_vested_coins": { + "type": "object", + "required": [ + "vesting_account_address" + ], + "properties": { + "block_time": { + "description": "(deprecated) Optional argument specifying that the query should be performed against non-current block.", + "anyOf": [ + { + "$ref": "#/definitions/Timestamp" + }, + { + "type": "null" + } + ] + }, + "vesting_account_address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the amount of coins that are still vesting for the provided vesting account address.", + "type": "object", + "required": [ + "get_vesting_coins" + ], + "properties": { + "get_vesting_coins": { + "type": "object", + "required": [ + "vesting_account_address" + ], + "properties": { + "block_time": { + "description": "(deprecated) Optional argument specifying that the query should be performed against non-current block.", + "anyOf": [ + { + "$ref": "#/definitions/Timestamp" + }, + { + "type": "null" + } + ] + }, + "vesting_account_address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the starting vesting time for the provided vesting account, i.e. the beginning of the first vesting period.", + "type": "object", + "required": [ + "get_start_time" + ], + "properties": { + "get_start_time": { + "type": "object", + "required": [ + "vesting_account_address" + ], + "properties": { + "vesting_account_address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the ending vesting time for the provided vesting account, i.e. the end of the last vesting period.", + "type": "object", + "required": [ + "get_end_time" + ], + "properties": { + "get_end_time": { + "type": "object", + "required": [ + "vesting_account_address" + ], + "properties": { + "vesting_account_address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the initial vesting specification used for the provided vesting account address.", + "type": "object", + "required": [ + "get_original_vesting" + ], + "properties": { + "get_original_vesting": { + "type": "object", + "required": [ + "vesting_account_address" + ], + "properties": { + "vesting_account_address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the total amount of coins accrued through claimed staking rewards by the provided vesting account.", + "type": "object", + "required": [ + "get_historical_vesting_staking_reward" + ], + "properties": { + "get_historical_vesting_staking_reward": { + "type": "object", + "required": [ + "vesting_account_address" + ], + "properties": { + "vesting_account_address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the amount of spendable vesting coins for the provided vesting account, i.e. coins that could be withdrawn that originated from the vesting specification.", + "type": "object", + "required": [ + "get_spendable_vested_coins" + ], + "properties": { + "get_spendable_vested_coins": { + "type": "object", + "required": [ + "vesting_account_address" + ], + "properties": { + "vesting_account_address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the amount of spendable reward coins for the provided vesting account, i.e. coins that could be withdrawn that originated from the claimed staking rewards.", + "type": "object", + "required": [ + "get_spendable_reward_coins" + ], + "properties": { + "get_spendable_reward_coins": { + "type": "object", + "required": [ + "vesting_account_address" + ], + "properties": { + "vesting_account_address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the amount of coins that are currently delegated for the provided vesting account address.", + "type": "object", + "required": [ + "get_delegated_coins" + ], + "properties": { + "get_delegated_coins": { + "type": "object", + "required": [ + "vesting_account_address" + ], + "properties": { + "vesting_account_address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the amount of coins that are currently pledged for the provided vesting account address.", + "type": "object", + "required": [ + "get_pledged_coins" + ], + "properties": { + "get_pledged_coins": { + "type": "object", + "required": [ + "vesting_account_address" + ], + "properties": { + "vesting_account_address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the amount of coins that are currently staked (i.e. delegations + pledges) for the provided vesting account address.", + "type": "object", + "required": [ + "get_staked_coins" + ], + "properties": { + "get_staked_coins": { + "type": "object", + "required": [ + "vesting_account_address" + ], + "properties": { + "vesting_account_address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the amount of coins that got withdrawn for the provided vesting account address.", + "type": "object", + "required": [ + "get_withdrawn_coins" + ], + "properties": { + "get_withdrawn_coins": { + "type": "object", + "required": [ + "vesting_account_address" + ], + "properties": { + "vesting_account_address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns detailed information associated with the account for the provided vesting account address.", + "type": "object", + "required": [ + "get_account" + ], + "properties": { + "get_account": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns pledge information (if applicable) for bonded mixnode for the provided vesting account address.", + "type": "object", + "required": [ + "get_mixnode" + ], + "properties": { + "get_mixnode": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns pledge information (if applicable) for bonded gateway for the provided vesting account address.", + "type": "object", + "required": [ + "get_gateway" + ], + "properties": { + "get_gateway": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the current vesting period for the provided vesting account address.", + "type": "object", + "required": [ + "get_current_vesting_period" + ], + "properties": { + "get_current_vesting_period": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "description": "Address of the vesting account in question.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the information about particular vesting delegation.", + "type": "object", + "required": [ + "get_delegation" + ], + "properties": { + "get_delegation": { + "type": "object", + "required": [ + "address", + "block_timestamp_secs", + "mix_id" + ], + "properties": { + "address": { + "description": "Address of the vesting account in question.", + "type": "string" + }, + "block_timestamp_secs": { + "description": "Block timestamp of the delegation.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "mix_id": { + "description": "Id of the mixnode towards which the delegation has been made.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the total amount of coins delegated towards particular mixnode by the provided vesting account address.", + "type": "object", + "required": [ + "get_total_delegation_amount" + ], + "properties": { + "get_total_delegation_amount": { + "type": "object", + "required": [ + "address", + "mix_id" + ], + "properties": { + "address": { + "description": "Address of the vesting account in question.", + "type": "string" + }, + "mix_id": { + "description": "Id of the mixnode towards which the delegations have been made.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns timestamps of delegations made towards particular mixnode by the provided vesting account address.", + "type": "object", + "required": [ + "get_delegation_times" + ], + "properties": { + "get_delegation_times": { + "type": "object", + "required": [ + "address", + "mix_id" + ], + "properties": { + "address": { + "description": "Address of the vesting account in question.", + "type": "string" + }, + "mix_id": { + "description": "Id of the mixnode towards which the delegations have been made.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns all active delegations made with vesting tokens stored in this contract.", + "type": "object", + "required": [ + "get_all_delegations" + ], + "properties": { + "get_all_delegations": { + "type": "object", + "properties": { + "limit": { + "description": "Controls the maximum number of entries returned by the query. Note that too large values will be overwritten by a saner default.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "description": "Pagination control for the values returned by the query. Note that the provided value itself will **not** be used for the response.", + "type": [ + "array", + "null" + ], + "items": [ + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + ], + "maxItems": 3, + "minItems": 3 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/vesting/schema/raw/response_to_get_account.json b/contracts/vesting/schema/raw/response_to_get_account.json new file mode 100644 index 0000000000..7d8544539b --- /dev/null +++ b/contracts/vesting/schema/raw/response_to_get_account.json @@ -0,0 +1,179 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Account", + "description": "Vesting account information.", + "type": "object", + "required": [ + "coin", + "owner_address", + "periods", + "start_time", + "storage_key" + ], + "properties": { + "coin": { + "description": "The initial amount of coins used creation of this account.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "owner_address": { + "description": "Address of the owner of the vesting account.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "periods": { + "description": "All vesting periods for this account.", + "type": "array", + "items": { + "$ref": "#/definitions/VestingPeriod" + } + }, + "pledge_cap": { + "description": "Optional custom pledge cap of this vesting account.", + "default": null, + "anyOf": [ + { + "$ref": "#/definitions/PledgeCap" + }, + { + "type": "null" + } + ] + }, + "staking_address": { + "description": "Optional address of an account allowed to perform staking on behalf of the owner.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + }, + "start_time": { + "description": "The starting vesting time.", + "allOf": [ + { + "$ref": "#/definitions/Timestamp" + } + ] + }, + "storage_key": { + "description": "The id/storage_key of this vesting account.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Percent": { + "description": "Percent represents a value between 0 and 100% (i.e. between 0.0 and 1.0)", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "PledgeCap": { + "description": "Defines cap for pleding/staking tokens.", + "oneOf": [ + { + "description": "Specifies a percent-based pledge cap, i.e. only given % of tokens could be pledged/staked.", + "type": "object", + "required": [ + "percent" + ], + "properties": { + "percent": { + "$ref": "#/definitions/Percent" + } + }, + "additionalProperties": false + }, + { + "description": "Specifies an absolute pledge cap, i.e. an explicit value that could be pledged/staked.", + "type": "object", + "required": [ + "absolute" + ], + "properties": { + "absolute": { + "$ref": "#/definitions/Uint128" + } + }, + "additionalProperties": false + } + ] + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + }, + "VestingPeriod": { + "description": "Vesting period details.", + "type": "object", + "required": [ + "period_seconds", + "start_time" + ], + "properties": { + "period_seconds": { + "description": "The duration (in seconds) of the vesting period.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "start_time": { + "description": "The start time of this vesting period, as unix timestamp.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/vesting/schema/raw/response_to_get_accounts_paged.json b/contracts/vesting/schema/raw/response_to_get_accounts_paged.json new file mode 100644 index 0000000000..f84ed729b8 --- /dev/null +++ b/contracts/vesting/schema/raw/response_to_get_accounts_paged.json @@ -0,0 +1,61 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "AccountsResponse", + "description": "Response containing basic vesting account information", + "type": "object", + "required": [ + "accounts" + ], + "properties": { + "accounts": { + "description": "The actual accounts returned by the query.", + "type": "array", + "items": { + "$ref": "#/definitions/BaseVestingAccountInfo" + } + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "BaseVestingAccountInfo": { + "description": "Basic information regarding particular vesting account", + "type": "object", + "required": [ + "account_id", + "owner" + ], + "properties": { + "account_id": { + "description": "Id associated with this account", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "description": "Address of this account's owner", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/vesting/schema/raw/response_to_get_accounts_vesting_coins_paged.json b/contracts/vesting/schema/raw/response_to_get_accounts_vesting_coins_paged.json new file mode 100644 index 0000000000..6647e14194 --- /dev/null +++ b/contracts/vesting/schema/raw/response_to_get_accounts_vesting_coins_paged.json @@ -0,0 +1,89 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "VestingCoinsResponse", + "description": "Response containing vesting coins held in this contract", + "type": "object", + "required": [ + "accounts" + ], + "properties": { + "accounts": { + "description": "The actual accounts, and their vesting coins, returned by the query.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountVestingCoins" + } + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "AccountVestingCoins": { + "description": "Basic information regarding particular vesting account alongside the amount of vesting coins.", + "type": "object", + "required": [ + "account_id", + "owner", + "still_vesting" + ], + "properties": { + "account_id": { + "description": "Id associated with this account", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "description": "Address of this account's owner", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "still_vesting": { + "description": "Coins that are still vesting belonging to this account.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + } + }, + "additionalProperties": false + }, + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/vesting/schema/raw/response_to_get_all_delegations.json b/contracts/vesting/schema/raw/response_to_get_all_delegations.json new file mode 100644 index 0000000000..89de917311 --- /dev/null +++ b/contracts/vesting/schema/raw/response_to_get_all_delegations.json @@ -0,0 +1,90 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "AllDelegationsResponse", + "description": "Response containing paged list of all vesting delegations made using vesting coins.", + "type": "object", + "required": [ + "delegations" + ], + "properties": { + "delegations": { + "description": "The actual vesting delegations made.", + "type": "array", + "items": { + "$ref": "#/definitions/VestingDelegation" + } + }, + "start_next_after": { + "description": "Field indicating paging information for the following queries if the caller wishes to get further entries.", + "type": [ + "array", + "null" + ], + "items": [ + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + ], + "maxItems": 3, + "minItems": 3 + } + }, + "additionalProperties": false, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "VestingDelegation": { + "description": "Details about particular vesting delegation.", + "type": "object", + "required": [ + "account_id", + "amount", + "block_timestamp", + "mix_id" + ], + "properties": { + "account_id": { + "description": "The id of the vesting account that has made the delegation.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "amount": { + "description": "The raw amount delegated (interpreted to be in the same denom as the underlying vesting specification)", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "block_timestamp": { + "description": "The block timestamp when the delegation has been made.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "mix_id": { + "description": "The id of the mixnode towards which the delegation has been made.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/vesting/schema/raw/response_to_get_c_w2_contract_version.json b/contracts/vesting/schema/raw/response_to_get_c_w2_contract_version.json new file mode 100644 index 0000000000..3ded8c84d9 --- /dev/null +++ b/contracts/vesting/schema/raw/response_to_get_c_w2_contract_version.json @@ -0,0 +1,20 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ContractVersion", + "type": "object", + "required": [ + "contract", + "version" + ], + "properties": { + "contract": { + "description": "contract is the crate name of the implementing contract, eg. `crate:cw20-base` we will use other prefixes for other languages, and their standard global namespacing", + "type": "string" + }, + "version": { + "description": "version is any string that this implementation knows. It may be simple counter \"1\", \"2\". or semantic version on release tags \"v0.7.0\", or some custom feature flag list. the only code that needs to understand the version parsing is code that knows how to migrate from the given contract (and is tied to it's implementation somehow)", + "type": "string" + } + }, + "additionalProperties": false +} diff --git a/contracts/vesting/schema/raw/response_to_get_contract_version.json b/contracts/vesting/schema/raw/response_to_get_contract_version.json new file mode 100644 index 0000000000..60ae65f3d1 --- /dev/null +++ b/contracts/vesting/schema/raw/response_to_get_contract_version.json @@ -0,0 +1,40 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ContractBuildInformation", + "type": "object", + "required": [ + "build_timestamp", + "build_version", + "commit_branch", + "commit_sha", + "commit_timestamp", + "rustc_version" + ], + "properties": { + "build_timestamp": { + "description": "Provides the build timestamp, for example `2021-02-23T20:14:46.558472672+00:00`.", + "type": "string" + }, + "build_version": { + "description": "Provides the build version, for example `0.1.0-9-g46f83e1`.", + "type": "string" + }, + "commit_branch": { + "description": "Provides the name of the git branch that was used for the build, for example `master`.", + "type": "string" + }, + "commit_sha": { + "description": "Provides the hash of the commit that was used for the build, for example `46f83e112520533338245862d366f6a02cef07d4`.", + "type": "string" + }, + "commit_timestamp": { + "description": "Provides the timestamp of the commit that was used for the build, for example `2021-02-23T08:08:02-05:00`.", + "type": "string" + }, + "rustc_version": { + "description": "Provides the rustc version that was used for the build, for example `1.52.0-nightly`.", + "type": "string" + } + }, + "additionalProperties": false +} diff --git a/contracts/vesting/schema/raw/response_to_get_current_vesting_period.json b/contracts/vesting/schema/raw/response_to_get_current_vesting_period.json new file mode 100644 index 0000000000..e001a46a2c --- /dev/null +++ b/contracts/vesting/schema/raw/response_to_get_current_vesting_period.json @@ -0,0 +1,36 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Period", + "description": "The vesting period.", + "oneOf": [ + { + "description": "Defines a pre-vesting period.", + "type": "string", + "enum": [ + "before" + ] + }, + { + "description": "Defines currently active vesting period.", + "type": "object", + "required": [ + "in" + ], + "properties": { + "in": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "Defines a post-vesting period.", + "type": "string", + "enum": [ + "after" + ] + } + ] +} diff --git a/contracts/vesting/schema/raw/response_to_get_delegated_coins.json b/contracts/vesting/schema/raw/response_to_get_delegated_coins.json new file mode 100644 index 0000000000..6e18ef9a9b --- /dev/null +++ b/contracts/vesting/schema/raw/response_to_get_delegated_coins.json @@ -0,0 +1,23 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Coin", + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + }, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/vesting/schema/raw/response_to_get_delegation.json b/contracts/vesting/schema/raw/response_to_get_delegation.json new file mode 100644 index 0000000000..75c770ef66 --- /dev/null +++ b/contracts/vesting/schema/raw/response_to_get_delegation.json @@ -0,0 +1,47 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "VestingDelegation", + "description": "Details about particular vesting delegation.", + "type": "object", + "required": [ + "account_id", + "amount", + "block_timestamp", + "mix_id" + ], + "properties": { + "account_id": { + "description": "The id of the vesting account that has made the delegation.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "amount": { + "description": "The raw amount delegated (interpreted to be in the same denom as the underlying vesting specification)", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "block_timestamp": { + "description": "The block timestamp when the delegation has been made.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "mix_id": { + "description": "The id of the mixnode towards which the delegation has been made.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/vesting/schema/raw/response_to_get_delegation_times.json b/contracts/vesting/schema/raw/response_to_get_delegation_times.json new file mode 100644 index 0000000000..0ac43e6513 --- /dev/null +++ b/contracts/vesting/schema/raw/response_to_get_delegation_times.json @@ -0,0 +1,50 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "DelegationTimesResponse", + "description": "Response containing timestamps of all delegations made towards particular mixnode by given vesting account.", + "type": "object", + "required": [ + "account_id", + "delegation_timestamps", + "mix_id", + "owner" + ], + "properties": { + "account_id": { + "description": "Id associated with this account", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "delegation_timestamps": { + "description": "All timestamps where a delegation was made", + "type": "array", + "items": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "mix_id": { + "description": "Id of the mixnode towards which the delegation was made", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "description": "Address of this account's owner", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + } + } +} diff --git a/contracts/vesting/schema/raw/response_to_get_end_time.json b/contracts/vesting/schema/raw/response_to_get_end_time.json new file mode 100644 index 0000000000..6dd9971a14 --- /dev/null +++ b/contracts/vesting/schema/raw/response_to_get_end_time.json @@ -0,0 +1,16 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Timestamp", + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ], + "definitions": { + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/vesting/schema/raw/response_to_get_gateway.json b/contracts/vesting/schema/raw/response_to_get_gateway.json new file mode 100644 index 0000000000..1a18cd9f84 --- /dev/null +++ b/contracts/vesting/schema/raw/response_to_get_gateway.json @@ -0,0 +1,72 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Nullable_PledgeData", + "anyOf": [ + { + "$ref": "#/definitions/PledgeData" + }, + { + "type": "null" + } + ], + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "PledgeData": { + "description": "Information regarding pledge (i.e. mixnode or gateway bonding) made with vesting tokens.", + "type": "object", + "required": [ + "amount", + "block_time" + ], + "properties": { + "amount": { + "description": "The amount pledged.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "block_time": { + "description": "The block timestamp where the pledge occurred.", + "allOf": [ + { + "$ref": "#/definitions/Timestamp" + } + ] + } + }, + "additionalProperties": false + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/vesting/schema/raw/response_to_get_historical_vesting_staking_reward.json b/contracts/vesting/schema/raw/response_to_get_historical_vesting_staking_reward.json new file mode 100644 index 0000000000..6e18ef9a9b --- /dev/null +++ b/contracts/vesting/schema/raw/response_to_get_historical_vesting_staking_reward.json @@ -0,0 +1,23 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Coin", + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + }, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/vesting/schema/raw/response_to_get_mixnode.json b/contracts/vesting/schema/raw/response_to_get_mixnode.json new file mode 100644 index 0000000000..1a18cd9f84 --- /dev/null +++ b/contracts/vesting/schema/raw/response_to_get_mixnode.json @@ -0,0 +1,72 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Nullable_PledgeData", + "anyOf": [ + { + "$ref": "#/definitions/PledgeData" + }, + { + "type": "null" + } + ], + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "PledgeData": { + "description": "Information regarding pledge (i.e. mixnode or gateway bonding) made with vesting tokens.", + "type": "object", + "required": [ + "amount", + "block_time" + ], + "properties": { + "amount": { + "description": "The amount pledged.", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "block_time": { + "description": "The block timestamp where the pledge occurred.", + "allOf": [ + { + "$ref": "#/definitions/Timestamp" + } + ] + } + }, + "additionalProperties": false + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/vesting/schema/raw/response_to_get_original_vesting.json b/contracts/vesting/schema/raw/response_to_get_original_vesting.json new file mode 100644 index 0000000000..0b0ced2dec --- /dev/null +++ b/contracts/vesting/schema/raw/response_to_get_original_vesting.json @@ -0,0 +1,55 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "OriginalVestingResponse", + "description": "Details about the original vesting specification used when the account was created.", + "type": "object", + "required": [ + "amount", + "number_of_periods", + "period_duration" + ], + "properties": { + "amount": { + "description": "The original amount that was used for the creation of this vesting account", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "number_of_periods": { + "description": "The number of vesting periods that the account was created with", + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "period_duration": { + "description": "Duration of each vesting period in seconds", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/vesting/schema/raw/response_to_get_pledged_coins.json b/contracts/vesting/schema/raw/response_to_get_pledged_coins.json new file mode 100644 index 0000000000..6e18ef9a9b --- /dev/null +++ b/contracts/vesting/schema/raw/response_to_get_pledged_coins.json @@ -0,0 +1,23 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Coin", + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + }, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/vesting/schema/raw/response_to_get_spendable_reward_coins.json b/contracts/vesting/schema/raw/response_to_get_spendable_reward_coins.json new file mode 100644 index 0000000000..6e18ef9a9b --- /dev/null +++ b/contracts/vesting/schema/raw/response_to_get_spendable_reward_coins.json @@ -0,0 +1,23 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Coin", + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + }, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/vesting/schema/raw/response_to_get_spendable_vested_coins.json b/contracts/vesting/schema/raw/response_to_get_spendable_vested_coins.json new file mode 100644 index 0000000000..6e18ef9a9b --- /dev/null +++ b/contracts/vesting/schema/raw/response_to_get_spendable_vested_coins.json @@ -0,0 +1,23 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Coin", + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + }, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/vesting/schema/raw/response_to_get_staked_coins.json b/contracts/vesting/schema/raw/response_to_get_staked_coins.json new file mode 100644 index 0000000000..6e18ef9a9b --- /dev/null +++ b/contracts/vesting/schema/raw/response_to_get_staked_coins.json @@ -0,0 +1,23 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Coin", + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + }, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/vesting/schema/raw/response_to_get_start_time.json b/contracts/vesting/schema/raw/response_to_get_start_time.json new file mode 100644 index 0000000000..6dd9971a14 --- /dev/null +++ b/contracts/vesting/schema/raw/response_to_get_start_time.json @@ -0,0 +1,16 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Timestamp", + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ], + "definitions": { + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/vesting/schema/raw/response_to_get_total_delegation_amount.json b/contracts/vesting/schema/raw/response_to_get_total_delegation_amount.json new file mode 100644 index 0000000000..6e18ef9a9b --- /dev/null +++ b/contracts/vesting/schema/raw/response_to_get_total_delegation_amount.json @@ -0,0 +1,23 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Coin", + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + }, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/vesting/schema/raw/response_to_get_vested_coins.json b/contracts/vesting/schema/raw/response_to_get_vested_coins.json new file mode 100644 index 0000000000..6e18ef9a9b --- /dev/null +++ b/contracts/vesting/schema/raw/response_to_get_vested_coins.json @@ -0,0 +1,23 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Coin", + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + }, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/vesting/schema/raw/response_to_get_vesting_coins.json b/contracts/vesting/schema/raw/response_to_get_vesting_coins.json new file mode 100644 index 0000000000..6e18ef9a9b --- /dev/null +++ b/contracts/vesting/schema/raw/response_to_get_vesting_coins.json @@ -0,0 +1,23 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Coin", + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + }, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/vesting/schema/raw/response_to_get_withdrawn_coins.json b/contracts/vesting/schema/raw/response_to_get_withdrawn_coins.json new file mode 100644 index 0000000000..6e18ef9a9b --- /dev/null +++ b/contracts/vesting/schema/raw/response_to_get_withdrawn_coins.json @@ -0,0 +1,23 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Coin", + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + }, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/vesting/schema/raw/response_to_locked_coins.json b/contracts/vesting/schema/raw/response_to_locked_coins.json new file mode 100644 index 0000000000..6e18ef9a9b --- /dev/null +++ b/contracts/vesting/schema/raw/response_to_locked_coins.json @@ -0,0 +1,23 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Coin", + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + }, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/vesting/schema/raw/response_to_spendable_coins.json b/contracts/vesting/schema/raw/response_to_spendable_coins.json new file mode 100644 index 0000000000..6e18ef9a9b --- /dev/null +++ b/contracts/vesting/schema/raw/response_to_spendable_coins.json @@ -0,0 +1,23 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Coin", + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + }, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/vesting/src/bin/schema.rs b/contracts/vesting/src/bin/schema.rs new file mode 100644 index 0000000000..fc95866f6d --- /dev/null +++ b/contracts/vesting/src/bin/schema.rs @@ -0,0 +1,14 @@ +// Copyright 2023 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use cosmwasm_schema::write_api; +use vesting_contract_common::{ExecuteMsg, InitMsg, MigrateMsg, QueryMsg}; + +fn main() { + write_api! { + instantiate: InitMsg, + query: QueryMsg, + execute: ExecuteMsg, + migrate: MigrateMsg, + } +} diff --git a/contracts/vesting/src/contract.rs b/contracts/vesting/src/contract.rs index 54db2d9464..31d3c21b06 100644 --- a/contracts/vesting/src/contract.rs +++ b/contracts/vesting/src/contract.rs @@ -1,14 +1,13 @@ -use crate::errors::ContractError; pub use crate::queries::*; use crate::storage::{ADMIN, MIXNET_CONTRACT_ADDRESS, MIX_DENOM}; pub use crate::transactions::*; -use crate::vesting::Account; use cosmwasm_std::{ entry_point, to_binary, Addr, Coin, Deps, DepsMut, Env, MessageInfo, QueryResponse, Response, Uint128, }; use semver::Version; use vesting_contract_common::messages::{ExecuteMsg, InitMsg, MigrateMsg, QueryMsg}; +use vesting_contract_common::{Account, VestingContractError}; // version info for migration info const CONTRACT_NAME: &str = "crate:nym-vesting-contract"; @@ -36,7 +35,7 @@ pub fn instantiate( _env: Env, info: MessageInfo, msg: InitMsg, -) -> Result { +) -> Result { // validate the received mixnet contract address let mixnet_contract_address = deps.api.addr_validate(&msg.mixnet_contract_address)?; @@ -51,21 +50,24 @@ pub fn instantiate( } #[entry_point] -pub fn migrate(deps: DepsMut<'_>, _env: Env, _msg: MigrateMsg) -> Result { +pub fn migrate( + deps: DepsMut<'_>, + _env: Env, + _msg: MigrateMsg, +) -> Result { // note: don't remove this particular bit of code as we have to ALWAYS check whether we have to update the stored version - let version: Version = - CONTRACT_VERSION - .parse() - .map_err(|error: semver::Error| ContractError::SemVerFailure { - value: CONTRACT_VERSION.to_string(), - error_message: error.to_string(), - })?; + let version: Version = CONTRACT_VERSION.parse().map_err(|error: semver::Error| { + VestingContractError::SemVerFailure { + value: CONTRACT_VERSION.to_string(), + error_message: error.to_string(), + } + })?; let storage_version_raw = cw2::get_contract_version(deps.storage)?.version; let storage_version: Version = storage_version_raw .parse() - .map_err(|error: semver::Error| ContractError::SemVerFailure { + .map_err(|error: semver::Error| VestingContractError::SemVerFailure { value: storage_version_raw, error_message: error.to_string(), })?; @@ -86,7 +88,7 @@ pub fn execute( env: Env, info: MessageInfo, msg: ExecuteMsg, -) -> Result { +) -> Result { match msg { ExecuteMsg::CreateFamily { label } => try_create_family(info, deps, label), ExecuteMsg::JoinFamily { @@ -190,7 +192,11 @@ pub fn execute( } #[entry_point] -pub fn query(deps: Deps<'_>, env: Env, msg: QueryMsg) -> Result { +pub fn query( + deps: Deps<'_>, + env: Env, + msg: QueryMsg, +) -> Result { let query_res = match msg { QueryMsg::GetContractVersion {} => to_binary(&get_contract_version()), QueryMsg::GetCW2ContractVersion {} => to_binary(&cw2::get_contract_version(deps.storage)?), @@ -314,17 +320,23 @@ pub fn query(deps: Deps<'_>, env: Env, msg: QueryMsg) -> Result Result { +pub(crate) fn validate_funds( + funds: &[Coin], + mix_denom: String, +) -> Result { if funds.is_empty() || funds[0].amount.is_zero() { - return Err(ContractError::EmptyFunds); + return Err(VestingContractError::EmptyFunds); } if funds.len() > 1 { - return Err(ContractError::MultipleDenoms); + return Err(VestingContractError::MultipleDenoms); } if funds[0].denom != mix_denom { - return Err(ContractError::WrongDenom(funds[0].denom.clone(), mix_denom)); + return Err(VestingContractError::WrongDenom( + funds[0].denom.clone(), + mix_denom, + )); } Ok(funds[0].clone()) @@ -333,13 +345,13 @@ pub(crate) fn validate_funds(funds: &[Coin], mix_denom: String) -> Result Result<(), ContractError> { +) -> Result<(), VestingContractError> { if let Some(staking_address) = account.staking_address() { if staking_address == addr { return Ok(()); } } - Err(ContractError::InvalidStakingAccount { + Err(VestingContractError::InvalidStakingAccount { address: addr.clone(), for_account: account.owner_address(), }) diff --git a/contracts/vesting/src/lib.rs b/contracts/vesting/src/lib.rs index d2238d4d15..527a9ffa53 100644 --- a/contracts/vesting/src/lib.rs +++ b/contracts/vesting/src/lib.rs @@ -5,7 +5,6 @@ #![warn(clippy::unwrap_used)] pub mod contract; -pub mod errors; mod queries; mod queued_migrations; mod storage; diff --git a/contracts/vesting/src/queries.rs b/contracts/vesting/src/queries.rs index a33bb84256..c3c9c0d99d 100644 --- a/contracts/vesting/src/queries.rs +++ b/contracts/vesting/src/queries.rs @@ -1,19 +1,18 @@ // Copyright 2021-2023 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use crate::errors::ContractError; use crate::storage; use crate::storage::{account_from_address, BlockTimestampSecs, ACCOUNTS, DELEGATIONS, MIX_DENOM}; use crate::traits::VestingAccount; -use crate::vesting::Account; +use crate::vesting::StorableVestingAccountExt; use contracts_common::ContractBuildInformation; use cosmwasm_std::{Coin, Deps, Env, Order, StdResult, Timestamp, Uint128}; use cw_storage_plus::Bound; use mixnet_contract_common::MixId; use vesting_contract_common::{ - AccountVestingCoins, AccountsResponse, AllDelegationsResponse, BaseVestingAccountInfo, + Account, AccountVestingCoins, AccountsResponse, AllDelegationsResponse, BaseVestingAccountInfo, DelegationTimesResponse, OriginalVestingResponse, Period, PledgeData, VestingCoinsResponse, - VestingDelegation, + VestingContractError, VestingDelegation, }; /// Get current vesting period for a given [crate::vesting::Account]. @@ -21,24 +20,30 @@ pub fn try_get_current_vesting_period( address: &str, deps: Deps<'_>, env: Env, -) -> Result { +) -> Result { let account = account_from_address(address, deps.storage, deps.api)?; account.get_current_vesting_period(env.block.time) } /// Loads mixnode bond from vesting contract storage. -pub fn try_get_mixnode(address: &str, deps: Deps<'_>) -> Result, ContractError> { +pub fn try_get_mixnode( + address: &str, + deps: Deps<'_>, +) -> Result, VestingContractError> { let account = account_from_address(address, deps.storage, deps.api)?; account.load_mixnode_pledge(deps.storage) } /// Loads gateway bond from vesting contract storage. -pub fn try_get_gateway(address: &str, deps: Deps<'_>) -> Result, ContractError> { +pub fn try_get_gateway( + address: &str, + deps: Deps<'_>, +) -> Result, VestingContractError> { let account = account_from_address(address, deps.storage, deps.api)?; account.load_gateway_pledge(deps.storage) } -pub fn try_get_account(address: &str, deps: Deps<'_>) -> Result { +pub fn try_get_account(address: &str, deps: Deps<'_>) -> Result { account_from_address(address, deps.storage, deps.api) } @@ -65,7 +70,7 @@ pub fn try_get_all_accounts( deps: Deps<'_>, start_after: Option, limit: Option, -) -> Result { +) -> Result { let limit = limit.unwrap_or(150).min(250) as usize; let start = start_after @@ -96,7 +101,7 @@ pub fn try_get_all_accounts_vesting_coins( env: Env, start_after: Option, limit: Option, -) -> Result { +) -> Result { let limit = limit.unwrap_or(150).min(250) as usize; let start = start_after @@ -133,7 +138,7 @@ pub fn try_get_locked_coins( block_time: Option, env: Env, deps: Deps<'_>, -) -> Result { +) -> Result { let account = account_from_address(vesting_account_address, deps.storage, deps.api)?; account.locked_coins(block_time, &env, deps.storage) } @@ -144,7 +149,7 @@ pub fn try_get_spendable_coins( block_time: Option, env: Env, deps: Deps<'_>, -) -> Result { +) -> Result { let account = account_from_address(vesting_account_address, deps.storage, deps.api)?; account.spendable_coins(block_time, &env, deps.storage) } @@ -155,7 +160,7 @@ pub fn try_get_vested_coins( block_time: Option, env: Env, deps: Deps<'_>, -) -> Result { +) -> Result { let account = account_from_address(vesting_account_address, deps.storage, deps.api)?; account.get_vested_coins(block_time, &env, deps.storage) } @@ -166,7 +171,7 @@ pub fn try_get_vesting_coins( block_time: Option, env: Env, deps: Deps<'_>, -) -> Result { +) -> Result { let account = account_from_address(vesting_account_address, deps.storage, deps.api)?; account.get_vesting_coins(block_time, &env, deps.storage) } @@ -175,7 +180,7 @@ pub fn try_get_vesting_coins( pub fn try_get_start_time( vesting_account_address: &str, deps: Deps<'_>, -) -> Result { +) -> Result { let account = account_from_address(vesting_account_address, deps.storage, deps.api)?; Ok(account.get_start_time()) } @@ -184,7 +189,7 @@ pub fn try_get_start_time( pub fn try_get_end_time( vesting_account_address: &str, deps: Deps<'_>, -) -> Result { +) -> Result { let account = account_from_address(vesting_account_address, deps.storage, deps.api)?; Ok(account.get_end_time()) } @@ -193,7 +198,7 @@ pub fn try_get_end_time( pub fn try_get_original_vesting( vesting_account_address: &str, deps: Deps<'_>, -) -> Result { +) -> Result { let account = account_from_address(vesting_account_address, deps.storage, deps.api)?; account.get_original_vesting() } @@ -201,7 +206,7 @@ pub fn try_get_original_vesting( pub fn try_get_historical_vesting_staking_reward( vesting_account_address: &str, deps: Deps<'_>, -) -> Result { +) -> Result { let account = account_from_address(vesting_account_address, deps.storage, deps.api)?; account.get_historical_vested_staking_rewards(deps.storage) } @@ -210,7 +215,7 @@ pub fn try_get_spendable_vested_coins( vesting_account_address: &str, deps: Deps<'_>, env: Env, -) -> Result { +) -> Result { let account = account_from_address(vesting_account_address, deps.storage, deps.api)?; account.spendable_vested_coins(None, &env, deps.storage) } @@ -219,7 +224,7 @@ pub fn try_get_spendable_reward_coins( vesting_account_address: &str, deps: Deps<'_>, env: Env, -) -> Result { +) -> Result { let account = account_from_address(vesting_account_address, deps.storage, deps.api)?; account.spendable_reward_coins(None, &env, deps.storage) } @@ -227,7 +232,7 @@ pub fn try_get_spendable_reward_coins( pub fn try_get_delegated_coins( vesting_account_address: &str, deps: Deps<'_>, -) -> Result { +) -> Result { let account = account_from_address(vesting_account_address, deps.storage, deps.api)?; let denom = MIX_DENOM.load(deps.storage)?; let amount = account.total_delegations(deps.storage)?; @@ -237,7 +242,7 @@ pub fn try_get_delegated_coins( pub fn try_get_pledged_coins( vesting_account_address: &str, deps: Deps<'_>, -) -> Result { +) -> Result { let account = account_from_address(vesting_account_address, deps.storage, deps.api)?; let denom = MIX_DENOM.load(deps.storage)?; let amount = account.total_pledged(deps.storage)?; @@ -247,7 +252,7 @@ pub fn try_get_pledged_coins( pub fn try_get_staked_coins( vesting_account_address: &str, deps: Deps<'_>, -) -> Result { +) -> Result { let account = account_from_address(vesting_account_address, deps.storage, deps.api)?; let denom = MIX_DENOM.load(deps.storage)?; let amount = account.total_staked(deps.storage)?; @@ -257,7 +262,7 @@ pub fn try_get_staked_coins( pub fn try_get_withdrawn_coins( vesting_account_address: &str, deps: Deps<'_>, -) -> Result { +) -> Result { let account = account_from_address(vesting_account_address, deps.storage, deps.api)?; let denom = MIX_DENOM.load(deps.storage)?; let amount = account.load_withdrawn(deps.storage)?; @@ -269,7 +274,7 @@ pub fn try_get_delegation_times( deps: Deps<'_>, vesting_account_address: &str, mix_id: MixId, -) -> Result { +) -> Result { let owner = deps.api.addr_validate(vesting_account_address)?; let account = account_from_address(vesting_account_address, deps.storage, deps.api)?; @@ -288,7 +293,7 @@ pub fn try_get_all_delegations( deps: Deps<'_>, start_after: Option<(u32, MixId, BlockTimestampSecs)>, limit: Option, -) -> Result { +) -> Result { let limit = limit.unwrap_or(100).min(200) as usize; let start = start_after.map(Bound::exclusive); @@ -325,7 +330,7 @@ pub fn try_get_delegation( vesting_account_address: &str, mix_id: MixId, block_timestamp_secs: BlockTimestampSecs, -) -> Result { +) -> Result { let account = account_from_address(vesting_account_address, deps.storage, deps.api)?; let storage_key = (account.storage_key(), mix_id, block_timestamp_secs); @@ -343,7 +348,7 @@ pub fn try_get_delegation_amount( deps: Deps<'_>, vesting_account_address: &str, mix_id: MixId, -) -> Result { +) -> Result { let account = account_from_address(vesting_account_address, deps.storage, deps.api)?; let amount = DELEGATIONS diff --git a/contracts/vesting/src/storage.rs b/contracts/vesting/src/storage.rs index eb49d3c434..d6d363d36f 100644 --- a/contracts/vesting/src/storage.rs +++ b/contracts/vesting/src/storage.rs @@ -1,16 +1,14 @@ -use crate::errors::ContractError; -use crate::vesting::Account; use cosmwasm_std::{Addr, Api, Storage, Uint128}; use cosmwasm_std::{Coin, Order}; use cw_storage_plus::{Item, Map}; use mixnet_contract_common::{IdentityKey, MixId}; -use vesting_contract_common::PledgeData; +use vesting_contract_common::account::VestingAccountStorageKey; +use vesting_contract_common::{Account, PledgeData, VestingContractError}; pub(crate) type BlockTimestampSecs = u64; -pub(crate) type AccountStorageKey = u32; /// Counter for the unique, monotonically increasing storage key id for the vesting account data. -pub const KEY: Item<'_, AccountStorageKey> = Item::new("key"); +pub const KEY: Item<'_, VestingAccountStorageKey> = Item::new("key"); /// Storage map containing vesting account information associated with particular owner address. pub const ACCOUNTS: Map<'_, Addr, Account> = Map::new("acc"); @@ -18,28 +16,31 @@ pub const ACCOUNTS: Map<'_, Addr, Account> = Map::new("acc"); /// Storage map containing information about amount of tokens associated with particular vesting account /// that are currently present in the contract (and have not been withdrawn or staked in the mixnet contract) // note: this assumes I understood the intent behind this correctly -const BALANCES: Map<'_, AccountStorageKey, Uint128> = Map::new("blc"); +const BALANCES: Map<'_, VestingAccountStorageKey, Uint128> = Map::new("blc"); /// Storage map containing information about amount of tokens withdrawn from the contract by a particular vesting account. -const WITHDRAWNS: Map<'_, AccountStorageKey, Uint128> = Map::new("wthd"); +const WITHDRAWNS: Map<'_, VestingAccountStorageKey, Uint128> = Map::new("wthd"); /// Storage map containing information about amount of tokens pledged towards bonding mixnodes /// in the mixnet contract using a particular vesting account. -const BOND_PLEDGES: Map<'_, AccountStorageKey, PledgeData> = Map::new("bnd"); +const BOND_PLEDGES: Map<'_, VestingAccountStorageKey, PledgeData> = Map::new("bnd"); /// Storage map containing information about amount of tokens pledged towards bonding gateways /// in the mixnet contract using a particular vesting account. -const GATEWAY_PLEDGES: Map<'_, AccountStorageKey, PledgeData> = Map::new("gtw"); +const GATEWAY_PLEDGES: Map<'_, VestingAccountStorageKey, PledgeData> = Map::new("gtw"); /// Old, pre-v2 migration, storage map that used to contain information about tokens delegated /// towards particular mixnodes in the mixnet contract with given vesting account. /// It should be completely empty. -pub const _OLD_DELEGATIONS: Map<'_, (AccountStorageKey, IdentityKey, BlockTimestampSecs), Uint128> = - Map::new("dlg"); +pub const _OLD_DELEGATIONS: Map< + '_, + (VestingAccountStorageKey, IdentityKey, BlockTimestampSecs), + Uint128, +> = Map::new("dlg"); /// Storage map containing information about tokens delegated towards particular mixnodes /// in the mixnet contract with given vesting account. -pub const DELEGATIONS: Map<'_, (AccountStorageKey, MixId, BlockTimestampSecs), Uint128> = +pub const DELEGATIONS: Map<'_, (VestingAccountStorageKey, MixId, BlockTimestampSecs), Uint128> = Map::new("dlg_v2"); /// Explicit contract admin that is allowed, among other things, to create new vesting accounts. @@ -52,10 +53,10 @@ pub const MIXNET_CONTRACT_ADDRESS: Item<'_, Addr> = Item::new("mix"); pub const MIX_DENOM: Item<'_, String> = Item::new("den"); pub fn save_delegation( - key: (AccountStorageKey, MixId, BlockTimestampSecs), + key: (VestingAccountStorageKey, MixId, BlockTimestampSecs), amount: Uint128, storage: &mut dyn Storage, -) -> Result<(), ContractError> { +) -> Result<(), VestingContractError> { let existing_delegation_amount = if let Some(delegation) = DELEGATIONS.may_load(storage, key)? { delegation } else { @@ -67,17 +68,17 @@ pub fn save_delegation( } pub fn remove_delegation( - key: (AccountStorageKey, MixId, BlockTimestampSecs), + key: (VestingAccountStorageKey, MixId, BlockTimestampSecs), storage: &mut dyn Storage, -) -> Result<(), ContractError> { +) -> Result<(), VestingContractError> { DELEGATIONS.remove(storage, key); Ok(()) } pub fn load_delegation_timestamps( - prefix: (AccountStorageKey, MixId), + prefix: (VestingAccountStorageKey, MixId), storage: &dyn Storage, -) -> Result, ContractError> { +) -> Result, VestingContractError> { let block_timestamps = DELEGATIONS .prefix(prefix) .keys(storage, None, None, Order::Ascending) @@ -86,7 +87,7 @@ pub fn load_delegation_timestamps( } pub fn count_subdelegations_for_mix( - prefix: (AccountStorageKey, MixId), + prefix: (VestingAccountStorageKey, MixId), storage: &dyn Storage, ) -> u32 { DELEGATIONS @@ -96,9 +97,9 @@ pub fn count_subdelegations_for_mix( } pub fn load_withdrawn( - key: AccountStorageKey, + key: VestingAccountStorageKey, storage: &dyn Storage, -) -> Result { +) -> Result { Ok(WITHDRAWNS .may_load(storage, key) .unwrap_or(None) @@ -106,9 +107,9 @@ pub fn load_withdrawn( } pub fn load_balance( - key: AccountStorageKey, + key: VestingAccountStorageKey, storage: &dyn Storage, -) -> Result { +) -> Result { Ok(BALANCES .may_load(storage, key) .unwrap_or(None) @@ -116,57 +117,57 @@ pub fn load_balance( } pub fn save_balance( - key: AccountStorageKey, + key: VestingAccountStorageKey, value: Uint128, storage: &mut dyn Storage, -) -> Result<(), ContractError> { +) -> Result<(), VestingContractError> { BALANCES.save(storage, key, &value)?; Ok(()) } pub fn save_withdrawn( - key: AccountStorageKey, + key: VestingAccountStorageKey, value: Uint128, storage: &mut dyn Storage, -) -> Result<(), ContractError> { +) -> Result<(), VestingContractError> { WITHDRAWNS.save(storage, key, &value)?; Ok(()) } pub fn load_bond_pledge( - key: AccountStorageKey, + key: VestingAccountStorageKey, storage: &dyn Storage, -) -> Result, ContractError> { +) -> Result, VestingContractError> { Ok(BOND_PLEDGES.may_load(storage, key).unwrap_or(None)) } pub fn remove_bond_pledge( - key: AccountStorageKey, + key: VestingAccountStorageKey, storage: &mut dyn Storage, -) -> Result<(), ContractError> { +) -> Result<(), VestingContractError> { BOND_PLEDGES.remove(storage, key); Ok(()) } pub fn save_bond_pledge( - key: AccountStorageKey, + key: VestingAccountStorageKey, value: &PledgeData, storage: &mut dyn Storage, -) -> Result<(), ContractError> { +) -> Result<(), VestingContractError> { BOND_PLEDGES.save(storage, key, value)?; Ok(()) } pub fn decrease_bond_pledge( - key: AccountStorageKey, + key: VestingAccountStorageKey, amount: Coin, storage: &mut dyn Storage, -) -> Result<(), ContractError> { +) -> Result<(), VestingContractError> { let mut existing = BOND_PLEDGES.load(storage, key)?; if existing.amount.amount <= amount.amount { // this shouldn't be possible! // (but check for it anyway... just in case) - return Err(ContractError::InvalidBondPledgeReduction { + return Err(VestingContractError::InvalidBondPledgeReduction { current: existing.amount, decrease_by: amount, }); @@ -176,30 +177,33 @@ pub fn decrease_bond_pledge( } pub fn load_gateway_pledge( - key: AccountStorageKey, + key: VestingAccountStorageKey, storage: &dyn Storage, -) -> Result, ContractError> { +) -> Result, VestingContractError> { Ok(GATEWAY_PLEDGES.may_load(storage, key).unwrap_or(None)) } pub fn save_gateway_pledge( - key: AccountStorageKey, + key: VestingAccountStorageKey, value: &PledgeData, storage: &mut dyn Storage, -) -> Result<(), ContractError> { +) -> Result<(), VestingContractError> { GATEWAY_PLEDGES.save(storage, key, value)?; Ok(()) } pub fn remove_gateway_pledge( - key: AccountStorageKey, + key: VestingAccountStorageKey, storage: &mut dyn Storage, -) -> Result<(), ContractError> { +) -> Result<(), VestingContractError> { GATEWAY_PLEDGES.remove(storage, key); Ok(()) } -pub fn save_account(account: &Account, storage: &mut dyn Storage) -> Result<(), ContractError> { +pub fn save_account( + account: &Account, + storage: &mut dyn Storage, +) -> Result<(), VestingContractError> { ACCOUNTS.save(storage, account.owner_address(), account)?; Ok(()) } @@ -207,24 +211,27 @@ pub fn save_account(account: &Account, storage: &mut dyn Storage) -> Result<(), pub fn load_account( address: Addr, storage: &dyn Storage, -) -> Result, ContractError> { +) -> Result, VestingContractError> { Ok(ACCOUNTS.may_load(storage, address).unwrap_or(None)) } -pub fn delete_account(address: Addr, storage: &mut dyn Storage) -> Result<(), ContractError> { +pub fn delete_account( + address: Addr, + storage: &mut dyn Storage, +) -> Result<(), VestingContractError> { ACCOUNTS.remove(storage, address); Ok(()) } -fn validate_account(address: Addr, storage: &dyn Storage) -> Result { +fn validate_account(address: Addr, storage: &dyn Storage) -> Result { load_account(address.clone(), storage)? - .ok_or_else(|| ContractError::NoAccountForAddress(address.into_string())) + .ok_or_else(|| VestingContractError::NoAccountForAddress(address.into_string())) } pub fn account_from_address( address: &str, storage: &dyn Storage, api: &dyn Api, -) -> Result { +) -> Result { validate_account(api.addr_validate(address)?, storage) } diff --git a/contracts/vesting/src/support/tests.rs b/contracts/vesting/src/support/tests.rs index 6f48fe6940..98995b1c8e 100644 --- a/contracts/vesting/src/support/tests.rs +++ b/contracts/vesting/src/support/tests.rs @@ -72,7 +72,7 @@ pub mod helpers { use crate::storage::{ACCOUNTS, ADMIN, MIXNET_CONTRACT_ADDRESS, MIX_DENOM}; use crate::support::tests::helpers::state_dump_decoder::RawState; use crate::traits::VestingAccount; - use crate::vesting::{populate_vesting_periods, Account}; + use crate::vesting::{populate_vesting_periods, StorableVestingAccountExt}; use contracts_common::Percent; use cosmwasm_std::testing::{mock_dependencies, mock_env, mock_info, MockApi, MockQuerier}; use cosmwasm_std::{ @@ -83,8 +83,8 @@ pub mod helpers { use rand_chacha::ChaCha20Rng; use std::path::Path; use std::str::FromStr; - use vesting_contract_common::messages::{InitMsg, VestingSpecification}; - use vesting_contract_common::PledgeCap; + use vesting_contract_common::messages::InitMsg; + use vesting_contract_common::{Account, PledgeCap, VestingSpecification}; // use rng with constant seed for all tests so that they would be deterministic #[allow(unused)] @@ -337,7 +337,7 @@ pub mod helpers { VestingSpecification::new(None, Some(3600), None), ); - Account::new( + Account::save_new( Addr::unchecked("owner"), Some(Addr::unchecked("staking")), Coin { @@ -357,7 +357,7 @@ pub mod helpers { let periods = populate_vesting_periods(start_time.seconds(), VestingSpecification::default()); - Account::new( + Account::save_new( Addr::unchecked("owner"), Some(Addr::unchecked("staking")), Coin { @@ -377,7 +377,7 @@ pub mod helpers { let periods = populate_vesting_periods(start_time.seconds(), VestingSpecification::default()); - Account::new( + Account::save_new( Addr::unchecked("owner"), Some(Addr::unchecked("staking")), Coin { diff --git a/contracts/vesting/src/traits/bonding_account.rs b/contracts/vesting/src/traits/bonding_account.rs index bf5cac3bf5..e5e415e30c 100644 --- a/contracts/vesting/src/traits/bonding_account.rs +++ b/contracts/vesting/src/traits/bonding_account.rs @@ -1,4 +1,3 @@ -use crate::errors::ContractError; use contracts_common::signing::MessageSignature; use cosmwasm_std::{Coin, Env, Response, Storage}; use mixnet_contract_common::{ @@ -6,9 +5,13 @@ use mixnet_contract_common::{ mixnode::{MixNodeConfigUpdate, MixNodeCostParams}, Gateway, MixNode, }; +use vesting_contract_common::VestingContractError; pub trait MixnodeBondingAccount { - fn try_claim_operator_reward(&self, storage: &dyn Storage) -> Result; + fn try_claim_operator_reward( + &self, + storage: &dyn Storage, + ) -> Result; fn try_bond_mixnode( &self, @@ -18,46 +21,46 @@ pub trait MixnodeBondingAccount { pledge: Coin, env: &Env, storage: &mut dyn Storage, - ) -> Result; + ) -> Result; fn try_pledge_additional_tokens( &self, additional_pledge: Coin, env: &Env, storage: &mut dyn Storage, - ) -> Result; + ) -> Result; fn try_decrease_mixnode_pledge( &self, amount: Coin, storage: &mut dyn Storage, - ) -> Result; + ) -> Result; - fn try_unbond_mixnode(&self, storage: &dyn Storage) -> Result; + fn try_unbond_mixnode(&self, storage: &dyn Storage) -> Result; fn try_track_unbond_mixnode( &self, amount: Coin, storage: &mut dyn Storage, - ) -> Result<(), ContractError>; + ) -> Result<(), VestingContractError>; fn try_track_decrease_mixnode_pledge( &self, amount: Coin, storage: &mut dyn Storage, - ) -> Result<(), ContractError>; + ) -> Result<(), VestingContractError>; fn try_update_mixnode_config( &self, new_config: MixNodeConfigUpdate, storage: &mut dyn Storage, - ) -> Result; + ) -> Result; fn try_update_mixnode_cost_params( &self, new_costs: MixNodeCostParams, storage: &mut dyn Storage, - ) -> Result; + ) -> Result; } pub trait GatewayBondingAccount { @@ -68,19 +71,19 @@ pub trait GatewayBondingAccount { pledge: Coin, env: &Env, storage: &mut dyn Storage, - ) -> Result; + ) -> Result; - fn try_unbond_gateway(&self, storage: &dyn Storage) -> Result; + fn try_unbond_gateway(&self, storage: &dyn Storage) -> Result; fn try_track_unbond_gateway( &self, amount: Coin, storage: &mut dyn Storage, - ) -> Result<(), ContractError>; + ) -> Result<(), VestingContractError>; fn try_update_gateway_config( &self, new_config: GatewayConfigUpdate, storage: &mut dyn Storage, - ) -> Result; + ) -> Result; } diff --git a/contracts/vesting/src/traits/delegating_account.rs b/contracts/vesting/src/traits/delegating_account.rs index 4beefabe28..629cfee050 100644 --- a/contracts/vesting/src/traits/delegating_account.rs +++ b/contracts/vesting/src/traits/delegating_account.rs @@ -1,13 +1,13 @@ -use crate::errors::ContractError; use cosmwasm_std::{Coin, Env, Response, Storage, Uint128}; use mixnet_contract_common::MixId; +use vesting_contract_common::VestingContractError; pub trait DelegatingAccount { fn try_claim_delegator_reward( &self, mix_id: MixId, storage: &dyn Storage, - ) -> Result; + ) -> Result; fn try_delegate_to_mixnode( &self, @@ -15,13 +15,13 @@ pub trait DelegatingAccount { amount: Coin, env: &Env, storage: &mut dyn Storage, - ) -> Result; + ) -> Result; fn try_undelegate_from_mixnode( &self, mix_id: MixId, storage: &dyn Storage, - ) -> Result; + ) -> Result; // track_delegation performs internal vesting accounting necessary when // delegating from a vesting account. It accepts the current block height, the @@ -35,7 +35,7 @@ pub trait DelegatingAccount { current_balance: Uint128, delegation: Coin, storage: &mut dyn Storage, - ) -> Result<(), ContractError>; + ) -> Result<(), VestingContractError>; // track_undelegation performs internal vesting accounting necessary when a // vesting account performs an undelegation. fn track_undelegation( @@ -43,5 +43,5 @@ pub trait DelegatingAccount { mix_id: MixId, amount: Coin, storage: &mut dyn Storage, - ) -> Result<(), ContractError>; + ) -> Result<(), VestingContractError>; } diff --git a/contracts/vesting/src/traits/node_families.rs b/contracts/vesting/src/traits/node_families.rs index 163308d30a..f5af460d17 100644 --- a/contracts/vesting/src/traits/node_families.rs +++ b/contracts/vesting/src/traits/node_families.rs @@ -1,32 +1,32 @@ -use crate::errors::ContractError; use contracts_common::signing::MessageSignature; use cosmwasm_std::{Response, Storage}; use mixnet_contract_common::families::FamilyHead; use mixnet_contract_common::IdentityKeyRef; +use vesting_contract_common::VestingContractError; pub trait NodeFamilies { fn try_create_family( &self, storage: &dyn Storage, label: String, - ) -> Result; + ) -> Result; fn try_join_family( &self, storage: &dyn Storage, join_permit: MessageSignature, family_head: FamilyHead, - ) -> Result; + ) -> Result; fn try_leave_family( &self, storage: &dyn Storage, family_head: FamilyHead, - ) -> Result; + ) -> Result; fn try_head_kick_member( &self, storage: &dyn Storage, member: IdentityKeyRef<'_>, - ) -> Result; + ) -> Result; } diff --git a/contracts/vesting/src/traits/vesting_account.rs b/contracts/vesting/src/traits/vesting_account.rs index 258a750492..3699f282ea 100644 --- a/contracts/vesting/src/traits/vesting_account.rs +++ b/contracts/vesting/src/traits/vesting_account.rs @@ -1,9 +1,8 @@ -use crate::errors::ContractError; use cosmwasm_std::{Addr, Coin, Env, Storage, Timestamp, Uint128}; -use vesting_contract_common::OriginalVestingResponse; +use vesting_contract_common::{OriginalVestingResponse, VestingContractError}; pub trait VestingAccount { - fn total_staked(&self, storage: &dyn Storage) -> Result; + fn total_staked(&self, storage: &dyn Storage) -> Result; /// Returns the set of coins that are not spendable (can still be delegated tough) (i.e. locked), /// defined as vesting coins that are not delegated or pledged. @@ -17,7 +16,7 @@ pub trait VestingAccount { block_time: Option, env: &Env, storage: &dyn Storage, - ) -> Result; + ) -> Result; /// Calculated as current_balance minus [crate::traits::VestingAccount::locked_coins] /// See [/vesting-contract/struct.Account.html/method.spendable_coins] for impl @@ -26,21 +25,21 @@ pub trait VestingAccount { block_time: Option, env: &Env, storage: &dyn Storage, - ) -> Result; + ) -> Result; fn spendable_vested_coins( &self, block_time: Option, env: &Env, storage: &dyn Storage, - ) -> Result; + ) -> Result; fn spendable_reward_coins( &self, block_time: Option, env: &Env, storage: &dyn Storage, - ) -> Result; + ) -> Result; /// See [/vesting-contract/struct.Account.html/method.get_vested_coins] for impl fn get_vested_coins( @@ -48,7 +47,7 @@ pub trait VestingAccount { block_time: Option, env: &Env, storage: &dyn Storage, - ) -> Result; + ) -> Result; /// See [/vesting-contract/struct.Account.html/method.get_vesting_coins] for impl fn get_vesting_coins( @@ -56,7 +55,7 @@ pub trait VestingAccount { block_time: Option, env: &Env, storage: &dyn Storage, - ) -> Result; + ) -> Result; /// See [/vesting-contract/struct.Account.html/method.get_start_time] for impl fn get_start_time(&self) -> Timestamp; @@ -65,23 +64,27 @@ pub trait VestingAccount { /// Returns amount of coins set at account creation /// See [/vesting-contract/struct.Account.html/method.get_original_vesting] for impl - fn get_original_vesting(&self) -> Result; + fn get_original_vesting(&self) -> Result; /// See [/vesting-contract/struct.Account.html/method.transfer_ownership] for impl fn transfer_ownership( &mut self, to_address: &Addr, storage: &mut dyn Storage, - ) -> Result<(), ContractError>; + ) -> Result<(), VestingContractError>; /// See [/vesting-contract/struct.Account.html/method.update_staking_address] for impl fn update_staking_address( &mut self, to_address: Option, storage: &mut dyn Storage, - ) -> Result<(), ContractError>; - fn track_reward(&self, amount: Coin, storage: &mut dyn Storage) -> Result<(), ContractError>; + ) -> Result<(), VestingContractError>; + fn track_reward( + &self, + amount: Coin, + storage: &mut dyn Storage, + ) -> Result<(), VestingContractError>; fn get_historical_vested_staking_rewards( &self, storage: &dyn Storage, - ) -> Result; + ) -> Result; } diff --git a/contracts/vesting/src/transactions.rs b/contracts/vesting/src/transactions.rs index bab50ec369..adbfe39436 100644 --- a/contracts/vesting/src/transactions.rs +++ b/contracts/vesting/src/transactions.rs @@ -2,14 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 use crate::contract::{ensure_staking_permission, validate_funds}; -use crate::errors::ContractError; use crate::storage::{ account_from_address, save_account, ADMIN, MIXNET_CONTRACT_ADDRESS, MIX_DENOM, }; use crate::traits::{ DelegatingAccount, GatewayBondingAccount, MixnodeBondingAccount, NodeFamilies, VestingAccount, }; -use crate::vesting::{populate_vesting_periods, Account}; +use crate::vesting::{populate_vesting_periods, StorableVestingAccountExt}; use contracts_common::signing::MessageSignature; use cosmwasm_std::{coin, BankMsg, Coin, DepsMut, Env, MessageInfo, Response, Timestamp}; use mixnet_contract_common::families::FamilyHead; @@ -22,14 +21,13 @@ use vesting_contract_common::events::{ new_track_mixnode_pledge_decrease_event, new_track_mixnode_unbond_event, new_track_reward_event, new_track_undelegation_event, new_vested_coins_withdraw_event, }; -use vesting_contract_common::messages::VestingSpecification; -use vesting_contract_common::PledgeCap; +use vesting_contract_common::{Account, PledgeCap, VestingContractError, VestingSpecification}; pub fn try_create_family( info: MessageInfo, deps: DepsMut, label: String, -) -> Result { +) -> Result { let account = account_from_address(info.sender.as_ref(), deps.storage, deps.api)?; account.try_create_family(deps.storage, label) } @@ -38,7 +36,7 @@ pub fn try_join_family( deps: DepsMut, join_permit: MessageSignature, family_head: FamilyHead, -) -> Result { +) -> Result { let account = account_from_address(info.sender.as_ref(), deps.storage, deps.api)?; account.try_join_family(deps.storage, join_permit, family_head) } @@ -46,7 +44,7 @@ pub fn try_leave_family( info: MessageInfo, deps: DepsMut, family_head: FamilyHead, -) -> Result { +) -> Result { let account = account_from_address(info.sender.as_ref(), deps.storage, deps.api)?; account.try_leave_family(deps.storage, family_head) } @@ -54,7 +52,7 @@ pub fn try_kick_family_member( info: MessageInfo, deps: DepsMut, member: String, -) -> Result { +) -> Result { let account = account_from_address(info.sender.as_ref(), deps.storage, deps.api)?; account.try_head_kick_member(deps.storage, &member) } @@ -67,9 +65,11 @@ pub fn try_update_locked_pledge_cap( cap: PledgeCap, info: MessageInfo, deps: DepsMut, -) -> Result { +) -> Result { if info.sender != ADMIN.load(deps.storage)? { - return Err(ContractError::NotAdmin(info.sender.as_str().to_string())); + return Err(VestingContractError::NotAdmin( + info.sender.as_str().to_string(), + )); } let mut account = account_from_address(&address, deps.storage, deps.api)?; @@ -83,7 +83,7 @@ pub fn try_update_mixnode_config( new_config: MixNodeConfigUpdate, info: MessageInfo, deps: DepsMut, -) -> Result { +) -> Result { let account = account_from_address(info.sender.as_str(), deps.storage, deps.api)?; account.try_update_mixnode_config(new_config, deps.storage) } @@ -92,7 +92,7 @@ pub fn try_update_gateway_config( new_config: GatewayConfigUpdate, info: MessageInfo, deps: DepsMut, -) -> Result { +) -> Result { let account = account_from_address(info.sender.as_str(), deps.storage, deps.api)?; account.try_update_gateway_config(new_config, deps.storage) } @@ -101,7 +101,7 @@ pub fn try_update_mixnode_cost_params( new_costs: MixNodeCostParams, info: MessageInfo, deps: DepsMut, -) -> Result { +) -> Result { let account = account_from_address(info.sender.as_str(), deps.storage, deps.api)?; account.try_update_mixnode_cost_params(new_costs, deps.storage) } @@ -113,9 +113,11 @@ pub fn try_update_mixnet_address( address: String, info: MessageInfo, deps: DepsMut<'_>, -) -> Result { +) -> Result { if info.sender != ADMIN.load(deps.storage)? { - return Err(ContractError::NotAdmin(info.sender.as_str().to_string())); + return Err(VestingContractError::NotAdmin( + info.sender.as_str().to_string(), + )); } let mixnet_contract_address = deps.api.addr_validate(&address)?; @@ -129,16 +131,18 @@ pub fn try_withdraw_vested_coins( env: Env, info: MessageInfo, deps: DepsMut<'_>, -) -> Result { +) -> Result { let mix_denom = MIX_DENOM.load(deps.storage)?; if amount.denom != mix_denom { - return Err(ContractError::WrongDenom(amount.denom, mix_denom)); + return Err(VestingContractError::WrongDenom(amount.denom, mix_denom)); } let address = info.sender; let account = account_from_address(address.as_str(), deps.storage, deps.api)?; if address != account.owner_address() { - return Err(ContractError::NotOwner(account.owner_address().to_string())); + return Err(VestingContractError::NotOwner( + account.owner_address().to_string(), + )); } let spendable_coins = account.spendable_coins(None, &env, deps.storage)?; if amount.amount <= spendable_coins.amount { @@ -157,7 +161,7 @@ pub fn try_withdraw_vested_coins( &coin(new_balance, &amount.denom), ))) } else { - Err(ContractError::InsufficientSpendable( + Err(VestingContractError::InsufficientSpendable( account.owner_address().as_str().to_string(), spendable_coins.amount.u128(), )) @@ -169,7 +173,7 @@ pub fn try_transfer_ownership( to_address: String, info: MessageInfo, deps: DepsMut<'_>, -) -> Result { +) -> Result { let address = info.sender; let to_address = deps.api.addr_validate(&to_address)?; let mut account = account_from_address(address.as_str(), deps.storage, deps.api)?; @@ -177,7 +181,9 @@ pub fn try_transfer_ownership( account.transfer_ownership(&to_address, deps.storage)?; Ok(Response::new().add_event(new_ownership_transfer_event(&address, &to_address))) } else { - Err(ContractError::NotOwner(account.owner_address().to_string())) + Err(VestingContractError::NotOwner( + account.owner_address().to_string(), + )) } } @@ -186,11 +192,13 @@ pub fn try_update_staking_address( to_address: Option, info: MessageInfo, deps: DepsMut<'_>, -) -> Result { +) -> Result { if let Some(ref to_address) = to_address { if account_from_address(to_address, deps.storage, deps.api).is_ok() { // do not allow setting staking address to an existing account's address - return Err(ContractError::StakingAccountExists(to_address.to_string())); + return Err(VestingContractError::StakingAccountExists( + to_address.to_string(), + )); } } @@ -202,7 +210,9 @@ pub fn try_update_staking_address( account.update_staking_address(to_address.clone(), deps.storage)?; Ok(Response::new().add_event(new_staking_address_update_event(&old, &to_address))) } else { - Err(ContractError::NotOwner(account.owner_address().to_string())) + Err(VestingContractError::NotOwner( + account.owner_address().to_string(), + )) } } @@ -214,7 +224,7 @@ pub fn try_bond_gateway( info: MessageInfo, env: Env, deps: DepsMut<'_>, -) -> Result { +) -> Result { let mix_denom = MIX_DENOM.load(deps.storage)?; let pledge = validate_funds(&[amount], mix_denom)?; let account = account_from_address(info.sender.as_str(), deps.storage, deps.api)?; @@ -222,7 +232,10 @@ pub fn try_bond_gateway( } /// Unbond a gateway, sends [mixnet_contract_common::ExecuteMsg::UnbondGatewayOnBehalf] to [crate::storage::MIXNET_CONTRACT_ADDRESS]. -pub fn try_unbond_gateway(info: MessageInfo, deps: DepsMut<'_>) -> Result { +pub fn try_unbond_gateway( + info: MessageInfo, + deps: DepsMut<'_>, +) -> Result { let account = account_from_address(info.sender.as_str(), deps.storage, deps.api)?; account.try_unbond_gateway(deps.storage) } @@ -233,9 +246,9 @@ pub fn try_track_unbond_gateway( amount: Coin, info: MessageInfo, deps: DepsMut<'_>, -) -> Result { +) -> Result { if info.sender != MIXNET_CONTRACT_ADDRESS.load(deps.storage)? { - return Err(ContractError::NotMixnetContract(info.sender)); + return Err(VestingContractError::NotMixnetContract(info.sender)); } let account = account_from_address(owner, deps.storage, deps.api)?; account.try_track_unbond_gateway(amount, deps.storage)?; @@ -251,7 +264,7 @@ pub fn try_bond_mixnode( info: MessageInfo, env: Env, deps: DepsMut<'_>, -) -> Result { +) -> Result { let mix_denom = MIX_DENOM.load(deps.storage)?; let pledge = validate_funds(&[amount], mix_denom)?; let account = account_from_address(info.sender.as_str(), deps.storage, deps.api)?; @@ -270,7 +283,7 @@ pub fn try_pledge_more( env: Env, info: MessageInfo, amount: Coin, -) -> Result { +) -> Result { let mix_denom = MIX_DENOM.load(deps.storage)?; let additional_pledge = validate_funds(&[amount], mix_denom)?; @@ -282,7 +295,7 @@ pub fn try_decrease_pledge( deps: DepsMut<'_>, info: MessageInfo, amount: Coin, -) -> Result { +) -> Result { let mix_denom = MIX_DENOM.load(deps.storage)?; // perform basic validation - is it correct demon, is it non-zero, etc. let decrease = validate_funds(&[amount], mix_denom)?; @@ -292,7 +305,10 @@ pub fn try_decrease_pledge( } /// Unbond a mixnode, sends [mixnet_contract_common::ExecuteMsg::UnbondMixnodeOnBehalf] to [crate::storage::MIXNET_CONTRACT_ADDRESS]. -pub fn try_unbond_mixnode(info: MessageInfo, deps: DepsMut<'_>) -> Result { +pub fn try_unbond_mixnode( + info: MessageInfo, + deps: DepsMut<'_>, +) -> Result { let account = account_from_address(info.sender.as_str(), deps.storage, deps.api)?; account.try_unbond_mixnode(deps.storage) } @@ -303,9 +319,9 @@ pub fn try_track_unbond_mixnode( amount: Coin, info: MessageInfo, deps: DepsMut<'_>, -) -> Result { +) -> Result { if info.sender != MIXNET_CONTRACT_ADDRESS.load(deps.storage)? { - return Err(ContractError::NotMixnetContract(info.sender)); + return Err(VestingContractError::NotMixnetContract(info.sender)); } let account = account_from_address(owner, deps.storage, deps.api)?; account.try_track_unbond_mixnode(amount, deps.storage)?; @@ -319,9 +335,9 @@ pub fn try_track_decrease_mixnode_pledge( amount: Coin, info: MessageInfo, deps: DepsMut<'_>, -) -> Result { +) -> Result { if info.sender != MIXNET_CONTRACT_ADDRESS.load(deps.storage)? { - return Err(ContractError::NotMixnetContract(info.sender)); + return Err(VestingContractError::NotMixnetContract(info.sender)); } let account = account_from_address(owner, deps.storage, deps.api)?; account.try_track_decrease_mixnode_pledge(amount, deps.storage)?; @@ -334,9 +350,9 @@ pub fn try_track_reward( info: MessageInfo, amount: Coin, address: &str, -) -> Result { +) -> Result { if info.sender != MIXNET_CONTRACT_ADDRESS.load(deps.storage)? { - return Err(ContractError::NotMixnetContract(info.sender)); + return Err(VestingContractError::NotMixnetContract(info.sender)); } let account = account_from_address(address, deps.storage, deps.api)?; account.track_reward(amount, deps.storage)?; @@ -350,9 +366,9 @@ pub fn try_track_undelegation( amount: Coin, info: MessageInfo, deps: DepsMut<'_>, -) -> Result { +) -> Result { if info.sender != MIXNET_CONTRACT_ADDRESS.load(deps.storage)? { - return Err(ContractError::NotMixnetContract(info.sender)); + return Err(VestingContractError::NotMixnetContract(info.sender)); } let account = account_from_address(address, deps.storage, deps.api)?; @@ -368,7 +384,7 @@ pub fn try_delegate_to_mixnode( info: MessageInfo, env: Env, deps: DepsMut<'_>, -) -> Result { +) -> Result { // TODO // as of 01.02.23 // thus restricting it to 25, which is more than double of that, doesn't seem too unreasonable. @@ -397,7 +413,7 @@ pub fn try_delegate_to_mixnode( pub fn try_claim_operator_reward( deps: DepsMut<'_>, info: MessageInfo, -) -> Result { +) -> Result { let account = account_from_address(info.sender.as_str(), deps.storage, deps.api)?; account.try_claim_operator_reward(deps.storage) } @@ -407,7 +423,7 @@ pub fn try_claim_delegator_reward( deps: DepsMut<'_>, info: MessageInfo, mix_id: MixId, -) -> Result { +) -> Result { let account = account_from_address(info.sender.as_str(), deps.storage, deps.api)?; account.try_claim_delegator_reward(mix_id, deps.storage) @@ -419,7 +435,7 @@ pub fn try_undelegate_from_mixnode( on_behalf_of: Option, info: MessageInfo, deps: DepsMut<'_>, -) -> Result { +) -> Result { let account = match on_behalf_of { Some(account_owner) => { let account = account_from_address(&account_owner, deps.storage, deps.api)?; @@ -444,16 +460,18 @@ pub fn try_create_periodic_vesting_account( info: MessageInfo, env: Env, deps: DepsMut<'_>, -) -> Result { +) -> Result { if info.sender != ADMIN.load(deps.storage)? { - return Err(ContractError::NotAdmin(info.sender.as_str().to_string())); + return Err(VestingContractError::NotAdmin( + info.sender.as_str().to_string(), + )); } let mix_denom = MIX_DENOM.load(deps.storage)?; let account_exists = account_from_address(owner_address, deps.storage, deps.api).is_ok(); if account_exists { - return Err(ContractError::AccountAlreadyExists( + return Err(VestingContractError::AccountAlreadyExists( owner_address.to_string(), )); } @@ -467,7 +485,9 @@ pub fn try_create_periodic_vesting_account( let staking_account_exists = account_from_address(&staking_address, deps.storage, deps.api).is_ok(); if staking_account_exists { - return Err(ContractError::StakingAccountAlreadyExists(staking_address)); + return Err(VestingContractError::StakingAccountAlreadyExists( + staking_address, + )); } Some(deps.api.addr_validate(&staking_address)?) } else { @@ -483,7 +503,7 @@ pub fn try_create_periodic_vesting_account( let response = Response::new(); - Account::new( + Account::save_new( owner_address.clone(), staking_address.clone(), coin.clone(), diff --git a/contracts/vesting/src/vesting/account/delegating_account.rs b/contracts/vesting/src/vesting/account/delegating_account.rs index beaedf2be2..0371bc7cc3 100644 --- a/contracts/vesting/src/vesting/account/delegating_account.rs +++ b/contracts/vesting/src/vesting/account/delegating_account.rs @@ -1,14 +1,15 @@ use crate::contract::MAX_PER_MIX_DELEGATIONS; -use crate::errors::ContractError; use crate::storage::save_delegation; use crate::storage::MIXNET_CONTRACT_ADDRESS; use crate::traits::DelegatingAccount; +use crate::vesting::account::StorableVestingAccountExt; use cosmwasm_std::{wasm_execute, Coin, Env, Response, Storage, Uint128}; use mixnet_contract_common::ExecuteMsg as MixnetExecuteMsg; use mixnet_contract_common::MixId; use vesting_contract_common::events::{ new_vesting_delegation_event, new_vesting_undelegation_event, }; +use vesting_contract_common::VestingContractError; use super::Account; @@ -17,7 +18,7 @@ impl DelegatingAccount for Account { &self, mix_id: MixId, storage: &dyn Storage, - ) -> Result { + ) -> Result { let msg = MixnetExecuteMsg::WithdrawDelegatorRewardOnBehalf { owner: self.owner_address().to_string(), mix_id, @@ -35,12 +36,12 @@ impl DelegatingAccount for Account { coin: Coin, env: &Env, storage: &mut dyn Storage, - ) -> Result { + ) -> Result { let current_balance = self.ensure_valid_additional_stake(&coin, storage)?; let num_subdelegations = self.num_subdelegations_for_mix(mix_id, storage); if num_subdelegations >= MAX_PER_MIX_DELEGATIONS { - return Err(ContractError::TooManyDelegations { + return Err(VestingContractError::TooManyDelegations { address: self.owner_address.clone(), acc_id: self.storage_key(), mix_id, @@ -75,9 +76,9 @@ impl DelegatingAccount for Account { &self, mix_id: MixId, storage: &dyn Storage, - ) -> Result { + ) -> Result { if !self.any_delegation_for_mix(mix_id, storage) { - return Err(ContractError::NoSuchDelegation( + return Err(VestingContractError::NoSuchDelegation( self.owner_address(), mix_id, )); @@ -102,7 +103,7 @@ impl DelegatingAccount for Account { current_balance: Uint128, delegation: Coin, storage: &mut dyn Storage, - ) -> Result<(), ContractError> { + ) -> Result<(), VestingContractError> { save_delegation( (self.storage_key(), mix_id, block_timestamp_secs), delegation.amount, @@ -118,7 +119,7 @@ impl DelegatingAccount for Account { mix_id: MixId, amount: Coin, storage: &mut dyn Storage, - ) -> Result<(), ContractError> { + ) -> Result<(), VestingContractError> { self.remove_delegations_for_mix(mix_id, storage)?; let new_balance = Uint128::new(self.load_balance(storage)?.u128() + amount.amount.u128()); self.save_balance(new_balance, storage)?; diff --git a/contracts/vesting/src/vesting/account/gateway_bonding_account.rs b/contracts/vesting/src/vesting/account/gateway_bonding_account.rs index 12910acbcc..e63b0d1d09 100644 --- a/contracts/vesting/src/vesting/account/gateway_bonding_account.rs +++ b/contracts/vesting/src/vesting/account/gateway_bonding_account.rs @@ -1,7 +1,7 @@ use super::PledgeData; -use crate::errors::ContractError; use crate::storage::MIXNET_CONTRACT_ADDRESS; use crate::traits::GatewayBondingAccount; +use crate::vesting::account::StorableVestingAccountExt; use contracts_common::signing::MessageSignature; use cosmwasm_std::{wasm_execute, Coin, Env, Response, Storage, Uint128}; use mixnet_contract_common::{ @@ -11,6 +11,7 @@ use vesting_contract_common::events::{ new_vesting_gateway_bonding_event, new_vesting_gateway_unbonding_event, new_vesting_update_gateway_config_event, }; +use vesting_contract_common::VestingContractError; use super::Account; @@ -22,11 +23,11 @@ impl GatewayBondingAccount for Account { pledge: Coin, env: &Env, storage: &mut dyn Storage, - ) -> Result { + ) -> Result { let current_balance = self.ensure_valid_additional_stake(&pledge, storage)?; let pledge_data = if self.load_gateway_pledge(storage)?.is_some() { - return Err(ContractError::AlreadyBonded( + return Err(VestingContractError::AlreadyBonded( self.owner_address().as_str().to_string(), )); } else { @@ -52,7 +53,7 @@ impl GatewayBondingAccount for Account { .add_event(new_vesting_gateway_bonding_event())) } - fn try_unbond_gateway(&self, storage: &dyn Storage) -> Result { + fn try_unbond_gateway(&self, storage: &dyn Storage) -> Result { let msg = MixnetExecuteMsg::UnbondGatewayOnBehalf { owner: self.owner_address().into_string(), }; @@ -64,7 +65,7 @@ impl GatewayBondingAccount for Account { .add_message(unbond_msg) .add_event(new_vesting_gateway_unbonding_event())) } else { - Err(ContractError::NoBondFound( + Err(VestingContractError::NoBondFound( self.owner_address().as_str().to_string(), )) } @@ -74,7 +75,7 @@ impl GatewayBondingAccount for Account { &self, amount: Coin, storage: &mut dyn Storage, - ) -> Result<(), ContractError> { + ) -> Result<(), VestingContractError> { let new_balance = Uint128::new(self.load_balance(storage)?.u128() + amount.amount.u128()); self.save_balance(new_balance, storage)?; @@ -86,7 +87,7 @@ impl GatewayBondingAccount for Account { &self, new_config: GatewayConfigUpdate, storage: &mut dyn Storage, - ) -> Result { + ) -> Result { let msg = MixnetExecuteMsg::UpdateGatewayConfigOnBehalf { new_config, owner: self.owner_address().into_string(), diff --git a/contracts/vesting/src/vesting/account/mixnode_bonding_account.rs b/contracts/vesting/src/vesting/account/mixnode_bonding_account.rs index 6986ac8793..29ee780ff9 100644 --- a/contracts/vesting/src/vesting/account/mixnode_bonding_account.rs +++ b/contracts/vesting/src/vesting/account/mixnode_bonding_account.rs @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 use super::Account; -use crate::errors::ContractError; use crate::storage::MIXNET_CONTRACT_ADDRESS; use crate::traits::MixnodeBondingAccount; +use crate::vesting::account::StorableVestingAccountExt; use contracts_common::signing::MessageSignature; use cosmwasm_std::{wasm_execute, Coin, Env, Response, Storage, Uint128}; use mixnet_contract_common::mixnode::MixNodeConfigUpdate; @@ -15,10 +15,13 @@ use vesting_contract_common::events::{ new_vesting_mixnode_unbonding_event, new_vesting_pledge_more_event, new_vesting_update_mixnode_config_event, new_vesting_update_mixnode_cost_params_event, }; -use vesting_contract_common::PledgeData; +use vesting_contract_common::{PledgeData, VestingContractError}; impl MixnodeBondingAccount for Account { - fn try_claim_operator_reward(&self, storage: &dyn Storage) -> Result { + fn try_claim_operator_reward( + &self, + storage: &dyn Storage, + ) -> Result { let msg = MixnetExecuteMsg::WithdrawOperatorRewardOnBehalf { owner: self.owner_address().into_string(), }; @@ -37,11 +40,11 @@ impl MixnodeBondingAccount for Account { pledge: Coin, env: &Env, storage: &mut dyn Storage, - ) -> Result { + ) -> Result { let current_balance = self.ensure_valid_additional_stake(&pledge, storage)?; let pledge_data = if self.load_mixnode_pledge(storage)?.is_some() { - return Err(ContractError::AlreadyBonded( + return Err(VestingContractError::AlreadyBonded( self.owner_address().as_str().to_string(), )); } else { @@ -73,13 +76,13 @@ impl MixnodeBondingAccount for Account { additional_pledge: Coin, env: &Env, storage: &mut dyn Storage, - ) -> Result { + ) -> Result { let current_balance = self.ensure_valid_additional_stake(&additional_pledge, storage)?; let mut pledge_data = if let Some(pledge_data) = self.load_mixnode_pledge(storage)? { pledge_data } else { - return Err(ContractError::NoBondFound( + return Err(VestingContractError::NoBondFound( self.owner_address().as_str().to_string(), )); }; @@ -113,18 +116,18 @@ impl MixnodeBondingAccount for Account { &self, amount: Coin, storage: &mut dyn Storage, - ) -> Result { + ) -> Result { match self.load_mixnode_pledge(storage)? { Some(pledge) => { if pledge.amount.amount <= amount.amount { - return Err(ContractError::InvalidBondPledgeReduction { + return Err(VestingContractError::InvalidBondPledgeReduction { current: pledge.amount, decrease_by: amount, }); } } None => { - return Err(ContractError::NoBondFound( + return Err(VestingContractError::NoBondFound( self.owner_address().as_str().to_string(), )); } @@ -147,14 +150,14 @@ impl MixnodeBondingAccount for Account { &self, amount: Coin, storage: &mut dyn Storage, - ) -> Result<(), ContractError> { + ) -> Result<(), VestingContractError> { let new_balance = Uint128::new(self.load_balance(storage)?.u128() + amount.amount.u128()); self.save_balance(new_balance, storage)?; self.decrease_mixnode_pledge(amount, storage) } - fn try_unbond_mixnode(&self, storage: &dyn Storage) -> Result { + fn try_unbond_mixnode(&self, storage: &dyn Storage) -> Result { let msg = MixnetExecuteMsg::UnbondMixnodeOnBehalf { owner: self.owner_address().into_string(), }; @@ -166,7 +169,7 @@ impl MixnodeBondingAccount for Account { .add_message(unbond_msg) .add_event(new_vesting_mixnode_unbonding_event())) } else { - Err(ContractError::NoBondFound( + Err(VestingContractError::NoBondFound( self.owner_address().as_str().to_string(), )) } @@ -176,7 +179,7 @@ impl MixnodeBondingAccount for Account { &self, amount: Coin, storage: &mut dyn Storage, - ) -> Result<(), ContractError> { + ) -> Result<(), VestingContractError> { let new_balance = Uint128::new(self.load_balance(storage)?.u128() + amount.amount.u128()); self.save_balance(new_balance, storage)?; @@ -187,7 +190,7 @@ impl MixnodeBondingAccount for Account { &self, new_config: MixNodeConfigUpdate, storage: &mut dyn Storage, - ) -> Result { + ) -> Result { let msg = MixnetExecuteMsg::UpdateMixnodeConfigOnBehalf { new_config, owner: self.owner_address().into_string(), @@ -205,7 +208,7 @@ impl MixnodeBondingAccount for Account { &self, new_costs: MixNodeCostParams, storage: &mut dyn Storage, - ) -> Result { + ) -> Result { let msg = MixnetExecuteMsg::UpdateMixnodeCostParamsOnBehalf { new_costs, owner: self.owner_address().into_string(), diff --git a/contracts/vesting/src/vesting/account/mod.rs b/contracts/vesting/src/vesting/account/mod.rs index e59f27d1a2..7d016fd130 100644 --- a/contracts/vesting/src/vesting/account/mod.rs +++ b/contracts/vesting/src/vesting/account/mod.rs @@ -1,17 +1,18 @@ +// Copyright 2021-2023 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + use super::VestingPeriod; -use crate::errors::ContractError; use crate::storage::{ count_subdelegations_for_mix, decrease_bond_pledge, load_balance, load_bond_pledge, load_delegation_timestamps, load_gateway_pledge, load_withdrawn, remove_bond_pledge, remove_delegation, remove_gateway_pledge, save_account, save_balance, save_bond_pledge, - save_gateway_pledge, save_withdrawn, AccountStorageKey, BlockTimestampSecs, DELEGATIONS, KEY, + save_gateway_pledge, save_withdrawn, BlockTimestampSecs, DELEGATIONS, KEY, }; use crate::traits::VestingAccount; use cosmwasm_std::{Addr, Coin, Order, Storage, Timestamp, Uint128}; use mixnet_contract_common::MixId; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use vesting_contract_common::{Period, PledgeCap, PledgeData}; +use vesting_contract_common::account::VestingAccountStorageKey; +use vesting_contract_common::{Account, PledgeCap, PledgeData, VestingContractError}; mod delegating_account; mod gateway_bonding_account; @@ -19,26 +20,17 @@ mod mixnode_bonding_account; mod node_families; mod vesting_account; -fn generate_storage_key(storage: &mut dyn Storage) -> Result { +fn generate_storage_key( + storage: &mut dyn Storage, +) -> Result { let key = KEY.may_load(storage)?.unwrap_or(0) + 1; KEY.save(storage, &key)?; Ok(key) } -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -pub struct Account { - pub owner_address: Addr, - pub staking_address: Option, - pub start_time: Timestamp, - pub periods: Vec, - pub coin: Coin, - storage_key: AccountStorageKey, - #[serde(default)] - pub pledge_cap: Option, -} - -impl Account { - pub fn new( +/// Helper trait to extend the `Account` type with methods that require access to the underlying storage +pub(crate) trait StorableVestingAccountExt: VestingAccount { + fn save_new( owner_address: Addr, staking_address: Option, coin: Coin, @@ -46,7 +38,7 @@ impl Account { periods: Vec, pledge_cap: Option, storage: &mut dyn Storage, - ) -> Result { + ) -> Result { let storage_key = generate_storage_key(storage)?; let amount = coin.amount; let account = Account { @@ -63,29 +55,31 @@ impl Account { Ok(account) } + fn owner_address(&self) -> Addr; + /// Checks whether the additional stake would be within the cap associated with the account /// and whether the account has enough tokens for staking. /// Returns the value of the current balance of the account. - pub fn ensure_valid_additional_stake( + fn ensure_valid_additional_stake( &self, additional_stake: &Coin, storage: &dyn Storage, - ) -> Result { + ) -> Result { let current_balance = self.load_balance(storage)?; let current_total_staked = self.total_staked(storage)?; let total_staked_after = current_total_staked + additional_stake.amount; let locked_pledge_cap = self.absolute_pledge_cap()?; if locked_pledge_cap < total_staked_after { - return Err(ContractError::LockedPledgeCapReached { + return Err(VestingContractError::LockedPledgeCapReached { current: total_staked_after, cap: locked_pledge_cap, }); } if current_balance < additional_stake.amount { - return Err(ContractError::InsufficientBalance( - self.owner_address().as_str().to_string(), + return Err(VestingContractError::InsufficientBalance( + self.owner_address().into_string(), current_balance.u128(), )); } @@ -93,107 +87,13 @@ impl Account { Ok(current_balance) } - pub fn pledge_cap(&self) -> PledgeCap { - self.pledge_cap.clone().unwrap_or_default() - } + fn absolute_pledge_cap(&self) -> Result; - pub fn absolute_pledge_cap(&self) -> Result { - match self.pledge_cap() { - PledgeCap::Absolute(cap) => Ok(cap), - PledgeCap::Percent(p) => Ok(p * self.get_original_vesting()?.amount.amount), - } - } - - pub fn coin(&self) -> Coin { - self.coin.clone() - } - - pub fn num_vesting_periods(&self) -> usize { - self.periods.len() - } - - pub fn period_duration(&self) -> Result { - self.periods - .get(0) - .ok_or(ContractError::UnpopulatedVestingPeriods { - owner: self.owner_address.clone(), - }) - .map(|p| p.period_seconds) - } - - pub fn storage_key(&self) -> u32 { - self.storage_key - } - - pub fn owner_address(&self) -> Addr { - self.owner_address.clone() - } - - pub fn staking_address(&self) -> Option<&Addr> { - self.staking_address.as_ref() - } - - #[allow(dead_code)] - pub fn periods(&self) -> Vec { - self.periods.clone() - } - - #[allow(dead_code)] - pub fn start_time(&self) -> Timestamp { - self.start_time - } - - pub fn tokens_per_period(&self) -> Result { - let amount = self.coin.amount.u128(); - if amount < self.num_vesting_periods() as u128 { - Err(ContractError::ImprobableVestingAmount(amount)) - } else { - // Remainder tokens will be lumped into the last period. - Ok(amount / self.num_vesting_periods() as u128) - } - } - - /// Returns the index of the next vesting period. Unless the current time is somehow in the past or vesting has not started yet. - /// In case vesting is over it will always return NUM_VESTING_PERIODS. - pub fn get_current_vesting_period( - &self, - block_time: Timestamp, - ) -> Result { - let first_period = - self.periods - .first() - .ok_or(ContractError::UnpopulatedVestingPeriods { - owner: self.owner_address.clone(), - })?; - - let last_period = self - .periods - .last() - .ok_or(ContractError::UnpopulatedVestingPeriods { - owner: self.owner_address.clone(), - })?; - - if block_time.seconds() < first_period.start_time { - Ok(Period::Before) - } else if last_period.end_time() < block_time { - Ok(Period::After) - } else { - let mut index = 0; - for period in &self.periods { - if block_time < period.end_time() { - break; - } - index += 1; - } - Ok(Period::In(index)) - } - } - - pub fn withdraw( + fn withdraw( &self, amount: &Coin, storage: &mut dyn Storage, - ) -> Result { + ) -> Result { let new_balance = self .load_balance(storage)? .u128() @@ -204,127 +104,73 @@ impl Account { Ok(new_balance) } - pub fn load_withdrawn(&self, storage: &dyn Storage) -> Result { - load_withdrawn(self.storage_key, storage) - } + fn load_withdrawn(&self, storage: &dyn Storage) -> Result; - pub fn save_withdrawn( + fn save_withdrawn( &self, withdrawn: Uint128, storage: &mut dyn Storage, - ) -> Result<(), ContractError> { - save_withdrawn(self.storage_key, withdrawn, storage) - } + ) -> Result<(), VestingContractError>; - pub fn load_balance(&self, storage: &dyn Storage) -> Result { - load_balance(self.storage_key(), storage) - } + fn load_balance(&self, storage: &dyn Storage) -> Result; - pub fn save_balance( + fn save_balance( &self, amount: Uint128, storage: &mut dyn Storage, - ) -> Result<(), ContractError> { - save_balance(self.storage_key(), amount, storage) - } + ) -> Result<(), VestingContractError>; - pub fn load_mixnode_pledge( + fn load_mixnode_pledge( &self, storage: &dyn Storage, - ) -> Result, ContractError> { - load_bond_pledge(self.storage_key(), storage) - } + ) -> Result, VestingContractError>; - pub fn save_mixnode_pledge( + fn save_mixnode_pledge( &self, pledge: PledgeData, storage: &mut dyn Storage, - ) -> Result<(), ContractError> { - save_bond_pledge(self.storage_key(), &pledge, storage) - } + ) -> Result<(), VestingContractError>; - pub fn remove_mixnode_pledge(&self, storage: &mut dyn Storage) -> Result<(), ContractError> { - remove_bond_pledge(self.storage_key(), storage) - } + fn remove_mixnode_pledge(&self, storage: &mut dyn Storage) -> Result<(), VestingContractError>; - pub fn decrease_mixnode_pledge( + fn decrease_mixnode_pledge( &self, amount: Coin, storage: &mut dyn Storage, - ) -> Result<(), ContractError> { - decrease_bond_pledge(self.storage_key, amount, storage) - } + ) -> Result<(), VestingContractError>; - pub fn load_gateway_pledge( + fn load_gateway_pledge( &self, storage: &dyn Storage, - ) -> Result, ContractError> { - load_gateway_pledge(self.storage_key(), storage) - } + ) -> Result, VestingContractError>; - pub fn save_gateway_pledge( + fn save_gateway_pledge( &self, pledge: PledgeData, storage: &mut dyn Storage, - ) -> Result<(), ContractError> { - save_gateway_pledge(self.storage_key(), &pledge, storage) - } + ) -> Result<(), VestingContractError>; - pub fn remove_gateway_pledge(&self, storage: &mut dyn Storage) -> Result<(), ContractError> { - remove_gateway_pledge(self.storage_key(), storage) - } + fn remove_gateway_pledge(&self, storage: &mut dyn Storage) -> Result<(), VestingContractError>; - pub fn any_delegation_for_mix(&self, mix_id: MixId, storage: &dyn Storage) -> bool { - DELEGATIONS - .prefix((self.storage_key(), mix_id)) - .range(storage, None, None, Order::Ascending) - .next() - .is_some() - } + fn any_delegation_for_mix(&self, mix_id: MixId, storage: &dyn Storage) -> bool; - pub fn num_subdelegations_for_mix(&self, mix_id: MixId, storage: &dyn Storage) -> u32 { - count_subdelegations_for_mix((self.storage_key(), mix_id), storage) - } + fn num_subdelegations_for_mix(&self, mix_id: MixId, storage: &dyn Storage) -> u32; - pub fn remove_delegations_for_mix( + fn remove_delegations_for_mix( &self, mix_id: MixId, storage: &mut dyn Storage, - ) -> Result<(), ContractError> { - // note that the limit is implicitly set to `MAX_PER_MIX_DELEGATIONS` - // as it should be impossible to create more delegations than that. - let block_timestamps = load_delegation_timestamps((self.storage_key(), mix_id), storage)?; + ) -> Result<(), VestingContractError>; - for block_timestamp in block_timestamps { - remove_delegation((self.storage_key(), mix_id, block_timestamp), storage)?; - } - Ok(()) - } - - pub fn total_delegations_for_mix( + fn total_delegations_for_mix( &self, mix_id: MixId, storage: &dyn Storage, - ) -> Result { - Ok(DELEGATIONS - .prefix((self.storage_key(), mix_id)) - .range(storage, None, None, Order::Ascending) - .filter_map(|x| x.ok()) - .fold(Uint128::zero(), |acc, (_key, val)| acc + val)) - } + ) -> Result; - // TODO: this should get reworked... somehow... (maybe with a memoized value?) - // as it's an unbounded iteration that could fail if an account has made a lot of delegations - // (I guess in order of thousands) - pub fn total_delegations(&self, storage: &dyn Storage) -> Result { - Ok(DELEGATIONS - .sub_prefix(self.storage_key()) - .range(storage, None, None, Order::Ascending) - .filter_map(|x| x.ok()) - .fold(Uint128::zero(), |acc, (_key, val)| acc + val)) - } + fn total_delegations(&self, storage: &dyn Storage) -> Result; - pub fn total_pledged(&self, storage: &dyn Storage) -> Result { + fn total_pledged(&self, storage: &dyn Storage) -> Result { let amount = if let Some(bond) = self .load_mixnode_pledge(storage)? .or(self.load_gateway_pledge(storage)?) @@ -336,11 +182,147 @@ impl Account { Ok(amount) } - pub fn total_delegations_at_timestamp( + fn total_delegations_at_timestamp( &self, storage: &dyn Storage, start_time: BlockTimestampSecs, - ) -> Result { + ) -> Result; +} + +impl StorableVestingAccountExt for Account { + fn owner_address(&self) -> Addr { + self.owner_address.clone() + } + + fn absolute_pledge_cap(&self) -> Result { + match self.pledge_cap() { + PledgeCap::Absolute(cap) => Ok(cap), + PledgeCap::Percent(p) => Ok(p * self.get_original_vesting()?.amount.amount), + } + } + + fn load_withdrawn(&self, storage: &dyn Storage) -> Result { + load_withdrawn(self.storage_key, storage) + } + + fn save_withdrawn( + &self, + withdrawn: Uint128, + storage: &mut dyn Storage, + ) -> Result<(), VestingContractError> { + save_withdrawn(self.storage_key, withdrawn, storage) + } + + fn load_balance(&self, storage: &dyn Storage) -> Result { + load_balance(self.storage_key(), storage) + } + + fn save_balance( + &self, + amount: Uint128, + storage: &mut dyn Storage, + ) -> Result<(), VestingContractError> { + save_balance(self.storage_key(), amount, storage) + } + + fn load_mixnode_pledge( + &self, + storage: &dyn Storage, + ) -> Result, VestingContractError> { + load_bond_pledge(self.storage_key(), storage) + } + + fn save_mixnode_pledge( + &self, + pledge: PledgeData, + storage: &mut dyn Storage, + ) -> Result<(), VestingContractError> { + save_bond_pledge(self.storage_key(), &pledge, storage) + } + + fn remove_mixnode_pledge(&self, storage: &mut dyn Storage) -> Result<(), VestingContractError> { + remove_bond_pledge(self.storage_key(), storage) + } + + fn decrease_mixnode_pledge( + &self, + amount: Coin, + storage: &mut dyn Storage, + ) -> Result<(), VestingContractError> { + decrease_bond_pledge(self.storage_key(), amount, storage) + } + + fn load_gateway_pledge( + &self, + storage: &dyn Storage, + ) -> Result, VestingContractError> { + load_gateway_pledge(self.storage_key(), storage) + } + + fn save_gateway_pledge( + &self, + pledge: PledgeData, + storage: &mut dyn Storage, + ) -> Result<(), VestingContractError> { + save_gateway_pledge(self.storage_key(), &pledge, storage) + } + + fn remove_gateway_pledge(&self, storage: &mut dyn Storage) -> Result<(), VestingContractError> { + remove_gateway_pledge(self.storage_key(), storage) + } + + fn any_delegation_for_mix(&self, mix_id: MixId, storage: &dyn Storage) -> bool { + DELEGATIONS + .prefix((self.storage_key(), mix_id)) + .range(storage, None, None, Order::Ascending) + .next() + .is_some() + } + + fn num_subdelegations_for_mix(&self, mix_id: MixId, storage: &dyn Storage) -> u32 { + count_subdelegations_for_mix((self.storage_key(), mix_id), storage) + } + + fn remove_delegations_for_mix( + &self, + mix_id: MixId, + storage: &mut dyn Storage, + ) -> Result<(), VestingContractError> { + // note that the limit is implicitly set to `MAX_PER_MIX_DELEGATIONS` + // as it should be impossible to create more delegations than that. + let block_timestamps = load_delegation_timestamps((self.storage_key(), mix_id), storage)?; + + for block_timestamp in block_timestamps { + remove_delegation((self.storage_key(), mix_id, block_timestamp), storage)?; + } + Ok(()) + } + + fn total_delegations_for_mix( + &self, + mix_id: MixId, + storage: &dyn Storage, + ) -> Result { + Ok(DELEGATIONS + .prefix((self.storage_key(), mix_id)) + .range(storage, None, None, Order::Ascending) + .filter_map(|x| x.ok()) + .fold(Uint128::zero(), |acc, (_key, val)| acc + val)) + } + + fn total_delegations(&self, storage: &dyn Storage) -> Result { + Ok(DELEGATIONS + .sub_prefix(self.storage_key()) + .range(storage, None, None, Order::Ascending) + .filter_map(|x| x.ok()) + .fold(Uint128::zero(), |acc, (_key, val)| acc + val)) + } + + fn total_delegations_at_timestamp( + &self, + storage: &dyn Storage, + start_time: BlockTimestampSecs, + ) -> Result { Ok(DELEGATIONS .sub_prefix(self.storage_key()) .range(storage, None, None, Order::Ascending) diff --git a/contracts/vesting/src/vesting/account/node_families.rs b/contracts/vesting/src/vesting/account/node_families.rs index 2d6c4ce436..649531688b 100644 --- a/contracts/vesting/src/vesting/account/node_families.rs +++ b/contracts/vesting/src/vesting/account/node_families.rs @@ -1,16 +1,17 @@ use super::Account; -use crate::{errors::ContractError, storage::MIXNET_CONTRACT_ADDRESS, traits::NodeFamilies}; +use crate::{storage::MIXNET_CONTRACT_ADDRESS, traits::NodeFamilies}; use contracts_common::signing::MessageSignature; use cosmwasm_std::{wasm_execute, Response, Storage}; use mixnet_contract_common::families::FamilyHead; use mixnet_contract_common::{ExecuteMsg as MixnetExecuteMsg, IdentityKeyRef}; +use vesting_contract_common::VestingContractError; impl NodeFamilies for Account { fn try_create_family( &self, storage: &dyn Storage, label: String, - ) -> Result { + ) -> Result { let msg = MixnetExecuteMsg::CreateFamilyOnBehalf { owner_address: self.owner_address().into_string(), label, @@ -26,7 +27,7 @@ impl NodeFamilies for Account { storage: &dyn Storage, join_permit: MessageSignature, family_head: FamilyHead, - ) -> Result { + ) -> Result { let msg = MixnetExecuteMsg::JoinFamilyOnBehalf { member_address: self.owner_address().to_string(), join_permit, @@ -42,7 +43,7 @@ impl NodeFamilies for Account { &self, storage: &dyn Storage, family_head: FamilyHead, - ) -> Result { + ) -> Result { let msg = MixnetExecuteMsg::LeaveFamilyOnBehalf { member_address: self.owner_address().to_string(), family_head, @@ -57,7 +58,7 @@ impl NodeFamilies for Account { &self, storage: &dyn Storage, member: IdentityKeyRef<'_>, - ) -> Result { + ) -> Result { let msg = MixnetExecuteMsg::KickFamilyMemberOnBehalf { head_address: self.owner_address().to_string(), member: member.to_string(), diff --git a/contracts/vesting/src/vesting/account/vesting_account.rs b/contracts/vesting/src/vesting/account/vesting_account.rs index 5b64b9896e..1cb51aae19 100644 --- a/contracts/vesting/src/vesting/account/vesting_account.rs +++ b/contracts/vesting/src/vesting/account/vesting_account.rs @@ -1,14 +1,14 @@ -use crate::errors::ContractError; use crate::storage::{delete_account, save_account, MIX_DENOM}; use crate::traits::VestingAccount; +use crate::vesting::account::StorableVestingAccountExt; use cosmwasm_std::{Addr, Coin, Env, Storage, Timestamp, Uint128}; use std::cmp::min; -use vesting_contract_common::{OriginalVestingResponse, Period}; +use vesting_contract_common::{OriginalVestingResponse, Period, VestingContractError}; use super::Account; impl VestingAccount for Account { - fn total_staked(&self, storage: &dyn Storage) -> Result { + fn total_staked(&self, storage: &dyn Storage) -> Result { Ok(self.total_delegations(storage)? + self.total_pledged(storage)?) } @@ -21,7 +21,7 @@ impl VestingAccount for Account { block_time: Option, env: &Env, storage: &dyn Storage, - ) -> Result { + ) -> Result { let still_vesting = self.get_vesting_coins(block_time, env, storage)?.amount; let staked = self.total_staked(storage)?; let locked_amount = still_vesting.saturating_sub(staked); @@ -37,7 +37,7 @@ impl VestingAccount for Account { block_time: Option, env: &Env, storage: &dyn Storage, - ) -> Result { + ) -> Result { Ok(Coin { amount: self .load_balance(storage)? @@ -51,7 +51,7 @@ impl VestingAccount for Account { block_time: Option, env: &Env, storage: &dyn Storage, - ) -> Result { + ) -> Result { let vested = self.get_vested_coins(block_time, env, storage)?; let withdrawn = self.load_withdrawn(storage)?; @@ -76,7 +76,7 @@ impl VestingAccount for Account { block_time: Option, env: &Env, storage: &dyn Storage, - ) -> Result { + ) -> Result { let spendable = self.spendable_coins(block_time, env, storage)?; let spendable_vested = self.spendable_vested_coins(block_time, env, storage)?; @@ -92,7 +92,7 @@ impl VestingAccount for Account { block_time: Option, env: &Env, storage: &dyn Storage, - ) -> Result { + ) -> Result { let block_time = block_time.unwrap_or(env.block.time); let period = self.get_current_vesting_period(block_time)?; let denom = MIX_DENOM.load(storage)?; @@ -119,7 +119,7 @@ impl VestingAccount for Account { block_time: Option, env: &Env, storage: &dyn Storage, - ) -> Result { + ) -> Result { Ok(Coin { amount: self.get_original_vesting()?.amount().amount - self.get_vested_coins(block_time, env, storage)?.amount, @@ -135,7 +135,7 @@ impl VestingAccount for Account { self.periods[self.num_vesting_periods() - 1].end_time() } - fn get_original_vesting(&self) -> Result { + fn get_original_vesting(&self) -> Result { Ok(OriginalVestingResponse::new( self.coin.clone(), self.num_vesting_periods(), @@ -147,7 +147,7 @@ impl VestingAccount for Account { &mut self, to_address: &Addr, storage: &mut dyn Storage, - ) -> Result<(), ContractError> { + ) -> Result<(), VestingContractError> { delete_account(self.owner_address(), storage)?; self.owner_address = to_address.to_owned(); save_account(self, storage)?; @@ -158,7 +158,7 @@ impl VestingAccount for Account { &mut self, to_address: Option, storage: &mut dyn Storage, - ) -> Result<(), ContractError> { + ) -> Result<(), VestingContractError> { if let Some(staking_address) = self.staking_address() { delete_account(staking_address.to_owned(), storage)?; } @@ -167,7 +167,11 @@ impl VestingAccount for Account { Ok(()) } - fn track_reward(&self, amount: Coin, storage: &mut dyn Storage) -> Result<(), ContractError> { + fn track_reward( + &self, + amount: Coin, + storage: &mut dyn Storage, + ) -> Result<(), VestingContractError> { let current_balance = self.load_balance(storage)?; let new_balance = current_balance + amount.amount; self.save_balance(new_balance, storage)?; @@ -183,7 +187,7 @@ impl VestingAccount for Account { fn get_historical_vested_staking_rewards( &self, storage: &dyn Storage, - ) -> Result { + ) -> Result { let balance = self.load_balance(storage)?; let withdrawn = self.load_withdrawn(storage)?; let staked = self.total_staked(storage)?; diff --git a/contracts/vesting/src/vesting/mod.rs b/contracts/vesting/src/vesting/mod.rs index 56a02928d7..b16efbdd23 100644 --- a/contracts/vesting/src/vesting/mod.rs +++ b/contracts/vesting/src/vesting/mod.rs @@ -1,43 +1,18 @@ -use cosmwasm_std::Timestamp; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - mod account; -pub use account::*; -use vesting_contract_common::messages::VestingSpecification; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -pub struct VestingPeriod { - pub start_time: u64, - pub period_seconds: u64, -} - -impl VestingPeriod { - pub fn end_time(&self) -> Timestamp { - Timestamp::from_seconds(self.start_time + self.period_seconds) - } -} +pub(crate) use account::StorableVestingAccountExt; +use vesting_contract_common::{VestingPeriod, VestingSpecification}; pub fn populate_vesting_periods( start_time: u64, vesting_spec: VestingSpecification, ) -> Vec { - let mut periods = Vec::with_capacity(vesting_spec.num_periods() as usize); - for i in 0..vesting_spec.num_periods() { - let period = VestingPeriod { - start_time: start_time + i * vesting_spec.period_seconds(), - period_seconds: vesting_spec.period_seconds(), - }; - periods.push(period); - } - periods + vesting_spec.populate_vesting_periods(start_time) } #[cfg(test)] mod tests { use crate::contract::*; - use crate::errors::ContractError; use crate::storage::*; use crate::support::tests::helpers::vesting_account_percent_fixture; use crate::support::tests::helpers::{ @@ -46,15 +21,16 @@ mod tests { use crate::traits::DelegatingAccount; use crate::traits::VestingAccount; use crate::traits::{GatewayBondingAccount, MixnodeBondingAccount}; - use crate::vesting::{populate_vesting_periods, Account}; + use crate::vesting::account::StorableVestingAccountExt; + use crate::vesting::populate_vesting_periods; use contracts_common::signing::MessageSignature; use cosmwasm_std::testing::{mock_env, mock_info}; use cosmwasm_std::{coin, coins, Addr, Coin, Timestamp, Uint128}; use mixnet_contract_common::mixnode::MixNodeCostParams; use mixnet_contract_common::{Gateway, MixNode, Percent}; - use vesting_contract_common::messages::{ExecuteMsg, VestingSpecification}; - use vesting_contract_common::Period; - use vesting_contract_common::PledgeCap; + use vesting_contract_common::messages::ExecuteMsg; + use vesting_contract_common::{Account, PledgeCap, VestingSpecification}; + use vesting_contract_common::{Period, VestingContractError}; #[test] fn test_account_creation() { @@ -317,7 +293,9 @@ mod tests { staking_address_change, ); assert_eq!( - Err(ContractError::StakingAccountExists("vesting1".to_string())), + Err(VestingContractError::StakingAccountExists( + "vesting1".to_string() + )), res ); @@ -802,7 +780,7 @@ mod tests { VestingSpecification::new(None, Some(vesting_period_length_secs), None), ); - let vesting_account = Account::new( + let vesting_account = Account::save_new( Addr::unchecked("owner"), Some(Addr::unchecked("staking")), Coin { @@ -842,7 +820,7 @@ mod tests { assert_eq!( res, - ContractError::TooManyDelegations { + VestingContractError::TooManyDelegations { address: vesting_account.owner_address(), acc_id: vesting_account.storage_key(), mix_id, diff --git a/nym-connect/desktop/Cargo.lock b/nym-connect/desktop/Cargo.lock index 1b9ca04b31..c1acf4ee4e 100644 --- a/nym-connect/desktop/Cargo.lock +++ b/nym-connect/desktop/Cargo.lock @@ -284,8 +284,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93f2635620bf0b9d4576eb7bb9a38a55df78bd1205d26fa994b25911a69f212f" dependencies = [ "bitcoin_hashes", - "rand 0.7.3", - "rand_core 0.5.1", + "rand 0.8.5", + "rand_core 0.6.4", "serde", "unicode-normalization", "zeroize", @@ -399,6 +399,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "bnum" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "845141a4fade3f790628b7daaaa298a25b204fb28907eb54febe5142db6ce653" + [[package]] name = "brotli" version = "3.3.4" @@ -833,9 +839,9 @@ dependencies = [ [[package]] name = "cosmwasm-crypto" -version = "1.2.5" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75836a10cb9654c54e77ee56da94d592923092a10b369cdb0dbd56acefc16340" +checksum = "0d076a08ec01ed23c4396aca98ec73a38fa1fee5f310465add52b4108181c7a8" dependencies = [ "digest 0.10.7", "ed25519-zebra", @@ -846,18 +852,18 @@ dependencies = [ [[package]] name = "cosmwasm-derive" -version = "1.2.5" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c9f7f0e51bfc7295f7b2664fe8513c966428642aa765dad8a74acdab5e0c773" +checksum = "dec361f3c09d7b41221948fc17be9b3c96cb58e55a02f82da36f888a651f2584" dependencies = [ "syn 1.0.109", ] [[package]] name = "cosmwasm-schema" -version = "1.2.5" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f00b363610218eea83f24bbab09e1a7c3920b79f068334fdfcc62f6129ef9fc" +checksum = "bb6b2fb76758ef59cddc77f2e2ae91c22f77da49037e9f182e9c2833f0e959b1" dependencies = [ "cosmwasm-schema-derive", "schemars", @@ -868,9 +874,9 @@ dependencies = [ [[package]] name = "cosmwasm-schema-derive" -version = "1.2.5" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae38f909b2822d32b275c9e2db9728497aa33ffe67dd463bc67c6a3b7092785c" +checksum = "2bfa39422f0d9f1c9a6fd3711573258495314dfa3aae738ea825ecd9964bc659" dependencies = [ "proc-macro2", "quote", @@ -879,11 +885,12 @@ dependencies = [ [[package]] name = "cosmwasm-std" -version = "1.2.5" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a49b85345e811c8e80ec55d0d091e4fcb4f00f97ab058f9be5f614c444a730cb" +checksum = "1f6dc2ee23313add5ecacc3ccac217b9967ad9d2d11bd56e5da6aa65a9da6138" dependencies = [ "base64 0.13.1", + "bnum", "cosmwasm-crypto", "cosmwasm-derive", "derivative", @@ -891,10 +898,9 @@ dependencies = [ "hex", "schemars", "serde", - "serde-json-wasm 0.5.1", + "serde-json-wasm", "sha2 0.10.6", "thiserror", - "uint", ] [[package]] @@ -998,12 +1004,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - [[package]] name = "crypto-bigint" version = "0.4.9" @@ -1151,9 +1151,9 @@ dependencies = [ [[package]] name = "cw-controllers" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91440ce8ec4f0642798bc8c8cb6b9b53c1926c6dadaf0eed267a5145cd529071" +checksum = "d5d8edce4b78785f36413f67387e4be7d0cb7d032b5d4164bcc024f9c3f3f2ea" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -1166,9 +1166,9 @@ dependencies = [ [[package]] name = "cw-storage-plus" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053a5083c258acd68386734f428a5a171b29f7d733151ae83090c6fcc9417ffa" +checksum = "3f0e92a069d62067f3472c62e30adedb4cab1754725c0f2a682b3128d2bf3c79" dependencies = [ "cosmwasm-std", "schemars", @@ -1192,22 +1192,23 @@ dependencies = [ [[package]] name = "cw2" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fb70cee2cf0b4a8ff7253e6bc6647107905e8eb37208f87d54f67810faa62f8" +checksum = "29ac2dc7a55ad64173ca1e0a46697c31b7a5c51342f55a1e84a724da4eb99908" dependencies = [ "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus", "schemars", "serde", + "thiserror", ] [[package]] name = "cw20" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91666da6c7b40c8dd5ff94df655a28114efc10c79b70b4d06f13c31e37d60609" +checksum = "011c45920f8200bd5d32d4fe52502506f64f2f75651ab408054d4cfc75ca3a9b" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -1218,9 +1219,9 @@ dependencies = [ [[package]] name = "cw3" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fe0b587008aa221cd2a2579a21990a28c4347dc53ad43167c68ad765f5b6efa" +checksum = "171af3d9127de6805a7dd819fb070c7d2f6c3ea85f4193f42cef259f0a7f33d5" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -1233,9 +1234,9 @@ dependencies = [ [[package]] name = "cw4" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c236e0bae02ce97e89235a681dd0e07d099524b369f1ef908d704db3e6b049b" +checksum = "a398696307efadaaa2d0850076f865fa706c959d493cb4203314f72be6b77a64" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -3614,22 +3615,20 @@ dependencies = [ name = "nym-coconut-bandwidth-contract-common" version = "0.1.0" dependencies = [ + "cosmwasm-schema", "cosmwasm-std", "nym-multisig-contract-common", - "schemars", - "serde", ] [[package]] name = "nym-coconut-dkg-common" version = "0.1.0" dependencies = [ + "cosmwasm-schema", "cosmwasm-std", "cw-utils", "nym-contracts-common", "nym-multisig-contract-common", - "schemars", - "serde", ] [[package]] @@ -3709,6 +3708,7 @@ name = "nym-contracts-common" version = "0.5.0" dependencies = [ "bs58 0.4.0", + "cosmwasm-schema", "cosmwasm-std", "schemars", "serde", @@ -3851,13 +3851,14 @@ name = "nym-mixnet-contract-common" version = "0.6.0" dependencies = [ "bs58 0.4.0", + "cosmwasm-schema", "cosmwasm-std", "humantime-serde", "log", "nym-contracts-common", "schemars", "serde", - "serde-json-wasm 0.4.1", + "serde-json-wasm", "serde_repr", "thiserror", "time", @@ -3882,11 +3883,11 @@ dependencies = [ name = "nym-name-service-common" version = "0.1.0" dependencies = [ + "cosmwasm-schema", "cosmwasm-std", "cw-controllers", "cw-utils", "nym-contracts-common", - "schemars", "serde", "thiserror", ] @@ -3952,12 +3953,11 @@ dependencies = [ name = "nym-service-provider-directory-common" version = "0.1.0" dependencies = [ + "cosmwasm-schema", "cosmwasm-std", "cw-controllers", "cw-utils", "nym-contracts-common", - "schemars", - "serde", "thiserror", ] @@ -4231,7 +4231,6 @@ dependencies = [ "nym-name-service-common", "nym-network-defaults", "nym-service-provider-directory-common", - "nym-vesting-contract", "nym-vesting-contract-common", "openssl", "prost", @@ -4246,33 +4245,16 @@ dependencies = [ "zeroize", ] -[[package]] -name = "nym-vesting-contract" -version = "1.4.0" -dependencies = [ - "cosmwasm-derive", - "cosmwasm-std", - "cw-storage-plus", - "cw2", - "nym-contracts-common", - "nym-mixnet-contract-common", - "nym-vesting-contract-common", - "schemars", - "semver 1.0.17", - "serde", - "thiserror", - "vergen", -] - [[package]] name = "nym-vesting-contract-common" version = "0.7.0" dependencies = [ + "cosmwasm-schema", "cosmwasm-std", "nym-contracts-common", "nym-mixnet-contract-common", - "schemars", "serde", + "thiserror", ] [[package]] @@ -5691,18 +5673,9 @@ dependencies = [ [[package]] name = "serde-json-wasm" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479b4dbc401ca13ee8ce902851b834893251404c4f3c65370a49e047a6be09a5" -dependencies = [ - "serde", -] - -[[package]] -name = "serde-json-wasm" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16a62a1fad1e1828b24acac8f2b468971dade7b8c3c2e672bcadefefb1f8c137" +checksum = "a15bee9b04dd165c3f4e142628982ddde884c2022a89e8ddf99c4829bf2c3a58" dependencies = [ "serde", ] @@ -6247,12 +6220,6 @@ dependencies = [ "loom", ] -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - [[package]] name = "string_cache" version = "0.8.7" @@ -7173,18 +7140,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" -[[package]] -name = "uint" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" -dependencies = [ - "byteorder", - "crunchy", - "hex", - "static_assertions", -] - [[package]] name = "uname" version = "0.1.1" diff --git a/nym-wallet/Cargo.lock b/nym-wallet/Cargo.lock index 050930055a..2e7df7a43e 100644 --- a/nym-wallet/Cargo.lock +++ b/nym-wallet/Cargo.lock @@ -302,6 +302,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "bnum" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "845141a4fade3f790628b7daaaa298a25b204fb28907eb54febe5142db6ce653" + [[package]] name = "brotli" version = "3.3.4" @@ -680,9 +686,9 @@ dependencies = [ [[package]] name = "cosmwasm-crypto" -version = "1.2.5" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75836a10cb9654c54e77ee56da94d592923092a10b369cdb0dbd56acefc16340" +checksum = "0d076a08ec01ed23c4396aca98ec73a38fa1fee5f310465add52b4108181c7a8" dependencies = [ "digest 0.10.7", "ed25519-zebra", @@ -693,18 +699,18 @@ dependencies = [ [[package]] name = "cosmwasm-derive" -version = "1.2.5" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c9f7f0e51bfc7295f7b2664fe8513c966428642aa765dad8a74acdab5e0c773" +checksum = "dec361f3c09d7b41221948fc17be9b3c96cb58e55a02f82da36f888a651f2584" dependencies = [ "syn 1.0.107", ] [[package]] name = "cosmwasm-schema" -version = "1.2.5" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f00b363610218eea83f24bbab09e1a7c3920b79f068334fdfcc62f6129ef9fc" +checksum = "bb6b2fb76758ef59cddc77f2e2ae91c22f77da49037e9f182e9c2833f0e959b1" dependencies = [ "cosmwasm-schema-derive", "schemars", @@ -715,9 +721,9 @@ dependencies = [ [[package]] name = "cosmwasm-schema-derive" -version = "1.2.5" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae38f909b2822d32b275c9e2db9728497aa33ffe67dd463bc67c6a3b7092785c" +checksum = "2bfa39422f0d9f1c9a6fd3711573258495314dfa3aae738ea825ecd9964bc659" dependencies = [ "proc-macro2", "quote", @@ -726,11 +732,12 @@ dependencies = [ [[package]] name = "cosmwasm-std" -version = "1.2.5" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a49b85345e811c8e80ec55d0d091e4fcb4f00f97ab058f9be5f614c444a730cb" +checksum = "1f6dc2ee23313add5ecacc3ccac217b9967ad9d2d11bd56e5da6aa65a9da6138" dependencies = [ "base64 0.13.1", + "bnum", "cosmwasm-crypto", "cosmwasm-derive", "derivative", @@ -738,10 +745,9 @@ dependencies = [ "hex", "schemars", "serde", - "serde-json-wasm 0.5.1", + "serde-json-wasm", "sha2 0.10.6", "thiserror", - "uint", ] [[package]] @@ -781,12 +787,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - [[package]] name = "crypto-bigint" version = "0.4.9" @@ -911,9 +911,9 @@ dependencies = [ [[package]] name = "cw-controllers" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91440ce8ec4f0642798bc8c8cb6b9b53c1926c6dadaf0eed267a5145cd529071" +checksum = "d5d8edce4b78785f36413f67387e4be7d0cb7d032b5d4164bcc024f9c3f3f2ea" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -926,9 +926,9 @@ dependencies = [ [[package]] name = "cw-storage-plus" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053a5083c258acd68386734f428a5a171b29f7d733151ae83090c6fcc9417ffa" +checksum = "3f0e92a069d62067f3472c62e30adedb4cab1754725c0f2a682b3128d2bf3c79" dependencies = [ "cosmwasm-std", "schemars", @@ -952,22 +952,23 @@ dependencies = [ [[package]] name = "cw2" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fb70cee2cf0b4a8ff7253e6bc6647107905e8eb37208f87d54f67810faa62f8" +checksum = "29ac2dc7a55ad64173ca1e0a46697c31b7a5c51342f55a1e84a724da4eb99908" dependencies = [ "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus", "schemars", "serde", + "thiserror", ] [[package]] name = "cw20" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91666da6c7b40c8dd5ff94df655a28114efc10c79b70b4d06f13c31e37d60609" +checksum = "011c45920f8200bd5d32d4fe52502506f64f2f75651ab408054d4cfc75ca3a9b" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -978,9 +979,9 @@ dependencies = [ [[package]] name = "cw3" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fe0b587008aa221cd2a2579a21990a28c4347dc53ad43167c68ad765f5b6efa" +checksum = "171af3d9127de6805a7dd819fb070c7d2f6c3ea85f4193f42cef259f0a7f33d5" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -993,9 +994,9 @@ dependencies = [ [[package]] name = "cw4" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c236e0bae02ce97e89235a681dd0e07d099524b369f1ef908d704db3e6b049b" +checksum = "a398696307efadaaa2d0850076f865fa706c959d493cb4203314f72be6b77a64" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -2937,22 +2938,20 @@ dependencies = [ name = "nym-coconut-bandwidth-contract-common" version = "0.1.0" dependencies = [ + "cosmwasm-schema", "cosmwasm-std", "nym-multisig-contract-common", - "schemars", - "serde", ] [[package]] name = "nym-coconut-dkg-common" version = "0.1.0" dependencies = [ + "cosmwasm-schema", "cosmwasm-std", "cw-utils", "nym-contracts-common", "nym-multisig-contract-common", - "schemars", - "serde", ] [[package]] @@ -2984,6 +2983,7 @@ name = "nym-contracts-common" version = "0.5.0" dependencies = [ "bs58 0.4.0", + "cosmwasm-schema", "cosmwasm-std", "schemars", "serde", @@ -3042,13 +3042,14 @@ name = "nym-mixnet-contract-common" version = "0.6.0" dependencies = [ "bs58 0.4.0", + "cosmwasm-schema", "cosmwasm-std", "humantime-serde", "log", "nym-contracts-common", "schemars", "serde", - "serde-json-wasm 0.4.1", + "serde-json-wasm", "serde_repr", "thiserror", "time", @@ -3074,11 +3075,11 @@ dependencies = [ name = "nym-name-service-common" version = "0.1.0" dependencies = [ + "cosmwasm-schema", "cosmwasm-std", "cw-controllers", "cw-utils", "nym-contracts-common", - "schemars", "serde", "thiserror", ] @@ -3107,12 +3108,11 @@ dependencies = [ name = "nym-service-provider-directory-common" version = "0.1.0" dependencies = [ + "cosmwasm-schema", "cosmwasm-std", "cw-controllers", "cw-utils", "nym-contracts-common", - "schemars", - "serde", "thiserror", ] @@ -3151,7 +3151,6 @@ dependencies = [ "nym-config", "nym-mixnet-contract-common", "nym-validator-client", - "nym-vesting-contract", "nym-vesting-contract-common", "reqwest", "schemars", @@ -3192,7 +3191,6 @@ dependencies = [ "nym-name-service-common", "nym-network-defaults", "nym-service-provider-directory-common", - "nym-vesting-contract", "nym-vesting-contract-common", "openssl", "prost", @@ -3207,33 +3205,16 @@ dependencies = [ "zeroize", ] -[[package]] -name = "nym-vesting-contract" -version = "1.4.0" -dependencies = [ - "cosmwasm-derive", - "cosmwasm-std", - "cw-storage-plus", - "cw2", - "nym-contracts-common", - "nym-mixnet-contract-common", - "nym-vesting-contract-common", - "schemars", - "semver 1.0.16", - "serde", - "thiserror", - "vergen", -] - [[package]] name = "nym-vesting-contract-common" version = "0.7.0" dependencies = [ + "cosmwasm-schema", "cosmwasm-std", "nym-contracts-common", "nym-mixnet-contract-common", - "schemars", "serde", + "thiserror", ] [[package]] @@ -3263,7 +3244,6 @@ dependencies = [ "nym-network-defaults", "nym-types", "nym-validator-client", - "nym-vesting-contract", "nym-vesting-contract-common", "serde", "serde_json", @@ -3298,7 +3278,6 @@ dependencies = [ "nym-store-cipher", "nym-types", "nym-validator-client", - "nym-vesting-contract", "nym-vesting-contract-common", "nym-wallet-types", "once_cell", @@ -4468,18 +4447,9 @@ dependencies = [ [[package]] name = "serde-json-wasm" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479b4dbc401ca13ee8ce902851b834893251404c4f3c65370a49e047a6be09a5" -dependencies = [ - "serde", -] - -[[package]] -name = "serde-json-wasm" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16a62a1fad1e1828b24acac8f2b468971dade7b8c3c2e672bcadefefb1f8c137" +checksum = "a15bee9b04dd165c3f4e142628982ddde884c2022a89e8ddf99c4829bf2c3a58" dependencies = [ "serde", ] @@ -4785,12 +4755,6 @@ dependencies = [ "loom", ] -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - [[package]] name = "string_cache" version = "0.8.4" @@ -5622,18 +5586,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" -[[package]] -name = "uint" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" -dependencies = [ - "byteorder", - "crunchy", - "hex", - "static_assertions", -] - [[package]] name = "unicode-bidi" version = "0.3.10" diff --git a/nym-wallet/nym-wallet-types/Cargo.toml b/nym-wallet/nym-wallet-types/Cargo.toml index 63a4aa5daf..670739ad5f 100644 --- a/nym-wallet/nym-wallet-types/Cargo.toml +++ b/nym-wallet/nym-wallet-types/Cargo.toml @@ -11,7 +11,7 @@ serde_json = "1.0" strum = { version = "0.23", features = ["derive"] } ts-rs = "6.1.2" -cosmwasm-std = "1.2.0" +cosmwasm-std = "1.3.0" cosmrs = "=0.14.0" nym-config = { path = "../../common/config" } @@ -19,8 +19,6 @@ nym-network-defaults = { path = "../../common/network-defaults" } nym-mixnet-contract-common = { path = "../../common/cosmwasm-smart-contracts/mixnet-contract" } nym-validator-client = { path = "../../common/client-libs/validator-client" } nym-vesting-contract-common = { path = "../../common/cosmwasm-smart-contracts/vesting-contract" } -# Used for Type conversion, can be extracted but its a lot of work -nym-vesting-contract = { path = "../../contracts/vesting" } nym-types = { path = "../../common/types" } diff --git a/nym-wallet/src-tauri/Cargo.toml b/nym-wallet/src-tauri/Cargo.toml index 19b5f0e3c9..8c96f181f1 100644 --- a/nym-wallet/src-tauri/Cargo.toml +++ b/nym-wallet/src-tauri/Cargo.toml @@ -48,7 +48,7 @@ k256 = { version = "0.13", features = ["ecdsa", "sha256"] } base64 = "0.13" zeroize = { version = "1.5", features = ["zeroize_derive", "serde"] } -cosmwasm-std = "1.2.0" +cosmwasm-std = "1.3.0" cosmrs = "=0.14.0" nym-validator-client = { path = "../../common/client-libs/validator-client", features = [ @@ -60,8 +60,6 @@ nym-mixnet-contract-common = { path = "../../common/cosmwasm-smart-contracts/mix nym-vesting-contract-common = { path = "../../common/cosmwasm-smart-contracts/vesting-contract" } nym-config = { path = "../../common/config" } nym-coconut-interface = { path = "../../common/coconut-interface" } -# Used for Type conversion, can be extracted but its a lot of work -nym-vesting-contract = { path = "../../contracts/vesting" } nym-types = { path = "../../common/types" } nym-wallet-types = { path = "../nym-wallet-types" } nym-store-cipher = { path = "../../common/store-cipher", features = ["json"] } diff --git a/nym-wallet/src-tauri/src/utils.rs b/nym-wallet/src-tauri/src/utils.rs index e5aed4e092..579ccc5add 100644 --- a/nym-wallet/src-tauri/src/utils.rs +++ b/nym-wallet/src-tauri/src/utils.rs @@ -53,7 +53,9 @@ pub async fn try_convert_pubkey_to_mix_id( let res = nyxd_client!(state) .get_mixnode_details_by_identity(mix_identity) .await?; - Ok(res.map(|mixnode_details| mixnode_details.mix_id())) + Ok(res + .mixnode_details + .map(|mixnode_details| mixnode_details.mix_id())) } #[tauri::command]