Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Events
- event RequestReceived(bytes s);
- event WorldCreated(bytes32 indexed worldName, address indexed sender, address result );
- function createWorld(bytes32 name) returns (World a){
- RequestReceived("createWorld fired");
- World w = new World(name);
- worldContracts.push(w);
- WorldCreated(name,msg.sender,w);
- return w;
- }
- public static string CreateWorld(string world)
- {
- var web3 = new Web3(Resources.Server);
- // Contract address
- var contract = web3.Eth.GetContract(Resources.ContractInterface2, address);
- var add = contract.GetFunction("createWorld"); // Add method
- var worldCreatedEvent = contract.GetEvent("WorldCreated");
- var filterAll = worldCreatedEvent.CreateFilterAsync().Result;
- var totalGas = GenericUtil.GetGasPrice(add, world);
- UnlockAccountForTransaction();
- var callResult = add.SendTransactionAsync("0x13111c7C98dFb371A4dd6cD1B1D9E6285bE68d2e", totalGas, new HexBigInteger(0), world).Result;
- var theResult = GenericUtil.GetReceiptAsync(web3, callResult);
- var log = worldCreatedEvent.GetAllChanges<WorldCreatedEvent>(filterAll).Result;
- return log[0].Event.Result;
- }
- var filterAll = worldCreatedEvent.CreateFilterAsync().Result;
- var filterAll = worldCreatedEvent.CreateFilterAsync(world).Result;
- debug.traceTransaction("0x....");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement