-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Compute calldata offset on B256
argument
#203
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Syntax highlighting of sway files as rust | ||
*.sw linguist-language=Rust |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
packages/fuels-abigen-macro/tests/test_projects/auth_testing_abi/Forc.lock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[[package]] | ||
name = 'auth_testing_abi' | ||
dependencies = ['std git+https://github.com/FuelLabs/sway?branch=master#b0ab3f8a67f71f6697266c36394ef56d429637aa'] | ||
|
||
[[package]] | ||
name = 'core' | ||
dependencies = [] | ||
|
||
[[package]] | ||
name = 'std' | ||
source = 'git+https://github.com/FuelLabs/sway?branch=master#b0ab3f8a67f71f6697266c36394ef56d429637aa' | ||
dependencies = ['core'] |
8 changes: 8 additions & 0 deletions
8
packages/fuels-abigen-macro/tests/test_projects/auth_testing_abi/Forc.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[project] | ||
authors = ["Fuel Labs <contact@fuel.sh>"] | ||
entry = "main.sw" | ||
license = "Apache-2.0" | ||
name = "auth_testing_abi" | ||
|
||
[dependencies] | ||
std = { git = "https://github.com/FuelLabs/sway", branch = "master" } |
Empty file.
11 changes: 11 additions & 0 deletions
11
packages/fuels-abigen-macro/tests/test_projects/auth_testing_abi/src/main.sw
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
library auth_testing_abi; | ||
|
||
use std::address::Address; | ||
use std::contract_id::ContractId; | ||
use std::chain::auth::*; | ||
use std::result::*; | ||
|
||
abi AuthTesting { | ||
fn is_caller_external() -> bool; | ||
fn check_msg_sender(expected_id: Address) -> bool; | ||
} |
19 changes: 19 additions & 0 deletions
19
packages/fuels-abigen-macro/tests/test_projects/auth_testing_contract/Forc.lock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[[package]] | ||
name = 'auth_testing_abi' | ||
dependencies = ['std git+https://github.com/FuelLabs/sway?branch=master#35cac1b6b4a1ca21e2b617d9334dcafa1363f737'] | ||
|
||
[[package]] | ||
name = 'auth_testing_contract' | ||
dependencies = [ | ||
'auth_testing_abi', | ||
'std git+https://github.com/FuelLabs/sway?branch=master#35cac1b6b4a1ca21e2b617d9334dcafa1363f737', | ||
] | ||
|
||
[[package]] | ||
name = 'core' | ||
dependencies = [] | ||
|
||
[[package]] | ||
name = 'std' | ||
source = 'git+https://github.com/FuelLabs/sway?branch=master#35cac1b6b4a1ca21e2b617d9334dcafa1363f737' | ||
dependencies = ['core'] |
9 changes: 9 additions & 0 deletions
9
packages/fuels-abigen-macro/tests/test_projects/auth_testing_contract/Forc.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[project] | ||
authors = ["Fuel Labs <contact@fuel.sh>"] | ||
entry = "main.sw" | ||
license = "Apache-2.0" | ||
name = "auth_testing_contract" | ||
|
||
[dependencies] | ||
std = { git = "https://github.com/FuelLabs/sway", branch = "master" } | ||
auth_testing_abi = { path = "../auth_testing_abi"} |
38 changes: 38 additions & 0 deletions
38
...-macro/tests/test_projects/auth_testing_contract/out/debug/auth_testing_contract-abi.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
[ | ||
{ | ||
"type": "function", | ||
"inputs": [], | ||
"name": "is_caller_external", | ||
"outputs": [ | ||
{ | ||
"name": "", | ||
"type": "bool", | ||
"components": null | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "function", | ||
"inputs": [ | ||
{ | ||
"name": "expected_id", | ||
"type": "struct Address", | ||
"components": [ | ||
{ | ||
"name": "value", | ||
"type": "b256", | ||
"components": null | ||
} | ||
] | ||
} | ||
], | ||
"name": "check_msg_sender", | ||
"outputs": [ | ||
{ | ||
"name": "", | ||
"type": "bool", | ||
"components": null | ||
} | ||
] | ||
} | ||
] |
Binary file added
BIN
+1.23 KB
...bigen-macro/tests/test_projects/auth_testing_contract/out/debug/auth_testing_contract.bin
Binary file not shown.
32 changes: 32 additions & 0 deletions
32
packages/fuels-abigen-macro/tests/test_projects/auth_testing_contract/src/main.sw
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
contract; | ||
|
||
use std::address::Address; | ||
use std::chain::auth::*; | ||
use std::contract_id::ContractId; | ||
use auth_testing_abi::*; | ||
use std::result::*; | ||
use std::assert::assert; | ||
|
||
impl AuthTesting for Contract { | ||
fn is_caller_external() -> bool { | ||
caller_is_external() | ||
} | ||
|
||
fn check_msg_sender(expected_id: Address) -> bool { | ||
let result: Result<Sender, AuthError> = msg_sender(); | ||
let mut ret = false; | ||
if result.is_err() { | ||
ret = false; | ||
} else { | ||
let unwrapped = result.unwrap(); | ||
if let Sender::Address(v) = unwrapped { | ||
assert(v == expected_id); | ||
ret = true; | ||
} else { | ||
ret = false; | ||
} | ||
}; | ||
|
||
ret | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
fuels-rs
repo probably needs this: https://github.com/FuelLabs/sway/blob/master/.gitattributes for Sway syntax highlighting.