removal of contracts/ workspace experiment commit
This commit is contained in:
Generated
+353
-5
@@ -913,7 +913,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "bls12_381"
|
||||
version = "0.8.0"
|
||||
source = "git+https://github.com/jstuczyn/bls12_381?branch=temp%2Fexperimental-serdect-updated#9bf520059cb28323fc51469cae86868ef4fa6fbd"
|
||||
source = "git+https://github.com/nymtech/bls12_381?branch=temp%2Fexperimental-serdect-updated#9bf520059cb28323fc51469cae86868ef4fa6fbd"
|
||||
dependencies = [
|
||||
"digest 0.10.7",
|
||||
"ff",
|
||||
@@ -1414,12 +1414,30 @@ dependencies = [
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "const_panic"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e262cdaac42494e3ae34c43969f9cdeb7da178bdb4b66fa6a1ea2edb4c8ae652"
|
||||
dependencies = [
|
||||
"typewit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "constant_time_eq"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6"
|
||||
|
||||
[[package]]
|
||||
name = "convert_case"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baaaa0ecca5b51987b9423ccdc971514dd8b0bb7b4060b983d3664dad3f1f89f"
|
||||
dependencies = [
|
||||
"unicode-segmentation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cookie"
|
||||
version = "0.18.1"
|
||||
@@ -1488,9 +1506,9 @@ checksum = "63efd882086668c3bad621b5b897a0e058d0b5fae027c984e1a6230bf284ab85"
|
||||
|
||||
[[package]]
|
||||
name = "cosmwasm-crypto"
|
||||
version = "2.3.0"
|
||||
version = "2.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0969e6f569f867725bf89e672058ae336e130c1fcf914def4f7c6c0380b2bc83"
|
||||
checksum = "aa2f53285517db3e33d825b3e46301efe845135778527e1295154413b2f0469e"
|
||||
dependencies = [
|
||||
"ark-bls12-381",
|
||||
"ark-ec",
|
||||
@@ -1512,9 +1530,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cosmwasm-derive"
|
||||
version = "2.3.0"
|
||||
version = "2.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d0da0db99715fc86e6a5ad7be9c19d0d9e5a92179862b17cae7406b729a402c2"
|
||||
checksum = "a782b93fae93e57ca8ad3e9e994e784583f5933aeaaa5c80a545c4b437be2047"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -2003,6 +2021,23 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cw20-base"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d6de8c32e100f1fca306972d86b617234a5e6b00594ea2b48716fd6804d4d95d"
|
||||
dependencies = [
|
||||
"cosmwasm-schema",
|
||||
"cosmwasm-std",
|
||||
"cw-storage-plus",
|
||||
"cw2",
|
||||
"cw20",
|
||||
"schemars 0.8.22",
|
||||
"semver 1.0.27",
|
||||
"serde",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cw3"
|
||||
version = "2.0.0"
|
||||
@@ -2018,6 +2053,46 @@ dependencies = [
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cw3-fixed-multisig"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a8233125653e61e898eaade6c6fdb3bd9c48aceb2ad97e84eada2c9bf5bff46"
|
||||
dependencies = [
|
||||
"cosmwasm-schema",
|
||||
"cosmwasm-std",
|
||||
"cw-storage-plus",
|
||||
"cw-utils",
|
||||
"cw2",
|
||||
"cw3",
|
||||
"schemars 0.8.22",
|
||||
"serde",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cw3-flex-multisig"
|
||||
version = "2.0.0"
|
||||
dependencies = [
|
||||
"cosmwasm-schema",
|
||||
"cosmwasm-std",
|
||||
"cw-multi-test",
|
||||
"cw-storage-plus",
|
||||
"cw-utils",
|
||||
"cw2",
|
||||
"cw20",
|
||||
"cw20-base",
|
||||
"cw3",
|
||||
"cw3-fixed-multisig",
|
||||
"cw4",
|
||||
"cw4-group",
|
||||
"easy-addr",
|
||||
"nym-contracts-common",
|
||||
"nym-contracts-common-testing",
|
||||
"nym-group-contract-common",
|
||||
"nym-multisig-contract-common",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cw4"
|
||||
version = "2.0.0"
|
||||
@@ -2031,6 +2106,26 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cw4-group"
|
||||
version = "2.0.0"
|
||||
dependencies = [
|
||||
"cosmwasm-schema",
|
||||
"cosmwasm-std",
|
||||
"cw-controllers",
|
||||
"cw-storage-plus",
|
||||
"cw-utils",
|
||||
"cw2",
|
||||
"cw4",
|
||||
"easy-addr",
|
||||
"nym-contracts-common",
|
||||
"nym-contracts-common-testing",
|
||||
"nym-group-contract-common",
|
||||
"schemars 0.8.22",
|
||||
"serde",
|
||||
"thiserror 2.0.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling"
|
||||
version = "0.20.11"
|
||||
@@ -4228,6 +4323,33 @@ version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c33070833c9ee02266356de0c43f723152bd38bd96ddf52c82b3af10c9138b28"
|
||||
|
||||
[[package]]
|
||||
name = "konst"
|
||||
version = "0.3.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4381b9b00c55f251f2ebe9473aef7c117e96828def1a7cb3bd3f0f903c6894e9"
|
||||
dependencies = [
|
||||
"const_panic",
|
||||
"konst_kernel",
|
||||
"konst_proc_macros",
|
||||
"typewit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "konst_kernel"
|
||||
version = "0.3.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e4b1eb7788f3824c629b1116a7a9060d6e898c358ebff59070093d51103dcc3c"
|
||||
dependencies = [
|
||||
"typewit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "konst_proc_macros"
|
||||
version = "0.3.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "00af7901ba50898c9e545c24d5c580c96a982298134e8037d8978b6594782c07"
|
||||
|
||||
[[package]]
|
||||
name = "kqueue"
|
||||
version = "1.1.1"
|
||||
@@ -4619,6 +4741,21 @@ dependencies = [
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mixnet-vesting-integration-tests"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cosmwasm-std",
|
||||
"cw-multi-test",
|
||||
"nym-contracts-common",
|
||||
"nym-crypto",
|
||||
"nym-mixnet-contract",
|
||||
"nym-mixnet-contract-common",
|
||||
"nym-vesting-contract",
|
||||
"nym-vesting-contract-common",
|
||||
"rand_chacha 0.3.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mock_instant"
|
||||
version = "0.6.0"
|
||||
@@ -5424,6 +5561,28 @@ dependencies = [
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nym-coconut-dkg"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cosmwasm-schema",
|
||||
"cosmwasm-std",
|
||||
"cw-controllers",
|
||||
"cw-multi-test",
|
||||
"cw-storage-plus",
|
||||
"cw2",
|
||||
"cw3-flex-multisig",
|
||||
"cw4",
|
||||
"cw4-group",
|
||||
"easy-addr",
|
||||
"nym-coconut-dkg-common",
|
||||
"nym-contracts-common",
|
||||
"nym-contracts-common-testing",
|
||||
"nym-group-contract-common",
|
||||
"thiserror 2.0.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nym-coconut-dkg-common"
|
||||
version = "1.20.1"
|
||||
@@ -5860,6 +6019,34 @@ dependencies = [
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nym-ecash"
|
||||
version = "1.20.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bs58",
|
||||
"cosmwasm-schema",
|
||||
"cosmwasm-std",
|
||||
"cw-controllers",
|
||||
"cw-multi-test",
|
||||
"cw-storage-plus",
|
||||
"cw-utils",
|
||||
"cw2",
|
||||
"cw3",
|
||||
"cw4",
|
||||
"nym-contracts-common",
|
||||
"nym-crypto",
|
||||
"nym-ecash-contract-common",
|
||||
"nym-multisig-contract-common",
|
||||
"nym-network-defaults",
|
||||
"rand_chacha 0.3.1",
|
||||
"schemars 0.8.22",
|
||||
"semver 1.0.27",
|
||||
"serde",
|
||||
"sylvia",
|
||||
"thiserror 2.0.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nym-ecash-contract-common"
|
||||
version = "1.20.1"
|
||||
@@ -6387,6 +6574,30 @@ dependencies = [
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nym-mixnet-contract"
|
||||
version = "1.5.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bs58",
|
||||
"cosmwasm-schema",
|
||||
"cosmwasm-std",
|
||||
"cw-controllers",
|
||||
"cw-storage-plus",
|
||||
"cw2",
|
||||
"easy-addr",
|
||||
"nym-contracts-common",
|
||||
"nym-contracts-common-testing",
|
||||
"nym-crypto",
|
||||
"nym-mixnet-contract",
|
||||
"nym-mixnet-contract-common",
|
||||
"nym-vesting-contract-common",
|
||||
"rand 0.8.5",
|
||||
"rand_chacha 0.3.1",
|
||||
"semver 1.0.27",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nym-mixnet-contract-common"
|
||||
version = "1.20.1"
|
||||
@@ -6906,6 +7117,25 @@ dependencies = [
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nym-performance-contract"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cosmwasm-schema",
|
||||
"cosmwasm-std",
|
||||
"cw-controllers",
|
||||
"cw-storage-plus",
|
||||
"cw2",
|
||||
"nym-contracts-common",
|
||||
"nym-contracts-common-testing",
|
||||
"nym-crypto",
|
||||
"nym-mixnet-contract",
|
||||
"nym-mixnet-contract-common",
|
||||
"nym-performance-contract-common",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nym-performance-contract-common"
|
||||
version = "1.20.1"
|
||||
@@ -6919,6 +7149,21 @@ dependencies = [
|
||||
"thiserror 2.0.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nym-pool-contract"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cosmwasm-schema",
|
||||
"cosmwasm-std",
|
||||
"cw-controllers",
|
||||
"cw-storage-plus",
|
||||
"cw2",
|
||||
"nym-contracts-common",
|
||||
"nym-contracts-common-testing",
|
||||
"nym-pool-contract-common",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nym-pool-contract-common"
|
||||
version = "1.20.1"
|
||||
@@ -7666,6 +7911,27 @@ dependencies = [
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nym-vesting-contract"
|
||||
version = "1.4.1"
|
||||
dependencies = [
|
||||
"base64 0.21.7",
|
||||
"cosmwasm-crypto",
|
||||
"cosmwasm-derive",
|
||||
"cosmwasm-schema",
|
||||
"cosmwasm-std",
|
||||
"cw-storage-plus",
|
||||
"cw2",
|
||||
"hex",
|
||||
"nym-contracts-common",
|
||||
"nym-mixnet-contract-common",
|
||||
"nym-vesting-contract-common",
|
||||
"rand_chacha 0.3.1",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror 2.0.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nym-vesting-contract-common"
|
||||
version = "1.20.1"
|
||||
@@ -8726,6 +8992,30 @@ dependencies = [
|
||||
"toml_edit 0.23.10+spec-1.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-error"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
|
||||
dependencies = [
|
||||
"proc-macro-error-attr",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-error-attr"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-error-attr2"
|
||||
version = "2.0.0"
|
||||
@@ -9717,6 +10007,15 @@ dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde-cw-value"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a75d32da6b8ed758b7d850b6c3c08f1d7df51a4df3cb201296e63e34a78e99d4"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde-json-wasm"
|
||||
version = "1.0.1"
|
||||
@@ -10554,6 +10853,40 @@ dependencies = [
|
||||
"rsa",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sylvia"
|
||||
version = "1.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "967a2aceb034b72e9ec106f6f889a45cebd8a93e831ceafb490ec8a0fb2fdb13"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cosmwasm-schema",
|
||||
"cosmwasm-std",
|
||||
"cw-multi-test",
|
||||
"cw-utils",
|
||||
"konst",
|
||||
"schemars 0.8.22",
|
||||
"serde",
|
||||
"serde-cw-value",
|
||||
"serde-json-wasm",
|
||||
"sylvia-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sylvia-derive"
|
||||
version = "1.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4a9f6b6ef457c685c596939baeb4e1c7257e949d690fa89be1aaea27963183e"
|
||||
dependencies = [
|
||||
"convert_case",
|
||||
"itertools 0.14.0",
|
||||
"proc-macro-crate",
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.113",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.109"
|
||||
@@ -11692,6 +12025,21 @@ version = "1.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb"
|
||||
|
||||
[[package]]
|
||||
name = "typewit"
|
||||
version = "1.14.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8c1ae7cc0fdb8b842d65d127cb981574b0d2b249b74d1c7a2986863dc134f71"
|
||||
dependencies = [
|
||||
"typewit_proc_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typewit_proc_macros"
|
||||
version = "1.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e36a83ea2b3c704935a01b4642946aadd445cea40b10935e3f8bd8052b8193d6"
|
||||
|
||||
[[package]]
|
||||
name = "ucd-trie"
|
||||
version = "0.1.7"
|
||||
|
||||
+34
-3
@@ -168,7 +168,19 @@ members = [
|
||||
"wasm/mix-fetch",
|
||||
"wasm/node-tester",
|
||||
"wasm/zknym-lib",
|
||||
"nym-gateway-probe"
|
||||
"nym-gateway-probe",
|
||||
|
||||
# experimenting with moving contracts/ workspace members into here
|
||||
"contracts/coconut-dkg",
|
||||
"contracts/ecash",
|
||||
"contracts/mixnet",
|
||||
"contracts/mixnet-vesting-integration-tests",
|
||||
"contracts/nym-pool",
|
||||
"contracts/multisig/cw3-flex-multisig",
|
||||
"contracts/multisig/cw4-group",
|
||||
"contracts/vesting",
|
||||
"contracts/performance",
|
||||
|
||||
]
|
||||
|
||||
default-members = [
|
||||
@@ -188,7 +200,7 @@ default-members = [
|
||||
"tools/nymvisor",
|
||||
]
|
||||
|
||||
exclude = ["contracts", "nym-wallet", "cpu-cycles"]
|
||||
exclude = ["nym-wallet", "cpu-cycles"]
|
||||
|
||||
[workspace.package]
|
||||
authors = ["Nym Technologies SA"]
|
||||
@@ -473,11 +485,22 @@ nym-wasm-client-core = { version = "1.20.1", path = "common/wasm/client-core" }
|
||||
nym-wasm-storage = { version = "1.20.1", path = "common/wasm/storage" }
|
||||
nym-wasm-utils = { version = "1.20.1", path = "common/wasm/utils", default-features = false }
|
||||
|
||||
# experimenting with moving contracts/ workspace members into here
|
||||
cw3-flex-multisig = { version = "2.0.0", path = "contracts/multisig/cw3-flex-multisig" }
|
||||
cw4-group = { version = "2.0.0", path = "contracts/multisig/cw4-group" }
|
||||
|
||||
nym-contracts-common-testing = { version = "1.20.1", path = "common/cosmwasm-smart-contracts/contracts-common-testing" }
|
||||
easy-addr = { version = "1.20.1", path = "common/cosmwasm-smart-contracts/easy_addr" }
|
||||
nym-pool-contract-common = { version = "1.20.1", path = "common/cosmwasm-smart-contracts/nym-pool-contract" }
|
||||
nym-mixnet-contract = { version = "1.5.1", path = "contracts/mixnet" }
|
||||
|
||||
|
||||
# coconut/DKG related
|
||||
# unfortunately until https://github.com/zkcrypto/bls12_381/issues/10 is resolved, we have to rely on the fork
|
||||
# as we need to be able to serialize Gt so that we could create the lookup table for baby-step-giant-step algorithm
|
||||
# plus to make our live easier we need serde support from https://github.com/zkcrypto/bls12_381/pull/125
|
||||
bls12_381 = { git = "https://github.com/jstuczyn/bls12_381", default-features = false, branch = "temp/experimental-serdect-updated" }
|
||||
# MAX TODO upload this to crates.io and then pull in from there
|
||||
bls12_381 = { git = "https://github.com/nymtech/bls12_381", default-features = false, branch = "temp/experimental-serdect-updated" }
|
||||
group = { version = "0.13.0", default-features = false }
|
||||
ff = { version = "0.13.1", default-features = false }
|
||||
subtle = "2.5.0"
|
||||
@@ -494,6 +517,14 @@ cw4 = { version = "=2.0.0" }
|
||||
cw-controllers = { version = "=2.0.0" }
|
||||
cw-multi-test = "=2.3.2"
|
||||
|
||||
# experimenting with moving contracts/ workspace members into here - additional required deps
|
||||
cosmwasm-crypto = "=2.2.2"
|
||||
cosmwasm-derive = "=2.2.2"
|
||||
cw3-fixed-multisig = "=2.0.0"
|
||||
cw20 = "=2.0.0"
|
||||
cw20-base = "2.0.0"
|
||||
sylvia = "1.3.3"
|
||||
|
||||
# cosmrs-related
|
||||
bip32 = { version = "0.5.3", default-features = false }
|
||||
|
||||
|
||||
@@ -57,6 +57,11 @@ schemars = "0.8.16"
|
||||
|
||||
thiserror = "2.0.11"
|
||||
|
||||
# nym-coconut-dkg-common = { path = "../common/cosmwasm-smart-contracts/coconut-dkg" }
|
||||
# nym-contracts-common = { path = "../common/cosmwasm-smart-contracts/contracts-common" }
|
||||
# nym-mixnet-contract-common = { path = "../common/cosmwasm-smart-contracts/mixnet-contract" }
|
||||
# nym-multisig-contract-common = { path = "../common/cosmwasm-smart-contracts/multisig-contract" }
|
||||
|
||||
[workspace.lints.clippy]
|
||||
unwrap_used = "deny"
|
||||
expect_used = "deny"
|
||||
@@ -17,9 +17,9 @@ crate-type = ["cdylib", "rlib"]
|
||||
|
||||
[dependencies]
|
||||
nym-coconut-dkg-common = { workspace = true }
|
||||
nym-contracts-common = { path = "../../common/cosmwasm-smart-contracts/contracts-common" }
|
||||
nym-contracts-common-testing = { path = "../../common/cosmwasm-smart-contracts/contracts-common-testing", optional = true }
|
||||
nym-group-contract-common = { path = "../../common/cosmwasm-smart-contracts/group-contract", optional = true }
|
||||
nym-contracts-common = { workspace = true }
|
||||
nym-contracts-common-testing = { workspace = true, optional = true }
|
||||
nym-group-contract-common = { workspace = true, optional = true }
|
||||
|
||||
cosmwasm-schema = { workspace = true, optional = true }
|
||||
cosmwasm-std = { workspace = true }
|
||||
@@ -30,15 +30,15 @@ cw2 = { workspace = true }
|
||||
cw4 = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
|
||||
cw3-flex-multisig = { path = "../multisig/cw3-flex-multisig", features = ["testable-cw3-contract"], optional = true }
|
||||
cw4-group = { path = "../multisig/cw4-group", features = ["testable-cw4-contract"], optional = true }
|
||||
cw3-flex-multisig = { workspace = true, features = ["testable-cw3-contract"], optional = true }
|
||||
cw4-group = { workspace = true, features = ["testable-cw4-contract"], optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
anyhow = { workspace = true }
|
||||
easy-addr = { path = "../../common/cosmwasm-smart-contracts/easy_addr" }
|
||||
nym-group-contract-common = { path = "../../common/cosmwasm-smart-contracts/group-contract" }
|
||||
easy-addr = { workspace = true }
|
||||
nym-group-contract-common = { workspace = true }
|
||||
cw-multi-test = { workspace = true }
|
||||
cw4-group = { path = "../multisig/cw4-group" }
|
||||
cw4-group = { workspace = true }
|
||||
|
||||
[features]
|
||||
schema-gen = ["nym-coconut-dkg-common/schema", "cosmwasm-schema"]
|
||||
|
||||
@@ -28,17 +28,17 @@ cw2 = { workspace = true }
|
||||
cw3 = { workspace = true }
|
||||
cw4 = { workspace = true }
|
||||
cw-utils = { workspace = true }
|
||||
semver = { workspace = true, default-features = false }
|
||||
semver = { workspace = true }
|
||||
|
||||
nym-ecash-contract-common = { path = "../../common/cosmwasm-smart-contracts/ecash-contract" }
|
||||
nym-contracts-common = { path = "../../common/cosmwasm-smart-contracts/contracts-common" }
|
||||
nym-multisig-contract-common = { path = "../../common/cosmwasm-smart-contracts/multisig-contract" }
|
||||
nym-network-defaults = { path = "../../common/network-defaults", default-features = false }
|
||||
nym-ecash-contract-common = { workspace = true }
|
||||
nym-contracts-common = { workspace = true }
|
||||
nym-multisig-contract-common = { workspace = true }
|
||||
nym-network-defaults = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
anyhow = { workspace = true }
|
||||
sylvia = { workspace = true, features = ["mt"] }
|
||||
nym-crypto = { path = "../../common/crypto", features = ["rand", "asymmetric"] }
|
||||
nym-crypto = { workspace = true, features = ["rand", "asymmetric"] }
|
||||
rand_chacha = "0.3"
|
||||
cw-multi-test = { workspace = true }
|
||||
|
||||
|
||||
+10
-10
@@ -26,10 +26,10 @@ name = "mixnet_contract"
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
[dependencies]
|
||||
mixnet-contract-common = { path = "../../common/cosmwasm-smart-contracts/mixnet-contract", package = "nym-mixnet-contract-common" }
|
||||
vesting-contract-common = { path = "../../common/cosmwasm-smart-contracts/vesting-contract", package = "nym-vesting-contract-common" }
|
||||
nym-contracts-common = { path = "../../common/cosmwasm-smart-contracts/contracts-common" }
|
||||
nym-contracts-common-testing = { path = "../../common/cosmwasm-smart-contracts/contracts-common-testing", optional = true }
|
||||
nym-mixnet-contract-common = { workspace = true }
|
||||
nym-vesting-contract-common = { workspace = true }
|
||||
nym-contracts-common = { workspace = true }
|
||||
nym-contracts-common-testing = { workspace = true, optional = true }
|
||||
|
||||
cosmwasm-schema = { workspace = true, optional = true }
|
||||
cosmwasm-std = { workspace = true }
|
||||
@@ -38,7 +38,7 @@ cw2 = { workspace = true }
|
||||
cw-storage-plus = { workspace = true }
|
||||
|
||||
bs58 = { workspace = true }
|
||||
serde = { workspace = true, default-features = false, features = ["derive"] }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
semver = { workspace = true }
|
||||
|
||||
|
||||
@@ -46,8 +46,8 @@ semver = { workspace = true }
|
||||
anyhow.workspace = true
|
||||
rand_chacha = { workspace = true }
|
||||
rand = { workspace = true }
|
||||
nym-crypto = { path = "../../common/crypto", features = ["asymmetric", "rand"] }
|
||||
easy-addr = { path = "../../common/cosmwasm-smart-contracts/easy_addr" }
|
||||
nym-crypto = { workspace = true, features = ["asymmetric", "rand"] }
|
||||
easy-addr = { workspace = true }
|
||||
|
||||
# activate the `testable-mixnet-contract` in tests (weird workaround, but it does the trick)
|
||||
nym-mixnet-contract = { path = ".", features = ["testable-mixnet-contract"] }
|
||||
@@ -55,9 +55,9 @@ nym-contracts-common-testing = { path = "../../common/cosmwasm-smart-contracts/c
|
||||
|
||||
[features]
|
||||
default = []
|
||||
contract-testing = ["mixnet-contract-common/contract-testing"]
|
||||
contract-testing = ["nym-mixnet-contract-common/contract-testing"]
|
||||
testable-mixnet-contract = ["nym-contracts-common-testing"]
|
||||
schema-gen = ["mixnet-contract-common/schema", "cosmwasm-schema"]
|
||||
schema-gen = ["nym-mixnet-contract-common/schema", "cosmwasm-schema"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
workspace = true
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use cosmwasm_schema::write_api;
|
||||
use mixnet_contract_common::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg};
|
||||
use nym_mixnet_contract_common::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg};
|
||||
|
||||
fn main() {
|
||||
write_api! {
|
||||
|
||||
@@ -6,9 +6,9 @@ use crate::mixnodes::storage as mixnode_storage;
|
||||
use crate::nodes::storage as nymnodes_storage;
|
||||
use crate::support::helpers::ensure_epoch_in_progress_state;
|
||||
use cosmwasm_std::{Coin, StdResult, Storage};
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::helpers::{NodeBond, NodeDetails, PendingChanges};
|
||||
use mixnet_contract_common::NodeId;
|
||||
use nym_mixnet_contract_common::NodeId;
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_mixnet_contract_common::helpers::{NodeBond, NodeDetails, PendingChanges};
|
||||
|
||||
pub fn ensure_can_withdraw_rewards<D>(node_details: &D) -> Result<(), MixnetContractError>
|
||||
where
|
||||
|
||||
@@ -10,7 +10,7 @@ pub(crate) mod rewards {
|
||||
use crate::mixnodes::helpers::{get_mixnode_details_by_id, get_mixnode_details_by_owner};
|
||||
use crate::nodes::helpers::{get_node_details_by_id, get_node_details_by_owner};
|
||||
use cosmwasm_std::{Addr, Deps, StdResult};
|
||||
use mixnet_contract_common::{NodeId, PendingRewardResponse};
|
||||
use nym_mixnet_contract_common::{NodeId, PendingRewardResponse};
|
||||
|
||||
#[allow(deprecated)]
|
||||
pub(crate) fn pending_operator_reward(
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
// use crate::rewards::storage as rewards_storage;
|
||||
// use cosmwasm_std::Storage;
|
||||
// use cw_storage_plus::Map;
|
||||
// use mixnet_contract_common::error::MixnetContractError;
|
||||
// use mixnet_contract_common::mixnode::PendingMixNodeChanges;
|
||||
// use mixnet_contract_common::{NodeId, PendingNodeChanges};
|
||||
// use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
// use nym_mixnet_contract_common::mixnode::PendingMixNodeChanges;
|
||||
// use nym_mixnet_contract_common::{NodeId, PendingNodeChanges};
|
||||
// use serde::de::DeserializeOwned;
|
||||
// use serde::{Deserialize, Serialize};
|
||||
//
|
||||
|
||||
@@ -16,8 +16,8 @@ use crate::support::helpers::{
|
||||
ensure_operating_cost_within_range, ensure_profit_margin_within_range,
|
||||
};
|
||||
use cosmwasm_std::{Coin, DepsMut, Env, MessageInfo, Response};
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::NodeCostParams;
|
||||
use nym_mixnet_contract_common::NodeCostParams;
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
|
||||
pub(crate) fn try_increase_pledge(
|
||||
deps: DepsMut<'_>,
|
||||
@@ -293,10 +293,10 @@ mod tests {
|
||||
use super::*;
|
||||
use crate::support::tests::fixtures::TEST_COIN_DENOM;
|
||||
use crate::support::tests::test_helpers::TestSetup;
|
||||
use cosmwasm_std::testing::message_info;
|
||||
use cosmwasm_std::Uint128;
|
||||
use mixnet_contract_common::{OperatingCostRange, ProfitMarginRange};
|
||||
use cosmwasm_std::testing::message_info;
|
||||
use nym_contracts_common::Percent;
|
||||
use nym_mixnet_contract_common::{OperatingCostRange, ProfitMarginRange};
|
||||
|
||||
fn new_dummy_params() -> NodeCostParams {
|
||||
NodeCostParams {
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use cosmwasm_std::{Coin, Uint128};
|
||||
use mixnet_contract_common::{
|
||||
NodeCostParams, DEFAULT_INTERVAL_OPERATING_COST_AMOUNT, DEFAULT_PROFIT_MARGIN_PERCENT,
|
||||
};
|
||||
use nym_contracts_common::Percent;
|
||||
use nym_mixnet_contract_common::{
|
||||
DEFAULT_INTERVAL_OPERATING_COST_AMOUNT, DEFAULT_PROFIT_MARGIN_PERCENT, NodeCostParams,
|
||||
};
|
||||
|
||||
/// Constant specifying minimum of coin amount required to bond a node
|
||||
pub const INITIAL_PLEDGE_AMOUNT: Uint128 = Uint128::new(100_000_000);
|
||||
|
||||
@@ -8,15 +8,15 @@ use crate::nodes::storage as nymnodes_storage;
|
||||
use crate::queued_migrations::introduce_key_rotation_id;
|
||||
use crate::rewards::storage::RewardingStorage;
|
||||
use cosmwasm_std::{
|
||||
entry_point, to_json_binary, Addr, Coin, Deps, DepsMut, Env, MessageInfo, QueryResponse,
|
||||
Response,
|
||||
Addr, Coin, Deps, DepsMut, Env, MessageInfo, QueryResponse, Response, entry_point,
|
||||
to_json_binary,
|
||||
};
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::{
|
||||
use nym_contracts_common::set_build_information;
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_mixnet_contract_common::{
|
||||
ConfigScoreParams, ContractState, ContractStateParams, DelegationsParams, ExecuteMsg,
|
||||
InstantiateMsg, Interval, MigrateMsg, OperatorsParams, QueryMsg,
|
||||
};
|
||||
use nym_contracts_common::set_build_information;
|
||||
use std::str::FromStr;
|
||||
|
||||
// version info for migration info
|
||||
@@ -651,13 +651,13 @@ mod tests {
|
||||
use crate::rewards::storage as rewards_storage;
|
||||
use cosmwasm_std::testing::{message_info, mock_env};
|
||||
use cosmwasm_std::{Decimal, Uint128};
|
||||
use mixnet_contract_common::reward_params::{
|
||||
use nym_contracts_common_testing::mock_dependencies;
|
||||
use nym_mixnet_contract_common::reward_params::{
|
||||
IntervalRewardParams, RewardedSetParams, RewardingParams,
|
||||
};
|
||||
use mixnet_contract_common::{
|
||||
use nym_mixnet_contract_common::{
|
||||
InitialRewardingParams, OperatingCostRange, Percent, ProfitMarginRange,
|
||||
};
|
||||
use nym_contracts_common_testing::mock_dependencies;
|
||||
use std::time::Duration;
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
use crate::delegations::storage;
|
||||
use crate::rewards::storage as rewards_storage;
|
||||
use cosmwasm_std::{Coin, Storage};
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::mixnode::NodeRewarding;
|
||||
use mixnet_contract_common::Delegation;
|
||||
use nym_mixnet_contract_common::Delegation;
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_mixnet_contract_common::mixnode::NodeRewarding;
|
||||
|
||||
pub(crate) fn undelegate(
|
||||
store: &mut dyn Storage,
|
||||
@@ -26,7 +26,7 @@ mod tests {
|
||||
use super::*;
|
||||
use crate::support::tests::test_helpers::TestSetup;
|
||||
use cosmwasm_std::{Addr, Decimal, Uint128};
|
||||
use mixnet_contract_common::rewarding::helpers::truncate_reward_amount;
|
||||
use nym_mixnet_contract_common::rewarding::helpers::truncate_reward_amount;
|
||||
|
||||
#[test]
|
||||
fn undelegation_updates_mix_rewarding_storage_and_deletes_delegation() {
|
||||
@@ -61,9 +61,11 @@ mod tests {
|
||||
|
||||
let storage_key =
|
||||
Delegation::generate_storage_key(mix_id, &Addr::unchecked(delegator), None);
|
||||
assert!(storage::delegations()
|
||||
.may_load(test.deps().storage, storage_key)
|
||||
.unwrap()
|
||||
.is_none());
|
||||
assert!(
|
||||
storage::delegations()
|
||||
.may_load(test.deps().storage, storage_key)
|
||||
.unwrap()
|
||||
.is_none()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,10 +10,10 @@ use cosmwasm_std::Deps;
|
||||
use cosmwasm_std::Order;
|
||||
use cosmwasm_std::StdResult;
|
||||
use cw_storage_plus::Bound;
|
||||
use mixnet_contract_common::delegation::{NodeDelegationResponse, OwnerProxySubKey};
|
||||
use mixnet_contract_common::{
|
||||
delegation, Delegation, NodeId, PagedAllDelegationsResponse, PagedDelegatorDelegationsResponse,
|
||||
PagedNodeDelegationsResponse,
|
||||
use nym_mixnet_contract_common::delegation::{NodeDelegationResponse, OwnerProxySubKey};
|
||||
use nym_mixnet_contract_common::{
|
||||
Delegation, NodeId, PagedAllDelegationsResponse, PagedDelegatorDelegationsResponse,
|
||||
PagedNodeDelegationsResponse, delegation,
|
||||
};
|
||||
|
||||
pub(crate) fn query_node_delegations_paged(
|
||||
@@ -466,10 +466,11 @@ mod tests {
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(res1.delegations.len(), 100);
|
||||
assert!(res1
|
||||
.delegations
|
||||
.into_iter()
|
||||
.all(|d| d.owner == test.make_addr("delegator2")));
|
||||
assert!(
|
||||
res1.delegations
|
||||
.into_iter()
|
||||
.all(|d| d.owner == test.make_addr("delegator2"))
|
||||
);
|
||||
|
||||
let res2 = query_delegator_delegations_paged(
|
||||
test.deps(),
|
||||
@@ -479,10 +480,11 @@ mod tests {
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(res2.delegations.len(), 100);
|
||||
assert!(res2
|
||||
.delegations
|
||||
.into_iter()
|
||||
.all(|d| d.owner == test.make_addr("delegator35")));
|
||||
assert!(
|
||||
res2.delegations
|
||||
.into_iter()
|
||||
.all(|d| d.owner == test.make_addr("delegator35"))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ use crate::constants::{
|
||||
DELEGATION_MIXNODE_IDX_NAMESPACE, DELEGATION_OWNER_IDX_NAMESPACE, DELEGATION_PK_NAMESPACE,
|
||||
};
|
||||
use cw_storage_plus::{Index, IndexList, IndexedMap, MultiIndex};
|
||||
use mixnet_contract_common::delegation::OwnerProxySubKey;
|
||||
use mixnet_contract_common::{Addr, Delegation, NodeId};
|
||||
use nym_mixnet_contract_common::delegation::OwnerProxySubKey;
|
||||
use nym_mixnet_contract_common::{Addr, Delegation, NodeId};
|
||||
|
||||
// It's a composite key on node's id and delegator address
|
||||
type PrimaryKey = (NodeId, OwnerProxySubKey);
|
||||
|
||||
@@ -8,12 +8,12 @@ use crate::support::helpers::{
|
||||
ensure_any_node_bonded, ensure_epoch_in_progress_state, validate_delegation_stake,
|
||||
};
|
||||
use cosmwasm_std::{DepsMut, Env, MessageInfo, Response};
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::events::{
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_mixnet_contract_common::events::{
|
||||
new_pending_delegation_event, new_pending_undelegation_event,
|
||||
};
|
||||
use mixnet_contract_common::pending_events::PendingEpochEventKind;
|
||||
use mixnet_contract_common::{Delegation, NodeId};
|
||||
use nym_mixnet_contract_common::pending_events::PendingEpochEventKind;
|
||||
use nym_mixnet_contract_common::{Delegation, NodeId};
|
||||
|
||||
pub(crate) fn try_delegate_to_node(
|
||||
deps: DepsMut<'_>,
|
||||
@@ -88,9 +88,9 @@ mod tests {
|
||||
use crate::support::tests::fixtures::TEST_COIN_DENOM;
|
||||
use crate::support::tests::test_helpers::TestSetup;
|
||||
use cosmwasm_std::testing::message_info;
|
||||
use cosmwasm_std::{coin, Addr, Decimal};
|
||||
use mixnet_contract_common::nym_node::Role;
|
||||
use mixnet_contract_common::{EpochState, EpochStatus};
|
||||
use cosmwasm_std::{Addr, Decimal, coin};
|
||||
use nym_mixnet_contract_common::nym_node::Role;
|
||||
use nym_mixnet_contract_common::{EpochState, EpochStatus};
|
||||
|
||||
#[test]
|
||||
fn cant_be_performed_if_epoch_transition_is_in_progress() {
|
||||
@@ -321,8 +321,8 @@ mod tests {
|
||||
use crate::support::tests::test_helpers::TestSetup;
|
||||
use cosmwasm_std::coin;
|
||||
use cosmwasm_std::testing::message_info;
|
||||
use mixnet_contract_common::nym_node::Role;
|
||||
use mixnet_contract_common::{EpochState, EpochStatus};
|
||||
use nym_mixnet_contract_common::nym_node::Role;
|
||||
use nym_mixnet_contract_common::{EpochState, EpochStatus};
|
||||
|
||||
#[test]
|
||||
fn cant_be_performed_if_epoch_transition_is_in_progress() {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
use super::storage;
|
||||
use cosmwasm_std::{Addr, Storage};
|
||||
use mixnet_contract_common::{error::MixnetContractError, GatewayBond};
|
||||
use nym_mixnet_contract_common::{GatewayBond, error::MixnetContractError};
|
||||
|
||||
pub(crate) fn must_get_gateway_bond_by_owner(
|
||||
store: &dyn Storage,
|
||||
|
||||
@@ -5,8 +5,8 @@ use super::storage;
|
||||
use crate::constants::{GATEWAY_BOND_DEFAULT_RETRIEVAL_LIMIT, GATEWAY_BOND_MAX_RETRIEVAL_LIMIT}; // Keeps gateway and mixnode retrieval in sync by re-using the constant. Could be split into its own constant.
|
||||
use cosmwasm_std::{Deps, Order, StdResult};
|
||||
use cw_storage_plus::Bound;
|
||||
use mixnet_contract_common::gateway::{PreassignedGatewayIdsResponse, PreassignedId};
|
||||
use mixnet_contract_common::{
|
||||
use nym_mixnet_contract_common::gateway::{PreassignedGatewayIdsResponse, PreassignedId};
|
||||
use nym_mixnet_contract_common::{
|
||||
GatewayBond, GatewayBondResponse, GatewayOwnershipResponse, IdentityKey, PagedGatewayResponse,
|
||||
};
|
||||
|
||||
@@ -85,7 +85,7 @@ pub(crate) mod tests {
|
||||
use super::*;
|
||||
use crate::support::tests;
|
||||
use crate::support::tests::test_helpers;
|
||||
use crate::support::tests::test_helpers::{sorted_addresses, TestSetup};
|
||||
use crate::support::tests::test_helpers::{TestSetup, sorted_addresses};
|
||||
use cosmwasm_std::testing::message_info;
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -6,8 +6,8 @@ use crate::constants::{
|
||||
};
|
||||
use cosmwasm_std::Addr;
|
||||
use cw_storage_plus::{Index, IndexList, IndexedMap, Map, UniqueIndex};
|
||||
use mixnet_contract_common::{GatewayBond, IdentityKeyRef, NodeId};
|
||||
use nym_contracts_common::IdentityKey;
|
||||
use nym_mixnet_contract_common::{GatewayBond, IdentityKeyRef, NodeId};
|
||||
|
||||
pub(crate) const PREASSIGNED_LEGACY_IDS: Map<IdentityKey, NodeId> =
|
||||
Map::new(LEGACY_GATEWAY_ID_NAMESPACE);
|
||||
|
||||
@@ -10,14 +10,14 @@ use crate::nodes::helpers::save_new_nymnode_with_id;
|
||||
use crate::nodes::transactions::add_nym_node_inner;
|
||||
use crate::support::helpers::ensure_epoch_in_progress_state;
|
||||
use cosmwasm_std::{DepsMut, Env, MessageInfo, Response};
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::events::{
|
||||
new_gateway_config_update_event, new_gateway_unbonding_event, new_migrated_gateway_event,
|
||||
};
|
||||
use mixnet_contract_common::gateway::GatewayConfigUpdate;
|
||||
use mixnet_contract_common::{Gateway, GatewayBondingPayload, NodeCostParams};
|
||||
use nym_contracts_common::helpers::ResponseExt;
|
||||
use nym_contracts_common::signing::MessageSignature;
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_mixnet_contract_common::events::{
|
||||
new_gateway_config_update_event, new_gateway_unbonding_event, new_migrated_gateway_event,
|
||||
};
|
||||
use nym_mixnet_contract_common::gateway::GatewayConfigUpdate;
|
||||
use nym_mixnet_contract_common::{Gateway, GatewayBondingPayload, NodeCostParams};
|
||||
|
||||
pub(crate) fn try_add_gateway(
|
||||
deps: DepsMut<'_>,
|
||||
@@ -155,7 +155,7 @@ pub mod tests {
|
||||
use crate::support::tests::test_helpers::TestSetup;
|
||||
use cosmwasm_std::testing::message_info;
|
||||
use cosmwasm_std::{Addr, BankMsg, Uint128};
|
||||
use mixnet_contract_common::ExecuteMsg;
|
||||
use nym_mixnet_contract_common::ExecuteMsg;
|
||||
|
||||
#[test]
|
||||
fn gateway_add() -> anyhow::Result<()> {
|
||||
|
||||
@@ -5,9 +5,9 @@ use crate::interval::storage;
|
||||
use crate::rewards;
|
||||
use crate::rewards::storage as rewards_storage;
|
||||
use cosmwasm_std::{Env, Response, Storage};
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::events::new_interval_config_update_event;
|
||||
use mixnet_contract_common::{BlockHeight, EpochId, Interval};
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_mixnet_contract_common::events::new_interval_config_update_event;
|
||||
use nym_mixnet_contract_common::{BlockHeight, EpochId, Interval};
|
||||
use std::time::Duration;
|
||||
|
||||
pub(crate) fn change_interval_config(
|
||||
|
||||
@@ -3,21 +3,21 @@
|
||||
|
||||
use cosmwasm_std::{Addr, BankMsg, Coin, DepsMut, Env, Response};
|
||||
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::events::{
|
||||
use nym_contracts_common::helpers::ResponseExt;
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_mixnet_contract_common::events::{
|
||||
new_active_set_update_event, new_active_set_update_failure, new_cost_params_update_event,
|
||||
new_delegation_event, new_delegation_on_unbonded_node_event, new_mixnode_unbonding_event,
|
||||
new_nym_node_unbonding_event, new_pledge_decrease_event, new_pledge_increase_event,
|
||||
new_rewarding_params_update_event, new_undelegation_event,
|
||||
};
|
||||
use mixnet_contract_common::mixnode::NodeCostParams;
|
||||
use mixnet_contract_common::pending_events::{
|
||||
use nym_mixnet_contract_common::mixnode::NodeCostParams;
|
||||
use nym_mixnet_contract_common::pending_events::{
|
||||
PendingEpochEventData, PendingEpochEventKind, PendingIntervalEventData,
|
||||
PendingIntervalEventKind,
|
||||
};
|
||||
use mixnet_contract_common::reward_params::{ActiveSetUpdate, IntervalRewardingParamsUpdate};
|
||||
use mixnet_contract_common::{BlockHeight, Delegation, NodeId};
|
||||
use nym_contracts_common::helpers::ResponseExt;
|
||||
use nym_mixnet_contract_common::reward_params::{ActiveSetUpdate, IntervalRewardingParamsUpdate};
|
||||
use nym_mixnet_contract_common::{BlockHeight, Delegation, NodeId};
|
||||
|
||||
use crate::delegations;
|
||||
use crate::delegations::storage as delegations_storage;
|
||||
@@ -637,9 +637,9 @@ impl ContractExecutableEvent for PendingIntervalEventData {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::support::tests::test_helpers::{assert_decimals, TestSetup};
|
||||
use crate::support::tests::test_helpers::{TestSetup, assert_decimals};
|
||||
use cosmwasm_std::Decimal;
|
||||
use mixnet_contract_common::Percent;
|
||||
use nym_mixnet_contract_common::Percent;
|
||||
use std::time::Duration;
|
||||
|
||||
// note that authorization and basic validation has already been performed for all of those
|
||||
@@ -652,7 +652,7 @@ mod tests {
|
||||
use crate::support::tests::fixtures::TEST_COIN_DENOM;
|
||||
use crate::support::tests::test_helpers::get_bank_send_msg;
|
||||
use cosmwasm_std::coin;
|
||||
use mixnet_contract_common::rewarding::helpers::truncate_reward_amount;
|
||||
use nym_mixnet_contract_common::rewarding::helpers::truncate_reward_amount;
|
||||
|
||||
#[test]
|
||||
fn returns_the_tokens_if_mixnode_has_unbonded() {
|
||||
@@ -705,10 +705,12 @@ mod tests {
|
||||
.unwrap();
|
||||
let storage_key =
|
||||
Delegation::generate_storage_key(mix_id, &Addr::unchecked(owner2), None);
|
||||
assert!(delegations_storage::delegations()
|
||||
.may_load(test.deps().storage, storage_key)
|
||||
.unwrap()
|
||||
.is_none());
|
||||
assert!(
|
||||
delegations_storage::delegations()
|
||||
.may_load(test.deps().storage, storage_key)
|
||||
.unwrap()
|
||||
.is_none()
|
||||
);
|
||||
|
||||
// and all tokens are returned back to the delegator
|
||||
let (receiver, sent_amount) = get_bank_send_msg(&res_fresh).unwrap();
|
||||
@@ -767,10 +769,12 @@ mod tests {
|
||||
)
|
||||
.unwrap();
|
||||
let storage_key = Delegation::generate_storage_key(mix_id, owner2, None);
|
||||
assert!(delegations_storage::delegations()
|
||||
.may_load(test.deps().storage, storage_key)
|
||||
.unwrap()
|
||||
.is_none());
|
||||
assert!(
|
||||
delegations_storage::delegations()
|
||||
.may_load(test.deps().storage, storage_key)
|
||||
.unwrap()
|
||||
.is_none()
|
||||
);
|
||||
|
||||
// and all tokens are returned back to the delegator
|
||||
let (receiver, sent_amount) = get_bank_send_msg(&res_fresh).unwrap();
|
||||
@@ -960,7 +964,7 @@ mod tests {
|
||||
mod undelegating {
|
||||
use super::*;
|
||||
use crate::support::tests::test_helpers::get_bank_send_msg;
|
||||
use mixnet_contract_common::rewarding::helpers::truncate_reward_amount;
|
||||
use nym_mixnet_contract_common::rewarding::helpers::truncate_reward_amount;
|
||||
|
||||
#[test]
|
||||
fn doesnt_return_any_tokens_if_it_doesnt_exist() {
|
||||
@@ -1031,10 +1035,12 @@ mod tests {
|
||||
// make sure delegation no longer exists
|
||||
let storage_key =
|
||||
Delegation::generate_storage_key(mix_id, &Addr::unchecked(owner), None);
|
||||
assert!(delegations_storage::delegations()
|
||||
.may_load(test.deps().storage, storage_key)
|
||||
.unwrap()
|
||||
.is_none());
|
||||
assert!(
|
||||
delegations_storage::delegations()
|
||||
.may_load(test.deps().storage, storage_key)
|
||||
.unwrap()
|
||||
.is_none()
|
||||
);
|
||||
|
||||
// and mix rewarding no longer contains any information about the delegation
|
||||
let rewarding = test.mix_rewarding(mix_id);
|
||||
@@ -1049,12 +1055,12 @@ mod tests {
|
||||
use crate::interval::pending_events::unbond_mixnode;
|
||||
use crate::mixnodes::storage as mixnodes_storage;
|
||||
use crate::rewards::storage as rewards_storage;
|
||||
use crate::support::tests::test_helpers::{get_bank_send_msg, TestSetup};
|
||||
use crate::support::tests::test_helpers::{TestSetup, get_bank_send_msg};
|
||||
use cosmwasm_std::testing::message_info;
|
||||
use cosmwasm_std::{Addr, Uint128};
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::mixnode::{PendingMixNodeChanges, UnbondedMixnode};
|
||||
use mixnet_contract_common::rewarding::helpers::truncate_reward_amount;
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_mixnet_contract_common::mixnode::{PendingMixNodeChanges, UnbondedMixnode};
|
||||
use nym_mixnet_contract_common::rewarding::helpers::truncate_reward_amount;
|
||||
|
||||
#[test]
|
||||
fn returns_hard_error_if_mixnode_doesnt_exist() {
|
||||
@@ -1156,14 +1162,18 @@ mod tests {
|
||||
assert_eq!(receiver, owner.to_string());
|
||||
assert_eq!(sent_amount[0].amount, expected_return);
|
||||
|
||||
assert!(rewards_storage::MIXNODE_REWARDING
|
||||
.may_load(test.deps().storage, mix_id)
|
||||
.unwrap()
|
||||
.is_none());
|
||||
assert!(mixnodes_storage::mixnode_bonds()
|
||||
.may_load(test.deps().storage, mix_id)
|
||||
.unwrap()
|
||||
.is_none());
|
||||
assert!(
|
||||
rewards_storage::MIXNODE_REWARDING
|
||||
.may_load(test.deps().storage, mix_id)
|
||||
.unwrap()
|
||||
.is_none()
|
||||
);
|
||||
assert!(
|
||||
mixnodes_storage::mixnode_bonds()
|
||||
.may_load(test.deps().storage, mix_id)
|
||||
.unwrap()
|
||||
.is_none()
|
||||
);
|
||||
let expected = UnbondedMixnode {
|
||||
identity_key: mix_details.identity().to_string(),
|
||||
owner: Addr::unchecked(owner),
|
||||
@@ -1183,7 +1193,7 @@ mod tests {
|
||||
mod increasing_pledge {
|
||||
use cosmwasm_std::Uint128;
|
||||
|
||||
use mixnet_contract_common::rewarding::helpers::truncate_reward_amount;
|
||||
use nym_mixnet_contract_common::rewarding::helpers::truncate_reward_amount;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -1517,7 +1527,7 @@ mod tests {
|
||||
mod decreasing_pledge {
|
||||
use super::*;
|
||||
use cosmwasm_std::{BankMsg, CosmosMsg, Uint128};
|
||||
use mixnet_contract_common::rewarding::helpers::truncate_reward_amount;
|
||||
use nym_mixnet_contract_common::rewarding::helpers::truncate_reward_amount;
|
||||
|
||||
#[test]
|
||||
fn returns_hard_error_if_mixnode_doesnt_exist() {
|
||||
|
||||
@@ -8,9 +8,9 @@ use crate::constants::{
|
||||
use crate::interval::storage;
|
||||
use cosmwasm_std::{Deps, Env, Order, StdResult};
|
||||
use cw_storage_plus::Bound;
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::pending_events::{PendingEpochEvent, PendingIntervalEvent};
|
||||
use mixnet_contract_common::{
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_mixnet_contract_common::pending_events::{PendingEpochEvent, PendingIntervalEvent};
|
||||
use nym_mixnet_contract_common::{
|
||||
CurrentIntervalResponse, EpochEventId, EpochStatus, IntervalEventId,
|
||||
NumberOfPendingEventsResponse, PendingEpochEventResponse, PendingEpochEventsResponse,
|
||||
PendingIntervalEventResponse, PendingIntervalEventsResponse,
|
||||
@@ -124,7 +124,7 @@ mod tests {
|
||||
use crate::support::tests::fixtures;
|
||||
use crate::support::tests::test_helpers::TestSetup;
|
||||
use cosmwasm_std::Addr;
|
||||
use mixnet_contract_common::{PendingEpochEventKind, PendingIntervalEventKind};
|
||||
use nym_mixnet_contract_common::{PendingEpochEventKind, PendingIntervalEventKind};
|
||||
use rand_chacha::rand_core::RngCore;
|
||||
|
||||
fn push_n_dummy_epoch_actions(test: &mut TestSetup, n: usize) {
|
||||
|
||||
@@ -8,10 +8,10 @@ use crate::constants::{
|
||||
};
|
||||
use cosmwasm_std::{Addr, Env, StdResult, Storage};
|
||||
use cw_storage_plus::{Item, Map};
|
||||
use mixnet_contract_common::pending_events::{
|
||||
use nym_mixnet_contract_common::pending_events::{
|
||||
PendingEpochEventData, PendingEpochEventKind, PendingIntervalEventData,
|
||||
};
|
||||
use mixnet_contract_common::{
|
||||
use nym_mixnet_contract_common::{
|
||||
EpochEventId, EpochStatus, Interval, IntervalEventId, PendingIntervalEventKind,
|
||||
};
|
||||
|
||||
|
||||
@@ -13,15 +13,15 @@ use crate::support::helpers::{
|
||||
ensure_can_advance_epoch, ensure_epoch_in_progress_state, ensure_is_authorized,
|
||||
};
|
||||
use cosmwasm_std::{DepsMut, Env, MessageInfo, Response};
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::events::{
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_mixnet_contract_common::events::{
|
||||
new_advance_epoch_event, new_assigned_role_event, new_epoch_transition_start_event,
|
||||
new_pending_epoch_events_execution_event, new_pending_interval_config_update_event,
|
||||
new_pending_interval_events_execution_event, new_reconcile_pending_events,
|
||||
};
|
||||
use mixnet_contract_common::nym_node::Role;
|
||||
use mixnet_contract_common::pending_events::PendingIntervalEventKind;
|
||||
use mixnet_contract_common::{EpochState, EpochStatus, RoleAssignment};
|
||||
use nym_mixnet_contract_common::nym_node::Role;
|
||||
use nym_mixnet_contract_common::pending_events::PendingIntervalEventKind;
|
||||
use nym_mixnet_contract_common::{EpochState, EpochStatus, RoleAssignment};
|
||||
|
||||
// those two should be called in separate tx (from advancing epoch),
|
||||
// since there might be a lot of events to execute.
|
||||
@@ -336,8 +336,8 @@ mod tests {
|
||||
use crate::rewards::storage as rewards_storage;
|
||||
use crate::support::tests::fixtures;
|
||||
use crate::support::tests::test_helpers::TestSetup;
|
||||
use mixnet_contract_common::pending_events::PendingEpochEventKind;
|
||||
use mixnet_contract_common::NodeId;
|
||||
use nym_mixnet_contract_common::NodeId;
|
||||
use nym_mixnet_contract_common::pending_events::PendingEpochEventKind;
|
||||
|
||||
fn push_n_dummy_epoch_actions(test: &mut TestSetup, n: usize) {
|
||||
// if you attempt to undelegate non-existent delegation,
|
||||
@@ -366,9 +366,9 @@ mod tests {
|
||||
#[cfg(test)]
|
||||
mod performing_pending_epoch_actions {
|
||||
use super::*;
|
||||
use crate::support::tests::fixtures::{active_set_update_fixture, TEST_COIN_DENOM};
|
||||
use cosmwasm_std::{coin, coins, BankMsg, Empty, SubMsg};
|
||||
use mixnet_contract_common::events::{
|
||||
use crate::support::tests::fixtures::{TEST_COIN_DENOM, active_set_update_fixture};
|
||||
use cosmwasm_std::{BankMsg, Empty, SubMsg, coin, coins};
|
||||
use nym_mixnet_contract_common::events::{
|
||||
new_active_set_update_event, new_delegation_on_unbonded_node_event,
|
||||
new_undelegation_event,
|
||||
};
|
||||
@@ -585,14 +585,14 @@ mod tests {
|
||||
mod performing_pending_interval_actions {
|
||||
use super::*;
|
||||
use crate::support::tests::fixtures::TEST_COIN_DENOM;
|
||||
use cosmwasm_std::{coin, Empty, SubMsg};
|
||||
use mixnet_contract_common::events::{
|
||||
use cosmwasm_std::{Empty, SubMsg, coin};
|
||||
use nym_mixnet_contract_common::Percent;
|
||||
use nym_mixnet_contract_common::events::{
|
||||
new_cost_params_update_event, new_interval_config_update_event,
|
||||
new_rewarding_params_update_event,
|
||||
};
|
||||
use mixnet_contract_common::mixnode::NodeCostParams;
|
||||
use mixnet_contract_common::reward_params::IntervalRewardingParamsUpdate;
|
||||
use mixnet_contract_common::Percent;
|
||||
use nym_mixnet_contract_common::mixnode::NodeCostParams;
|
||||
use nym_mixnet_contract_common::reward_params::IntervalRewardingParamsUpdate;
|
||||
|
||||
#[test]
|
||||
fn without_limit_executes_all_actions() {
|
||||
@@ -948,12 +948,12 @@ mod tests {
|
||||
use super::*;
|
||||
use crate::support::tests::fixtures::TEST_COIN_DENOM;
|
||||
use cosmwasm_std::testing::message_info;
|
||||
use cosmwasm_std::{coin, coins, BankMsg, Empty, SubMsg};
|
||||
use mixnet_contract_common::events::{
|
||||
use cosmwasm_std::{BankMsg, Empty, SubMsg, coin, coins};
|
||||
use nym_contracts_common::Percent;
|
||||
use nym_mixnet_contract_common::events::{
|
||||
new_delegation_on_unbonded_node_event, new_rewarding_params_update_event,
|
||||
};
|
||||
use mixnet_contract_common::reward_params::IntervalRewardingParamsUpdate;
|
||||
use nym_contracts_common::Percent;
|
||||
use nym_mixnet_contract_common::reward_params::IntervalRewardingParamsUpdate;
|
||||
|
||||
#[test]
|
||||
fn can_only_be_performed_if_in_reconciling_state() {
|
||||
@@ -1038,8 +1038,8 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn epoch_state_is_correctly_updated_if_even_with_leftover_interval_events_if_interval_is_not_over(
|
||||
) {
|
||||
fn epoch_state_is_correctly_updated_if_even_with_leftover_interval_events_if_interval_is_not_over()
|
||||
{
|
||||
let mut test = TestSetup::new();
|
||||
let rewarding_validator = test.rewarding_validator();
|
||||
|
||||
@@ -1347,8 +1347,8 @@ mod tests {
|
||||
#[cfg(test)]
|
||||
mod assigning_roles {
|
||||
use super::*;
|
||||
use cosmwasm_std::testing::message_info;
|
||||
use cosmwasm_std::Uint128;
|
||||
use cosmwasm_std::testing::message_info;
|
||||
|
||||
fn setup_test() -> TestSetup {
|
||||
let mut test = TestSetup::new();
|
||||
@@ -1615,7 +1615,7 @@ mod tests {
|
||||
#[cfg(test)]
|
||||
mod correctly_updates_storage {
|
||||
use super::*;
|
||||
use mixnet_contract_common::nym_node::RoleMetadata;
|
||||
use nym_mixnet_contract_common::nym_node::RoleMetadata;
|
||||
|
||||
fn perform_partial_assignment(test: &mut TestSetup) -> anyhow::Result<()> {
|
||||
let env = test.env();
|
||||
@@ -1787,8 +1787,8 @@ mod tests {
|
||||
#[cfg(test)]
|
||||
mod updating_interval_config {
|
||||
use super::*;
|
||||
use cosmwasm_std::testing::message_info;
|
||||
use cosmwasm_std::Decimal;
|
||||
use cosmwasm_std::testing::message_info;
|
||||
use cw_controllers::AdminError::NotAdmin;
|
||||
use std::time::Duration;
|
||||
|
||||
|
||||
@@ -6,12 +6,12 @@ use crate::mixnet_contract_settings::storage::ADMIN;
|
||||
use cosmwasm_std::{Deps, Order, StdResult};
|
||||
use cw_controllers::AdminResponse;
|
||||
use cw_storage_plus::Bound;
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::{
|
||||
use nym_contracts_common::get_build_information;
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_mixnet_contract_common::{
|
||||
ContractBuildInformation, ContractState, ContractStateParams, CurrentNymNodeVersionResponse,
|
||||
HistoricalNymNodeVersionEntry, NymNodeVersionHistoryResponse,
|
||||
};
|
||||
use nym_contracts_common::get_build_information;
|
||||
|
||||
pub(crate) fn query_admin(deps: Deps<'_>) -> StdResult<AdminResponse> {
|
||||
ADMIN.query_admin(deps)
|
||||
@@ -71,8 +71,8 @@ pub(crate) fn query_current_nym_node_version(
|
||||
pub(crate) mod tests {
|
||||
use super::*;
|
||||
use crate::support::tests::test_helpers;
|
||||
use cosmwasm_std::{coin, Addr};
|
||||
use mixnet_contract_common::{ConfigScoreParams, DelegationsParams, OperatorsParams};
|
||||
use cosmwasm_std::{Addr, coin};
|
||||
use nym_mixnet_contract_common::{ConfigScoreParams, DelegationsParams, OperatorsParams};
|
||||
|
||||
#[test]
|
||||
fn query_for_contract_settings_works() {
|
||||
|
||||
@@ -9,8 +9,8 @@ use cosmwasm_std::Coin;
|
||||
use cosmwasm_std::{Addr, DepsMut, Env, Storage};
|
||||
use cw_controllers::Admin;
|
||||
use cw_storage_plus::{Item, Map};
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::{
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_mixnet_contract_common::{
|
||||
ContractState, ContractStateParams, HistoricalNymNodeVersion, HistoricalNymNodeVersionEntry,
|
||||
OperatingCostRange, ProfitMarginRange,
|
||||
};
|
||||
@@ -262,10 +262,12 @@ mod tests {
|
||||
let env = mock_env();
|
||||
let storage = NymNodeVersionHistory::new();
|
||||
|
||||
assert!(storage
|
||||
.id_counter
|
||||
.may_load(deps.as_mut().storage)?
|
||||
.is_none());
|
||||
assert!(
|
||||
storage
|
||||
.id_counter
|
||||
.may_load(deps.as_mut().storage)?
|
||||
.is_none()
|
||||
);
|
||||
|
||||
storage.try_insert_new(deps.as_mut().storage, &env, "1.1.1")?;
|
||||
assert_eq!(storage.id_counter.load(deps.as_mut().storage)?, 0);
|
||||
@@ -296,23 +298,33 @@ mod tests {
|
||||
let storage = NymNodeVersionHistory::new();
|
||||
|
||||
// lower version
|
||||
assert!(storage
|
||||
.try_insert_new(test.storage_mut(), &env, "1.1.9")
|
||||
.is_err());
|
||||
assert!(storage
|
||||
.try_insert_new(test.storage_mut(), &env, "1.0.1")
|
||||
.is_err());
|
||||
assert!(
|
||||
storage
|
||||
.try_insert_new(test.storage_mut(), &env, "1.1.9")
|
||||
.is_err()
|
||||
);
|
||||
assert!(
|
||||
storage
|
||||
.try_insert_new(test.storage_mut(), &env, "1.0.1")
|
||||
.is_err()
|
||||
);
|
||||
|
||||
// malformed
|
||||
assert!(storage
|
||||
.try_insert_new(test.storage_mut(), &env, "1.0")
|
||||
.is_err());
|
||||
assert!(storage
|
||||
.try_insert_new(test.storage_mut(), &env, "1.0bad")
|
||||
.is_err());
|
||||
assert!(storage
|
||||
.try_insert_new(test.storage_mut(), &env, "foomp")
|
||||
.is_err());
|
||||
assert!(
|
||||
storage
|
||||
.try_insert_new(test.storage_mut(), &env, "1.0")
|
||||
.is_err()
|
||||
);
|
||||
assert!(
|
||||
storage
|
||||
.try_insert_new(test.storage_mut(), &env, "1.0bad")
|
||||
.is_err()
|
||||
);
|
||||
assert!(
|
||||
storage
|
||||
.try_insert_new(test.storage_mut(), &env, "foomp")
|
||||
.is_err()
|
||||
);
|
||||
|
||||
// patch
|
||||
let mut test = TestSetup::new();
|
||||
|
||||
@@ -6,12 +6,12 @@ use crate::mixnet_contract_settings::storage::ADMIN;
|
||||
use cosmwasm_std::Response;
|
||||
use cosmwasm_std::{DepsMut, StdResult};
|
||||
use cosmwasm_std::{Env, MessageInfo};
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::events::{
|
||||
use nym_mixnet_contract_common::ContractStateParamsUpdate;
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_mixnet_contract_common::events::{
|
||||
new_rewarding_validator_address_update_event, new_settings_update_event,
|
||||
new_update_nym_node_semver_event,
|
||||
};
|
||||
use mixnet_contract_common::ContractStateParamsUpdate;
|
||||
|
||||
pub fn try_update_contract_admin(
|
||||
mut deps: DepsMut<'_>,
|
||||
@@ -133,8 +133,8 @@ pub mod tests {
|
||||
use cosmwasm_std::testing::message_info;
|
||||
use cosmwasm_std::{Coin, Uint128};
|
||||
use cw_controllers::AdminError::NotAdmin;
|
||||
use mixnet_contract_common::OperatorsParamsUpdate;
|
||||
use nym_contracts_common_testing::mock_api;
|
||||
use nym_mixnet_contract_common::OperatorsParamsUpdate;
|
||||
|
||||
#[test]
|
||||
fn update_contract_rewarding_validator_address() {
|
||||
@@ -301,7 +301,7 @@ pub mod tests {
|
||||
mod semver_chain_updates {
|
||||
use super::*;
|
||||
use crate::mixnet_contract_settings::queries::query_nym_node_version_history_paged;
|
||||
use mixnet_contract_common::{
|
||||
use nym_mixnet_contract_common::{
|
||||
HistoricalNymNodeVersion, HistoricalNymNodeVersionEntry, TotalVersionDifference,
|
||||
};
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
use super::storage;
|
||||
use crate::rewards::storage as rewards_storage;
|
||||
use cosmwasm_std::{Addr, Decimal, Env, StdResult, Storage};
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::mixnode::{MixNodeDetails, UnbondedMixnode};
|
||||
use mixnet_contract_common::{IdentityKey, MixNodeBond, NodeId};
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_mixnet_contract_common::mixnode::{MixNodeDetails, UnbondedMixnode};
|
||||
use nym_mixnet_contract_common::{IdentityKey, MixNodeBond, NodeId};
|
||||
|
||||
pub(crate) fn must_get_mixnode_bond_by_owner(
|
||||
store: &dyn Storage,
|
||||
|
||||
@@ -14,11 +14,11 @@ use crate::mixnodes::helpers::{
|
||||
use crate::rewards::storage as rewards_storage;
|
||||
use cosmwasm_std::{Deps, Order, StdResult, Storage};
|
||||
use cw_storage_plus::Bound;
|
||||
use mixnet_contract_common::mixnode::{
|
||||
use nym_mixnet_contract_common::mixnode::{
|
||||
MixNodeBond, MixNodeDetails, MixStakeSaturationResponse, MixnodeRewardingDetailsResponse,
|
||||
PagedMixnodesDetailsResponse, PagedUnbondedMixnodesResponse, UnbondedMixnodeResponse,
|
||||
};
|
||||
use mixnet_contract_common::{
|
||||
use nym_mixnet_contract_common::{
|
||||
IdentityKey, MixOwnershipResponse, MixnodeDetailsByIdentityResponse, MixnodeDetailsResponse,
|
||||
NodeId, PagedMixnodeBondsResponse,
|
||||
};
|
||||
@@ -236,7 +236,7 @@ pub fn query_stake_saturation(
|
||||
mix_id,
|
||||
current_saturation: None,
|
||||
uncapped_saturation: None,
|
||||
})
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -449,7 +449,7 @@ pub(crate) mod tests {
|
||||
mod unbonded_mixnodes {
|
||||
use super::*;
|
||||
use cosmwasm_std::Addr;
|
||||
use mixnet_contract_common::mixnode::UnbondedMixnode;
|
||||
use nym_mixnet_contract_common::mixnode::UnbondedMixnode;
|
||||
|
||||
#[test]
|
||||
fn obeys_limits() {
|
||||
@@ -562,7 +562,7 @@ pub(crate) mod tests {
|
||||
use super::*;
|
||||
use crate::support::tests::test_helpers::sorted_addresses;
|
||||
use cosmwasm_std::Addr;
|
||||
use mixnet_contract_common::mixnode::UnbondedMixnode;
|
||||
use nym_mixnet_contract_common::mixnode::UnbondedMixnode;
|
||||
|
||||
fn add_unbonded_with_owner(storage: &mut dyn Storage, id: NodeId, owner: &Addr) {
|
||||
storage::unbonded_mixnodes()
|
||||
@@ -808,7 +808,7 @@ pub(crate) mod tests {
|
||||
mod unbonded_mixnodes_by_identity {
|
||||
use super::*;
|
||||
use cosmwasm_std::Addr;
|
||||
use mixnet_contract_common::mixnode::UnbondedMixnode;
|
||||
use nym_mixnet_contract_common::mixnode::UnbondedMixnode;
|
||||
|
||||
fn add_unbonded_with_identity(storage: &mut dyn Storage, id: NodeId, identity: &str) {
|
||||
storage::unbonded_mixnodes()
|
||||
|
||||
@@ -8,9 +8,9 @@ use crate::constants::{
|
||||
UNBONDED_MIXNODES_PK_NAMESPACE,
|
||||
};
|
||||
use cw_storage_plus::{Index, IndexList, IndexedMap, Map, MultiIndex, UniqueIndex};
|
||||
use mixnet_contract_common::mixnode::{PendingMixNodeChanges, UnbondedMixnode};
|
||||
use mixnet_contract_common::SphinxKey;
|
||||
use mixnet_contract_common::{Addr, IdentityKey, MixNodeBond, NodeId};
|
||||
use nym_mixnet_contract_common::SphinxKey;
|
||||
use nym_mixnet_contract_common::mixnode::{PendingMixNodeChanges, UnbondedMixnode};
|
||||
use nym_mixnet_contract_common::{Addr, IdentityKey, MixNodeBond, NodeId};
|
||||
|
||||
pub const PENDING_MIXNODE_CHANGES: Map<NodeId, PendingMixNodeChanges> =
|
||||
Map::new(PENDING_MIXNODE_CHANGES_NAMESPACE);
|
||||
@@ -31,8 +31,8 @@ impl IndexList<UnbondedMixnode> for UnbondedMixnodeIndex<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn unbonded_mixnodes<'a>(
|
||||
) -> IndexedMap<NodeId, UnbondedMixnode, UnbondedMixnodeIndex<'a>> {
|
||||
pub(crate) fn unbonded_mixnodes<'a>()
|
||||
-> IndexedMap<NodeId, UnbondedMixnode, UnbondedMixnodeIndex<'a>> {
|
||||
let indexes = UnbondedMixnodeIndex {
|
||||
owner: MultiIndex::new(
|
||||
|_pk, d| d.owner.clone(),
|
||||
|
||||
@@ -14,19 +14,19 @@ use crate::support::helpers::{
|
||||
ensure_bonded, ensure_epoch_in_progress_state, ensure_no_pending_params_changes,
|
||||
ensure_no_pending_pledge_changes, validate_pledge,
|
||||
};
|
||||
use cosmwasm_std::{coin, Coin, DepsMut, Env, MessageInfo, Response};
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::events::{
|
||||
use cosmwasm_std::{Coin, DepsMut, Env, MessageInfo, Response, coin};
|
||||
use nym_contracts_common::signing::MessageSignature;
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_mixnet_contract_common::events::{
|
||||
new_migrated_mixnode_event, new_mixnode_config_update_event,
|
||||
new_pending_cost_params_update_event, new_pending_mixnode_unbonding_event,
|
||||
new_pending_pledge_decrease_event, new_pending_pledge_increase_event,
|
||||
};
|
||||
use mixnet_contract_common::mixnode::{MixNodeConfigUpdate, NodeCostParams};
|
||||
use mixnet_contract_common::pending_events::{PendingEpochEventKind, PendingIntervalEventKind};
|
||||
use mixnet_contract_common::{
|
||||
use nym_mixnet_contract_common::mixnode::{MixNodeConfigUpdate, NodeCostParams};
|
||||
use nym_mixnet_contract_common::pending_events::{PendingEpochEventKind, PendingIntervalEventKind};
|
||||
use nym_mixnet_contract_common::{
|
||||
MixNode, MixNodeDetails, MixnodeBondingPayload, NymNodeBond, PendingNodeChanges,
|
||||
};
|
||||
use nym_contracts_common::signing::MessageSignature;
|
||||
|
||||
pub fn try_add_mixnode(
|
||||
deps: DepsMut<'_>,
|
||||
@@ -263,14 +263,14 @@ pub mod tests {
|
||||
use crate::mixnodes::helpers::{get_mixnode_details_by_id, get_mixnode_details_by_identity};
|
||||
use crate::nodes::helpers::{get_node_details_by_identity, must_get_node_bond_by_owner};
|
||||
use crate::signing::storage as signing_storage;
|
||||
use crate::support::tests::fixtures::{good_mixnode_pledge, TEST_COIN_DENOM};
|
||||
use crate::support::tests::fixtures::{TEST_COIN_DENOM, good_mixnode_pledge};
|
||||
use crate::support::tests::test_helpers::TestSetup;
|
||||
use crate::support::tests::{fixtures, test_helpers};
|
||||
use cosmwasm_std::testing::message_info;
|
||||
use cosmwasm_std::{Addr, Order, StdResult, Uint128};
|
||||
use mixnet_contract_common::mixnode::PendingMixNodeChanges;
|
||||
use mixnet_contract_common::nym_node::Role;
|
||||
use mixnet_contract_common::{EpochState, EpochStatus, ExecuteMsg, Percent};
|
||||
use nym_mixnet_contract_common::mixnode::PendingMixNodeChanges;
|
||||
use nym_mixnet_contract_common::nym_node::Role;
|
||||
use nym_mixnet_contract_common::{EpochState, EpochStatus, ExecuteMsg, Percent};
|
||||
|
||||
#[test]
|
||||
fn mixnode_add() -> anyhow::Result<()> {
|
||||
@@ -762,15 +762,17 @@ pub mod tests {
|
||||
let info_alice = message_info(&test.make_addr("alice"), &good_mixnode_pledge());
|
||||
let info_bob = message_info(&test.make_addr("bob"), &good_mixnode_pledge());
|
||||
|
||||
assert!(try_add_mixnode(
|
||||
test.deps_mut(),
|
||||
env.clone(),
|
||||
info_alice,
|
||||
mixnode1,
|
||||
cost_params.clone(),
|
||||
sig1,
|
||||
)
|
||||
.is_ok());
|
||||
assert!(
|
||||
try_add_mixnode(
|
||||
test.deps_mut(),
|
||||
env.clone(),
|
||||
info_alice,
|
||||
mixnode1,
|
||||
cost_params.clone(),
|
||||
sig1,
|
||||
)
|
||||
.is_ok()
|
||||
);
|
||||
|
||||
// change identity but reuse sphinx key
|
||||
assert!(
|
||||
|
||||
@@ -6,12 +6,12 @@ use crate::nodes::storage;
|
||||
use crate::nodes::storage::next_nymnode_id_counter;
|
||||
use crate::rewards::storage as rewards_storage;
|
||||
use cosmwasm_std::{Addr, Coin, Env, StdResult, Storage};
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::nym_node::UnbondedNymNode;
|
||||
use mixnet_contract_common::{
|
||||
use nym_contracts_common::IdentityKey;
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_mixnet_contract_common::nym_node::UnbondedNymNode;
|
||||
use nym_mixnet_contract_common::{
|
||||
NodeCostParams, NodeId, NodeRewarding, NymNode, NymNodeBond, NymNodeDetails, PendingNodeChanges,
|
||||
};
|
||||
use nym_contracts_common::IdentityKey;
|
||||
|
||||
pub(crate) fn save_new_nymnode(
|
||||
storage: &mut dyn Storage,
|
||||
|
||||
@@ -15,17 +15,17 @@ use crate::nodes::storage;
|
||||
use crate::rewards::storage as rewards_storage;
|
||||
use cosmwasm_std::{Deps, Order, StdResult, Storage};
|
||||
use cw_storage_plus::Bound;
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::nym_node::{
|
||||
use nym_contracts_common::IdentityKey;
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_mixnet_contract_common::nym_node::{
|
||||
EpochAssignmentResponse, NodeDetailsByIdentityResponse, NodeDetailsResponse,
|
||||
NodeOwnershipResponse, NodeRewardingDetailsResponse, PagedNymNodeBondsResponse,
|
||||
PagedNymNodeDetailsResponse, PagedUnbondedNymNodesResponse, Role, RolesMetadataResponse,
|
||||
StakeSaturationResponse, UnbondedNodeResponse,
|
||||
};
|
||||
use mixnet_contract_common::{
|
||||
use nym_mixnet_contract_common::{
|
||||
KeyRotationIdResponse, KeyRotationState, NodeId, NymNodeBond, NymNodeDetails,
|
||||
};
|
||||
use nym_contracts_common::IdentityKey;
|
||||
|
||||
pub(crate) fn query_nymnode_bonds_paged(
|
||||
deps: Deps<'_>,
|
||||
@@ -248,7 +248,7 @@ pub fn query_stake_saturation(
|
||||
node_id,
|
||||
current_saturation: None,
|
||||
uncapped_saturation: None,
|
||||
})
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
use crate::signing::storage as signing_storage;
|
||||
use crate::support::helpers::decode_ed25519_identity_key;
|
||||
use cosmwasm_std::{Addr, Coin, Deps};
|
||||
use mixnet_contract_common::construct_generic_node_bonding_payload;
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_contracts_common::IdentityKeyRef;
|
||||
use nym_contracts_common::signing::Verifier;
|
||||
use nym_contracts_common::signing::{MessageSignature, SigningPurpose};
|
||||
use nym_contracts_common::IdentityKeyRef;
|
||||
use nym_mixnet_contract_common::construct_generic_node_bonding_payload;
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use serde::Serialize;
|
||||
|
||||
/// Verifies the bonding signature on either a legacy mixnode, legacy gateway or a nym-node.
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use crate::nodes::storage::rewarded_set::{ACTIVE_ROLES_BUCKET, ROLES, ROLES_METADATA};
|
||||
use crate::nodes::storage::{nym_nodes, KEY_ROTATION_STATE, NYMNODE_ID_COUNTER};
|
||||
use crate::nodes::storage::{KEY_ROTATION_STATE, NYMNODE_ID_COUNTER, nym_nodes};
|
||||
use cosmwasm_std::{StdResult, Storage};
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::nym_node::{RewardedSetMetadata, Role};
|
||||
use mixnet_contract_common::{EpochId, KeyRotationState, NodeId, NymNodeBond, RoleAssignment};
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_mixnet_contract_common::nym_node::{RewardedSetMetadata, Role};
|
||||
use nym_mixnet_contract_common::{EpochId, KeyRotationState, NodeId, NymNodeBond, RoleAssignment};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Copy, Clone, Default, Debug, Serialize, Deserialize, Eq, PartialEq)]
|
||||
|
||||
@@ -11,9 +11,11 @@ use crate::constants::{
|
||||
use crate::nodes::storage::helpers::RoleStorageBucket;
|
||||
use cosmwasm_std::Addr;
|
||||
use cw_storage_plus::{Index, IndexList, IndexedMap, Item, Map, MultiIndex, UniqueIndex};
|
||||
use mixnet_contract_common::nym_node::{NymNodeBond, RewardedSetMetadata, Role, UnbondedNymNode};
|
||||
use mixnet_contract_common::{KeyRotationState, NodeId, PendingNodeChanges};
|
||||
use nym_contracts_common::IdentityKey;
|
||||
use nym_mixnet_contract_common::nym_node::{
|
||||
NymNodeBond, RewardedSetMetadata, Role, UnbondedNymNode,
|
||||
};
|
||||
use nym_mixnet_contract_common::{KeyRotationState, NodeId, PendingNodeChanges};
|
||||
|
||||
pub(crate) mod helpers;
|
||||
|
||||
@@ -113,8 +115,8 @@ impl IndexList<UnbondedNymNode> for UnbondedNymNodeIndex<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn unbonded_nym_nodes<'a>(
|
||||
) -> IndexedMap<NodeId, UnbondedNymNode, UnbondedNymNodeIndex<'a>> {
|
||||
pub(crate) fn unbonded_nym_nodes<'a>()
|
||||
-> IndexedMap<NodeId, UnbondedNymNode, UnbondedNymNodeIndex<'a>> {
|
||||
let indexes = UnbondedNymNodeIndex {
|
||||
owner: MultiIndex::new(
|
||||
|_pk, d| d.owner.clone(),
|
||||
|
||||
@@ -16,19 +16,19 @@ use crate::support::helpers::{
|
||||
ensure_epoch_in_progress_state, ensure_no_existing_bond, ensure_operating_cost_within_range,
|
||||
ensure_profit_margin_within_range, validate_pledge,
|
||||
};
|
||||
use cosmwasm_std::{coin, Coin, DepsMut, Env, MessageInfo, Response};
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::events::{
|
||||
use cosmwasm_std::{Coin, DepsMut, Env, MessageInfo, Response, coin};
|
||||
use nym_contracts_common::signing::{MessageSignature, SigningPurpose};
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_mixnet_contract_common::events::{
|
||||
new_nym_node_bonding_event, new_pending_cost_params_update_event,
|
||||
new_pending_nym_node_unbonding_event, new_pending_pledge_decrease_event,
|
||||
new_pending_pledge_increase_event,
|
||||
};
|
||||
use mixnet_contract_common::nym_node::{NodeConfigUpdate, NymNode};
|
||||
use mixnet_contract_common::{
|
||||
use nym_mixnet_contract_common::nym_node::{NodeConfigUpdate, NymNode};
|
||||
use nym_mixnet_contract_common::{
|
||||
NodeCostParams, NymNodeBondingPayload, NymNodeDetails, PendingEpochEventKind,
|
||||
PendingIntervalEventKind,
|
||||
};
|
||||
use nym_contracts_common::signing::{MessageSignature, SigningPurpose};
|
||||
use serde::Serialize;
|
||||
|
||||
pub fn try_add_nym_node(
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
use crate::interval::storage as interval_storage;
|
||||
use crate::nodes::storage as nymnodes_storage;
|
||||
use cosmwasm_std::DepsMut;
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::KeyRotationState;
|
||||
use nym_mixnet_contract_common::KeyRotationState;
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
|
||||
pub fn introduce_key_rotation_id(deps: DepsMut) -> Result<(), MixnetContractError> {
|
||||
let current_epoch_id =
|
||||
|
||||
@@ -6,11 +6,11 @@ use crate::delegations::storage as delegations_storage;
|
||||
use crate::interval::storage as interval_storage;
|
||||
use crate::nodes::storage::read_assigned_roles;
|
||||
use cosmwasm_std::{Coin, Storage};
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::helpers::{IntoBaseDecimal, NodeBond, NodeDetails};
|
||||
use mixnet_contract_common::mixnode::NodeRewarding;
|
||||
use mixnet_contract_common::nym_node::Role;
|
||||
use mixnet_contract_common::{Delegation, EpochState, EpochStatus, NodeId};
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_mixnet_contract_common::helpers::{IntoBaseDecimal, NodeBond, NodeDetails};
|
||||
use nym_mixnet_contract_common::mixnode::NodeRewarding;
|
||||
use nym_mixnet_contract_common::nym_node::Role;
|
||||
use nym_mixnet_contract_common::{Delegation, EpochState, EpochStatus, NodeId};
|
||||
|
||||
pub(crate) fn update_and_save_last_rewarded(
|
||||
storage: &mut dyn Storage,
|
||||
@@ -137,9 +137,9 @@ mod tests {
|
||||
use super::*;
|
||||
use crate::mixnodes::helpers::get_mixnode_details_by_id;
|
||||
use crate::rewards::models::RewardPoolChange;
|
||||
use crate::support::tests::test_helpers::{assert_decimals, TestSetup};
|
||||
use crate::support::tests::test_helpers::{TestSetup, assert_decimals};
|
||||
use cosmwasm_std::Uint128;
|
||||
use mixnet_contract_common::rewarding::helpers::truncate_reward_amount;
|
||||
use nym_mixnet_contract_common::rewarding::helpers::truncate_reward_amount;
|
||||
|
||||
#[test]
|
||||
fn applying_reward_pool_changes() {
|
||||
|
||||
@@ -6,18 +6,18 @@ use crate::compat;
|
||||
use crate::compat::helpers::may_get_bond;
|
||||
use crate::delegations::storage as delegations_storage;
|
||||
use crate::interval::storage as interval_storage;
|
||||
use cosmwasm_std::{coin, Coin, Decimal, Deps, StdResult};
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::helpers::into_base_decimal;
|
||||
use mixnet_contract_common::nym_node::Role;
|
||||
use mixnet_contract_common::reward_params::{
|
||||
use cosmwasm_std::{Coin, Decimal, Deps, StdResult, coin};
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_mixnet_contract_common::helpers::into_base_decimal;
|
||||
use nym_mixnet_contract_common::nym_node::Role;
|
||||
use nym_mixnet_contract_common::reward_params::{
|
||||
NodeRewardingParameters, Performance, RewardingParams, WorkFactor,
|
||||
};
|
||||
use mixnet_contract_common::rewarding::helpers::truncate_reward;
|
||||
use mixnet_contract_common::rewarding::{
|
||||
use nym_mixnet_contract_common::rewarding::helpers::truncate_reward;
|
||||
use nym_mixnet_contract_common::rewarding::{
|
||||
EstimatedCurrentEpochRewardResponse, PendingRewardResponse,
|
||||
};
|
||||
use mixnet_contract_common::{Delegation, NodeId};
|
||||
use nym_mixnet_contract_common::{Delegation, NodeId};
|
||||
|
||||
pub(crate) fn query_rewarding_params(deps: Deps<'_>) -> StdResult<RewardingParams> {
|
||||
storage::REWARDING_PARAMS.load(deps.storage)
|
||||
@@ -844,8 +844,8 @@ mod tests {
|
||||
use super::*;
|
||||
use crate::mixnodes::transactions::try_remove_mixnode;
|
||||
use crate::support::tests::fixtures::TEST_COIN_DENOM;
|
||||
use cosmwasm_std::testing::message_info;
|
||||
use cosmwasm_std::Addr;
|
||||
use cosmwasm_std::testing::message_info;
|
||||
|
||||
fn expected_current_delegator(
|
||||
test: &TestSetup,
|
||||
|
||||
@@ -8,10 +8,10 @@ use crate::constants::{
|
||||
use crate::rewards::models::RewardPoolChange;
|
||||
use cosmwasm_std::{Decimal, StdResult, Storage};
|
||||
use cw_storage_plus::{Item, Map};
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::mixnode::NodeRewarding;
|
||||
use mixnet_contract_common::reward_params::{RewardingParams, WorkFactor};
|
||||
use mixnet_contract_common::NodeId;
|
||||
use nym_mixnet_contract_common::NodeId;
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_mixnet_contract_common::mixnode::NodeRewarding;
|
||||
use nym_mixnet_contract_common::reward_params::{RewardingParams, WorkFactor};
|
||||
|
||||
// LEGACY CONSTANTS:
|
||||
|
||||
|
||||
@@ -15,20 +15,20 @@ use crate::support::helpers::{
|
||||
ensure_any_node_bonded, ensure_can_advance_epoch, ensure_epoch_in_progress_state,
|
||||
};
|
||||
use cosmwasm_std::{DepsMut, Env, MessageInfo, Response};
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::events::{
|
||||
use nym_contracts_common::helpers::ResponseExt;
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_mixnet_contract_common::events::{
|
||||
new_active_set_update_event, new_mix_rewarding_event,
|
||||
new_not_found_node_operator_rewarding_event, new_pending_active_set_update_event,
|
||||
new_pending_rewarding_params_update_event, new_rewarding_params_update_event,
|
||||
new_withdraw_delegator_reward_event, new_withdraw_operator_reward_event,
|
||||
new_zero_uptime_mix_operator_rewarding_event,
|
||||
};
|
||||
use mixnet_contract_common::pending_events::{PendingEpochEventKind, PendingIntervalEventKind};
|
||||
use mixnet_contract_common::reward_params::{
|
||||
use nym_mixnet_contract_common::pending_events::{PendingEpochEventKind, PendingIntervalEventKind};
|
||||
use nym_mixnet_contract_common::reward_params::{
|
||||
ActiveSetUpdate, IntervalRewardingParamsUpdate, NodeRewardingParameters,
|
||||
};
|
||||
use mixnet_contract_common::{Delegation, EpochState, MixNodeDetails, NodeId, NymNodeDetails};
|
||||
use nym_contracts_common::helpers::ResponseExt;
|
||||
use nym_mixnet_contract_common::{Delegation, EpochState, MixNodeDetails, NodeId, NymNodeDetails};
|
||||
|
||||
pub(crate) fn try_reward_node(
|
||||
deps: DepsMut<'_>,
|
||||
@@ -368,22 +368,22 @@ pub mod tests {
|
||||
mod legacy_mixnode_rewarding {
|
||||
use super::*;
|
||||
use crate::interval::pending_events;
|
||||
use crate::support::tests::test_helpers::{find_attribute, FindAttribute, TestSetup};
|
||||
use crate::support::tests::test_helpers::{FindAttribute, TestSetup, find_attribute};
|
||||
use cosmwasm_std::{Decimal, Uint128};
|
||||
use mixnet_contract_common::events::{
|
||||
MixnetEventType, BOND_NOT_FOUND_VALUE, DELEGATES_REWARD_KEY, NO_REWARD_REASON_KEY,
|
||||
use nym_mixnet_contract_common::EpochStatus;
|
||||
use nym_mixnet_contract_common::events::{
|
||||
BOND_NOT_FOUND_VALUE, DELEGATES_REWARD_KEY, MixnetEventType, NO_REWARD_REASON_KEY,
|
||||
OPERATOR_REWARD_KEY, PRIOR_DELEGATES_KEY, PRIOR_UNIT_REWARD_KEY,
|
||||
ZERO_PERFORMANCE_OR_WORK_VALUE,
|
||||
};
|
||||
use mixnet_contract_common::helpers::compare_decimals;
|
||||
use mixnet_contract_common::nym_node::Role;
|
||||
use mixnet_contract_common::reward_params::WorkFactor;
|
||||
use mixnet_contract_common::EpochStatus;
|
||||
use nym_mixnet_contract_common::helpers::compare_decimals;
|
||||
use nym_mixnet_contract_common::nym_node::Role;
|
||||
use nym_mixnet_contract_common::reward_params::WorkFactor;
|
||||
|
||||
#[cfg(test)]
|
||||
mod epoch_state_is_correctly_updated {
|
||||
use super::*;
|
||||
use mixnet_contract_common::reward_params::WorkFactor;
|
||||
use nym_mixnet_contract_common::reward_params::WorkFactor;
|
||||
|
||||
#[test]
|
||||
fn when_target_mixnode_unbonded() {
|
||||
@@ -1312,9 +1312,9 @@ pub mod tests {
|
||||
mod legacy_gateway_rewarding {
|
||||
use super::*;
|
||||
use crate::support::tests::test_helpers::FindAttribute;
|
||||
use mixnet_contract_common::events::{BOND_NOT_FOUND_VALUE, NO_REWARD_REASON_KEY};
|
||||
use mixnet_contract_common::nym_node::Role;
|
||||
use mixnet_contract_common::RoleAssignment;
|
||||
use nym_mixnet_contract_common::RoleAssignment;
|
||||
use nym_mixnet_contract_common::events::{BOND_NOT_FOUND_VALUE, NO_REWARD_REASON_KEY};
|
||||
use nym_mixnet_contract_common::nym_node::Role;
|
||||
|
||||
#[test]
|
||||
fn regardless_of_performance_or_work_they_get_nothing() {
|
||||
@@ -1347,13 +1347,13 @@ pub mod tests {
|
||||
use crate::interval::pending_events;
|
||||
use crate::support::tests::test_helpers::FindAttribute;
|
||||
use cosmwasm_std::{Decimal, Uint128};
|
||||
use mixnet_contract_common::events::{
|
||||
use nym_mixnet_contract_common::RoleAssignment;
|
||||
use nym_mixnet_contract_common::events::{
|
||||
BOND_NOT_FOUND_VALUE, NO_REWARD_REASON_KEY, OPERATOR_REWARD_KEY,
|
||||
ZERO_PERFORMANCE_OR_WORK_VALUE,
|
||||
};
|
||||
use mixnet_contract_common::nym_node::Role;
|
||||
use mixnet_contract_common::reward_params::WorkFactor;
|
||||
use mixnet_contract_common::RoleAssignment;
|
||||
use nym_mixnet_contract_common::nym_node::Role;
|
||||
use nym_mixnet_contract_common::reward_params::WorkFactor;
|
||||
use std::collections::HashMap;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
@@ -1616,10 +1616,10 @@ pub mod tests {
|
||||
#[cfg(test)]
|
||||
mod withdrawing_delegator_reward {
|
||||
use crate::interval::pending_events;
|
||||
use crate::support::tests::test_helpers::{assert_eq_with_leeway, TestSetup};
|
||||
use crate::support::tests::test_helpers::{TestSetup, assert_eq_with_leeway};
|
||||
use cosmwasm_std::testing::message_info;
|
||||
use cosmwasm_std::{BankMsg, CosmosMsg, Decimal, Uint128};
|
||||
use mixnet_contract_common::rewarding::helpers::truncate_reward_amount;
|
||||
use nym_mixnet_contract_common::rewarding::helpers::truncate_reward_amount;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -2106,8 +2106,8 @@ pub mod tests {
|
||||
#[cfg(test)]
|
||||
mod updating_active_set {
|
||||
use cw_controllers::AdminError::NotAdmin;
|
||||
use mixnet_contract_common::nym_node::Role;
|
||||
use mixnet_contract_common::EpochStatus;
|
||||
use nym_mixnet_contract_common::EpochStatus;
|
||||
use nym_mixnet_contract_common::nym_node::Role;
|
||||
|
||||
use crate::support::tests::test_helpers::TestSetup;
|
||||
|
||||
@@ -2369,11 +2369,11 @@ pub mod tests {
|
||||
use cosmwasm_std::Decimal;
|
||||
use cw_controllers::AdminError::NotAdmin;
|
||||
|
||||
use mixnet_contract_common::nym_node::Role;
|
||||
use mixnet_contract_common::reward_params::RewardedSetParams;
|
||||
use mixnet_contract_common::EpochStatus;
|
||||
use nym_mixnet_contract_common::EpochStatus;
|
||||
use nym_mixnet_contract_common::nym_node::Role;
|
||||
use nym_mixnet_contract_common::reward_params::RewardedSetParams;
|
||||
|
||||
use crate::support::tests::test_helpers::{assert_decimals, TestSetup};
|
||||
use crate::support::tests::test_helpers::{TestSetup, assert_decimals};
|
||||
|
||||
use super::*;
|
||||
|
||||
|
||||
@@ -8,11 +8,11 @@ use crate::mixnodes::storage as mixnodes_storage;
|
||||
use crate::nodes::helpers::must_get_node_bond_by_owner;
|
||||
use crate::nodes::storage as nymnodes_storage;
|
||||
use cosmwasm_std::{Addr, Coin, Storage};
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::mixnode::PendingMixNodeChanges;
|
||||
use mixnet_contract_common::{EpochState, EpochStatus, IdentityKeyRef, MixNodeBond, NodeId};
|
||||
use nym_contracts_common::IdentityKey;
|
||||
use nym_contracts_common::Percent;
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_mixnet_contract_common::mixnode::PendingMixNodeChanges;
|
||||
use nym_mixnet_contract_common::{EpochState, EpochStatus, IdentityKeyRef, MixNodeBond, NodeId};
|
||||
|
||||
pub(crate) fn validate_pledge(
|
||||
mut pledge: Vec<Coin>,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
use crate::constants::INITIAL_PLEDGE_AMOUNT;
|
||||
use cosmwasm_std::{coin, Coin};
|
||||
use mixnet_contract_common::mixnode::NodeCostParams;
|
||||
use mixnet_contract_common::reward_params::ActiveSetUpdate;
|
||||
use mixnet_contract_common::{
|
||||
Gateway, MixNode, Percent, DEFAULT_INTERVAL_OPERATING_COST_AMOUNT,
|
||||
DEFAULT_PROFIT_MARGIN_PERCENT,
|
||||
use cosmwasm_std::{Coin, coin};
|
||||
use nym_mixnet_contract_common::mixnode::NodeCostParams;
|
||||
use nym_mixnet_contract_common::reward_params::ActiveSetUpdate;
|
||||
use nym_mixnet_contract_common::{
|
||||
DEFAULT_INTERVAL_OPERATING_COST_AMOUNT, DEFAULT_PROFIT_MARGIN_PERCENT, Gateway, MixNode,
|
||||
Percent,
|
||||
};
|
||||
|
||||
pub const TEST_COIN_DENOM: &str = "unym";
|
||||
|
||||
@@ -8,11 +8,11 @@ use crate::mixnodes::storage as mixnodes_storage;
|
||||
use crate::nodes::storage::next_nymnode_id_counter;
|
||||
use crate::rewards::storage as rewards_storage;
|
||||
use cosmwasm_std::{Addr, Coin, Env, Storage};
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::{
|
||||
use nym_contracts_common::IdentityKey;
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_mixnet_contract_common::{
|
||||
Gateway, GatewayBond, MixNode, MixNodeBond, NodeCostParams, NodeId, NodeRewarding,
|
||||
};
|
||||
use nym_contracts_common::IdentityKey;
|
||||
|
||||
pub(crate) fn save_new_mixnode(
|
||||
storage: &mut dyn Storage,
|
||||
|
||||
@@ -23,7 +23,7 @@ pub mod test_helpers {
|
||||
};
|
||||
use crate::interval::{pending_events, storage as interval_storage};
|
||||
use crate::mixnet_contract_settings::storage::{
|
||||
self as mixnet_params_storage, minimum_node_pledge, ADMIN,
|
||||
self as mixnet_params_storage, ADMIN, minimum_node_pledge,
|
||||
};
|
||||
use crate::mixnet_contract_settings::storage::{rewarding_denom, rewarding_validator_address};
|
||||
use crate::mixnodes::helpers::get_mixnode_details_by_id;
|
||||
@@ -55,38 +55,16 @@ pub mod test_helpers {
|
||||
};
|
||||
use crate::support::tests::{legacy, test_helpers};
|
||||
use crate::testable_mixnet_contract::MixnetContract;
|
||||
use cosmwasm_std::testing::message_info;
|
||||
use cosmwasm_std::testing::mock_env;
|
||||
use cosmwasm_std::testing::MockApi;
|
||||
use cosmwasm_std::testing::MockQuerier;
|
||||
use cosmwasm_std::{coin, coins, Addr, BankMsg, CosmosMsg, Storage};
|
||||
use cosmwasm_std::testing::message_info;
|
||||
use cosmwasm_std::testing::mock_env;
|
||||
use cosmwasm_std::{Addr, BankMsg, CosmosMsg, Storage, coin, coins};
|
||||
use cosmwasm_std::{Coin, Order};
|
||||
use cosmwasm_std::{Decimal, Empty, MemoryStorage};
|
||||
use cosmwasm_std::{Deps, OwnedDeps};
|
||||
use cosmwasm_std::{DepsMut, MessageInfo};
|
||||
use cosmwasm_std::{Env, Response, Timestamp, Uint128};
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::events::{
|
||||
MixnetEventType, DELEGATES_REWARD_KEY, OPERATOR_REWARD_KEY,
|
||||
};
|
||||
use mixnet_contract_common::helpers::compare_decimals;
|
||||
use mixnet_contract_common::mixnode::{NodeRewarding, UnbondedMixnode};
|
||||
use mixnet_contract_common::nym_node::{RewardedSetMetadata, Role};
|
||||
use mixnet_contract_common::pending_events::{PendingEpochEventData, PendingIntervalEventData};
|
||||
use mixnet_contract_common::reward_params::{
|
||||
NodeRewardingParameters, Performance, RewardingParams, WorkFactor,
|
||||
};
|
||||
use mixnet_contract_common::rewarding::simulator::simulated_node::SimulatedNode;
|
||||
use mixnet_contract_common::rewarding::simulator::Simulator;
|
||||
use mixnet_contract_common::rewarding::RewardDistribution;
|
||||
use mixnet_contract_common::{
|
||||
ContractStateParamsUpdate, Delegation, EpochEventId, EpochState, EpochStatus, ExecuteMsg,
|
||||
Gateway, GatewayBondingPayload, IdentityKey, Interval, MixNode, MixNodeBond,
|
||||
MixNodeDetails, MixnodeBondingPayload, NodeId, NymNode, NymNodeBond, NymNodeBondingPayload,
|
||||
NymNodeDetails, OperatingCostRange, OperatorsParamsUpdate, ProfitMarginRange,
|
||||
RoleAssignment, SignableGatewayBondingMsg, SignableMixNodeBondingMsg,
|
||||
SignableNymNodeBondingMsg,
|
||||
};
|
||||
use nym_contracts_common::signing::{
|
||||
ContractMessageContent, MessageSignature, SignableMessage, SigningAlgorithm, SigningPurpose,
|
||||
};
|
||||
@@ -94,14 +72,38 @@ pub mod test_helpers {
|
||||
use nym_contracts_common_testing::{mock_api, mock_dependencies};
|
||||
use nym_crypto::asymmetric::ed25519;
|
||||
use nym_crypto::asymmetric::ed25519::KeyPair;
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_mixnet_contract_common::events::{
|
||||
DELEGATES_REWARD_KEY, MixnetEventType, OPERATOR_REWARD_KEY,
|
||||
};
|
||||
use nym_mixnet_contract_common::helpers::compare_decimals;
|
||||
use nym_mixnet_contract_common::mixnode::{NodeRewarding, UnbondedMixnode};
|
||||
use nym_mixnet_contract_common::nym_node::{RewardedSetMetadata, Role};
|
||||
use nym_mixnet_contract_common::pending_events::{
|
||||
PendingEpochEventData, PendingIntervalEventData,
|
||||
};
|
||||
use nym_mixnet_contract_common::reward_params::{
|
||||
NodeRewardingParameters, Performance, RewardingParams, WorkFactor,
|
||||
};
|
||||
use nym_mixnet_contract_common::rewarding::RewardDistribution;
|
||||
use nym_mixnet_contract_common::rewarding::simulator::Simulator;
|
||||
use nym_mixnet_contract_common::rewarding::simulator::simulated_node::SimulatedNode;
|
||||
use nym_mixnet_contract_common::{
|
||||
ContractStateParamsUpdate, Delegation, EpochEventId, EpochState, EpochStatus, ExecuteMsg,
|
||||
Gateway, GatewayBondingPayload, IdentityKey, Interval, MixNode, MixNodeBond,
|
||||
MixNodeDetails, MixnodeBondingPayload, NodeId, NymNode, NymNodeBond, NymNodeBondingPayload,
|
||||
NymNodeDetails, OperatingCostRange, OperatorsParamsUpdate, ProfitMarginRange,
|
||||
RoleAssignment, SignableGatewayBondingMsg, SignableMixNodeBondingMsg,
|
||||
SignableNymNodeBondingMsg,
|
||||
};
|
||||
use rand::distributions::WeightedIndex;
|
||||
use rand::prelude::*;
|
||||
use rand_chacha::rand_core::{CryptoRng, RngCore, SeedableRng};
|
||||
use rand_chacha::ChaCha20Rng;
|
||||
use rand_chacha::rand_core::{CryptoRng, RngCore, SeedableRng};
|
||||
use serde::Serialize;
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub(crate) use nym_contracts_common_testing::helpers::{find_attribute, FindAttribute};
|
||||
pub(crate) use nym_contracts_common_testing::helpers::{FindAttribute, find_attribute};
|
||||
|
||||
pub(crate) fn sorted_addresses(n: usize) -> Vec<Addr> {
|
||||
let mut rng = test_rng();
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
|
||||
use crate::contract::{execute, instantiate, migrate, query};
|
||||
use cosmwasm_std::Decimal;
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::reward_params::RewardedSetParams;
|
||||
use mixnet_contract_common::{
|
||||
ExecuteMsg, InitialRewardingParams, InstantiateMsg, MigrateMsg, QueryMsg,
|
||||
};
|
||||
use nym_contracts_common::Percent;
|
||||
use nym_contracts_common_testing::{
|
||||
mock_dependencies, ContractFn, PermissionedFn, QueryFn, TEST_DENOM,
|
||||
ContractFn, PermissionedFn, QueryFn, TEST_DENOM, mock_dependencies,
|
||||
};
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_mixnet_contract_common::reward_params::RewardedSetParams;
|
||||
use nym_mixnet_contract_common::{
|
||||
ExecuteMsg, InitialRewardingParams, InstantiateMsg, MigrateMsg, QueryMsg,
|
||||
};
|
||||
use std::time::Duration;
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ use crate::interval::transactions::{
|
||||
perform_pending_epoch_actions, perform_pending_interval_actions,
|
||||
};
|
||||
use cosmwasm_std::{DepsMut, Env, Response};
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::events::{
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_mixnet_contract_common::events::{
|
||||
new_pending_epoch_events_execution_event, new_pending_interval_events_execution_event,
|
||||
new_reconcile_pending_events,
|
||||
};
|
||||
|
||||
@@ -9,10 +9,10 @@ use crate::rewards::storage as rewards_storage;
|
||||
use crate::support::helpers::{
|
||||
ensure_bonded, ensure_epoch_in_progress_state, ensure_no_pending_pledge_changes,
|
||||
};
|
||||
use cosmwasm_std::{wasm_execute, DepsMut, Env, Event, MessageInfo, Response};
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::{Delegation, NodeId};
|
||||
use vesting_contract_common::messages::ExecuteMsg as VestingExecuteMsg;
|
||||
use cosmwasm_std::{DepsMut, Env, Event, MessageInfo, Response, wasm_execute};
|
||||
use nym_mixnet_contract_common::error::MixnetContractError;
|
||||
use nym_mixnet_contract_common::{Delegation, NodeId};
|
||||
use nym_vesting_contract_common::messages::ExecuteMsg as VestingExecuteMsg;
|
||||
|
||||
pub(crate) fn try_migrate_vested_mixnode(
|
||||
deps: DepsMut<'_>,
|
||||
@@ -223,7 +223,7 @@ mod tests {
|
||||
use crate::mixnodes::helpers::get_mixnode_details_by_id;
|
||||
use crate::support::tests::test_helpers::TestSetup;
|
||||
use cosmwasm_std::testing::message_info;
|
||||
use cosmwasm_std::{from_json, CosmosMsg, WasmMsg};
|
||||
use cosmwasm_std::{CosmosMsg, WasmMsg, from_json};
|
||||
|
||||
#[test]
|
||||
fn with_no_bonded_nodes() {
|
||||
@@ -290,14 +290,14 @@ mod tests {
|
||||
mod migrating_vested_delegation {
|
||||
use super::*;
|
||||
use crate::delegations::storage::delegations;
|
||||
use crate::support::tests::test_helpers::{assert_eq_with_leeway, TestSetup};
|
||||
use crate::support::tests::test_helpers::{TestSetup, assert_eq_with_leeway};
|
||||
use cosmwasm_std::testing::message_info;
|
||||
use cosmwasm_std::{from_json, CosmosMsg, Order, Uint128, WasmMsg};
|
||||
use mixnet_contract_common::helpers::compare_decimals;
|
||||
use mixnet_contract_common::nym_node::Role;
|
||||
use mixnet_contract_common::reward_params::{NodeRewardingParameters, Performance};
|
||||
use mixnet_contract_common::rewarding::helpers::truncate_reward;
|
||||
use mixnet_contract_common::RoleAssignment;
|
||||
use cosmwasm_std::{CosmosMsg, Order, Uint128, WasmMsg, from_json};
|
||||
use nym_mixnet_contract_common::RoleAssignment;
|
||||
use nym_mixnet_contract_common::helpers::compare_decimals;
|
||||
use nym_mixnet_contract_common::nym_node::Role;
|
||||
use nym_mixnet_contract_common::reward_params::{NodeRewardingParameters, Performance};
|
||||
use nym_mixnet_contract_common::rewarding::helpers::truncate_reward;
|
||||
use rand::RngCore;
|
||||
|
||||
#[test]
|
||||
@@ -325,10 +325,12 @@ mod tests {
|
||||
.unwrap();
|
||||
|
||||
// make sure we haven't chosen somebody that also has a vested delegation because that would have invalidated the test
|
||||
assert!(!delegations()
|
||||
.range(test.deps().storage, None, None, Order::Ascending)
|
||||
.filter_map(|d| d.map(|(_, del)| del).ok())
|
||||
.any(|d| d.proxy.is_some() && d.owner.as_str() == delegation.owner.as_str()));
|
||||
assert!(
|
||||
!delegations()
|
||||
.range(test.deps().storage, None, None, Order::Ascending)
|
||||
.filter_map(|d| d.map(|(_, del)| del).ok())
|
||||
.any(|d| d.proxy.is_some() && d.owner.as_str() == delegation.owner.as_str())
|
||||
);
|
||||
|
||||
let sender = message_info(&delegation.owner, &[]);
|
||||
let mix_id = delegation.node_id;
|
||||
@@ -352,10 +354,12 @@ mod tests {
|
||||
.unwrap();
|
||||
|
||||
// make sure we haven't chosen somebody that also has a liquid delegation because that would have invalidated the test
|
||||
assert!(!delegations()
|
||||
.range(test.deps().storage, None, None, Order::Ascending)
|
||||
.filter_map(|d| d.map(|(_, del)| del).ok())
|
||||
.any(|d| d.proxy.is_none() && d.owner.as_str() == delegation.owner.as_str()));
|
||||
assert!(
|
||||
!delegations()
|
||||
.range(test.deps().storage, None, None, Order::Ascending)
|
||||
.filter_map(|d| d.map(|(_, del)| del).ok())
|
||||
.any(|d| d.proxy.is_none() && d.owner.as_str() == delegation.owner.as_str())
|
||||
);
|
||||
|
||||
let storage_key = delegation.storage_key();
|
||||
let mut expected_liquid = delegation.clone();
|
||||
@@ -380,10 +384,12 @@ mod tests {
|
||||
);
|
||||
|
||||
// the entry is gone from the old storage key
|
||||
assert!(delegations()
|
||||
.may_load(test.deps().storage, storage_key)
|
||||
.unwrap()
|
||||
.is_none());
|
||||
assert!(
|
||||
delegations()
|
||||
.may_load(test.deps().storage, storage_key)
|
||||
.unwrap()
|
||||
.is_none()
|
||||
);
|
||||
|
||||
// and is resaved (without proxy) under the new key
|
||||
assert_eq!(
|
||||
@@ -450,10 +456,12 @@ mod tests {
|
||||
);
|
||||
|
||||
// the vested delegation is gone
|
||||
assert!(delegations()
|
||||
.may_load(test.deps().storage, vested_storage_key)
|
||||
.unwrap()
|
||||
.is_none());
|
||||
assert!(
|
||||
delegations()
|
||||
.may_load(test.deps().storage, vested_storage_key)
|
||||
.unwrap()
|
||||
.is_none()
|
||||
);
|
||||
|
||||
let updated_liquid_delegation = delegations()
|
||||
.load(test.deps().storage, liquid_storage_key.clone())
|
||||
|
||||
@@ -27,18 +27,18 @@ cw-storage-plus = { workspace = true }
|
||||
cosmwasm-schema = { workspace = true, optional = true }
|
||||
cosmwasm-std = { workspace = true }
|
||||
|
||||
nym-group-contract-common = { path = "../../../common/cosmwasm-smart-contracts/group-contract" }
|
||||
nym-multisig-contract-common = { path = "../../../common/cosmwasm-smart-contracts/multisig-contract" }
|
||||
nym-contracts-common = { path = "../../../common/cosmwasm-smart-contracts/contracts-common" }
|
||||
nym-contracts-common-testing = { path = "../../../common/cosmwasm-smart-contracts/contracts-common-testing", optional = true }
|
||||
nym-group-contract-common = { workspace = true }
|
||||
nym-multisig-contract-common = { workspace = true }
|
||||
nym-contracts-common = { workspace = true }
|
||||
nym-contracts-common-testing = { workspace = true, optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
easy-addr = { path = "../../../common/cosmwasm-smart-contracts/easy_addr" }
|
||||
cw4-group = { path = "../cw4-group" }
|
||||
easy-addr = { workspace = true }
|
||||
cw4-group = { workspace = true }
|
||||
cw-multi-test = { workspace = true }
|
||||
cw20-base = { workspace = true }
|
||||
|
||||
[features]
|
||||
# use library feature to disable all instantiate/execute/query exports
|
||||
library = []
|
||||
testable-cw3-contract = ["nym-contracts-common-testing"]
|
||||
testable-cw3-contract = ["nym-contracts-common-testing"]
|
||||
|
||||
@@ -35,7 +35,7 @@ cw-storage-plus = { workspace = true }
|
||||
cosmwasm-schema = { workspace = true }
|
||||
cosmwasm-std = { workspace = true }
|
||||
schemars = { workspace = true }
|
||||
serde = { workspace = true, default-features = false, features = ["derive"] }
|
||||
serde = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
@@ -44,4 +44,4 @@ easy-addr = { path = "../../../common/cosmwasm-smart-contracts/easy_addr" }
|
||||
[features]
|
||||
# use library feature to disable all instantiate/execute/query exports
|
||||
library = []
|
||||
testable-cw4-contract = ["nym-contracts-common-testing"]
|
||||
testable-cw4-contract = ["nym-contracts-common-testing"]
|
||||
|
||||
@@ -22,12 +22,12 @@ cw-controllers = { workspace = true }
|
||||
|
||||
cosmwasm-schema = { workspace = true, optional = true }
|
||||
|
||||
nym-contracts-common = { path = "../../common/cosmwasm-smart-contracts/contracts-common" }
|
||||
nym-pool-contract-common = { path = "../../common/cosmwasm-smart-contracts/nym-pool-contract" }
|
||||
nym-contracts-common = { workspace = true }
|
||||
nym-pool-contract-common = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
anyhow = { workspace = true }
|
||||
nym-contracts-common-testing = { path = "../../common/cosmwasm-smart-contracts/contracts-common-testing" }
|
||||
nym-contracts-common-testing = { workspace = true }
|
||||
|
||||
[features]
|
||||
schema-gen = ["nym-pool-contract-common/schema", "cosmwasm-schema"]
|
||||
|
||||
@@ -25,18 +25,18 @@ serde = { workspace = true }
|
||||
|
||||
cosmwasm-schema = { workspace = true, optional = true }
|
||||
|
||||
nym-contracts-common = { path = "../../common/cosmwasm-smart-contracts/contracts-common" }
|
||||
nym-performance-contract-common = { path = "../../common/cosmwasm-smart-contracts/nym-performance-contract" }
|
||||
nym-mixnet-contract-common = { path = "../../common/cosmwasm-smart-contracts/mixnet-contract" }
|
||||
nym-contracts-common = { workspace = true }
|
||||
nym-performance-contract-common = { workspace = true }
|
||||
nym-mixnet-contract-common = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
anyhow = { workspace = true }
|
||||
nym-contracts-common-testing = { path = "../../common/cosmwasm-smart-contracts/contracts-common-testing" }
|
||||
nym-mixnet-contract = { path = "../mixnet", features = ["testable-mixnet-contract"] }
|
||||
nym-crypto = { path = "../../common/crypto", features = ["asymmetric", "rand"] }
|
||||
nym-contracts-common-testing = { workspace = true }
|
||||
nym-mixnet-contract = { workspace = true, features = ["testable-mixnet-contract"] }
|
||||
nym-crypto = { workspace = true, features = ["asymmetric", "rand"] }
|
||||
|
||||
[features]
|
||||
schema-gen = ["nym-performance-contract-common/schema", "cosmwasm-schema"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
workspace = true
|
||||
|
||||
@@ -24,9 +24,9 @@ name = "vesting_contract"
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
[dependencies]
|
||||
mixnet-contract-common = { path = "../../common/cosmwasm-smart-contracts/mixnet-contract", package = "nym-mixnet-contract-common", version = "0.6.0" }
|
||||
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" }
|
||||
nym-mixnet-contract-common = { workspace = true }
|
||||
nym-contracts-common = { workspace = true }
|
||||
nym-vesting-contract-common = { workspace = true }
|
||||
|
||||
cosmwasm-schema = { workspace = true, optional = true }
|
||||
cosmwasm-std = { workspace = true }
|
||||
@@ -46,4 +46,4 @@ cosmwasm-crypto = { workspace = true }
|
||||
|
||||
|
||||
[features]
|
||||
schema-gen = ["vesting-contract-common/schema", "cosmwasm-schema"]
|
||||
schema-gen = ["nym-vesting-contract-common/schema", "cosmwasm-schema"]
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use cosmwasm_schema::write_api;
|
||||
use vesting_contract_common::{ExecuteMsg, InitMsg, MigrateMsg, QueryMsg};
|
||||
use nym_vesting_contract_common::{ExecuteMsg, InitMsg, MigrateMsg, QueryMsg};
|
||||
|
||||
fn main() {
|
||||
write_api! {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
pub use crate::queries::*;
|
||||
use crate::storage::{ADMIN, MIXNET_CONTRACT_ADDRESS, MIX_DENOM};
|
||||
use crate::storage::{ADMIN, MIX_DENOM, MIXNET_CONTRACT_ADDRESS};
|
||||
pub use crate::transactions::*;
|
||||
use contracts_common::set_build_information;
|
||||
use cosmwasm_std::{
|
||||
entry_point, to_json_binary, Addr, Coin, Deps, DepsMut, Env, MessageInfo, QueryResponse,
|
||||
Response, Uint128,
|
||||
Addr, Coin, Deps, DepsMut, Env, MessageInfo, QueryResponse, Response, Uint128, entry_point,
|
||||
to_json_binary,
|
||||
};
|
||||
use vesting_contract_common::messages::{ExecuteMsg, InitMsg, MigrateMsg, QueryMsg};
|
||||
use vesting_contract_common::{Account, VestingContractError};
|
||||
use nym_contracts_common::set_build_information;
|
||||
use nym_vesting_contract_common::messages::{ExecuteMsg, InitMsg, MigrateMsg, QueryMsg};
|
||||
use nym_vesting_contract_common::{Account, VestingContractError};
|
||||
|
||||
// version info for migration info
|
||||
const CONTRACT_NAME: &str = "crate:nym-vesting-contract";
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use crate::storage;
|
||||
use crate::storage::{account_from_address, BlockTimestampSecs, ACCOUNTS, DELEGATIONS, MIX_DENOM};
|
||||
use crate::storage::{ACCOUNTS, BlockTimestampSecs, DELEGATIONS, MIX_DENOM, account_from_address};
|
||||
use crate::traits::VestingAccount;
|
||||
use crate::vesting::StorableVestingAccountExt;
|
||||
use contracts_common::{get_build_information, ContractBuildInformation};
|
||||
use cosmwasm_std::{Coin, Deps, Env, Order, StdResult, Timestamp, Uint128};
|
||||
use cw_storage_plus::Bound;
|
||||
use mixnet_contract_common::NodeId;
|
||||
use vesting_contract_common::{
|
||||
use nym_contracts_common::{ContractBuildInformation, get_build_information};
|
||||
use nym_mixnet_contract_common::NodeId;
|
||||
use nym_vesting_contract_common::{
|
||||
Account, AccountVestingCoins, AccountsResponse, AllDelegationsResponse, BaseVestingAccountInfo,
|
||||
DelegationTimesResponse, OriginalVestingResponse, Period, PledgeData, VestingCoinsResponse,
|
||||
VestingContractError, VestingDelegation,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use cosmwasm_std::{Addr, Api, Storage, Uint128};
|
||||
use cosmwasm_std::{Coin, Order};
|
||||
use cw_storage_plus::{Item, Map};
|
||||
use mixnet_contract_common::{IdentityKey, NodeId};
|
||||
use vesting_contract_common::account::VestingAccountStorageKey;
|
||||
use vesting_contract_common::{Account, PledgeData, VestingContractError};
|
||||
use nym_mixnet_contract_common::{IdentityKey, NodeId};
|
||||
use nym_vesting_contract_common::account::VestingAccountStorageKey;
|
||||
use nym_vesting_contract_common::{Account, PledgeData, VestingContractError};
|
||||
|
||||
pub(crate) type BlockTimestampSecs = u64;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ pub mod helpers {
|
||||
// the `ContractState` should replace the below
|
||||
#[allow(unused)]
|
||||
mod state_dump_decoder {
|
||||
use base64::{engine::general_purpose, Engine};
|
||||
use base64::{Engine, engine::general_purpose};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fs::File;
|
||||
use std::path::Path;
|
||||
@@ -69,22 +69,22 @@ pub mod helpers {
|
||||
}
|
||||
|
||||
use crate::contract::{instantiate, try_create_periodic_vesting_account};
|
||||
use crate::storage::{ACCOUNTS, ADMIN, MIXNET_CONTRACT_ADDRESS, MIX_DENOM};
|
||||
use crate::storage::{ACCOUNTS, ADMIN, MIX_DENOM, MIXNET_CONTRACT_ADDRESS};
|
||||
use crate::support::tests::helpers::state_dump_decoder::RawState;
|
||||
use crate::traits::VestingAccount;
|
||||
use crate::vesting::{populate_vesting_periods, StorableVestingAccountExt};
|
||||
use contracts_common::Percent;
|
||||
use cosmwasm_std::testing::{message_info, mock_dependencies, mock_env, MockApi, MockQuerier};
|
||||
use crate::vesting::{StorableVestingAccountExt, populate_vesting_periods};
|
||||
use cosmwasm_std::testing::{MockApi, MockQuerier, message_info, mock_dependencies, mock_env};
|
||||
use cosmwasm_std::{
|
||||
coin, Addr, BlockInfo, Coin, ContractInfo, Deps, DepsMut, Empty, Env, MemoryStorage,
|
||||
MessageInfo, OwnedDeps, Storage, Timestamp, Uint128,
|
||||
Addr, BlockInfo, Coin, ContractInfo, Deps, DepsMut, Empty, Env, MemoryStorage, MessageInfo,
|
||||
OwnedDeps, Storage, Timestamp, Uint128, coin,
|
||||
};
|
||||
use rand_chacha::rand_core::SeedableRng;
|
||||
use nym_contracts_common::Percent;
|
||||
use nym_vesting_contract_common::messages::InitMsg;
|
||||
use nym_vesting_contract_common::{Account, PledgeCap, VestingSpecification};
|
||||
use rand_chacha::ChaCha20Rng;
|
||||
use rand_chacha::rand_core::SeedableRng;
|
||||
use std::path::Path;
|
||||
use std::str::FromStr;
|
||||
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)]
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
use contracts_common::signing::MessageSignature;
|
||||
use cosmwasm_std::{Coin, Env, Response, Storage};
|
||||
use mixnet_contract_common::{
|
||||
use nym_contracts_common::signing::MessageSignature;
|
||||
use nym_mixnet_contract_common::{
|
||||
Gateway, MixNode,
|
||||
gateway::GatewayConfigUpdate,
|
||||
mixnode::{MixNodeConfigUpdate, NodeCostParams},
|
||||
Gateway, MixNode,
|
||||
};
|
||||
use vesting_contract_common::VestingContractError;
|
||||
use nym_vesting_contract_common::VestingContractError;
|
||||
|
||||
pub trait MixnodeBondingAccount {
|
||||
fn try_claim_operator_reward(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use cosmwasm_std::{Coin, Env, Response, Storage, Uint128};
|
||||
use mixnet_contract_common::NodeId;
|
||||
use vesting_contract_common::VestingContractError;
|
||||
use nym_mixnet_contract_common::NodeId;
|
||||
use nym_vesting_contract_common::VestingContractError;
|
||||
|
||||
pub trait DelegatingAccount {
|
||||
fn try_claim_delegator_reward(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use cosmwasm_std::{Addr, Coin, Env, Storage, Timestamp, Uint128};
|
||||
use vesting_contract_common::{OriginalVestingResponse, VestingContractError};
|
||||
use nym_vesting_contract_common::{OriginalVestingResponse, VestingContractError};
|
||||
|
||||
pub trait VestingAccount {
|
||||
fn total_staked(&self, storage: &dyn Storage) -> Result<Uint128, VestingContractError>;
|
||||
|
||||
@@ -3,25 +3,25 @@
|
||||
|
||||
use crate::contract::{ensure_staking_permission, validate_funds};
|
||||
use crate::storage::{
|
||||
account_from_address, save_account, ADMIN, MIXNET_CONTRACT_ADDRESS, MIX_DENOM,
|
||||
ADMIN, MIX_DENOM, MIXNET_CONTRACT_ADDRESS, account_from_address, save_account,
|
||||
};
|
||||
use crate::traits::{
|
||||
DelegatingAccount, GatewayBondingAccount, MixnodeBondingAccount, VestingAccount,
|
||||
};
|
||||
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::{
|
||||
use crate::vesting::{StorableVestingAccountExt, populate_vesting_periods};
|
||||
use cosmwasm_std::{BankMsg, Coin, DepsMut, Env, MessageInfo, Response, Timestamp, coin};
|
||||
use nym_contracts_common::signing::MessageSignature;
|
||||
use nym_mixnet_contract_common::{
|
||||
Gateway, GatewayConfigUpdate, MixNode, MixNodeConfigUpdate, NodeCostParams, NodeId,
|
||||
};
|
||||
use vesting_contract_common::events::{
|
||||
use nym_vesting_contract_common::events::{
|
||||
new_ownership_transfer_event, new_periodic_vesting_account_event,
|
||||
new_staking_address_update_event, new_track_gateway_unbond_event,
|
||||
new_track_migrate_mixnode_event, 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::{Account, PledgeCap, VestingContractError, VestingSpecification};
|
||||
use nym_vesting_contract_common::{Account, PledgeCap, VestingContractError, VestingSpecification};
|
||||
|
||||
/// Update locked_pledge_cap, the hard cap for staking/bonding with unvested tokens.
|
||||
///
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
use crate::contract::MAX_PER_MIX_DELEGATIONS;
|
||||
use crate::storage::save_delegation;
|
||||
use crate::storage::MIXNET_CONTRACT_ADDRESS;
|
||||
use crate::storage::save_delegation;
|
||||
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::NodeId;
|
||||
use vesting_contract_common::events::{
|
||||
use cosmwasm_std::{Coin, Env, Response, Storage, Uint128, wasm_execute};
|
||||
use nym_mixnet_contract_common::ExecuteMsg as MixnetExecuteMsg;
|
||||
use nym_mixnet_contract_common::NodeId;
|
||||
use nym_vesting_contract_common::VestingContractError;
|
||||
use nym_vesting_contract_common::events::{
|
||||
new_vesting_delegation_event, new_vesting_undelegation_event,
|
||||
};
|
||||
use vesting_contract_common::VestingContractError;
|
||||
|
||||
use super::Account;
|
||||
|
||||
|
||||
@@ -2,16 +2,16 @@ use super::PledgeData;
|
||||
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::{
|
||||
gateway::GatewayConfigUpdate, ExecuteMsg as MixnetExecuteMsg, Gateway,
|
||||
use cosmwasm_std::{Coin, Env, Response, Storage, Uint128, wasm_execute};
|
||||
use nym_contracts_common::signing::MessageSignature;
|
||||
use nym_mixnet_contract_common::{
|
||||
ExecuteMsg as MixnetExecuteMsg, Gateway, gateway::GatewayConfigUpdate,
|
||||
};
|
||||
use vesting_contract_common::events::{
|
||||
use nym_vesting_contract_common::VestingContractError;
|
||||
use nym_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;
|
||||
|
||||
|
||||
@@ -5,17 +5,17 @@ use super::Account;
|
||||
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;
|
||||
use mixnet_contract_common::mixnode::NodeCostParams;
|
||||
use mixnet_contract_common::{ExecuteMsg as MixnetExecuteMsg, MixNode};
|
||||
use vesting_contract_common::events::{
|
||||
use cosmwasm_std::{Coin, Env, Response, Storage, Uint128, wasm_execute};
|
||||
use nym_contracts_common::signing::MessageSignature;
|
||||
use nym_mixnet_contract_common::mixnode::MixNodeConfigUpdate;
|
||||
use nym_mixnet_contract_common::mixnode::NodeCostParams;
|
||||
use nym_mixnet_contract_common::{ExecuteMsg as MixnetExecuteMsg, MixNode};
|
||||
use nym_vesting_contract_common::events::{
|
||||
new_vesting_decrease_pledge_event, new_vesting_mixnode_bonding_event,
|
||||
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, VestingContractError};
|
||||
use nym_vesting_contract_common::{PledgeData, VestingContractError};
|
||||
|
||||
impl MixnodeBondingAccount for Account {
|
||||
fn try_claim_operator_reward(
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
|
||||
use super::VestingPeriod;
|
||||
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, BlockTimestampSecs, DELEGATIONS, KEY,
|
||||
BlockTimestampSecs, DELEGATIONS, KEY, 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,
|
||||
};
|
||||
use crate::traits::VestingAccount;
|
||||
use cosmwasm_std::{Addr, Coin, Order, Storage, Timestamp, Uint128};
|
||||
use mixnet_contract_common::NodeId;
|
||||
use vesting_contract_common::account::VestingAccountStorageKey;
|
||||
use vesting_contract_common::{Account, PledgeCap, PledgeData, VestingContractError};
|
||||
use nym_mixnet_contract_common::NodeId;
|
||||
use nym_vesting_contract_common::account::VestingAccountStorageKey;
|
||||
use nym_vesting_contract_common::{Account, PledgeCap, PledgeData, VestingContractError};
|
||||
|
||||
mod delegating_account;
|
||||
mod gateway_bonding_account;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use crate::storage::{delete_account, save_account, MIX_DENOM};
|
||||
use crate::storage::{MIX_DENOM, delete_account, save_account};
|
||||
use crate::traits::VestingAccount;
|
||||
use crate::vesting::account::StorableVestingAccountExt;
|
||||
use cosmwasm_std::{Addr, Coin, Env, Storage, Timestamp, Uint128};
|
||||
use nym_vesting_contract_common::{OriginalVestingResponse, Period, VestingContractError};
|
||||
use std::cmp::min;
|
||||
use vesting_contract_common::{OriginalVestingResponse, Period, VestingContractError};
|
||||
|
||||
use super::Account;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
mod account;
|
||||
|
||||
pub(crate) use account::StorableVestingAccountExt;
|
||||
use vesting_contract_common::{VestingPeriod, VestingSpecification};
|
||||
use nym_vesting_contract_common::{VestingPeriod, VestingSpecification};
|
||||
|
||||
pub fn populate_vesting_periods(
|
||||
start_time: u64,
|
||||
@@ -16,21 +16,21 @@ mod tests {
|
||||
|
||||
use crate::support::tests::helpers::vesting_account_percent_fixture;
|
||||
use crate::support::tests::helpers::{
|
||||
init_contract, vesting_account_mid_fixture, vesting_account_new_fixture, TEST_COIN_DENOM,
|
||||
TEST_COIN_DENOM, init_contract, vesting_account_mid_fixture, vesting_account_new_fixture,
|
||||
};
|
||||
use crate::traits::DelegatingAccount;
|
||||
use crate::traits::GatewayBondingAccount;
|
||||
use crate::traits::VestingAccount;
|
||||
use crate::vesting::account::StorableVestingAccountExt;
|
||||
use crate::vesting::populate_vesting_periods;
|
||||
use contracts_common::signing::MessageSignature;
|
||||
use cosmwasm_std::testing::{message_info, mock_env};
|
||||
use cosmwasm_std::{coin, coins, Addr, Coin, Timestamp, Uint128};
|
||||
use mixnet_contract_common::mixnode::NodeCostParams;
|
||||
use mixnet_contract_common::{Gateway, MixNode, Percent};
|
||||
use vesting_contract_common::messages::ExecuteMsg;
|
||||
use vesting_contract_common::{Account, PledgeCap, VestingSpecification};
|
||||
use vesting_contract_common::{Period, VestingContractError};
|
||||
use cosmwasm_std::{Addr, Coin, Timestamp, Uint128, coin, coins};
|
||||
use nym_contracts_common::signing::MessageSignature;
|
||||
use nym_mixnet_contract_common::mixnode::NodeCostParams;
|
||||
use nym_mixnet_contract_common::{Gateway, MixNode, Percent};
|
||||
use nym_vesting_contract_common::messages::ExecuteMsg;
|
||||
use nym_vesting_contract_common::{Account, PledgeCap, VestingSpecification};
|
||||
use nym_vesting_contract_common::{Period, VestingContractError};
|
||||
|
||||
#[test]
|
||||
fn test_account_creation() {
|
||||
|
||||
Reference in New Issue
Block a user