From f0b5631d9b64980fc02a7a58ff5994ab6a53996f Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Tue, 2 Jul 2024 14:32:46 +0000 Subject: [PATCH 1/6] fix vault reads --- examples/src6-vault/multi_asset_vault/src/main.sw | 9 ++++++++- examples/src6-vault/single_asset_vault/src/main.sw | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/examples/src6-vault/multi_asset_vault/src/main.sw b/examples/src6-vault/multi_asset_vault/src/main.sw index 26d3428..ede9e40 100644 --- a/examples/src6-vault/multi_asset_vault/src/main.sw +++ b/examples/src6-vault/multi_asset_vault/src/main.sw @@ -50,7 +50,14 @@ impl SRC6 for Contract { _mint(receiver, share_asset, share_asset_vault_sub_id, shares); - let mut vault_info = storage.vault_info.get(share_asset).read(); + let mut vault_info = match storage.vault_info.get(share_asset).try_read() { + Some(vault_info) => vault_info, + None => VaultInfo { + managed_assets: 0, + vault_sub_id, + asset: underlying_asset, + }, + }; vault_info.managed_assets = vault_info.managed_assets + asset_amount; storage.vault_info.insert(share_asset, vault_info); diff --git a/examples/src6-vault/single_asset_vault/src/main.sw b/examples/src6-vault/single_asset_vault/src/main.sw index 16d1d76..c910eb6 100644 --- a/examples/src6-vault/single_asset_vault/src/main.sw +++ b/examples/src6-vault/single_asset_vault/src/main.sw @@ -51,7 +51,14 @@ impl SRC6 for Contract { _mint(receiver, share_asset, share_asset_vault_sub_id, shares); - let mut vault_info = storage.vault_info.get(share_asset).read(); + let mut vault_info = match storage.vault_info.get(share_asset).try_read() { + Some(vault_info) => vault_info, + None => VaultInfo { + managed_assets: 0, + vault_sub_id, + asset: underlying_asset, + }, + }; vault_info.managed_assets = vault_info.managed_assets + asset_amount; storage.vault_info.insert(share_asset, vault_info); From 050977c54cbd522131917444d639c2d08a94e4ee Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Tue, 2 Jul 2024 14:38:33 +0000 Subject: [PATCH 2/6] add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b99f637..1513cfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ Description of the upcoming release here. - [#99](https://github.com/FuelLabs/sway-standards/pull/99) Fixes links and typos in the SRC-14 standard. - [#112](https://github.com/FuelLabs/sway-standards/pull/112) Fixes inline documentation code in the SRC-3 standard. - [#115](https://github.com/FuelLabs/sway-standards/pull/115) Hotfixes the Cargo.toml version to the v0.5.1 release. +- [#121](https://github.com/FuelLabs/sway-standards/pull/121) Fixes the `deposit` function in the SRC-6 standard, uses try_read instead of read in order to allow first time deposits to a vault. #### Breaking From 7edb337ccc5f953bc6405ab852728339e63ab901 Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Mon, 8 Jul 2024 16:27:51 +0530 Subject: [PATCH 3/6] move changelog to new empty changelog --- CHANGELOG.md | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1513cfe..d1d2316 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,29 @@ 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/). +## [Unreleased] - yyyy-mm-dd + +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 + +- [#121](https://github.com/FuelLabs/sway-standards/pull/121) Fixes the `deposit` function in the SRC-6 standard, uses try_read instead of read in order to allow first time deposits to a vault. + +#### Breaking + +- Some breaking change here 1 +- Some breaking change here 2 + ## [Version 0.5.1] Description of the upcoming release here. @@ -27,7 +50,6 @@ Description of the upcoming release here. - [#99](https://github.com/FuelLabs/sway-standards/pull/99) Fixes links and typos in the SRC-14 standard. - [#112](https://github.com/FuelLabs/sway-standards/pull/112) Fixes inline documentation code in the SRC-3 standard. - [#115](https://github.com/FuelLabs/sway-standards/pull/115) Hotfixes the Cargo.toml version to the v0.5.1 release. -- [#121](https://github.com/FuelLabs/sway-standards/pull/121) Fixes the `deposit` function in the SRC-6 standard, uses try_read instead of read in order to allow first time deposits to a vault. #### Breaking From cb4dbab61c279c78a010fdc75d40e0278d96297e Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Mon, 8 Jul 2024 16:32:05 +0530 Subject: [PATCH 4/6] add "unreleased" to changelog heads --- CHANGELOG.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1d2316..87528a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,21 +9,21 @@ and this project adheres to [Semantic Versioning](http://semver.org/). Description of the upcoming release here. -### Added +### Added Unreleased - Something new here 1 - Something new here 2 -### Changed +### Changed Unreleased - Something changed here 1 - Something changed here 2 -### Fixed +### Fixed Unreleased - [#121](https://github.com/FuelLabs/sway-standards/pull/121) Fixes the `deposit` function in the SRC-6 standard, uses try_read instead of read in order to allow first time deposits to a vault. -#### Breaking +#### Breaking Unreleased - Some breaking change here 1 - Some breaking change here 2 From b70a650d2c39426371c5b288c67bc8e24d89d2a5 Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Mon, 8 Jul 2024 16:36:04 +0530 Subject: [PATCH 5/6] remove date --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87528a5..f0439db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ 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/). -## [Unreleased] - yyyy-mm-dd +## [Unreleased] Description of the upcoming release here. From babc929b3bf35ba3af8718833252dacfeafca16b Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Mon, 8 Jul 2024 16:37:19 +0530 Subject: [PATCH 6/6] add v0.5.1 --- CHANGELOG.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0439db..5d6103c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,26 +32,26 @@ Description of the upcoming release here. Description of the upcoming release here. -### Added +### Added v0.5.1 - [#107](https://github.com/FuelLabs/sway-standards/pull/107): Adds the `proxy_owner()` function to the SRC-14 standard. - [#104](https://github.com/FuelLabs/sway-standards/pull/104): Adds the CHANGELOG.md file to Sway-Standards. - [#110](https://github.com/FuelLabs/sway-standards/pull/110) Adds the `proxy_target()` function to the SRC-14 standard. - [#103](https://github.com/FuelLabs/sway-standards/pull/103): Adds Sway-Standards to the [docs hub](https://docs.fuel.network/docs/sway-standards/). -### Changed +### Changed v0.5.1 - [#103](https://github.com/FuelLabs/sway-standards/pull/103) Removes standards in the `./SRC` folder in favor of `./docs`. - [#106](https://github.com/FuelLabs/sway-standards/pull/106) Updates links from the Sway Book to Docs Hub. -### Fixed +### Fixed v0.5.1 - [#107](https://github.com/FuelLabs/sway-standards/pull/107) resolves the conflict when SRC-5's `owner()` function is used in both the proxy and target contract in the SRC-14 standard. - [#99](https://github.com/FuelLabs/sway-standards/pull/99) Fixes links and typos in the SRC-14 standard. - [#112](https://github.com/FuelLabs/sway-standards/pull/112) Fixes inline documentation code in the SRC-3 standard. - [#115](https://github.com/FuelLabs/sway-standards/pull/115) Hotfixes the Cargo.toml version to the v0.5.1 release. -#### Breaking +#### Breaking v0.5.1 - [#110](https://github.com/FuelLabs/sway-standards/pull/110) Breaks the `SRC14` abi by adding the `proxy_target()` function. This will need to be added to any SRC14 implementation. The new abi is as follows: