-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE: - `U256` is not supported anymore. If used in sway, the SDK will return a runtime error.
- Loading branch information
Showing
7 changed files
with
42 additions
and
40 deletions.
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
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
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
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 |
---|---|---|
@@ -1,40 +1,36 @@ | ||
contract; | ||
|
||
use std::u256::U256; | ||
|
||
#[allow(dead_code)] | ||
enum SomeEnum<T> { | ||
A: bool, | ||
B: T, | ||
} | ||
|
||
abi MyContract { | ||
fn u256_sum_and_ret(some_u256: U256) -> U256; | ||
fn u256_in_enum_input(some_enum: SomeEnum<U256>); | ||
fn u256_in_enum_output() -> SomeEnum<U256>; | ||
fn u256_sum_and_ret(some_u256: u256) -> u256; | ||
fn u256_in_enum_output() -> SomeEnum<u256>; | ||
fn u256_in_enum_input(some_enum: SomeEnum<u256>); | ||
} | ||
|
||
impl MyContract for Contract { | ||
#[allow(deprecated)] | ||
fn u256_sum_and_ret(arg: U256) -> U256 { | ||
arg + U256::from((3, 4, 5, 6)) | ||
fn u256_sum_and_ret(arg: u256) -> u256 { | ||
arg + 0x0000000000000003000000000000000400000000000000050000000000000006u256 | ||
} | ||
|
||
fn u256_in_enum_output() -> SomeEnum<u256> { | ||
SomeEnum::B( | ||
0x0000000000000001000000000000000200000000000000030000000000000004u256, | ||
) | ||
} | ||
|
||
#[allow(deprecated)] | ||
fn u256_in_enum_input(some_enum: SomeEnum<U256>) { | ||
fn u256_in_enum_input(some_enum: SomeEnum<u256>) { | ||
if let SomeEnum::B(some_u256) = some_enum { | ||
let expected_u256 = U256::from((2, 3, 4, 5)); | ||
require( | ||
some_u256 == expected_u256, | ||
some_u256 == 0x0000000000000002000000000000000300000000000000040000000000000005u256, | ||
"given u256 didn't match the expected u256", | ||
); | ||
} else { | ||
require(false, "enum was not of variant B: u256"); | ||
} | ||
} | ||
|
||
#[allow(deprecated)] | ||
fn u256_in_enum_output() -> SomeEnum<U256> { | ||
SomeEnum::B(U256::from((1, 2, 3, 4))) | ||
} | ||
} |
7 changes: 2 additions & 5 deletions
7
packages/fuels/tests/types/predicates/predicate_u256/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 |
---|---|---|
@@ -1,8 +1,5 @@ | ||
predicate; | ||
|
||
use std::u256::U256; | ||
|
||
#[allow(deprecated)] | ||
fn main(arg: U256) -> bool { | ||
arg == U256::from((10, 11, 12, 13)) | ||
fn main(arg: u256) -> bool { | ||
arg == 0x000000000000000a000000000000000b000000000000000c000000000000000du256 | ||
} |
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 |
---|---|---|
@@ -1,8 +1,5 @@ | ||
script; | ||
|
||
use std::u256::U256; | ||
|
||
#[allow(deprecated)] | ||
fn main(arg: U256) -> U256 { | ||
arg + U256::from((6, 7, 8, 9)) | ||
fn main(arg: u256) -> u256 { | ||
arg + 0x0000000000000006000000000000000700000000000000080000000000000009u256 | ||
} |
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