Skip to content

Basic Types

Most basic types feel familiar, but a few details matter immediately when porting code.

  • Solidity supports signed and unsigned integers such as int256 and uint256.
  • Move supports both unsigned and signed integers, such as u8, u16, u32, u64, u128, u256, and i8, i16, i32, i64, i128, i256.
let a: u8 = 255;
let b: u64 = 1_000_000;
let c: u128 = 340282366920938463463374607431768211455;
let d: i64 = -42;
  • Solidity uses address.
  • Move also uses address, but address literals are written with @.
let framework: address = @0x1;
let custom: address = @0x42;
  • Solidity strings are ABI-managed dynamic byte arrays.
  • Move typically uses String from std::string, and collections often use vector<T>.
use std::string::String;
let message: String = string::utf8(b"hello");
let values: vector<u64> = vector[1, 2, 3];

When a Solidity example looks type-similar at first glance, still verify:

  • integer width
  • whether signed integers were used
  • address literal syntax
  • whether a value should be a vector<T>, String, or a custom struct resource