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

Michelson Lambda parameter support #273

Open
simonmcl opened this issue Apr 8, 2020 · 2 comments
Open

Michelson Lambda parameter support #273

simonmcl opened this issue Apr 8, 2020 · 2 comments
Assignees

Comments

@simonmcl
Copy link

simonmcl commented Apr 8, 2020

In your code there is a comment that states Michelson Lambda parameters are currently not supported, when converting Michelson to Micheline.

Is there any timeline on implementing that? I'm building an app at the minute that will require a lot of Michelson Lambda functions and would love to not have to try hardcode the conversions into my app.

@anonymoussprocket
Copy link
Contributor

hi, it would be helpful if you provided some known-good samples for me to test against.

@anonymoussprocket anonymoussprocket self-assigned this Apr 26, 2020
@simonmcl
Copy link
Author

@anonymoussprocket sorry I thought you'd have some given the comment said it wasn't supported. Heres a few:

Example 1: Michelson:

{DROP; PUSH address "tz1abc123"; CONTRACT unit; IF_SOME {PUSH mutez 1000000; UNIT; TRANSFER_TOKENS;} {PUSH string ""; FAILWITH;};}

Example 1: Micheline:

[
        {
            "prim": "DROP"
        },
        {
            "prim": "PUSH",
            "args": [
                {
                    "prim": "address"
                },
                {
                    "string": "tz1abc123"
                }
            ]
        },
        {
            "prim": "CONTRACT",
            "args": [
                {
                    "prim": "unit"
                }
            ]
        },
        [
            {
                "prim": "IF_NONE",
                "args": [
                    [
                        {
                            "prim": "PUSH",
                            "args": [
                                {
                                    "prim": "string"
                                },
                                {
                                    "string": ""
                                }
                            ]
                        },
                        {
                            "prim": "FAILWITH"
                        }
                    ],
                    [
                        {
                            "prim": "PUSH",
                            "args": [
                                {
                                    "prim": "mutez"
                                },
                                {
                                    "int": "1000000"
                                }
                            ]
                        },
                        {
                            "prim": "UNIT"
                        },
                        {
                            "prim": "TRANSFER_TOKENS"
                        }
                    ]
                ]
            }
        ]
    ]

Example 2: Michelson:

{DROP; PUSH address "kt1def123"; CONTRACT %transfer (pair (pair address address) nat); IF_SOME {PUSH mutez 0; PUSH nat 100; PUSH address "tz1abc123"; PUSH address "kt1def123"; PAIR; PAIR; TRANSFER_TOKENS;} {PUSH string ""; FAILWITH;}}

Example 2: Micheline:

[
        {
            "prim": "DROP"
        },
        {
            "prim": "PUSH",
            "args": [
                {
                    "prim": "address"
                },
                {
                    "string": "kt1def123"
                }
            ]
        },
        {
            "prim": "CONTRACT",
            "args": [
                {
                    "prim": "pair",
                    "args": [
                        {
                            "prim": "pair",
                            "args": [
                                {
                                    "prim": "address"
                                },
                                {
                                    "prim": "address"
                                }
                            ]
                        },
                        {
                            "prim": "nat"
                        }
                    ]
                }
            ],
            "annots": [
                "%transfer"
            ]
        },
        [
            {
                "prim": "IF_NONE",
                "args": [
                    [
                        {
                            "prim": "PUSH",
                            "args": [
                                {
                                    "prim": "string"
                                },
                                {
                                    "string": ""
                                }
                            ]
                        },
                        {
                            "prim": "FAILWITH"
                        }
                    ],
                    [
                        {
                            "prim": "PUSH",
                            "args": [
                                {
                                    "prim": "mutez"
                                },
                                {
                                    "int": "0"
                                }
                            ]
                        },
                        {
                            "prim": "PUSH",
                            "args": [
                                {
                                    "prim": "nat"
                                },
                                {
                                    "int": "100"
                                }
                            ]
                        },
                        {
                            "prim": "PUSH",
                            "args": [
                                {
                                    "prim": "address"
                                },
                                {
                                    "string": "tz1abc123"
                                }
                            ]
                        },
                        {
                            "prim": "PUSH",
                            "args": [
                                {
                                    "prim": "address"
                                },
                                {
                                    "string": "kt1def123"
                                }
                            ]
                        },
                        {
                            "prim": "PAIR"
                        },
                        {
                            "prim": "PAIR"
                        },
                        {
                            "prim": "TRANSFER_TOKENS"
                        }
                    ]
                ]
            }
        ]
    ]

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

No branches or pull requests

2 participants