Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v0.6.2 #164

Open
wants to merge 57 commits into
base: release
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
9c85a02
Hotfix: Update Cargo.toml to v0.5.1 (#115)
bitzoic Jun 27, 2024
f0b5631
fix vault reads
SwayStar123 Jul 2, 2024
050977c
add changelog
SwayStar123 Jul 2, 2024
7edb337
move changelog to new empty changelog
SwayStar123 Jul 8, 2024
cb4dbab
add "unreleased" to changelog heads
SwayStar123 Jul 8, 2024
b70a650
remove date
SwayStar123 Jul 8, 2024
babc929
add v0.5.1
SwayStar123 Jul 8, 2024
b0e99a6
Merge pull request #121 from FuelLabs/fixsrc6eg
SwayStar123 Jul 8, 2024
3acac2b
SRC-6 example contract does not update managed assets (#122)
bitzoic Jul 9, 2024
ade6077
Use new namespace syntax for storage (#120)
IGI-111 Jul 22, 2024
e7e8dfa
chore: fix compiler warnings
sdankel Jul 25, 2024
6f2b07c
remove for examples
sdankel Jul 25, 2024
94b3978
Update changelog
sdankel Jul 31, 2024
d736ca6
Merge pull request #124 from FuelLabs/sophie/fix-warnings
K1-R1 Aug 1, 2024
2f45270
Prepare master for v0.5.2 release (#126)
bitzoic Aug 6, 2024
89e9882
Make the `SubId` an `Option` in SRC-3's `mint()` function (#131)
bitzoic Aug 23, 2024
69217c2
Add event logging to SRC-20 and SRC-7 standards (#130)
bitzoic Aug 26, 2024
81c9e65
Prepare for v0.6.0 release
bitzoic Aug 26, 2024
94bc033
Update CHANGELOG
bitzoic Aug 26, 2024
bab74e4
Merge pull request #139 from FuelLabs/bitzoic-release-v0.6.0
SwayStar123 Aug 27, 2024
0cbef85
Resolve warnings in examples (#137)
bitzoic Aug 27, 2024
a477a91
chore: update to forc 0.63.3 (#135)
K1-R1 Aug 30, 2024
d264041
docs: update src14 storage recommendation and general typos (#136)
K1-R1 Aug 30, 2024
955061b
Add helper functions to SRC7 standard's `Metadata` (#144)
bitzoic Aug 30, 2024
7ce70c9
Remove metadata functions (#148)
bitzoic Aug 30, 2024
5b501cf
Fix Sway Standards inline docs (#142)
bitzoic Sep 2, 2024
ab52d73
Prepare for Sway-Standards `v0.6.1` release (#147)
bitzoic Sep 4, 2024
29986f1
Add helper functions to struct types and `Eq` implementations for all…
bitzoic Sep 9, 2024
18d4842
init
SwayStar123 Sep 10, 2024
64dbef4
remove unused param from SetSRC20Data impl
SwayStar123 Sep 10, 2024
6ab90c3
fix import
SwayStar123 Sep 10, 2024
6dc8a28
fix some get calls
SwayStar123 Sep 10, 2024
90d748c
fmt 2
SwayStar123 Sep 10, 2024
3263c4a
unwrap -> read
SwayStar123 Sep 10, 2024
d9ad426
remove get from sasbv
SwayStar123 Sep 10, 2024
d467526
init
SwayStar123 Sep 10, 2024
1718d5a
ujpdate changelog pr number
SwayStar123 Sep 10, 2024
731e5a2
resolve comments
SwayStar123 Sep 11, 2024
6948958
fmt
SwayStar123 Sep 11, 2024
2ebb457
get(asset) for maps
SwayStar123 Sep 11, 2024
2a822da
add write permission
SwayStar123 Sep 11, 2024
c8b5618
move changelog
SwayStar123 Sep 11, 2024
17809b0
add sotrage writes to set_src20_data
SwayStar123 Sep 16, 2024
607066a
add changelog
SwayStar123 Sep 16, 2024
55541de
add write to storage annotation
SwayStar123 Sep 16, 2024
ee95fad
Merge pull request #151 from FuelLabs/update-src-6-to-latest-src-20-s…
SwayStar123 Sep 17, 2024
04a5248
Merge pull request #152 from FuelLabs/add-src6-inline-doc-examples
SwayStar123 Sep 17, 2024
408d81a
Merge pull request #153 from FuelLabs/swaystar123/fix-set_src20_data-bug
SwayStar123 Sep 17, 2024
a3f87a4
Update abi names in standards docs (#154)
bitzoic Oct 7, 2024
c53ef03
Rename SRC-7 to Onchain Native Asset Metadata Standard (#157)
bitzoic Oct 28, 2024
fefbd93
Fix typo in SRC-7 inline docs (#160)
bitzoic Nov 25, 2024
ccf84fd
docs: Add CI link check (#162)
calldelegation Dec 12, 2024
e7d3617
SRC-15; Offchain Metadata Standard (#159)
bitzoic Dec 13, 2024
3f6543f
Update master from v0.6.1 to v0.6.2 (#163)
bitzoic Dec 14, 2024
529b5e5
Resolve merge conflicts
bitzoic Dec 16, 2024
a5fb98e
Resolve merge conflicts
bitzoic Dec 16, 2024
008116c
Resolve merge conflicts
bitzoic Dec 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ jobs:
"examples/src11-security-information",
"examples/src12-contract-factory",
"examples/src14-simple-proxy",
"examples/src15-offchain-metadata",
"examples/src20-native-asset",
]

Expand Down
17 changes: 14 additions & 3 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,19 @@ on:
pull_request:

jobs:
test:
spell-check:
name: Spell Check
uses: FuelLabs/github-actions/.github/workflows/mdbook-docs.yml@master
with:
docs-src-path: 'docs/src'
spellcheck-config-path: 'docs/.spellcheck.yml'
docs-src-path: "docs/src"
spellcheck-config-path: "docs/.spellcheck.yml"

link-check:
name: Link Check
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Run Markdown Link Check
uses: gaurav-nelson/github-action-markdown-link-check@1.0.15
35 changes: 30 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

Description of the upcoming release here.

### Added

- Something new here 1
Expand All @@ -24,14 +22,39 @@ Description of the upcoming release here.
- Some fix here 1
- Some fix here 2

#### Breaking
### Breaking

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

## [Version 0.6.1]
## [Version 0.6.2]

### New Standards v0.6.2

- [#159](https://github.com/FuelLabs/sway-standards/pull/159) Defines the SRC-15; Offchain Metadata Standard.

### Added v0.6.2

- [#152](https://github.com/FuelLabs/sway-standards/pull/152) Adds inline documentation examples to the SRC-6 standard.
- [#159](https://github.com/FuelLabs/sway-standards/pull/159) Adds the SRC-15 standard files and docs.
- [#162](https://github.com/FuelLabs/sway-standards/pull/162) Adds link checker to CI.

### Changed v0.6.2

Description of the upcoming release here.
- [#154](https://github.com/FuelLabs/sway-standards/pull/154) Updates the examples in the standards specififcations to use the offical abi name.
- [#157](https://github.com/FuelLabs/sway-standards/pull/157) Updates the name of the SRC-7 standard to "Onchain Native Asset Metadata Standard".
- [#163](https://github.com/FuelLabs/sway-standards/pull/163) Prepares for the v0.6.2 release.

### Fixed v0.6.2

- [#153](https://github.com/FuelLabs/sway-standards/pull/153) Actually write to storage in `set_src20_data()` in the SRC-20 multi asset example.
- [#160](https://github.com/FuelLabs/sway-standards/pull/160) Fixes a typo in the SRC-7 inline docs.

#### Breaking v0.6.2

- None

## [Version 0.6.1]

### Added v0.6.1

Expand All @@ -50,6 +73,8 @@ Description of the upcoming release here.
- [#137](https://github.com/FuelLabs/sway-standards/pull/137) Resolves warnings for SRC-6, SRC-14, and SRC-5 standard examples.
- [#136](https://github.com/FuelLabs/sway-standards/pull/136) Fixes SRC14 to recommend namespacing all non-standardized storage variables under the SRC14 namespace, fixes typos, and improves markdown in docs and inline documentation.
- [#142](https://github.com/FuelLabs/sway-standards/pull/142) Fixes errors in inline documentation for SRC-10, SRC-12, SRC-14, SRC-20, SRC-3, SRC-5, SRC-7 standards.
- [#151](https://github.com/FuelLabs/sway-standards/pull/151) Fixes SRC-6 standard examples conform to the latest SRC-20 spec of logging values after updates.
- [#151](https://github.com/FuelLabs/sway-standards/pull/151) Formats code of SRC-6 examples, and fixes some comments.

## [Version 0.6.0]

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-standards"
version = "0.6.1"
version = "0.6.2"
edition = "2021"
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
</p>

<p align="center">
<a href="https://github.com/FuelLabs/sway-standards/actions/workflows/ci.yml" alt="CI">
<img src="https://github.com/FuelLabs/sway-standards/actions/workflows/ci.yml/badge.svg" />
<a href="https://github.com/FuelLabs/sway-standards/actions/workflows/ci.yaml" alt="CI">
<img src="https://github.com/FuelLabs/sway-standards/actions/workflows/ci.yaml/badge.svg" />
</a>
<a href="https://crates.io/crates/forc/0.63.3" alt="forc">
<img src="https://img.shields.io/badge/forc-v0.63.3-orange" />
Expand Down Expand Up @@ -37,7 +37,7 @@ If you don't find what you're looking for, feel free to create an issue and prop

- [SRC-20; Native Asset Standard](https://docs.fuel.network/docs/sway-standards/src-20-native-asset/) defines the implementation of a standard API for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) using the Sway Language.
- [SRC-3; Mint and Burn](https://docs.fuel.network/docs/sway-standards/src-3-minting-and-burning/) is used to enable mint and burn functionality for fungible assets.
- [SRC-7; Arbitrary Asset Metadata Standard](https://docs.fuel.network/docs/sway-standards/src-7-asset-metadata/) is used to store metadata for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets).
- [SRC-7; Onchain Asset Metadata Standard](https://docs.fuel.network/docs/sway-standards/src-7-asset-metadata/) is used to store metadata for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets).
- [SRC-9; Metadata Keys Standard](https://docs.fuel.network/docs/sway-standards/src-9-metadata-keys/) is used to store standardized metadata keys for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) in combination with the SRC-7 standard.
- [SRC-6; Vault Standard](https://docs.fuel.network/docs/sway-standards/src-6-vault/) defines the implementation of a standard API for asset vaults developed in Sway.
- [SRC-13; Soulbound Address](https://docs.fuel.network/docs/sway-standards/src-13-soulbound-address/) provides a predicate interface to lock [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) as soulbound.
Expand Down Expand Up @@ -65,7 +65,7 @@ If you don't find what you're looking for, feel free to create an issue and prop
To import a standard the following should be added to the project's `Forc.toml` file under `[dependencies]` with the most recent release:

```toml
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.6.1" }
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.6.2" }
```

> **NOTE:**
Expand Down
5 changes: 5 additions & 0 deletions docs/spell-check-custom-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -266,3 +266,8 @@ SetNameEvent
SetSymbolEvent
SetDecimalsEvent
UpdateTotalSupplyEvent
Onchain
onchain
Offchain
offchain
MetadataEvent
3 changes: 2 additions & 1 deletion docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
- [SRC-3: Minting and Burning](./src-3-minting-and-burning.md)
- [SRC-5: Ownership](./src-5-ownership.md)
- [SRC-6: Vault](./src-6-vault.md)
- [SRC-7: Asset Metadata](./src-7-asset-metadata.md)
- [SRC-7: Onchain Asset Metadata](./src-7-asset-metadata.md)
- [SRC-8: Bridged Asset](./src-8-bridged-asset.md)
- [SRC-9: Metadata Keys](./src-9-metadata-keys.md)
- [SRC-10: Native Bridge](./src-10-native-bridge.md)
- [SRC-11: Security Information](./src-11-security-information.md)
- [SRC-12: Contract Factory](./src-12-contract-factory.md)
- [SRC-13: Soulbound Address](./src-13-soulbound-address.md)
- [SRC-14: Simple Upgradeable Contract](./src-14-simple-upgradeable-proxies.md)
- [SRC-15: Offchain Asset Metadata](./src-15-offchain-asset-metadata.md)
- [SRC-20: Native Asset](./src-20-native-asset.md)
5 changes: 3 additions & 2 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ If you don't find what you're looking for, feel free to create an issue and prop
To import a standard the following should be added to the project's `Forc.toml` file under `[dependencies]` with the most recent release:

```toml
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.6.1" }
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.6.2" }
```

> **NOTE:**
Expand All @@ -38,10 +38,11 @@ use standards::src20::SRC20;

- [SRC-20; Native Asset Standard](./src-20-native-asset.md) defines the implementation of a standard API for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) using the Sway Language.
- [SRC-3; Mint and Burn](./src-3-minting-and-burning.md) is used to enable mint and burn functionality for fungible assets.
- [SRC-7; Arbitrary Asset Metadata Standard](./src-7-asset-metadata.md) is used to store metadata for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets).
- [SRC-7; Onchain Asset Metadata Standard](./src-7-asset-metadata.md) is used to store metadata for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets).
- [SRC-9; Metadata Keys Standard](./src-9-metadata-keys.md) is used to store standardized metadata keys for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) in combination with the SRC-7 standard.
- [SRC-6; Vault Standard](./src-6-vault.md) defines the implementation of a standard API for asset vaults developed in Sway.
- [SRC-13; Soulbound Address](./src-13-soulbound-address.md) defines the implementation of a soulbound address.
- [SRC-15; Offchain Asset Metadata Standard](./src-15-offchain-asset-metadata.md) is used to associated metadata with [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) offchain.

### Security and Access Control

Expand Down
73 changes: 73 additions & 0 deletions docs/src/src-15-offchain-asset-metadata.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# SRC-15: Off-Chain Native Asset Metadata

The following standard attempts to define arbitrary metadata for any [Native Asset](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) that is not required by other contracts onchain, in a stateless manner. Any contract that implements the SRC-15 standard MUST implement the [SRC-20](./src-20-native-asset.md) standard.

## Motivation

The SRC-15 standard seeks to enable data-rich assets on the Fuel Network while maintaining a stateless solution. All metadata queries are done off-chain using the indexer.

## Prior Art

The SRC-7 standard exists prior to the SRC-15 standard and is a stateful solution. The SRC-15 builds off the SRC-7 standard by using the `Metadata` enum however provides a stateless solution.

The use of generic metadata was originally found in the Sway-Lib's [NFT Library](https://github.com/FuelLabs/sway-libs/tree/v0.12.0/libs/nft) which did not use Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). This library has since been deprecated.

A previous definition for a metadata standard was written in the original edit of the now defunct [SRC-721](https://github.com/FuelLabs/sway-standards/issues/2). This has since been replaced with the [SRC-20](./src-20-native-asset.md) standard as `SubId` was introduced to enable multiple assets to be minted from a single contract.

## Specification

### Metadata Type

The `Metadata` enum from the SRC-7 standard is also used to represent the metadata in the SRC-15 standard.

### Logging

The following logs MUST be implemented and emitted to follow the SRC-15 standard. Logging MUST be emitted from the contract which minted the asset.

#### SRC15MetadataEvent

The `SRC15MetadataEvent` MUST be emitted at least once for each distinct piece of metadata. The latest emitted `SRC15MetadataEvent` is determined to be the current metadata.

There SHALL be the following fields in the `SRC15MetadataEvent` struct:

* `asset`: The `asset` field SHALL be used for the corresponding `AssetId` for the metadata.
* `metadata`: The `metadata` field SHALL be used for the corresponding `Metadata` which represents the metadata of the asset.

Example:

```sway
pub struct SRC15MetadataEvent {
pub asset: AssetId,
pub metadata: Metadata,
}
```

## Rationale

The SRC-15 standard allows for data-rich assets in a stateless manner by associating an asset with some metadata that may later be fetched by the indexer.

## Backwards Compatibility

This standard is compatible with Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) and the [SRC-20](./src-20-native-asset.md) standard. This standard is also compatible with the SRC-7 standard which defines a stateful solution. It also maintains compatibility with existing standards in other ecosystems.

## Security Considerations

When indexing for SRC-15 metadata, developers should confirm that the contract that emitted the `SRC15MetadataEvent` is also the contract that minted the asset that the metadata associates with. Additionally, restrictions via access control on who may emit the Metadata should be considered.

## Example Implementation

### Single Native Asset

Example of the SRC-15 implementation where metadata exists for only a single asset with one `SubId`.

```sway
{{#include ../examples/src15-offchain-metadata/single_asset/src/single_asset.sw}}
```

### Multi Native Asset

Example of the SRC-15 implementation where metadata exists for multiple assets with differing `SubId` values.

```sway
{{#include ../examples/src15-offchain-metadata/multi_asset/src/multi_asset.sw}}
```
2 changes: 1 addition & 1 deletion docs/src/src-20-native-asset.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ This standard does not introduce any security concerns, as it does not call exte
## Example ABI

```sway
abi MyAsset {
abi SRC20 {
#[storage(read)]
fn total_assets() -> u64;
#[storage(read)]
Expand Down
2 changes: 1 addition & 1 deletion docs/src/src-3-minting-and-burning.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ The burn function may also introduce a security consideration if the total suppl
## Example ABI

```sway
abi MySRC3Asset {
abi SRC3 {
#[storage(read, write)]
fn mint(recipient: Identity, sub_id: Option<SubId>, amount: u64);
#[payable]
Expand Down
12 changes: 6 additions & 6 deletions docs/src/src-7-asset-metadata.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# SRC-7: Arbitrary Native Asset Metadata
# SRC-7: Onchain Native Asset Metadata

The following standard attempts to define the retrieval of on-chain arbitrary metadata for any [Native Asset](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). Any contract that implements the SRC-7 standard MUST implement the [SRC-20](./src-20-native-asset.md) standard.
The following standard attempts to define the retrieval of on-chain arbitrary metadata for any [Native Asset](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). This standard should be used if a stateful approach is needed. Any contract that implements the SRC-7 standard MUST implement the [SRC-20](./src-20-native-asset.md) standard.

## Motivation

The SRC-7 standard seeks to enable data-rich assets on the Fuel Network while maintaining compatibility between multiple assets minted by the same contract. The standard ensures type safety with the use of an `enum` and an `Option`. All metadata queries are done through a single function to facilitate cross-contract calls.
The SRC-7 standard seeks to enable stateful data-rich assets on the Fuel Network while maintaining compatibility between multiple assets minted by the same contract. The standard ensures type safety with the use of an `enum` and an `Option`. All metadata queries are done through a single function to facilitate cross-contract calls.

## Prior Art

Expand Down Expand Up @@ -57,7 +57,7 @@ The `SetMetadataEvent` MUST be emitted when the metadata of an asset has updated

There SHALL be the following fields in the `SetMetadataEvent` struct:

* `asset`: The `asset` field SHALL be used for the corresponding `AssetId` of the asset has been updated.
* `asset`: The `asset` field SHALL be used for the corresponding `AssetId` for the asset that has been updated.
* `metadata`: The `metadata` field SHALL be used for the corresponding `Option<Metadata>` which represents the metadata of the asset.
* `key`: The `key` field SHALL be used for the corresponding `String` which represents the key used for storing the metadata.
* `sender`: The `sender` field SHALL be used for the corresponding `Identity` which made the function call that has updated the metadata of the asset.
Expand All @@ -75,7 +75,7 @@ pub struct SetMetadataEvent {

## Rationale

The SRC-7 standard should allow for data-rich assets to interact with one another in a safe manner.
The SRC-7 standard should allow for stateful data-rich assets to interact with one another in a safe manner.

## Backwards Compatibility

Expand All @@ -88,7 +88,7 @@ This standard does not introduce any security concerns, as it does not call exte
## Example ABI

```sway
abi SRC7Metadata {
abi SRC7 {
#[storage(read)]
fn metadata(asset: AssetId, key: String) -> Option<Metadata>;
}
Expand Down
2 changes: 2 additions & 0 deletions examples/src15-offchain-metadata/Forc.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[workspace]
members = ["single_asset", "multi_asset"]
8 changes: 8 additions & 0 deletions examples/src15-offchain-metadata/multi_asset/Forc.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[project]
authors = ["Fuel Labs <contact@fuel.sh>"]
entry = "multi_asset.sw"
license = "Apache-2.0"
name = "multi_src15_asset"

[dependencies]
standards = { path = "../../../standards" }
Loading
Loading