7

When I call the CONTRACT opcode in Michelson, say I have a command like:

CONTRACT int;

Does the contract I'm calling this on have to have int as a param or could it be something like:

parameter Or(Or(string, bool), Or((pair nat int), int));
4

It does need to be exactly an int.

Something close to what you describe is probably how multiple entry points for contracts would be supported, though there would be an additional tag to indicate the position of the type in the disjunction.

The technique is known as "sum-type polymorphism".

  • 1
    great, so this is a feature in the works? – Rob Jan 31 '19 at 17:20
  • 1
    I haven't heard of anyone working on this, but it's a fun project for an amendment – Arthur B Feb 1 '19 at 0:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.