@gnosis.pm/pm-contracts
Version:
Collection of smart contracts for the Gnosis prediction market platform
110 lines • 910 kB
JSON
{
"contractName": "LMSRMarketMaker",
"abi": [
{
"constant": true,
"inputs": [
{
"name": "market",
"type": "address"
},
{
"name": "outcomeTokenAmounts",
"type": "int256[]"
}
],
"name": "calcNetCost",
"outputs": [
{
"name": "netCost",
"type": "int256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "market",
"type": "address"
},
{
"name": "outcomeTokenIndex",
"type": "uint8"
},
{
"name": "outcomeTokenCount",
"type": "uint256"
}
],
"name": "calcCost",
"outputs": [
{
"name": "cost",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "market",
"type": "address"
},
{
"name": "outcomeTokenIndex",
"type": "uint8"
},
{
"name": "outcomeTokenCount",
"type": "uint256"
}
],
"name": "calcProfit",
"outputs": [
{
"name": "profit",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "market",
"type": "address"
},
{
"name": "outcomeTokenIndex",
"type": "uint8"
}
],
"name": "calcMarginalPrice",
"outputs": [
{
"name": "price",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
],
"metadata": "{\"compiler\":{\"version\":\"0.5.6+commit.b259423e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[{\"name\":\"market\",\"type\":\"address\"},{\"name\":\"outcomeTokenAmounts\",\"type\":\"int256[]\"}],\"name\":\"calcNetCost\",\"outputs\":[{\"name\":\"netCost\",\"type\":\"int256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"market\",\"type\":\"address\"},{\"name\":\"outcomeTokenIndex\",\"type\":\"uint8\"},{\"name\":\"outcomeTokenCount\",\"type\":\"uint256\"}],\"name\":\"calcProfit\",\"outputs\":[{\"name\":\"profit\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"market\",\"type\":\"address\"},{\"name\":\"outcomeTokenIndex\",\"type\":\"uint8\"},{\"name\":\"outcomeTokenCount\",\"type\":\"uint256\"}],\"name\":\"calcCost\",\"outputs\":[{\"name\":\"cost\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"market\",\"type\":\"address\"},{\"name\":\"outcomeTokenIndex\",\"type\":\"uint8\"}],\"name\":\"calcMarginalPrice\",\"outputs\":[{\"name\":\"price\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Alan Lu - <alan.lu@gnosis.pm>\",\"methods\":{\"calcCost(address,uint8,uint256)\":{\"details\":\"Returns cost to buy given number of outcome tokens\",\"params\":{\"market\":\"Market contract\",\"outcomeTokenCount\":\"Number of outcome tokens to buy\",\"outcomeTokenIndex\":\"Index of outcome to buy\"},\"return\":\"Cost\"},\"calcMarginalPrice(address,uint8)\":{\"details\":\"Returns marginal price of an outcome\",\"params\":{\"market\":\"Market contract\",\"outcomeTokenIndex\":\"Index of outcome to determine marginal price of\"},\"return\":\"Marginal price of an outcome as a fixed point number\"},\"calcNetCost(address,int256[])\":{\"details\":\"Calculates the net cost for executing a given trade.\",\"params\":{\"market\":\"Market contract\",\"outcomeTokenAmounts\":\"Amounts of outcome tokens to buy from the market. If an amount is negative, represents an amount to sell to the market.\"},\"return\":\"Net cost of trade. If positive, represents amount of collateral which would be paid to the market for the trade. If negative, represents amount of collateral which would be received from the market for the trade.\"},\"calcProfit(address,uint8,uint256)\":{\"details\":\"Returns profit for selling given number of outcome tokens\",\"params\":{\"market\":\"Market contract\",\"outcomeTokenCount\":\"Number of outcome tokens to sell\",\"outcomeTokenIndex\":\"Index of outcome to sell\"},\"return\":\"Profit\"}},\"title\":\"LMSR market maker contract - Calculates share prices based on share distribution and initial funding\"},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/alan/src/github.com/gnosis/pm-contracts/contracts/MarketMakers/LMSRMarketMaker.sol\":\"LMSRMarketMaker\"},\"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/MarketMakers/LMSRMarketMaker.sol\":{\"keccak256\":\"0xcf8c9b164ae8ce9d08348c8751a5a1465456af9a40954e4d97b73590b098f8a7\",\"urls\":[\"bzzr://11c580dfdb542c3514f30cecf9cdfbaafb716f95f3650257f2438e8063496958\"]},\"/home/alan/src/github.com/gnosis/pm-contracts/contracts/MarketMakers/MarketMaker.sol\":{\"keccak256\":\"0xa71f8ce92412033d0900d44c01f0702aefced87d860cf116c6a4d3efe86913cf\",\"urls\":[\"bzzr://63c5bf60b931bb032fcab23514a3db171b680b11d8c6c05ac8caa88752e3be41\"]},\"/home/alan/src/github.com/gnosis/pm-contracts/contracts/Markets/Market.sol\":{\"keccak256\":\"0x7bc1ebf0ea0f4cd9b6e9bfff6c6ac9088c253bcfca4e27f31e5845799f0278d8\",\"urls\":[\"bzzr://5e3f86d96ab269d284b34563501469d539cc436d62f070dd0abda2519d5e60c0\"]},\"/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/Fixed192x64Math.sol\":{\"keccak256\":\"0xad15b641bf8f5862034749b679ab91cb2c330c2ca997da4455863dc169ab82d4\",\"urls\":[\"bzzr://a37b3d23f367b7f0ba4669c417af754260f0dbedad21294079aed622222427f5\"]},\"@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": "0x608060405234801561001057600080fd5b506117a6806100206000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806338bf0452146100515780634091c6a91461013d578063bd8ff817146101ac578063d812d3461461021b575b600080fd5b6101276004803603604081101561006757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001906401000000008111156100a457600080fd5b8201836020820111156100b657600080fd5b803590602001918460208302840111640100000000831117156100d857600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610280565b6040518082815260200191505060405180910390f35b6101966004803603606081101561015357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190803590602001909291905050506105fa565b6040518082815260200191505060405180910390f35b610205600480360360608110156101c257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190803590602001909291905050506108f1565b6040518082815260200191505060405180910390f35b61026a6004803603604081101561023157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610c32565b6040518082815260200191505060405180910390f35b600060018373ffffffffffffffffffffffffffffffffffffffff1663e274fd246040518163ffffffff1660e01b815260040160206040518083038186803b1580156102ca57600080fd5b505afa1580156102de573d6000803e3d6000fd5b505050506040513d60208110156102f457600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff16637dc8f0866040518163ffffffff1660e01b815260040160206040518083038186803b15801561034a57600080fd5b505afa15801561035e573d6000803e3d6000fd5b505050506040513d602081101561037457600080fd5b810190808051906020019092919050505060ff161161039257600080fd5b606061039d84610ec6565b9050600073__Fixed192x64Math_______________________63137bf7986801000000000000000084510260016040518363ffffffff1660e01b8152600401808381526020018260028111156103ef57fe5b60ff1681526020019250505060206040518083038186803b15801561041357600080fd5b505af4158015610427573d6000803e3d6000fd5b505050506040513d602081101561043d57600080fd5b8101908080519060200190929190505050905060008573ffffffffffffffffffffffffffffffffffffffff1663cb4c86b76040518163ffffffff1660e01b815260040160206040518083038186803b15801561049857600080fd5b505afa1580156104ac573d6000803e3d6000fd5b505050506040513d60208110156104c257600080fd5b8101908080519060200190929190505050905060006104e483858460006110cc565b905085518451146104f457600080fd5b60008090505b84518160ff16101561056d57610545878260ff168151811061051857fe5b6020026020010151868360ff168151811061052f57fe5b60200260200101516111de90919063ffffffff16565b858260ff168151811061055457fe5b60200260200101818152505080806001019150506104fa565b50600061057d84868560016110cc565b9050610592828261126c90919063ffffffff16565b95506000861315806105b7575085680100000000000000008088816105b357fe5b0502145b156105d6576801000000000000000086816105ce57fe5b0595506105ef565b60016801000000000000000087816105ea57fe5b050195505b505050505092915050565b600060018473ffffffffffffffffffffffffffffffffffffffff1663e274fd246040518163ffffffff1660e01b815260040160206040518083038186803b15801561064457600080fd5b505afa158015610658573d6000803e3d6000fd5b505050506040513d602081101561066e57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff16637dc8f0866040518163ffffffff1660e01b815260040160206040518083038186803b1580156106c457600080fd5b505afa1580156106d8573d6000803e3d6000fd5b505050506040513d60208110156106ee57600080fd5b810190808051906020019092919050505060ff161161070c57600080fd5b606061071785610ec6565b9050600073__Fixed192x64Math_______________________63137bf7986801000000000000000084510260016040518363ffffffff1660e01b81526004018083815260200182600281111561076957fe5b60ff1681526020019250505060206040518083038186803b15801561078d57600080fd5b505af41580156107a1573d6000803e3d6000fd5b505050506040513d60208110156107b757600080fd5b8101908080519060200190929190505050905060008673ffffffffffffffffffffffffffffffffffffffff1663cb4c86b76040518163ffffffff1660e01b815260040160206040518083038186803b15801561081257600080fd5b505afa158015610826573d6000803e3d6000fd5b505050506040513d602081101561083c57600080fd5b81019080805190602001909291905050509050600061085e83858460006110cc565b9050600086121561086e57600080fd5b61089786858960ff168151811061088157fe5b602002602001015161126c90919063ffffffff16565b848860ff16815181106108a657fe5b60200260200101818152505060006108c184868560016110cc565b90508082136108ce578091505b68010000000000000000818303816108e257fe5b04955050505050509392505050565b600060018473ffffffffffffffffffffffffffffffffffffffff1663e274fd246040518163ffffffff1660e01b815260040160206040518083038186803b15801561093b57600080fd5b505afa15801561094f573d6000803e3d6000fd5b505050506040513d602081101561096557600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff16637dc8f0866040518163ffffffff1660e01b815260040160206040518083038186803b1580156109bb57600080fd5b505afa1580156109cf573d6000803e3d6000fd5b505050506040513d60208110156109e557600080fd5b810190808051906020019092919050505060ff1611610a0357600080fd5b6060610a0e85610ec6565b9050600073__Fixed192x64Math_______________________63137bf7986801000000000000000084510260016040518363ffffffff1660e01b815260040180838152602001826002811115610a6057fe5b60ff1681526020019250505060206040518083038186803b158015610a8457600080fd5b505af4158015610a98573d6000803e3d6000fd5b505050506040513d6020811015610aae57600080fd5b8101908080519060200190929190505050905060008673ffffffffffffffffffffffffffffffffffffffff1663cb4c86b76040518163ffffffff1660e01b815260040160206040518083038186803b158015610b0957600080fd5b505afa158015610b1d573d6000803e3d6000fd5b505050506040513d6020811015610b3357600080fd5b810190808051906020019092919050505090506000610b5583858460006110cc565b90506000861215610b6557600080fd5b610b8e86858960ff1681518110610b7857fe5b60200260200101516111de90919063ffffffff16565b848860ff1681518110610b9d57fe5b6020026020010181815250506000610bb884868560016110cc565b905081811215610bc6578190505b81810395508568010000000000000000808881610bdf57fe5b04021415610c0157680100000000000000008681610bf957fe5b049550610c1a565b6001680100000000000000008781610c1557fe5b040195505b86861115610c26578695505b50505050509392505050565b600060018373ffffffffffffffffffffffffffffffffffffffff1663e274fd246040518163ffffffff1660e01b815260040160206040518083038186803b158015610c7c57600080fd5b505afa158015610c90573d6000803e3d6000fd5b505050506040513d6020811015610ca657600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff16637dc8f0866040518163ffffffff1660e01b815260040160206040518083038186803b158015610cfc57600080fd5b505afa158015610d10573d6000803e3d6000fd5b505050506040513d6020811015610d2657600080fd5b810190808051906020019092919050505060ff1611610d4457600080fd5b6060610d4f84610ec6565b9050600073__Fixed192x64Math_______________________63137bf7986801000000000000000084510260026040518363ffffffff1660e01b815260040180838152602001826002811115610da157fe5b60ff1681526020019250505060206040518083038186803b158015610dc557600080fd5b505af4158015610dd9573d6000803e3d6000fd5b505050506040513d6020811015610def57600080fd5b8101908080519060200190929190505050905060008573ffffffffffffffffffffffffffffffffffffffff1663cb4c86b76040518163ffffffff1660e01b815260040160206040518083038186803b158015610e4a57600080fd5b505afa158015610e5e573d6000803e3d6000fd5b505050506040513d6020811015610e7457600080fd5b81019080805190602001909291905050509050600080610e988486858a60026112fa565b9250509150680100000000000000008281610eaf57fe5b048181610eb857fe5b049550505050505092915050565b60608173ffffffffffffffffffffffffffffffffffffffff1663e274fd246040518163ffffffff1660e01b815260040160206040518083038186803b158015610f0e57600080fd5b505afa158015610f22573d6000803e3d6000fd5b505050506040513d6020811015610f3857600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff16637dc8f0866040518163ffffffff1660e01b815260040160206040518083038186803b158015610f8e57600080fd5b505afa158015610fa2573d6000803e3d6000fd5b505050506040513d6020811015610fb857600080fd5b810190808051906020019092919050505060ff16604051908082528060200260200182016040528015610ffa5781602001602082028038833980820191505090505b50905060008090505b81518160ff1610156110c6578273ffffffffffffffffffffffffffffffffffffffff1663a157979c826040518263ffffffff1660e01b8152600401808260ff16815260200191505060206040518083038186803b15801561106357600080fd5b505afa158015611077573d6000803e3d6000fd5b505050506040513d602081101561108d57600080fd5b8101908080519060200190929190505050828260ff16815181106110ad57fe5b6020026020010181815250508080600101915050611003565b50919050565b60008060006110df8787876000886112fa565b509150915073__Fixed192x64Math_______________________63137bf79883866040518363ffffffff1660e01b81526004018083815260200182600281111561112557fe5b60ff1681526020019250505060206040518083038186803b15801561114957600080fd5b505af415801561115d573d6000803e3d6000fd5b505050506040513d602081101561117357600080fd5b8101908080519060200190929190505050925061119981846111de90919063ffffffff16565b92506111d285886111bc680100000000000000008761155c90919063ffffffff16565b816111c357fe5b0561155c90919063ffffffff16565b92505050949350505050565b6000808284019050600083121580156111f75750838112155b8061120d575060008312801561120c57508381125b5b611262576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061170f6021913960400191505060405180910390fd5b8091505092915050565b6000808284039050600083121580156112855750838113155b8061129b575060008312801561129a57508381135b5b6112f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806117576024913960400191505060405180910390fd5b8091505092915050565b6000806000808812158015611310575060008612155b61131957600080fd5b73__Fixed192x64Math_______________________63ccc13814886040518263ffffffff1660e01b81526004018080602001828103825283818151815260200191508051906020019060200280838360005b8381101561138657808201518184015260208101905061136b565b505050509050019250505060206040518083038186803b1580156113a957600080fd5b505af41580156113bd573d6000803e3d6000fd5b505050506040513d60208110156113d357600080fd5b81019080805190602001909291905050509150856113fa898461155c90919063ffffffff16565b8161140157fe5b05915061142068b800000000000000008361126c90919063ffffffff16565b9150600080600090505b88518160ff16101561154f5773__Fixed192x64Math_______________________631d580123611494868b61147e8f8f8860ff168151811061146857fe5b602002602001015161155c90919063ffffffff16565b8161148557fe5b0561126c90919063ffffffff16565b886040518363ffffffff1660e01b8152600401808381526020018260028111156114ba57fe5b60ff1681526020019250505060206040518083038186803b1580156114de57600080fd5b505af41580156114f2573d6000803e3d6000fd5b505050506040513d602081101561150857600080fd5b810190808051906020019092919050505091508660ff168160ff16141561152d578192505b611540828661168690919063ffffffff16565b9450808060010191505061142a565b5050955095509592505050565b60008083141561156f5760009050611680565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831480156115bd57507f800000000000000000000000000000000000000000000000000000000000000082145b15611613576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260278152602001806117306027913960400191505060405180910390fd5b600082840290508284828161162457fe5b051461167b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260278152602001806117306027913960400191505060405180910390fd5b809150505b92915050565b600080828401905083811015611704576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe5369676e6564536166654d6174683a206164646974696f6e206f766572666c6f775369676e6564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775369676e6564536166654d6174683a207375627472616374696f6e206f766572666c6f77a165627a7a723058202e3aace01203b4e2a833f95ca344b0c3ad857069549785196995710f6669eeea0029",
"deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806338bf0452146100515780634091c6a91461013d578063bd8ff817146101ac578063d812d3461461021b575b600080fd5b6101276004803603604081101561006757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001906401000000008111156100a457600080fd5b8201836020820111156100b657600080fd5b803590602001918460208302840111640100000000831117156100d857600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610280565b6040518082815260200191505060405180910390f35b6101966004803603606081101561015357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190803590602001909291905050506105fa565b6040518082815260200191505060405180910390f35b610205600480360360608110156101c257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190803590602001909291905050506108f1565b6040518082815260200191505060405180910390f35b61026a6004803603604081101561023157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610c32565b6040518082815260200191505060405180910390f35b600060018373ffffffffffffffffffffffffffffffffffffffff1663e274fd246040518163ffffffff1660e01b815260040160206040518083038186803b1580156102ca57600080fd5b505afa1580156102de573d6000803e3d6000fd5b505050506040513d60208110156102f457600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff16637dc8f0866040518163ffffffff1660e01b815260040160206040518083038186803b15801561034a57600080fd5b505afa15801561035e573d6000803e3d6000fd5b505050506040513d602081101561037457600080fd5b810190808051906020019092919050505060ff161161039257600080fd5b606061039d84610ec6565b9050600073__Fixed192x64Math_______________________63137bf7986801000000000000000084510260016040518363ffffffff1660e01b8152600401808381526020018260028111156103ef57fe5b60ff1681526020019250505060206040518083038186803b15801561041357600080fd5b505af4158015610427573d6000803e3d6000fd5b505050506040513d602081101561043d57600080fd5b8101908080519060200190929190505050905060008573ffffffffffffffffffffffffffffffffffffffff1663cb4c86b76040518163ffffffff1660e01b815260040160206040518083038186803b15801561049857600080fd5b505afa1580156104ac573d6000803e3d6000fd5b505050506040513d60208110156104c257600080fd5b8101908080519060200190929190505050905060006104e483858460006110cc565b905085518451146104f457600080fd5b60008090505b84518160ff16101561056d57610545878260ff168151811061051857fe5b6020026020010151868360ff168151811061052f57fe5b60200260200101516111de90919063ffffffff16565b858260ff168151811061055457fe5b60200260200101818152505080806001019150506104fa565b50600061057d84868560016110cc565b9050610592828261126c90919063ffffffff16565b95506000861315806105b7575085680100000000000000008088816105b357fe5b0502145b156105d6576801000000000000000086816105ce57fe5b0595506105ef565b60016801000000000000000087816105ea57fe5b050195505b505050505092915050565b600060018473ffffffffffffffffffffffffffffffffffffffff1663e274fd246040518163ffffffff1660e01b815260040160206040518083038186803b15801561064457600080fd5b505afa158015610658573d6000803e3d6000fd5b505050506040513d602081101561066e57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff16637dc8f0866040518163ffffffff1660e01b815260040160206040518083038186803b1580156106c457600080fd5b505afa1580156106d8573d6000803e3d6000fd5b505050506040513d60208110156106ee57600080fd5b810190808051906020019092919050505060ff161161070c57600080fd5b606061071785610ec6565b9050600073__Fixed192x64Math_______________________63137bf7986801000000000000000084510260016040518363ffffffff1660e01b81526004018083815260200182600281111561076957fe5b60ff1681526020019250505060206040518083038186803b15801561078d57600080fd5b505af41580156107a1573d6000803e3d6000fd5b505050506040513d60208110156107b757600080fd5b8101908080519060200190929190505050905060008673ffffffffffffffffffffffffffffffffffffffff1663cb4c86b76040518163ffffffff1660e01b815260040160206040518083038186803b15801561081257600080fd5b505afa158015610826573d6000803e3d6000fd5b505050506040513d602081101561083c57600080fd5b81019080805190602001909291905050509050600061085e83858460006110cc565b9050600086121561086e57600080fd5b61089786858960ff168151811061088157fe5b602002602001015161126c90919063ffffffff16565b848860ff16815181106108a657fe5b60200260200101818152505060006108c184868560016110cc565b90508082136108ce578091505b68010000000000000000818303816108e257fe5b04955050505050509392505050565b600060018473ffffffffffffffffffffffffffffffffffffffff1663e274fd246040518163ffffffff1660e01b815260040160206040518083038186803b15801561093b57600080fd5b505afa15801561094f573d6000803e3d6000fd5b505050506040513d602081101561096557600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff16637dc8f0866040518163ffffffff1660e01b815260040160206040518083038186803b1580156109bb57600080fd5b505afa1580156109cf573d6000803e3d6000fd5b505050506040513d60208110156109e557600080fd5b810190808051906020019092919050505060ff1611610a0357600080fd5b6060610a0e85610ec6565b9050600073__Fixed192x64Math_______________________63137bf7986801000000000000000084510260016040518363ffffffff1660e01b815260040180838152602001826002811115610a6057fe5b60ff1681526020019250505060206040518083038186803b158015610a8457600080fd5b505af4158015610a98573d6000803e3d6000fd5b505050506040513d6020811015610aae57600080fd5b8101908080519060200190929190505050905060008673ffffffffffffffffffffffffffffffffffffffff1663cb4c86b76040518163ffffffff1660e01b815260040160206040518083038186803b158015610b0957600080fd5b505afa158015610b1d573d6000803e3d6000fd5b505050506040513d6020811015610b3357600080fd5b810190808051906020019092919050505090506000610b5583858460006110cc565b90506000861215610b6557600080fd5b610b8e86858960ff1681518110610b7857fe5b60200260200101516111de90919063ffffffff16565b848860ff1681518110610b9d57fe5b6020026020010181815250506000610bb884868560016110cc565b905081811215610bc6578190505b81810395508568010000000000000000808881610bdf57fe5b04021415610c0157680100000000000000008681610bf957fe5b049550610c1a565b6001680100000000000000008781610c1557fe5b040195505b86861115610c26578695505b50505050509392505050565b600060018373ffffffffffffffffffffffffffffffffffffffff1663e274fd246040518163ffffffff1660e01b815260040160206040518083038186803b158015610c7c57600080fd5b505afa158015610c90573d6000803e3d6000fd5b505050506040513d6020811015610ca657600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff16637dc8f0866040518163ffffffff1660e01b815260040160206040518083038186803b158015610cfc57600080fd5b505afa158015610d10573d6000803e3d6000fd5b505050506040513d6020811015610d2657600080fd5b810190808051906020019092919050505060ff1611610d4457600080fd5b6060610d4f84610ec6565b9050600073__Fixed192x64Math_______________________63137bf7986801000000000000000084510260026040518363ffffffff1660e01b815260040180838152602001826002811115610da157fe5b60ff1681526020019250505060206040518083038186803b158015610dc557600080fd5b505af4158015610dd9573d6000803e3d6000fd5b505050506040513d6020811015610def57600080fd5b8101908080519060200190929190505050905060008573ffffffffffffffffffffffffffffffffffffffff1663cb4c86b76040518163ffffffff1660e01b815260040160206040518083038186803b158015610e4a57600080fd5b505afa158015610e5e573d6000803e3d6000fd5b505050506040513d6020811015610e7457600080fd5b81019080805190602001909291905050509050600080610e988486858a60026112fa565b9250509150680100000000000000008281610eaf57fe5b048181610eb857fe5b049550505050505092915050565b60608173ffffffffffffffffffffffffffffffffffffffff1663e274fd246040518163ffffffff1660e01b815260040160206040518083038186803b158015610f0e57600080fd5b505afa158015610f22573d6000803e3d6000fd5b505050506040513d6020811015610f3857600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff16637dc8f0866040518163ffffffff1660e01b815260040160206040518083038186803b158015610f8e57600080fd5b505afa158015610fa2573d6000803e3d6000fd5b505050506040513d6020811015610fb857600080fd5b810190808051906020019092919050505060ff16604051908082528060200260200182016040528015610ffa5781602001602082028038833980820191505090505b50905060008090505b81518160ff1610156110c6578273ffffffffffffffffffffffffffffffffffffffff1663a157979c826040518263ffffffff1660e01b8152600401808260ff16815260200191505060206040518083038186803b15801561106357600080fd5b505afa158015611077573d6000803e3d6000fd5b505050506040513d602081101561108d57600080fd5b8101908080519060200190929190505050828260ff16815181106110ad57fe5b6020026020010181815250508080600101915050611003565b50919050565b60008060006110df8787876000886112fa565b509150915073__Fixed192x64Math_______________________63137bf79883866040518363ffffffff1660e01b81526004018083815260200182600281111561112557fe5b60ff1681526020019250505060206040518083038186803b15801561114957600080fd5b505af415801561115d573d6000803e3d6000fd5b505050506040513d602081101561117357600080fd5b8101908080519060200190929190505050925061119981846111de90919063ffffffff16565b92506111d285886111bc680100000000000000008761155c90919063ffffffff16565b816111c357fe5b0561155c90919063ffffffff16565b92505050949350505050565b6000808284019050600083121580156111f75750838112155b8061120d575060008312801561120c57508381125b5b611262576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061170f6021913960400191505060405180910390fd5b8091505092915050565b6000808284039050600083121580156112855750838113155b8061129b575060008312801561129a57508381135b5b6112f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806117576024913960400191505060405180910390fd5b8091505092915050565b6000806000808812158015611310575060008612155b61131957600080fd5b73__Fixed192x64Math_______________________63ccc13814886040518263ffffffff1660e01b81526004018080602001828103825283818151815260200191508051906020019060200280838360005b8381101561138657808201518184015260208101905061136b565b505050509050019250505060206040518083038186803b1580156113a957600080fd5b505af41580156113bd573d6000803e3d6000fd5b505050506040513d60208110156113d357600080fd5b81019080805190602001909291905050509150856113fa898461155c90919063ffffffff16565b8161140157fe5b05915061142068b800000000000000008361126c90919063ffffffff16565b9150600080600090505b88518160ff16101561154f5773__Fixed192x64Math_______________________631d580123611494868b61147e8f8f8860ff168151811061146857fe5b602002602001015161155c90919063ffffffff16565b8161148557fe5b0561126c90919063ffffffff16565b886040518363ffffffff1660e01b8152600401808381526020018260028111156114ba57fe5b60ff1681526020019250505060206040518083038186803b1580156114de57600080fd5b505af41580156114f2573d6000803e3d6000fd5b505050506040513d602081101561150857600080fd5b810190808051906020019092919050505091508660ff168160ff16141561152d578192505b611540828661168690919063ffffffff16565b9450808060010191505061142a565b5050955095509592505050565b60008083141561156f5760009050611680565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831480156115bd57507f800000000000000000000000000000000000000000000000000000000000000082145b15611613576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260278152602001806117306027913960400191505060405180910390fd5b600082840290508284828161162457fe5b051461167b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260278152602001806117306027913960400191505060405180910390fd5b809150505b92915050565b600080828401905083811015611704576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe5369676e6564536166654d6174683a206164646974696f6e206f766572666c6f775369676e6564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775369676e6564536166654d6174683a207375627472616374696f6e206f766572666c6f77a165627a7a723058202e3aace01203b4e2a833f95ca344b0c3ad857069549785196995710f6669eeea0029",
"sourceMap": "416:10946:4:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;416:10946:4;;;;;;;",
"deployedSourceMap": "416:10946:4:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;416:10946:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1186:1574;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1186:1574:4;;;;;;;;;;;;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;1186:1574:4;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;1186:1574:4;;;;;;101:9:-1;95:2;81:12;77:21;67:8;63:36;60:51;39:11;25:12;22:29;11:108;8:2;;;132:1;129;122:12;8:2;1186:1574:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;1186:1574:4;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;4897:1310;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;4897:1310:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;3011:1624;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;3011:1624:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;6451:859;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;6451:859:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;1186:1574;1301:11;1379:1;1336:6;:20;;;:22;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1336:22:4;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1336:22:4;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1336:22:4;;;;;;;;;;;;;;;;:38;;;:40;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1336:40:4;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1336:40:4;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1336:40:4;;;;;;;;;;;;;;;;:44;;;1328:53;;;;;;1391:33;1427:31;1451:6;1427:23;:31::i;:::-;1391:67;;1537:9;1549:15;:25;579:19;1575:20;:27;:33;1610:41;1549:103;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1549:103:4;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1549:103:4;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1549:103:4;;;;;;;;;;;;;;;;1537:115;;1662:12;1677:6;:14;;;:16;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1677:16:4;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1677:16:4;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1677:16:4;;;;;;;;;;;;;;;;1662:31;;1703:19;1725:94;1739:5;1746:20;1768:7;1777:41;1725:13;:94::i;:::-;1703:116;;1934:19;:26;1903:20;:27;:57;1895:66;;;;;;1976:7;1986:1;1976:11;;1971:158;1993:20;:27;1989:1;:31;;;1971:158;;;2067:51;2095:19;2115:1;2095:22;;;;;;;;;;;;;;;;2067:20;2088:1;2067:23;;;;;;;;;;;;;;;;:27;;:51;;;;:::i;:::-;2041:20;2062:1;2041:23;;;;;;;;;;;;;;;:77;;;;;2022:3;;;;;;;1971:158;;;;2197:18;2218:94;2232:5;2239:20;2261:7;2270:41;2218:13;:94::i;:::-;2197:115;;2405:35;2424:15;2405:14;:18;;:35;;;;:::i;:::-;2395:45;;2600:1;2589:7;:12;;:56;;;;2638:7;579:19;;2605:7;:18;;;;;;:29;:40;2589:56;2586:168;;;579:19;2661;;;;;;;;;2586:168;;;2742:1;579:19;2721:7;:18;;;;;;:22;2711:32;;2586:168;1186:1574;;;;;;;;;:::o;4897:1310::-;5026:11;5104:1;5061:6;:20;;;:22;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;5061:22:4;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;5061:22:4;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;5061:22:4;;;;;;;;;;;;;;;;:38;;;:40;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;5061:40:4;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;5061:40:4;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;5061:40:4;;;;;;;;;;;;;;;;:44;;;5053:53;;;;;;5116:33;5152:31;5176:6;5152:23;:31::i;:::-;5116:67;;5261:9;5273:15;:25;579:19;5299:20;:27;:33;5334:41;5273:103;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;5273:103:4;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;5273:103:4;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;5273:103:4;;;;;;;;;;;;;;;;5261:115;;5386:12;5401:6;:14;;;:16;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;5401:16:4;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;5401:16:4;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;5401:16:4;;;;;;;;;;;;;;;;5386:31;;5427:19;5449:94;5463:5;5470:20;5492:7;5501:41;5449:13;:94::i;:::-;5427:116;;5662:1;5640:17;5636:27;;5628:36;;;;;;5716:67;5764:17;5716:20;5737:17;5716:39;;;;;;;;;;;;;;;;:43;;:67;;;;:::i;:::-;5674:20;5695:17;5674:39;;;;;;;;;;;;;;;:109;;;;;5851:18;5872:94;5886:5;5893:20;5915:7;5924:41;5872:13;:94::i;:::-;5851:115;;6051:14;6032:15;:33;6029:82;;6097:14;6079:32;;6029:82;579:19;6179:14;6161:15;:32;6156:44;;;;;;6147:53;;4897:1310;;;;;;;;;;:::o;3011:1624::-;3138:9;3214:1;3171:6;:20;;;:22;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3171:22:4;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;3171:22:4;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;3171:22:4;;;;;;;;;;;;;;;;:38;;;:40;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3171:40:4;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;3171:40:4;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;3171:40:4;;;;;;;;;;;;;;;;:44;;;3163:53;;;;;;3226:33;3262:31;3286:6;3262:23;:31::i;:::-;3226:67;;3371:9;3383:15;:25;579:19;3409:20;:27;:33;3444:41;3383:103;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3383:103:4;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;3383:103:4;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;3383:103:4;;;;;;;;;;;;;;;;3371:115;;3496:12;3511:6;:14;;;:16;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3511:16:4;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;3511:16:4;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;3511:16:4;;;;;;;;;;;;;;;;3496:31;;3537:19;3559:94;3573:5;3580:20;3602:7;3611:41;3559:13;:94::i;:::-;3537:116;;3761:1;3739:17;3735:27;;3727:36;;;;;;3815:67;3863:17;3815:20;3836:17;3815:39;;;;;;;;;;;;;;;;:43;;:67;;;;:::i;:::-;3773:20;3794:17;3773:39;;;;;;;;;;;;;;;:109;;;;;3950:18;3971:94;3985:5;3992:20;4014:7;4023:41;3971:13;:94::i;:::-;3950:115;;4146:15;4129:14;:32;4126:81;;;4192:15;4175:32;;4126:81;4246:15;4229:14;:32;4217:45;;4348:4;579:19;;4328:4;:10;;;;;;:16;:24;4324:171;;;579:19;4366:11;;;;;;;;;4324:171;;;4494:1;579:19;4481:4;:10;;;;;;:14;4474:21;;4324:171;4573:17;4566:4;:24;4562:66;;;4611:17;4604:24;;4562:66;3011:1624;;;;;;;;;;:::o;6451:859::-;6563:10;6640:1;6597:6;:20;;;:22;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;6597:22:4;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;6597:22:4;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;6597:22:4;;;;;;;;;;;;;;;;:38;;;:40;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;6597:40:4;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;6597:40:4;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;6597:40:4;;;;;;;;;;;;;;;;:44;;;6589:53;;;;;;6652:33;6688:31;6712:6;6688:23;:31::i;:::-;6652:67;;6729:8;6740:15;:25;579:19;6766:20;:27;:33;6801:39;6740:101;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;6740:101:4;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;6740:101:4;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;6740:101:4;;;;;;;;;;;;;;;;6729:112;;6851:12;6866:6;:14;;;:16;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;6866:16:4;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;6866:16:4;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;6866:16:4;;;;;;;;;;;;;;;;6851:31;;7114:8;7126:19;7149:109;7162:4;7168:20;7190:7;7199:17;7218:39;7149:12;:109::i;:::-;7113:145;;;;;579:19;7293:3;:9;;;;;;7275:14;:28;;;;;;7268:35;;;;;;;6451:859;;;;:::o;11042:318::-;11136:23;11198:6;:20;;;:22;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;11198:22:4;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;11198:22:4;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;11198:22:4;;;;;;;;;;;;;;;;:38;;;:40;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;11198:40:4;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;11198:40:4;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;11198:40:4;;;;;;;;;;;;;;;;11188:51;;;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;11188:51:4;;;;11175:64;;11254:7;11264:1;11254:11;;11249:104;11271:10;:17;11267:1;:21;;;11249:104;;;11323:6;:27;;;11351:1;11323:30;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;11323:30:4;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;11323:30:4;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;11323:30:4;;;;;;;;;;;;;;;;11307:10;11318:1;11307:13;;;;;;;;;;;;;;;:46;;;;;11290:3;;;;;;;11249:104;;;;11042:318;;;:::o;7687:717::-;7861:13;8120:8;8130:10;8146:68;8159:4;8165:20;8187:7;8196:1;8199:14;8146:12;:68::i;:::-;8119:95;;;;;8236:15;:25;8262:3;8267:14;8236:46;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;8236:46:4;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;8236:46:4;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;8236:46:4;;;;;;;;;;;;;;;;8224:58;;8304:21;8318:6;8304:9;:13;;:21;;;;:::i;:::-;8292:33;;8347:50;8388:7;8374:4;8348:23;579:19;8348:9;:13;;:23;;;;:::i;:::-;:30;;;;;;8347:36;;:50;;;;:::i;:::-;8335:62;;7687:717;;;;;;;;:::o;1614:210:31:-;1670:6;1688:8;1703:1;1699;:5;1688:16;;1728:1;1723;:6;;:16;;;;;1738:1;1733;:6;;1723:16;1722:38;;;;1749:1;1745;:5;:14;;;;;1758:1;1754;:5;1745:14;1722:38;1714:84;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1816:1;1809:8;;;1614:210;;;;:::o;1320:213::-;1376:6;1394:8;1409:1;1405;:5;1394:16;;1434:1;1429;:6;;:16;;;;;1444:1;1439;:6;;1429:16;1428:38;;;;1455:1;1451;:5;:14;;;;;1464:1;1460;:5;1451:14;1428:38;1420:87;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1525:1;1518:8;;;1320:213;;;;:::o;8950:1612:4:-;9144:8;9154:10;9166:19;10059:1;10051:4;:9;;:30;;;;;10080:1;10068:7;10064:17;;10051:30;10043:39;;;;;;10101:15;:19;10121:20;10101:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;10101:41:4;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;10101:41:4;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;10101:41:4;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;10101:41:4;;;;;;;;;;;;;;;;10092:50;;10184:7;10161:16;10172:4;10161:6;:10;;:16;;;;:::i;:::-;:31;;;;;;10152:40;;10211:21;629:22;10211:6;:10;;:21;;;;:::i;:::-;10202:30;;10242:9;10266:7;10276:1;10266:11;;10261:295;10283:20;:27;10279:1;:31;;;10261:295;;;10338:15;:20;10359:62;10414:6;10400:7;10360:33;10388:4;10360:20;10381:1;10360:23;;;;;;;;;;;;;;;;:27;;:33;;;;:::i;:::-;:48;;;;;;10359:54;;:62;;;;:::i;:::-;10423:14;10338:100;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;10338:100:4;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;10338:100:4;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;10338:100:4;;;;;;;;;;;;;;;;10331:107;;10461:12;10456:17;;:1;:17;;;10452:60;;;10508:4;10491:21;;10452:60;10532:13;10540:4;10532:3;:7;;:13;;;;:::i;:::-;10526:19;;10312:3;;;;;;;10261:295;;;;8950:1612;;;;;;;;;;:::o;291:552:31:-;347:6;591:1;586;:6;582:45;;;615:1;608:8;;;;582:45;652:2;647:1;:7;:26;;;;;196:7;658:1;:15;647:26;645:29;637:81;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;729:8;744:1;740;:5;729:16;;772:1;767;763;:5;;;;;;:10;755:62;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;835:1;828:8;;;291:552;;;;;:::o;834:176:32:-;892:7;911:9;927:1;923;:5;911:17;;951:1;946;:6;;938:46;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1002:1;995:8;;;834:176;;;;:::o",
"source": "pragma solidity ^0.5.0;\nimport \"openzeppelin-solidity/contracts/math/SafeMath.sol\";\nimport \"openzeppelin-solidity/contracts/drafts/SignedSafeMath.sol\";\nimport \"@gnosis.pm/util-contracts/contracts/Fixed192x64Math.sol\";\nimport \"../MarketMakers/MarketMaker.sol\";\n\n\n/// @title LMSR market maker contract - Calculates share prices based on share distribution and initial funding\n/// @author Alan Lu - <alan.lu@gnosis.pm>\ncontract LMSRMarketMaker is MarketMaker {\n using SignedSafeMath for int;\n using SafeMath for uint;\n\n /*\n * Constants\n */\n uint constant ONE = 0x10000000000000000;\n int constant EXP_LIMIT = 3394200909562557497344;\n\n /*\n * Public functions\n */\n /// @dev Calculates the net cost for executing a given trade.\n /// @param market Market contract\n /// @param outcomeTokenAmounts Amounts of outcome tokens to buy from the market. If an amount is negative, represents an amount to sell to the market.\n /// @return Net cost of trade. If positive, represents amount of collateral which would be paid to the market for the trade. If negative, represents amount of collateral which would be received from the market for the trade.\n function calcNetCost(Market market, int[] memory outcomeTokenAmounts)\n public\n view\n returns (int netCost)\n {\n require(market.eventContract().getOutcomeCount() > 1);\n int[] memory netOutcomeTokensSold = getNetOutcomeTokensSold(market);\n\n // Calculate cost level based on net outcome token balances\n int log2N = Fixed192x64Math.binaryLog(netOutcomeTokensSold.length * ONE, Fixed192x64Math.EstimationMode.UpperBound);\n uint funding = market.funding();\n int costLevelBefore = calcCostLevel(log2N, netOutcomeTokensSold, funding, Fixed192x64Math.EstimationMode.LowerBound);\n\n // Change amounts based on outcomeTokenAmounts passed in\n require(netOutcomeTokensSold.length == outcomeTokenAmounts.length);\n for (uint8 i = 0; i < netOutcomeTokensSold.length; i++) {\n netOutcomeTokensSold[i] = netOutcomeTokensSold[i].add(outcomeTokenAmounts[i]);\n }\n\n // Calculate cost level after balance was updated\n int costLevelAfter = calcCostLevel(log2N, netOutcomeTokensSold, funding, Fixed192x64Math.EstimationMode.UpperBound);\n\n // Calculate net cost as cost level difference and use the ceil\n netCost = costLevelAfter.sub(costLevelBefore);\n // Integer division for negative numbers already uses ceiling,\n // so only check boundary condition for positive numbers\n if(netCost <= 0 || netCost / int(ONE) * int(ONE) == netCost) {\n netCost /= int(ONE);\n } else {\n netCost = netCost / int(ONE) + 1;\n }\n }\n\n /// @dev Returns cost to buy given number of outcome tokens\n /// @param market Market contract\n /// @param outcomeTokenIndex Index of outcome to buy\n /// @param outcomeTokenCount Number of outcome tokens to buy\n /// @return Cost\n function calcCost(Market market, uint8 outcomeTokenIndex, uint outcomeTokenCount)\n public\n view\n returns (uint cost)\n {\n require(market.eventContract().getOutcomeCount() > 1);\n int[] memory netOutcomeTokensSold = getNetOutcomeTokensSold(market);\n // Calculate cost level based on net outcome token balances\n int log2N = Fixed192x64Math.binaryLog(netOutcomeTokensSold.length * ONE, Fixed192x64Math.EstimationMode.UpperBound);\n uint funding = market.funding();\n int costLevelBefore = calcCostLevel(log2N, netOutcomeTokensSold, funding, Fixed192x64Math.EstimationMode.LowerBound);\n // Add outcome token count to net outcome token balance\n require(int(outcomeTokenCount) >= 0);\n netOutcomeTokensSold[outcomeTokenIndex] = netOutcomeTokensSold[outcomeTokenIndex].add(int(outcomeTokenCount));\n // Calculate cost level after balance was updated\n int costLevelAfter = calcCostLevel(log2N, netOutcomeTokensSold, funding, Fixed192x64Math.EstimationMode.UpperBound);\n // Calculate cost as cost level difference\n if(costLevelAfter < costLevelBefore)\n costLevelAfter = costLevelBefore;\n cost = uint(costLevelAfter - costLevelBefore);\n // Take the ceiling to account for rounding\n if (cost / ONE * ONE == cost)\n cost /= ONE;\n else\n // Integer division by ONE ensures there is room to (+ 1)\n cost = cost / ONE + 1;\n // Make sure cost is not bigger than 1 per share\n if (cost > outcomeTokenCount)\n cost = outcomeTokenCount;\n }\n\n /// @dev Returns profit for selling given number of outcome tokens\n /// @param market Market contract\n /// @param outcomeTokenIndex Index of outcome to sell\n /// @param outcomeTokenCount Number of outcome tokens to sell\n /// @return Profit\n function calcProfit(Market market, uint8 outcomeTokenIndex, uint outcomeTokenCount)\n public\n view\n returns (uint profit)\n {\n require(market.eventContract().getOutcomeCount() > 1);\n int[] memory netOutcomeTokensSold = getNetOutcomeTokensSold(market);\n // Calculate cost level based on net outcome token balances\n int log2N = Fixed192x64Math.binaryLog(netOutcomeTokensSold.length * ONE, Fixed192x64Math.EstimationMode.UpperBound);\n uint funding = market.funding();\n int costLevelBefore = calcCostLevel(log2N, netOutcomeTokensSold, funding, Fixed192x64Math.EstimationMode.LowerBound);\n // Subtract outcome token count from the net outcome token balance\n require(int(outcomeTokenCount) >= 0);\n netOutcomeTokensSold[outcomeTokenIndex] = netOutcomeTokensSold[outcomeTokenIndex].sub(int(outcomeTokenCount));\n // Calculate cost level after balance was updated\n int costLevelAfter = calcCostLevel(log2N, netOutcomeTokensSold, funding, Fixed192x64Math.EstimationMode.UpperBound);\n // Calculate profit as cost level difference\n if(costLevelBefore <= costLevelAfter)\n costLevelBefore = costLevelAfter;\n // Take the floor\n profit = uint(costLevelBefore - costLevelAfter) / ONE;\n }\n\n /// @dev Returns marginal price of an outcome\n /// @param market Market contrac