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

Bump to forc v0.56.0 #239

Merged
merged 7 commits into from
Apr 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
2 changes: 0 additions & 2 deletions .gitattributes

This file was deleted.

7 changes: 6 additions & 1 deletion docs/book/src/asset/metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ To use the `StorageMetadata` type, simply get the stored metadata with the assoc
The `Metadata` type defined by the [SRC-7](https://github.com/FuelLabs/sway-standards/blob/master/SRCs/src-7.md) standard can be one of 4 states:

```sway
{{#include ../../../../examples/asset/metadata_docs/src/main.sw:metadata_enum}}
pub enum Metadata {
B256: b256,
Bytes: Bytes,
Int: u64,
String: String,
}
```

The Asset Library enables the following functionality for the `Metadata` type:
Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/reentrancy/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Once imported, using the Reentrancy Library can be done by calling one of the tw
Once imported, using the Reentrancy Guard Library can be used by calling the `reentrancy_guard()` in your Sway Smart Contract. The following shows a Sway Smart Contract that applies the Reentrancy Guard Library:

```sway
{{#include ../../../../examples/reentrancy/src/main.sw:reentrancy}}
{{#include ../../../../examples/reentrancy/src/main.sw:reentrancy_guard}}
```

### Checking Reentrancy Status
Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/signed_integers/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ To import the Signed Integer Number Library to your Sway Smart Contract, add the
In order to use the any of the Signed Integer types, import them into your Sway project like so:

```sway
{{#include ../../../../examples/signed_integers/src/main.sw:import_i8}}
{{#include ../../../../examples/signed_integers/src/main.sw:import_8}}
```

## Basic Functionality
Expand Down
2 changes: 1 addition & 1 deletion examples/admin/Forc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ license = "Apache-2.0"
name = "admin_examples"

[dependencies]
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.1" }
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.3" }
sway_libs = { path = "../../libs" }
2 changes: 1 addition & 1 deletion examples/asset/base_docs/Forc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ license = "Apache-2.0"
name = "base_docs"

[dependencies]
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.1" }
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.3" }
sway_libs = { path = "../../../libs" }
2 changes: 1 addition & 1 deletion examples/asset/basic_src20/Forc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ license = "Apache-2.0"
name = "basic_src20"

[dependencies]
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.1" }
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.3" }
sway_libs = { path = "../../../libs" }
2 changes: 1 addition & 1 deletion examples/asset/basic_src3/Forc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ license = "Apache-2.0"
name = "basic_src3"

[dependencies]
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.1" }
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.3" }
sway_libs = { path = "../../../libs" }
2 changes: 1 addition & 1 deletion examples/asset/basic_src7/Forc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ license = "Apache-2.0"
name = "basic_src7"

[dependencies]
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.1" }
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.3" }
sway_libs = { path = "../../../libs" }
2 changes: 1 addition & 1 deletion examples/asset/metadata_docs/Forc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ license = "Apache-2.0"
name = "metadata_docs"

[dependencies]
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.1" }
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.3" }
sway_libs = { path = "../../../libs" }
9 changes: 0 additions & 9 deletions examples/asset/metadata_docs/src/main.sw
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,6 @@ storage {
}
// ANCHOR_END: src7_storage

// ANCHOR: metadata_enum
pub enum Metadata {
B256: b256,
Bytes: Bytes,
Int: u64,
String: String,
}
// ANCHOR_END: metadata_enum

// ANCHOR: as_b256
fn b256_type(my_metadata: Metadata) {
assert(my_metadata.is_b256());
Expand Down
2 changes: 1 addition & 1 deletion examples/asset/setting_src20_attributes/Forc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ license = "Apache-2.0"
name = "setting_src20_attributes"

[dependencies]
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.1" }
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.3" }
sway_libs = { path = "../../../libs" }
2 changes: 1 addition & 1 deletion examples/asset/setting_src7_attributes/Forc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ license = "Apache-2.0"
name = "setting_src7_attributes"

[dependencies]
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.1" }
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.3" }
sway_libs = { path = "../../../libs" }
2 changes: 1 addition & 1 deletion examples/asset/supply_docs/Forc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ license = "Apache-2.0"
name = "supply_docs"

[dependencies]
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.1" }
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.3" }
sway_libs = { path = "../../../libs" }
2 changes: 1 addition & 1 deletion examples/ownership/Forc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ license = "Apache-2.0"
name = "ownership_examples"

[dependencies]
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.1" }
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.3" }
sway_libs = { path = "../../libs" }
2 changes: 1 addition & 1 deletion examples/signed_integers/src/main.sw
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use sway_libs::signed_integers::*;

// ANCHOR: import_8
use sway_libs::signed_integers::i8::I8;
// ANCHOR_END: import
// ANCHOR_END: import_8

fn initialize() {
// ANCHOR: initialize
Expand Down
2 changes: 1 addition & 1 deletion libs/Forc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ license = "Apache-2.0"
name = "sway_libs"

[dependencies]
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.1" }
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.3" }
9 changes: 3 additions & 6 deletions libs/src/asset/supply.sw
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ use std::{
burn,
mint_to,
},
call_frames::{
contract_id,
msg_asset_id,
},
call_frames::msg_asset_id,
context::this_balance,
hash::{
Hash,
Expand Down Expand Up @@ -68,7 +65,7 @@ pub fn _mint(
sub_id: SubId,
amount: u64,
) -> AssetId {
let asset_id = AssetId::new(contract_id(), sub_id);
let asset_id = AssetId::new(ContractId::this(), sub_id);
let supply = _total_supply(total_supply_key, asset_id);

// Only increment the number of assets minted by this contract if it hasn't been minted before.
Expand Down Expand Up @@ -127,7 +124,7 @@ pub fn _burn(
sub_id: SubId,
amount: u64,
) {
let asset_id = AssetId::new(contract_id(), sub_id);
let asset_id = AssetId::new(ContractId::this(), sub_id);

require(this_balance(asset_id) >= amount, BurnError::NotEnoughCoins);

Expand Down
2 changes: 1 addition & 1 deletion libs/src/reentrancy.sw
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub fn reentrancy_guard() {
/// ```
pub fn is_reentrant() -> bool {
// Get our current contract ID
let this_id = contract_id();
let this_id = ContractId::this();

// Reentrancy cannot occur in an external context. If not detected by the time we get to the
// bottom of the call_frame stack, then no reentrancy has occured.
Expand Down
2 changes: 1 addition & 1 deletion tests/src/admin/Forc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ license = "Apache-2.0"
name = "admin_test"

[dependencies]
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.1" }
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.3" }
sway_libs = { path = "../../../libs" }
2 changes: 1 addition & 1 deletion tests/src/native_asset/Forc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ license = "Apache-2.0"
name = "native_asset_lib"

[dependencies]
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.1" }
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.3" }
sway_libs = { path = "../../../libs" }
2 changes: 1 addition & 1 deletion tests/src/ownership/Forc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ license = "Apache-2.0"
name = "ownership_test"

[dependencies]
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.1" }
standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.3" }
sway_libs = { path = "../../../libs" }
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
contract;

use std::{auth::*, call_frames::contract_id, constants::ZERO_B256};
use std::{auth::*, constants::ZERO_B256};

use reentrancy_target_abi::Target;
use reentrancy_attacker_abi::Attacker;
Expand Down Expand Up @@ -46,17 +46,17 @@ impl Attacker for Contract {
}

fn evil_callback_1() {
assert(abi(Attacker, contract_id().bits()).launch_attack(get_msg_sender_id_or_panic()));
assert(abi(Attacker, ContractId::this().bits()).launch_attack(get_msg_sender_id_or_panic()));
}

fn evil_callback_2() {
abi(Attacker, contract_id()
abi(Attacker, ContractId::this()
.bits())
.launch_thwarted_attack_1(get_msg_sender_id_or_panic());
}

fn evil_callback_3() {
abi(Attacker, contract_id()
abi(Attacker, ContractId::this()
.bits())
.launch_thwarted_attack_2(get_msg_sender_id_or_panic());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/src/reentrancy/reentrancy_target_contract/src/main.sw
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
contract;

use std::{auth::*, call_frames::contract_id};
use std::auth::*;
use sway_libs::reentrancy::*;

use reentrancy_attacker_abi::Attacker;
Expand Down Expand Up @@ -48,7 +48,7 @@ impl Target for Contract {
}

fn intra_contract_call() {
abi(Target, contract_id()
abi(Target, ContractId::this()
.bits())
.cross_function_reentrance_denied();
}
Expand Down
Loading