Skip to content

Commit

Permalink
WIP on credit spec #100
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronc committed Feb 25, 2020
1 parent 40f2be3 commit 2ce33fc
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 0 deletions.
Empty file added docs/specs/credit/README.md
Empty file.
70 changes: 70 additions & 0 deletions docs/specs/credit/credit.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
syntax = "proto3";

package regen_network.credit;

import "third_party/mapbox/geobuf.proto";
import "google/protobuf/timestamp.proto";

message MsgCreateCreditClass {
bytes designer = 1;
repeated bytes issuers = 2;
// CreditType type = 3;
}

//enum CreditType {
// CARBON = 0; // tons is unit
// BIODIVERSITY_AREA = 1; // hectares is unit
// BIODIVERSITY_SCORE = 2;
//}

message MsgIssueCredit {
bytes credit_class = 1;
string units = 2; // decimal
bytes issuer = 3;
bytes issuee = 4;
geobuf.Data.Geometry polygon = 5;
google.protobuf.Timestamp start_date = 6;
google.protobuf.Timestamp end_date = 7;
}

message MsgSend {
bytes from = 1;
bytes to = 2;
repeated Asset assets = 3;
}

message MsgBurn {
bytes account = 1;
repeated Asset assets = 2;
}

message Asset {
bytes asset_id = 1;
string amount = 2;
}

message CreditClassMetadata {
bytes credit_class = 1;
bytes designer = 2;
repeated bytes issuers = 3;
// CreditType type = 4;
}

message CreditMetadata {
bytes asset_id = 1;
bytes credit_class = 2;
bytes issuer = 3;
}

message AssetSupply {
bytes asset_id = 1;
string liquid_supply = 2;
string burned_supply = 3;
}

message AssetBalance {
bytes account = 1;
bytes asset_id = 2;
string liquid_balance = 3;
string burned_balance = 4;
}
68 changes: 68 additions & 0 deletions docs/specs/credit/third_party/mapbox/geobuf.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
option optimize_for = LITE_RUNTIME;

package geobuf;

message Data {
repeated string keys = 1; // global arrays of unique keys

optional uint32 dimensions = 2 [default = 2]; // max coordinate dimensions
optional uint32 precision = 3 [default = 6]; // number of digits after decimal point for coordinates

oneof data_type {
FeatureCollection feature_collection = 4;
Feature feature = 5;
Geometry geometry = 6;
}

message Feature {
required Geometry geometry = 1;

oneof id_type {
string id = 11;
sint64 int_id = 12;
}

repeated Value values = 13; // unique values
repeated uint32 properties = 14 [packed = true]; // pairs of key/value indexes
repeated uint32 custom_properties = 15 [packed = true]; // arbitrary properties
}

message Geometry {
required Type type = 1;

repeated uint32 lengths = 2 [packed = true]; // coordinate structure in lengths
repeated sint64 coords = 3 [packed = true]; // delta-encoded integer values
repeated Geometry geometries = 4;

repeated Value values = 13;
repeated uint32 custom_properties = 15 [packed = true];

enum Type {
POINT = 0;
MULTIPOINT = 1;
LINESTRING = 2;
MULTILINESTRING = 3;
POLYGON = 4;
MULTIPOLYGON = 5;
GEOMETRYCOLLECTION = 6;
}
}

message FeatureCollection {
repeated Feature features = 1;

repeated Value values = 13;
repeated uint32 custom_properties = 15 [packed = true];
}

message Value {
oneof value_type {
string string_value = 1;
double double_value = 2;
uint64 pos_int_value = 3;
uint64 neg_int_value = 4;
bool bool_value = 5;
string json_value = 6;
}
}
}

0 comments on commit 2ce33fc

Please sign in to comment.