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

chore: update to forc 0.63.3 #135

Merged
merged 3 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
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.61.0
CORE_VERSION: 0.26.0
RUST_VERSION: 1.80.1
FORC_VERSION: 0.63.3
CORE_VERSION: 0.34.0
PATH_TO_SCRIPTS: .github/scripts

jobs:
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Changed Unreleased

- Something changed here 1
- [#135](https://github.com/FuelLabs/sway-standards/pull/135) Updates standards, examples and CI to latest forc 0.63.3.
- Something changed here 2

### Fixed Unreleased
Expand Down
8 changes: 4 additions & 4 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-standards/actions/workflows/ci.yml" alt="CI">
<img src="https://github.com/FuelLabs/sway-standards/actions/workflows/ci.yml/badge.svg" />
</a>
<a href="https://crates.io/crates/forc/0.61.0" alt="forc">
<img src="https://img.shields.io/badge/forc-v0.61.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-standards" />
Expand Down Expand Up @@ -162,12 +162,12 @@ Example of a minimal SRC-14 implementation with no access control.
Example of a SRC-14 implementation that also implements [SRC-5](https://docs.fuel.network/docs/sway-standards/src-5-ownership/).

> **Note**
> All standards currently use `forc v0.61.0`.
> All standards currently use `forc v0.63.3`.

<!-- TODO:
## Contributing

Check out the [book](https://fuellabs.github.io/sway-libs/book/index.html) for more info!
Check out the [book](https://fuellabs.github.io/sway-libs/book/index.html) for more info!
-->

> **Note**
Expand Down
2 changes: 1 addition & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Standards in this repository may be in various stages of development. Use of dra
If you don't find what you're looking for, feel free to create an issue and propose a new standard!

> **Note**
> All standards currently use `forc v0.61.0`.
> All standards currently use `forc v0.63.3`.

## Using a standard

Expand Down
16 changes: 11 additions & 5 deletions examples/src14-simple-proxy/minimal/src/minimal.sw
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,31 @@ use std::execution::run_external;
use standards::src14::{SRC14, SRC14_TARGET_STORAGE};

storage {
// target is at sha256("storage_SRC14_0")
target: ContractId = ContractId::zero(),
SRC14 {
/// The [ContractId] of the target contract.
///
/// # Additional Information
///
/// `target` is stored at sha256("storage_SRC14_0")
target in 0x7bb458adc1d118713319a5baa00a2d049dd64d2916477d2688d76970c898cd55: ContractId = ContractId::zero(),
},
}

impl SRC14 for Contract {
#[storage(read, write)]
fn set_proxy_target(new_target: ContractId) {
storage.target.write(new_target);
storage::SRC14.target.write(new_target);
}

#[storage(read)]
fn proxy_target() -> Option<ContractId> {
storage.target.try_read()
storage::SRC14.target.try_read()
}
}

#[fallback]
#[storage(read)]
fn fallback() {
// pass through any other method call to the target
run_external(storage.target.read())
run_external(storage::SRC14.target.read())
}
21 changes: 13 additions & 8 deletions examples/src14-simple-proxy/owned/src/owned.sw
Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,49 @@ use standards::src14::{SRC14, SRC14_TARGET_STORAGE, SRC14Extension};
const INITIAL_OWNER: Identity = Identity::Address(Address::zero());

storage {
proxy {
// target is at sha256("storage_SRC14_0")
SRC14 {
/// The [ContractId] of the target contract.
///
/// # Additional Information
///
/// `target` is stored at sha256("storage_SRC14_0")
target in 0x7bb458adc1d118713319a5baa00a2d049dd64d2916477d2688d76970c898cd55: ContractId = ContractId::zero(),
/// The [State] of the proxy owner.
owner: State = State::Initialized(INITIAL_OWNER),
},
target: ContractId = ContractId::zero(),
}

impl SRC14 for Contract {
#[storage(read, write)]
fn set_proxy_target(new_target: ContractId) {
only_owner();
storage.target.write(new_target);
storage::SRC14.target.write(new_target);
}

#[storage(read)]
fn proxy_target() -> Option<ContractId> {
storage.target.try_read()
storage::SRC14.target.try_read()
}
}

impl SRC14Extension for Contract {
#[storage(read)]
fn proxy_owner() -> State {
storage::proxy.owner.read()
storage::SRC14.owner.read()
}
}

#[fallback]
#[storage(read)]
fn fallback() {
// pass through any other method call to the target
run_external(storage.target.read())
run_external(storage::SRC14.target.read())
}

#[storage(read)]
fn only_owner() {
require(
storage::proxy
storage::SRC14
.owner
.read() == State::Initialized(msg_sender().unwrap()),
AccessError::NotOwner,
Expand Down
Loading