2de8f8bc21
* squashed nym-pool commits initialised nym-pool contract and updated all bls12_381 to make it possible create scaffolding for tests ability to control the contract admin introducing contract grants grant type validation basic grant operations + stubs for other messages added queries use transaction stubs added expiration information to grant queries setting initial grant state based on the current environment allowance logic for attempting to spend part of a grant implemented all remaining transactions made public api for coin locking perform validation tests for locked tokens storage nympool storage tests added messages for changing granter set tests and fixes for sufficient tokens when inserting grants tests for initial state + more bugfixes queries tests additional tests for transactions and fixes post rebase fixes updated contract dependencies removed redundant wasm constructor dont ask me why this suddenly became an issue - no clue removed redundant wasm constructor dont ask me why this suddenly became an issue - no clue * missing schema + added nym_pool to the main Makefile
545 lines
15 KiB
JSON
545 lines
15 KiB
JSON
{
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"title": "ExecuteMsg",
|
|
"oneOf": [
|
|
{
|
|
"description": "Change the admin",
|
|
"type": "object",
|
|
"required": [
|
|
"update_admin"
|
|
],
|
|
"properties": {
|
|
"update_admin": {
|
|
"type": "object",
|
|
"required": [
|
|
"admin"
|
|
],
|
|
"properties": {
|
|
"admin": {
|
|
"type": "string"
|
|
},
|
|
"update_granter_set": {
|
|
"type": [
|
|
"boolean",
|
|
"null"
|
|
]
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
{
|
|
"description": "Attempt to grant new allowance to the specified grantee",
|
|
"type": "object",
|
|
"required": [
|
|
"grant_allowance"
|
|
],
|
|
"properties": {
|
|
"grant_allowance": {
|
|
"type": "object",
|
|
"required": [
|
|
"allowance",
|
|
"grantee"
|
|
],
|
|
"properties": {
|
|
"allowance": {
|
|
"$ref": "#/definitions/Allowance"
|
|
},
|
|
"grantee": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
{
|
|
"description": "Attempt to revoke previously granted allowance",
|
|
"type": "object",
|
|
"required": [
|
|
"revoke_allowance"
|
|
],
|
|
"properties": {
|
|
"revoke_allowance": {
|
|
"type": "object",
|
|
"required": [
|
|
"grantee"
|
|
],
|
|
"properties": {
|
|
"grantee": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
{
|
|
"description": "Attempt to use allowance",
|
|
"type": "object",
|
|
"required": [
|
|
"use_allowance"
|
|
],
|
|
"properties": {
|
|
"use_allowance": {
|
|
"type": "object",
|
|
"required": [
|
|
"recipients"
|
|
],
|
|
"properties": {
|
|
"recipients": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/TransferRecipient"
|
|
}
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
{
|
|
"description": "Attempt to withdraw the specified amount into the grantee's account",
|
|
"type": "object",
|
|
"required": [
|
|
"withdraw_allowance"
|
|
],
|
|
"properties": {
|
|
"withdraw_allowance": {
|
|
"type": "object",
|
|
"required": [
|
|
"amount"
|
|
],
|
|
"properties": {
|
|
"amount": {
|
|
"$ref": "#/definitions/Coin"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
{
|
|
"description": "Attempt to lock part of existing allowance for future use",
|
|
"type": "object",
|
|
"required": [
|
|
"lock_allowance"
|
|
],
|
|
"properties": {
|
|
"lock_allowance": {
|
|
"type": "object",
|
|
"required": [
|
|
"amount"
|
|
],
|
|
"properties": {
|
|
"amount": {
|
|
"$ref": "#/definitions/Coin"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
{
|
|
"description": "Attempt to unlock previously locked allowance",
|
|
"type": "object",
|
|
"required": [
|
|
"unlock_allowance"
|
|
],
|
|
"properties": {
|
|
"unlock_allowance": {
|
|
"type": "object",
|
|
"required": [
|
|
"amount"
|
|
],
|
|
"properties": {
|
|
"amount": {
|
|
"$ref": "#/definitions/Coin"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
{
|
|
"description": "Attempt to use part of the locked allowance",
|
|
"type": "object",
|
|
"required": [
|
|
"use_locked_allowance"
|
|
],
|
|
"properties": {
|
|
"use_locked_allowance": {
|
|
"type": "object",
|
|
"required": [
|
|
"recipients"
|
|
],
|
|
"properties": {
|
|
"recipients": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/TransferRecipient"
|
|
}
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
{
|
|
"description": "Attempt to withdraw the specified amount of locked tokens into the grantee's account",
|
|
"type": "object",
|
|
"required": [
|
|
"withdraw_locked_allowance"
|
|
],
|
|
"properties": {
|
|
"withdraw_locked_allowance": {
|
|
"type": "object",
|
|
"required": [
|
|
"amount"
|
|
],
|
|
"properties": {
|
|
"amount": {
|
|
"$ref": "#/definitions/Coin"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
{
|
|
"description": "Attempt to add a new account to the permitted set of grant granters",
|
|
"type": "object",
|
|
"required": [
|
|
"add_new_granter"
|
|
],
|
|
"properties": {
|
|
"add_new_granter": {
|
|
"type": "object",
|
|
"required": [
|
|
"granter"
|
|
],
|
|
"properties": {
|
|
"granter": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
{
|
|
"description": "Revoke the provided account from the permitted set of granters",
|
|
"type": "object",
|
|
"required": [
|
|
"revoke_granter"
|
|
],
|
|
"properties": {
|
|
"revoke_granter": {
|
|
"type": "object",
|
|
"required": [
|
|
"granter"
|
|
],
|
|
"properties": {
|
|
"granter": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
{
|
|
"description": "Attempt to remove expired grant from the storage and unlock (if any) locked tokens",
|
|
"type": "object",
|
|
"required": [
|
|
"remove_expired_grant"
|
|
],
|
|
"properties": {
|
|
"remove_expired_grant": {
|
|
"type": "object",
|
|
"required": [
|
|
"grantee"
|
|
],
|
|
"properties": {
|
|
"grantee": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
],
|
|
"definitions": {
|
|
"Allowance": {
|
|
"oneOf": [
|
|
{
|
|
"type": "object",
|
|
"required": [
|
|
"basic"
|
|
],
|
|
"properties": {
|
|
"basic": {
|
|
"$ref": "#/definitions/BasicAllowance"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
{
|
|
"type": "object",
|
|
"required": [
|
|
"classic_periodic"
|
|
],
|
|
"properties": {
|
|
"classic_periodic": {
|
|
"$ref": "#/definitions/ClassicPeriodicAllowance"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
{
|
|
"type": "object",
|
|
"required": [
|
|
"cumulative_periodic"
|
|
],
|
|
"properties": {
|
|
"cumulative_periodic": {
|
|
"$ref": "#/definitions/CumulativePeriodicAllowance"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
{
|
|
"type": "object",
|
|
"required": [
|
|
"delayed"
|
|
],
|
|
"properties": {
|
|
"delayed": {
|
|
"$ref": "#/definitions/DelayedAllowance"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
]
|
|
},
|
|
"BasicAllowance": {
|
|
"description": "BasicAllowance is an allowance with a one-time grant of coins that optionally expires. The grantee can use up to SpendLimit to cover fees.",
|
|
"type": "object",
|
|
"properties": {
|
|
"expiration_unix_timestamp": {
|
|
"description": "expiration specifies an optional time when this allowance expires",
|
|
"type": [
|
|
"integer",
|
|
"null"
|
|
],
|
|
"format": "uint64",
|
|
"minimum": 0.0
|
|
},
|
|
"spend_limit": {
|
|
"description": "spend_limit specifies the maximum amount of coins that can be spent by this allowance and will be updated as coins are spent. If it is empty, there is no spend limit and any amount of coins can be spent.",
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/Coin"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"ClassicPeriodicAllowance": {
|
|
"description": "ClassicPeriodicAllowance extends BasicAllowance to allow for both a maximum cap, as well as a limit per time period.",
|
|
"type": "object",
|
|
"required": [
|
|
"basic",
|
|
"period_duration_secs",
|
|
"period_spend_limit"
|
|
],
|
|
"properties": {
|
|
"basic": {
|
|
"description": "basic specifies a struct of `BasicAllowance`",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/BasicAllowance"
|
|
}
|
|
]
|
|
},
|
|
"period_can_spend": {
|
|
"description": "period_can_spend is the number of coins left to be spent before the period_reset time",
|
|
"default": null,
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/Coin"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"period_duration_secs": {
|
|
"description": "period_duration_secs specifies the time duration in which period_spend_limit coins can be spent before that allowance is reset",
|
|
"type": "integer",
|
|
"format": "uint64",
|
|
"minimum": 0.0
|
|
},
|
|
"period_reset_unix_timestamp": {
|
|
"description": "period_reset is the time at which this period resets and a new one begins, it is calculated from the start time of the first transaction after the last period ended",
|
|
"default": 0,
|
|
"type": "integer",
|
|
"format": "uint64",
|
|
"minimum": 0.0
|
|
},
|
|
"period_spend_limit": {
|
|
"description": "period_spend_limit specifies the maximum number of coins that can be spent in the period",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/Coin"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"Coin": {
|
|
"type": "object",
|
|
"required": [
|
|
"amount",
|
|
"denom"
|
|
],
|
|
"properties": {
|
|
"amount": {
|
|
"$ref": "#/definitions/Uint128"
|
|
},
|
|
"denom": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"CumulativePeriodicAllowance": {
|
|
"type": "object",
|
|
"required": [
|
|
"basic",
|
|
"period_duration_secs",
|
|
"period_grant"
|
|
],
|
|
"properties": {
|
|
"accumulation_limit": {
|
|
"description": "accumulation_limit is the maximum value the grants and accumulate to",
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/Coin"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"basic": {
|
|
"description": "basic specifies a struct of `BasicAllowance`",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/BasicAllowance"
|
|
}
|
|
]
|
|
},
|
|
"last_grant_applied_unix_timestamp": {
|
|
"description": "last_grant_applied is the time at which last transaction associated with this allowance has been sent and `spendable` value has been adjusted",
|
|
"default": 0,
|
|
"type": "integer",
|
|
"format": "uint64",
|
|
"minimum": 0.0
|
|
},
|
|
"period_duration_secs": {
|
|
"description": "period_duration_secs specifies the time duration in which spendable coins can be spent before that allowance is incremented",
|
|
"type": "integer",
|
|
"format": "uint64",
|
|
"minimum": 0.0
|
|
},
|
|
"period_grant": {
|
|
"description": "period_grant specifies the maximum number of coins that is granted per period",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/Coin"
|
|
}
|
|
]
|
|
},
|
|
"spendable": {
|
|
"description": "spendable is the number of coins left to be spent before additional grant is applied",
|
|
"default": null,
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/Coin"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"DelayedAllowance": {
|
|
"description": "Create a grant to allow somebody to withdraw from the pool only after the specified time. For example, we could create a grant for mixnet rewarding/testing/etc However, if the required work has not been completed, the grant could be revoked before it's withdrawn",
|
|
"type": "object",
|
|
"required": [
|
|
"available_at_unix_timestamp",
|
|
"basic"
|
|
],
|
|
"properties": {
|
|
"available_at_unix_timestamp": {
|
|
"description": "available_at specifies when this allowance is going to become usable",
|
|
"type": "integer",
|
|
"format": "uint64",
|
|
"minimum": 0.0
|
|
},
|
|
"basic": {
|
|
"description": "basic specifies a struct of `BasicAllowance`",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/BasicAllowance"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"TransferRecipient": {
|
|
"type": "object",
|
|
"required": [
|
|
"amount",
|
|
"recipient"
|
|
],
|
|
"properties": {
|
|
"amount": {
|
|
"$ref": "#/definitions/Coin"
|
|
},
|
|
"recipient": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"Uint128": {
|
|
"description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```",
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|