Skip to content
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

add support for System.Runtime.CurrentSigners SYSCALL #1274

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion boa3/builtin/interop/runtime/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
'invocation_counter',
'entry_script_hash',
'script_container',
'get_current_signers',
]


from collections.abc import Sequence
from typing import Any

from boa3.builtin.interop.blockchain import Transaction
from boa3.builtin.interop.blockchain import Transaction, Signer
from boa3.builtin.interop.contract.callflagstype import CallFlags
from boa3.builtin.interop.runtime.notification import Notification
from boa3.builtin.interop.runtime.triggertype import TriggerType
Expand Down Expand Up @@ -82,6 +83,15 @@ def log(message: str):
"""
pass

def get_current_signers() -> list[Signer]:
"""
Get the Signers of the current transaction.

:return: Return an array of all signers of the transaction.
:rtype: list[Signer]
"""
pass


def get_trigger() -> TriggerType:
"""
Expand Down
5 changes: 4 additions & 1 deletion boa3/internal/model/builtin/interop/interop.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from boa3.internal.model.builtin.interop.policy import *
from boa3.internal.model.builtin.interop.role import *
from boa3.internal.model.builtin.interop.runtime import *
from boa3.internal.model.builtin.interop.runtime.getcurrentsignersmethod import GetCurrentSignersMethod
from boa3.internal.model.builtin.interop.stdlib import *
from boa3.internal.model.builtin.interop.storage import *
from boa3.internal.model.event import Event
Expand Down Expand Up @@ -164,6 +165,7 @@ def interop_events(cls) -> list[Event]:
GasLeft = GasLeftProperty()
GetNetwork = GetNetworkMethod()
GetNotifications = GetNotificationsMethod(NotificationType)
GetCurrentSigners = GetCurrentSignersMethod(SignerType)
GetRandom = GetRandomMethod()
GetTrigger = GetTriggerMethod(TriggerType)
InvocationCounter = InvocationCounterProperty()
Expand Down Expand Up @@ -396,7 +398,8 @@ def interop_events(cls) -> list[Event]:
GetTrigger,
LoadScript,
Log,
Notify
Notify,
GetCurrentSigners
],
packages=[NotificationModule,
TriggerTypeModule
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from boa3.internal.model.builtin.interop.blockchain import SignerType
from boa3.internal.model.builtin.interop.interopmethod import InteropMethod
from boa3.internal.model.variable import Variable

class GetCurrentSignersMethod(InteropMethod):
def __init__(self, signer_type: SignerType):
from boa3.internal.model.type.type import Type
identifier = 'get_current_signers'
syscall = 'System.Runtime.CurrentSigners'
args: dict[str, Variable] = {}
super().__init__(identifier, syscall, args, return_type=Type.list.build([signer_type]))
Loading