Last active
October 28, 2015 06:39
-
-
Save tinybike/5d5820cf01eedb6f8c71 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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