Commit afbff250 authored by Zvezdin .'s avatar Zvezdin .

bet fix

parent 2623a8fb
......@@ -77,6 +77,7 @@ contract Better {
}
uint[] tmpTest;
uint[] tmpTest2;
constructor() public {
owner = msg.sender;
......@@ -85,9 +86,30 @@ contract Better {
tmpTest.length = 2;
tmpTest[0] = 1;
tmpTest[1] = 2;
//DEBUG temp adds:
tmpTest2.length = 2;
tmpTest2[0] = 1;
tmpTest2[1] = 2;
createEvent(1, 1629829173, "Bulg", "Germ", "Football", tmpTest);
updateBet(1, 2, 123123, [uint(1),3], 7043, 3);
updateBet(1, 1, 123123, [uint(1),3], 7043, 1);
updateBet(1, 2, 321321, [uint(2),1], 1034, 2);
createEvent(2, 1629829173, "Isla", "Germ", "Football", tmpTest2);
//updateBet(2, 1, 420, [uint(5),2], 2043, 1);
updateBet(2, 2, 453, [uint(1),3], 1014, 2);
//createEvent(3, 1629829173, "Germ", "Fran", "Football", tmpTest);
//updateBet(2, 1, 3562, [uint(0),0], 2043, 1);
//updateBet(2, 2, 23748, [uint(1),1], 5034, 2);
_placeBetObject(0x123, 100, 1, 321321);
_placeBetObject(0x123, 90, 2, 453);
//_placeBetObject(0x123, 400, 3, 3562);
}
function getEventIDs() public view returns (uint[]) {
......@@ -106,7 +128,8 @@ contract Better {
closedBetTypes = ev.closedBetTypes;
}
function breakDownBet(Bet bet) private view returns (uint amount, uint betType, uint[2] values, uint odd, address user, uint number) {
function breakDownBet(Bet bet) private view returns (uint id, uint amount, uint betType, uint[2] values, uint odd, address user, uint number) {
id = bet.id;
amount = bet.amount;
betType = bet.betType;
values = bet.values;
......@@ -115,14 +138,14 @@ contract Better {
number = bet.number;
}
function getEventBetByID(uint eventID, uint betID) public betExists(eventID, betID) view returns (uint amount, uint betType, uint[2] values, uint odd, address user, uint number) {
function getEventBetByID(uint eventID, uint betID) public betExists(eventID, betID) view returns (uint id, uint amount, uint betType, uint[2] values, uint odd, address user, uint number) {
Event storage ev = events[eventID];
Bet storage bet = ev.availableBets[ev.idToIndex[betID]];
return breakDownBet(bet);
}
function getEventPlacedBetByIndex(uint eventID, uint idx) public placedBetExists(eventID, idx) view returns (uint amount, uint betType, uint[2] values, uint odd, address user, uint number) {
function getEventPlacedBetByIndex(uint eventID, uint idx) public placedBetExists(eventID, idx) view returns (uint id, uint amount, uint betType, uint[2] values, uint odd, address user, uint number) {
Event storage ev = events[eventID];
Bet storage bet = ev.placedBets[idx];
......@@ -178,19 +201,24 @@ contract Better {
bet.number = number;
}
//only if event is active
//if bet is not closed
function placeBet(uint eventID, uint betID) public eventActive(eventID) betExists(eventID, betID) betOpen(eventID, betID) payable {
require(msg.value > 0);
function _placeBetObject(address sender, uint amount, uint eventID, uint betID) private {
Event storage ev = events[eventID];
Bet storage avBet = ev.availableBets[ev.idToIndex[betID]];
Bet memory b = avBet; // copy to memory
b.amount = msg.value;
b.user = msg.sender;
b.amount = amount;
b.user = sender;
ev.placedBets.push(b);
}
//only if event is active
//if bet is not closed
function placeBet(uint eventID, uint betID) public eventActive(eventID) betExists(eventID, betID) betOpen(eventID, betID) payable {
require(msg.value > 0);
_placeBetObject(msg.sender, msg.value, eventID, betID);
}
function announceResult(uint eventID, uint betType, uint[2] values) public onlyOwner {
Event storage ev = events[eventID];
......
......@@ -30,7 +30,7 @@ contract Ownable {
//Store this contract's compiled bytecode and ABI
var abi = [{"constant":true,"inputs":[{"name":"eventID","type":"uint256"},{"name":"idx","type":"uint256"}],"name":"getEventPlacedBetByIndex","outputs":[{"name":"amount","type":"uint256"},{"name":"betType","type":"uint256"},{"name":"values","type":"uint256[2]"},{"name":"odd","type":"uint256"},{"name":"user","type":"address"},{"name":"number","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"eventID","type":"uint256"}],"name":"getEventByID","outputs":[{"name":"id","type":"uint256"},{"name":"ts","type":"uint256"},{"name":"home","type":"string"},{"name":"away","type":"string"},{"name":"sport","type":"string"},{"name":"betTypes","type":"uint256[]"},{"name":"closedBetTypes","type":"uint256[]"},{"name":"active","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"value","type":"uint256"}],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getEventIDs","outputs":[{"name":"","type":"uint256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"eventID","type":"uint256"},{"name":"betType","type":"uint256"}],"name":"closeBetType","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"eventID","type":"uint256"},{"name":"betID","type":"uint256"}],"name":"placeBet","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"eventID","type":"uint256"}],"name":"getEventPlacedBetsAmount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"eventID","type":"uint256"},{"name":"betType","type":"uint256"},{"name":"values","type":"uint256[2]"}],"name":"announceResult","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"eventID","type":"uint256"},{"name":"betID","type":"uint256"}],"name":"getEventBetByID","outputs":[{"name":"amount","type":"uint256"},{"name":"betType","type":"uint256"},{"name":"values","type":"uint256[2]"},{"name":"odd","type":"uint256"},{"name":"user","type":"address"},{"name":"number","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"eventID","type":"uint256"},{"name":"betType","type":"uint256"},{"name":"betID","type":"uint256"},{"name":"values","type":"uint256[2]"},{"name":"odd","type":"uint256"},{"name":"number","type":"uint256"}],"name":"updateBet","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"id","type":"uint256"},{"name":"ts","type":"uint256"},{"name":"home","type":"string"},{"name":"away","type":"string"},{"name":"sport","type":"string"},{"name":"betTypes","type":"uint256[]"}],"name":"createEvent","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"eventID","type":"uint256"}],"name":"getEventAvailableBets","outputs":[{"name":"","type":"uint256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isCallerAdmin","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"user","type":"address"},{"indexed":true,"name":"eventID","type":"uint256"},{"indexed":false,"name":"betIndex","type":"uint256"},{"indexed":false,"name":"winnings","type":"uint256"}],"name":"BetWon","type":"event"}];
var bytecode = "60806040523480156200001157600080fd5b5033600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600260048162000064919062000501565b506001600460008154811015156200007857fe5b90600052602060002001819055506002600460018154811015156200009957fe5b9060005260206000200181905550620001bc600163612538356040805190810160405280600481526020017f42756c67000000000000000000000000000000000000000000000000000000008152506040805190810160405280600481526020017f4765726d000000000000000000000000000000000000000000000000000000008152506040805190810160405280600881526020017f466f6f7462616c6c0000000000000000000000000000000000000000000000008152506004805480602002602001604051908101604052809291908181526020018280548015620001a257602002820191906000526020600020905b8154815260200190600101908083116200018d575b5050505050620001ff640100000000026401000000009004565b620001f9600160026201e0f36040805190810160405280600181526020016003815250611b83600362000343640100000000026401000000009004565b62000744565b60003373ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156200025e57600080fd5b600160008881526020019081526020016000209050868160000181905550858160010181905550838160030190805190602001906200029f92919062000530565b5084816002019080519060200190620002ba92919062000530565b5082816004019080519060200190620002d592919062000530565b5081816005019080519060200190620002f0929190620005b7565b50600181600c0160006101000a81548160ff021916908315150217905550600087908060018154018082558091505090600182039060005260206000200160009091929091909150555050505050505050565b6000806000884260016000838152602001908152602001600020600101541115156200036e57600080fd5b3373ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515620003cb57600080fd5b600160008b815260200190815260200160002093506000925060008460080160008a815260200190815260200160002054141562000477578360090180548091906001016200041b919062000609565b506001846009018054905003925083600a01889080600181540180825580915050906001820390600052602060002001600090919290919091505550828460080160008a81526020019081526020016000208190555062000490565b8360080160008981526020019081526020016000205492505b8360090183815481101515620004a257fe5b906000526020600020906009020191508982600101819055508782600201819055508882600301819055508682600401906002620004e29291906200063e565b5085826006018190555084826008018190555050505050505050505050565b8154818355818111156200052b578183600052602060002091820191016200052a919062000683565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200057357805160ff1916838001178555620005a4565b82800160010185558215620005a4579182015b82811115620005a357825182559160200191906001019062000586565b5b509050620005b3919062000683565b5090565b828054828255906000526020600020908101928215620005f6579160200282015b82811115620005f5578251825591602001919060010190620005d8565b5b50905062000605919062000683565b5090565b8154818355818111156200063957600902816009028360005260206000209182019101620006389190620006ab565b5b505050565b826002810192821562000670579160200282015b828111156200066f57825182559160200191906001019062000652565b5b5090506200067f919062000683565b5090565b620006a891905b80821115620006a45760008160009055506001016200068a565b5090565b90565b6200073391905b808211156200072f57600080820160009055600182016000905560028201600090556003820160009055600482016000620006ee919062000736565b60068201600090556007820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600882016000905550600901620006b2565b5090565b90565b506000815560010160009055565b611e0280620007546000396000f3006080604052600436106100c5576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630a23f5fb146100ca5780632d47e66b1461018c5780632e1a7d4d146103b35780633cbb95f6146103e05780633f6f64be1461044c5780634afe62b514610483578063627d04a6146104ad5780636710aec2146104ee5780636f5f754514610554578063ad65b12b14610616578063b2112ae41461069a578063ebf30b84146107e6578063fd31a7d014610868575b600080fd5b3480156100d657600080fd5b506100ff6004803603810190808035906020019092919080359060200190929190505050610897565b6040518087815260200186815260200185600260200280838360005b8381101561013657808201518184015260208101905061011b565b505050509050018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001965050505050505060405180910390f35b34801561019857600080fd5b506101b760048036038101908080359060200190929190505050610a32565b6040518089815260200188815260200180602001806020018060200180602001806020018715151515815260200186810386528c818151815260200191508051906020019080838360005b8381101561021d578082015181840152602081019050610202565b50505050905090810190601f16801561024a5780820380516001836020036101000a031916815260200191505b5086810385528b818151815260200191508051906020019080838360005b83811015610283578082015181840152602081019050610268565b50505050905090810190601f1680156102b05780820380516001836020036101000a031916815260200191505b5086810384528a818151815260200191508051906020019080838360005b838110156102e95780820151818401526020810190506102ce565b50505050905090810190601f1680156103165780820380516001836020036101000a031916815260200191505b50868103835289818151815260200191508051906020019060200280838360005b83811015610352578082015181840152602081019050610337565b50505050905001868103825288818151815260200191508051906020019060200280838360005b83811015610394578082015181840152602081019050610379565b505050509050019d505050505050505050505050505060405180910390f35b3480156103bf57600080fd5b506103de60048036038101908080359060200190929190505050610d08565b005b3480156103ec57600080fd5b506103f5610ded565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561043857808201518184015260208101905061041d565b505050509050019250505060405180910390f35b34801561045857600080fd5b506104816004803603810190808035906020019092919080359060200190929190505050610e45565b005b6104ab6004803603810190808035906020019092919080359060200190929190505050610f68565b005b3480156104b957600080fd5b506104d8600480360381019080803590602001909291905050506112da565b6040518082815260200191505060405180910390f35b3480156104fa57600080fd5b50610552600480360381019080803590602001909291908035906020019092919080604001906002806020026040519081016040528092919082600260200280828437820191505050505091929192905050506112ff565b005b34801561056057600080fd5b506105896004803603810190808035906020019092919080359060200190929190505050611538565b6040518087815260200186815260200185600260200280838360005b838110156105c05780820151818401526020810190506105a5565b505050509050018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001965050505050505060405180910390f35b34801561062257600080fd5b50610698600480360381019080803590602001909291908035906020019092919080359060200190929190806040019060028060200260405190810160405280929190826002602002808284378201915050505050919291929080359060200190929190803590602001909291905050506116fd565b005b3480156106a657600080fd5b506107e46004803603810190808035906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192905050506118b2565b005b3480156107f257600080fd5b50610811600480360381019080803590602001909291905050506119ed565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610854578082015181840152602081019050610839565b505050509050019250505060405180910390f35b34801561087457600080fd5b5061087d611a5d565b604051808215151515815260200191505060405180910390f35b6000806108a2611af8565b600080600080600089896000600160008481526020019081526020016000209050600081600b01838154811015156108d657fe5b9060005260206000209060090201600601541115156108f457600080fd5b600160008e8152602001908152602001600020945084600b018c81548110151561091a57fe5b90600052602060002090600902019350610a17846101006040519081016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820160028060200260405190810160405280929190826002801561099f576020028201915b81548152602001906001019080831161098b575b50505050508152602001600682015481526020016007820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600882015481525050611ab5565b9a509a509a509a509a509a5050505050509295509295509295565b600080606080606080606060008088600160008c815260200190815260200160002091508a995081600101549850816002018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610af85780601f10610acd57610100808354040283529160200191610af8565b820191906000526020600020905b815481529060010190602001808311610adb57829003601f168201915b50505050509750816003018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b975780601f10610b6c57610100808354040283529160200191610b97565b820191906000526020600020905b815481529060010190602001808311610b7a57829003601f168201915b50505050509650816004018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c365780601f10610c0b57610100808354040283529160200191610c36565b820191906000526020600020905b815481529060010190602001808311610c1957829003601f168201915b5050505050955081600501805480602002602001604051908101604052809291908181526020018280548015610c8b57602002820191906000526020600020905b815481526020019060010190808311610c77575b5050505050945081600c0160009054906101000a900460ff16925081600601805480602002602001604051908101604052809291908181526020018280548015610cf457602002820191906000526020600020905b815481526020019060010190808311610ce0575b505050505093505050919395975091939597565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111151515610d5657600080fd5b80600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610de9573d6000803e3d6000fd5b5050565b60606000805480602002602001604051908101604052809291908181526020018280548015610e3b57602002820191906000526020600020905b815481526020019060010190808311610e27575b5050505050905090565b600080833373ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610ea557600080fd5b60016000868152602001908152602001600020925082600701600085815260200190815260200160002060009054906101000a900460ff161515610f4057600183600701600086815260200190815260200160002060006101000a81548160ff021916908315150217905550826006018490806001815401808255809150509060018203906000526020600020016000909192909190915055505b600091505b8260050180549050821015610f61578180600101925050610f45565b5050505050565b600080610f73611b1a565b84426001600083815260200190815260200160002060010154111515610f9857600080fd5b8585600060016000848152602001908152602001600020905060008160090182600801600085815260200190815260200160002054815481101515610fd957fe5b906000526020600020906009020160060154111515610ff757600080fd5b8888600080600160008581526020019081526020016000209150816009018260080160008581526020019081526020016000205481548110151561103757fe5b906000526020600020906009020190508160070160008260030154815260200190815260200160002060009054906101000a900460ff1615151561107a57600080fd5b60003411151561108957600080fd5b600160008e81526020019081526020016000209a508a6009018b60080160008e8152602001908152602001600020548154811015156110c457fe5b906000526020600020906009020199508961010060405190810160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201600280602002604051908101604052809291908260028015611146576020028201915b815481526020019060010190808311611132575b50505050508152602001600682015481526020016007820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600882015481525050985034896000018181525050338960c0019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508a600b0189908060018154018082558091505090600182039060005260206000209060090201600090919290919091506000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040190600261126c929190611b7c565b5060a0820151816006015560c08201518160070160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060e0820151816008015550505050505050505050505050505050565b60008160016000848152602001908152602001600020600b0180549050915050919050565b6000806000803373ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561136157600080fd5b600160008881526020019081526020016000209350600092505b83600b018054905083101561152f5783600b018381548110151561139b57fe5b906000526020600020906009020191508582600301541480156113e357508460006002811015156113c857fe5b60200201518260040160006002811015156113df57fe5b0154145b801561141457508460016002811015156113f957fe5b602002015182600401600160028110151561141057fe5b0154145b15611522578160060154826000015402905060648181151561143257fe5b04905080600260008460070160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550868260070160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f1ce690bab3f0797851d1673f462be38a6378af9c81188730b523525747eba55d8584604051808381526020018281526020019250505060405180910390a35b828060010193505061137b565b50505050505050565b600080611543611af8565b6000806000806000898960006001600084815260200190815260200160002090506000816009018260080160008581526020019081526020016000205481548110151561158c57fe5b9060005260206000209060090201600601541115156115aa57600080fd5b600160008e81526020019081526020016000209450846009018560080160008e8152602001908152602001600020548154811015156115e557fe5b906000526020600020906009020193506116e2846101006040519081016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820160028060200260405190810160405280929190826002801561166a576020028201915b815481526020019060010190808311611656575b50505050508152602001600682015481526020016007820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600882015481525050611ab5565b9a509a509a509a509a509a5050505050509295509295509295565b60008060008842600160008381526020019081526020016000206001015411151561172757600080fd5b3373ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561178357600080fd5b600160008b815260200190815260200160002093506000925060008460080160008a815260200190815260200160002054141561182b578360090180548091906001016117d09190611bbc565b506001846009018054905003925083600a01889080600181540180825580915050906001820390600052602060002001600090919290919091505550828460080160008a815260200190815260200160002081905550611844565b8360080160008981526020019081526020016000205492505b836009018381548110151561185557fe5b906000526020600020906009020191508982600101819055508782600201819055508882600301819055508682600401906002611893929190611bee565b5085826006018190555084826008018190555050505050505050505050565b60003373ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561191057600080fd5b6001600088815260200190815260200160002090508681600001819055508581600101819055508381600301908051906020019061194f929190611c2e565b5084816002019080519060200190611968929190611c2e565b5082816004019080519060200190611981929190611c2e565b508181600501908051906020019061199a929190611cae565b50600181600c0160006101000a81548160ff021916908315150217905550600087908060018154018082558091505090600182039060005260206000200160009091929091909150555050505050505050565b60608160016000848152602001908152602001600020600a01805480602002602001604051908101604052809291908181526020018280548015611a5057602002820191906000526020600020905b815481526020019060010190808311611a3c575b5050505050915050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b600080611ac0611af8565b60008060008660000151955086606001519450866080015193508660a0015192508660c0015191508660e00151905091939550919395565b6040805190810160405280600290602082028038833980820191505090505090565b6101206040519081016040528060008152602001600081526020016000815260200160008152602001611b4b611cfb565b815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b8260028101928215611bab579160200282015b82811115611baa578251825591602001919060010190611b8f565b5b509050611bb89190611d1d565b5090565b815481835581811115611be957600902816009028360005260206000209182019101611be89190611d42565b5b505050565b8260028101928215611c1d579160200282015b82811115611c1c578251825591602001919060010190611c01565b5b509050611c2a9190611d1d565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611c6f57805160ff1916838001178555611c9d565b82800160010185558215611c9d579182015b82811115611c9c578251825591602001919060010190611c81565b5b509050611caa9190611d1d565b5090565b828054828255906000526020600020908101928215611cea579160200282015b82811115611ce9578251825591602001919060010190611cce565b5b509050611cf79190611d1d565b5090565b6040805190810160405280600290602082028038833980820191505090505090565b611d3f91905b80821115611d3b576000816000905550600101611d23565b5090565b90565b611dc591905b80821115611dc157600080820160009055600182016000905560028201600090556003820160009055600482016000611d819190611dc8565b60068201600090556007820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600882016000905550600901611d48565b5090565b90565b5060008155600101600090555600a165627a7a723058208cb3ab565c4c4b666bd85ae2652c5a1a67dce6a7784345b7dfb047ebe90cfcba0029"
var bytecode = "60806040523480156200001157600080fd5b5033600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600260048162000064919062000985565b506001600460008154811015156200007857fe5b90600052602060002001819055506002600460018154811015156200009957fe5b90600052602060002001819055506002600581620000b8919062000985565b50600160056000815481101515620000cc57fe5b9060005260206000200181905550600260056001815481101515620000ed57fe5b906000526020600020018190555062000210600163612538356040805190810160405280600481526020017f42756c67000000000000000000000000000000000000000000000000000000008152506040805190810160405280600481526020017f4765726d000000000000000000000000000000000000000000000000000000008152506040805190810160405280600881526020017f466f6f7462616c6c0000000000000000000000000000000000000000000000008152506004805480602002602001604051908101604052809291908181526020018280548015620001f657602002820191906000526020600020905b815481526020019060010190808311620001e1575b505050505062000426640100000000026401000000009004565b6200024c6001806201e0f36040805190810160405280600181526020016003815250611b8360016200056a640100000000026401000000009004565b62000289600160026204e729604080519081016040528060028152602001600181525061040a60026200056a640100000000026401000000009004565b6200039e600263612538356040805190810160405280600481526020017f49736c61000000000000000000000000000000000000000000000000000000008152506040805190810160405280600481526020017f4765726d000000000000000000000000000000000000000000000000000000008152506040805190810160405280600881526020017f466f6f7462616c6c00000000000000000000000000000000000000000000000081525060058054806020026020016040519081016040528092919081815260200182805480156200038457602002820191906000526020600020905b8154815260200190600101908083116200036f575b505050505062000426640100000000026401000000009004565b620003d96002806101c560408051908101604052806001815260200160038152506103f660026200056a640100000000026401000000009004565b620003fd610123606460016204e72962000728640100000000026401000000009004565b62000420610123605a60026101c562000728640100000000026401000000009004565b62000c93565b60003373ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156200048557600080fd5b60016000888152602001908152602001600020905086816000018190555085816001018190555083816003019080519060200190620004c6929190620009b4565b5084816002019080519060200190620004e1929190620009b4565b5082816004019080519060200190620004fc929190620009b4565b50818160050190805190602001906200051792919062000a3b565b50600181600c0160006101000a81548160ff021916908315150217905550600087908060018154018082558091505090600182039060005260206000200160009091929091909150555050505050505050565b6000806000884260016000838152602001908152602001600020600101541115156200059557600080fd5b3373ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515620005f257600080fd5b600160008b815260200190815260200160002093506000925060008460080160008a81526020019081526020016000205414156200069e5783600901805480919060010162000642919062000a8d565b506001846009018054905003925083600a01889080600181540180825580915050906001820390600052602060002001600090919290919091505550828460080160008a815260200190815260200160002081905550620006b7565b8360080160008981526020019081526020016000205492505b8360090183815481101515620006c957fe5b9060005260206000209060090201915089826001018190555087826002018190555088826003018190555086826004019060026200070992919062000ac2565b5085826006018190555084826008018190555050505050505050505050565b6000806200073562000b07565b60016000868152602001908152602001600020925082600901836008016000868152602001908152602001600020548154811015156200077157fe5b906000526020600020906009020191508161010060405190810160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201600280602002604051908101604052809291908260028015620007f5576020028201915b815481526020019060010190808311620007e0575b50505050508152602001600682015481526020016007820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600882015481525050905085816000018181525050868160c0019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505082600b018190806001815401808255809150509060018203906000526020600020906009020160009091929091909150600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004019060026200091d92919062000b6b565b5060a0820151816006015560c08201518160070160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060e0820151816008015550505050505050505050565b815481835581811115620009af57818360005260206000209182019101620009ae919062000bb0565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620009f757805160ff191683800117855562000a28565b8280016001018555821562000a28579182015b8281111562000a2757825182559160200191906001019062000a0a565b5b50905062000a37919062000bb0565b5090565b82805482825590600052602060002090810192821562000a7a579160200282015b8281111562000a7957825182559160200191906001019062000a5c565b5b50905062000a89919062000bb0565b5090565b81548183558181111562000abd5760090281600902836000526020600020918201910162000abc919062000bd8565b5b505050565b826002810192821562000af4579160200282015b8281111562000af357825182559160200191906001019062000ad6565b5b50905062000b03919062000bb0565b5090565b610120604051908101604052806000815260200160008152602001600081526020016000815260200162000b3a62000c63565b815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b826002810192821562000b9d579160200282015b8281111562000b9c57825182559160200191906001019062000b7f565b5b50905062000bac919062000bb0565b5090565b62000bd591905b8082111562000bd157600081600090555060010162000bb7565b5090565b90565b62000c6091905b8082111562000c5c5760008082016000905560018201600090556002820160009055600382016000905560048201600062000c1b919062000c85565b60068201600090556007820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905560088201600090555060090162000bdf565b5090565b90565b6040805190810160405280600290602082028038833980820191505090505090565b506000815560010160009055565b611e398062000ca36000396000f3006080604052600436106100c5576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630a23f5fb146100ca5780632d47e66b146101935780632e1a7d4d146103ba5780633cbb95f6146103e75780633f6f64be146104535780634afe62b51461048a578063627d04a6146104b45780636710aec2146104f55780636f5f75451461055b578063ad65b12b14610624578063b2112ae4146106a8578063ebf30b84146107f4578063fd31a7d014610876575b600080fd5b3480156100d657600080fd5b506100ff60048036038101908080359060200190929190803590602001909291905050506108a5565b6040518088815260200187815260200186815260200185600260200280838360005b8381101561013c578082015181840152602081019050610121565b505050509050018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200197505050505050505060405180910390f35b34801561019f57600080fd5b506101be60048036038101908080359060200190929190505050610a46565b6040518089815260200188815260200180602001806020018060200180602001806020018715151515815260200186810386528c818151815260200191508051906020019080838360005b83811015610224578082015181840152602081019050610209565b50505050905090810190601f1680156102515780820380516001836020036101000a031916815260200191505b5086810385528b818151815260200191508051906020019080838360005b8381101561028a57808201518184015260208101905061026f565b50505050905090810190601f1680156102b75780820380516001836020036101000a031916815260200191505b5086810384528a818151815260200191508051906020019080838360005b838110156102f05780820151818401526020810190506102d5565b50505050905090810190601f16801561031d5780820380516001836020036101000a031916815260200191505b50868103835289818151815260200191508051906020019060200280838360005b8381101561035957808201518184015260208101905061033e565b50505050905001868103825288818151815260200191508051906020019060200280838360005b8381101561039b578082015181840152602081019050610380565b505050509050019d505050505050505050505050505060405180910390f35b3480156103c657600080fd5b506103e560048036038101908080359060200190929190505050610d1c565b005b3480156103f357600080fd5b506103fc610e01565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561043f578082015181840152602081019050610424565b505050509050019250505060405180910390f35b34801561045f57600080fd5b506104886004803603810190808035906020019092919080359060200190929190505050610e59565b005b6104b26004803603810190808035906020019092919080359060200190929190505050610f7c565b005b3480156104c057600080fd5b506104df600480360381019080803590602001909291905050506110aa565b6040518082815260200191505060405180910390f35b34801561050157600080fd5b50610559600480360381019080803590602001909291908035906020019092919080604001906002806020026040519081016040528092919082600260200280828437820191505050505091929192905050506110cf565b005b34801561056757600080fd5b506105906004803603810190808035906020019092919080359060200190929190505050611308565b6040518088815260200187815260200186815260200185600260200280838360005b838110156105cd5780820151818401526020810190506105b2565b505050509050018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200197505050505050505060405180910390f35b34801561063057600080fd5b506106a6600480360381019080803590602001909291908035906020019092919080359060200190929190806040019060028060200260405190810160405280929190826002602002808284378201915050505050919291929080359060200190929190803590602001909291905050506114d3565b005b3480156106b457600080fd5b506107f26004803603810190808035906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050611688565b005b34801561080057600080fd5b5061081f600480360381019080803590602001909291905050506117c3565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610862578082015181840152602081019050610847565b505050509050019250505060405180910390f35b34801561088257600080fd5b5061088b611833565b604051808215151515815260200191505060405180910390f35b60008060006108b2611b2f565b60008060008060008a8a6000600160008481526020019081526020016000209050600081600b01838154811015156108e657fe5b90600052602060002090600902016006015411151561090457600080fd5b600160008f8152602001908152602001600020945084600b018d81548110151561092a57fe5b90600052602060002090600902019350610a2784610100604051908101604052908160008201548152602001600182015481526020016002820154815260200160038201548152602001600482016002806020026040519081016040528092919082600280156109af576020028201915b81548152602001906001019080831161099b575b50505050508152602001600682015481526020016007820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160088201548152505061188b565b9b509b509b509b509b509b509b50505050505092959891949750929550565b600080606080606080606060008088600160008c815260200190815260200160002091508a995081600101549850816002018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b0c5780601f10610ae157610100808354040283529160200191610b0c565b820191906000526020600020905b815481529060010190602001808311610aef57829003601f168201915b50505050509750816003018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610bab5780601f10610b8057610100808354040283529160200191610bab565b820191906000526020600020905b815481529060010190602001808311610b8e57829003601f168201915b50505050509650816004018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c4a5780601f10610c1f57610100808354040283529160200191610c4a565b820191906000526020600020905b815481529060010190602001808311610c2d57829003601f168201915b5050505050955081600501805480602002602001604051908101604052809291908181526020018280548015610c9f57602002820191906000526020600020905b815481526020019060010190808311610c8b575b5050505050945081600c0160009054906101000a900460ff16925081600601805480602002602001604051908101604052809291908181526020018280548015610d0857602002820191906000526020600020905b815481526020019060010190808311610cf4575b505050505093505050919395975091939597565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111151515610d6a57600080fd5b80600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610dfd573d6000803e3d6000fd5b5050565b60606000805480602002602001604051908101604052809291908181526020018280548015610e4f57602002820191906000526020600020905b815481526020019060010190808311610e3b575b5050505050905090565b600080833373ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610eb957600080fd5b60016000868152602001908152602001600020925082600701600085815260200190815260200160002060009054906101000a900460ff161515610f5457600183600701600086815260200190815260200160002060006101000a81548160ff021916908315150217905550826006018490806001815401808255809150509060018203906000526020600020016000909192909190915055505b600091505b8260050180549050821015610f75578180600101925050610f59565b5050505050565b81426001600083815260200190815260200160002060010154111515610fa157600080fd5b8282600060016000848152602001908152602001600020905060008160090182600801600085815260200190815260200160002054815481101515610fe257fe5b90600052602060002090600902016006015411151561100057600080fd5b8585600080600160008581526020019081526020016000209150816009018260080160008581526020019081526020016000205481548110151561104057fe5b906000526020600020906009020190508160070160008260030154815260200190815260200160002060009054906101000a900460ff1615151561108357600080fd5b60003411151561109257600080fd5b61109e33348c8c6118d9565b50505050505050505050565b60008160016000848152602001908152602001600020600b0180549050915050919050565b6000806000803373ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561113157600080fd5b600160008881526020019081526020016000209350600092505b83600b01805490508310156112ff5783600b018381548110151561116b57fe5b906000526020600020906009020191508582600301541480156111b3575084600060028110151561119857fe5b60200201518260040160006002811015156111af57fe5b0154145b80156111e457508460016002811015156111c957fe5b60200201518260040160016002811015156111e057fe5b0154145b156112f2578160060154826000015402905060648181151561120257fe5b04905080600260008460070160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550868260070160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f1ce690bab3f0797851d1673f462be38a6378af9c81188730b523525747eba55d8584604051808381526020018281526020019250505060405180910390a35b828060010193505061114b565b50505050505050565b6000806000611315611b2f565b60008060008060008a8a60006001600084815260200190815260200160002090506000816009018260080160008581526020019081526020016000205481548110151561135e57fe5b90600052602060002090600902016006015411151561137c57600080fd5b600160008f81526020019081526020016000209450846009018560080160008f8152602001908152602001600020548154811015156113b757fe5b906000526020600020906009020193506114b4846101006040519081016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820160028060200260405190810160405280929190826002801561143c576020028201915b815481526020019060010190808311611428575b50505050508152602001600682015481526020016007820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160088201548152505061188b565b9b509b509b509b509b509b509b50505050505092959891949750929550565b6000806000884260016000838152602001908152602001600020600101541115156114fd57600080fd5b3373ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561155957600080fd5b600160008b815260200190815260200160002093506000925060008460080160008a8152602001908152602001600020541415611601578360090180548091906001016115a69190611b51565b506001846009018054905003925083600a01889080600181540180825580915050906001820390600052602060002001600090919290919091505550828460080160008a81526020019081526020016000208190555061161a565b8360080160008981526020019081526020016000205492505b836009018381548110151561162b57fe5b906000526020600020906009020191508982600101819055508782600201819055508882600301819055508682600401906002611669929190611b83565b5085826006018190555084826008018190555050505050505050505050565b60003373ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156116e657600080fd5b60016000888152602001908152602001600020905086816000018190555085816001018190555083816003019080519060200190611725929190611bc3565b508481600201908051906020019061173e929190611bc3565b5082816004019080519060200190611757929190611bc3565b5081816005019080519060200190611770929190611c43565b50600181600c0160006101000a81548160ff021916908315150217905550600087908060018154018082558091505090600182039060005260206000200160009091929091909150555050505050505050565b60608160016000848152602001908152602001600020600a0180548060200260200160405190810160405280929190818152602001828054801561182657602002820191906000526020600020905b815481526020019060010190808311611812575b5050505050915050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b6000806000611898611b2f565b6000806000876040015196508760000151955087606001519450876080015193508760a0015192508760c0015191508760e001519050919395979092949650565b6000806118e4611c90565b600160008681526020019081526020016000209250826009018360080160008681526020019081526020016000205481548110151561191f57fe5b9060005260206000209060090201915081610100604051908101604052908160008201548152602001600182015481526020016002820154815260200160038201548152602001600482016002806020026040519081016040528092919082600280156119a1576020028201915b81548152602001906001019080831161198d575b50505050508152602001600682015481526020016007820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600882015481525050905085816000018181525050868160c0019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505082600b01819080600181540180825580915050906001820390600052602060002090600902016000909192909190915060008201518160000155602082015181600101556040820151816002015560608201518160030155608082015181600401906002611ac7929190611cf2565b5060a0820151816006015560c08201518160070160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060e0820151816008015550505050505050505050565b6040805190810160405280600290602082028038833980820191505090505090565b815481835581811115611b7e57600902816009028360005260206000209182019101611b7d9190611d32565b5b505050565b8260028101928215611bb2579160200282015b82811115611bb1578251825591602001919060010190611b96565b5b509050611bbf9190611db8565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611c0457805160ff1916838001178555611c32565b82800160010185558215611c32579182015b82811115611c31578251825591602001919060010190611c16565b5b509050611c3f9190611db8565b5090565b828054828255906000526020600020908101928215611c7f579160200282015b82811115611c7e578251825591602001919060010190611c63565b5b509050611c8c9190611db8565b5090565b6101206040519081016040528060008152602001600081526020016000815260200160008152602001611cc1611ddd565b815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b8260028101928215611d21579160200282015b82811115611d20578251825591602001919060010190611d05565b5b509050611d2e9190611db8565b5090565b611db591905b80821115611db157600080820160009055600182016000905560028201600090556003820160009055600482016000611d719190611dff565b60068201600090556007820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600882016000905550600901611d38565b5090565b90565b611dda91905b80821115611dd6576000816000905550600101611dbe565b5090565b90565b6040805190810160405280600290602082028038833980820191505090505090565b5060008155600101600090555600a165627a7a7230582074837974d98ec581ba77c152868ec2eebb02635b9c25c22ee70bf82d7467d4970029"
//create the contract instance. We can use this instance to publish or connect to a published contract
var Contract = web3.eth.contract(abi);
......@@ -47,7 +47,8 @@ var publishData = {
Contract.new(publishData, function(err, contractInstance) {
if(!err) {
if(contractInstance.address) { //if the contract has an address aka if the transaction is mined
console.log("New contract address is :", contractInstance.address);
console.log("New contract address is :", contractInstance.address);
console.log("Owner is :", acc)
}
} else {
console.error(err); //something went wrong
......
......@@ -43,7 +43,7 @@
</Market>
<Market ID="25179221" Number="4" Name="Penalty in Match">
<Selection ID="60475707" Number="1" Description="Yes" OddsDecimal="22.24" />
<Selection ID="60475707" Number="2" Description="No" OddsDecimal="1.24" />
<Selection ID="60475708" Number="2" Description="No" OddsDecimal="1.24" />
</Market>
</FootballEvent>
</UpcomingEvents>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment