# Mutez

The type of amounts in SmartPy is sp.TMutez.

The corresponding type in Michelson is Michelson mutez.

## Literalsโ

`sp.tez(<natural number>)`, `sp.mutez(<natural number>)`
Introduce a mutez.

#### Exampleโ

``# Two identical amounts (one tez):sp.tez(1)sp.mutez(1000000)``

## Global propertiesโ

### Get transferred amountโ

`sp.amount`
The amount of the current transaction, which is of type sp.TMutez.

#### Exampleโ

``amount = sp.amount``
Michelson AMOUNT

### Get contract balanceโ

`sp.balance`
The balance of the current contract.
Due to the not intuitive semantics in Michelson, we suggest that developers do not rely on balance too much.

See Tezos Agora Post.
In tests, a contract's balance is accessible through the `<contract>.balance` field.

#### Exampleโ

``balance = sp.balance``
Michelson BALANCE

## Operationsโ

`expr1 + expr2`
Add two values of type sp.TMutez, `expr1` and `expr2`.

#### Exampleโ

``result = sp.mutez(10) + sp.tez(1) # 1000010 of type sp.TMutez``

### Subtractionโ

`expr1 - expr2`
Subtract two values of type sp.TMutez, `expr1` and `expr2`.

#### Exampleโ

``result = sp.mutez(20) - sp.mutez(10) # 10 of type sp.TMutez``
Michelson SUB

### Multiplicationโ

`sp.mul(<expr1>, <expr2>)`
Multiply a sp.TMutez with a sp.TNat and produce a sp.TMutez.

#### Exampleโ

``value = sp.mul(sp.nat(2), sp.mutez(2)) # 4 of type sp.TMutez``

### Divisionโ

`sp.ediv(expr1, expr2)`
Perform euclidean division, where `expr1` is the dividend, and `expr2` is the divisor.

#### Exampleโ

``(quotient, remainder) = sp.ediv(sp.tez(11), sp.tez(2)).open_some()``
Michelson EDIV

### Split tokensโ

`sp.split_tokens(amount, quantity, totalQuantity)`
Compute `amount * quantity / totalQuantity` where `amount` is of type sp.TMutez, `quantity` and `totalQuantity` are of type sp.TNat.

#### Exampleโ

``sp.split_tokens(sp.mutez(100), 1, 10) # 10 mutez``