Skip to main content

Cheat Sheets

Metadata​

metadata metadataString = "myValue"
metadata metadataObject = {
id: "myID"
}

Use Statements​

use other-namespace#OtherShape

Shapes​

Simple Shapes​

address myAddress
TypeExample SyntaxDescription
addressaddress myAddressEthereum wallet addresses.
blobblob myBlobUninterpreted binary data.
booleanboolean myBooleanTrue or false values.
bytebyte myByteAn 8-bit unsigned integer.
bytesbytes myBytesSequence of bytes.
documentdocument myDocumentArbitrary JSON-like data structures.
doubledouble myDoubleDouble-precision floating point number.
floatfloat myFloatSingle-precision floating point number.
intint myInt32-bit signed integer.
int8int8 myInt88-bit signed integer.
int16int16 myInt1616-bit signed integer.
int32int32 myInt3232-bit signed integer.
int64int64 myInt6464-bit signed integer.
int128int128 myInt128128-bit signed integer.
int256int256 myInt256256-bit signed integer.
nonenone myNoneAbsence of a value.
stringstring myStringUTF-8 encoded text data.
timestamptimestamp myTimestampAn instant in time.
uintuint myUint32-bit unsigned integer.
uint8uint8 myUint88-bit unsigned integer.
uint16uint16 myUint1616-bit unsigned integer.
uint32uint32 myUint3232-bit unsigned integer.
uint64uint64 myUint6464-bit unsigned integer.
uint128uint128 myUint128128-bit unsigned integer.
uint256uint256 myUint256256-bit unsigned integer.

Aggregate Shapes​

enum Suit {
DIAMOND,
CLUB,
HEART,
SPADE
}

list myList : uint

map myMap {
key : string,
value : int
}

Subject Shapes​

subject MySubject {
state : {
balance : map(address, uint)
},
behaviors : [transfer, mint],
events : [Transfer, Mint]
}

Traits​

@myTrait(value = "example")

Values​

Strings​

'value'
"value"

Numbers​

123
-456
3.14

Lists​

[1, 2, 3]

Objects​

{
key: "value",
anotherKey: 123
}

Key Concepts​

Shape ID​

namespace#MyShape

Trait​

@myTrait(value = "example")

Shape Members​

member myMember : uint = 42