Skip to content

Commit

Permalink
Merge branch 'master' into kayagokalp/4679
Browse files Browse the repository at this point in the history
  • Loading branch information
kayagokalp authored Jun 30, 2023
2 parents a0cb7c1 + 0d45b89 commit f3a3d12
Show file tree
Hide file tree
Showing 131 changed files with 1,566 additions and 534 deletions.
471 changes: 243 additions & 228 deletions Cargo.lock

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions docs/book/src/basics/built_in_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ Numbers can be declared with binary syntax, hexadecimal syntax, base-10 syntax,
<!-- This section should explain the default numeric type in Sway -->
<!-- default_num:example:start -->
The default numeric type is `u64`. The FuelVM's word size is 64 bits, and the cases where using a smaller numeric type saves space are minimal.

If a 64-bit arithmetic operation produces an overflow or an underflow,
computation gets reverted automatically by FuelVM.

8/16/32-bit arithmetic operations are emulated using their 64-bit analogues with
additional overflow/underflow checks inserted, which generally results in
somewhat higher gas consumption.
<!-- default_num:example:end -->

## Boolean Type
Expand Down
21 changes: 21 additions & 0 deletions docs/book/src/basics/constants.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,27 @@ Constants are similar to variables; however, there are a few differences:
const ID: u32 = 0;
```

Constant initializer expressions can be quite complex, but they cannot use, for
instance, assembly instructions, storage access, mutable variables, loops and
`return` statements. Although, function calls, primitive types and compound data
structures are perfectly fine to use:

```sway
fn bool_to_num(b: bool) -> u64 {
if b {
1
} else {
0
}
}
fn arr_wrapper(a: u64, b: u64, c: u64) -> [u64; 3] {
[a, b, c]
}
const ARR2 = arr_wrapper(bool_to_num(1) + 42, 2, 3);
```

## Associated Constants

<!-- This section should explain what associated constants are -->
Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/common-collections/storage_map.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Maps with multiple keys can be implemented using tuples as keys. For example:
{{#include ../../../../examples/storage_map/src/main.sw:storage_map_tuple_key}}
```

## Nested Storage Naps
## Nested Storage Maps

It is possible to nest storage maps as follows:

Expand Down
101 changes: 46 additions & 55 deletions docs/reference/src/code/Forc.lock
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
[[package]]
name = 'annotation_style'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'annotations'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'arrays'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'assertions'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'asset_operations'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'associated-consts'
Expand All @@ -30,30 +30,30 @@ source = 'member'
[[package]]
name = 'booleans'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'bytes'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'call'
source = 'member'
dependencies = [
'contract_interface',
'std path+from-root-0F28276288D2432C',
'std',
]

[[package]]
name = 'call_data'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'comments'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'constants'
Expand All @@ -62,198 +62,189 @@ source = 'member'
[[package]]
name = 'contract_interface'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'control_flow'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'core'
source = 'path+from-root-0F28276288D2432C'

[[package]]
name = 'core'
source = 'path+from-root-D62A8C57DD8D2801'

[[package]]
name = 'counter'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'empty_storage_init'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'enum-advanced'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'enum_style'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'enums'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'fizzbuzz'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'functions'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'hashing'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'interface'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'letter_casing'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'logging'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'my_lib'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'my_library'
source = 'member'
dependencies = [
'my_other_library',
'std path+from-root-0F28276288D2432C',
'std',
]

[[package]]
name = 'my_other_library'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'namespace'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'numerics'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'ownership'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'pattern_matching'
source = 'member'
dependencies = ['std git+https://github.com/fuellabs/sway?tag=v0.40.1#48104d0bde0d343154a5bc39a310092532883235']
dependencies = ['std']

[[package]]
name = 'reading_writing_to_storage'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'simple_predicate'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'simple_script'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']

[[package]]
name = 'std'
source = 'git+https://github.com/fuellabs/sway?tag=v0.40.1#48104d0bde0d343154a5bc39a310092532883235'
dependencies = ['core path+from-root-D62A8C57DD8D2801']
dependencies = ['std']

[[package]]
name = 'std'
source = 'path+from-root-0F28276288D2432C'
dependencies = ['core path+from-root-0F28276288D2432C']
dependencies = ['core']

[[package]]
name = 'storage_init'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'storage_map'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'storage_vec'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'store_get'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'string_issue'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'strings'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'struct_shorthand'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'structs'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'tuples'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'variables'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']

[[package]]
name = 'wallet'
source = 'member'
dependencies = [
'interface',
'std path+from-root-0F28276288D2432C',
'std',
]

[[package]]
name = 'wallet_example'
source = 'member'
dependencies = ['std path+from-root-0F28276288D2432C']
dependencies = ['std']
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ license = "Apache-2.0"
name = "pattern_matching"

[dependencies]
std = { path = "../../../../../../../sway-lib-std" }
16 changes: 8 additions & 8 deletions forc-pkg/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "forc-pkg"
version = "0.40.1"
version = "0.41.0"
description = "Building, locking, fetching and updating Sway projects as Forc packages."
authors.workspace = true
edition.workspace = true
Expand All @@ -13,11 +13,11 @@ ansi_term = "0.12"
anyhow = "1"
cid = "0.10"
fd-lock = "3.0"
forc-tracing = { version = "0.40.1", path = "../forc-tracing" }
forc-util = { version = "0.40.1", path = "../forc-util" }
forc-tracing = { version = "0.41.0", path = "../forc-tracing" }
forc-util = { version = "0.41.0", path = "../forc-util" }
fuel-abi-types = "0.1"
futures = "0.3"
git2 = { version = "0.16.1", features = ["vendored-libgit2", "vendored-openssl"] }
git2 = { version = "0.17.2", features = ["vendored-libgit2", "vendored-openssl"] }
gix-url = { version = "0.16.0", features = ["serde1"] }
hex = "0.4.3"
ipfs-api-backend-hyper = { version = "0.6", features = ["with-builder"] }
Expand All @@ -27,10 +27,10 @@ semver = { version = "1.0", features = ["serde"] }
serde = { version = "1.0", features = ["derive"] }
serde_ignored = "0.1"
serde_json = "1.0"
sway-core = { version = "0.40.1", path = "../sway-core" }
sway-error = { version = "0.40.1", path = "../sway-error" }
sway-types = { version = "0.40.1", path = "../sway-types" }
sway-utils = { version = "0.40.1", path = "../sway-utils" }
sway-core = { version = "0.41.0", path = "../sway-core" }
sway-error = { version = "0.41.0", path = "../sway-error" }
sway-types = { version = "0.41.0", path = "../sway-types" }
sway-utils = { version = "0.41.0", path = "../sway-utils" }
sysinfo = "0.29.0"
tar = "0.4.38"
toml = "0.5"
Expand Down
Loading

0 comments on commit f3a3d12

Please sign in to comment.