Last active
July 15, 2025 06:21
-
-
Save juzybits/af9b75f598c839e300ac433aa00f5dda to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sui Move instructions (.move files): | |
- Sui is an object-oriented blockchain. Sui smart contracts are written in the Move language. | |
- Sui's object ownership model guarantees that the sender of a transaction has permission to use the objects it passes to functions as arguments. | |
- Sui object ownership model in a nutshell: | |
- Single owner objects: owned by a single address - granting it exclusive control over the object. | |
- Shared objects: any address can use them in transactions and pass them to functions. | |
- Immutable objects: like Shared objects, any address can use them, but they are read-only. | |
- Abilities are a Move typing feature that control what actions are permissible on a struct: | |
- `key`: the struct can be used as a key in storage. If an struct does not have the key ability, it has to be stored under another struct or destroyed before the end of the transaction. | |
- `store`: the struct can be stored inside other structs. It also relaxes transfer restrictions. | |
- `drop`: the struct can be dropped or discarded. Simply allowing the object to go out of scope will destroy it. | |
- `copy`: the struct can be copied. | |
- Structs can only be created within the module that defines them. A module exposes functions to determine how its structs can be created, read, modified and destroyed. | |
- Similarly, the `transfer::transfer/share/freeze/receive/party_transfer` functions can only be called within the module that defines the struct being transferred. However, if the struct has the `store` ability, the `transfer::public_transfer/public_share/etc` functions can be called on that object from other modules. | |
- All numbers are unsigned integers (u8, u16, u32, u64, u128, u256). | |
- Functions calls are all or nothing (atomic). If there's an error, the transaction is reverted. | |
- Race conditions are impossible. | |
- It is allowed to compare a reference to a value using == or !=. The language automatically borrows the value if one operand is a reference and the other is not. | |
- Integer overflows/underflows are automatically reverted. Any transaction that causes an integer overflow/underflow cannot succeed. E.g. `std::u64::max_value!() + 1` raises an arithmetic error. | |
- Don't worry about "missing imports", because the compiler includes many std::/sui:: imports by default. | |
- Don't worry about emitting additional events. | |
- Prefer macros over constants. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment