is "if (Tezos.amount>Tezos.balance) then" wrong? Oddly, the condition is failwith when i sent more tez compared to the contract balance

1 Answer 1


Yes, it is wrong.

At that point, the amount has already been credited to the contract balance. Meaning that the balance will never be less than the amount.

enter image description here

  • Wow! what a cool interface. What do you use? And also how do I compare the amount of tez and the contract balance then?
    – Darkshade
    Apr 30 at 10:22
  • The animation above uses visualtez.com with a testing feature coming in May. Looking at what you have above, you probably want something like Tezos.amount > (Option.unopt (Tezos.balance - Tezos.amount)). May 1 at 22:16

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.