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

p-866 Adding btc token holding amount #2919

Merged
merged 19 commits into from
Jul 31, 2024
Merged

p-866 Adding btc token holding amount #2919

merged 19 commits into from
Jul 31, 2024

Conversation

0xverin
Copy link
Contributor

@0xverin 0xverin commented Jul 22, 2024

Context

as the topic;
this pr also adding dataprovider client to tokeninfo structure

The CLI test has not passed yet. But it can be reviewed first.

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

./bin/litentry-cli trusted -d link-identity did:litentry:substrate:0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d did:litentry:bitcoin:0x0381a0d6b97a0e65d1268b3ea2cd47d7cf3387b2811116b88da88cba11c6584c9e bitcoinp2wpkh
./bin/litentry-cli trusted -d request-vc did:litentry:substrate:0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d -a "dynamic 0000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000036274630000000000000000000000000000000000000000000000000000000000 true"
>>> identity: Substrate(Address32)
>>> nonce: 1
>>> assertions: [Dynamic(DynamicParams { smart_contract_id: 0x0000000000000000000000000000000000000000, smart_contract_params: Some(BoundedVec([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 98, 116, 99, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 1024)), return_log: true })]
{
    "@context": [
        "https://www.w3.org/2018/credentials/v1",
        "https://w3id.org/security/suites/ed25519-2020/v1"
    ],
    "id": "0x181cd1661794d3eb5ccbca020dfa58911ebae5c2a79d979bc0db4f85879f89ac",
    "type": [
        "VerifiableCredential"
    ],
    "credentialSubject": {
        "id": "did:litentry:substrate:0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d",
        "description": "The amount of a particular token you are holding",
        "type": "Token Holding Amount",
        "assertionText": "",
        "assertions": [
            {
                "and": [
                    {
                        "src": "$token",
                        "op": "==",
                        "dst": "btc"
                    },
                    {
                        "src": "$holding_amount",
                        "op": ">=",
                        "dst": "5"
                    },
                    {
                        "src": "$holding_amount",
                        "op": "<",
                        "dst": "10"
                    }
                ]
            }
        ],
        "values": [
            true
        ],
        "endpoint": "http://localhost:9933/"
    },
    "issuer": {
        "id": "did:litentry:substrate:0xe4f0691ecba8153794085269c53259a3250222b6edd42ce4d792f39f9f2db6c3",
        "name": "Litentry TEE Worker",
        "mrenclave": "6T6AVMxXs9SbQh8Zp9yCgDbRWSUGYYHFeY4xhm63B8Av",
        "runtimeVersion": {
            "parachain": 9186,
            "sidechain": 109
        }
    },
    "issuanceDate": "2024-07-31T08:06:28.431767421+00:00",
    "parachainBlockNumber": 474,
    "sidechainBlockNumber": 943,
    "proof": {
        "created": "2024-07-31T08:06:28.432700166+00:00",
        "type": "Ed25519Signature2020",
        "proofPurpose": "assertionMethod",
        "proofValue": "cf2ab0cd98cfa717f30432b17cd157deb07a59c9c4c674230f70027b7fc086efed9b7e59338ec246e22d7429b01725bdbca5a09afbe7e0700152d1f717250506",
        "verificationMethod": "0x17426351f9a0d1718c3746d84c60e5cd99352312914663a679c14bbea10f7812"
    },
    "credentialSchema": {
        "id": "https://raw.githubusercontent.com/litentry/vc-jsonschema/main/dist/schemas/25-token-holding-amount/1-1-3.json",
        "type": "JsonSchemaValidator2018"
    }
}
image

Copy link

linear bot commented Jul 22, 2024

@0xverin 0xverin requested review from kziemianek, higherordertech and a team July 22, 2024 11:17
Copy link
Member

@kziemianek kziemianek left a comment

Choose a reason for hiding this comment

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

Could you add hardhat tests ?

@0xverin
Copy link
Contributor Author

0xverin commented Jul 26, 2024

Could you add hardhat tests ?

Okay, that's why I didn't merge after approve.

@0xverin 0xverin force-pushed the btc-token-holding-amount branch from a25a2af to 562a576 Compare July 29, 2024 13:08
@0xverin 0xverin force-pushed the btc-token-holding-amount branch from 7c8dfe5 to c24e21e Compare July 30, 2024 04:08
@higherordertech
Copy link
Contributor

LGTM, could you pls add some cli test evidence?

@0xverin 0xverin requested a review from higherordertech July 31, 2024 02:38
@0xverin
Copy link
Contributor Author

0xverin commented Jul 31, 2024

LGTM, could you pls add some cli test evidence?

pls see description.

@higherordertech
Copy link
Contributor

LGTM, could you pls add some cli test evidence?

pls see description.

Does the true case also work?

@0xverin
Copy link
Contributor Author

0xverin commented Jul 31, 2024

LGTM, could you pls add some cli test evidence?

pls see description.

Does the true case also work?

Done!

LGTM, could you pls add some cli test evidence?

pls see description.

Does the true case also work?

Updated.

@0xverin 0xverin merged commit 09004f4 into dev Jul 31, 2024
34 checks passed
@0xverin 0xverin deleted the btc-token-holding-amount branch July 31, 2024 13:48
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.

3 participants