Skip to content

Commit

Permalink
[move-book] Extending Book by Move 2.0 Documentation
Browse files Browse the repository at this point in the history
Adds documentation derived from our internal preparation documents. Also adds an overview page for Move 2 which links to other sections in the book.
  • Loading branch information
wrwg committed Aug 28, 2024
1 parent 945e322 commit 2f321fc
Show file tree
Hide file tree
Showing 10 changed files with 571 additions and 112 deletions.
5 changes: 5 additions & 0 deletions apps/nextra/pages/en/build/smart-contracts/book/SUMMARY.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
- [Modules and Scripts](modules-and-scripts.mdx)
- [Move Tutorial](move-tutorial.mdx)

## Language Release Notes

- [Move 2.0](move-2.0.mdx)

## Primitive Types

- [Integers](integers.mdx)
Expand All @@ -24,6 +28,7 @@
- [While, For, and Loop](loops.mdx)
- [Functions](functions.mdx)
- [Structs and Resources](structs-and-resources.mdx)
- [Enum Types](enums.mdx)
- [Constants](constants.mdx)
- [Generics](generics.mdx)
- [Type Abilities](abilities.mdx)
Expand Down
220 changes: 113 additions & 107 deletions apps/nextra/pages/en/build/smart-contracts/book/_meta.tsx
Original file line number Diff line number Diff line change
@@ -1,109 +1,115 @@
export default {
SUMMARY: {
title: "Summary",
},
"---getting-started---": {
type: "separator",
title: "Getting Started",
},
"modules-and-scripts": {
title: "Modules and Scripts",
},
"move-tutorial": {
title: "Move Tutorial",
},
"---primitive-types---": {
type: "separator",
title: "Primitive Types",
},
integers: {
title: "Integers",
},
bool: {
title: "Bool",
},
address: {
title: "Address",
},
vector: {
title: "Vector",
},
signer: {
title: "Signer",
},
references: {
title: "References",
},
tuples: {
title: "Tuples and Unit",
},
"---basic-concepts---": {
type: "separator",
title: "Basic Concepts",
},
variables: {
title: "Local Variables and Scopes",
},
equality: {
title: "Equality",
},
"abort-and-assert": {
title: "Abort and Assert",
},
conditionals: {
title: "Conditionals",
},
loops: {
title: "While, For, and Loop",
},
functions: {
title: "Functions",
},
"structs-and-resources": {
title: "Structs and Resources",
},
constants: {
title: "Constants",
},
generics: {
title: "Generics",
},
abilities: {
title: "Type abilities",
},
uses: {
title: "Uses and Aliases",
},
friends: {
title: "Friends",
},
packages: {
title: "Packages",
},
"package-upgrades": {
title: "Package Upgrades",
},
"unit-testing": {
title: "Unit Tests",
},
"---global-storage---": {
type: "separator",
title: "Global Storage",
},
"global-storage-structure": {
title: "Global Storage Structure",
},
"global-storage-operators": {
title: "Global Storage Operators",
},
"---reference---": {
type: "separator",
title: "Reference",
},
"standard-library": {
title: "Standard Library",
},
"coding-conventions": {
title: "Coding Conventions",
},
SUMMARY: {
title: "Summary",
},
"---getting-started---": {
type: "separator",
title: "Getting Started",
},
"modules-and-scripts": {
title: "Modules and Scripts",
},
"move-tutorial": {
title: "Move Tutorial",
},
"---primitive-types---": {
type: "separator",
title: "Primitive Types",
},
integers: {
title: "Integers",
},
bool: {
title: "Bool",
},
address: {
title: "Address",
},
vector: {
title: "Vector",
},
signer: {
title: "Signer",
},
references: {
title: "References",
},
tuples: {
title: "Tuples and Unit",
},
"---basic-concepts---": {
type: "separator",
title: "Basic Concepts",
},
variables: {
title: "Local Variables and Scopes",
},
equality: {
title: "Equality",
},
"abort-and-assert": {
title: "Abort and Assert",
},
conditionals: {
title: "Conditionals",
},
loops: {
title: "While, For, and Loop",
},
functions: {
title: "Functions",
},
"structs-and-resources": {
title: "Structs and Resources",
},
"enums": {
title: "Enum Types",
},
constants: {
title: "Constants",
},
generics: {
title: "Generics",
},
abilities: {
title: "Type abilities",
},
uses: {
title: "Uses and Aliases",
},
friends: {
title: "Friends",
},
packages: {
title: "Packages",
},
"package-upgrades": {
title: "Package Upgrades",
},
"unit-testing": {
title: "Unit Tests",
},
"---global-storage---": {
type: "separator",
title: "Global Storage",
},
"global-storage-structure": {
title: "Global Storage Structure",
},
"global-storage-operators": {
title: "Global Storage Operators",
},
"---reference---": {
type: "separator",
title: "Reference",
},
"move-2.0": {
title: "Move 2.0 Release Notes",
},
"standard-library": {
title: "Standard Library",
},
"coding-conventions": {
title: "Coding Conventions",
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ condition of type `bool` and a code of type `u64`

```move
assert!(condition: bool, code: u64)
assert!(condition: bool) // Since Move 2.0
```

Since the operation is a macro, it must be invoked with the `!`. This is to convey that the
Expand All @@ -74,6 +75,9 @@ does not exist at the bytecode level. It is replaced inside the compiler with
if (condition) () else abort code
```

Since Move 2.0, `assert` without an error code is supported. If this assert is used, the
abort code `0xD8CA26CBD9BE00000000` is generated.

`assert` is more commonly used than just `abort` by itself. The `abort` examples above can be
rewritten using `assert`

Expand Down
Loading

0 comments on commit 2f321fc

Please sign in to comment.