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

DeployContract implementation for Tezos connector #36

Merged
merged 5 commits into from
Apr 8, 2024

Conversation

alex-semenyuk
Copy link
Member

@alex-semenyuk alex-semenyuk commented Mar 20, 2024

Related PRs to firefly and firefly-cli

Request example

{
   "key":"tz1V3spuktTP2wuEZP7D2hJruLZ5uJTuJk31",
   "contract":{
      "code":[
         {
            "args":[
               {
                  "prim":"string"
               }
            ],
            "prim":"parameter"
         },
         {
            "args":[
               {
                  "prim":"string"
               }
            ],
            "prim":"storage"
         },
         {
            "args":[
               [
                  {
                     "prim":"CAR"
                  },
                  {
                     "args":[
                        {
                           "prim":"operation"
                        }
                     ],
                     "prim":"NIL"
                  },
                  {
                     "prim":"PAIR"
                  }
               ]
            ],
            "prim":"code"
         }
      ],
      "storage":{
         "string":"hello world"
      }
   }
}

Response

{
  "id": "3caf86b2-be4d-40c2-9450-bd4af5340e4a",
  "namespace": "default",
  "tx": "b492cd22-2eff-4b78-a9f2-95da5db58e9b",
  "type": "blockchain_deploy",
  "status": "Pending",
  "plugin": "tezos",
  "input": {
    "contract": {
      "code": [
        {
          "args": [
            {
              "prim": "string"
            }
          ],
          "prim": "parameter"
        },
        {
          "args": [
            {
              "prim": "string"
            }
          ],
          "prim": "storage"
        },
        {
          "args": [
            [
              {
                "prim": "CAR"
              },
              {
                "args": [
                  {
                    "prim": "operation"
                  }
                ],
                "prim": "NIL"
              },
              {
                "prim": "PAIR"
              }
            ]
          ],
          "prim": "code"
        }
      ],
      "storage": {
        "string": "hello world!!!!"
      }
    },
    "definition": null,
    "input": null,
    "key": "tz1V3spuktTP2wuEZP7D2hJruLZ5uJTuJk31",
    "options": null
  },
  "created": "2024-03-19T21:06:22.871702Z",
  "updated": "2024-03-19T21:06:22.871702Z"
}

Signed-off-by: Alexey Semenyuk <[email protected]>
Signed-off-by: Alexey Semenyuk <[email protected]>
Signed-off-by: Alexey Semenyuk <[email protected]>
Copy link
Member Author

Choose a reason for hiding this comment

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

Currently this file doesn't have coverage TODO add this at next PR

Signed-off-by: Alexey Semenyuk <[email protected]>
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 43.33333% with 34 lines in your changes are missing coverage. Please review.

Project coverage is 62.43%. Comparing base (c734c3b) to head (40c82b2).
Report is 5 commits behind head on main.

Files Patch % Lines
internal/tezos/get_receipt.go 0.00% 34 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #36      +/-   ##
==========================================
- Coverage   63.70%   62.43%   -1.28%     
==========================================
  Files          22       22              
  Lines         912      969      +57     
==========================================
+ Hits          581      605      +24     
- Misses        325      358      +33     
  Partials        6        6              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nguyer
Copy link
Contributor

nguyer commented Apr 8, 2024

@alex-semenyuk If I am reading this correctly, for Tezos, the code (instructions) are bound up in the same object as the type definitions for a smart contract. Am I understanding that correctly? I'm just thinking through if we're using the right fields here.

For ethereum contracts, the compiled code and the interface are entirely separate things, and have separate fields on FireFly's API but maybe that doesn't make sense with Tezos.

@alex-semenyuk
Copy link
Member Author

@alex-semenyuk If I am reading this correctly, for Tezos, the code (instructions) are bound up in the same object as the type definitions for a smart contract. Am I understanding that correctly? I'm just thinking through if we're using the right fields here.

For ethereum contracts, the compiled code and the interface are entirely separate things, and have separate fields on FireFly's API but maybe that doesn't make sense with Tezos.

@nguyer
Right.
I saw at example here https://hyperledger.github.io/firefly/tutorials/custom_contracts/ethereum.html#contract-deployment that for Ethereum we have separate contract (compiled bytecode) and definition.
As for Tezos it's quite different we have Michelson Code which includes this both instructions and type definitions and initial storage values.

@nguyer nguyer merged commit 9def885 into hyperledger:main Apr 8, 2024
3 checks passed
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.

4 participants