I have tried this:

entry makeOffer() {
  require {
    r_higherBid: topBid ? transferred > the : false otherwise "your Bid must be higher than current topBid";
  } effect {
    match lastBuyer with
    | some(a) -> const lastBuyerConst = a
    | none -> fail

and this (in the place of the match)

const lastBuyerConst = lastBuyer ? the : fail

and many other less likely solution candidates.

Both return parsing errors and are invalid to the binding generator.

Any help appreciated!

1 Answer 1


short answer is:

const lastBuyerConst ?= lastBuyer : "EXPECTED_SOME_BUYER"

fail is an instruction that takes anything as a parameter, hence it is called fail() or fail("SOMETHING") or fail(("INVALID_AMOUNT", amount)) for examples.

I guess the following should work:

match lastBuyer with
| some(a) -> begin 
    const lastBuyerConst = a;
    // do something with a
    // ...
| none -> fail() // do not forget parenthesis

but the ?= : syntax makes it much lighter:

const a ?= lastBuyer; // : "ERROR_MSG" is optional
// do something with a

More information here:

https://archetype-lang.org/docs/reference/instructions/localvariable#-get-option-assign-or-fail https://archetype-lang.org/docs/reference/instructions/assignment#a--b--e https://archetype-lang.org/docs/reference/instructions/control/#option https://archetype-lang.org/docs/reference/instructions/divergent/#faile--t


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.