Created
October 14, 2017 22:13
-
-
Save D-Nice/6ef6e37e982340b177a4a14baf93249a 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
contract Precompile { | |
function foo (bytes) returns (bytes32); | |
} | |
contract Testcontract { | |
bytes32 last; | |
event Debug(string message, bytes32 res); | |
Precompile prec = Precompile(0x0000000000000000000000000000000000000002); | |
function testMe () { | |
bytes memory s = "hello"; | |
last = prec.foo("hello"); | |
Debug("testMe()", last); | |
Debug("sha", sha256(s)); | |
} | |
function test () returns (bytes32 b) { | |
string memory x = "hello"; | |
bytes memory r; | |
uint len = bytes(x).length; | |
assembly { | |
let a := 0x0000000000000000000000000000000000000002 | |
let v := 0 | |
call(200000, a, v, add(x,0x20), len, r, 0x20) | |
pop | |
b := mload(r) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment