Basic Types
Most basic types feel familiar, but a few details matter immediately when porting code.
Integers
Section titled “Integers”- Solidity supports signed and unsigned integers such as
int256anduint256. - Move supports both unsigned and signed integers, such as
u8,u16,u32,u64,u128,u256, andi8,i16,i32,i64,i128,i256.
let a: u8 = 255;let b: u64 = 1_000_000;let c: u128 = 340282366920938463463374607431768211455;let d: i64 = -42;Addresses
Section titled “Addresses”- Solidity uses
address. - Move also uses
address, but address literals are written with@.
let framework: address = @0x1;let custom: address = @0x42;Strings and vectors
Section titled “Strings and vectors”- Solidity strings are ABI-managed dynamic byte arrays.
- Move typically uses
Stringfromstd::string, and collections often usevector<T>.
use std::string::String;
let message: String = string::utf8(b"hello");let values: vector<u64> = vector[1, 2, 3];Migration takeaway
Section titled “Migration takeaway”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