cw20-escrow 0.7.0

Implementation of an escrow that accepts CosmWasm-20 tokens as well as native tokens
Documentation
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "ExecuteMsg",
  "anyOf": [
    {
      "type": "object",
      "required": [
        "create"
      ],
      "properties": {
        "create": {
          "$ref": "#/definitions/CreateMsg"
        }
      },
      "additionalProperties": false
    },
    {
      "description": "Adds all sent native tokens to the contract",
      "type": "object",
      "required": [
        "top_up"
      ],
      "properties": {
        "top_up": {
          "type": "object",
          "required": [
            "id"
          ],
          "properties": {
            "id": {
              "type": "string"
            }
          }
        }
      },
      "additionalProperties": false
    },
    {
      "description": "Approve sends all tokens to the recipient. Only the arbiter can do this",
      "type": "object",
      "required": [
        "approve"
      ],
      "properties": {
        "approve": {
          "type": "object",
          "required": [
            "id"
          ],
          "properties": {
            "id": {
              "description": "id is a human-readable name for the escrow from create",
              "type": "string"
            }
          }
        }
      },
      "additionalProperties": false
    },
    {
      "description": "Refund returns all remaining tokens to the original sender, The arbiter can do this any time, or anyone can do this after a timeout",
      "type": "object",
      "required": [
        "refund"
      ],
      "properties": {
        "refund": {
          "type": "object",
          "required": [
            "id"
          ],
          "properties": {
            "id": {
              "description": "id is a human-readable name for the escrow from create",
              "type": "string"
            }
          }
        }
      },
      "additionalProperties": false
    },
    {
      "description": "This accepts a properly-encoded ReceiveMsg from a cw20 contract",
      "type": "object",
      "required": [
        "receive"
      ],
      "properties": {
        "receive": {
          "$ref": "#/definitions/Cw20ReceiveMsg"
        }
      },
      "additionalProperties": false
    }
  ],
  "definitions": {
    "Binary": {
      "description": "Binary is a wrapper around Vec<u8> to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec<u8>",
      "type": "string"
    },
    "CreateMsg": {
      "type": "object",
      "required": [
        "arbiter",
        "id",
        "recipient"
      ],
      "properties": {
        "arbiter": {
          "description": "arbiter can decide to approve or refund the escrow",
          "type": "string"
        },
        "cw20_whitelist": {
          "description": "Besides any possible tokens sent with the CreateMsg, this is a list of all cw20 token addresses that are accepted by the escrow during a top-up. This is required to avoid a DoS attack by topping-up with an invalid cw20 contract. See https://github.com/CosmWasm/cosmwasm-plus/issues/19",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string"
          }
        },
        "end_height": {
          "description": "When end height set and block height exceeds this value, the escrow is expired. Once an escrow is expired, it can be returned to the original funder (via \"refund\").",
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 0.0
        },
        "end_time": {
          "description": "When end time (in seconds since epoch 00:00:00 UTC on 1 January 1970) is set and block time exceeds this value, the escrow is expired. Once an escrow is expired, it can be returned to the original funder (via \"refund\").",
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 0.0
        },
        "id": {
          "description": "id is a human-readable name for the escrow to use later 3-20 bytes of utf-8 text",
          "type": "string"
        },
        "recipient": {
          "description": "if approved, funds go to the recipient",
          "type": "string"
        }
      }
    },
    "Cw20ReceiveMsg": {
      "description": "Cw20ReceiveMsg should be de/serialized under `Receive()` variant in a ExecuteMsg",
      "type": "object",
      "required": [
        "amount",
        "msg",
        "sender"
      ],
      "properties": {
        "amount": {
          "$ref": "#/definitions/Uint128"
        },
        "msg": {
          "$ref": "#/definitions/Binary"
        },
        "sender": {
          "type": "string"
        }
      }
    },
    "Uint128": {
      "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```",
      "type": "string"
    }
  }
}