diff --git a/boa/blockchain/vm/System/ExecutionEngine.py b/boa/blockchain/vm/System/ExecutionEngine.py index f80e32a34..d14e5db9c 100644 --- a/boa/blockchain/vm/System/ExecutionEngine.py +++ b/boa/blockchain/vm/System/ExecutionEngine.py @@ -4,10 +4,17 @@ class ExecutionEngine(): pass -#def GetScriptContainer(): -# pass +def GetScriptContainer(): + pass + + +def GetExecutingScriptHash(): + pass + +def GetCallingScriptHash(): + pass -#def GetExecutingScriptHash(): -# pass +def GetEntryScriptHash(): + pass \ No newline at end of file diff --git a/boa/code/builtins.py b/boa/code/builtins.py index 0c50db4ae..4efd34256 100644 --- a/boa/code/builtins.py +++ b/boa/code/builtins.py @@ -1,4 +1,8 @@ + + + + class list(list): def __init__(self, length=0): @@ -86,6 +90,36 @@ def __setitem__(self, *args, **kwargs): # real signature unknown pass +# @TODO this currently reverses the order of str1 and str2 +def concat(str1, str2): + """ + range(str1, str2) -> str object + + Return a string that is the concatenation of the two arguments + """ + pass + + +# @TODO this currently does not work +#def substr(source,start_index, count): +# """ +# substr(source, start_index, count) -> list object +# +# Return a subset of a string `source`, starting at `start_index` and +# of length `count` +# """ +# pass + + +# @TODO this currently does not work +#def take(source, count): +# """ +# take(source, count) -> list object +# +# Return a subset of a string or list `source`, starting +# at index 0 and of length `count` +# """ +# pass def range(start, stop): diff --git a/boa/code/token.py b/boa/code/token.py index 079fdcf1b..60bc826ac 100644 --- a/boa/code/token.py +++ b/boa/code/token.py @@ -802,7 +802,7 @@ def convert_method_call(self, pytoken): def is_op_call(self, op): - if op in ['len','abs','min','max',]: + if op in ['len','abs','min','max','concat','substr','take']: return True return False @@ -816,6 +816,12 @@ def convert_op_call(self, op, pytoken=None): return self.convert1(VMOp.MIN,pytoken) elif op == 'max': return self.convert1(VMOp.MAX,pytoken) + elif op == 'concat': + return self.convert1(VMOp.CAT,pytoken) + elif op == 'substr': + return self.convert1(VMOp.SUBSTR,pytoken) + elif op == 'take': + return self.convert1(VMOp.LEFT,pytoken) return None def is_notify_call(self, op): diff --git a/boa/tests/src/ConcatTest.py b/boa/tests/src/ConcatTest.py new file mode 100644 index 000000000..409515523 --- /dev/null +++ b/boa/tests/src/ConcatTest.py @@ -0,0 +1,13 @@ +from boa.code.builtins import concat + +def Main(): + + str1 = 'hello' + str2 = 'world' + + str3 = concat(str1,str2) + + #this ends up being 'worldhello' + #need to reverse the parameters... + + return str3 \ No newline at end of file