UNPKG

@gnosis.pm/pm-contracts

Version:

Collection of smart contracts for the Gnosis prediction market platform

930 lines 595 kB
{ "contractName": "UltimateOracleProxy", "abi": [ { "constant": true, "inputs": [], "name": "forwardedOracle", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "frontRunnerPeriod", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "frontRunner", "outputs": [ { "name": "", "type": "int256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "totalAmount", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "", "type": "int256" } ], "name": "totalOutcomeAmounts", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "forwardedOutcomeSetTimestamp", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "frontRunnerSetTimestamp", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "forwardedOutcome", "outputs": [ { "name": "", "type": "int256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "challengeAmount", "outputs": [ { "name": "", "type": "uint256" } ], "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": "collateralToken", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "", "type": "address" }, { "name": "", "type": "int256" } ], "name": "outcomeAmounts", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "spreadMultiplier", "outputs": [ { "name": "", "type": "uint8" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "challengePeriod", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "inputs": [ { "name": "proxied", "type": "address" }, { "name": "_forwardedOracle", "type": "address" }, { "name": "_collateralToken", "type": "address" }, { "name": "_spreadMultiplier", "type": "uint8" }, { "name": "_challengePeriod", "type": "uint256" }, { "name": "_challengeAmount", "type": "uint256" }, { "name": "_frontRunnerPeriod", "type": "uint256" } ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, { "payable": true, "stateMutability": "payable", "type": "fallback" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "outcome", "type": "int256" } ], "name": "ForwardedOracleOutcomeAssignment", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "sender", "type": "address" }, { "indexed": false, "name": "outcome", "type": "int256" } ], "name": "OutcomeChallenge", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "sender", "type": "address" }, { "indexed": false, "name": "outcome", "type": "int256" }, { "indexed": false, "name": "amount", "type": "uint256" } ], "name": "OutcomeVote", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "sender", "type": "address" }, { "indexed": false, "name": "amount", "type": "uint256" } ], "name": "Withdrawal", "type": "event" } ], "metadata": "{\"compiler\":{\"version\":\"0.5.6+commit.b259423e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[],\"name\":\"forwardedOracle\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"frontRunnerPeriod\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"frontRunner\",\"outputs\":[{\"name\":\"\",\"type\":\"int256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalAmount\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"int256\"}],\"name\":\"totalOutcomeAmounts\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"forwardedOutcomeSetTimestamp\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"frontRunnerSetTimestamp\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"forwardedOutcome\",\"outputs\":[{\"name\":\"\",\"type\":\"int256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"challengeAmount\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"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\":\"collateralToken\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"address\"},{\"name\":\"\",\"type\":\"int256\"}],\"name\":\"outcomeAmounts\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"spreadMultiplier\",\"outputs\":[{\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"challengePeriod\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"proxied\",\"type\":\"address\"},{\"name\":\"_forwardedOracle\",\"type\":\"address\"},{\"name\":\"_collateralToken\",\"type\":\"address\"},{\"name\":\"_spreadMultiplier\",\"type\":\"uint8\"},{\"name\":\"_challengePeriod\",\"type\":\"uint256\"},{\"name\":\"_challengeAmount\",\"type\":\"uint256\"},{\"name\":\"_frontRunnerPeriod\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"outcome\",\"type\":\"int256\"}],\"name\":\"ForwardedOracleOutcomeAssignment\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"outcome\",\"type\":\"int256\"}],\"name\":\"OutcomeChallenge\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"outcome\",\"type\":\"int256\"},{\"indexed\":false,\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"OutcomeVote\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Withdrawal\",\"type\":\"event\"}],\"devdoc\":{\"methods\":{\"constructor\":{\"details\":\"Constructor sets ultimate oracle properties\",\"params\":{\"_challengeAmount\":\"Amount to challenge the outcome\",\"_challengePeriod\":\"Time to challenge oracle outcome\",\"_collateralToken\":\"Collateral token address\",\"_forwardedOracle\":\"Oracle address\",\"_frontRunnerPeriod\":\"Time to overbid the front-runner\",\"_spreadMultiplier\":\"Defines the spread as a multiple of the money bet on other outcomes\"}}}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/alan/src/github.com/gnosis/pm-contracts/contracts/Oracles/UltimateOracle.sol\":\"UltimateOracleProxy\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/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/Oracles/UltimateOracle.sol\":{\"keccak256\":\"0x58cd0fc631023fdc5be8ca10d38d470c45b9bd6a07c55a32b1e37c5017c15c9d\",\"urls\":[\"bzzr://75b2c3baa37871dbb7604d38fc3c1a113dec600c55f7ad22a97f41675cf6c873\"]},\"@gnosis.pm/util-contracts/contracts/Proxy.sol\":{\"keccak256\":\"0xeab0e83a9ec9e7f052c0455a11577061ec6d1994db08dae429abd6faaabf6555\",\"urls\":[\"bzzr://b2c1273d4ec30e2f9e768eea8c510f8493a7359b03e01923d93eea86b57ec145\"]},\"openzeppelin-solidity/contracts/drafts/SignedSafeMath.sol\":{\"keccak256\":\"0xb4b45cd5475c318722ac0f8d7e2b9e77fee6f4f36374c1110fe615d50fbc0650\",\"urls\":[\"bzzr://a90fb457269c8a03ec5b811c71acef08a2751a4d2019b0661328610f9357dae7\"]},\"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": "0x608060405234801561001057600080fd5b5060405160e0806107fc833981018060405260e081101561003057600080fd5b810190808051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919050505086600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156100b857600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141580156101635750600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015610173575060028460ff1610155b801561017f5750600083115b801561018b5750600082115b80156101975750600081115b6101a057600080fd5b85600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555084600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555083600260146101000a81548160ff021916908360ff16021790555082600381905550816004819055508060058190555050505050505050610594806102686000396000f3fe6080604052600436106100dd5760003560e01c8063984a470a1161007f578063b2016bd411610059578063b2016bd414610355578063c427af9b146103ac578063d84d2a471461041b578063f3f480d91461044c576100dd565b8063984a470a146102a85780639d89e7d4146102d3578063a619486e146102fe576100dd565b80631a39d8ef116100bb5780631a39d8ef146101d85780631ff1431114610203578063466ae314146102525780638ef8125e1461027d576100dd565b8063061a85c71461012b5780630853f7eb146101825780630f3e9438146101ad575b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050366000803760008036600084600019f43d6000803e8060008114610126573d6000f35b3d6000fd5b34801561013757600080fd5b50610140610477565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561018e57600080fd5b5061019761049d565b6040518082815260200191505060405180910390f35b3480156101b957600080fd5b506101c26104a3565b6040518082815260200191505060405180910390f35b3480156101e457600080fd5b506101ed6104a9565b6040518082815260200191505060405180910390f35b34801561020f57600080fd5b5061023c6004803603602081101561022657600080fd5b81019080803590602001909291905050506104af565b6040518082815260200191505060405180910390f35b34801561025e57600080fd5b506102676104c7565b6040518082815260200191505060405180910390f35b34801561028957600080fd5b506102926104cd565b6040518082815260200191505060405180910390f35b3480156102b457600080fd5b506102bd6104d3565b6040518082815260200191505060405180910390f35b3480156102df57600080fd5b506102e86104d9565b6040518082815260200191505060405180910390f35b34801561030a57600080fd5b506103136104df565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561036157600080fd5b5061036a610504565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103b857600080fd5b50610405600480360360408110156103cf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061052a565b6040518082815260200191505060405180910390f35b34801561042757600080fd5b5061043061054f565b604051808260ff1660ff16815260200191505060405180910390f35b34801561045857600080fd5b50610461610562565b6040518082815260200191505060405180910390f35b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b60085481565b600a5481565b600b6020528060005260406000206000915090505481565b60075481565b60095481565b60065481565b60045481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600c602052816000526040600020602052806000526040600020600091509150505481565b600260149054906101000a900460ff1681565b6003548156fea165627a7a7230582052d82f92036ae3d480ca814bd18c547f9ea020394feec8bbcbe34212d46f0ae40029", "deployedBytecode": "0x6080604052600436106100dd5760003560e01c8063984a470a1161007f578063b2016bd411610059578063b2016bd414610355578063c427af9b146103ac578063d84d2a471461041b578063f3f480d91461044c576100dd565b8063984a470a146102a85780639d89e7d4146102d3578063a619486e146102fe576100dd565b80631a39d8ef116100bb5780631a39d8ef146101d85780631ff1431114610203578063466ae314146102525780638ef8125e1461027d576100dd565b8063061a85c71461012b5780630853f7eb146101825780630f3e9438146101ad575b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050366000803760008036600084600019f43d6000803e8060008114610126573d6000f35b3d6000fd5b34801561013757600080fd5b50610140610477565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561018e57600080fd5b5061019761049d565b6040518082815260200191505060405180910390f35b3480156101b957600080fd5b506101c26104a3565b6040518082815260200191505060405180910390f35b3480156101e457600080fd5b506101ed6104a9565b6040518082815260200191505060405180910390f35b34801561020f57600080fd5b5061023c6004803603602081101561022657600080fd5b81019080803590602001909291905050506104af565b6040518082815260200191505060405180910390f35b34801561025e57600080fd5b506102676104c7565b6040518082815260200191505060405180910390f35b34801561028957600080fd5b506102926104cd565b6040518082815260200191505060405180910390f35b3480156102b457600080fd5b506102bd6104d3565b6040518082815260200191505060405180910390f35b3480156102df57600080fd5b506102e86104d9565b6040518082815260200191505060405180910390f35b34801561030a57600080fd5b506103136104df565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561036157600080fd5b5061036a610504565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103b857600080fd5b50610405600480360360408110156103cf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061052a565b6040518082815260200191505060405180910390f35b34801561042757600080fd5b5061043061054f565b604051808260ff1660ff16815260200191505060405180910390f35b34801561045857600080fd5b50610461610562565b6040518082815260200191505060405180910390f35b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b60085481565b600a5481565b600b6020528060005260406000206000915090505481565b60075481565b60095481565b60065481565b60045481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600c602052816000526040600020602052806000526040600020600091509150505481565b600260149054906101000a900460ff1681565b6003548156fea165627a7a7230582052d82f92036ae3d480ca814bd18c547f9ea020394feec8bbcbe34212d46f0ae40029", "sourceMap": "1164:1391:25:-;;;1687:866;8:9:-1;5:2;;;30:1;27;20:12;5:2;1687:866:25;;;;;;;;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;1687:866:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1937:7;644:1:29;621:25;;:11;:25;;;;613:34;;;;;;670:11;657:10;;:24;;;;;;;;;;;;;;;;;;551:137;2050:1:25;2013:39;;2021:16;2013:39;;;;:98;;;;;2109:1;2072:39;;2080:16;2072:39;;;;2013:98;:140;;;;;2152:1;2131:17;:22;;;;2013:140;:180;;;;;2192:1;2173:16;:20;2013:180;:220;;;;;2232:1;2213:16;:20;2013:220;:262;;;;;2274:1;2253:18;:22;2013:262;2002:274;;;;;;2304:16;2286:15;;:34;;;;;;;;;;;;;;;;;;2348:16;2330:15;;:34;;;;;;;;;;;;;;;;;;2393:17;2374:16;;:36;;;;;;;;;;;;;;;;;;2438:16;2420:15;:34;;;;2482:16;2464:15;:34;;;;2528:18;2508:17;:38;;;;1687:866;;;;;;;1164:1391;;;;;;", "deployedSourceMap": "1164:1391:25:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;657:29:25;;8:9:-1;5:2;;;30:1;27;20:12;5:2;657:29:25;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;827;;8:9:-1;5:2;;;30:1;27;20:12;5:2;827:29:25;;;:::i;:::-;;;;;;;;;;;;;;;;;;;942:22;;8:9:-1;5:2;;;30:1;27;20:12;5:2;942:22:25;;;:::i;:::-;;;;;;;;;;;;;;;;;;;1012:23;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1012:23:25;;;:::i;:::-;;;;;;;;;;;;;;;;;;;1041:48;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1041:48:25;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1041:48:25;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;896:40;;8:9:-1;5:2;;;30:1;27;20:12;5:2;896:40:25;;;:::i;:::-;;;;;;;;;;;;;;;;;;;970:35;;8:9:-1;5:2;;;30:1;27;20:12;5:2;970:35:25;;;:::i;:::-;;;;;;;;;;;;;;;;;;;863:27;;8:9:-1;5:2;;;30:1;27;20:12;5:2;863:27:25;;;:::i;:::-;;;;;;;;;;;;;;;;;;;794;;8:9:-1;5:2;;;30:1;27;20:12;5:2;794:27:25;;;:::i;:::-;;;;;;;;;;;;;;;;;;;205:25:29;;8:9:-1;5:2;;;30:1;27;20:12;5:2;205:25:29;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;692:28:25;;8:9:-1;5:2;;;30:1;27;20:12;5:2;692:28:25;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;1095:64;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1095:64:25;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1095:64:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;726:29;;8:9:-1;5:2;;;30:1;27;20:12;5:2;726:29:25;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;761:27;;8:9:-1;5:2;;;30:1;27;20:12;5:2;761:27:25;;;:::i;:::-;;;;;;;;;;;;;;;;;;;657:29;;;;;;;;;;;;;:::o;827:::-;;;;:::o;942:22::-;;;;:::o;1012:23::-;;;;:::o;1041:48::-;;;;;;;;;;;;;;;;;:::o;896:40::-;;;;:::o;970:35::-;;;;:::o;863:27::-;;;;:::o;794:::-;;;;:::o;205:25:29:-;;;;;;;;;;;;;:::o;692:28:25:-;;;;;;;;;;;;;:::o;1095:64::-;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;726:29::-;;;;;;;;;;;;;:::o;761:27::-;;;;:::o", "source": "pragma solidity ^0.5.0;\nimport \"../Oracles/Oracle.sol\";\nimport \"openzeppelin-solidity/contracts/token/ERC20/ERC20.sol\";\nimport \"openzeppelin-solidity/contracts/math/SafeMath.sol\";\nimport \"openzeppelin-solidity/contracts/drafts/SignedSafeMath.sol\";\nimport \"@gnosis.pm/util-contracts/contracts/Proxy.sol\";\n\n\ncontract UltimateOracleData {\n\n /*\n * Events\n */\n event ForwardedOracleOutcomeAssignment(int outcome);\n event OutcomeChallenge(address indexed sender, int outcome);\n event OutcomeVote(address indexed sender, int outcome, uint amount);\n event Withdrawal(address indexed sender, uint amount);\n\n /*\n * Storage\n */\n Oracle public forwardedOracle;\n ERC20 public collateralToken;\n uint8 public spreadMultiplier;\n uint public challengePeriod;\n uint public challengeAmount;\n uint public frontRunnerPeriod;\n\n int public forwardedOutcome;\n uint public forwardedOutcomeSetTimestamp;\n int public frontRunner;\n uint public frontRunnerSetTimestamp;\n\n uint public totalAmount;\n mapping (int => uint) public totalOutcomeAmounts;\n mapping (address => mapping (int => uint)) public outcomeAmounts;\n}\n\ncontract UltimateOracleProxy is Proxy, UltimateOracleData {\n\n /// @dev Constructor sets ultimate oracle properties\n /// @param _forwardedOracle Oracle address\n /// @param _collateralToken Collateral token address\n /// @param _spreadMultiplier Defines the spread as a multiple of the money bet on other outcomes\n /// @param _challengePeriod Time to challenge oracle outcome\n /// @param _challengeAmount Amount to challenge the outcome\n /// @param _frontRunnerPeriod Time to overbid the front-runner\n constructor(\n address proxied,\n Oracle _forwardedOracle,\n ERC20 _collateralToken,\n uint8 _spreadMultiplier,\n uint _challengePeriod,\n uint _challengeAmount,\n uint _frontRunnerPeriod\n )\n Proxy(proxied)\n public\n {\n // Validate inputs\n require( address(_forwardedOracle) != address(0)\n && address(_collateralToken) != address(0)\n && _spreadMultiplier >= 2\n && _challengePeriod > 0\n && _challengeAmount > 0\n && _frontRunnerPeriod > 0);\n forwardedOracle = _forwardedOracle;\n collateralToken = _collateralToken;\n spreadMultiplier = _spreadMultiplier;\n challengePeriod = _challengePeriod;\n challengeAmount = _challengeAmount;\n frontRunnerPeriod = _frontRunnerPeriod;\n }\n}\n\n/// @title Ultimate oracle contract - Allows to swap oracle result for ultimate oracle result\n/// @author Stefan George - <stefan@gnosis.pm>\ncontract UltimateOracle is Proxied, Oracle, UltimateOracleData {\n using SignedSafeMath for int;\n using SafeMath for uint;\n\n /*\n * Public functions\n */\n /// @dev Allows to set oracle outcome\n function setForwardedOutcome()\n public\n {\n // There was no challenge and the outcome was not set yet in the ultimate oracle but in the forwarded oracle\n require( !isChallenged()\n && forwardedOutcomeSetTimestamp == 0\n && forwardedOracle.isOutcomeSet());\n forwardedOutcome = forwardedOracle.getOutcome();\n forwardedOutcomeSetTimestamp = now;\n emit ForwardedOracleOutcomeAssignment(forwardedOutcome);\n }\n\n /// @dev Allows to challenge the oracle outcome\n /// @param _outcome Outcome to bid on\n function challengeOutcome(int _outcome)\n public\n {\n // There was no challenge yet or the challenge period expired\n require( !isChallenged()\n && !isChallengePeriodOver()\n && collateralToken.transferFrom(msg.sender, address(this), challengeAmount));\n outcomeAmounts[msg.sender][_outcome] = challengeAmount;\n totalOutcomeAmounts[_outcome] = challengeAmount;\n totalAmount = challengeAmount;\n frontRunner = _outcome;\n frontRunnerSetTimestamp = now;\n emit OutcomeChallenge(msg.sender, _outcome);\n }\n\n /// @dev Allows to challenge the oracle outcome\n /// @param _outcome Outcome to bid on\n /// @param amount Amount to bid\n function voteForOutcome(int _outcome, uint amount)\n public\n {\n uint maxAmount = (totalAmount - totalOutcomeAmounts[_outcome]).mul(spreadMultiplier);\n\n if (maxAmount > totalOutcomeAmounts[_outcome])\n maxAmount -= totalOutcomeAmounts[_outcome];\n else\n maxAmount = 0;\n\n if (amount > maxAmount)\n amount = maxAmount;\n // Outcome is challenged and front runner period is not over yet and tokens can be transferred\n require( isChallenged()\n && !isFrontRunnerPeriodOver()\n && collateralToken.transferFrom(msg.sender, address(this), amount));\n outcomeAmounts[msg.sender][_outcome] = outcomeAmounts[msg.sender][_outcome].add(amount);\n totalOutcomeAmounts[_outcome] = totalOutcomeAmounts[_outcome].add(amount);\n totalAmount = totalAmount.add(amount);\n if (_outcome != frontRunner && totalOutcomeAmounts[_outcome] > totalOutcomeAmounts[frontRunner])\n {\n frontRunner = _outcome;\n frontRunnerSetTimestamp = now;\n }\n emit OutcomeVote(msg.sender, _outcome, amount);\n }\n\n /// @dev Withdraws winnings for user\n /// @return Winnings\n function withdraw()\n public\n returns (uint amount)\n {\n // Outcome was challenged and ultimate outcome decided\n require(isFrontRunnerPeriodOver());\n amount = totalAmount.mul(outcomeAmounts[msg.sender][frontRunner]) / totalOutcomeAmounts[frontRunner];\n outcomeAmounts[msg.sender][frontRunner] = 0;\n // Transfer earnings to contributor\n require(collateralToken.transfer(msg.sender, amount));\n emit Withdrawal(msg.sender, amount);\n }\n\n /// @dev Checks if time to challenge the outcome is over\n /// @return Is challenge period over?\n function isChallengePeriodOver()\n public\n view\n returns (bool)\n {\n return forwardedOutcomeSetTimestamp != 0 && now.sub(forwardedOutcomeSetTimestamp) > challengePeriod;\n }\n\n /// @dev Checks if time to overbid the front runner is over\n /// @return Is front runner period over?\n function isFrontRunnerPeriodOver()\n public\n view\n returns (bool)\n {\n return frontRunnerSetTimestamp != 0 && now.sub(frontRunnerSetTimestamp) > frontRunnerPeriod;\n }\n\n /// @dev Checks if outcome was challenged\n /// @return Is challenged?\n function isChallenged()\n public\n view\n returns (bool)\n {\n return frontRunnerSetTimestamp != 0;\n }\n\n /// @dev Returns if winning outcome is set\n /// @return Is outcome set?\n function isOutcomeSet()\n public\n view\n returns (bool)\n {\n return isChallengePeriodOver() && !isChallenged()\n || isFrontRunnerPeriodOver();\n }\n\n /// @dev Returns winning outcome\n /// @return Outcome\n function getOutcome()\n public\n view\n returns (int)\n {\n if (isFrontRunnerPeriodOver())\n return frontRunner;\n return forwardedOutcome;\n }\n}\n", "sourcePath": "/home/alan/src/github.com/gnosis/pm-contracts/contracts/Oracles/UltimateOracle.sol", "ast": { "absolutePath": "/home/alan/src/github.com/gnosis/pm-contracts/contracts/Oracles/UltimateOracle.sol", "exportedSymbols": { "UltimateOracle": [ 5603 ], "UltimateOracleData": [ 5165 ], "UltimateOracleProxy": [ 5249 ] }, "id": 5604, "nodeType": "SourceUnit", "nodes": [ { "id": 5103, "literals": [ "solidity", "^", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:25" }, { "absolutePath": "/home/alan/src/github.com/gnosis/pm-contracts/contracts/Oracles/Oracle.sol", "file": "../Oracles/Oracle.sol", "id": 5104, "nodeType": "ImportDirective", "scope": 5604, "sourceUnit": 4842, "src": "24:31:25", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol", "file": "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol", "id": 5105, "nodeType": "ImportDirective", "scope": 5604, "sourceUnit": 7779, "src": "56:63:25", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "openzeppelin-solidity/contracts/math/SafeMath.sol", "file": "openzeppelin-solidity/contracts/math/SafeMath.sol", "id": 5106, "nodeType": "ImportDirective", "scope": 5604, "sourceUnit": 7382, "src": "120:59:25", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "openzeppelin-solidity/contracts/drafts/SignedSafeMath.sol", "file": "openzeppelin-solidity/contracts/drafts/SignedSafeMath.sol", "id": 5107, "nodeType": "ImportDirective", "scope": 5604, "sourceUnit": 7249, "src": "180:67:25", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@gnosis.pm/util-contracts/contracts/Proxy.sol", "file": "@gnosis.pm/util-contracts/contracts/Proxy.sol", "id": 5108, "nodeType": "ImportDirective", "scope": 5604, "sourceUnit": 6829, "src": "248:55:25", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 5165, "linearizedBaseContracts": [ 5165 ], "name": "UltimateOracleData", "nodeType": "ContractDefinition", "nodes": [ { "anonymous": false, "documentation": null, "id": 5112, "name": "ForwardedOracleOutcomeAssignment", "nodeType": "EventDefinition", "parameters": { "id": 5111, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 5110, "indexed": false, "name": "outcome", "nodeType": "VariableDeclaration", "scope": 5112, "src": "410:11:25", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_int256", "typeString": "int256" }, "typeName": { "id": 5109, "name": "int", "nodeType": "ElementaryTypeName", "src": "410:3:25", "typeDescriptions": { "typeIdentifier": "t_int256", "typeString": "int256" } }, "value": null, "visibility": "internal" } ], "src": "409:13:25" }, "src": "371:52:25" }, { "anonymous": false, "documentation": null, "id": 5118, "name": "OutcomeChallenge", "nodeType": "EventDefinition", "parameters": { "id": 5117, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 5114, "indexed": true, "name": "sender", "nodeType": "VariableDeclaration", "scope": 5118, "src": "451:22:25", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 5113, "name": "address", "nodeType": "ElementaryTypeName", "src": "451:7:25", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 5116, "indexed": false, "name": "outcome", "nodeType": "VariableDeclaration", "scope": 5118, "src": "475:11:25", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_int256", "typeString": "int256" }, "typeName": { "id": 5115, "name": "int", "nodeType": "ElementaryTypeName", "src": "475:3:25", "typeDescriptions": { "typeIdentifier": "t_int256", "typeString": "int256" } }, "value": null, "visibility": "internal" } ], "src": "450:37:25" }, "src": "428:60:25" }, { "anonymous": false, "documentation": null, "id": 5126, "name": "OutcomeVote", "nodeType": "EventDefinition", "parameters": { "id": 5125, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 5120, "indexed": true, "name": "sender", "nodeType": "VariableDeclaration", "scope": 5126, "src": "511:22:25", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 5119, "name": "address", "nodeType": "ElementaryTypeName", "src": "511:7:25", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 5122, "indexed": false, "name": "outcome", "nodeType": "VariableDeclaration", "scope": 5126, "src": "535:11:25", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_int256", "typeString": "int256" }, "typeName": { "id": 5121, "name": "int", "nodeType": "ElementaryTypeName", "src": "535:3:25", "typeDescriptions": { "typeIdentifier": "t_int256", "typeString": "int256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 5124, "indexed": false, "name": "amount", "nodeType": "VariableDeclaration", "scope": 5126, "src": "548:11:25", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 5123, "name": "uint", "nodeType": "ElementaryTypeName", "src": "548:4:25", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "510:50:25" }, "src": "493:68:25" }, { "anonymous": false, "documentation": null, "id": 5132, "name": "Withdrawal", "nodeType": "EventDefinition", "parameters": { "id": 5131, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 5128, "indexed": true, "name": "sender", "nodeType": "VariableDeclaration", "scope": 5132, "src": "583:22:25", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 5127, "name": "address", "nodeType": "ElementaryTypeName", "src": "583:7:25", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 5130, "indexed": false, "name": "amount", "nodeType": "VariableDeclaration", "scope": 5132, "src": "607:11:25", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 5129, "name": "uint", "nodeType": "ElementaryTypeName", "src": "607:4:25", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "582:37:25" }, "src": "566:54:25" }, { "constant": false, "id": 5134, "name": "forwardedOracle", "nodeType": "VariableDeclaration", "scope": 5165, "src": "657:29:25", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_Oracle_$4841", "typeString": "contract Oracle" }, "typeName": { "contractScope": null, "id": 5133, "name": "Oracle", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 4841, "src": "657:6:25", "typeDescriptions": { "typeIdentifier": "t_contract$_Oracle_$4841", "typeString": "contract Oracle" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 5136, "name": "collateralToken", "nodeType": "VariableDeclaration", "scope": 5165, "src": "692:28:25", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_ERC20_$7778", "typeString": "contract ERC20" }, "typeName": { "contractScope": null, "id": 5135, "name": "ERC20", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 7778, "src": "692:5:25", "typeDescriptions": { "typeIdentifier": "t_contract$_ERC20_$7778", "typeString": "contract ERC20" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 5138, "name": "spreadMultiplier", "nodeType": "VariableDeclaration", "scope": 5165, "src": "726:29:25", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "typeName": { "id": 5137, "name": "uint8", "nodeType": "ElementaryTypeName", "src": "726:5:25", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 5140, "name": "challengePeriod", "nodeType": "VariableDeclaration", "scope": 5165, "src": "761:27:25", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 5139, "name": "uint", "nodeType": "ElementaryTypeName", "src": "761:4:25", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 5142, "name": "challengeAmount", "nodeType": "VariableDeclaration", "scope": 5165, "src": "794:27:25", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 5141, "name": "uint", "nodeType": "ElementaryTypeName", "src": "794:4:25", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 5144, "name": "frontRunnerPeriod", "nodeType": "VariableDeclaration", "scope": 5165, "src": "827:29:25", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 5143, "name": "uint", "nodeType": "ElementaryTypeName", "src": "827:4:25", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 5146, "name": "forwardedOutcome", "nodeType": "VariableDeclaration", "scope": 5165, "src": "863:27:25", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_int256", "typeString": "int256" }, "typeName": { "id": 5145, "name": "int", "nodeType": "ElementaryTypeName", "src": "863:3:25", "typeDescriptions": { "typeIdentifier": "t_int256", "typeString": "int256" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 5148, "name": "forwardedOutcomeSetTimestamp", "nodeType": "VariableDeclaration", "scope": 5165, "src": "896:40:25", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 5147, "name": "uint", "nodeType": "ElementaryTypeName", "src": "896:4:25", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 5150, "name": "frontRunner", "nodeType": "VariableDeclaration", "scope": 5165, "src": "942:22:25", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_int256", "typeString": "int256" }, "typeName": { "id":