@josojo/tokenized-events
Version:
tokenized events for pm markets
339 lines (338 loc) • 699 kB
JSON
{
"contractName": "LMSRMarketMaker",
"abi": [
{
"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",
"signature": "0xbd8ff817"
},
{
"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",
"signature": "0x4091c6a9"
},
{
"constant": true,
"inputs": [
{
"name": "market",
"type": "address"
},
{
"name": "outcomeTokenIndex",
"type": "uint8"
}
],
"name": "calcMarginalPrice",
"outputs": [
{
"name": "price",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function",
"signature": "0xd812d346"
}
],
"bytecode": "0x608060405234801561001057600080fd5b50611375806100206000396000f30060806040526004361061003d5763ffffffff60e060020a6000350416634091c6a98114610042578063bd8ff8171461007e578063d812d346146100a8575b600080fd5b34801561004e57600080fd5b5061006c600160a060020a036004351660ff602435166044356100cf565b60408051918252519081900360200190f35b34801561008a57600080fd5b5061006c600160a060020a036004351660ff6024351660443561041e565b3480156100b457600080fd5b5061006c600160a060020a036004351660ff602435166107ac565b60006060600080600080600189600160a060020a031663e274fd246040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561011957600080fd5b505af115801561012d573d6000803e3d6000fd5b505050506040513d602081101561014357600080fd5b50516040805160e160020a633ee478430281529051600160a060020a0390921691637dc8f086916004808201926020929091908290030181600087803b15801561018c57600080fd5b505af11580156101a0573d6000803e3d6000fd5b505050506040513d60208110156101b657600080fd5b505160ff16116101c557600080fd5b6101ce89610a1a565b945073__Math__________________________________6320ddd2556801000000000000000087510260016040518363ffffffff1660e060020a0281526004018083815260200182600281111561022157fe5b60ff1681526020019250505060206040518083038186803b15801561024557600080fd5b505af4158015610259573d6000803e3d6000fd5b505050506040513d602081101561026f57600080fd5b5051604080517fcb4c86b70000000000000000000000000000000000000000000000000000000081529051919550600160a060020a038b169163cb4c86b7916004808201926020929091908290030181600087803b1580156102d057600080fd5b505af11580156102e4573d6000803e3d6000fd5b505050506040513d60208110156102fa57600080fd5b5051925061030b8486856000610bdd565b9150600087121561031b57600080fd5b848860ff1681518110151561032c57fe5b6020908102909101810151604080517fadefc37b0000000000000000000000000000000000000000000000000000000081526004810192909252602482018a90525173__Math__________________________________9263adefc37b9260448082019391829003018186803b1580156103a557600080fd5b505af41580156103b9573d6000803e3d6000fd5b505050506040513d60208110156103cf57600080fd5b50518551869060ff8b169081106103e257fe5b602090810290910101526103f98486856001610bdd565b9050808213610406578091505b68010000000000000000910304979650505050505050565b60006060600080600080600189600160a060020a031663e274fd246040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561046857600080fd5b505af115801561047c573d6000803e3d6000fd5b505050506040513d602081101561049257600080fd5b50516040805160e160020a633ee478430281529051600160a060020a0390921691637dc8f086916004808201926020929091908290030181600087803b1580156104db57600080fd5b505af11580156104ef573d6000803e3d6000fd5b505050506040513d602081101561050557600080fd5b505160ff161161051457600080fd5b61051d89610a1a565b945073__Math__________________________________6320ddd2556801000000000000000087510260016040518363ffffffff1660e060020a0281526004018083815260200182600281111561057057fe5b60ff1681526020019250505060206040518083038186803b15801561059457600080fd5b505af41580156105a8573d6000803e3d6000fd5b505050506040513d60208110156105be57600080fd5b5051604080517fcb4c86b70000000000000000000000000000000000000000000000000000000081529051919550600160a060020a038b169163cb4c86b7916004808201926020929091908290030181600087803b15801561061f57600080fd5b505af1158015610633573d6000803e3d6000fd5b505050506040513d602081101561064957600080fd5b5051925061065a8486856000610bdd565b9150600087121561066a57600080fd5b848860ff1681518110151561067b57fe5b6020908102909101810151604080517fa5f3c23b0000000000000000000000000000000000000000000000000000000081526004810192909252602482018a90525173__Math__________________________________9263a5f3c23b9260448082019391829003018186803b1580156106f457600080fd5b505af4158015610708573d6000803e3d6000fd5b505050506040513d602081101561071e57600080fd5b50518551869060ff8b1690811061073157fe5b602090810290910101526107488486856001610bdd565b9050818112156107555750805b81810395508568010000000000000000808204021415610782576801000000000000000086049550610794565b68010000000000000000860460010195505b868611156107a0578695505b50505050509392505050565b60006060600080600080600188600160a060020a031663e274fd246040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156107f657600080fd5b505af115801561080a573d6000803e3d6000fd5b505050506040513d602081101561082057600080fd5b50516040805160e160020a633ee478430281529051600160a060020a0390921691637dc8f086916004808201926020929091908290030181600087803b15801561086957600080fd5b505af115801561087d573d6000803e3d6000fd5b505050506040513d602081101561089357600080fd5b505160ff16116108a257600080fd5b6108ab88610a1a565b945073__Math__________________________________6320ddd2556801000000000000000087510260026040518363ffffffff1660e060020a028152600401808381526020018260028111156108fe57fe5b60ff1681526020019250505060206040518083038186803b15801561092257600080fd5b505af4158015610936573d6000803e3d6000fd5b505050506040513d602081101561094c57600080fd5b5051604080517fcb4c86b70000000000000000000000000000000000000000000000000000000081529051919550600160a060020a038a169163cb4c86b7916004808201926020929091908290030181600087803b1580156109ad57600080fd5b505af11580156109c1573d6000803e3d6000fd5b505050506040513d60208110156109d757600080fd5b505192506109e98486858a6002610e72565b92505091506801000000000000000082811515610a0257fe5b0481811515610a0d57fe5b0498975050505050505050565b6060600082600160a060020a031663e274fd246040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610a5c57600080fd5b505af1158015610a70573d6000803e3d6000fd5b505050506040513d6020811015610a8657600080fd5b50516040805160e160020a633ee478430281529051600160a060020a0390921691637dc8f086916004808201926020929091908290030181600087803b158015610acf57600080fd5b505af1158015610ae3573d6000803e3d6000fd5b505050506040513d6020811015610af957600080fd5b50516040805160ff90921680835260208181028401019091528015610b28578160200160208202803883390190505b509150600090505b81518160ff161015610bd75782600160a060020a031663a157979c826040518263ffffffff1660e060020a028152600401808260ff168152602001915050602060405180830381600087803b158015610b8857600080fd5b505af1158015610b9c573d6000803e3d6000fd5b505050506040513d6020811015610bb257600080fd5b50518251839060ff8416908110610bc557fe5b60209081029091010152600101610b30565b50919050565b6000806000610bf0878787600088610e72565b509150915073__Math__________________________________6320ddd25583866040518363ffffffff1660e060020a02815260040180838152602001826002811115610c3957fe5b60ff1681526020019250505060206040518083038186803b158015610c5d57600080fd5b505af4158015610c71573d6000803e3d6000fd5b505050506040513d6020811015610c8757600080fd5b5051604080517fa5f3c23b0000000000000000000000000000000000000000000000000000000081526004810183905260248101849052905191945073__Math__________________________________9163a5f3c23b91604480820192602092909190829003018186803b158015610cff57600080fd5b505af4158015610d13573d6000803e3d6000fd5b505050506040513d6020811015610d2957600080fd5b5051604080517fbbe93d91000000000000000000000000000000000000000000000000000000008152600481018390526801000000000000000060248201529051919450889173__Math__________________________________9163bbe93d91916044808301926020929190829003018186803b158015610daa57600080fd5b505af4158015610dbe573d6000803e3d6000fd5b505050506040513d6020811015610dd457600080fd5b5051811515610ddf57fe5b0573__Math__________________________________63bbe93d919091876040518363ffffffff1660e060020a028152600401808381526020018281526020019250505060206040518083038186803b158015610e3b57600080fd5b505af4158015610e4f573d6000803e3d6000fd5b505050506040513d6020811015610e6557600080fd5b5051979650505050505050565b6000806000806000808a12158015610e8b575060008812155b1515610e9657600080fd5b6040517fccc138140000000000000000000000000000000000000000000000000000000081526020600482018181528b5160248401528b5173__Math__________________________________9363ccc13814938e9392839260440191808601910280838360005b83811015610f16578181015183820152602001610efe565b505050509050019250505060206040518083038186803b158015610f3957600080fd5b505af4158015610f4d573d6000803e3d6000fd5b505050506040513d6020811015610f6357600080fd5b5051604080517fbbe93d9100000000000000000000000000000000000000000000000000000000815260048101839052602481018d90529051919550899173__Math__________________________________9163bbe93d91916044808301926020929190829003018186803b158015610fdc57600080fd5b505af4158015610ff0573d6000803e3d6000fd5b505050506040513d602081101561100657600080fd5b505181151561101157fe5b0593508373__Math__________________________________63adefc37b909168b800000000000000006040518363ffffffff1660e060020a028152600401808381526020018281526020019250505060206040518083038186803b15801561107957600080fd5b505af415801561108d573d6000803e3d6000fd5b505050506040513d60208110156110a357600080fd5b50519350600090505b88518160ff16101561133c5773__Math__________________________________6384059dd0898b8460ff168151811015156110e457fe5b9060200190602002015173__Math__________________________________63bbe93d9190918f6040518363ffffffff1660e060020a028152600401808381526020018281526020019250505060206040518083038186803b15801561114957600080fd5b505af415801561115d573d6000803e3d6000fd5b505050506040513d602081101561117357600080fd5b505181151561117e57fe5b0573__Math__________________________________63adefc37b9091886040518363ffffffff1660e060020a028152600401808381526020018281526020019250505060206040518083038186803b1580156111da57600080fd5b505af41580156111ee573d6000803e3d6000fd5b505050506040513d602081101561120457600080fd5b505160405160e060020a63ffffffff8416028152600481018281528a9160240182600281111561123057fe5b60ff1681526020019250505060206040518083038186803b15801561125457600080fd5b505af4158015611268573d6000803e3d6000fd5b505050506040513d602081101561127e57600080fd5b5051915060ff8181169088161415611294578192505b604080517f771602f70000000000000000000000000000000000000000000000000000000081526004810187905260248101849052905173__Math__________________________________9163771602f7916044808301926020929190829003018186803b15801561130657600080fd5b505af415801561131a573d6000803e3d6000fd5b505050506040513d602081101561133057600080fd5b505194506001016110ac565b50509550955095925050505600a165627a7a72305820125637eb737d4d0603abeab033313dbd2ca44fbeba1990b67daeacde5444589b0029",
"deployedBytecode": "0x60806040526004361061003d5763ffffffff60e060020a6000350416634091c6a98114610042578063bd8ff8171461007e578063d812d346146100a8575b600080fd5b34801561004e57600080fd5b5061006c600160a060020a036004351660ff602435166044356100cf565b60408051918252519081900360200190f35b34801561008a57600080fd5b5061006c600160a060020a036004351660ff6024351660443561041e565b3480156100b457600080fd5b5061006c600160a060020a036004351660ff602435166107ac565b60006060600080600080600189600160a060020a031663e274fd246040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561011957600080fd5b505af115801561012d573d6000803e3d6000fd5b505050506040513d602081101561014357600080fd5b50516040805160e160020a633ee478430281529051600160a060020a0390921691637dc8f086916004808201926020929091908290030181600087803b15801561018c57600080fd5b505af11580156101a0573d6000803e3d6000fd5b505050506040513d60208110156101b657600080fd5b505160ff16116101c557600080fd5b6101ce89610a1a565b945073__Math__________________________________6320ddd2556801000000000000000087510260016040518363ffffffff1660e060020a0281526004018083815260200182600281111561022157fe5b60ff1681526020019250505060206040518083038186803b15801561024557600080fd5b505af4158015610259573d6000803e3d6000fd5b505050506040513d602081101561026f57600080fd5b5051604080517fcb4c86b70000000000000000000000000000000000000000000000000000000081529051919550600160a060020a038b169163cb4c86b7916004808201926020929091908290030181600087803b1580156102d057600080fd5b505af11580156102e4573d6000803e3d6000fd5b505050506040513d60208110156102fa57600080fd5b5051925061030b8486856000610bdd565b9150600087121561031b57600080fd5b848860ff1681518110151561032c57fe5b6020908102909101810151604080517fadefc37b0000000000000000000000000000000000000000000000000000000081526004810192909252602482018a90525173__Math__________________________________9263adefc37b9260448082019391829003018186803b1580156103a557600080fd5b505af41580156103b9573d6000803e3d6000fd5b505050506040513d60208110156103cf57600080fd5b50518551869060ff8b169081106103e257fe5b602090810290910101526103f98486856001610bdd565b9050808213610406578091505b68010000000000000000910304979650505050505050565b60006060600080600080600189600160a060020a031663e274fd246040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561046857600080fd5b505af115801561047c573d6000803e3d6000fd5b505050506040513d602081101561049257600080fd5b50516040805160e160020a633ee478430281529051600160a060020a0390921691637dc8f086916004808201926020929091908290030181600087803b1580156104db57600080fd5b505af11580156104ef573d6000803e3d6000fd5b505050506040513d602081101561050557600080fd5b505160ff161161051457600080fd5b61051d89610a1a565b945073__Math__________________________________6320ddd2556801000000000000000087510260016040518363ffffffff1660e060020a0281526004018083815260200182600281111561057057fe5b60ff1681526020019250505060206040518083038186803b15801561059457600080fd5b505af41580156105a8573d6000803e3d6000fd5b505050506040513d60208110156105be57600080fd5b5051604080517fcb4c86b70000000000000000000000000000000000000000000000000000000081529051919550600160a060020a038b169163cb4c86b7916004808201926020929091908290030181600087803b15801561061f57600080fd5b505af1158015610633573d6000803e3d6000fd5b505050506040513d602081101561064957600080fd5b5051925061065a8486856000610bdd565b9150600087121561066a57600080fd5b848860ff1681518110151561067b57fe5b6020908102909101810151604080517fa5f3c23b0000000000000000000000000000000000000000000000000000000081526004810192909252602482018a90525173__Math__________________________________9263a5f3c23b9260448082019391829003018186803b1580156106f457600080fd5b505af4158015610708573d6000803e3d6000fd5b505050506040513d602081101561071e57600080fd5b50518551869060ff8b1690811061073157fe5b602090810290910101526107488486856001610bdd565b9050818112156107555750805b81810395508568010000000000000000808204021415610782576801000000000000000086049550610794565b68010000000000000000860460010195505b868611156107a0578695505b50505050509392505050565b60006060600080600080600188600160a060020a031663e274fd246040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156107f657600080fd5b505af115801561080a573d6000803e3d6000fd5b505050506040513d602081101561082057600080fd5b50516040805160e160020a633ee478430281529051600160a060020a0390921691637dc8f086916004808201926020929091908290030181600087803b15801561086957600080fd5b505af115801561087d573d6000803e3d6000fd5b505050506040513d602081101561089357600080fd5b505160ff16116108a257600080fd5b6108ab88610a1a565b945073__Math__________________________________6320ddd2556801000000000000000087510260026040518363ffffffff1660e060020a028152600401808381526020018260028111156108fe57fe5b60ff1681526020019250505060206040518083038186803b15801561092257600080fd5b505af4158015610936573d6000803e3d6000fd5b505050506040513d602081101561094c57600080fd5b5051604080517fcb4c86b70000000000000000000000000000000000000000000000000000000081529051919550600160a060020a038a169163cb4c86b7916004808201926020929091908290030181600087803b1580156109ad57600080fd5b505af11580156109c1573d6000803e3d6000fd5b505050506040513d60208110156109d757600080fd5b505192506109e98486858a6002610e72565b92505091506801000000000000000082811515610a0257fe5b0481811515610a0d57fe5b0498975050505050505050565b6060600082600160a060020a031663e274fd246040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610a5c57600080fd5b505af1158015610a70573d6000803e3d6000fd5b505050506040513d6020811015610a8657600080fd5b50516040805160e160020a633ee478430281529051600160a060020a0390921691637dc8f086916004808201926020929091908290030181600087803b158015610acf57600080fd5b505af1158015610ae3573d6000803e3d6000fd5b505050506040513d6020811015610af957600080fd5b50516040805160ff90921680835260208181028401019091528015610b28578160200160208202803883390190505b509150600090505b81518160ff161015610bd75782600160a060020a031663a157979c826040518263ffffffff1660e060020a028152600401808260ff168152602001915050602060405180830381600087803b158015610b8857600080fd5b505af1158015610b9c573d6000803e3d6000fd5b505050506040513d6020811015610bb257600080fd5b50518251839060ff8416908110610bc557fe5b60209081029091010152600101610b30565b50919050565b6000806000610bf0878787600088610e72565b509150915073__Math__________________________________6320ddd25583866040518363ffffffff1660e060020a02815260040180838152602001826002811115610c3957fe5b60ff1681526020019250505060206040518083038186803b158015610c5d57600080fd5b505af4158015610c71573d6000803e3d6000fd5b505050506040513d6020811015610c8757600080fd5b5051604080517fa5f3c23b0000000000000000000000000000000000000000000000000000000081526004810183905260248101849052905191945073__Math__________________________________9163a5f3c23b91604480820192602092909190829003018186803b158015610cff57600080fd5b505af4158015610d13573d6000803e3d6000fd5b505050506040513d6020811015610d2957600080fd5b5051604080517fbbe93d91000000000000000000000000000000000000000000000000000000008152600481018390526801000000000000000060248201529051919450889173__Math__________________________________9163bbe93d91916044808301926020929190829003018186803b158015610daa57600080fd5b505af4158015610dbe573d6000803e3d6000fd5b505050506040513d6020811015610dd457600080fd5b5051811515610ddf57fe5b0573__Math__________________________________63bbe93d919091876040518363ffffffff1660e060020a028152600401808381526020018281526020019250505060206040518083038186803b158015610e3b57600080fd5b505af4158015610e4f573d6000803e3d6000fd5b505050506040513d6020811015610e6557600080fd5b5051979650505050505050565b6000806000806000808a12158015610e8b575060008812155b1515610e9657600080fd5b6040517fccc138140000000000000000000000000000000000000000000000000000000081526020600482018181528b5160248401528b5173__Math__________________________________9363ccc13814938e9392839260440191808601910280838360005b83811015610f16578181015183820152602001610efe565b505050509050019250505060206040518083038186803b158015610f3957600080fd5b505af4158015610f4d573d6000803e3d6000fd5b505050506040513d6020811015610f6357600080fd5b5051604080517fbbe93d9100000000000000000000000000000000000000000000000000000000815260048101839052602481018d90529051919550899173__Math__________________________________9163bbe93d91916044808301926020929190829003018186803b158015610fdc57600080fd5b505af4158015610ff0573d6000803e3d6000fd5b505050506040513d602081101561100657600080fd5b505181151561101157fe5b0593508373__Math__________________________________63adefc37b909168b800000000000000006040518363ffffffff1660e060020a028152600401808381526020018281526020019250505060206040518083038186803b15801561107957600080fd5b505af415801561108d573d6000803e3d6000fd5b505050506040513d60208110156110a357600080fd5b50519350600090505b88518160ff16101561133c5773__Math__________________________________6384059dd0898b8460ff168151811015156110e457fe5b9060200190602002015173__Math__________________________________63bbe93d9190918f6040518363ffffffff1660e060020a028152600401808381526020018281526020019250505060206040518083038186803b15801561114957600080fd5b505af415801561115d573d6000803e3d6000fd5b505050506040513d602081101561117357600080fd5b505181151561117e57fe5b0573__Math__________________________________63adefc37b9091886040518363ffffffff1660e060020a028152600401808381526020018281526020019250505060206040518083038186803b1580156111da57600080fd5b505af41580156111ee573d6000803e3d6000fd5b505050506040513d602081101561120457600080fd5b505160405160e060020a63ffffffff8416028152600481018281528a9160240182600281111561123057fe5b60ff1681526020019250505060206040518083038186803b15801561125457600080fd5b505af4158015611268573d6000803e3d6000fd5b505050506040513d602081101561127e57600080fd5b5051915060ff8181169088161415611294578192505b604080517f771602f70000000000000000000000000000000000000000000000000000000081526004810187905260248101849052905173__Math__________________________________9163771602f7916044808301926020929190829003018186803b15801561130657600080fd5b505af415801561131a573d6000803e3d6000fd5b505050506040513d602081101561133057600080fd5b505194506001016110ac565b50509550955095925050505600a165627a7a72305820125637eb737d4d0603abeab033313dbd2ca44fbeba1990b67daeacde5444589b0029",
"sourceMap": "268:8633:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;268:8633:1;;;;;;;",
"deployedSourceMap": "268:8633:1:-;;;;;;;;;-1:-1:-1;;;268:8633:1;;;;;;;;;;;;;;;;;;;;;;;2595:1265;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2595:1265:1;-1:-1:-1;;;;;2595:1265:1;;;;;;;;;;;;;;;;;;;;;;;;;;;754:1579;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;754:1579:1;-1:-1:-1;;;;;754:1579:1;;;;;;;;;;;4104:819;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4104:819:1;-1:-1:-1;;;;;4104:819:1;;;;;;;;;2595:1265;2728:11;2818:33;2963:9;3061:12;3102:19;3515:18;2806:1;2763:6;-1:-1:-1;;;;;2763:20:1;;:22;;;;;-1:-1:-1;;;2763:22:1;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2763:22:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2763:22:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;2763:22:1;:40;;;-1:-1:-1;;;;;2763:40:1;;;;-1:-1:-1;;;;;2763:38:1;;;;;;:40;;;;;:22;;:40;;;;;;;;;:38;:40;;;5:2:-1;;;;30:1;27;20:12;5:2;2763:40:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2763:40:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;2763:40:1;:44;;;2755:53;;;;;;2854:31;2878:6;2854:23;:31::i;:::-;2818:67;;2975:4;:9;390:19;2985:20;:27;:33;3020:30;2975:76;;;;;-1:-1:-1;;;2975:76:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2975:76:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2975:76:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;2975:76:1;3076:16;;;;;;;;2975:76;;-1:-1:-1;;;;;;3076:14:1;;;;;:16;;;;;2975:76;;3076:16;;;;;;;;;:14;:16;;;5:2:-1;;;;30:1;27;20:12;5:2;3076:16:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;3076:16:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;3076:16:1;;-1:-1:-1;3124:83:1;3138:5;3145:20;3076:16;3176:30;3124:13;:83::i;:::-;3102:105;-1:-1:-1;3326:1:1;3300:27;;;3292:36;;;;;;3380:20;3401:17;3380:39;;;;;;;;;;;;;;;;;;;;;;:67;;;;;;;;;;;;;;;;;;;;:43;;;;:67;;;;;;;;;;;:43;:67;;;5:2:-1;;;;30:1;27;20:12;5:2;3380:67:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;3380:67:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;3380:67:1;3338:39;;:20;;:39;;;;;;;;;;;;;;;;;;:109;3536:83;3550:5;3557:20;3579:7;3588:30;3536:13;:83::i;:::-;3515:104;-1:-1:-1;3685:33:1;;;3682:82;;3750:14;3732:32;;3682:82;390:19;3814:32;;3809:44;;;-1:-1:-1;;;;;;;2595:1265:1:o;754:1579::-;885:9;973:33;1118:9;1216:12;1257:19;1659:18;961:1;918:6;-1:-1:-1;;;;;918:20:1;;:22;;;;;-1:-1:-1;;;918:22:1;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;918:22:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;918:22:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;918:22:1;:40;;;-1:-1:-1;;;;;918:40:1;;;;-1:-1:-1;;;;;918:38:1;;;;;;:40;;;;;:22;;:40;;;;;;;;;:38;:40;;;5:2:-1;;;;30:1;27;20:12;5:2;918:40:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;918:40:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;918:40:1;:44;;;910:53;;;;;;1009:31;1033:6;1009:23;:31::i;:::-;973:67;;1130:4;:9;390:19;1140:20;:27;:33;1175:30;1130:76;;;;;-1:-1:-1;;;1130:76:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1130:76:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1130:76:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;1130:76:1;1231:16;;;;;;;;1130:76;;-1:-1:-1;;;;;;1231:14:1;;;;;:16;;;;;1130:76;;1231:16;;;;;;;;;:14;:16;;;5:2:-1;;;;30:1;27;20:12;5:2;1231:16:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1231:16:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;1231:16:1;;-1:-1:-1;1279:83:1;1293:5;1300:20;1231:16;1331:30;1279:13;:83::i;:::-;1257:105;-1:-1:-1;1470:1:1;1444:27;;;1436:36;;;;;;1524:20;1545:17;1524:39;;;;;;;;;;;;;;;;;;;;;;:67;;;;;;;;;;;;;;;;;;;;:43;;;;:67;;;;;;;;;;;:43;:67;;;5:2:-1;;;;30:1;27;20:12;5:2;1524:67:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1524:67:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;1524:67:1;1482:39;;:20;;:39;;;;;;;;;;;;;;;;;;:109;1680:83;1694:5;1701:20;1723:7;1732:30;1680:13;:83::i;:::-;1659:104;;1844:15;1827:14;:32;1824:81;;;-1:-1:-1;1890:15:1;1824:81;1927:32;;;;-1:-1:-1;1927:32:1;390:19;;1927:32;2026:10;:16;:24;2022:171;;;390:19;2064:11;;;;2022:171;;;390:19;2179:4;:10;2192:1;2179:14;2172:21;;2022:171;2271:17;2264:4;:24;2260:66;;;2309:17;2302:24;;2260:66;754:1579;;;;;;;;;;:::o;4104:819::-;4220:10;4309:33;4386:8;4481:12;4748:3;4755:14;4297:1;4254:6;-1:-1:-1;;;;;4254:20:1;;:22;;;;;-1:-1:-1;;;4254:22:1;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;4254:22:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;4254:22:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;4254:22:1;:40;;;-1:-1:-1;;;;;4254:40:1;;;;-1:-1:-1;;;;;4254:38:1;;;;;;:40;;;;;:22;;:40;;;;;;;;;:38;:40;;;5:2:-1;;;;30:1;27;20:12;5:2;4254:40:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;4254:40:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;4254:40:1;:44;;;4246:53;;;;;;4345:31;4369:6;4345:23;:31::i;:::-;4309:67;;4397:4;:9;390:19;4407:20;:27;:33;4442:28;4397:74;;;;;-1:-1:-1;;;4397:74:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;4397:74:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;4397:74:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;4397:74:1;4496:16;;;;;;;;4397:74;;-1:-1:-1;;;;;;4496:14:1;;;;;:16;;;;;4397:74;;4496:16;;;;;;;;;:14;:16;;;5:2:-1;;;;30:1;27;20:12;5:2;4496:16:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;4496:16:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;4496:16:1;;-1:-1:-1;4773:98:1;4786:4;4792:20;4496:16;4823:17;4842:28;4773:12;:98::i;:::-;4743:128;;;;;390:19;4906:3;:9;;;;;;;;4888:14;:28;;;;;;;;;4104:819;-1:-1:-1;;;;;;;;4104:819:1:o;8584:315::-;8682:16;8793:7;8737:6;-1:-1:-1;;;;;8737:20:1;;:22;;;;;-1:-1:-1;;;8737:22:1;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;8737:22:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;8737:22:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;8737:22:1;:40;;;-1:-1:-1;;;;;8737:40:1;;;;-1:-1:-1;;;;;8737:38:1;;;;;;:40;;;;;:22;;:40;;;;;;;;;:38;:40;;;5:2:-1;;;;30:1;27;20:12;5:2;8737:40:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;8737:40:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;8737:40:1;8727:51;;;;;;;;;;8737:40;8727:51;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;8727:51:1;;8714:64;;8803:1;8793:11;;8788:104;8810:10;:17;8806:1;:21;;;8788:104;;;8862:6;-1:-1:-1;;;;;8862:27:1;;8890:1;8862:30;;;;;-1:-1:-1;;;8862:30:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;8862:30:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;8862:30:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;8862:30:1;8846:13;;:10;;:13;;;;;;;;;;;;;;;;;;:46;8829:3;;8788:104;;;8584:315;;;;:::o;5300:682::-;5460:13;5723:3;5728:6;5740:68;5753:4;5759:20;5781:7;5790:1;5793:14;5740:12;:68::i;:::-;5718:90;;;;;5830:4;:9;5840:3;5845:14;5830:30;;;;;-1:-1:-1;;;5830:30:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;5830:30:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;5830:30:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;5830:30:1;5882:21;;;;;;;;;;;;;;;;;;;;5830:30;;-1:-1:-1;5882:13:1;;;;:21;;;;;5830:30;;5882:21;;;;;;;;:13;:21;;;5:2:-1;;;;30:1;27;20:12;5:2;5882:21:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;5882:21:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;5882:21:1;5926:23;;;;;;;;;;;;390:19;5926:23;;;;;;5882:21;;-1:-1:-1;5952:4:1;;5926:13;;;;:23;;;;;5882:21;;5926:23;;;;;;;:13;:23;;;5:2:-1;;;;30:1;27;20:12;5:2;5926:23:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;5926:23:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;5926:23:1;:30;;;;;;;;5925:36;;;;5966:7;5925:50;;;;;-1:-1:-1;;;5925:50:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;5925:50:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;5925:50:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;5925:50:1;;5300:682;-1:-1:-1;;;;;;;5300:682:1:o;6528:1576::-;6708:8;6718:10;6730:19;7795:9;7819:7;7623:1;7615:4;:9;;:30;;;;;7644:1;7632:7;7628:17;;7615:30;7607:39;;;;;;;;7665:30;;;;;;;;;;;;;;;;;;;;:4;;:8;;7674:20;;7665:30;;;;;;;;;;;;;;;8:100:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;7665:30:1;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;7665:30:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;7665:30:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;7665:30:1;7714:16;;;;;;;;;;;;;;;;;;;;7665:30;;-1:-1:-1;7737:7:1;;7714:10;;;;:16;;;;;7665:30;;7714:16;;;;;;;:10;:16;;;5:2:-1;;;;30:1;27;20:12;5:2;7714:16:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;7714:16:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;7714:16:1;:31;;;;;;;;7705:40;;7764:6;:10;;;;440:22;7764:21;;;;;-1:-1:-1;;;7764:21:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;7764:21:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;7764:21:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;7764:21:1;;-1:-1:-1;7829:1:1;;-1:-1:-1;7814:284:1;7836:20;:27;7832:1;:31;;;7814:284;;;7891:4;:9;7942:7;7902:20;7923:1;7902:23;;;;;;;;;;;;;;;;;;;;:27;;;;7930:4;7902:33;;;;;-1:-1:-1;;;7902:33:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;7902:33:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;7902:33:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;7902:33:1;:48;;;;;;;;7901:54;;;;7956:6;7901:62;;;;;-1:-1:-1;;;7901:62:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;7901:62:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;7901:62:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;7901:62:1;7891:89;;-1:-1:-1;;;7891:89:1;;;;;;;;;;;;7965:14;;7891:89;;7965:14;7891:89;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;7891:89:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;7891:89:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;7891:89:1;;-1:-1:-1;7998:17:1;;;;;;;;7994:60;;;8050:4;8033:21;;7994:60;8074:13;;;;;;;;;;;;;;;;;;;;:7;;;;:13;;;;;;;;;;;;;;:7;:13;;;5:2:-1;;;;30:1;27;20:12;5:2;8074:13:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;8074:13:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;8074:13:1;;-1:-1:-1;7865:3:1;;7814:284;;;6528:1576;;;;;;;;;;;:::o",
"source": "pragma solidity ^0.4.15;\nimport \"@gnosis.pm/pm-contracts/contracts/Utils/Math.sol\";\nimport \"./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 Math for *;\n\n /*\n * Constants\n */\n uint constant ONE = 0x10000000000000000;\n int constant EXP_LIMIT = 3394200909562557497344;\n\n /*\n * Public functions\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 constant\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 = Math.log2(netOutcomeTokensSold.length * ONE, Math.EstimationMode.UpperBound);\n uint funding = market.funding();\n int costLevelBefore = calcCostLevel(log2N, netOutcomeTokensSold, funding, Math.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, Math.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 constant\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 = Math.log2(netOutcomeTokensSold.length * ONE, Math.EstimationMode.UpperBound);\n uint funding = market.funding();\n int costLevelBefore = calcCostLevel(log2N, netOutcomeTokensSold, funding, Math.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, Math.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 contract\n /// @param outcomeTokenIndex Index of outcome to determine marginal price of\n /// @return Marginal price of an outcome as a fixed point number\n function calcMarginalPrice(Market market, uint8 outcomeTokenIndex)\n public\n constant\n returns (uint price)\n {\n require(market.eventContract().getOutcomeCount() > 1);\n int[] memory netOutcomeTokensSold = getNetOutcomeTokensSold(market);\n int logN = Math.log2(netOutcomeTokensSold.length * ONE, Math.EstimationMode.Midpoint);\n uint funding = market.funding();\n // The price function is exp(quantities[i]/b) / sum(exp(q/b) for q in quantities)\n // To avoid overflow, calculate with\n // exp(quantities[i]/b - offset) / sum(exp(q/b - offset) for q in quantities)\n var (sum, , outcomeExpTerm) = sumExpOffset(logN, netOutcomeTokensSold, funding, outcomeTokenIndex, Math.EstimationMode.Midpoint);\n return outcomeExpTerm / (sum / ONE);\n }\n\n /*\n * Private functions\n */\n /// @dev Calculates the result of the LMSR cost function which is used to\n /// derive prices from the market state\n /// @param logN Logarithm of the number of outcomes\n /// @param netOutcomeTokensSold Net outcome tokens sold by market\n /// @param funding Initial funding for market\n /// @return Cost level\n function calcCostLevel(int logN, int[] netOutcomeTokensSold, uint funding, Math.EstimationMode estimationMode)\n private\n constant\n returns(int costLevel)\n {\n // The cost function is C = b * log(sum(exp(q/b) for q in quantities)).\n // To avoid overflow, we need to calc with an exponent offset:\n // C = b * (offset + log(sum(exp(q/b - offset) for q in quantities)))\n var (sum, offset, ) = sumExpOffset(logN, netOutcomeTokensSold, funding, 0, estimationMode);\n costLevel = Math.log2(sum, estimationMode);\n costLevel = costLevel.add(offset);\n costLevel = (costLevel.mul(int(ONE)) / logN).mul(int(funding));\n }\n\n /// @dev Calculates sum(exp(q/b - offset) for q in quantities), where offset is set\n /// so that the sum fits in 248-256 bits\n /// @param logN Logarithm of the number of outcomes\n /// @param netOutcomeTokensSold Net outcome tokens sold by market\n /// @param funding Initial funding for market\n /// @param outcomeIndex Index of exponential term to extract (for use by marginal price function)\n /// @return A result structure composed of the sum, the offset used, and the summand associated with the supplied index\n function sumExpOffset(int logN, int[] netOutcomeTokensSold, uint funding, uint8 outcomeIndex, Math.EstimationMode estimationMode)\n private\n constant\n returns (uint sum, int offset, uint outcomeExpTerm)\n {\n // Naive calculation of this causes an overflow\n // since anything above a bit over 133*ONE supplied to exp will explode\n // as exp(133) just about fits into 192 bits of whole number data.\n\n // The choice of this offset is subject to another limit:\n // computing the inner sum successfully.\n // Since the index is 8 bits, there has to be 8 bits of headroom for\n // each summand, meaning q/b - offset <= exponential_limit,\n // where that limit can be found with `mp.floor(mp.log((2**248 - 1) / ONE) * ONE)`\n // That is what EXP_LIMIT is set to: it is about 127.5\n\n // finally, if the distribution looks like [BIG, tiny, tiny...], using a\n // BIG offset will cause the tiny quantities to go really negative\n // causing the associated exponentials to vanish.\n\n require(logN >= 0 && int(funding) >= 0);\n offset = Math.max(netOutcomeTokensSold);\n offset = offset.mul(logN) / int(funding);\n offset = offset.sub(EXP_LIMIT);\n uint term;\n for (uint8 i = 0; i < netOutcomeTokensSold.length; i++) {\n term = Math.pow2((netOutcomeTokensSold[i].mul(logN) / int(funding)).sub(offset), estimationMode);\n if (i == outcomeIndex)\n outcomeExpTerm = term;\n sum = sum.add(term);\n }\n }\n\n /// @dev Gets net outcome tokens sold by market. Since all sets of outcome tokens are backed by\n /// corresponding collateral tokens, the net quantity of a token sold by the market is the\n /// number of collateral tokens (which is the same as the number of outcome tokens the\n /// market created) subtracted by the quantity of that token held by the market.\n /// @param market Market contract\n /// @return Net outcome tokens sold by market\n function getNetOutcomeTokensSold(Market market)\n private\n constant\n returns (int[] quantities)\n {\n quantities = new int[](market.eventContract().getOutcomeCount());\n for (uint8 i = 0; i < quantities.length; i++)\n quantities[i] = market.netOutcomeTokensSold(i);\n }\n}\n",
"sourcePath": "/home/josojo/reality/tokenized-events/contracts/Market/LMSRMarketMaker.sol",
"ast": {
"absolutePath": "/home/josojo/reality/tokenized-events/contracts/Market/LMSRMarketMaker.sol",
"exportedSymbols": {
"LMSRMarketMaker": [
815
]
},
"id": 816,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 281,
"literals": [
"solidity",
"^",
"0.4",
".15"
],
"nodeType": "PragmaDirective",
"src": "0:24:1"
},
{
"absolutePath": "@gnosis.pm/pm-contracts/contracts/Utils/Math.sol",
"file": "@gnosis.pm/pm-contracts/contracts/Utils/Math.sol",
"id": 282,
"nodeType": "ImportDirective",
"scope": 816,
"sourceUnit": 3955,
"src": "25:58:1",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "/home/josojo/reality/tokenized-events/contracts/Market/MarketMaker.sol",
"file": "./MarketMaker.sol",
"id": 283,
"nodeType": "ImportDirective",
"scope": 816,
"sourceUnit": 921,
"src": "84:27:1",
"symbolAliases": [],
"unitAlias": ""
},
{
"baseContracts": [
{
"arguments": null,
"baseName": {
"contractScope": null,
"id": 284,
"name": "MarketMaker",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 920,
"src": "296:11:1",
"typeDescriptions": {
"typeIdentifier": "t_contract$_MarketMaker_$920",
"typeString": "contract MarketMaker"
}
},
"id": 285,
"nodeType": "InheritanceSpecifier",
"src": "296:11:1"
}
],
"contractDependencies": [
920
],
"contractKind": "contract",
"documentation": "@title LMSR market maker contract - Calculates share prices based on share distribution and initial funding\n @author Alan Lu - <alan.lu@gnosis.pm>",
"fullyImplemented": true,
"id": 815,
"linearizedBaseContracts": [
815,
920
],
"name": "LMSRMarketMaker",
"nodeType": "ContractDefinition",
"nodes": [
{
"id": 287,
"libraryName": {
"contractScope": null,
"id": 286,
"name": "Math",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 3954,
"src": "320:4:1",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Math_$3954",
"typeString": "library Math"
}
},
"nodeType": "UsingForDirective",
"src": "314:17:1",
"typeName": null
},
{
"constant": true,
"id": 290,
"name": "ONE",
"nodeType": "VariableDeclaration",
"scope": 815,
"src": "370:39:1",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 288,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "370:4:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": {
"argumentTypes": null,
"hexValue": "30783130303030303030303030303030303030",
"id": 289,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "390:19:1",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_18446744073709551616_by_1",
"typeString": "int_const 18446744073709551616"
},
"value": "0x10000000000000000"
},
"visibility": "internal"
},
{
"constant": true,
"id": 293,
"name": "EXP_LIMIT",
"nodeType": "VariableDeclaration",
"scope": 815,
"src": "415:47:1",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
},
"typeName": {
"id": 291,
"name": "int",
"nodeType": "ElementaryTypeName",
"src": "415:3:1",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"value": {
"argumentTypes": null,
"hexValue": "33333934323030393039353632353537343937333434",
"id": 292,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "440:22:1",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_3394200909562557497344_by_1",
"typeString": "int_const 3394200909562557497344"
},
"value": "3394200909562557497344"
},
"visibility": "internal"
},
{
"body": {
"id": 428,
"nodeType": "Block",
"src": "900:1433:1",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
},
"id": 311,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": null,
"id": 305,
"name": "market",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 295,
"src": "918:6:1",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Market_$885",
"typeString": "contract Market"
}
},
"id": 306,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "eventContract",
"nodeType": "MemberAccess",
"referencedDeclaration": 869,
"src": "918:20:1",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$__$returns$_t_contract$_ScalarEvent_$2415_$",
"typeString": "function () view external returns (contract ScalarEvent)"
}
},
"id": 307,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",