Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update token-holding-amount #36

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
}),
],
}),
}),
},
};
Loading