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: bump forc to 0.66.6 #3617

Merged
merged 9 commits into from
Jan 24, 2025
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
7 changes: 7 additions & 0 deletions .changeset/lemon-avocados-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@internal/forc": patch
"create-fuels": patch
petertonysmith94 marked this conversation as resolved.
Show resolved Hide resolved
"@fuel-ts/versions": patch
---

chore: bump `forc` to `0.66.6`
2 changes: 1 addition & 1 deletion apps/create-fuels-counter-guide/fuel-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
channel = "testnet"

[components]
forc = "0.66.5"
forc = "0.66.6"
fuel-core = "0.40.2"
10 changes: 1 addition & 9 deletions apps/docs/sway/liquidity-pool/src/main.sw
Original file line number Diff line number Diff line change
@@ -1,40 +1,32 @@
// #region deposit-and-withdraw-cookbook-1
contract;

use std::{asset::{mint_to, transfer,}, call_frames::{msg_asset_id,}, context::msg_amount,};
use std::{asset::{mint_to, transfer}, call_frames::msg_asset_id, context::msg_amount};
use std::constants::ZERO_B256;

abi LiquidityPool {
#[payable]
fn deposit(recipient: Address);
#[payable]
fn withdraw(recipient: Address);
}

configurable {
TOKEN: AssetId = AssetId::from(0x0000000000000000000000000000000000000000000000000000000000000000),
}

impl LiquidityPool for Contract {
#[payable]
fn deposit(recipient: Address) {
assert(TOKEN == msg_asset_id());
assert(0 < msg_amount());

// Mint two times the amount.
let amount_to_mint = msg_amount() * 2;

// Mint some LP token based upon the amount of the base token.
mint_to(Identity::Address(recipient), ZERO_B256, amount_to_mint);
}

#[payable]
fn withdraw(recipient: Address) {
assert(0 < msg_amount());

// Amount to withdraw.
let amount_to_transfer = msg_amount() / 2;

// Transfer base token to recipient.
transfer(Identity::Address(recipient), TOKEN, amount_to_transfer);
}
Expand Down
5 changes: 3 additions & 2 deletions apps/docs/sway/simple-token/src/main.sw
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// #region inter-contract-calls-1
contract;

use ::simple_token_abi::SimpleToken;

use std::hash::*;
use simple_token_abi::SimpleToken;

storage {
balances: StorageMap<b256, u64> = StorageMap {},
}

impl SimpleToken for Contract {
#[storage(read, write)]
fn deposit(address: b256, amount: u64) {
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/sway/token-depositor/src/main.sw
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ contract;

use std::auth::msg_sender;

use ::simple_token_abi::SimpleToken;
use simple_token_abi::SimpleToken;

abi TokenDepositor {
fn deposit_to_simple_token(contract_id: b256, amount: u64);
Expand Down
2 changes: 1 addition & 1 deletion internal/forc/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.66.5
0.66.6
Original file line number Diff line number Diff line change
Expand Up @@ -160,17 +160,17 @@ const abi = {
{
"name": "SHOULD_RETURN",
"concreteTypeId": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903",
"offset": 2816
"offset": 2584
},
{
"name": "AN_OPTION",
"concreteTypeId": "2da102c46c7263beeed95818cd7bee801716ba8303dddafdcd0f6c9efda4a0f1",
"offset": 2792
"offset": 2560
},
{
"name": "A_GENERIC_STRUCT",
"concreteTypeId": "71df88006611ffff852cf617defb70f77adaf507305088cedd41d276c783aab0",
"offset": 2808
"offset": 2576
}
]
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ const abi = {
{
"name": "FEE",
"concreteTypeId": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b",
"offset": 936
"offset": 888
},
{
"name": "ADDRESS",
"concreteTypeId": "7c5ee1cecf5f8eacd1284feb5f0bf2bdea533a51e2f0c9aabe9236d335989f3b",
"offset": 904
"offset": 856
}
]
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const abi = {
{
"name": "SHOULD_RETURN",
"concreteTypeId": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903",
"offset": 768
"offset": 696
}
]
};
Expand Down
2 changes: 1 addition & 1 deletion packages/create-fuels/test/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe('CLI', { timeout: 15_000 }, () => {

expect(toolchain).toEqual({ channel: 'testnet' });
expect(components).toEqual({
forc: '0.66.5',
forc: '0.66.6',
'fuel-core': '0.40.2',
});
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
library;

use ::data_structures::*;
use core::ops::Eq;
use ::data_structures::*;

impl Eq for [u8; 4] {
fn eq(self, other: Self) -> bool {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
contract;

use {std::{auth::msg_sender, hash::Hash,},};

use std::{auth::msg_sender, hash::Hash};
enum OptionEnum {
a: Option<u8>,
b: Option<u16>,
}

struct OptionStruct {
one: OptionEnum,
two: Option<u32>,
}

pub enum FoodType {
Tomatoes: (),
}

pub struct Food {
pub name: FoodType,
pub time_planted: Option<u64>,
}

impl Food {
pub fn new(name: FoodType, time_planted: Option<u64>) -> Self {
Self {
Expand All @@ -29,11 +24,9 @@ impl Food {
}
}
}

pub struct GardenVector {
pub inner: [Option<Food>; 10],
}

impl GardenVector {
pub fn new() -> Self {
let initial_val: Option<Food> = None;
Expand All @@ -42,29 +35,23 @@ impl GardenVector {
}
}
}

enum DeepEnum {
a: (bool, [Option<u8>; 3]),
}

struct DeepStruct {
DeepEnum: DeepEnum,
}

struct SomeStruct {
a: u64,
b: u64,
}

enum DiffSizeEnum {
a: u8,
b: b256,
}

storage {
stuff: StorageMap<Identity, SomeStruct> = StorageMap {},
}

abi OptionContract {
#[storage(read)]
fn get_some_struct(id: Identity) -> Option<SomeStruct>;
Expand All @@ -80,62 +67,49 @@ abi OptionContract {
fn type_then_option_then_type(x: u8, y: Option<u8>, z: u8) -> Option<u8>;
fn option_then_type_then_option(x: Option<u8>, y: u8, z: Option<u8>) -> Option<u8>;
}

impl OptionContract for Contract {
#[storage(read)]
fn get_some_struct(id: Identity) -> Option<SomeStruct> {
storage.stuff.get(id).try_read()
}

fn echo_option(arg: Option<u8>) -> Option<u8> {
arg
}

fn echo_struct_enum_option(arg: OptionStruct) -> OptionStruct {
arg
}

fn echo_vec_option(arg: Vec<Option<u32>>) -> Vec<Option<u32>> {
arg
}

fn echo_tuple_option(arg: (Option<u8>, Option<u16>)) -> (Option<u8>, Option<u16>) {
arg
}

fn echo_enum_option(arg: OptionEnum) -> OptionEnum {
arg
}

fn echo_array_option(arg: [Option<u16>; 3]) -> [Option<u16>; 3] {
arg
}

fn print_enum_option_array() -> GardenVector {
GardenVector::new()
}

fn echo_deeply_nested_option(arg: DeepStruct) -> DeepStruct {
arg
}

fn echo_enum_diff_sizes(arg: Option<DiffSizeEnum>) -> Option<DiffSizeEnum> {
arg
}

fn type_then_option_then_type(x: u8, y: Option<u8>, z: u8) -> Option<u8> {
assert_eq(x, 42);
assert_eq(y, Option::None);
assert_eq(z, 43);

y
}

fn option_then_type_then_option(x: Option<u8>, y: u8, z: Option<u8>) -> Option<u8> {
assert_eq(x, Option::None);
assert_eq(y, 42);
assert_eq(z, Option::None);

z
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
contract;

use std::{asset::{transfer,}, bytes::Bytes, logging::log, message::{send_message,},};
use std::{asset::transfer, bytes::Bytes, logging::log, message::send_message};
use custom_errors::{AccessError, InputError};

abi RevertError {
fn validate_inputs(token_id: u64, price: u64);
fn failed_message();
Expand All @@ -12,15 +11,12 @@ abi RevertError {
fn assert_value_ne_5(value: u8);
fn revert_with_0();
}

const BASE_TOKEN_A: AssetId = AssetId::from(0x0000000000000000000000000000000000000000000000000000000000000001);
const BASE_TOKEN_B: AssetId = AssetId::from(0x0000000000000000000000000000000000000000000000000000000000000001);

pub struct ValidInputsEvent {
token_id: u64,
price: u64,
}

impl RevertError for Contract {
fn validate_inputs(token_id: u64, price: u64) {
log(1u8);
Expand All @@ -32,15 +28,12 @@ impl RevertError for Contract {
log(99u8);
require(token_id == 100u64, AccessError::InvalidTokenId);
log(100u8);

assert(price != token_id);

log(ValidInputsEvent {
token_id: token_id,
price: price,
});
}

fn failed_message() {
let mut data = Bytes::new();
data.push(1);
Expand All @@ -52,33 +45,28 @@ impl RevertError for Contract {
0,
);
}

fn failed_transfer() {
let amount = 1;
let address = 0x0000000000000000000000000000000000000000000000000000000000000001;
let user = Address::from(address);
transfer(Identity::Address(user), BASE_TOKEN_A, amount);
}

fn failed_transfer_revert() {
let amount = 0;
let address = 0x0000000000000000000000000000000000000000000000000000000000000001;
let user = Address::from(address);
transfer(Identity::Address(user), BASE_TOKEN_B, amount);
}

fn assert_value_eq_10(value: u8) {
log("FOO");
assert_eq(value, 10);
}

fn assert_value_ne_5(value: u8) {
log("BAZ");
log(10u8);
assert_ne(value, 5);
log(27u8);
}

fn revert_with_0() {
revert(0);
}
Expand Down
Loading
Loading