{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "ThresholdResponse",
"description": "This defines the different ways tallies can happen. Every contract should support a subset of these, ideally all.\n\nThe total_weight used for calculating success as well as the weights of each individual voter used in tallying should be snapshotted at the beginning of the block at which the proposal starts (this is likely the responsibility of a correct cw4 implementation).",
"anyOf": [
{
"description": "Declares that a fixed weight of yes votes is needed to pass. It does not matter how many no votes are cast, or how many do not vote, as long as `weight` yes votes are cast.\n\nThis is the simplest format and usually suitable for small multisigs of trusted parties, like 3 of 5. (weight: 3, total_weight: 5)\n\nA proposal of this type can pass early as soon as the needed weight of yes votes has been cast.",
"type": "object",
"required": [
"absolute_count"
],
"properties": {
"absolute_count": {
"type": "object",
"required": [
"total_weight",
"weight"
],
"properties": {
"total_weight": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"weight": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
}
}
},
"additionalProperties": false
},
{
"description": "Declares a percentage of the total weight that must cast Yes votes, in order for a proposal to pass. The passing weight is computed over the total weight minus the weight of the abstained votes.\n\nThis is useful for similar circumstances as `AbsoluteCount`, where we have a relatively small set of voters, and participation is required. It is understood that if the voting set (group) changes between different proposals that refer to the same group, each proposal will work with a different set of voter weights (the ones snapshotted at proposal creation), and the passing weight for each proposal will be computed based on the absolute percentage, times the total weights of the members at the time of each proposal creation.\n\nExample: we set `percentage` to 51%. Proposal 1 starts when there is a `total_weight` of 5. This will require 3 weight of Yes votes in order to pass. Later, the Proposal 2 starts but the `total_weight` of the group has increased to 9. That proposal will then automatically require 5 Yes of 9 to pass, rather than 3 yes of 9 as would be the case with `AbsoluteCount`.",
"type": "object",
"required": [
"absolute_percentage"
],
"properties": {
"absolute_percentage": {
"type": "object",
"required": [
"percentage",
"total_weight"
],
"properties": {
"percentage": {
"$ref": "#/definitions/Decimal"
},
"total_weight": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
}
}
},
"additionalProperties": false
},
{
"description": "In addition to a `threshold`, declares a `quorum` of the total votes that must participate in the election in order for the vote to be considered at all. Within the votes that were cast, it requires `threshold` votes in favor. That is calculated by ignoring the Abstain votes (they count towards `quorum`, but do not influence `threshold`). That is, we calculate `Yes / (Yes + No + Veto)` and compare it with `threshold` to consider if the proposal was passed.\n\nIt is rather difficult for a proposal of this type to pass early. That can only happen if the required quorum has been already met, and there are already enough Yes votes for the proposal to pass.\n\n30% Yes votes, 10% No votes, and 20% Abstain would pass early if quorum <= 60% (who has cast votes) and if the threshold is <= 37.5% (the remaining 40% voting no => 30% yes + 50% no). Once the voting period has passed with no additional votes, that same proposal would be considered successful if quorum <= 60% and threshold <= 75% (percent in favor if we ignore abstain votes).\n\nThis type is more common in general elections, where participation is often expected to be low, and `AbsolutePercentage` would either be too high to pass anything, or allow low percentages to pass, independently of if there was high participation in the election or not.",
"type": "object",
"required": [
"threshold_quorum"
],
"properties": {
"threshold_quorum": {
"type": "object",
"required": [
"quorum",
"threshold",
"total_weight"
],
"properties": {
"quorum": {
"$ref": "#/definitions/Decimal"
},
"threshold": {
"$ref": "#/definitions/Decimal"
},
"total_weight": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
}
}
},
"additionalProperties": false
}
],
"definitions": {
"Decimal": {
"description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)",
"type": "string"
}
}
}