Skip to content

Instantly share code, notes, and snippets.

@tinybike
Last active October 28, 2015 06:39
Show Gist options
  • Select an option

  • Save tinybike/5d5820cf01eedb6f8c71 to your computer and use it in GitHub Desktop.

Select an option

Save tinybike/5d5820cf01eedb6f8c71 to your computer and use it in GitHub Desktop.
def concat():
t = text("i'm a long text variable! lololololololololololololol")
textlen = len(t)
a = array(textlen + 2)
a[0] = tx.origin
a[1] = msg.gas
i = 0
while i < textlen:
a[i + 2] = getch(t, i)
i += 1
return(a: arr)
#!/usr/bin/env python
from ethereum import tester
def init(gas_limit=700000000):
s = tester.state()
tester.gas_limit = gas_limit
return tester.state()
def compile(state, filepath, gas=70000000):
return state.abi_contract(filepath, gas=gas)
def run(contract, fn, *args):
return getattr(contract, fn)(*args)
def bin2ascii(bytearr):
return ''.join(map(chr, bytearr))
c = compile(init(), "concat.se")
result = run(c, "concat")
print bin2ascii(result[2:])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment