Skip to main content
Version: 1.5.0

Simple Types

LIGO is strongly and statically typed. This means that the compiler checks how your contract processes data, ensuring that each function's expectations are met. If it passes the test, your contract will not fail at run-time due to some inconsistent assumptions on your data. This is called type checking.

LIGO types are built on top of Michelson's type system.

Built-in types

For quick reference, you can find all the built-in types here.

Type aliases

Type aliasing consists of renaming a given type when the context calls for a more precise name. This increases readability and maintainability of your smart contracts. For example we can choose to alias a string type as an animal breed - this will allow us to communicate our intent with added clarity.

type breed = string;
const dog_breed: breed = "Saluki";

The above type definitions are aliases, which means that breed and string are interchangeable in all contexts.

Simple types

// The type account_balances denotes maps from addresses to tez
type account_balances = map<address, tez>;
const ledger: account_balances =
Map.literal
(list([["tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" as address, 10mutez]]));