Skip to content

Commit

Permalink
Release v0.24.0 (#295)
Browse files Browse the repository at this point in the history
## Type of change

<!--Delete points that do not apply-->

- Release

## [Version 0.24.0]

### Added v0.24.0

- [#293](#293) Adds the
`BytecodeRoot` and `ContractConfigurables` types to the Bytecode
Library.
- [#286](#286) Adds the
`_metadata()` function to the Asset Library.

### Changed v0.24.0

- [#286](#286) Updates the
repository to Sway-Standards v0.6.0 and implements the new SRC-20 and
SRC-7 logging specifications.
- [#286](#286)
`_set_metadata()`, `_set_name()` and `_set_symbol()` now revert if the
metadata is an empty string.
- [#286](#286)
`_set_metadata()` now reverts if the metadata is empty bytes.
- [#286](#286) `_mint()` and
`_burn()` now revert if the `amount` argument is zero.
- [#289](#289) Bumps Sway-Libs
to forc `v0.63.3`, fuel-core `v0.34.0`, and fuels `v0.66.2`.
- [#290](#290) Update the
Upgradeability library to use a specific storage slot for owner
functionality.
- [#291](#291) Prepares for
the `v0.24.0` release.

### Breaking v0.24.0

- [#290](#290) The
`_proxy_owner()`, `only_proxy_owner()` and `_set_proxy_owner()`
functions no longer take `storage.proxy_owner` as a parameter. Instead
they directly read and write to the storage slot
`0xbb79927b15d9259ea316f2ecb2297d6cc8851888a98278c0a2e03e1a091ea754`
which is `sha256("storage_SRC14_1")`.

Before:

```sway
fn foo() {
    let stored_proxy_owner = _proxy_owner(storage.proxy_owner);
    only_proxy_owner(storage.proxy_owner);
    _set_proxy_owner(new_proxy_owner, storage.proxy_owner);
}
```

After:

```sway
fn foo() {
    let stored_proxy_owner = _proxy_owner();
    only_proxy_owner();
    _set_proxy_owner(new_proxy_owner);
}
```

---------

Signed-off-by: withbest <[email protected]>
Co-authored-by: K1-R1 <[email protected]>
Co-authored-by: SwayStar123 <[email protected]>
Co-authored-by: withbest <[email protected]>
  • Loading branch information
4 people authored Sep 2, 2024
1 parent 9987d8a commit e19f96f
Show file tree
Hide file tree
Showing 73 changed files with 2,117 additions and 737 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ concurrency:
env:
CARGO_TERM_COLOR: always
REGISTRY: ghcr.io
RUST_VERSION: 1.77.0
FORC_VERSION: 0.60.0
CORE_VERSION: 0.26.0
RUST_VERSION: 1.80.1
FORC_VERSION: 0.63.3
CORE_VERSION: 0.34.0

jobs:
build-sway-lib:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ on:
- v*

env:
RUST_VERSION: 1.77.0
FORC_VERSION: 0.60.0
CORE_VERSION: 0.26.0
RUST_VERSION: 1.80.1
FORC_VERSION: 0.63.3
CORE_VERSION: 0.34.0

jobs:
deploy-contributing:
Expand Down
92 changes: 88 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,107 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [v0.23.0]
## [Unreleased]

Description of the upcoming release here.

### Added

- Something new here 1
- Something new here 2

### Changed

- Something changed here 1
- Something changed here 2

### Fixed

- Some fix here 1
- Some fix here 2

#### Breaking

- Some breaking change here 1
- Some breaking change here 2

## [Version 0.24.0]

### Added v0.24.0

- [#293](https://github.com/FuelLabs/sway-libs/pull/293) Adds the `BytecodeRoot` and `ContractConfigurables` types to the Bytecode Library.
- [#286](https://github.com/FuelLabs/sway-libs/pull/286) Adds the `_metadata()` function to the Asset Library.

### Changed v0.24.0

- [#286](https://github.com/FuelLabs/sway-libs/pull/286) Updates the repository to Sway-Standards v0.6.0 and implements the new SRC-20 and SRC-7 logging specifications.
- [#286](https://github.com/FuelLabs/sway-libs/pull/286) `_set_metadata()`, `_set_name()` and `_set_symbol()` now revert if the metadata is an empty string.
- [#286](https://github.com/FuelLabs/sway-libs/pull/286) `_set_metadata()` now reverts if the metadata is empty bytes.
- [#286](https://github.com/FuelLabs/sway-libs/pull/286) `_mint()` and `_burn()` now revert if the `amount` argument is zero.
- [#289](https://github.com/FuelLabs/sway-libs/pull/289) Bumps Sway-Libs to forc `v0.63.3`, fuel-core `v0.34.0`, and fuels `v0.66.2`.
- [#290](https://github.com/FuelLabs/sway-libs/pull/290) Update the Upgradeability library to use a specific storage slot for owner functionality.
- [#291](https://github.com/FuelLabs/sway-libs/pull/291) Prepares for the `v0.24.0` release.

### Breaking v0.24.0

- [#290](https://github.com/FuelLabs/sway-libs/pull/290) The `_proxy_owner()`, `only_proxy_owner()` and `_set_proxy_owner()` functions no longer take `storage.proxy_owner` as a parameter. Instead they directly read and write to the storage slot `0xbb79927b15d9259ea316f2ecb2297d6cc8851888a98278c0a2e03e1a091ea754` which is `sha256("storage_SRC14_1")`.

Before:

```sway
fn foo() {
let stored_proxy_owner = _proxy_owner(storage.proxy_owner);
only_proxy_owner(storage.proxy_owner);
_set_proxy_owner(new_proxy_owner, storage.proxy_owner);
}
```

After:

```sway
fn foo() {
let stored_proxy_owner = _proxy_owner();
only_proxy_owner();
_set_proxy_owner(new_proxy_owner);
}
```

## [Version 0.23.1]

### Added v0.23.1

- None

### Changed v0.23.1

- [#281](https://github.com/FuelLabs/sway-libs/pull/281) Prepares for `v0.23.1` release.
- [#281](https://github.com/FuelLabs/sway-libs/pull/281) Updates repository to use sway-standards `v0.5.2`.

### Fixed v0.23.1

- None

### Breaking v0.23.1

- None

## [Version 0.23.0]

### Added v0.23.0

- [#259](https://github.com/FuelLabs/sway-libs/pull/259) Adds a new upgradability library, including associated tests and documentation.
- [#265](https://github.com/FuelLabs/sway-libs/pull/265) Adds the `SetMetadataEvent` and emits `SetMetadataEvent` when the `_set_metadata()` function is called.
- [#270](https://github.com/FuelLabs/sway-libs/pull/270) Adds `OrdEq` functionality to Signed Integers.
- [#272](https://github.com/FuelLabs/sway-libs/pull/272) Adds the `TryFrom` implementation from signed integers to unsigned integers.

### Changed
### Changed v0.23.0

- [#265](https://github.com/FuelLabs/sway-libs/pull/265) Enables the metadata events now that the Rust SDK supports wrapped heap types.
- [#269](https://github.com/FuelLabs/sway-libs/pull/269) Hashes the string "admin" and with the bits of an Identity when creating a storage slot to storage an admin in the Admin Library.
- [#276](https://github.com/FuelLabs/sway-libs/pull/276) Prepares for v0.23.0 release.
- [#278](https://github.com/FuelLabs/sway-libs/pull/278) Deprecates the Fixed Point number library.

### Fixed
### Fixed v0.23.0

- [#258](https://github.com/FuelLabs/sway-libs/pull/258) Fixes incorrect instructions on how to run tests in README and docs hub.
- [#262](https://github.com/FuelLabs/sway-libs/pull/262) Fixes incorrect ordering comparison for IFP64, IFP128 and IFP256.
Expand All @@ -33,7 +117,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- [#274](https://github.com/FuelLabs/sway-libs/pull/274) Fixes the `swap_configurables()` function to correctly handle the case where the bytecode is too large to fit in the buffer.
- [#275](https://github.com/FuelLabs/sway-libs/pull/275) Fixes an infinite loop in the Bytecode root library's `_compute_bytecode_root()` function.

#### Breaking
### Breaking v0.23.0

- [#263](https://github.com/FuelLabs/sway-libs/pull/263) Removes the `TwosComplement` trait in favor of `WrappingNeg`.

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[package]
name = "sway-libs"
version = "0.23.0"
version = "0.24.0"
edition = "2021"
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<a href="https://github.com/FuelLabs/sway-libs/actions/workflows/ci.yml" alt="CI">
<img src="https://github.com/FuelLabs/sway-libs/actions/workflows/ci.yml/badge.svg" />
</a>
<a href="https://crates.io/crates/forc/0.60.0" alt="forc">
<img src="https://img.shields.io/badge/forc-v0.60.0-orange" />
<a href="https://crates.io/crates/forc/0.63.3" alt="forc">
<img src="https://img.shields.io/badge/forc-v0.63.3-orange" />
</a>
<a href="./LICENSE" alt="forc">
<img src="https://img.shields.io/github/license/FuelLabs/sway-libs" />
Expand Down Expand Up @@ -75,7 +75,7 @@ For implementation details on the libraries please see the [Sway Libs Docs](http
To import a library, the following dependency should be added to the project's `Forc.toml` file under `[dependencies]`.

```rust
sway_libs = { git = "https://github.com/FuelLabs/sway-libs", tag = "v0.23.0" }
sway_libs = { git = "https://github.com/FuelLabs/sway-libs", tag = "v0.24.0" }
```

> **NOTE:**
Expand All @@ -97,7 +97,7 @@ For more information about implementation please refer to the [Sway Libs Docs Hu

## Running Tests

There are two sets of tests that should be run: inline tests and sdk-harness tests. Please make sure you are using `forc v0.60.0` and `fuel-core v0.26.0`. You can check what version you are using by running the `fuelup show` command.
There are two sets of tests that should be run: inline tests and sdk-harness tests. Please make sure you are using `forc v0.63.3` and `fuel-core v0.34.0`. You can check what version you are using by running the `fuelup show` command.

Make sure you are in the source directory of this repository `sway-libs/<you are here>`.

Expand All @@ -119,7 +119,7 @@ forc test --path tests --release --locked && cargo test --manifest-path tests/Ca
Any instructions related to using a specific library should be found within the README.md of that library.

> **NOTE:**
> All projects currently use `forc v0.60.0`, `fuels-rs v0.62.0` and `fuel-core v0.26.0`.
> All projects currently use `forc v0.63.3`, `fuels-rs v0.66.2` and `fuel-core v0.34.0`.
## Contributing

Expand Down
2 changes: 2 additions & 0 deletions docs/book/src/asset/base.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ To use the Asset Library's base functionly, simply pass the `StorageKey` from th

To set some the asset attributes for an Asset, use the `SetAssetAttributes` ABI provided by the Asset Library. The example below shows the implementation of the `SetAssetAttributes` ABI with no user defined restrictions or custom functionality. It is recommended that the [Ownership Library](../ownership/index.md) is used in conjunction with the `SetAssetAttributes` ABI to ensure only a single user has permissions to set an Asset's attributes.

The `_set_name()`, `_set_symbol()`, and `_set_decimals()` functions follows the SRC-20 standard for logging and will emit their respective log when called.

```sway
{{#include ../../../../examples/asset/setting_src20_attributes/src/main.sw:setting_src20_attributes}}
```
Expand Down
6 changes: 4 additions & 2 deletions docs/book/src/asset/metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ Once imported, the Asset Library's metadata functionality should be available. T

### Setting Metadata

To set some metadata for an Asset, use the `SetAssetMetadata` ABI provided by the Asset Library. Be sure to follow the [SRC-9](https://docs.fuel.network/docs/sway-standards/src-9-metadata-keys/) standard for your `key`. It is recommended that the [Ownership Library](../ownership/index.md) is used in conjunction with the `SetAssetMetadata` ABI to ensure only a single user has permissions to set an Asset's metadata.
To set some metadata for an Asset, use the `SetAssetMetadata` ABI provided by the Asset Library with the `_set_metadata()` function. Be sure to follow the [SRC-9](https://docs.fuel.network/docs/sway-standards/src-9-metadata-keys/) standard for your `key`. It is recommended that the [Ownership Library](../ownership/index.md) is used in conjunction with the `SetAssetMetadata` ABI to ensure only a single user has permissions to set an Asset's metadata.

The `_set_metadata()` function follows the SRC-7 standard for logging and will emit the `SetMetadataEvent` when called.

```sway
{{#include ../../../../examples/asset/setting_src7_attributes/src/main.sw:setting_src7_attributes}}
Expand Down Expand Up @@ -111,5 +113,5 @@ The `is_string()` check enables checking whether the `Metadata` type is a `Strin
The `as_string()` returns the `String` of the `Metadata` type.

```sway
{{#include ../../../../examples/asset/metadata_docs/src/main.sw:as_string}}
{{#include ../../../../examples/asset/basic_src7/src/main.sw:src7_metadata_convenience_function}}
```
4 changes: 3 additions & 1 deletion docs/book/src/asset/supply.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ Once imported, the Asset Library's supply functionality should be available. To

## Implementing the SRC-3 Standard with the Asset Library

To use a base function, simply pass the `StorageKey` from the prescribed storage block. The example below shows the implementation of the [SRC-3](https://docs.fuel.network/docs/sway-standards/src-3-minting-and-burning/) standard in combination with the Asset Library with no user defined restrictions or custom functionality. It is recommended that the [Ownership Library](../ownership/index.md) is used in conjunction with the Asset Library;s supply functionality to ensure only a single user has permissions to mint an Asset.
To use either function, simply pass the `StorageKey` from the prescribed storage block. The example below shows the implementation of the [SRC-3](https://docs.fuel.network/docs/sway-standards/src-3-minting-and-burning/) standard in combination with the Asset Library with no user defined restrictions or custom functionality. It is recommended that the [Ownership Library](../ownership/index.md) is used in conjunction with the Asset Library;s supply functionality to ensure only a single user has permissions to mint an Asset.

The `_mint()` and `_burn()` functions follows the SRC-20 standard for logging and will emit the `TotalSupplyEvent` when called.

```sway
{{#include ../../../../examples/asset/basic_src3/src/main.sw:basic_src3}}
Expand Down
6 changes: 3 additions & 3 deletions docs/book/src/getting_started/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
To import any library, the following dependency should be added to the project's `Forc.toml` file under `[dependencies]`.

```sway
sway_libs = { git = "https://github.com/FuelLabs/sway-libs", tag = "v0.23.0" }
sway_libs = { git = "https://github.com/FuelLabs/sway-libs", tag = "v0.24.0" }
```

For reference, here is a complete `Forc.toml` file:
Expand All @@ -18,7 +18,7 @@ license = "Apache-2.0"
name = "MyProject"
[dependencies]
sway_libs = { git = "https://github.com/FuelLabs/sway-libs", tag = "v0.23.0" }
sway_libs = { git = "https://github.com/FuelLabs/sway-libs", tag = "v0.24.0" }
```

> **NOTE:** Be sure to set the tag to the latest release.
Expand All @@ -38,7 +38,7 @@ use sway_libs::ownership::only_owner;
```

> **NOTE:**
> All projects currently use `forc v0.60.0`, `fuels-rs v0.62.0` and `fuel-core 0.26.0`.
> All projects currently use `forc 0.63.3`, `fuels-rs v0.66.2` and `fuel-core 0.34.0`.
## Using Sway Libs

Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/getting_started/running_tests.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Running Tests

There are two sets of tests that should be run: inline tests and sdk-harness tests. Please make sure you are using `forc v0.60.0` and `fuel-core v0.26.0`. You can check what version you are using by running the `fuelup show` command.
There are two sets of tests that should be run: inline tests and sdk-harness tests. Please make sure you are using `forc v0.63.3` and `fuel-core v0.34.0`. You can check what version you are using by running the `fuelup show` command.

Make sure you are in the source directory of this repository `sway-libs/<you are here>`.

Expand Down
6 changes: 3 additions & 3 deletions docs/contributing-book/src/code_docs/naming-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ Using a single character to name a variable conveys little to no information to

- Is this a throw away variable?
- What is the variable meant to represent where ever it is used?
- Does it make sense to call it by the chosen character e.g. `x` when referring to forumlas?
- Does it make sense to call it by the chosen character e.g. `x` when referring to formulas?

### Ambigious Abbreviations
### Ambiguous Abbreviations

A common mistake is to abbreviate a variable when it does not need to be abbreviated or when the abbreviation may be ambigious.
A common mistake is to abbreviate a variable when it does not need to be abbreviated or when the abbreviation may be ambiguous.

For example, in the context of an industry that deals with temperature sensors what does the variable `temp` refer to?

Expand Down
2 changes: 1 addition & 1 deletion docs/contributing-book/src/pull-requests/creating-pr.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ If there is an issue that the pull request is working off of then it's a good pr

For example, issue number `123` would be referenced in the description as `closes #123`.

Additionally, referencing the issue that the pull request is based on allows the reviewer to easily click on the link which will take them to the issue. This makes it easy to see the problem in detail and any discussion that occured.
Additionally, referencing the issue that the pull request is based on allows the reviewer to easily click on the link which will take them to the issue. This makes it easy to see the problem in detail and any discussion that occurred.

### Merging the Pull Request

Expand Down
2 changes: 1 addition & 1 deletion docs/contributing-book/src/pull-requests/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Pull Requests

A pull request is a term used to identify when a piece of work is ready to be pulled into and merged with another piece of work. This funtionality is especially useful when collaborating with others because it allows a review process to take place.
A pull request is a term used to identify when a piece of work is ready to be pulled into and merged with another piece of work. This functionality is especially useful when collaborating with others because it allows a review process to take place.

In order to create a high quality pull request there are a couple areas that need to be considered:

Expand Down
2 changes: 1 addition & 1 deletion examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "Apache-2.0"
[dependencies]
fuel-merkle = { version = "0.50.0" }
sha2 = { version = "0.10" }
fuels = { version = "0.62.0", features = ["fuel-core-lib"] }
fuels = { version = "0.66.2" }
tokio = { version = "1.12", features = ["rt", "macros"] }

[[test]]
Expand Down
Loading

0 comments on commit e19f96f

Please sign in to comment.