The following contract (Hic Et Nunc Marketplace V1) contains the deprecated instruction SUB on type mutez:


I want to deploy this contract out of curiosity.

How do I patch it properly so that I can deploy the contract to e.g. Ghostnet? Although I attempted replacing the deprecated instructions with SUB_MUTEZ, I still haven't been able to deploy the contract. This boils down to me not fully understanding which SUB instructions are the ones that need to be replaced.

1 Answer 1


SUB_MUTEZ is resulting in OPTION MUTEZ, which has to be consumed.

Thus, you have to replace the corresponding SUB with:

IF_NONE { FAIL } {};

For your specific contract you have to replace the SUB at line 821, since this is the instruction which tries to subtract MUTEZ values.

  • Thank you. I thought so, yet after replacing said instruction, I'm confronted with another error: ``` At line 496 characters 26 to 41, wrong stack type for instruction TRANSFER_TOKENS: [] ``` Checking further via: ``` octez-client typecheck script test.tz -v At line 4583 characters 26 to 41, wrong stack type for instruction TRANSFER_TOKENS: []. Fatal error: ill-typed script ``` Oct 13, 2023 at 6:10
  • It works for me and the above linked contract. Sry, cant' help. Or you have to post more information (your changed contract, versions, etc.).
    – ghast
    Oct 13, 2023 at 6:38
  • At first attempt I didn't realize that I need to replace the corresponding instruction with both lines you posted, which I now did. Cheers! Followup question, how can I (automatically, like in a script) detect which SUB instructions must be replaced? Oct 13, 2023 at 7:09
  • Can't see a nice solution for this. However, you could try: 1) Run octez-client with flag -v (like you already did). 2) Identify the place where there are no more any comments for the instructions. 3) Replace the SUB with the replacement code. Redo the steps above.
    – ghast
    Oct 13, 2023 at 7:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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