forked from ethereum/fe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support for string type items in structs and test it as part of i…
…ssue ethereum#343
- Loading branch information
Showing
5 changed files
with
115 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
struct TodoItem: | ||
amount: u256 | ||
content: String<100> | ||
contract Foo: | ||
pub def bar(): | ||
(42,).abi_encode() | ||
ti1: TodoItem | ||
ti2: TodoItem | ||
|
||
pub def set_item(): | ||
self.ti1.content = String<100>("Fooooo") | ||
self.ti2.content = String<100>("Fooooo2") | ||
|
||
pub def get_number() -> u256: | ||
return self.ti1.amount | ||
|
||
pub def get_some_string() -> String<100>: | ||
return self.ti1.content.to_mem() |
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,17 @@ | ||
struct TodoItem: | ||
amount: u256 | ||
content: String<100> | ||
contract Foo: | ||
ti1: TodoItem | ||
ti2: TodoItem | ||
|
||
pub def set_item(): | ||
self.ti1.content = String<100>("Fooooo") | ||
self.ti2.content = String<100>("Fooooo2") | ||
|
||
pub def get_number() -> u256: | ||
return self.ti1.amount | ||
|
||
pub def get_some_string() -> String<100>: | ||
self.set_item() | ||
return self.ti1.content.to_mem() |
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