a21a01cf1a
* start node families topic branch * start node families topic branch * initialise node families contract * define contract storage * registering new family in storage * accepting family invitation * add_pending_invitation * revoke_pending_invitation * remove_family_member * reject_pending_invitation * disband_family * added unit tests for the storage methods * added restriction on uniquness of family names * update rustc version for node families contract common * clippy * basic queries by id * query_families_paged * change family membership storage and expose query for all members of a family * queries for pending invitations * queries for past invitations * queries for past data per node * queries for past family members * query_past_members_for_node_paged * queries for family by name and by owner * fixup family name normalisation * fixed incorrect lower bound for queries for past data * implement contract and storage initialisation * stubbing tx messages that are to be exposed by the contract * handler for updating config * removed partial fee return * wip: create family * move mixnet contract interaction traits to shared location * store original family name alongside the normalised variant * prevent family creation if owner has a node in another family * try_disband_family * try_invite_to_family + shared helpers * try_revoke_family_invitation * accept_family_invitation * stub method for node unbonding * try_reject_family_invitation * unit tests for family name normalisation * try_leave_family * try_kick_from_family * fix outdated comments and add paid fee event attribute * feat: NMv3: leave family upon node unbonding * NF contract handling of unbonding * lints * init node families contract when creating performance contract tester * clippy * avoid self-dep in the contract dev deps * introduced client traits for interacting with the node families contract * add node families contract to cache refresher * added query for all node family members (globally) and started scaffolding nym-api caches * docs and cache -> api conversion * calculating average node age based on individual timestamps * wire up node families cache * http stubs * filled in the implementation * route tests + extracting shared code * review fixes * feat: expose family information for all dvpn gateway endpoints within NS API * expose family information for explorer v3 route * clippy * review comments and optimise db family update * feat: Node Families: expose stake information inside DVpnGateway * chore: update lock files after rebase * chore: sort workspace members * explicitly require providing node families contract address for mixnet contract migration * fix missing node families contract address env export * dont swallow cache overwrite failures in fixture * pin network-defaults rustc version due to contracts dep * further version pinning * chore: update mixnet contract schema
300 lines
9.2 KiB
JSON
300 lines
9.2 KiB
JSON
{
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"title": "ContractState",
|
|
"description": "The current state of the mixnet contract.",
|
|
"type": "object",
|
|
"required": [
|
|
"node_families_contract_address",
|
|
"params",
|
|
"rewarding_denom",
|
|
"rewarding_validator_address",
|
|
"vesting_contract_address"
|
|
],
|
|
"properties": {
|
|
"node_families_contract_address": {
|
|
"description": "Address of the node families contract. It is called whenever nym-node unbonds so that it could be removed from any family it belongs to.",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/Addr"
|
|
}
|
|
]
|
|
},
|
|
"owner": {
|
|
"description": "Address of the contract owner.",
|
|
"default": null,
|
|
"deprecated": true,
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/Addr"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"params": {
|
|
"description": "Contract parameters that could be adjusted in a transaction the contract admin.",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/ContractStateParams"
|
|
}
|
|
]
|
|
},
|
|
"rewarding_denom": {
|
|
"description": "The expected denom used for rewarding (and realistically any other operation). Default: `unym`",
|
|
"type": "string"
|
|
},
|
|
"rewarding_validator_address": {
|
|
"description": "Address of \"rewarding validator\" (nym-api) that's allowed to send any rewarding-related transactions.",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/Addr"
|
|
}
|
|
]
|
|
},
|
|
"vesting_contract_address": {
|
|
"description": "Address of the vesting contract to which the mixnet contract would be sending all track-related messages.",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/Addr"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"additionalProperties": false,
|
|
"definitions": {
|
|
"Addr": {
|
|
"description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.",
|
|
"type": "string"
|
|
},
|
|
"Coin": {
|
|
"type": "object",
|
|
"required": [
|
|
"amount",
|
|
"denom"
|
|
],
|
|
"properties": {
|
|
"amount": {
|
|
"$ref": "#/definitions/Uint128"
|
|
},
|
|
"denom": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"ConfigScoreParams": {
|
|
"type": "object",
|
|
"required": [
|
|
"version_score_formula_params",
|
|
"version_weights"
|
|
],
|
|
"properties": {
|
|
"version_score_formula_params": {
|
|
"description": "Defines the parameters of the formula for calculating the version score",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/VersionScoreFormulaParams"
|
|
}
|
|
]
|
|
},
|
|
"version_weights": {
|
|
"description": "Defines weights for calculating numbers of versions behind the current release.",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/OutdatedVersionWeights"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"ContractStateParams": {
|
|
"description": "Contract parameters that could be adjusted in a transaction by the contract admin.",
|
|
"type": "object",
|
|
"required": [
|
|
"config_score_params",
|
|
"delegations_params",
|
|
"operators_params"
|
|
],
|
|
"properties": {
|
|
"config_score_params": {
|
|
"description": "Parameters to do with the config score",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/ConfigScoreParams"
|
|
}
|
|
]
|
|
},
|
|
"delegations_params": {
|
|
"description": "Parameters to do with delegations.",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/DelegationsParams"
|
|
}
|
|
]
|
|
},
|
|
"operators_params": {
|
|
"description": "Parameters to do with node operators.",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/OperatorsParams"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"Decimal": {
|
|
"description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)",
|
|
"type": "string"
|
|
},
|
|
"DelegationsParams": {
|
|
"type": "object",
|
|
"properties": {
|
|
"minimum_delegation": {
|
|
"description": "Minimum amount a delegator must stake in orders for his delegation to get accepted.",
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/Coin"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"OperatorsParams": {
|
|
"type": "object",
|
|
"required": [
|
|
"interval_operating_cost",
|
|
"minimum_pledge",
|
|
"profit_margin"
|
|
],
|
|
"properties": {
|
|
"interval_operating_cost": {
|
|
"description": "Defines the allowed interval operating cost range of operators. default: 0 - 1'000'000'000'000'000 (1 Billion native tokens - the total supply)",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/RangedValue_for_Uint128"
|
|
}
|
|
]
|
|
},
|
|
"minimum_pledge": {
|
|
"description": "Minimum amount a node must pledge to get into the system.",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/Coin"
|
|
}
|
|
]
|
|
},
|
|
"profit_margin": {
|
|
"description": "Defines the allowed profit margin range of operators. default: 0% - 100%",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/RangedValue_for_Percent"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"OutdatedVersionWeights": {
|
|
"description": "Defines weights for calculating numbers of versions behind the current release.",
|
|
"type": "object",
|
|
"required": [
|
|
"major",
|
|
"minor",
|
|
"patch",
|
|
"prerelease"
|
|
],
|
|
"properties": {
|
|
"major": {
|
|
"type": "integer",
|
|
"format": "uint32",
|
|
"minimum": 0.0
|
|
},
|
|
"minor": {
|
|
"type": "integer",
|
|
"format": "uint32",
|
|
"minimum": 0.0
|
|
},
|
|
"patch": {
|
|
"type": "integer",
|
|
"format": "uint32",
|
|
"minimum": 0.0
|
|
},
|
|
"prerelease": {
|
|
"type": "integer",
|
|
"format": "uint32",
|
|
"minimum": 0.0
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"Percent": {
|
|
"description": "Percent represents a value between 0 and 100% (i.e. between 0.0 and 1.0)",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/Decimal"
|
|
}
|
|
]
|
|
},
|
|
"RangedValue_for_Percent": {
|
|
"type": "object",
|
|
"required": [
|
|
"maximum",
|
|
"minimum"
|
|
],
|
|
"properties": {
|
|
"maximum": {
|
|
"$ref": "#/definitions/Percent"
|
|
},
|
|
"minimum": {
|
|
"$ref": "#/definitions/Percent"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"RangedValue_for_Uint128": {
|
|
"type": "object",
|
|
"required": [
|
|
"maximum",
|
|
"minimum"
|
|
],
|
|
"properties": {
|
|
"maximum": {
|
|
"$ref": "#/definitions/Uint128"
|
|
},
|
|
"minimum": {
|
|
"$ref": "#/definitions/Uint128"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"Uint128": {
|
|
"description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```",
|
|
"type": "string"
|
|
},
|
|
"VersionScoreFormulaParams": {
|
|
"description": "Given the formula of version_score = penalty ^ (versions_behind_factor ^ penalty_scaling) define the relevant parameters",
|
|
"type": "object",
|
|
"required": [
|
|
"penalty",
|
|
"penalty_scaling"
|
|
],
|
|
"properties": {
|
|
"penalty": {
|
|
"$ref": "#/definitions/Decimal"
|
|
},
|
|
"penalty_scaling": {
|
|
"$ref": "#/definitions/Decimal"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
}
|
|
}
|