@gnosis.pm/pm-contracts
Version:
Collection of smart contracts for the Gnosis prediction market platform
922 lines (921 loc) • 339 kB
JSON
{
"contractName": "ScalarEventProxy",
"abi": [
{
"constant": true,
"inputs": [],
"name": "outcome",
"outputs": [
{
"name": "",
"type": "int256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "LONG",
"outputs": [
{
"name": "",
"type": "uint8"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "OUTCOME_RANGE",
"outputs": [
{
"name": "",
"type": "uint24"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "oracle",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "",
"type": "uint256"
}
],
"name": "outcomeTokens",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "lowerBound",
"outputs": [
{
"name": "",
"type": "int256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "masterCopy",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "SHORT",
"outputs": [
{
"name": "",
"type": "uint8"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "upperBound",
"outputs": [
{
"name": "",
"type": "int256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "collateralToken",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "isOutcomeSet",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"name": "proxied",
"type": "address"
},
{
"name": "outcomeTokenMasterCopy",
"type": "address"
},
{
"name": "_collateralToken",
"type": "address"
},
{
"name": "_oracle",
"type": "address"
},
{
"name": "_lowerBound",
"type": "int256"
},
{
"name": "_upperBound",
"type": "int256"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"payable": true,
"stateMutability": "payable",
"type": "fallback"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "outcomeToken",
"type": "address"
},
{
"indexed": false,
"name": "index",
"type": "uint8"
}
],
"name": "OutcomeTokenCreation",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "buyer",
"type": "address"
},
{
"indexed": false,
"name": "collateralTokenCount",
"type": "uint256"
}
],
"name": "OutcomeTokenSetIssuance",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "seller",
"type": "address"
},
{
"indexed": false,
"name": "outcomeTokenCount",
"type": "uint256"
}
],
"name": "OutcomeTokenSetRevocation",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "outcome",
"type": "int256"
}
],
"name": "OutcomeAssignment",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "receiver",
"type": "address"
},
{
"indexed": false,
"name": "winnings",
"type": "uint256"
}
],
"name": "WinningsRedemption",
"type": "event"
}
],
"metadata": "{\"compiler\":{\"version\":\"0.5.6+commit.b259423e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[],\"name\":\"outcome\",\"outputs\":[{\"name\":\"\",\"type\":\"int256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"LONG\",\"outputs\":[{\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"OUTCOME_RANGE\",\"outputs\":[{\"name\":\"\",\"type\":\"uint24\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"oracle\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"outcomeTokens\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"lowerBound\",\"outputs\":[{\"name\":\"\",\"type\":\"int256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"masterCopy\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"SHORT\",\"outputs\":[{\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"upperBound\",\"outputs\":[{\"name\":\"\",\"type\":\"int256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"collateralToken\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"isOutcomeSet\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"proxied\",\"type\":\"address\"},{\"name\":\"outcomeTokenMasterCopy\",\"type\":\"address\"},{\"name\":\"_collateralToken\",\"type\":\"address\"},{\"name\":\"_oracle\",\"type\":\"address\"},{\"name\":\"_lowerBound\",\"type\":\"int256\"},{\"name\":\"_upperBound\",\"type\":\"int256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"outcomeToken\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"index\",\"type\":\"uint8\"}],\"name\":\"OutcomeTokenCreation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"buyer\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"collateralTokenCount\",\"type\":\"uint256\"}],\"name\":\"OutcomeTokenSetIssuance\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"seller\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"outcomeTokenCount\",\"type\":\"uint256\"}],\"name\":\"OutcomeTokenSetRevocation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"outcome\",\"type\":\"int256\"}],\"name\":\"OutcomeAssignment\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"winnings\",\"type\":\"uint256\"}],\"name\":\"WinningsRedemption\",\"type\":\"event\"}],\"devdoc\":{\"methods\":{\"constructor\":{\"details\":\"Contract constructor validates and sets basic event properties\",\"params\":{\"_collateralToken\":\"Tokens used as collateral in exchange for outcome tokens\",\"_lowerBound\":\"Lower bound for event outcome\",\"_oracle\":\"Oracle contract used to resolve the event\",\"_upperBound\":\"Lower bound for event outcome\"}}}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/alan/src/github.com/gnosis/pm-contracts/contracts/Events/ScalarEvent.sol\":\"ScalarEventProxy\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/home/alan/src/github.com/gnosis/pm-contracts/contracts/Events/Event.sol\":{\"keccak256\":\"0xdcacfa25145426b5681ad7d8bafb3c117c92a37b7a0175d72a10b42f130fb8c1\",\"urls\":[\"bzzr://bd10fbdb82f0d50866442c9e95317b3176c8ee067def27d764529973fb36420a\"]},\"/home/alan/src/github.com/gnosis/pm-contracts/contracts/Events/ScalarEvent.sol\":{\"keccak256\":\"0xb8113f1a3f63ec0b6ae2d1a833fbffcf2b2af9470d4d7591d8e2c2784a163b32\",\"urls\":[\"bzzr://feb468d84fdda273585ba31abbbf8cceb906df5a9142695ec30c98f000a05bd4\"]},\"/home/alan/src/github.com/gnosis/pm-contracts/contracts/Oracles/Oracle.sol\":{\"keccak256\":\"0xf4d12f4a59c17e66dfa6791188f621a8914e2038a4e3f72d6fc9fb903ca8e18e\",\"urls\":[\"bzzr://a477ccd203e677cc904b1a4f8fcc85251c5b5e09c5c10eed27e01318584b16d1\"]},\"/home/alan/src/github.com/gnosis/pm-contracts/contracts/Tokens/OutcomeToken.sol\":{\"keccak256\":\"0x3d4c9ec14a60cf7577d366da5116e919a4331da8d6d993174f7d599f84ae74e0\",\"urls\":[\"bzzr://20f87450259a3af24ff1769faa9ab3b714d01921e9d8fa4efa75a0c277837a8a\"]},\"@gnosis.pm/util-contracts/contracts/Proxy.sol\":{\"keccak256\":\"0xeab0e83a9ec9e7f052c0455a11577061ec6d1994db08dae429abd6faaabf6555\",\"urls\":[\"bzzr://b2c1273d4ec30e2f9e768eea8c510f8493a7359b03e01923d93eea86b57ec145\"]},\"openzeppelin-solidity/contracts/math/SafeMath.sol\":{\"keccak256\":\"0x4ccf2d7b51873db1ccfd54ca2adae5eac3b184f9699911ed4490438419f1c690\",\"urls\":[\"bzzr://1604f5b6d6e916c154efd8c6720cda069e5ba32dfa0a9dedf2b42e5b02d07f89\"]},\"openzeppelin-solidity/contracts/token/ERC20/ERC20.sol\":{\"keccak256\":\"0x852793a3c2f86d336a683b30d688ec3dcfc57451af5a2bf5975cda3b7191a901\",\"urls\":[\"bzzr://07fb42206812a17c1f71e548cfa5cec6f9aa1ae0ca5df870718ca4aa9759d1a5\"]},\"openzeppelin-solidity/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x90e8c2521653bbb1768b05889c5760031e688d9cd361f167489b89215e201b95\",\"urls\":[\"bzzr://aa8b45b57edafc3d67bc5d916327ea16807fae33f753ca163ae0c4061b789766\"]}},\"version\":1}",
"bytecode": "0x608060405234801561001057600080fd5b5060405160c080610a5d833981018060405260c081101561003057600080fd5b8101908080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919050505085600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156100ae57600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156101595750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b61016257600080fd5b83600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008090505b60028160ff16101561033f5760008660405161020590610365565b808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050604051809103906000f080158015610257573d6000803e3d6000fd5b50905060048190806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550507fad24776dc347085865b6988e249c191fc22d9b31cf54cb62233c3c16be1736ee8183604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260ff1660ff1681526020019250505060405180910390a15080806001019150506101ea565b5081811361034c57600080fd5b8160058190555080600681905550505050505050610372565b61021c8061084183390190565b6104c0806103816000396000f3fe60806040526004361061009c5760003560e01c8063a384d6ff11610064578063a384d6ff1461024d578063a619486e14610278578063a871da91146102cf578063b09ad8a014610300578063b2016bd41461032b578063ccdf68f3146103825761009c565b806327793f87146100ea578063561cce0a146101155780636e5452fe146101465780637dc0d1d01461017b5780638abe59ea146101d2575b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050366000803760008036600084600019f43d6000803e80600081146100e5573d6000f35b3d6000fd5b3480156100f657600080fd5b506100ff6103b1565b6040518082815260200191505060405180910390f35b34801561012157600080fd5b5061012a6103b7565b604051808260ff1660ff16815260200191505060405180910390f35b34801561015257600080fd5b5061015b6103bc565b604051808262ffffff1662ffffff16815260200191505060405180910390f35b34801561018757600080fd5b506101906103c3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101de57600080fd5b5061020b600480360360208110156101f557600080fd5b81019080803590602001909291905050506103e9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561025957600080fd5b50610262610425565b6040518082815260200191505060405180910390f35b34801561028457600080fd5b5061028d61042b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102db57600080fd5b506102e4610450565b604051808260ff1660ff16815260200191505060405180910390f35b34801561030c57600080fd5b50610315610455565b6040518082815260200191505060405180910390f35b34801561033757600080fd5b5061034061045b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561038e57600080fd5b50610397610481565b604051808215151515815260200191505060405180910390f35b60035481565b600181565b620f424081565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600481815481106103f657fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600081565b60065481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600260149054906101000a900460ff168156fea165627a7a723058201ad326563df01e279e60dfba8f6610d07e653666c4be8ecd67c56aa15da6c7750029608060405234801561001057600080fd5b5060405160208061021c8339810180604052602081101561003057600080fd5b810190808051906020019092919050505080600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561007c57600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505033600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505061010e8061010e6000396000f3fe608060405260043610601c5760003560e01c8063a619486e146069575b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050366000803760008036600084600019f43d6000803e80600081146064573d6000f35b3d6000fd5b348015607457600080fd5b50607b60bd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168156fea165627a7a72305820cbbb84b03efb936eec7a7a63670e9c47ced04c53284f2b0435d190970bfd2eb40029",
"deployedBytecode": "0x60806040526004361061009c5760003560e01c8063a384d6ff11610064578063a384d6ff1461024d578063a619486e14610278578063a871da91146102cf578063b09ad8a014610300578063b2016bd41461032b578063ccdf68f3146103825761009c565b806327793f87146100ea578063561cce0a146101155780636e5452fe146101465780637dc0d1d01461017b5780638abe59ea146101d2575b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050366000803760008036600084600019f43d6000803e80600081146100e5573d6000f35b3d6000fd5b3480156100f657600080fd5b506100ff6103b1565b6040518082815260200191505060405180910390f35b34801561012157600080fd5b5061012a6103b7565b604051808260ff1660ff16815260200191505060405180910390f35b34801561015257600080fd5b5061015b6103bc565b604051808262ffffff1662ffffff16815260200191505060405180910390f35b34801561018757600080fd5b506101906103c3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101de57600080fd5b5061020b600480360360208110156101f557600080fd5b81019080803590602001909291905050506103e9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561025957600080fd5b50610262610425565b6040518082815260200191505060405180910390f35b34801561028457600080fd5b5061028d61042b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102db57600080fd5b506102e4610450565b604051808260ff1660ff16815260200191505060405180910390f35b34801561030c57600080fd5b50610315610455565b6040518082815260200191505060405180910390f35b34801561033757600080fd5b5061034061045b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561038e57600080fd5b50610397610481565b604051808215151515815260200191505060405180910390f35b60035481565b600181565b620f424081565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600481815481106103f657fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600081565b60065481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600260149054906101000a900460ff168156fea165627a7a723058201ad326563df01e279e60dfba8f6610d07e653666c4be8ecd67c56aa15da6c7750029",
"sourceMap": "387:1296:3:-;;;801:880;8:9:-1;5:2;;;30:1;27;20:12;5:2;801:880:3;;;;;;;;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;801:880:3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1004:7;644:1:29;621:25;;:11;:25;;;;613:34;;;;;;670:11;657:10;;:24;;;;;;;;;;;;;;;;;;551:137;1113:1:3;1076:39;;1084:16;1076:39;;;;:73;;;;;1147:1;1119:30;;1127:7;1119:30;;;;1076:73;1068:82;;;;;;1178:16;1160:15;;:34;;;;;;;;;;;;;;;;;;1213:7;1204:6;;:16;;;;;;;;;;;;;;;;;;1287:7;1297:1;1287:11;;1282:253;1304:1;1300;:5;;;1282:253;;;1326:25;1397:22;1375:45;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1375:45:3;1326:96;;1436:13;1455:12;1436:32;;39:1:-1;33:3;27:10;23:18;57:10;52:3;45:23;79:10;72:17;;0:93;1436:32:3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1487:37;1508:12;1522:1;1487:37;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1282:253;1307:3;;;;;;;1282:253;;;;1594:11;1580;:25;1572:34;;;;;;1629:11;1616:10;:24;;;;1663:11;1650:10;:24;;;;801:880;;;;;;387:1296;;;;;;;;;;:::o;:::-;;;;;;;",
"deployedSourceMap": "387:1296:3:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;848:19:29;870:10;;;;;;;;;;;848:32;;932:14;929:1;926;913:34;1031:1;1028;1012:14;1009:1;996:11;992:1;988:6;975:58;1067:16;1064:1;1061;1046:38;1104:7;1129:1;1124:38;;;;1195:16;1192:1;1185:27;1124:38;1143:16;1140:1;1133:27;748:18:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;748:18:1;;;:::i;:::-;;;;;;;;;;;;;;;;;;;214:30:3;;8:9:-1;5:2;;;30:1;27;20:12;5:2;214:30:3;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;250:46;;8:9:-1;5:2;;;30:1;27;20:12;5:2;250:46:3;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;692:20:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;692:20:1;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;772:35;;8:9:-1;5:2;;;30:1;27;20:12;5:2;772:35:1;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;772:35:1;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;334:21:3;;8:9:-1;5:2;;;30:1;27;20:12;5:2;334:21:3;;;:::i;:::-;;;;;;;;;;;;;;;;;;;205:25:29;;8:9:-1;5:2;;;30:1;27;20:12;5:2;205:25:29;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;177:31:3;;8:9:-1;5:2;;;30:1;27;20:12;5:2;177:31:3;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;361:21;;8:9:-1;5:2;;;30:1;27;20:12;5:2;361:21:3;;;:::i;:::-;;;;;;;;;;;;;;;;;;;658:28:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;658:28:1;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;718:24;;8:9:-1;5:2;;;30:1;27;20:12;5:2;718:24:1;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;748:18;;;;:::o;214:30:3:-;243:1;214:30;:::o;250:46::-;289:7;250:46;:::o;692:20:1:-;;;;;;;;;;;;;:::o;772:35::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;334:21:3:-;;;;:::o;205:25:29:-;;;;;;;;;;;;;:::o;177:31:3:-;207:1;177:31;:::o;361:21::-;;;;:::o;658:28:1:-;;;;;;;;;;;;;:::o;718:24::-;;;;;;;;;;;;;:::o",
"source": "pragma solidity ^0.5.0;\nimport \"../Events/Event.sol\";\nimport \"@gnosis.pm/util-contracts/contracts/Proxy.sol\";\n\n\ncontract ScalarEventData {\n\n /*\n * Constants\n */\n uint8 public constant SHORT = 0;\n uint8 public constant LONG = 1;\n uint24 public constant OUTCOME_RANGE = 1000000;\n\n /*\n * Storage\n */\n int public lowerBound;\n int public upperBound;\n}\n\ncontract ScalarEventProxy is Proxy, EventData, ScalarEventData {\n\n /// @dev Contract constructor validates and sets basic event properties\n /// @param _collateralToken Tokens used as collateral in exchange for outcome tokens\n /// @param _oracle Oracle contract used to resolve the event\n /// @param _lowerBound Lower bound for event outcome\n /// @param _upperBound Lower bound for event outcome\n constructor(\n address proxied,\n address outcomeTokenMasterCopy,\n ERC20 _collateralToken,\n Oracle _oracle,\n int _lowerBound,\n int _upperBound\n )\n Proxy(proxied)\n public\n {\n // Validate input\n require(address(_collateralToken) != address(0) && address(_oracle) != address(0));\n collateralToken = _collateralToken;\n oracle = _oracle;\n // Create an outcome token for each outcome\n for (uint8 i = 0; i < 2; i++) {\n OutcomeToken outcomeToken = OutcomeToken(address(new OutcomeTokenProxy(outcomeTokenMasterCopy)));\n outcomeTokens.push(outcomeToken);\n emit OutcomeTokenCreation(outcomeToken, i);\n }\n\n // Validate bounds\n require(_upperBound > _lowerBound);\n lowerBound = _lowerBound;\n upperBound = _upperBound;\n }\n}\n\n/// @title Scalar event contract - Scalar events resolve to a number within a range\n/// @author Stefan George - <stefan@gnosis.pm>\ncontract ScalarEvent is Proxied, Event, ScalarEventData {\n using SafeMath for *;\n\n /*\n * Public functions\n */\n /// @dev Exchanges sender's winning outcome tokens for collateral tokens\n /// @return Sender's winnings\n function redeemWinnings()\n public\n returns (uint winnings)\n {\n // Winning outcome has to be set\n require(isOutcomeSet);\n // Calculate winnings\n uint24 convertedWinningOutcome;\n // Outcome is lower than defined lower bound\n if (outcome < lowerBound)\n convertedWinningOutcome = 0;\n // Outcome is higher than defined upper bound\n else if (outcome > upperBound)\n convertedWinningOutcome = OUTCOME_RANGE;\n // Map outcome to outcome range\n else\n convertedWinningOutcome = uint24(OUTCOME_RANGE * (outcome - lowerBound) / (upperBound - lowerBound));\n uint factorShort = OUTCOME_RANGE - convertedWinningOutcome;\n uint factorLong = OUTCOME_RANGE - factorShort;\n uint shortOutcomeTokenCount = outcomeTokens[SHORT].balanceOf(msg.sender);\n uint longOutcomeTokenCount = outcomeTokens[LONG].balanceOf(msg.sender);\n winnings = shortOutcomeTokenCount.mul(factorShort).add(longOutcomeTokenCount.mul(factorLong)) / OUTCOME_RANGE;\n // Revoke all outcome tokens\n outcomeTokens[SHORT].revoke(msg.sender, shortOutcomeTokenCount);\n outcomeTokens[LONG].revoke(msg.sender, longOutcomeTokenCount);\n // Payout winnings to sender\n require(collateralToken.transfer(msg.sender, winnings));\n emit WinningsRedemption(msg.sender, winnings);\n }\n\n /// @dev Calculates and returns event hash\n /// @return Event hash\n function getEventHash()\n public\n view\n returns (bytes32)\n {\n return keccak256(abi.encodePacked(collateralToken, oracle, lowerBound, upperBound));\n }\n}\n",
"sourcePath": "/home/alan/src/github.com/gnosis/pm-contracts/contracts/Events/ScalarEvent.sol",
"ast": {
"absolutePath": "/home/alan/src/github.com/gnosis/pm-contracts/contracts/Events/ScalarEvent.sol",
"exportedSymbols": {
"ScalarEvent": [
870
],
"ScalarEventData": [
620
],
"ScalarEventProxy": [
720
]
},
"id": 871,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 604,
"literals": [
"solidity",
"^",
"0.5",
".0"
],
"nodeType": "PragmaDirective",
"src": "0:23:3"
},
{
"absolutePath": "/home/alan/src/github.com/gnosis/pm-contracts/contracts/Events/Event.sol",
"file": "../Events/Event.sol",
"id": 605,
"nodeType": "ImportDirective",
"scope": 871,
"sourceUnit": 393,
"src": "24:29:3",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "@gnosis.pm/util-contracts/contracts/Proxy.sol",
"file": "@gnosis.pm/util-contracts/contracts/Proxy.sol",
"id": 606,
"nodeType": "ImportDirective",
"scope": 871,
"sourceUnit": 6829,
"src": "54:55:3",
"symbolAliases": [],
"unitAlias": ""
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"id": 620,
"linearizedBaseContracts": [
620
],
"name": "ScalarEventData",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": true,
"id": 609,
"name": "SHORT",
"nodeType": "VariableDeclaration",
"scope": 620,
"src": "177:31:3",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
},
"typeName": {
"id": 607,
"name": "uint8",
"nodeType": "ElementaryTypeName",
"src": "177:5:3",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
}
},
"value": {
"argumentTypes": null,
"hexValue": "30",
"id": 608,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "207:1:3",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"visibility": "public"
},
{
"constant": true,
"id": 612,
"name": "LONG",
"nodeType": "VariableDeclaration",
"scope": 620,
"src": "214:30:3",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
},
"typeName": {
"id": 610,
"name": "uint8",
"nodeType": "ElementaryTypeName",
"src": "214:5:3",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
}
},
"value": {
"argumentTypes": null,
"hexValue": "31",
"id": 611,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "243:1:3",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_1_by_1",
"typeString": "int_const 1"
},
"value": "1"
},
"visibility": "public"
},
{
"constant": true,
"id": 615,
"name": "OUTCOME_RANGE",
"nodeType": "VariableDeclaration",
"scope": 620,
"src": "250:46:3",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint24",
"typeString": "uint24"
},
"typeName": {
"id": 613,
"name": "uint24",
"nodeType": "ElementaryTypeName",
"src": "250:6:3",
"typeDescriptions": {
"typeIdentifier": "t_uint24",
"typeString": "uint24"
}
},
"value": {
"argumentTypes": null,
"hexValue": "31303030303030",
"id": 614,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "289:7:3",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_1000000_by_1",
"typeString": "int_const 1000000"
},
"value": "1000000"
},
"visibility": "public"
},
{
"constant": false,
"id": 617,
"name": "lowerBound",
"nodeType": "VariableDeclaration",
"scope": 620,
"src": "334:21:3",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
},
"typeName": {
"id": 616,
"name": "int",
"nodeType": "ElementaryTypeName",
"src": "334:3:3",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"value": null,
"visibility": "public"
},
{
"constant": false,
"id": 619,
"name": "upperBound",
"nodeType": "VariableDeclaration",
"scope": 620,
"src": "361:21:3",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
},
"typeName": {
"id": 618,
"name": "int",
"nodeType": "ElementaryTypeName",
"src": "361:3:3",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"value": null,
"visibility": "public"
}
],
"scope": 871,
"src": "112:273:3"
},
{
"baseContracts": [
{
"arguments": null,
"baseName": {
"contractScope": null,
"id": 621,
"name": "Proxy",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 6828,
"src": "416:5:3",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Proxy_$6828",
"typeString": "contract Proxy"
}
},
"id": 622,
"nodeType": "InheritanceSpecifier",
"src": "416:5:3"
},
{
"arguments": null,
"baseName": {
"contractScope": null,
"id": 623,
"name": "EventData",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 204,
"src": "423:9:3",
"typeDescriptions": {
"typeIdentifier": "t_contract$_EventData_$204",
"typeString": "contract EventData"
}
},
"id": 624,
"nodeType": "InheritanceSpecifier",
"src": "423:9:3"
},
{
"arguments": null,
"baseName": {
"contractScope": null,
"id": 625,
"name": "ScalarEventData",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 620,
"src": "434:15:3",
"typeDescriptions": {
"typeIdentifier": "t_contract$_ScalarEventData_$620",
"typeString": "contract ScalarEventData"
}
},
"id": 626,
"nodeType": "InheritanceSpecifier",
"src": "434:15:3"
}
],
"contractDependencies": [
204,
620,
5721,
6798,
6828
],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"id": 720,
"linearizedBaseContracts": [
720,
620,
204,
6828,
6798
],
"name": "ScalarEventProxy",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 718,
"nodeType": "Block",
"src": "1032:649:3",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"id": 659,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 651,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 646,
"name": "_collateralToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 632,
"src": "1084:16:3",
"typeDescriptions": {
"typeIdentifier": "t_contract$_ERC20_$7778",
"typeString": "contract ERC20"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_ERC20_$7778",
"typeString": "contract ERC20"
}
],
"id": 645,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1076:7:3",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": "address"
},
"id": 647,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1076:25:3",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "30",
"id": 649,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1113:1:3",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
}
],
"id": 648,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1105:7:3",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": "address"
},
"id": 650,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1105:10:3",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"src": "1076:39:3",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "BinaryOperation",
"operator": "&&",
"rightExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 658,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 653,
"name": "_oracle",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 634,
"src": "1127:7:3",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Oracle_$4841",
"typeString": "contract Oracle"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_Oracle_$4841",
"typeString": "contract Oracle"
}
],
"id": 652,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1119:7:3",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": "address"
},
"id": 654,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1119:16:3",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "30",
"id": 656,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1147:1:3",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
}
],
"id": 655,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1139:7:3",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": "address"
},
"id": 657,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1139:10:3",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"src": "1119:30:3",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"src": "1076:73:3",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
}
],
"id": 644,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
7923,
7924
],
"referencedDeclaration": 7923,
"src": "1068:7:3",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$",
"typeString": "function (bool) pure"
}
},
"id": 660,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],