Skip to content

cip: Conviction Voting Template #87

@oed

Description

@oed
cip: <to be assigned>
title: Conviction Voting Template
author: Joel Thorstensson (@oed)
discussions-to: <URL of the Github issue for this CIP (if this is a PR)>
status: Idea
category: Standards
type: RFC
created: 2021-02-28

This is still a work in progress. Will add more context to these schemas!

Simple Summary

This CIP describes a template that can be used to create off-chain conviction voting dapps.

Abstract

Abstract goes here.

Motivation

Fix me :)

Specification

Definition content

Deployment: Deploy your own.

{
  "name": "Conviction Voting Dapp",
  "description": "Voting data for my dapp",
  "schema": "<convictions-schema-docid>",
  "config": {
    "context": "<caip19-asset-id>"
  }
}

Proposal Schema

Deployment: <proposal-schema-docid>

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "title": "Convictions",
  "properties": {
    "context": {
      "type": "string"
    },
    "title": {
      "type": "string"
    },
    "currency": {
      "type": "string"
    },
    "amount": {
      "type": "number"
    },
    "beneficiary": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "url": {
      "type": "string"
    }
  },
  "additionalProperties": false,
  "required": [
    "context",
    "title",
    "currency",
    "amount",
    "beneficiary",
    "url"
  ]
}

Convictions Schema

Deployment: <convictions-schema-docid>

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "title": "Convictions",
  "properties": {
    "context": {
      "type": "string"
    },
    "supply": {
      "type": "number"
    },
    "proposals": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/proposals"
      }
    },
    "convictions": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/convictions"
      }
    }
  },
  "additionalProperties": false,
  "required": [
    "context",
    "proposals",
    "convictions"
  ],
  "definitions": {
    "proposals": {
      "type": "string",
      "$id": "ceramic://doc",
      "$ceramicSchema": "<proposal-schema-docid>",
      "maxLength": 150
    },
    "convictions": {
      "type": "object",
      "properties": {
        "proposal": {
          "type": "string",
          "$id": "ceramic://doc",
          "$ceramicSchema": "<proposal-schema-docid>",
          "maxLength": 150
        },
        "allocation": {
          "type": "number"
        }
      },
      "required": [
        "proposal",
        "allocation"
      ]
    }
  }
}

Conviction State Schema

Deployment: <convictions-state-schema-docid>

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "title": "ConvictionState",
  "properties": {
    "context": {
      "type": "string"
    },
    "blockHeight": {
      "type": "number"
    },
    "supply": {
      "type": "number"
    },
    "participants": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/participants"
      }
    },
    "proposals": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/proposals"
      }
    }
  },
  "additionalProperties": false,
  "required": [
    "context",
    "supply",
    "participants",
    "proposals"
  ],
  "definitions": {
    "participants": {
      "type": "object",
      "properties": {
        "account": {
          "type": "string"
        },
        "balance": {
          "type": "number"
        },
        "convictions": {
          "type": "string",
          "$id": "ceramic://doc",
          "$ceramicSchema": "<convictions-schema-docid>",
          "maxLength": 150
        }
      },
      "required": [
        "account",
        "balance",
        "convictions"
      ]
    },
    "proposals": {
      "type": "object",
      "properties": {
        "proposal": {
          "type": "string",
          "$id": "ceramic://doc",
          "$ceramicSchema": "<proposal-schema-docid>",
          "maxLength": 150
        },
        "totalConviction": {
          "type": "number"
        },
        "triggered": {
          "type": "boolean"
        }
      },
      "required": [
        "proposal",
        "totalConviction",
        "triggered"
      ]
    }
  }
}

Rationale

Fix me :)

Backwards Compatibility

N/A

Implementation

Fix me :)

Security Considerations

Security considerations go here.

Copyright

Copyright and related rights waived via CC0.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions