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

Add bean support for TokenAmountHolding VC #2770

Merged
merged 5 commits into from
May 29, 2024

Conversation

higherordertech
Copy link
Contributor

…nt VC

Context

Labels

Please apply following PR-related labels when appropriate:

  • C0-breaking: if your change could break the existing client, e.g. API change, critical logic change
  • C1-noteworthy: if your change is non-breaking, but is still worth noticing for the client, e.g. reference code improvement

How (Optional)

Testing Evidences

Please attach any relevant evidences if applicable

Copy link

linear bot commented May 29, 2024

@higherordertech higherordertech enabled auto-merge (squash) May 29, 2024 13:12
Copy link
Collaborator

@Kailai-Wang Kailai-Wang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good from my side, if we want to add COMBO we probably need to add another a separete bean_balance

@Kailai-Wang
Copy link
Collaborator

Kailai-Wang commented May 29, 2024

And yes I can see how urgent it was 😂

image

@Kailai-Wang Kailai-Wang requested a review from a team May 29, 2024 13:37
Copy link
Member

@felixfaisal felixfaisal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @higherordertech ! Looks good
So i was tracking the logic,

To use NodeReal for COMBO we have to make changes to


and rest of the things in this file.

So we need to do the above changes for supporting COMBO.

@Kailai-Wang Kailai-Wang disabled auto-merge May 29, 2024 15:56
felixfaisal and others added 4 commits May 29, 2024 19:36
* feat: add new web3 network combo

* fix: support bean on combo

* refactor: use combo instead of combo-mainnet
@Kailai-Wang Kailai-Wang changed the title feat: P-822 added web3 token BEAN on bsc network for TokenHoldingAmou… Add bean support for TokenAmountHolding VC May 29, 2024
@Kailai-Wang Kailai-Wang enabled auto-merge (squash) May 29, 2024 21:34
@Kailai-Wang Kailai-Wang merged commit c86621d into dev May 29, 2024
33 checks passed
@Kailai-Wang Kailai-Wang deleted the P-822-BEAN-bsc-holding-amount branch May 29, 2024 22:10
@Kailai-Wang
Copy link
Collaborator

Attaching test evidence too:

./litentry-cli trusted -d request-vc did:litentry:evm:0x50bdf51209BABDd7a86a98AB80E824604Cec452a -a "token-holding-amount bean"

Example generated VC:

{
  "@context": [
    "https://www.w3.org/2018/credentials/v1",
    "https://w3id.org/security/suites/ed25519-2020/v1"
  ],
  "id": "0x79452104b10ec5a35ba0f77a4a6fdf0c1f7d5bf9b5418e09ea5b4c6da17f32fa",
  "type": [
    "VerifiableCredential"
  ],
  "credentialSubject": {
    "id": "did:litentry:evm:0x50bdf51209babdd7a86a98ab80e824604cec452a",
    "description": "The amount of a particular token you are holding",
    "type": "Token Holding Amount",
    "assertionText": "TokenHoldingAmount(Bean)",
    "assertions": [
      {
        "and": [
          {
            "src": "",
            "op": "==",
            "dst": "BEAN"
          },
          {
            "or": [
              {
                "and": [
                  {
                    "src": "",
                    "op": "==",
                    "dst": "bsc"
                  },
                  {
                    "src": "",
                    "op": "==",
                    "dst": "0x07da81e9a684ab87fad7206b3bc8d0866f48cc7c"
                  }
                ]
              },
              {
                "and": [
                  {
                    "src": "",
                    "op": "==",
                    "dst": "combo"
                  },
                  {
                    "src": "",
                    "op": "==",
                    "dst": "0xba7b9936a965fac23bb7a8190364fa60622b3cff"
                  }
                ]
              }
            ]
          },
          {
            "src": "",
            "op": ">=",
            "dst": "0"
          },
          {
            "src": "",
            "op": "<",
            "dst": "1500"
          }
        ]
      }
    ],
    "values": [
      true
    ],
    "endpoint": "http://localhost:9933"
  },
  "issuer": {
    "id": "did:litentry:substrate:0xda340fed8f85f3a3ee9dd2c7aa36c29c79ad87eb19b5d78544278d7605566caf",
    "name": "Litentry TEE Worker",
    "mrenclave": "8GkkAQ81Rc9TrRn6JWtUwEZD8DWF5k8DbLBxroX5Ln1N",
    "runtimeVersion": {
      "parachain": 9180,
      "sidechain": 106
    }
  },
  "issuanceDate": "2024-05-29T23:02:45.856569183+00:00",
  "parachainBlockNumber": 9,
  "sidechainBlockNumber": 10,
  "proof": {
    "created": "2024-05-29T23:02:45.856827055+00:00",
    "type": "Ed25519Signature2020",
    "proofPurpose": "assertionMethod",
    "proofValue": "4465a6a2f8b763888cf1f123afb8cb2e7b6d224f3b1fc17f3ea5796127754f5cf74e0e11511e12e75611ce5a2408eef2fe1f6f1fded3995d825b7e35c2b66804",
    "verificationMethod": "0xda340fed8f85f3a3ee9dd2c7aa36c29c79ad87eb19b5d78544278d7605566caf"
  },
  "credentialSchema": {
    "id": "https://raw.githubusercontent.com/litentry/vc-jsonschema/main/dist/schemas/25-token-holding-amount/1-1-2.json",
    "type": "JsonSchemaValidator2018"
  }
}

@Kailai-Wang
Copy link
Collaborator

Kailai-Wang commented May 29, 2024

With real endpoint:

{
  "@context": [
    "https://www.w3.org/2018/credentials/v1",
    "https://w3id.org/security/suites/ed25519-2020/v1"
  ],
  "id": "0x6f25985d2b9230c41bca28f349da19b26c0347870a405d7eb52df46fcc8652da",
  "type": [
    "VerifiableCredential"
  ],
  "credentialSubject": {
    "id": "did:litentry:evm:0x50bdf51209babdd7a86a98ab80e824604cec452a",
    "description": "The amount of a particular token you are holding",
    "type": "Token Holding Amount",
    "assertionText": "TokenHoldingAmount(Bean)",
    "assertions": [
      {
        "and": [
          {
            "src": "",
            "op": "==",
            "dst": "BEAN"
          },
          {
            "or": [
              {
                "and": [
                  {
                    "src": "",
                    "op": "==",
                    "dst": "bsc"
                  },
                  {
                    "src": "",
                    "op": "==",
                    "dst": "0x07da81e9a684ab87fad7206b3bc8d0866f48cc7c"
                  }
                ]
              },
              {
                "and": [
                  {
                    "src": "",
                    "op": "==",
                    "dst": "combo"
                  },
                  {
                    "src": "",
                    "op": "==",
                    "dst": "0xba7b9936a965fac23bb7a8190364fa60622b3cff"
                  }
                ]
              }
            ]
          },
          {
            "src": "",
            "op": ">=",
            "dst": "50000"
          }
        ]
      }
    ],
    "values": [
      true
    ],
    "endpoint": "http://localhost:9933"
  },
  "issuer": {
    "id": "did:litentry:substrate:0xda340fed8f85f3a3ee9dd2c7aa36c29c79ad87eb19b5d78544278d7605566caf",
    "name": "Litentry TEE Worker",
    "mrenclave": "8GkkAQ81Rc9TrRn6JWtUwEZD8DWF5k8DbLBxroX5Ln1N",
    "runtimeVersion": {
      "parachain": 9180,
      "sidechain": 106
    }
  },
  "issuanceDate": "2024-05-29T23:13:58.497467222+00:00",
  "parachainBlockNumber": 5,
  "sidechainBlockNumber": 2,
  "proof": {
    "created": "2024-05-29T23:13:58.497724076+00:00",
    "type": "Ed25519Signature2020",
    "proofPurpose": "assertionMethod",
    "proofValue": "c2dd8a1ead0b9655b8c69eb92d393b933c61ec1a7e1b2a41b6e2c8349578a7d9b0560995f51a71352743c5ff4d3451ba4389b2df84ae7cddbec374f0664fa20f",
    "verificationMethod": "0xda340fed8f85f3a3ee9dd2c7aa36c29c79ad87eb19b5d78544278d7605566caf"
  },
  "credentialSchema": {
    "id": "https://raw.githubusercontent.com/litentry/vc-jsonschema/main/dist/schemas/25-token-holding-amount/1-1-2.json",
    "type": "JsonSchemaValidator2018"
  }
}```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants