-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#86dt6db2x - Improve new get methods to avoid returning misleading se…
…ntinel values
- Loading branch information
Mirella de Medeiros
committed
Apr 30, 2024
1 parent
1adf40b
commit 441cd41
Showing
4 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
File renamed without changes.
12 changes: 12 additions & 0 deletions
12
boa3_test/test_sc/interop_test/storage/StorageTryGetExists.py
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 @@ | ||
from boa3.builtin.compile_time import public | ||
from boa3.sc.storage import try_get_int, put_int | ||
|
||
|
||
@public | ||
def put_value(key: bytes, value: int): | ||
put_int(key, value) | ||
|
||
|
||
@public | ||
def get_value(key: bytes) -> bool: | ||
return try_get_int(key)[1] |
12 changes: 12 additions & 0 deletions
12
boa3_test/test_sc/interop_test/storage/StorageTryGetValue.py
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 @@ | ||
from boa3.builtin.compile_time import public | ||
from boa3.sc.storage import try_get_int, put_int | ||
|
||
|
||
@public | ||
def put_value(key: bytes, value: int): | ||
put_int(key, value) | ||
|
||
|
||
@public | ||
def get_value(key: bytes) -> int: | ||
return try_get_int(key)[0] |
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