Skip to content

Commit

Permalink
Merge pull request #36 from litentry/update-token-holding-amount
Browse files Browse the repository at this point in the history
Update token-holding-amount
  • Loading branch information
BillyWooo authored May 13, 2024
2 parents a5b2525 + 9e9614c commit 5a4fe86
Show file tree
Hide file tree
Showing 3 changed files with 348 additions and 0 deletions.
265 changes: 265 additions & 0 deletions dist/schemas/17-token-holding-amount/1-1-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,265 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://raw.githubusercontent.com/litentry/vc-jsonschema/main/dist/schemas/17-token-holding-amount/1-1-1.json",
"title": "Token holding amount",
"description": "The amount of a particular token you are holding",
"type": "object",
"required": [
"@context",
"issuer",
"issuanceDate",
"credentialSubject",
"proof"
],
"properties": {
"@context": {
"type": "array",
"items": {
"type": "string",
"format": "uri"
}
},
"id": {
"type": "string"
},
"type": {
"type": "array",
"items": {
"type": "string"
}
},
"issuer": {
"type": "object",
"required": [
"id",
"name",
"mrenclave"
],
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"mrenclave": {
"type": "string"
},
"runtimeVersion": {
"type": "object",
"required": [
"parachain",
"sidechain"
],
"properties": {
"sidechain": {
"type": "number"
},
"parachain": {
"type": "number"
}
}
}
}
},
"issuanceDate": {
"type": "string",
"format": "date-time"
},
"proof": {
"type": "object",
"required": [
"created",
"type",
"proofPurpose",
"proofValue",
"verificationMethod"
],
"properties": {
"created": {
"type": "string",
"format": "date-time"
},
"type": {
"type": "string"
},
"proofPurpose": {
"type": "string"
},
"proofValue": {
"type": "string"
},
"verificationMethod": {
"type": "string"
}
}
},
"credentialSubject": {
"title": "Credential Subject of Token holding amount",
"type": "object",
"required": [
"id",
"type",
"values",
"endpoint",
"assertions"
],
"properties": {
"id": {
"type": "string"
},
"type": {
"type": "string"
},
"description": {
"type": "string"
},
"values": {
"type": "array",
"minItems": 1,
"items": {
"type": "boolean"
}
},
"endpoint": {
"type": "string",
"format": "uri"
},
"assertions": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"required": [
"and"
],
"properties": {
"and": {
"type": "array",
"minItems": 2,
"maxItems": 2,
"additionalItems": false,
"items": [
{
"type": "object",
"required": [
"src",
"op",
"dst"
],
"properties": {
"src": {
"type": "string",
"enum": [
"$wbtc_holding_amount",
"$lit_holding_amount",
"$usdc_holding_amount",
"$usdt_holding_amount",
"$crv_holding_amount",
"$matic_holding_amount",
"$dydx_holding_amount",
"$amp_holding_amount",
"$cvx_holding_amount",
"$tusd_holding_amount",
"$usdd_holding_amount",
"$gusd_holding_amount",
"$link_holding_amount",
"$grt_holding_amount",
"$comp_holding_amount",
"$people_holding_amount",
"$gtc_holding_amount",
"$eth_holding_amount",
"lit_holding_amount",
"$lit_staking_amount",
"$ada_holding_amount",
"$doge_holding_amount",
"$shib_holding_amount",
"$uni_holding_amount",
"$bch_holding_amount",
"$etc_holding_amount",
"$atom_holding_amount",
"$dai_holding_amount",
"$leo_holding_amount",
"$fil_holding_amount",
"$imx_holding_amount",
"$cro_holding_amount",
"$inj_holding_amount"
]
},
"op": {
"type": "string",
"enum": [
">="
]
},
"dst": {
"type": "string"
}
}
},
{
"type": "object",
"required": [
"src",
"op",
"dst"
],
"properties": {
"src": {
"type": "string",
"enum": [
"$wbtc_holding_amount",
"$lit_holding_amount",
"$usdc_holding_amount",
"$usdt_holding_amount",
"$crv_holding_amount",
"$matic_holding_amount",
"$dydx_holding_amount",
"$amp_holding_amount",
"$cvx_holding_amount",
"$tusd_holding_amount",
"$usdd_holding_amount",
"$gusd_holding_amount",
"$link_holding_amount",
"$grt_holding_amount",
"$comp_holding_amount",
"$people_holding_amount",
"$gtc_holding_amount",
"$eth_holding_amount",
"lit_holding_amount",
"$lit_staking_amount",
"$ada_holding_amount",
"$doge_holding_amount",
"$shib_holding_amount",
"$uni_holding_amount",
"$bch_holding_amount",
"$etc_holding_amount",
"$atom_holding_amount",
"$dai_holding_amount",
"$leo_holding_amount",
"$fil_holding_amount",
"$imx_holding_amount",
"$cro_holding_amount",
"$inj_holding_amount"
]
},
"op": {
"type": "string",
"enum": [
"<"
]
},
"dst": {
"type": "string"
}
}
}
]
}
}
}
}
}
}
}
}
6 changes: 6 additions & 0 deletions packages/schemas/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ and this project follows [Schema Versioning](https://docs.snowplow.io/docs/pipel

-

## 2024-05-13

(REVISION) [`25-token-holding-amount`](./src/lib/25-token-holding-amount/) bumped to 1-1-1

- Support tokens: `Ada`, `Doge`, `Shib`, `Uni`, `Bch`, `Etc`, `Atom`, `Dai`, `Leo`, `Fil`, `Imx`, `Cro`, `Inj`.

## 2024-05-10

(ADDITION) [`24-platform-user`](./src/lib/24-platform-user/) bumped to 1-1-s1
Expand Down
77 changes: 77 additions & 0 deletions packages/schemas/src/lib/17-token-holding-amount/1-1-1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import { JSONSchema7 } from 'json-schema';

import { schema as base } from '../0-base/1-1-0';
import { resolveGitHubPath } from '../helpers';
import { credentialSubject, assertion } from '../schema-helpers';

const supportedTokens = [
// https://github.com/litentry/litentry-parachain/blob/dev/tee-worker/litentry/core/credentials/src/litentry_profile/token_balance.rs
'$wbtc_holding_amount',
'$lit_holding_amount',
'$usdc_holding_amount',
'$usdt_holding_amount',
'$crv_holding_amount',
'$matic_holding_amount',
'$dydx_holding_amount',
'$amp_holding_amount',
'$cvx_holding_amount',
'$tusd_holding_amount',
'$usdd_holding_amount',
'$gusd_holding_amount',
'$link_holding_amount',
'$grt_holding_amount',
'$comp_holding_amount',
'$people_holding_amount',
'$gtc_holding_amount',
// https://github.com/litentry/litentry-parachain/blob/dev/tee-worker/litentry/core/credentials/src/litentry_profile/holding_amount.rs
'$eth_holding_amount',
// https://github.com/litentry/litentry-parachain/blob/dev/tee-worker/litentry/core/credentials/src/achainable/lit_holding_amount.rs
'lit_holding_amount',
/// https://github.com/litentry/litentry-parachain/blob/dev/tee-worker/litentry/core/credentials/src/litentry_profile/lit_staking.rs
'$lit_staking_amount',

'$ada_holding_amount',
'$doge_holding_amount',
'$shib_holding_amount',
'$uni_holding_amount',
'$bch_holding_amount',
'$etc_holding_amount',
'$atom_holding_amount',
'$dai_holding_amount',
'$leo_holding_amount',
'$fil_holding_amount',
'$imx_holding_amount',
'$cro_holding_amount',
'$inj_holding_amount',
];

export const schema: JSONSchema7 = {
...base,

$id: resolveGitHubPath('17-token-holding-amount/1-1-1.json'),

title: 'Token holding amount',
description: 'The amount of a particular token you are holding',

properties: {
...base.properties,

credentialSubject: credentialSubject({
title: 'Credential Subject of Token holding amount',
assertions: assertion.and({
items: [
assertion.clause({
src: supportedTokens,
op: ['>='],
dst: undefined, // Amount, can be any number. Format is a string.
}),
assertion.clause({
src: supportedTokens,
op: ['<'],
dst: undefined, // Amount, can be any number. Format is a string.
}),
],
}),
}),
},
};

0 comments on commit 5a4fe86

Please sign in to comment.