Skip to content

Commit

Permalink
add support for System.Runtime.CurrentSigners SYSCALL
Browse files Browse the repository at this point in the history
  • Loading branch information
ixje committed Aug 21, 2024
1 parent 58d33fd commit a3612bf
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
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]))

0 comments on commit a3612bf

Please sign in to comment.