1

I am trying to execute this line sp.amount == sp.utils.nat_to_mutez(x) * self.data.y where x is the parameter of an entry point function. These are the following types:

sp.amount: sp.TMutez,

x: sp.TNat

y: sp.TMutez.

Even using the sp.utils.nat_to_mutez(x), I still get the following error:

Error: Type Error (sp.mul(params, sp.mutez(1)) : sp.TMutez), (self.data.y : sp.TMutez) cannot be multiplied (sp.mul(params, sp.mutez(1)) * self.data.y : sp.TMutez) (__main__, line 87)

0

It is not possible to multiply mutez by mutez directly. Doc

⊢ MUL :: mutez : nat : A ⇒ mutez

⊢ MUL :: nat : mutez : A ⇒ mutez

You can do sp.amount == sp.mul(x, self.data.y), which uses the overloaded multiplication (between 2 values of different types)

Where: sp.amount: sp.TMutez, x: sp.TNat, y: sp.TMutez

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.