Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
pragma solidity ^0.4.7;
contract usingCallback {
function __callback(uint id, string s) {}
}
contract A {
usingCallback C;
uint queryId;
function A () {}
function getString() returns(uint _queryId) {
C = usingCallback(msg.sender);
C.__callback(queryId++, 'hello World');
_queryId = queryId;
}
}
contract B is usingCallback {
A a;
string s;
uint queryId;
function B (address _a) {
a = A(_a);
}
function test () {
queryId = a.getString();
}
function __callback(uint id, string _s) {
if (id != queryId) {
throw;
}
s = _s;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.