I am looking for a reliable way to calculate a percentage. A simple example would be 100 mutez, 3% of this would be 3 mutez.

Ideally I can get a percentage from tez/mutez etc.

This would be used for taking a fee for example. The intention would be to set a variable like fee and then calculate the fee from the available contract balance or balance associated with an address.

Finally taking the set percentage, sending the fee to a fee wallet and the remainder to the user address.

So far attempts using sp.ediv and àbs all results in floats which causes the following error

Error: Expression cannot be a float. Got '3.0'

In the initial example 97 mutez would be sent to the user and 3 mutez to the fee wallet.

1 Answer 1


You can use sp.split_tokens(<your_amount>, <your_pourcentage>, 100)


  • sp.split_tokens(sp.tez(100), 3, 100) results in sp.tez(3).
  • sp.split_tokens(sp.tez(200), 3, 100) results in sp.tez(6).

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.