Skip to content

Commit

Permalink
CU-86drpndam - Refactor example_tests/test_wrapped_neo.py to use BoaC…
Browse files Browse the repository at this point in the history
…onstructor
  • Loading branch information
Mirella de Medeiros committed Mar 18, 2024
1 parent 095a317 commit b326d20
Show file tree
Hide file tree
Showing 2 changed files with 650 additions and 595 deletions.
28 changes: 6 additions & 22 deletions boa3_test/tests/boatestcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,10 @@ def from_notification(cls, n: noderpc.Notification):
try:
return super().from_notification(n)
except ValueError:
from neo3.api import StackItemType
stack = n.state.as_list()

try:
source = stack[0].as_uint160()
except ValueError:
source = stack[0].as_none()

try:
destination = stack[1].as_uint160()
except ValueError:
destination = stack[1].as_none()

source = stack[0].as_uint160() if stack[0].type != StackItemType.ANY else stack[0].as_none()
destination = stack[1].as_uint160() if stack[1].type != StackItemType.ANY else stack[1].as_none()
amount = stack[2].as_int()
return cls(source, destination, amount)

Expand All @@ -119,18 +111,10 @@ class Nep11TransferEvent(Nep17TransferEvent):

@classmethod
def from_notification(cls, n: noderpc.Notification):
from neo3.api import StackItemType
stack = n.state.as_list()

try:
source = stack[0].as_uint160()
except ValueError:
source = stack[0].as_none()

try:
destination = stack[1].as_uint160()
except ValueError:
destination = stack[1].as_none()

source = stack[0].as_uint160() if stack[0].type != StackItemType.ANY else stack[0].as_none()
destination = stack[1].as_uint160() if stack[1].type != StackItemType.ANY else stack[1].as_none()
amount = stack[2].as_int()
token_id = stack[3].as_str()
return cls(source, destination, amount, token_id)
Expand Down
Loading

0 comments on commit b326d20

Please sign in to comment.