Skip to content

Commit

Permalink
chore: formatted all sway projects (#1211)
Browse files Browse the repository at this point in the history
  • Loading branch information
nedsalk committed Aug 28, 2023
1 parent 80a777f commit c3ed0f2
Show file tree
Hide file tree
Showing 55 changed files with 646 additions and 514 deletions.
2 changes: 2 additions & 0 deletions .changeset/light-cougars-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
40 changes: 20 additions & 20 deletions apps/docs-snippets/projects/Forc.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
[workspace]
members = [
"counter",
"echo-enum",
"log-values",
"sum-script",
"echo-values",
"simple-token",
"sum-option-u8",
"employee-data",
"echo-u64-array",
"return-context",
"token-depositor",
"simple-predicate",
"simple-token-abi",
"echo-configurables",
"transfer-to-address",
"return-true-predicate",
"echo-employee-data-vector",
"whitelisted-address-predicate",
"echo-evm-address",
"script-transfer-to-contract"
"counter",
"echo-enum",
"log-values",
"sum-script",
"echo-values",
"simple-token",
"sum-option-u8",
"employee-data",
"echo-u64-array",
"return-context",
"token-depositor",
"simple-predicate",
"simple-token-abi",
"echo-configurables",
"transfer-to-address",
"return-true-predicate",
"echo-employee-data-vector",
"whitelisted-address-predicate",
"echo-evm-address",
"script-transfer-to-contract",
]
14 changes: 7 additions & 7 deletions apps/docs-snippets/projects/echo-configurables/src/main.sw
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
contract;

enum MyEnum {
Checked: (),
Pending: ()
Checked: (),
Pending: (),
}

struct MyStruct {
x: u8,
y: u8,
state: MyEnum
x: u8,
y: u8,
state: MyEnum,
}

configurable {
Expand All @@ -19,8 +19,8 @@ configurable {
my_struct: MyStruct = MyStruct {
x: 1,
y: 2,
state: MyEnum::Pending
}
state: MyEnum::Pending,
},
}

abi EchoConfigurables {
Expand Down
1 change: 0 additions & 1 deletion apps/docs-snippets/projects/echo-enum/src/main.sw
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ impl EchoEnum for Contract {
state_error
}
// #endregion enum-2

fn echo_user_error_enum(user_error: UserError) -> UserError {
user_error
}
Expand Down
13 changes: 6 additions & 7 deletions apps/docs-snippets/projects/echo-u64-array/src/main.sw
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
contract;

struct EmployeeData {
name: str[8],
age: u8,
salary: u64,
idHash: b256,
ratings: [u8; 3],
isActive: bool,
name: str[8],
age: u8,
salary: u64,
idHash: b256,
ratings: [u8; 3],
isActive: bool,
}

abi EchoU64Array {
Expand All @@ -21,7 +21,6 @@ impl EchoU64Array for Contract {
u64_array
}
// #endregion arrays-2

fn echo_data(data: EmployeeData) -> EmployeeData {
data
}
Expand Down
7 changes: 1 addition & 6 deletions apps/docs-snippets/projects/return-context/src/main.sw
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
contract;

use std::{
context::{
msg_amount
},
};

use std::{context::{msg_amount}};

abi ReturnContext {
#[payable]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ script;

use std::token::force_transfer_to_contract;

fn main(contract_address: b256, asset_a: AssetId, amount_asset_a: u64, asset_b: AssetId, amount_asset_b: u64) -> bool {
fn main(
contract_address: b256,
asset_a: AssetId,
amount_asset_a: u64,
asset_b: AssetId,
amount_asset_b: u64,
) -> bool {
let wrapped_contract = ContractId::from(contract_address);

force_transfer_to_contract(wrapped_contract, asset_a, amount_asset_a);
force_transfer_to_contract(wrapped_contract, asset_b, amount_asset_b);
force_transfer_to_contract(wrapped_contract, asset_a, amount_asset_a);
force_transfer_to_contract(wrapped_contract, asset_b, amount_asset_b);
true
}
// #endregion custom-transactions-1
2 changes: 1 addition & 1 deletion apps/docs-snippets/projects/sum-script/src/main.sw
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
script;

configurable {
AMOUNT: u8 = 10
AMOUNT: u8 = 10,
}

fn main(inpputed_amount: u8) -> u8 {
Expand Down
2 changes: 1 addition & 1 deletion apps/docs-snippets/projects/token-depositor/Forc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ license = "Apache-2.0"
name = "token-depositor"

[dependencies]
simple_token_abi = { path = "../simple-token-abi"}
simple_token_abi = { path = "../simple-token-abi" }
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
predicate;

configurable {
WHITELISTED: b256 = 0xa703b26833939dabc41d3fcaefa00e62cee8e1ac46db37e0fa5d4c9fe30b4132
WHITELISTED: b256 = 0xa703b26833939dabc41d3fcaefa00e62cee8e1ac46db37e0fa5d4c9fe30b4132,
}

fn main(address: b256) -> bool {
Expand Down
Loading

0 comments on commit c3ed0f2

Please sign in to comment.