{
    "schemaVersion": "2.0.0",
    "contractName": "PosterRegistry",
    "compilerOutput": {
        "abi": [
            {
                "constant": false,
                "inputs": [
                    {
                        "internalType": "uint256",
                        "name": "amount",
                        "type": "uint256"
                    }
                ],
                "name": "releaseTokens",
                "outputs": [],
                "payable": false,
                "stateMutability": "nonpayable",
                "type": "function"
            },
            {
                "constant": true,
                "inputs": [],
                "name": "treasury",
                "outputs": [
                    {
                        "internalType": "contract Treasury",
                        "name": "",
                        "type": "address"
                    }
                ],
                "payable": false,
                "stateMutability": "view",
                "type": "function"
            },
            {
                "constant": true,
                "inputs": [
                    {
                        "internalType": "address",
                        "name": "a",
                        "type": "address"
                    }
                ],
                "name": "tokensRegisteredFor",
                "outputs": [
                    {
                        "internalType": "uint256",
                        "name": "",
                        "type": "uint256"
                    }
                ],
                "payable": false,
                "stateMutability": "view",
                "type": "function"
            },
            {
                "constant": false,
                "inputs": [
                    {
                        "internalType": "uint256",
                        "name": "amount",
                        "type": "uint256"
                    }
                ],
                "name": "registerTokens",
                "outputs": [],
                "payable": false,
                "stateMutability": "nonpayable",
                "type": "function"
            },
            {
                "constant": true,
                "inputs": [],
                "name": "tokensContributed",
                "outputs": [
                    {
                        "internalType": "uint256",
                        "name": "",
                        "type": "uint256"
                    }
                ],
                "payable": false,
                "stateMutability": "view",
                "type": "function"
            },
            {
                "constant": true,
                "inputs": [],
                "name": "kosuToken",
                "outputs": [
                    {
                        "internalType": "contract KosuToken",
                        "name": "",
                        "type": "address"
                    }
                ],
                "payable": false,
                "stateMutability": "view",
                "type": "function"
            },
            {
                "inputs": [
                    {
                        "internalType": "address payable",
                        "name": "_treasuryAddress",
                        "type": "address"
                    },
                    {
                        "internalType": "address",
                        "name": "_events",
                        "type": "address"
                    }
                ],
                "payable": false,
                "stateMutability": "nonpayable",
                "type": "constructor"
            },
            {
                "payable": true,
                "stateMutability": "payable",
                "type": "fallback"
            }
        ],
        "devdoc": {
            "author": "Freydal",
            "details": "The PosterRegistry allows accounts to manage tokens registered rewarding permission to post orders to the kosu network.",
            "methods": {
                "constructor": {
                    "details": "Initializes the PosterRegistry with the treasury and EventEmitter addresses.",
                    "params": {
                        "_events": "Deployed Events contract address.",
                        "_treasuryAddress": "Treasury contract address."
                    }
                },
                "registerTokens(uint256)": {
                    "details": "Register tokens for posting permissions.",
                    "params": {
                        "amount": "Number of tokens to register."
                    }
                },
                "releaseTokens(uint256)": {
                    "details": "Release tokens from the registry.",
                    "params": {
                        "amount": "Number of tokens to release."
                    }
                },
                "tokensRegisteredFor(address)": {
                    "details": "Tokens registered for an account.",
                    "params": {
                        "a": "Address to get value for."
                    },
                    "return": "Tokens registered for address."
                }
            },
            "title": "PosterRegistry"
        },
        "evm": {
            "bytecode": {
                "linkReferences": {},
                "object": "0x6080604052600060015534801561001557600080fd5b506040516107b43803806107b48339818101604052604081101561003857600080fd5b508051602091820151600380546001600160a01b0319166001600160a01b038085169190911791829055604080517fd818bb4d000000000000000000000000000000000000000000000000000000008152905194959394929091169263d818bb4d92600480840193829003018186803b1580156100b457600080fd5b505afa1580156100c8573d6000803e3d6000fd5b505050506040513d60208110156100de57600080fd5b5051600280546001600160a01b039283166001600160a01b03199182161790915560048054939092169216919091179055506106958061011f6000396000f3fe6080604052600436106100555760003560e01c80634b0babdd1461019557806361d027b3146101c1578063a5988a6f146101f2578063cbb7a7c014610237578063d244ac3214610261578063d818bb4d14610276575b600354604080516303d4b97b60e11b815233600482015290516000926001600160a01b0316916307a972f691349160248082019260209290919082900301818588803b1580156100a457600080fd5b505af11580156100b8573d6000803e3d6000fd5b50505050506040513d60208110156100cf57600080fd5b50516003546040805163fe417fa560e01b81523360048201526024810184905290519293506001600160a01b039091169163fe417fa59160448082019260009290919082900301818387803b15801561012757600080fd5b505af115801561013b573d6000803e3d6000fd5b5050600154610153925090508263ffffffff61028b16565b60015533600090815260208190526040902054610176908263ffffffff61028b16565b33600081815260208190526040902091909155610192906102a4565b50005b3480156101a157600080fd5b506101bf600480360360208110156101b857600080fd5b50356103fa565b005b3480156101cd57600080fd5b506101d661053d565b604080516001600160a01b039092168252519081900360200190f35b3480156101fe57600080fd5b506102256004803603602081101561021557600080fd5b50356001600160a01b031661054c565b60408051918252519081900360200190f35b34801561024357600080fd5b506101bf6004803603602081101561025a57600080fd5b503561055d565b34801561026d57600080fd5b5061022561061b565b34801561028257600080fd5b506101d6610621565b60008282018381101561029d57600080fd5b9392505050565b6040805160028082526060808301845292602083019080388339019050509050816001600160a01b031660001b816000815181106102de57fe5b6020026020010181815250506102f382610630565b60001b8160018151811061030357fe5b602090810291909101810191909152600480546040516354309e0d60e01b815260609281019283526014606482015273506f73746572526567697374727955706461746560601b608482015260a060248201908152855160a483015285516001600160a01b03909316946354309e0d9487949093849392604482019260c490920191878201910280838360005b838110156103a8578181015183820152602001610390565b50505050905001848103825260008152602001602001945050505050600060405180830381600087803b1580156103de57600080fd5b505af11580156103f2573d6000803e3d6000fd5b505050505050565b6002546003546040805163095ea7b360e01b81526001600160a01b039283166004820152602481018590529051919092169163095ea7b39160448083019260209291908290030181600087803b15801561045357600080fd5b505af1158015610467573d6000803e3d6000fd5b505050506040513d602081101561047d57600080fd5b50506003546040805163f40d71f160e01b81523360048201526024810184905290516001600160a01b039092169163f40d71f19160448082019260009290919082900301818387803b1580156104d257600080fd5b505af11580156104e6573d6000803e3d6000fd5b50503360009081526020819052604090205461050b925090508263ffffffff61064b16565b3360009081526020819052604090205560015461052e908263ffffffff61064b16565b60015561053a336102a4565b50565b6003546001600160a01b031681565b600061055782610630565b92915050565b6003546040805163fe417fa560e01b81523360048201526024810184905290516001600160a01b039092169163fe417fa59160448082019260009290919082900301818387803b1580156105b057600080fd5b505af11580156105c4573d6000803e3d6000fd5b50506001546105dc925090508263ffffffff61028b16565b600155336000908152602081905260409020546105ff908263ffffffff61028b16565b3360008181526020819052604090209190915561053a906102a4565b60015481565b6002546001600160a01b031681565b6001600160a01b031660009081526020819052604090205490565b60008282111561065a57600080fd5b5090039056fea265627a7a7231582010925f7743507458f4d96fe064963880894ab2cdd3258c7c5efaabbea3d66e2664736f6c634300050b0032",
                "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 PUSH1 0x1 SSTORE CALLVALUE DUP1 ISZERO PUSH2 0x15 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH2 0x7B4 CODESIZE SUB DUP1 PUSH2 0x7B4 DUP4 CODECOPY DUP2 DUP2 ADD PUSH1 0x40 MSTORE PUSH1 0x40 DUP2 LT ISZERO PUSH2 0x38 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP DUP1 MLOAD PUSH1 0x20 SWAP2 DUP3 ADD MLOAD PUSH1 0x3 DUP1 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB NOT AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP1 DUP6 AND SWAP2 SWAP1 SWAP2 OR SWAP2 DUP3 SWAP1 SSTORE PUSH1 0x40 DUP1 MLOAD PUSH32 0xD818BB4D00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE SWAP1 MLOAD SWAP5 SWAP6 SWAP4 SWAP5 SWAP3 SWAP1 SWAP2 AND SWAP3 PUSH4 0xD818BB4D SWAP3 PUSH1 0x4 DUP1 DUP5 ADD SWAP4 DUP3 SWAP1 SUB ADD DUP2 DUP7 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0xB4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0xC8 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x20 DUP2 LT ISZERO PUSH2 0xDE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP MLOAD PUSH1 0x2 DUP1 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP3 DUP4 AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB NOT SWAP2 DUP3 AND OR SWAP1 SWAP2 SSTORE PUSH1 0x4 DUP1 SLOAD SWAP4 SWAP1 SWAP3 AND SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE POP PUSH2 0x695 DUP1 PUSH2 0x11F PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x55 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x4B0BABDD EQ PUSH2 0x195 JUMPI DUP1 PUSH4 0x61D027B3 EQ PUSH2 0x1C1 JUMPI DUP1 PUSH4 0xA5988A6F EQ PUSH2 0x1F2 JUMPI DUP1 PUSH4 0xCBB7A7C0 EQ PUSH2 0x237 JUMPI DUP1 PUSH4 0xD244AC32 EQ PUSH2 0x261 JUMPI DUP1 PUSH4 0xD818BB4D EQ PUSH2 0x276 JUMPI JUMPDEST PUSH1 0x3 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH4 0x3D4B97B PUSH1 0xE1 SHL DUP2 MSTORE CALLER PUSH1 0x4 DUP3 ADD MSTORE SWAP1 MLOAD PUSH1 0x0 SWAP3 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND SWAP2 PUSH4 0x7A972F6 SWAP2 CALLVALUE SWAP2 PUSH1 0x24 DUP1 DUP3 ADD SWAP3 PUSH1 0x20 SWAP3 SWAP1 SWAP2 SWAP1 DUP3 SWAP1 SUB ADD DUP2 DUP6 DUP9 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0xA4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0xB8 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x20 DUP2 LT ISZERO PUSH2 0xCF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP MLOAD PUSH1 0x3 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH4 0xFE417FA5 PUSH1 0xE0 SHL DUP2 MSTORE CALLER PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 DUP2 ADD DUP5 SWAP1 MSTORE SWAP1 MLOAD SWAP3 SWAP4 POP PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP2 AND SWAP2 PUSH4 0xFE417FA5 SWAP2 PUSH1 0x44 DUP1 DUP3 ADD SWAP3 PUSH1 0x0 SWAP3 SWAP1 SWAP2 SWAP1 DUP3 SWAP1 SUB ADD DUP2 DUP4 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x127 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x13B JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP PUSH1 0x1 SLOAD PUSH2 0x153 SWAP3 POP SWAP1 POP DUP3 PUSH4 0xFFFFFFFF PUSH2 0x28B AND JUMP JUMPDEST PUSH1 0x1 SSTORE CALLER PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH2 0x176 SWAP1 DUP3 PUSH4 0xFFFFFFFF PUSH2 0x28B AND JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SWAP2 SWAP1 SWAP2 SSTORE PUSH2 0x192 SWAP1 PUSH2 0x2A4 JUMP JUMPDEST POP STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1A1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1BF PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x1B8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP CALLDATALOAD PUSH2 0x3FA JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1CD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1D6 PUSH2 0x53D JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1FE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x225 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x215 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH2 0x54C JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x243 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1BF PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x25A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP CALLDATALOAD PUSH2 0x55D JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x26D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x225 PUSH2 0x61B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x282 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1D6 PUSH2 0x621 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 ADD DUP4 DUP2 LT ISZERO PUSH2 0x29D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x2 DUP1 DUP3 MSTORE PUSH1 0x60 DUP1 DUP4 ADD DUP5 MSTORE SWAP3 PUSH1 0x20 DUP4 ADD SWAP1 DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP POP SWAP1 POP DUP2 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH1 0x0 SHL DUP2 PUSH1 0x0 DUP2 MLOAD DUP2 LT PUSH2 0x2DE JUMPI INVALID JUMPDEST PUSH1 0x20 MUL PUSH1 0x20 ADD ADD DUP2 DUP2 MSTORE POP POP PUSH2 0x2F3 DUP3 PUSH2 0x630 JUMP JUMPDEST PUSH1 0x0 SHL DUP2 PUSH1 0x1 DUP2 MLOAD DUP2 LT PUSH2 0x303 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP2 SWAP1 SWAP2 ADD DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x4 DUP1 SLOAD PUSH1 0x40 MLOAD PUSH4 0x54309E0D PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x60 SWAP3 DUP2 ADD SWAP3 DUP4 MSTORE PUSH1 0x14 PUSH1 0x64 DUP3 ADD MSTORE PUSH20 0x506F737465725265676973747279557064617465 PUSH1 0x60 SHL PUSH1 0x84 DUP3 ADD MSTORE PUSH1 0xA0 PUSH1 0x24 DUP3 ADD SWAP1 DUP2 MSTORE DUP6 MLOAD PUSH1 0xA4 DUP4 ADD MSTORE DUP6 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP4 AND SWAP5 PUSH4 0x54309E0D SWAP5 DUP8 SWAP5 SWAP1 SWAP4 DUP5 SWAP4 SWAP3 PUSH1 0x44 DUP3 ADD SWAP3 PUSH1 0xC4 SWAP1 SWAP3 ADD SWAP2 DUP8 DUP3 ADD SWAP2 MUL DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x3A8 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x390 JUMP JUMPDEST POP POP POP POP SWAP1 POP ADD DUP5 DUP2 SUB DUP3 MSTORE PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x20 ADD SWAP5 POP POP POP POP POP PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x3DE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x3F2 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x2 SLOAD PUSH1 0x3 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH4 0x95EA7B3 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP3 DUP4 AND PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 DUP2 ADD DUP6 SWAP1 MSTORE SWAP1 MLOAD SWAP2 SWAP1 SWAP3 AND SWAP2 PUSH4 0x95EA7B3 SWAP2 PUSH1 0x44 DUP1 DUP4 ADD SWAP3 PUSH1 0x20 SWAP3 SWAP2 SWAP1 DUP3 SWAP1 SUB ADD DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x453 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x467 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x47D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP POP PUSH1 0x3 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH4 0xF40D71F1 PUSH1 0xE0 SHL DUP2 MSTORE CALLER PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 DUP2 ADD DUP5 SWAP1 MSTORE SWAP1 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP3 AND SWAP2 PUSH4 0xF40D71F1 SWAP2 PUSH1 0x44 DUP1 DUP3 ADD SWAP3 PUSH1 0x0 SWAP3 SWAP1 SWAP2 SWAP1 DUP3 SWAP1 SUB ADD DUP2 DUP4 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x4D2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x4E6 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP CALLER PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH2 0x50B SWAP3 POP SWAP1 POP DUP3 PUSH4 0xFFFFFFFF PUSH2 0x64B AND JUMP JUMPDEST CALLER PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SSTORE PUSH1 0x1 SLOAD PUSH2 0x52E SWAP1 DUP3 PUSH4 0xFFFFFFFF PUSH2 0x64B AND JUMP JUMPDEST PUSH1 0x1 SSTORE PUSH2 0x53A CALLER PUSH2 0x2A4 JUMP JUMPDEST POP JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP2 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x557 DUP3 PUSH2 0x630 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH4 0xFE417FA5 PUSH1 0xE0 SHL DUP2 MSTORE CALLER PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 DUP2 ADD DUP5 SWAP1 MSTORE SWAP1 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP3 AND SWAP2 PUSH4 0xFE417FA5 SWAP2 PUSH1 0x44 DUP1 DUP3 ADD SWAP3 PUSH1 0x0 SWAP3 SWAP1 SWAP2 SWAP1 DUP3 SWAP1 SUB ADD DUP2 DUP4 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x5B0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x5C4 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP PUSH1 0x1 SLOAD PUSH2 0x5DC SWAP3 POP SWAP1 POP DUP3 PUSH4 0xFFFFFFFF PUSH2 0x28B AND JUMP JUMPDEST PUSH1 0x1 SSTORE CALLER PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH2 0x5FF SWAP1 DUP3 PUSH4 0xFFFFFFFF PUSH2 0x28B AND JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SWAP2 SWAP1 SWAP2 SSTORE PUSH2 0x53A SWAP1 PUSH2 0x2A4 JUMP JUMPDEST PUSH1 0x1 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x2 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP2 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 GT ISZERO PUSH2 0x65A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP SWAP1 SUB SWAP1 JUMP INVALID LOG2 PUSH6 0x627A7A723158 KECCAK256 LT SWAP3 0x5f PUSH24 0x43507458F4D96FE064963880894AB2CDD3258C7C5EFAABBE LOG3 0xd6 PUSH15 0x2664736F6C634300050B0032000000 ",
                "sourceMap": "335:3247:9:-;;;475:1;443:33;;879:201;8:9:-1;5:2;;;30:1;27;20:12;5:2;879:201:9;;;;;;;;;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;879:201:9;;;;;;;959:8;:37;;-1:-1:-1;;;;;;959:37:9;-1:-1:-1;;;;;959:37:9;;;;;;;;;;;879:201;1018:20;;;;;;;879:201;;;;1018:8;;;;;:18;;:20;;;;;;;;;;:8;:20;;;5:2:-1;;;;30:1;27;20:12;5:2;1018:20:9;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1018:20:9;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;1018:20:9;1006:9;:32;;-1:-1:-1;;;;;1006:32:9;;;-1:-1:-1;;;;;;1006:32:9;;;;;;;1048:1;:25;;;;;;;;;;;;;;-1:-1:-1;335:3247:9;;;;;;"
            },
            "deployedBytecode": {
                "linkReferences": {},
                "object": "0x6080604052600436106100555760003560e01c80634b0babdd1461019557806361d027b3146101c1578063a5988a6f146101f2578063cbb7a7c014610237578063d244ac3214610261578063d818bb4d14610276575b600354604080516303d4b97b60e11b815233600482015290516000926001600160a01b0316916307a972f691349160248082019260209290919082900301818588803b1580156100a457600080fd5b505af11580156100b8573d6000803e3d6000fd5b50505050506040513d60208110156100cf57600080fd5b50516003546040805163fe417fa560e01b81523360048201526024810184905290519293506001600160a01b039091169163fe417fa59160448082019260009290919082900301818387803b15801561012757600080fd5b505af115801561013b573d6000803e3d6000fd5b5050600154610153925090508263ffffffff61028b16565b60015533600090815260208190526040902054610176908263ffffffff61028b16565b33600081815260208190526040902091909155610192906102a4565b50005b3480156101a157600080fd5b506101bf600480360360208110156101b857600080fd5b50356103fa565b005b3480156101cd57600080fd5b506101d661053d565b604080516001600160a01b039092168252519081900360200190f35b3480156101fe57600080fd5b506102256004803603602081101561021557600080fd5b50356001600160a01b031661054c565b60408051918252519081900360200190f35b34801561024357600080fd5b506101bf6004803603602081101561025a57600080fd5b503561055d565b34801561026d57600080fd5b5061022561061b565b34801561028257600080fd5b506101d6610621565b60008282018381101561029d57600080fd5b9392505050565b6040805160028082526060808301845292602083019080388339019050509050816001600160a01b031660001b816000815181106102de57fe5b6020026020010181815250506102f382610630565b60001b8160018151811061030357fe5b602090810291909101810191909152600480546040516354309e0d60e01b815260609281019283526014606482015273506f73746572526567697374727955706461746560601b608482015260a060248201908152855160a483015285516001600160a01b03909316946354309e0d9487949093849392604482019260c490920191878201910280838360005b838110156103a8578181015183820152602001610390565b50505050905001848103825260008152602001602001945050505050600060405180830381600087803b1580156103de57600080fd5b505af11580156103f2573d6000803e3d6000fd5b505050505050565b6002546003546040805163095ea7b360e01b81526001600160a01b039283166004820152602481018590529051919092169163095ea7b39160448083019260209291908290030181600087803b15801561045357600080fd5b505af1158015610467573d6000803e3d6000fd5b505050506040513d602081101561047d57600080fd5b50506003546040805163f40d71f160e01b81523360048201526024810184905290516001600160a01b039092169163f40d71f19160448082019260009290919082900301818387803b1580156104d257600080fd5b505af11580156104e6573d6000803e3d6000fd5b50503360009081526020819052604090205461050b925090508263ffffffff61064b16565b3360009081526020819052604090205560015461052e908263ffffffff61064b16565b60015561053a336102a4565b50565b6003546001600160a01b031681565b600061055782610630565b92915050565b6003546040805163fe417fa560e01b81523360048201526024810184905290516001600160a01b039092169163fe417fa59160448082019260009290919082900301818387803b1580156105b057600080fd5b505af11580156105c4573d6000803e3d6000fd5b50506001546105dc925090508263ffffffff61028b16565b600155336000908152602081905260409020546105ff908263ffffffff61028b16565b3360008181526020819052604090209190915561053a906102a4565b60015481565b6002546001600160a01b031681565b6001600160a01b031660009081526020819052604090205490565b60008282111561065a57600080fd5b5090039056fea265627a7a7231582010925f7743507458f4d96fe064963880894ab2cdd3258c7c5efaabbea3d66e2664736f6c634300050b0032",
                "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x55 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x4B0BABDD EQ PUSH2 0x195 JUMPI DUP1 PUSH4 0x61D027B3 EQ PUSH2 0x1C1 JUMPI DUP1 PUSH4 0xA5988A6F EQ PUSH2 0x1F2 JUMPI DUP1 PUSH4 0xCBB7A7C0 EQ PUSH2 0x237 JUMPI DUP1 PUSH4 0xD244AC32 EQ PUSH2 0x261 JUMPI DUP1 PUSH4 0xD818BB4D EQ PUSH2 0x276 JUMPI JUMPDEST PUSH1 0x3 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH4 0x3D4B97B PUSH1 0xE1 SHL DUP2 MSTORE CALLER PUSH1 0x4 DUP3 ADD MSTORE SWAP1 MLOAD PUSH1 0x0 SWAP3 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND SWAP2 PUSH4 0x7A972F6 SWAP2 CALLVALUE SWAP2 PUSH1 0x24 DUP1 DUP3 ADD SWAP3 PUSH1 0x20 SWAP3 SWAP1 SWAP2 SWAP1 DUP3 SWAP1 SUB ADD DUP2 DUP6 DUP9 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0xA4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0xB8 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x20 DUP2 LT ISZERO PUSH2 0xCF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP MLOAD PUSH1 0x3 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH4 0xFE417FA5 PUSH1 0xE0 SHL DUP2 MSTORE CALLER PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 DUP2 ADD DUP5 SWAP1 MSTORE SWAP1 MLOAD SWAP3 SWAP4 POP PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP2 AND SWAP2 PUSH4 0xFE417FA5 SWAP2 PUSH1 0x44 DUP1 DUP3 ADD SWAP3 PUSH1 0x0 SWAP3 SWAP1 SWAP2 SWAP1 DUP3 SWAP1 SUB ADD DUP2 DUP4 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x127 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x13B JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP PUSH1 0x1 SLOAD PUSH2 0x153 SWAP3 POP SWAP1 POP DUP3 PUSH4 0xFFFFFFFF PUSH2 0x28B AND JUMP JUMPDEST PUSH1 0x1 SSTORE CALLER PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH2 0x176 SWAP1 DUP3 PUSH4 0xFFFFFFFF PUSH2 0x28B AND JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SWAP2 SWAP1 SWAP2 SSTORE PUSH2 0x192 SWAP1 PUSH2 0x2A4 JUMP JUMPDEST POP STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1A1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1BF PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x1B8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP CALLDATALOAD PUSH2 0x3FA JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1CD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1D6 PUSH2 0x53D JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1FE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x225 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x215 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH2 0x54C JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x243 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1BF PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x25A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP CALLDATALOAD PUSH2 0x55D JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x26D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x225 PUSH2 0x61B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x282 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1D6 PUSH2 0x621 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 ADD DUP4 DUP2 LT ISZERO PUSH2 0x29D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x2 DUP1 DUP3 MSTORE PUSH1 0x60 DUP1 DUP4 ADD DUP5 MSTORE SWAP3 PUSH1 0x20 DUP4 ADD SWAP1 DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP POP SWAP1 POP DUP2 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH1 0x0 SHL DUP2 PUSH1 0x0 DUP2 MLOAD DUP2 LT PUSH2 0x2DE JUMPI INVALID JUMPDEST PUSH1 0x20 MUL PUSH1 0x20 ADD ADD DUP2 DUP2 MSTORE POP POP PUSH2 0x2F3 DUP3 PUSH2 0x630 JUMP JUMPDEST PUSH1 0x0 SHL DUP2 PUSH1 0x1 DUP2 MLOAD DUP2 LT PUSH2 0x303 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP2 SWAP1 SWAP2 ADD DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x4 DUP1 SLOAD PUSH1 0x40 MLOAD PUSH4 0x54309E0D PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x60 SWAP3 DUP2 ADD SWAP3 DUP4 MSTORE PUSH1 0x14 PUSH1 0x64 DUP3 ADD MSTORE PUSH20 0x506F737465725265676973747279557064617465 PUSH1 0x60 SHL PUSH1 0x84 DUP3 ADD MSTORE PUSH1 0xA0 PUSH1 0x24 DUP3 ADD SWAP1 DUP2 MSTORE DUP6 MLOAD PUSH1 0xA4 DUP4 ADD MSTORE DUP6 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP4 AND SWAP5 PUSH4 0x54309E0D SWAP5 DUP8 SWAP5 SWAP1 SWAP4 DUP5 SWAP4 SWAP3 PUSH1 0x44 DUP3 ADD SWAP3 PUSH1 0xC4 SWAP1 SWAP3 ADD SWAP2 DUP8 DUP3 ADD SWAP2 MUL DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x3A8 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x390 JUMP JUMPDEST POP POP POP POP SWAP1 POP ADD DUP5 DUP2 SUB DUP3 MSTORE PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x20 ADD SWAP5 POP POP POP POP POP PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x3DE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x3F2 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x2 SLOAD PUSH1 0x3 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH4 0x95EA7B3 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP3 DUP4 AND PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 DUP2 ADD DUP6 SWAP1 MSTORE SWAP1 MLOAD SWAP2 SWAP1 SWAP3 AND SWAP2 PUSH4 0x95EA7B3 SWAP2 PUSH1 0x44 DUP1 DUP4 ADD SWAP3 PUSH1 0x20 SWAP3 SWAP2 SWAP1 DUP3 SWAP1 SUB ADD DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x453 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x467 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x47D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP POP PUSH1 0x3 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH4 0xF40D71F1 PUSH1 0xE0 SHL DUP2 MSTORE CALLER PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 DUP2 ADD DUP5 SWAP1 MSTORE SWAP1 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP3 AND SWAP2 PUSH4 0xF40D71F1 SWAP2 PUSH1 0x44 DUP1 DUP3 ADD SWAP3 PUSH1 0x0 SWAP3 SWAP1 SWAP2 SWAP1 DUP3 SWAP1 SUB ADD DUP2 DUP4 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x4D2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x4E6 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP CALLER PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH2 0x50B SWAP3 POP SWAP1 POP DUP3 PUSH4 0xFFFFFFFF PUSH2 0x64B AND JUMP JUMPDEST CALLER PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SSTORE PUSH1 0x1 SLOAD PUSH2 0x52E SWAP1 DUP3 PUSH4 0xFFFFFFFF PUSH2 0x64B AND JUMP JUMPDEST PUSH1 0x1 SSTORE PUSH2 0x53A CALLER PUSH2 0x2A4 JUMP JUMPDEST POP JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP2 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x557 DUP3 PUSH2 0x630 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH4 0xFE417FA5 PUSH1 0xE0 SHL DUP2 MSTORE CALLER PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 DUP2 ADD DUP5 SWAP1 MSTORE SWAP1 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP3 AND SWAP2 PUSH4 0xFE417FA5 SWAP2 PUSH1 0x44 DUP1 DUP3 ADD SWAP3 PUSH1 0x0 SWAP3 SWAP1 SWAP2 SWAP1 DUP3 SWAP1 SUB ADD DUP2 DUP4 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x5B0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x5C4 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP PUSH1 0x1 SLOAD PUSH2 0x5DC SWAP3 POP SWAP1 POP DUP3 PUSH4 0xFFFFFFFF PUSH2 0x28B AND JUMP JUMPDEST PUSH1 0x1 SSTORE CALLER PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH2 0x5FF SWAP1 DUP3 PUSH4 0xFFFFFFFF PUSH2 0x28B AND JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SWAP2 SWAP1 SWAP2 SSTORE PUSH2 0x53A SWAP1 PUSH2 0x2A4 JUMP JUMPDEST PUSH1 0x1 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x2 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP2 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 GT ISZERO PUSH2 0x65A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP SWAP1 SUB SWAP1 JUMP INVALID LOG2 PUSH6 0x627A7A723158 KECCAK256 LT SWAP3 0x5f PUSH24 0x43507458F4D96FE064963880894AB2CDD3258C7C5EFAABBE LOG3 0xd6 PUSH15 0x2664736F6C634300050B0032000000 ",
                "sourceMap": "335:3247:9:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1427:8;;:50;;;-1:-1:-1;;;1427:50:9;;1466:10;1427:50;;;;;;1413:11;;-1:-1:-1;;;;;1427:8:9;;:21;;1455:9;;1427:50;;;;;;;;;;;;;;;1455:9;1427:8;:50;;;5:2:-1;;;;30:1;27;20:12;5:2;1427:50:9;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1427:50:9;;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;1427:50:9;1487:8;;:40;;;-1:-1:-1;;;1487:40:9;;1508:10;1487:40;;;;;;;;;;;;1427:50;;-1:-1:-1;;;;;;1487:8:9;;;;:20;;:40;;;;;:8;;:40;;;;;;;;:8;;:40;;;5:2:-1;;;;30:1;27;20:12;5:2;1487:40:9;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;;1557:17:9;;:29;;-1:-1:-1;1557:17:9;-1:-1:-1;1579:6:9;1557:29;:21;:29;:::i;:::-;1537:17;:49;1630:10;1620:9;:21;;;;;;;;;;;:33;;1646:6;1620:33;:25;:33;:::i;:::-;1606:10;1596:9;:21;;;;;;;;;;:57;;;;1663:22;;:10;:22::i;:::-;1374:318;335:3247;2712:424;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2712:424:9;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;2712:424:9;;:::i;:::-;;514:24;;8:9:-1;5:2;;;30:1;27;20:12;5:2;514:24:9;;;:::i;:::-;;;;-1:-1:-1;;;;;514:24:9;;;;;;;;;;;;;;1892:106;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1892:106:9;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;1892:106:9;-1:-1:-1;;;;;1892:106:9;;:::i;:::-;;;;;;;;;;;;;;;;2174:377;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2174:377:9;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;2174:377:9;;:::i;443:33::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;443:33:9;;;:::i;482:26::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;482:26:9;;;:::i;1431:145:0:-;1489:7;1520:5;;;1543:6;;;;1535:15;;;;;;1568:1;1431:145;-1:-1:-1;;;1431:145:0:o;3159:319:9:-;3322:16;;;3336:1;3322:16;;;3298:21;3322:16;;;;;3298:21;3322:16;;;;;105:10:-1;3322:16:9;88:34:-1;136:17;;-1:-1;3322:16:9;3298:40;;3371:1;-1:-1:-1;;;;;3366:7:9;3358:16;;3348:4;3353:1;3348:7;;;;;;;;;;;;;:26;;;;;3402:13;3413:1;3402:10;:13::i;:::-;3394:22;;3384:4;3389:1;3384:7;;;;;;;;;;;;;;;;;;:32;;;;3426:1;;;:45;;-1:-1:-1;;;3426:45:9;;;;;;;;;;;;;;-1:-1:-1;;;3426:45:9;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;3426:1:9;;;;:11;;3462:4;;3426:45;;;;;;;;;;;;;;;;;;;;;;:1;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;3426:45:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3426:45:9;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;3426:45:9;;;;3159:319;;:::o;2712:424::-;2875:9;;2901:8;;2875:44;;;-1:-1:-1;;;2875:44:9;;-1:-1:-1;;;;;2901:8:9;;;2875:44;;;;;;;;;;;;:9;;;;;:17;;:44;;;;;;;;;;;;;;:9;;:44;;;5:2:-1;;;;30:1;27;20:12;5:2;2875:44:9;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2875:44:9;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;2929:8:9;;:42;;;-1:-1:-1;;;2929:42:9;;2952:10;2929:42;;;;;;;;;;;;-1:-1:-1;;;;;2929:8:9;;;;:22;;:42;;;;;:8;;:42;;;;;;;;:8;;:42;;;5:2:-1;;;;30:1;27;20:12;5:2;2929:42:9;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;;3015:10:9;3005:9;:21;;;;;;;;;;;:33;;-1:-1:-1;3005:21:9;-1:-1:-1;3031:6:9;3005:33;:25;:33;:::i;:::-;2991:10;2981:9;:21;;;;;;;;;;:57;3068:17;;:29;;3090:6;3068:29;:21;:29;:::i;:::-;3048:17;:49;3107:22;3118:10;3107;:22::i;:::-;2712:424;:::o;514:24::-;;;-1:-1:-1;;;;;514:24:9;;:::o;1892:106::-;1955:4;1978:13;1989:1;1978:10;:13::i;:::-;1971:20;1892:106;-1:-1:-1;;1892:106:9:o;2174:377::-;2346:8;;:40;;;-1:-1:-1;;;2346:40:9;;2367:10;2346:40;;;;;;;;;;;;-1:-1:-1;;;;;2346:8:9;;;;:20;;:40;;;;;:8;;:40;;;;;;;;:8;;:40;;;5:2:-1;;;;30:1;27;20:12;5:2;2346:40:9;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;;2416:17:9;;:29;;-1:-1:-1;2416:17:9;-1:-1:-1;2438:6:9;2416:29;:21;:29;:::i;:::-;2396:17;:49;2489:10;2479:9;:21;;;;;;;;;;;:33;;2505:6;2479:33;:25;:33;:::i;:::-;2465:10;2455:9;:21;;;;;;;;;;:57;;;;2522:22;;:10;:22::i;443:33::-;;;;:::o;482:26::-;;;-1:-1:-1;;;;;482:26:9;;:::o;3484:96::-;-1:-1:-1;;;;;3561:12:9;3538:4;3561:12;;;;;;;;;;;;3484:96::o;1205:145:0:-;1263:7;1295:1;1290;:6;;1282:15;;;;;;-1:-1:-1;1319:5:0;;;1205:145::o"
            }
        }
    },
    "sources": {
        "poster/PosterRegistry.sol": {
            "id": 9
        },
        "openzeppelin-solidity/contracts/math/SafeMath.sol": {
            "id": 0
        },
        "treasury/Treasury.sol": {
            "id": 10
        },
        "base/Authorizable.sol": {
            "id": 5
        },
        "access_control/AuthorizedAddresses.sol": {
            "id": 4
        },
        "openzeppelin-solidity/contracts/ownership/Ownable.sol": {
            "id": 1
        },
        "lib/KosuToken.sol": {
            "id": 8
        },
        "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol": {
            "id": 2
        },
        "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol": {
            "id": 3
        },
        "lib/Formula.sol": {
            "id": 7
        },
        "voting/IVoting.sol": {
            "id": 12
        },
        "event/EventEmitter.sol": {
            "id": 6
        }
    },
    "sourceCodes": {
        "poster/PosterRegistry.sol": "pragma solidity ^0.5.0;\n\nimport \"openzeppelin-solidity/contracts/math/SafeMath.sol\";\nimport \"../treasury/Treasury.sol\";\nimport \"../event/EventEmitter.sol\";\n\n/** @title PosterRegistry\n    @author Freydal\n    @dev The PosterRegistry allows accounts to manage tokens registered rewarding permission to post orders to the kosu network.\n*/\ncontract PosterRegistry {\n    using SafeMath for uint;\n\n    mapping(address => uint) private _balances;\n    uint public tokensContributed = 0;\n    KosuToken public kosuToken;\n    Treasury public treasury;\n    EventEmitter private e;\n\n    /** @dev Initializes the PosterRegistry with the treasury and EventEmitter addresses.\n        @notice Initializes the PosterRegistry with the treasury and EventEmitter addresses.\n        @param _treasuryAddress Treasury contract address.\n        @param _events Deployed Events contract address.\n    */\n    constructor(address payable _treasuryAddress, address _events) public {\n        treasury = Treasury(_treasuryAddress);\n        kosuToken = treasury.kosuToken();\n        e = EventEmitter(_events);\n    }\n\n    /** @dev Fallback payable function allows for direct deposit of ether to generate tokens to be registered for Posting to Kosu network.\n        @notice Fallback payable function allows for direct deposit of ether to generate tokens to be registered for Posting to Kosu network.\n    */\n    function () external payable {\n        uint amount = treasury.contractBond.value(msg.value)(msg.sender);\n        treasury.claimTokens(msg.sender, amount);\n        tokensContributed = tokensContributed.add(amount);\n        _balances[msg.sender] = _balances[msg.sender].add(amount);\n        _emitEvent(msg.sender);\n    }\n\n    /** @dev Tokens registered for an account.\n        @notice Tokens registered for an account.\n        @param a Address to get value for.\n        @return Tokens registered for address.\n    */\n    function tokensRegisteredFor(address a) external view returns (uint) {\n        return _tokensFor(a);\n    }\n\n    /** @dev Register tokens for posting permissions.\n        @notice Register tokens for posting permissions.\n        @param amount Number of tokens to register.\n    */\n    function registerTokens(uint amount) external {\n        //Claim tokens from the treasury, delivering them to this contract and accounting for the balances locally.\n        treasury.claimTokens(msg.sender, amount);\n        tokensContributed = tokensContributed.add(amount);\n        _balances[msg.sender] = _balances[msg.sender].add(amount);\n        _emitEvent(msg.sender);\n    }\n\n    /** @dev Release tokens from the registry.\n        @notice Release tokens from the registry.\n        @param amount Number of tokens to release.\n    */\n    function releaseTokens(uint amount) external {\n        //Approve treasury to take tokens from this contract, treasury takes tokens and updates accounting.\n        kosuToken.approve(address(treasury), amount);\n        treasury.releaseTokens(msg.sender, amount);\n        _balances[msg.sender] = _balances[msg.sender].sub(amount);\n        tokensContributed = tokensContributed.sub(amount);\n        _emitEvent(msg.sender);\n    }\n\n    // Internal\n\n    function _emitEvent(address a) internal {\n        //Emits an event for the address that made a change and the new current balance.\n        bytes32[] memory data = new bytes32[](2);\n        data[0] = bytes32(uint(a));\n        data[1] = bytes32(_tokensFor(a));\n        e.emitEvent(\"PosterRegistryUpdate\", data, \"\");\n    }\n\n    function _tokensFor(address a) internal view returns (uint) {\n        return _balances[a];\n    }\n}\n",
        "openzeppelin-solidity/contracts/math/SafeMath.sol": "pragma solidity ^0.5.0;\n\n/**\n * @title SafeMath\n * @dev Unsigned math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n    /**\n    * @dev Multiplies two unsigned integers, reverts on overflow.\n    */\n    function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n        // benefit is lost if 'b' is also tested.\n        // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n        if (a == 0) {\n            return 0;\n        }\n\n        uint256 c = a * b;\n        require(c / a == b);\n\n        return c;\n    }\n\n    /**\n    * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.\n    */\n    function div(uint256 a, uint256 b) internal pure returns (uint256) {\n        // Solidity only automatically asserts when dividing by 0\n        require(b > 0);\n        uint256 c = a / b;\n        // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n        return c;\n    }\n\n    /**\n    * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n    */\n    function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n        require(b <= a);\n        uint256 c = a - b;\n\n        return c;\n    }\n\n    /**\n    * @dev Adds two unsigned integers, reverts on overflow.\n    */\n    function add(uint256 a, uint256 b) internal pure returns (uint256) {\n        uint256 c = a + b;\n        require(c >= a);\n\n        return c;\n    }\n\n    /**\n    * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),\n    * reverts when dividing by zero.\n    */\n    function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n        require(b != 0);\n        return a % b;\n    }\n}\n",
        "treasury/Treasury.sol": "pragma solidity ^0.5.0;\n\nimport \"../base/Authorizable.sol\";\nimport \"../lib/KosuToken.sol\";\nimport \"../voting/IVoting.sol\";\n\n/** @title Treasury\n    @author Freydal\n    @dev The Kosu Treasury manages KosuToken balances to allow tokens in use within the contract system to be available for voting operations.\n*/\ncontract Treasury is Authorizable {\n    using SafeMath for uint;\n\n    IVoting voting;\n\n    struct TokenLock {\n        uint value;\n        uint pollId;\n        uint tokenLockEnd;\n        uint pollEarlyUnlock;\n    }\n\n    KosuToken public kosuToken;\n    mapping(address => uint) private currentBalances;\n    mapping(address => uint) private systemBalances;\n    mapping(address => TokenLock[]) private addressTokenLocks;\n\n    /** @dev Initializes the treasury with the kosuToken and authorizedAddresses contracts.\n        @notice Initializes the treasury with the kosuToken and authorizedAddresses contracts.\n        @param kosuTokenAddress The deployed KosuToken contract address.\n        @param auth AuthorizedAddresses deployed address.\n    */\n    constructor(address payable kosuTokenAddress, address auth) Authorizable(auth) public {\n        kosuToken = KosuToken(kosuTokenAddress);\n    }\n\n    function setVoting(address votingAddress) isAuthorized public {\n        voting = IVoting(votingAddress);\n    }\n\n    /** @dev Fallback payable function to allow ether but be bonded and directly deposit tokens into the Treasury.\n        @notice Fallback payable function to allow ether but be bonded and directly deposit tokens into the Treasury.\n    */\n    function () external payable {\n        _bond(msg.sender);\n    }\n\n    /** @dev Allows Kosu contracts to bond ether on on the accounts behalf.\n        @notice Allows Kosu contracts to bond ether on on the accounts behalf.\n        @param account The address the calling contract is acting on behalf of.\n    */\n    function contractBond(address account) isAuthorized payable public returns (uint) {\n        return _bond(account);\n    }\n\n    /** @dev Deposits tokens into the treasury.\n        @notice Deposits tokens into the treasury.\n        @param amount Number of tokens to deposit.\n    */\n    function deposit(uint amount) public {\n        _deposit(msg.sender, amount);\n    }\n\n    /** @dev Allows contracts to deposit tokens from an accounts balance.\n        @notice Allows contracts to deposit tokens from an accounts balance.\n        @param account Account address the tokens will be deposited from.\n        @param amount Number of tokens to deposit.\n    */\n    function contractDeposit(address account, uint amount) isAuthorized public {\n        _deposit(account, amount);\n    }\n\n    /** @dev Withdraw tokens from the treasury.\n        @notice Withdraw tokens from the treasury.\n        @param amount Number of tokens to withdraw.\n    */\n    function withdraw(uint amount) public {\n        require(getSystemBalance(msg.sender).sub(amount) >= _getLockedTokens(msg.sender), \"tokens are locked\");\n\n        _withdraw(msg.sender, amount);\n    }\n\n    /** @dev Allows contracts to withdraw tokens back to an account address.\n        @notice Allows contracts to withdraw tokens back to an account address.\n        @param account Address to withdraw tokens for.\n        @param amount Number of tokens to withdraw.\n    */\n    function contractWithdraw(address account, uint amount) isAuthorized public {\n        _withdraw(account, amount);\n    }\n\n    /** @dev Allows contracts to claim tokens. Claimed tokens are not available for other system contract and leave the treasury under control of the calling contract.  These tokens are still available for voting.\n        @notice Allows contracts to claim tokens. Claimed tokens are not available for other system contract and leave the treasury under control of the calling contract.  These tokens are still available for voting.\n        @param account Account to claim tokens from.\n        @param amount Number of tokens to claim.\n    */\n    function claimTokens(address account, uint amount) isAuthorized public {\n        //Attempt to get more balance if balance is insufficient\n        if(getCurrentBalance(account) < amount) {\n            uint currentBalance = getCurrentBalance(account);\n            uint amountToDeposit = amount.sub(currentBalance);\n            _deposit(account, amountToDeposit);\n        }\n\n        //Transfer to requesting contract and update balance held in contract\n        require(kosuToken.transfer(msg.sender, amount));\n        setCurrentBalance(account, getCurrentBalance(account).sub(amount));\n    }\n\n    /** @dev Allows contracts to release claimed tokens. Allowing them to be used elsewhere by the user again.\n        @notice Allows contracts to release claimed tokens. Allowing them to be used elsewhere by the user again.\n        @param account Account to release tokens to.\n        @param amount Number of tokens to release.\n    */\n    function releaseTokens(address account, uint amount) isAuthorized public {\n        //Transfer from requesting contract and update balance held in contract\n        require(kosuToken.transferFrom(msg.sender, address(this), amount));\n        setCurrentBalance(account, getCurrentBalance(account).add(amount));\n    }\n\n    /** @dev Allows contracts to confiscate tokens the account has lost access to. These previously claimed tokens are no longer owned by the account.\n        @notice Allows contracts to confiscate tokens the account has lost access to. These previously claimed tokens are no longer owned by the account.\n        @param account Account to confiscate tokens from.\n        @param amount Number of tokens to confiscate.\n    */\n    function confiscate(address account, uint amount) isAuthorized public {\n        //Remove the system balance\n        setSystemBalance(account, getSystemBalance(account).sub(amount));\n        // Require the tokens being confiscated are only tokens already in kosu system contract control\n        require(getSystemBalance(account) >= getCurrentBalance(account), \"system balance overburn\");\n    }\n\n    /** @dev Allows accounts to be rewarded with tokens. These tokens were previously obtained by the calling contract and are now being redistributed to the provided account.\n        @notice Allows accounts to be rewarded with tokens. These tokens were previously obtained by the calling contract and are now being redistributed to the provided account.\n        @param account Account to award tokens to.\n        @param amount Number of tokens to award.\n    */\n    function award(address account, uint amount) isAuthorized public {\n        //Transfer from requesting contract and update balance held in contract\n        require(kosuToken.transferFrom(msg.sender, address(this), amount));\n        //Increase current balance\n        setCurrentBalance(account, getCurrentBalance(account).add(amount));\n        //Increase systemBalance these tokens are new to the account\n        setSystemBalance(account, getSystemBalance(account).add(amount));\n    }\n\n    /** @dev Allows contracts to burn an accounts held tokens.\n        @notice Allows contracts to burn an accounts held tokens.\n        @param account Account to burn tokens for.\n        @param amount Number of tokens to burn.\n    */\n    function burnFrom(address account, uint amount) isAuthorized public {\n        require(getCurrentBalance(account) >= amount, \"insufficient current balance\");\n        kosuToken.burn(amount);\n        setCurrentBalance(account, getCurrentBalance(account).sub(amount));\n        setSystemBalance(account, getSystemBalance(account).sub(amount));\n    }\n\n    /** @dev Allows voting contract to register a poll to ensure tokens aren't removed.\n        @notice Allows voting contract to register a poll to ensure tokens aren't removed.\n        @param account The account voting.\n        @param pollId The poll the account is voting on.\n        @param amount Number of tokens contributed.\n    */\n    function registerVote(address account, uint pollId, uint amount, uint endBlock, uint losingEndBlock) isAuthorized public returns (bool) {\n        if(systemBalances[account] < amount) {\n            return false;\n        }\n\n        addressTokenLocks[account].push(TokenLock(amount, pollId, endBlock, losingEndBlock));\n\n        return true;\n    }\n\n    /** @dev Allows validator registry to lock tokens in treasury after an exit.\n        @notice Allows validator registry to lock tokens in treasury after an exit.\n        @param account The account validator is locking.\n        @param amount Number of tokens to lock.\n        @param endBlock The end of the lock.\n    */\n    function validatorLock(address account, uint amount, uint endBlock) isAuthorized public {\n        addressTokenLocks[account].push(TokenLock(\n            amount,\n            0,\n            endBlock,\n            0\n        ));\n    }\n\n    /** @dev Allows tokens to determine when all tokens are unlocked for a given account.\n        @notice Allows tokens to determine when all tokens are unlocked for a given account.\n        @param account The account to look at locks for.\n        @return Final block of the last lock to expire.\n    */\n    function tokenLocksExpire(address account) public returns (uint lastBlock) {\n        _removeInactiveTokenLocks(msg.sender);\n        for(uint i = addressTokenLocks[account].length; i > 0; i--) {\n            if(addressTokenLocks[account][i - 1].tokenLockEnd > lastBlock) {\n                lastBlock = addressTokenLocks[account][i - 1].tokenLockEnd;\n            }\n        }\n        return lastBlock;\n    }\n\n    /** @dev Reports the total balance within the entire contract system for an account.\n        @notice Reports the total balance within the entire contract system for an account.\n        @param account Account to report balance on.\n        @return The number of tokens within the entire contract system.\n    */\n    function systemBalance(address account) public view returns (uint)  {\n        return getSystemBalance(account);\n    }\n\n    /** @dev Reports the available balance held within the treasury for an account.\n        @notice Reports the available balance held within the treasury for an account.\n        @param account Account to report balance on.\n        @return Number of available tokens the treasury holds for the account.\n    */\n    function currentBalance(address account) public view returns (uint)  {\n        return getCurrentBalance(account);\n    }\n\n    // INTERNAL\n    /** @dev Bonds tokens by passing the transaction value to the bonding functions of the KosuToken then provides the added balance to the provided account address.\n    */\n    function _bond(address account) internal returns (uint) {\n        uint initialBalance = kosuToken.balanceOf(address(this));\n        uint minted = kosuToken.bondTokens.value(msg.value)(0);\n        require(initialBalance + minted == kosuToken.balanceOf(address(this)), \"tokens not minted\");\n\n        setSystemBalance(account, getSystemBalance(account).add(minted));\n        setCurrentBalance(account, getCurrentBalance(account).add(minted));\n\n        return minted;\n    }\n\n    /** @dev Transfers tokens from the account address to the treasury.  Increases the available and total system balance by the added amount.\n    */\n    function _deposit(address account, uint amount) internal {\n        //Pulls token from the account and increases both internal ans system balances by the value.\n        require(kosuToken.transferFrom(account, address(this), amount));\n        setSystemBalance(account, getSystemBalance(account).add(amount));\n        setCurrentBalance(account, getCurrentBalance(account).add(amount));\n    }\n\n    /** @dev Transfers tokens held within the treasury to the provided account address and removes the amount from the accounts available and system balances.\n    */\n    function _withdraw(address account, uint amount) internal {\n        //Sends tokens to the account reduce the values of internal and system balances by the value.\n        require(getCurrentBalance(account) >= amount, \"insufficient tokens\");\n        require(kosuToken.transfer(account, amount));\n        setSystemBalance(account, getSystemBalance(account).sub(amount));\n        setCurrentBalance(account, getCurrentBalance(account).sub(amount));\n    }\n\n    /** @dev Removes expired locks.\n    */\n    function _removeInactiveTokenLocks(address account) internal {\n        for(uint i = addressTokenLocks[account].length; i > 0; i--) {\n            TokenLock storage v = addressTokenLocks[account][i - 1];\n            (bool finished, uint winningTokens) = voting.userWinningTokens(v.pollId, msg.sender);\n            if(v.pollId > 0 && finished && winningTokens == 0) {\n                v.tokenLockEnd = v.pollEarlyUnlock;\n            }\n            if(v.tokenLockEnd < block.number) {\n                if(i == addressTokenLocks[account].length) {\n                    delete addressTokenLocks[account][i - 1];\n                    addressTokenLocks[account].length = addressTokenLocks[account].length - 1;\n                } else {\n                    addressTokenLocks[account][i - 1] = addressTokenLocks[account][addressTokenLocks[account].length - 1];\n                    delete addressTokenLocks[account][addressTokenLocks[account].length - 1];\n                    addressTokenLocks[account].length = addressTokenLocks[account].length - 1;\n                }\n            }\n        }\n    }\n\n    /** @dev Calculates addresses total locked tokens\n    */\n    function _getLockedTokens(address account) internal returns (uint) {\n        //cleanup\n        _removeInactiveTokenLocks(account);\n        //Updates the systemBalance for the account\n        uint totalLocked;\n        uint maxVoteLock;\n        for(uint i = 0; i < addressTokenLocks[account].length; i++) {\n            TokenLock storage lock = addressTokenLocks[account][i];\n            if(lock.pollId == 0) {\n                totalLocked = totalLocked.add(addressTokenLocks[account][i].value);\n            } else {\n                if (lock.value > maxVoteLock) {\n                    maxVoteLock = lock.value;\n                }\n            }\n        }\n        return totalLocked + maxVoteLock;\n    }\n    /** @dev Reads the account addresses system balance.\n    */\n    function getSystemBalance(address account) internal view returns (uint) {\n        //Reports the systemBalance for the account\n        return systemBalances[account];\n    }\n\n    /** @dev Sets the accounts system balance.\n    */\n    function setSystemBalance(address account, uint amount) internal {\n        systemBalances[account] = amount;\n    }\n\n    /** @dev Reads the accounts current balance.\n    */\n    function getCurrentBalance(address account) internal view returns (uint) {\n        //Reports the held balance for the account\n        return currentBalances[account];\n    }\n\n    /** @dev Sets the accounts current balance.\n    */\n    function setCurrentBalance(address account, uint amount) internal {\n        //Updates the held balance for the account\n        currentBalances[account] = amount;\n    }\n}\n",
        "base/Authorizable.sol": "pragma solidity ^0.5.0;\n\nimport \"../access_control/AuthorizedAddresses.sol\";\n\n/** @title Authorizable\n    @author Freydal\n    @dev Implements a modifier to verify authorization with the AuthorizedAddresses contract\n*/\ncontract Authorizable {\n\n    // Contract storing system level permissions\n    AuthorizedAddresses authorizedAddress;\n\n    /** @dev Initializes contract with deployed AuthorizedAddresses contract.\n        @notice Initializes contract with deployed AuthorizedAddresses contract.\n        @param authorizedAddressesAddress Deployed AuthorizedAddresses address.\n    */\n    constructor(address authorizedAddressesAddress) public {\n        authorizedAddress = AuthorizedAddresses(authorizedAddressesAddress);\n    }\n\n    /** @dev Ensures msg.sender is authorized within the AuthorizedAddresses contract\n        @notice Ensures msg.sender is authorized within the AuthorizedAddresses contract\n    */\n    modifier isAuthorized() {\n        require(authorizedAddress.isAddressAuthorized(msg.sender), \"unauthorized\");\n        _;\n    }\n}\n",
        "access_control/AuthorizedAddresses.sol": "pragma solidity ^0.5.0;\n\nimport \"openzeppelin-solidity/contracts/ownership/Ownable.sol\";\n\n/** @title AuthorizedAddresses\n    @author Freydal\n    @dev Common registry of system contract addresses authorized to access internal methods.\n*/\ncontract AuthorizedAddresses is Ownable {\n\n    // Mapping storing address permissions\n    mapping(address => bool) private authorizedAddresses;\n\n    /** @dev Initializes contract with the creators permissions set to true.\n        @notice Initializes contract with the creators permissions set to true.\n    */\n    constructor() Ownable() public {\n        authorizedAddresses[owner()] = true;\n    }\n\n    /** @dev Authorizes the address by setting the mapping value to true.\n        @notice Authorizes the address by setting the mapping value to true.\n        @param a Address to authorize\n    */\n    function authorizeAddress(address a) public {\n        require(authorizedAddresses[msg.sender], \"unauthorized\");\n        authorizedAddresses[a] = true;\n    }\n\n    /** @dev Disables the address previous authorization by setting the mapping value to false.\n        @notice Disables the address previous authorization by setting the mapping value to false\n        @param a Address to unauthorize\n    */\n    function unauthorizeAddress(address a) public {\n        require(authorizedAddresses[msg.sender]);\n        authorizedAddresses[a] = false;\n    }\n\n    /** @dev Verify address authorization.\n        @notice Verify address authorization.\n        @param a Address to authorize.\n        @return Address authorization\n    */\n    function isAddressAuthorized(address a) public view returns (bool) {\n        return authorizedAddresses[a];\n    }\n}\n",
        "openzeppelin-solidity/contracts/ownership/Ownable.sol": "pragma solidity ^0.5.0;\n\n/**\n * @title Ownable\n * @dev The Ownable contract has an owner address, and provides basic authorization control\n * functions, this simplifies the implementation of \"user permissions\".\n */\ncontract Ownable {\n    address private _owner;\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev The Ownable constructor sets the original `owner` of the contract to the sender\n     * account.\n     */\n    constructor () internal {\n        _owner = msg.sender;\n        emit OwnershipTransferred(address(0), _owner);\n    }\n\n    /**\n     * @return the address of the owner.\n     */\n    function owner() public view returns (address) {\n        return _owner;\n    }\n\n    /**\n     * @dev Throws if called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        require(isOwner());\n        _;\n    }\n\n    /**\n     * @return true if `msg.sender` is the owner of the contract.\n     */\n    function isOwner() public view returns (bool) {\n        return msg.sender == _owner;\n    }\n\n    /**\n     * @dev Allows the current owner to relinquish control of the contract.\n     * @notice Renouncing to ownership will leave the contract without an owner.\n     * It will not be possible to call the functions with the `onlyOwner`\n     * modifier anymore.\n     */\n    function renounceOwnership() public onlyOwner {\n        emit OwnershipTransferred(_owner, address(0));\n        _owner = address(0);\n    }\n\n    /**\n     * @dev Allows the current owner to transfer control of the contract to a newOwner.\n     * @param newOwner The address to transfer ownership to.\n     */\n    function transferOwnership(address newOwner) public onlyOwner {\n        _transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev Transfers control of the contract to a newOwner.\n     * @param newOwner The address to transfer ownership to.\n     */\n    function _transferOwnership(address newOwner) internal {\n        require(newOwner != address(0));\n        emit OwnershipTransferred(_owner, newOwner);\n        _owner = newOwner;\n    }\n}\n",
        "lib/KosuToken.sol": "pragma solidity ^0.5.0;\n\nimport \"openzeppelin-solidity/contracts/token/ERC20/ERC20.sol\";\nimport \"../base/Authorizable.sol\";\nimport \"./Formula.sol\";\n\n/** @title KosuToken\n    @author Freydal\n    @dev KosuToken (KOSU) is an implementation of the ERC-20 interface and supporting bonding curve for mints and burns.\n*/\ncontract KosuToken is ERC20, Authorizable {\n\n    string public name = \"KOSU\";\n    string public symbol = \"KOSU\";\n    uint8 public decimals = 18;\n    uint private _weiPaid = 0;\n    uint32 constant private r = 290000; // ppm\n\n    /** @dev Initializes KosuToken with the authorizedAddresses shared permission contract to protect functions.\n        @notice Initializes KosuToken with the authorizedAddresses shared permission contract to protect functions.\n    */\n    constructor(address _auth) Authorizable(_auth) public {\n    }\n\n    /** @dev Fallback payable function to allow the contract address to directly accept ether to be forwarded to the bonding function.\n        @notice Fallback payable function to allow the contract address to directly accept ether to be forwarded to the bonding function.\n    */\n    function () external payable {\n        bondTokens(0);\n    }\n\n    /** @dev Receives ether as a backing currency to be used against the bonding curve to mint tokens.\n        @notice Receives ether as a backing currency to be used against the bonding curve to mint tokens.\n        @param minPayout The minimum number of tokens to mint otherwise the transaction is reverted. This should prevent a front runner modifying the output.\n    */\n    function bondTokens(uint minPayout) payable public returns (uint) {\n        if (msg.value == 0) return 0;\n\n        uint tokensToMint = calculateEtherToToken(msg.value);\n\n        require(tokensToMint >= minPayout, \"payout below requested minimum\");\n\n        _weiPaid = _weiPaid.add(msg.value);\n        _mint(msg.sender, tokensToMint);\n        return tokensToMint;\n    }\n\n    /** @dev Burns the input tokens and releases the calculated amount of ether backing the tokens destroyed.\n        @notice Burns the input tokens and releases the calculated amount of ether backing the tokens destroyed.\n        @param tokensToBurn The number of the users tokens to burn.\n    */\n    function releaseTokens(uint tokensToBurn) public {\n        if (tokensToBurn == 0) return;\n\n        uint etherToRelease = calculateTokenToEther(tokensToBurn);\n\n        _burn(msg.sender, tokensToBurn);\n        msg.sender.transfer(etherToRelease);\n        _weiPaid = _weiPaid.sub(etherToRelease);\n    }\n\n    /** @dev Estimates the number of tokens that would be minted with the input ether at the current ether and token balances.\n        @notice Estimates the number of tokens that would be minted with the input ether at the current ether and token balances.\n        @param input The amount of ether to contribute.\n        @return Number of tokens that would be minted.\n    */\n    function estimateEtherToToken(uint input) public view returns (uint) {\n        return calculateEtherToToken(input);\n    }\n\n    /** @dev Estimates the amount of ether to be released with the input number of tokens to burn.\n        @notice Estimates the amount of ether to be released with the input number of tokens to burn.\n        @param input The number of tokens to burn.\n        @return Amount of ether to release.\n    */\n    function estimateTokenToEther(uint input) public view returns (uint) {\n        return calculateTokenToEther(input);\n    }\n\n    /** @dev Voluntarily burn tokens.\n        @notice Voluntarily burn tokens.\n        @param amount Number of tokens to burn.\n    */\n    function burn(uint amount) public isAuthorized {\n        _burn(msg.sender, amount);\n    }\n\n    /** @dev Authorized addresses (mostly contract systems) may manually mint new tokens to desired addresses.\n        @notice Authorized addresses (mostly contract systems) may manually mint new tokens to desired addresses.\n        @param _address Address to mint tokens to.\n        @param amount Number of tokens to mint.\n    */\n    function mintTo(address _address, uint amount) public isAuthorized {\n        _mint(_address, amount);\n    }\n\n    /** @dev Uses a modified BancorFormula to calculate the number of tokens to mint for input ether value.\n    */\n    function calculateEtherToToken(uint etherValue) internal view returns (uint) {\n        if (_weiPaid == 0 && totalSupply() == 0) {\n            require(etherValue == (2 ether)/10, \"first transaction must be .2 ether\");\n            return 10000 ether;\n        } else {\n            return Formula.calculatePurchaseReturn(totalSupply(), _weiPaid, r, etherValue);\n        }\n    }\n\n    /** @dev Uses a modified BancorFormula to calculate the amount of ether to release for input token value.\n    */\n    function calculateTokenToEther(uint numberOfTokens) internal view returns (uint) {\n        return Formula.calculateSaleReturn(totalSupply(), _weiPaid, r, numberOfTokens);\n    }\n}\n",
        "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol": "pragma solidity ^0.5.0;\n\nimport \"./IERC20.sol\";\nimport \"../../math/SafeMath.sol\";\n\n/**\n * @title Standard ERC20 token\n *\n * @dev Implementation of the basic standard token.\n * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md\n * Originally based on code by FirstBlood:\n * https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol\n *\n * This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for\n * all accounts just by listening to said events. Note that this isn't required by the specification, and other\n * compliant implementations may not do it.\n */\ncontract ERC20 is IERC20 {\n    using SafeMath for uint256;\n\n    mapping (address => uint256) private _balances;\n\n    mapping (address => mapping (address => uint256)) private _allowed;\n\n    uint256 private _totalSupply;\n\n    /**\n    * @dev Total number of tokens in existence\n    */\n    function totalSupply() public view returns (uint256) {\n        return _totalSupply;\n    }\n\n    /**\n    * @dev Gets the balance of the specified address.\n    * @param owner The address to query the balance of.\n    * @return An uint256 representing the amount owned by the passed address.\n    */\n    function balanceOf(address owner) public view returns (uint256) {\n        return _balances[owner];\n    }\n\n    /**\n     * @dev Function to check the amount of tokens that an owner allowed to a spender.\n     * @param owner address The address which owns the funds.\n     * @param spender address The address which will spend the funds.\n     * @return A uint256 specifying the amount of tokens still available for the spender.\n     */\n    function allowance(address owner, address spender) public view returns (uint256) {\n        return _allowed[owner][spender];\n    }\n\n    /**\n    * @dev Transfer token for a specified address\n    * @param to The address to transfer to.\n    * @param value The amount to be transferred.\n    */\n    function transfer(address to, uint256 value) public returns (bool) {\n        _transfer(msg.sender, to, value);\n        return true;\n    }\n\n    /**\n     * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.\n     * Beware that changing an allowance with this method brings the risk that someone may use both the old\n     * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this\n     * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     * @param spender The address which will spend the funds.\n     * @param value The amount of tokens to be spent.\n     */\n    function approve(address spender, uint256 value) public returns (bool) {\n        require(spender != address(0));\n\n        _allowed[msg.sender][spender] = value;\n        emit Approval(msg.sender, spender, value);\n        return true;\n    }\n\n    /**\n     * @dev Transfer tokens from one address to another.\n     * Note that while this function emits an Approval event, this is not required as per the specification,\n     * and other compliant implementations may not emit the event.\n     * @param from address The address which you want to send tokens from\n     * @param to address The address which you want to transfer to\n     * @param value uint256 the amount of tokens to be transferred\n     */\n    function transferFrom(address from, address to, uint256 value) public returns (bool) {\n        _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);\n        _transfer(from, to, value);\n        emit Approval(from, msg.sender, _allowed[from][msg.sender]);\n        return true;\n    }\n\n    /**\n     * @dev Increase the amount of tokens that an owner allowed to a spender.\n     * approve should be called when allowed_[_spender] == 0. To increment\n     * allowed value is better to use this function to avoid 2 calls (and wait until\n     * the first transaction is mined)\n     * From MonolithDAO Token.sol\n     * Emits an Approval event.\n     * @param spender The address which will spend the funds.\n     * @param addedValue The amount of tokens to increase the allowance by.\n     */\n    function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {\n        require(spender != address(0));\n\n        _allowed[msg.sender][spender] = _allowed[msg.sender][spender].add(addedValue);\n        emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);\n        return true;\n    }\n\n    /**\n     * @dev Decrease the amount of tokens that an owner allowed to a spender.\n     * approve should be called when allowed_[_spender] == 0. To decrement\n     * allowed value is better to use this function to avoid 2 calls (and wait until\n     * the first transaction is mined)\n     * From MonolithDAO Token.sol\n     * Emits an Approval event.\n     * @param spender The address which will spend the funds.\n     * @param subtractedValue The amount of tokens to decrease the allowance by.\n     */\n    function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {\n        require(spender != address(0));\n\n        _allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub(subtractedValue);\n        emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);\n        return true;\n    }\n\n    /**\n    * @dev Transfer token for a specified addresses\n    * @param from The address to transfer from.\n    * @param to The address to transfer to.\n    * @param value The amount to be transferred.\n    */\n    function _transfer(address from, address to, uint256 value) internal {\n        require(to != address(0));\n\n        _balances[from] = _balances[from].sub(value);\n        _balances[to] = _balances[to].add(value);\n        emit Transfer(from, to, value);\n    }\n\n    /**\n     * @dev Internal function that mints an amount of the token and assigns it to\n     * an account. This encapsulates the modification of balances such that the\n     * proper events are emitted.\n     * @param account The account that will receive the created tokens.\n     * @param value The amount that will be created.\n     */\n    function _mint(address account, uint256 value) internal {\n        require(account != address(0));\n\n        _totalSupply = _totalSupply.add(value);\n        _balances[account] = _balances[account].add(value);\n        emit Transfer(address(0), account, value);\n    }\n\n    /**\n     * @dev Internal function that burns an amount of the token of a given\n     * account.\n     * @param account The account whose tokens will be burnt.\n     * @param value The amount that will be burnt.\n     */\n    function _burn(address account, uint256 value) internal {\n        require(account != address(0));\n\n        _totalSupply = _totalSupply.sub(value);\n        _balances[account] = _balances[account].sub(value);\n        emit Transfer(account, address(0), value);\n    }\n\n    /**\n     * @dev Internal function that burns an amount of the token of a given\n     * account, deducting from the sender's allowance for said account. Uses the\n     * internal burn function.\n     * Emits an Approval event (reflecting the reduced allowance).\n     * @param account The account whose tokens will be burnt.\n     * @param value The amount that will be burnt.\n     */\n    function _burnFrom(address account, uint256 value) internal {\n        _allowed[account][msg.sender] = _allowed[account][msg.sender].sub(value);\n        _burn(account, value);\n        emit Approval(account, msg.sender, _allowed[account][msg.sender]);\n    }\n}\n",
        "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol": "pragma solidity ^0.5.0;\n\n/**\n * @title ERC20 interface\n * @dev see https://github.com/ethereum/EIPs/issues/20\n */\ninterface IERC20 {\n    function transfer(address to, uint256 value) external returns (bool);\n\n    function approve(address spender, uint256 value) external returns (bool);\n\n    function transferFrom(address from, address to, uint256 value) external returns (bool);\n\n    function totalSupply() external view returns (uint256);\n\n    function balanceOf(address who) external view returns (uint256);\n\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n",
        "lib/Formula.sol": "pragma solidity ^0.5.0;\n\nimport \"openzeppelin-solidity/contracts/math/SafeMath.sol\";\n\n/** @title Formula (from BancorFormula)\n    @author Freydal converted to library from https://github.com/bancorprotocol/contracts/blob/master/solidity/contracts/converter/BancorFormula.sol\n*/\nlibrary Formula {\n    using SafeMath for uint256;\n\n    uint256 private constant ONE = 1;\n    uint32 private constant MAX_WEIGHT = 1000000;\n    uint8 private constant MIN_PRECISION = 32;\n    uint8 private constant MAX_PRECISION = 127;\n\n    /**\n        Auto-generated via 'PrintIntScalingFactors.py'\n    */\n    uint256 private constant FIXED_1 = 0x080000000000000000000000000000000;\n    uint256 private constant FIXED_2 = 0x100000000000000000000000000000000;\n    uint256 private constant MAX_NUM = 0x200000000000000000000000000000000;\n\n    /**\n        Auto-generated via 'PrintLn2ScalingFactors.py'\n    */\n    uint256 private constant LN2_NUMERATOR   = 0x3f80fe03f80fe03f80fe03f80fe03f8;\n    uint256 private constant LN2_DENOMINATOR = 0x5b9de1d10bf4103d647b0955897ba80;\n\n    /**\n        Auto-generated via 'PrintFunctionOptimalLog.py' and 'PrintFunctionOptimalExp.py'\n    */\n    uint256 private constant OPT_LOG_MAX_VAL = 0x15bf0a8b1457695355fb8ac404e7a79e3;\n    uint256 private constant OPT_EXP_MAX_VAL = 0x800000000000000000000000000000000;\n\n    /**\n        Auto-generated via 'PrintFunctionConstructor.py'\n    */\n\n    /**\n        @dev given a token supply, connector balance, weight and a deposit amount (in the connector token),\n        calculates the return for a given conversion (in the main token)\n\n        Formula:\n        Return = _supply * ((1 + _depositAmount / _connectorBalance) ^ (_connectorWeight / 1000000) - 1)\n\n        @param _supply              token total supply\n        @param _connectorBalance    total connector balance\n        @param _connectorWeight     connector weight, represented in ppm, 1-1000000\n        @param _depositAmount       deposit amount, in connector token\n\n        @return purchase return amount\n    */\n    function calculatePurchaseReturn(uint256 _supply, uint256 _connectorBalance, uint32 _connectorWeight, uint256 _depositAmount) internal view returns (uint256) {\n        // validate input\n        require(_supply > 0 && _connectorBalance > 0 && _connectorWeight > 0 && _connectorWeight <= MAX_WEIGHT);\n\n        // special case for 0 deposit amount\n        if (_depositAmount == 0)\n            return 0;\n\n        // special case if the weight = 100%\n        if (_connectorWeight == MAX_WEIGHT)\n            return _supply.mul(_depositAmount) / _connectorBalance;\n\n        uint256 result;\n        uint8 precision;\n        uint256 baseN = _depositAmount.add(_connectorBalance);\n        (result, precision) = power(baseN, _connectorBalance, _connectorWeight, MAX_WEIGHT);\n        uint256 temp = _supply.mul(result) >> precision;\n        return temp - _supply;\n    }\n\n    /**\n        @dev given a token supply, connector balance, weight and a sell amount (in the main token),\n        calculates the return for a given conversion (in the connector token)\n\n        Formula:\n        Return = _connectorBalance * (1 - (1 - _sellAmount / _supply) ^ (1 / (_connectorWeight / 1000000)))\n\n        @param _supply              token total supply\n        @param _connectorBalance    total connector\n        @param _connectorWeight     constant connector Weight, represented in ppm, 1-1000000\n        @param _sellAmount          sell amount, in the token itself\n\n        @return sale return amount\n    */\n    function calculateSaleReturn(uint256 _supply, uint256 _connectorBalance, uint32 _connectorWeight, uint256 _sellAmount) internal view returns (uint256) {\n        // validate input\n        require(_supply > 0 && _connectorBalance > 0 && _connectorWeight > 0 && _connectorWeight <= MAX_WEIGHT && _sellAmount <= _supply);\n\n        // special case for 0 sell amount\n        if (_sellAmount == 0)\n            return 0;\n\n        // special case for selling the entire supply\n        if (_sellAmount == _supply)\n            return _connectorBalance;\n\n        // special case if the weight = 100%\n        if (_connectorWeight == MAX_WEIGHT)\n            return _connectorBalance.mul(_sellAmount) / _supply;\n\n        uint256 result;\n        uint8 precision;\n        uint256 baseD = _supply - _sellAmount;\n        (result, precision) = power(_supply, baseD, MAX_WEIGHT, _connectorWeight);\n        uint256 temp1 = _connectorBalance.mul(result);\n        uint256 temp2 = _connectorBalance << precision;\n        return (temp1 - temp2) / result;\n    }\n\n    /**\n        @dev given two connector balances/weights and a sell amount (in the first connector token),\n        calculates the return for a conversion from the first connector token to the second connector token (in the second connector token)\n\n        Formula:\n        Return = _toConnectorBalance * (1 - (_fromConnectorBalance / (_fromConnectorBalance + _amount)) ^ (_fromConnectorWeight / _toConnectorWeight))\n\n        @param _fromConnectorBalance    input connector balance\n        @param _fromConnectorWeight     input connector weight, represented in ppm, 1-1000000\n        @param _toConnectorBalance      output connector balance\n        @param _toConnectorWeight       output connector weight, represented in ppm, 1-1000000\n        @param _amount                  input connector amount\n\n        @return second connector amount\n    */\n    function calculateCrossConnectorReturn(uint256 _fromConnectorBalance, uint32 _fromConnectorWeight, uint256 _toConnectorBalance, uint32 _toConnectorWeight, uint256 _amount) internal view returns (uint256) {\n        // validate input\n        require(_fromConnectorBalance > 0 && _fromConnectorWeight > 0 && _fromConnectorWeight <= MAX_WEIGHT && _toConnectorBalance > 0 && _toConnectorWeight > 0 && _toConnectorWeight <= MAX_WEIGHT);\n\n        // special case for equal weights\n        if (_fromConnectorWeight == _toConnectorWeight)\n            return _toConnectorBalance.mul(_amount) / _fromConnectorBalance.add(_amount);\n\n        uint256 result;\n        uint8 precision;\n        uint256 baseN = _fromConnectorBalance.add(_amount);\n        (result, precision) = power(baseN, _fromConnectorBalance, _fromConnectorWeight, _toConnectorWeight);\n        uint256 temp1 = _toConnectorBalance.mul(result);\n        uint256 temp2 = _toConnectorBalance << precision;\n        return (temp1 - temp2) / result;\n    }\n\n    /**\n        General Description:\n            Determine a value of precision.\n            Calculate an integer approximation of (_baseN / _baseD) ^ (_expN / _expD) * 2 ^ precision.\n            Return the result along with the precision used.\n\n        Detailed Description:\n            Instead of calculating \"base ^ exp\", we calculate \"e ^ (log(base) * exp)\".\n            The value of \"log(base)\" is represented with an integer slightly smaller than \"log(base) * 2 ^ precision\".\n            The larger \"precision\" is, the more accurately this value represents the real value.\n            However, the larger \"precision\" is, the more bits are required in order to store this value.\n            And the exponentiation function, which takes \"x\" and calculates \"e ^ x\", is limited to a maximum exponent (maximum value of \"x\").\n            This maximum exponent depends on the \"precision\" used, and it is given by \"maxExpArray[precision] >> (MAX_PRECISION - precision)\".\n            Hence we need to determine the highest precision which can be used for the given input, before calling the exponentiation function.\n            This allows us to compute \"base ^ exp\" with maximum accuracy and without exceeding 256 bits in any of the intermediate computations.\n            This functions assumes that \"_expN < 2 ^ 256 / log(MAX_NUM - 1)\", otherwise the multiplication should be replaced with a \"safeMul\".\n    */\n    function power(uint256 _baseN, uint256 _baseD, uint32 _expN, uint32 _expD) internal view returns (uint256, uint8) {\n        require(_baseN < MAX_NUM);\n\n        uint256 baseLog;\n        uint256 base = _baseN * FIXED_1 / _baseD;\n        if (base < OPT_LOG_MAX_VAL) {\n            baseLog = optimalLog(base);\n        }\n        else {\n            baseLog = generalLog(base);\n        }\n\n        uint256 baseLogTimesExp = baseLog * _expN / _expD;\n        if (baseLogTimesExp < OPT_EXP_MAX_VAL) {\n            return (optimalExp(baseLogTimesExp), MAX_PRECISION);\n        }\n        else {\n            uint8 precision = findPositionInMaxExpArray(baseLogTimesExp);\n            return (generalExp(baseLogTimesExp >> (MAX_PRECISION - precision), precision), precision);\n        }\n    }\n\n    /**\n        Compute log(x / FIXED_1) * FIXED_1.\n        This functions assumes that \"x >= FIXED_1\", because the output would be negative otherwise.\n    */\n    function generalLog(uint256 x) internal pure returns (uint256) {\n        uint256 res = 0;\n\n        // If x >= 2, then we compute the integer part of log2(x), which is larger than 0.\n        if (x >= FIXED_2) {\n            uint8 count = floorLog2(x / FIXED_1);\n            x >>= count; // now x < 2\n            res = count * FIXED_1;\n        }\n\n        // If x > 1, then we compute the fraction part of log2(x), which is larger than 0.\n        if (x > FIXED_1) {\n            for (uint8 i = MAX_PRECISION; i > 0; --i) {\n                x = (x * x) / FIXED_1; // now 1 < x < 4\n                if (x >= FIXED_2) {\n                    x >>= 1; // now 1 < x < 2\n                    res += ONE << (i - 1);\n                }\n            }\n        }\n\n        return res * LN2_NUMERATOR / LN2_DENOMINATOR;\n    }\n\n    /**\n        Compute the largest integer smaller than or equal to the binary logarithm of the input.\n    */\n    function floorLog2(uint256 _n) internal pure returns (uint8) {\n        uint8 res = 0;\n\n        if (_n < 256) {\n            // At most 8 iterations\n            while (_n > 1) {\n                _n >>= 1;\n                res += 1;\n            }\n        }\n        else {\n            // Exactly 8 iterations\n            for (uint8 s = 128; s > 0; s >>= 1) {\n                if (_n >= (ONE << s)) {\n                    _n >>= s;\n                    res |= s;\n                }\n            }\n        }\n\n        return res;\n    }\n\n    /**\n        The global \"maxExpArray\" is sorted in descending order, and therefore the following statements are equivalent:\n        - This function finds the position of [the smallest value in \"maxExpArray\" larger than or equal to \"x\"]\n        - This function finds the highest position of [a value in \"maxExpArray\" larger than or equal to \"x\"]\n    */\n    function findPositionInMaxExpArray(uint256 _x) internal view returns (uint8) {\n        uint256[128] memory maxExpArray = [uint256(0x6bffffffffffffffffffffffffffffffff), uint256(0x67ffffffffffffffffffffffffffffffff), uint256(0x637fffffffffffffffffffffffffffffff), uint256(0x5f6fffffffffffffffffffffffffffffff), uint256(0x5b77ffffffffffffffffffffffffffffff), uint256(0x57b3ffffffffffffffffffffffffffffff), uint256(0x5419ffffffffffffffffffffffffffffff), uint256(0x50a2ffffffffffffffffffffffffffffff), uint256(0x4d517fffffffffffffffffffffffffffff), uint256(0x4a233fffffffffffffffffffffffffffff), uint256(0x47165fffffffffffffffffffffffffffff), uint256(0x4429afffffffffffffffffffffffffffff), uint256(0x415bc7ffffffffffffffffffffffffffff), uint256(0x3eab73ffffffffffffffffffffffffffff), uint256(0x3c1771ffffffffffffffffffffffffffff), uint256(0x399e96ffffffffffffffffffffffffffff), uint256(0x373fc47fffffffffffffffffffffffffff), uint256(0x34f9e8ffffffffffffffffffffffffffff), uint256(0x32cbfd5fffffffffffffffffffffffffff), uint256(0x30b5057fffffffffffffffffffffffffff), uint256(0x2eb40f9fffffffffffffffffffffffffff), uint256(0x2cc8340fffffffffffffffffffffffffff), uint256(0x2af09481ffffffffffffffffffffffffff), uint256(0x292c5bddffffffffffffffffffffffffff), uint256(0x277abdcdffffffffffffffffffffffffff), uint256(0x25daf6657fffffffffffffffffffffffff), uint256(0x244c49c65fffffffffffffffffffffffff), uint256(0x22ce03cd5fffffffffffffffffffffffff), uint256(0x215f77c047ffffffffffffffffffffffff), uint256(0x1fffffffffffffffffffffffffffffffff), uint256(0x1eaefdbdabffffffffffffffffffffffff), uint256(0x1d6bd8b2ebffffffffffffffffffffffff), uint256(0x1c35fedd14ffffffffffffffffffffffff), uint256(0x1b0ce43b323fffffffffffffffffffffff), uint256(0x19f0028ec1ffffffffffffffffffffffff), uint256(0x18ded91f0e7fffffffffffffffffffffff), uint256(0x17d8ec7f0417ffffffffffffffffffffff), uint256(0x16ddc6556cdbffffffffffffffffffffff), uint256(0x15ecf52776a1ffffffffffffffffffffff), uint256(0x15060c256cb2ffffffffffffffffffffff), uint256(0x1428a2f98d72ffffffffffffffffffffff), uint256(0x13545598e5c23fffffffffffffffffffff), uint256(0x1288c4161ce1dfffffffffffffffffffff), uint256(0x11c592761c666fffffffffffffffffffff), uint256(0x110a688680a757ffffffffffffffffffff), uint256(0x1056f1b5bedf77ffffffffffffffffffff), uint256(0x0faadceceeff8bffffffffffffffffffff), uint256(0x0f05dc6b27edadffffffffffffffffffff), uint256(0x0e67a5a25da4107fffffffffffffffffff), uint256(0x0dcff115b14eedffffffffffffffffffff), uint256(0x0d3e7a392431239fffffffffffffffffff), uint256(0x0cb2ff529eb71e4fffffffffffffffffff), uint256(0x0c2d415c3db974afffffffffffffffffff), uint256(0x0bad03e7d883f69bffffffffffffffffff), uint256(0x0b320d03b2c343d5ffffffffffffffffff), uint256(0x0abc25204e02828dffffffffffffffffff), uint256(0x0a4b16f74ee4bb207fffffffffffffffff), uint256(0x09deaf736ac1f569ffffffffffffffffff), uint256(0x0976bd9952c7aa957fffffffffffffffff), uint256(0x09131271922eaa606fffffffffffffffff), uint256(0x08b380f3558668c46fffffffffffffffff), uint256(0x0857ddf0117efa215bffffffffffffffff), uint256(0x07ffffffffffffffffffffffffffffffff), uint256(0x07abbf6f6abb9d087fffffffffffffffff), uint256(0x075af62cbac95f7dfa7fffffffffffffff), uint256(0x070d7fb7452e187ac13fffffffffffffff), uint256(0x06c3390ecc8af379295fffffffffffffff), uint256(0x067c00a3b07ffc01fd6fffffffffffffff), uint256(0x0637b647c39cbb9d3d27ffffffffffffff), uint256(0x05f63b1fc104dbd39587ffffffffffffff), uint256(0x05b771955b36e12f7235ffffffffffffff), uint256(0x057b3d49dda84556d6f6ffffffffffffff), uint256(0x054183095b2c8ececf30ffffffffffffff), uint256(0x050a28be635ca2b888f77fffffffffffff), uint256(0x04d5156639708c9db33c3fffffffffffff), uint256(0x04a23105873875bd52dfdfffffffffffff), uint256(0x0471649d87199aa990756fffffffffffff), uint256(0x04429a21a029d4c1457cfbffffffffffff), uint256(0x0415bc6d6fb7dd71af2cb3ffffffffffff), uint256(0x03eab73b3bbfe282243ce1ffffffffffff), uint256(0x03c1771ac9fb6b4c18e229ffffffffffff), uint256(0x0399e96897690418f785257fffffffffff), uint256(0x0373fc456c53bb779bf0ea9fffffffffff), uint256(0x034f9e8e490c48e67e6ab8bfffffffffff), uint256(0x032cbfd4a7adc790560b3337ffffffffff), uint256(0x030b50570f6e5d2acca94613ffffffffff), uint256(0x02eb40f9f620fda6b56c2861ffffffffff), uint256(0x02cc8340ecb0d0f520a6af58ffffffffff), uint256(0x02af09481380a0a35cf1ba02ffffffffff), uint256(0x0292c5bdd3b92ec810287b1b3fffffffff), uint256(0x0277abdcdab07d5a77ac6d6b9fffffffff), uint256(0x025daf6654b1eaa55fd64df5efffffffff), uint256(0x0244c49c648baa98192dce88b7ffffffff), uint256(0x022ce03cd5619a311b2471268bffffffff), uint256(0x0215f77c045fbe885654a44a0fffffffff), uint256(0x01ffffffffffffffffffffffffffffffff), uint256(0x01eaefdbdaaee7421fc4d3ede5ffffffff), uint256(0x01d6bd8b2eb257df7e8ca57b09bfffffff), uint256(0x01c35fedd14b861eb0443f7f133fffffff), uint256(0x01b0ce43b322bcde4a56e8ada5afffffff), uint256(0x019f0028ec1fff007f5a195a39dfffffff), uint256(0x018ded91f0e72ee74f49b15ba527ffffff), uint256(0x017d8ec7f04136f4e5615fd41a63ffffff), uint256(0x016ddc6556cdb84bdc8d12d22e6fffffff), uint256(0x015ecf52776a1155b5bd8395814f7fffff), uint256(0x015060c256cb23b3b3cc3754cf40ffffff), uint256(0x01428a2f98d728ae223ddab715be3fffff), uint256(0x013545598e5c23276ccf0ede68034fffff), uint256(0x01288c4161ce1d6f54b7f61081194fffff), uint256(0x011c592761c666aa641d5a01a40f17ffff), uint256(0x0110a688680a7530515f3e6e6cfdcdffff), uint256(0x01056f1b5bedf75c6bcb2ce8aed428ffff), uint256(0x00faadceceeff8a0890f3875f008277fff), uint256(0x00f05dc6b27edad306388a600f6ba0bfff), uint256(0x00e67a5a25da41063de1495d5b18cdbfff), uint256(0x00dcff115b14eedde6fc3aa5353f2e4fff), uint256(0x00d3e7a3924312399f9aae2e0f868f8fff), uint256(0x00cb2ff529eb71e41582cccd5a1ee26fff), uint256(0x00c2d415c3db974ab32a51840c0b67edff), uint256(0x00bad03e7d883f69ad5b0a186184e06bff), uint256(0x00b320d03b2c343d4829abd6075f0cc5ff), uint256(0x00abc25204e02828d73c6e80bcdb1a95bf), uint256(0x00a4b16f74ee4bb2040a1ec6c15fbbf2df), uint256(0x009deaf736ac1f569deb1b5ae3f36c130f), uint256(0x00976bd9952c7aa957f5937d790ef65037), uint256(0x009131271922eaa6064b73a22d0bd4f2bf), uint256(0x008b380f3558668c46c91c49a2f8e967b9), uint256(0x00857ddf0117efa215952912839f6473e6)];\n\n        uint8 lo = MIN_PRECISION;\n        uint8 hi = MAX_PRECISION;\n\n        while (lo + 1 < hi) {\n            uint8 mid = (lo + hi) / 2;\n            if (maxExpArray[mid] >= _x)\n                lo = mid;\n            else\n                hi = mid;\n        }\n\n        if (maxExpArray[hi] >= _x)\n            return hi;\n        if (maxExpArray[lo] >= _x)\n            return lo;\n\n        require(false);\n        return 0;\n    }\n\n    /**\n        This function can be auto-generated by the script 'PrintFunctionGeneralExp.py'.\n        It approximates \"e ^ x\" via maclaurin summation: \"(x^0)/0! + (x^1)/1! + ... + (x^n)/n!\".\n        It returns \"e ^ (x / 2 ^ precision) * 2 ^ precision\", that is, the result is upshifted for accuracy.\n        The global \"maxExpArray\" maps each \"precision\" to \"((maximumExponent + 1) << (MAX_PRECISION - precision)) - 1\".\n        The maximum permitted value for \"x\" is therefore given by \"maxExpArray[precision] >> (MAX_PRECISION - precision)\".\n    */\n    function generalExp(uint256 _x, uint8 _precision) internal pure returns (uint256) {\n        uint256 xi = _x;\n        uint256 res = 0;\n\n        xi = (xi * _x) >> _precision; res += xi * 0x3442c4e6074a82f1797f72ac0000000; // add x^02 * (33! / 02!)\n        xi = (xi * _x) >> _precision; res += xi * 0x116b96f757c380fb287fd0e40000000; // add x^03 * (33! / 03!)\n        xi = (xi * _x) >> _precision; res += xi * 0x045ae5bdd5f0e03eca1ff4390000000; // add x^04 * (33! / 04!)\n        xi = (xi * _x) >> _precision; res += xi * 0x00defabf91302cd95b9ffda50000000; // add x^05 * (33! / 05!)\n        xi = (xi * _x) >> _precision; res += xi * 0x002529ca9832b22439efff9b8000000; // add x^06 * (33! / 06!)\n        xi = (xi * _x) >> _precision; res += xi * 0x00054f1cf12bd04e516b6da88000000; // add x^07 * (33! / 07!)\n        xi = (xi * _x) >> _precision; res += xi * 0x0000a9e39e257a09ca2d6db51000000; // add x^08 * (33! / 08!)\n        xi = (xi * _x) >> _precision; res += xi * 0x000012e066e7b839fa050c309000000; // add x^09 * (33! / 09!)\n        xi = (xi * _x) >> _precision; res += xi * 0x000001e33d7d926c329a1ad1a800000; // add x^10 * (33! / 10!)\n        xi = (xi * _x) >> _precision; res += xi * 0x0000002bee513bdb4a6b19b5f800000; // add x^11 * (33! / 11!)\n        xi = (xi * _x) >> _precision; res += xi * 0x00000003a9316fa79b88eccf2a00000; // add x^12 * (33! / 12!)\n        xi = (xi * _x) >> _precision; res += xi * 0x0000000048177ebe1fa812375200000; // add x^13 * (33! / 13!)\n        xi = (xi * _x) >> _precision; res += xi * 0x0000000005263fe90242dcbacf00000; // add x^14 * (33! / 14!)\n        xi = (xi * _x) >> _precision; res += xi * 0x000000000057e22099c030d94100000; // add x^15 * (33! / 15!)\n        xi = (xi * _x) >> _precision; res += xi * 0x0000000000057e22099c030d9410000; // add x^16 * (33! / 16!)\n        xi = (xi * _x) >> _precision; res += xi * 0x00000000000052b6b54569976310000; // add x^17 * (33! / 17!)\n        xi = (xi * _x) >> _precision; res += xi * 0x00000000000004985f67696bf748000; // add x^18 * (33! / 18!)\n        xi = (xi * _x) >> _precision; res += xi * 0x000000000000003dea12ea99e498000; // add x^19 * (33! / 19!)\n        xi = (xi * _x) >> _precision; res += xi * 0x00000000000000031880f2214b6e000; // add x^20 * (33! / 20!)\n        xi = (xi * _x) >> _precision; res += xi * 0x000000000000000025bcff56eb36000; // add x^21 * (33! / 21!)\n        xi = (xi * _x) >> _precision; res += xi * 0x000000000000000001b722e10ab1000; // add x^22 * (33! / 22!)\n        xi = (xi * _x) >> _precision; res += xi * 0x0000000000000000001317c70077000; // add x^23 * (33! / 23!)\n        xi = (xi * _x) >> _precision; res += xi * 0x00000000000000000000cba84aafa00; // add x^24 * (33! / 24!)\n        xi = (xi * _x) >> _precision; res += xi * 0x00000000000000000000082573a0a00; // add x^25 * (33! / 25!)\n        xi = (xi * _x) >> _precision; res += xi * 0x00000000000000000000005035ad900; // add x^26 * (33! / 26!)\n        xi = (xi * _x) >> _precision; res += xi * 0x000000000000000000000002f881b00; // add x^27 * (33! / 27!)\n        xi = (xi * _x) >> _precision; res += xi * 0x0000000000000000000000001b29340; // add x^28 * (33! / 28!)\n        xi = (xi * _x) >> _precision; res += xi * 0x00000000000000000000000000efc40; // add x^29 * (33! / 29!)\n        xi = (xi * _x) >> _precision; res += xi * 0x0000000000000000000000000007fe0; // add x^30 * (33! / 30!)\n        xi = (xi * _x) >> _precision; res += xi * 0x0000000000000000000000000000420; // add x^31 * (33! / 31!)\n        xi = (xi * _x) >> _precision; res += xi * 0x0000000000000000000000000000021; // add x^32 * (33! / 32!)\n        xi = (xi * _x) >> _precision; res += xi * 0x0000000000000000000000000000001; // add x^33 * (33! / 33!)\n\n        return res / 0x688589cc0e9505e2f2fee5580000000 + _x + (ONE << _precision); // divide by 33! and then add x^1 / 1! + x^0 / 0!\n    }\n\n    /**\n        Return log(x / FIXED_1) * FIXED_1\n        Input range: FIXED_1 <= x <= LOG_EXP_MAX_VAL - 1\n        Auto-generated via 'PrintFunctionOptimalLog.py'\n        Detailed description:\n        - Rewrite the input as a product of natural exponents and a single residual r, such that 1 < r < 2\n        - The natural logarithm of each (pre-calculated) exponent is the degree of the exponent\n        - The natural logarithm of r is calculated via Taylor series for log(1 + x), where x = r - 1\n        - The natural logarithm of the input is calculated by summing up the intermediate results above\n        - For example: log(250) = log(e^4 * e^1 * e^0.5 * 1.021692859) = 4 + 1 + 0.5 + log(1 + 0.021692859)\n    */\n    function optimalLog(uint256 x) internal pure returns (uint256) {\n        uint256 res = 0;\n\n        uint256 y;\n        uint256 z;\n        uint256 w;\n\n        if (x >= 0xd3094c70f034de4b96ff7d5b6f99fcd8) {res += 0x40000000000000000000000000000000; x = x * FIXED_1 / 0xd3094c70f034de4b96ff7d5b6f99fcd8;} // add 1 / 2^1\n        if (x >= 0xa45af1e1f40c333b3de1db4dd55f29a7) {res += 0x20000000000000000000000000000000; x = x * FIXED_1 / 0xa45af1e1f40c333b3de1db4dd55f29a7;} // add 1 / 2^2\n        if (x >= 0x910b022db7ae67ce76b441c27035c6a1) {res += 0x10000000000000000000000000000000; x = x * FIXED_1 / 0x910b022db7ae67ce76b441c27035c6a1;} // add 1 / 2^3\n        if (x >= 0x88415abbe9a76bead8d00cf112e4d4a8) {res += 0x08000000000000000000000000000000; x = x * FIXED_1 / 0x88415abbe9a76bead8d00cf112e4d4a8;} // add 1 / 2^4\n        if (x >= 0x84102b00893f64c705e841d5d4064bd3) {res += 0x04000000000000000000000000000000; x = x * FIXED_1 / 0x84102b00893f64c705e841d5d4064bd3;} // add 1 / 2^5\n        if (x >= 0x8204055aaef1c8bd5c3259f4822735a2) {res += 0x02000000000000000000000000000000; x = x * FIXED_1 / 0x8204055aaef1c8bd5c3259f4822735a2;} // add 1 / 2^6\n        if (x >= 0x810100ab00222d861931c15e39b44e99) {res += 0x01000000000000000000000000000000; x = x * FIXED_1 / 0x810100ab00222d861931c15e39b44e99;} // add 1 / 2^7\n        if (x >= 0x808040155aabbbe9451521693554f733) {res += 0x00800000000000000000000000000000; x = x * FIXED_1 / 0x808040155aabbbe9451521693554f733;} // add 1 / 2^8\n\n        z = y = x - FIXED_1;\n        w = y * y / FIXED_1;\n        res += z * (0x100000000000000000000000000000000 - y) / 0x100000000000000000000000000000000; z = z * w / FIXED_1; // add y^01 / 01 - y^02 / 02\n        res += z * (0x0aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - y) / 0x200000000000000000000000000000000; z = z * w / FIXED_1; // add y^03 / 03 - y^04 / 04\n        res += z * (0x099999999999999999999999999999999 - y) / 0x300000000000000000000000000000000; z = z * w / FIXED_1; // add y^05 / 05 - y^06 / 06\n        res += z * (0x092492492492492492492492492492492 - y) / 0x400000000000000000000000000000000; z = z * w / FIXED_1; // add y^07 / 07 - y^08 / 08\n        res += z * (0x08e38e38e38e38e38e38e38e38e38e38e - y) / 0x500000000000000000000000000000000; z = z * w / FIXED_1; // add y^09 / 09 - y^10 / 10\n        res += z * (0x08ba2e8ba2e8ba2e8ba2e8ba2e8ba2e8b - y) / 0x600000000000000000000000000000000; z = z * w / FIXED_1; // add y^11 / 11 - y^12 / 12\n        res += z * (0x089d89d89d89d89d89d89d89d89d89d89 - y) / 0x700000000000000000000000000000000; z = z * w / FIXED_1; // add y^13 / 13 - y^14 / 14\n        res += z * (0x088888888888888888888888888888888 - y) / 0x800000000000000000000000000000000;                      // add y^15 / 15 - y^16 / 16\n\n        return res;\n    }\n\n    /**\n        Return e ^ (x / FIXED_1) * FIXED_1\n        Input range: 0 <= x <= OPT_EXP_MAX_VAL - 1\n        Auto-generated via 'PrintFunctionOptimalExp.py'\n        Detailed description:\n        - Rewrite the input as a sum of binary exponents and a single residual r, as small as possible\n        - The exponentiation of each binary exponent is given (pre-calculated)\n        - The exponentiation of r is calculated via Taylor series for e^x, where x = r\n        - The exponentiation of the input is calculated by multiplying the intermediate results above\n        - For example: e^5.521692859 = e^(4 + 1 + 0.5 + 0.021692859) = e^4 * e^1 * e^0.5 * e^0.021692859\n    */\n    function optimalExp(uint256 x) internal pure returns (uint256) {\n        uint256 res = 0;\n\n        uint256 y;\n        uint256 z;\n\n        z = y = x % 0x10000000000000000000000000000000; // get the input modulo 2^(-3)\n        z = z * y / FIXED_1; res += z * 0x10e1b3be415a0000; // add y^02 * (20! / 02!)\n        z = z * y / FIXED_1; res += z * 0x05a0913f6b1e0000; // add y^03 * (20! / 03!)\n        z = z * y / FIXED_1; res += z * 0x0168244fdac78000; // add y^04 * (20! / 04!)\n        z = z * y / FIXED_1; res += z * 0x004807432bc18000; // add y^05 * (20! / 05!)\n        z = z * y / FIXED_1; res += z * 0x000c0135dca04000; // add y^06 * (20! / 06!)\n        z = z * y / FIXED_1; res += z * 0x0001b707b1cdc000; // add y^07 * (20! / 07!)\n        z = z * y / FIXED_1; res += z * 0x000036e0f639b800; // add y^08 * (20! / 08!)\n        z = z * y / FIXED_1; res += z * 0x00000618fee9f800; // add y^09 * (20! / 09!)\n        z = z * y / FIXED_1; res += z * 0x0000009c197dcc00; // add y^10 * (20! / 10!)\n        z = z * y / FIXED_1; res += z * 0x0000000e30dce400; // add y^11 * (20! / 11!)\n        z = z * y / FIXED_1; res += z * 0x000000012ebd1300; // add y^12 * (20! / 12!)\n        z = z * y / FIXED_1; res += z * 0x0000000017499f00; // add y^13 * (20! / 13!)\n        z = z * y / FIXED_1; res += z * 0x0000000001a9d480; // add y^14 * (20! / 14!)\n        z = z * y / FIXED_1; res += z * 0x00000000001c6380; // add y^15 * (20! / 15!)\n        z = z * y / FIXED_1; res += z * 0x000000000001c638; // add y^16 * (20! / 16!)\n        z = z * y / FIXED_1; res += z * 0x0000000000001ab8; // add y^17 * (20! / 17!)\n        z = z * y / FIXED_1; res += z * 0x000000000000017c; // add y^18 * (20! / 18!)\n        z = z * y / FIXED_1; res += z * 0x0000000000000014; // add y^19 * (20! / 19!)\n        z = z * y / FIXED_1; res += z * 0x0000000000000001; // add y^20 * (20! / 20!)\n        res = res / 0x21c3677c82b40000 + y + FIXED_1; // divide by 20! and then add y^1 / 1! + y^0 / 0!\n\n        if ((x & 0x010000000000000000000000000000000) != 0) res = res * 0x1c3d6a24ed82218787d624d3e5eba95f9 / 0x18ebef9eac820ae8682b9793ac6d1e776; // multiply by e^2^(-3)\n        if ((x & 0x020000000000000000000000000000000) != 0) res = res * 0x18ebef9eac820ae8682b9793ac6d1e778 / 0x1368b2fc6f9609fe7aceb46aa619baed4; // multiply by e^2^(-2)\n        if ((x & 0x040000000000000000000000000000000) != 0) res = res * 0x1368b2fc6f9609fe7aceb46aa619baed5 / 0x0bc5ab1b16779be3575bd8f0520a9f21f; // multiply by e^2^(-1)\n        if ((x & 0x080000000000000000000000000000000) != 0) res = res * 0x0bc5ab1b16779be3575bd8f0520a9f21e / 0x0454aaa8efe072e7f6ddbab84b40a55c9; // multiply by e^2^(+0)\n        if ((x & 0x100000000000000000000000000000000) != 0) res = res * 0x0454aaa8efe072e7f6ddbab84b40a55c5 / 0x00960aadc109e7a3bf4578099615711ea; // multiply by e^2^(+1)\n        if ((x & 0x200000000000000000000000000000000) != 0) res = res * 0x00960aadc109e7a3bf4578099615711d7 / 0x0002bf84208204f5977f9a8cf01fdce3d; // multiply by e^2^(+2)\n        if ((x & 0x400000000000000000000000000000000) != 0) res = res * 0x0002bf84208204f5977f9a8cf01fdc307 / 0x0000003c6ab775dd0b95b4cbee7e65d11; // multiply by e^2^(+3)\n\n        return res;\n    }\n}\n",
        "voting/IVoting.sol": "interface IVoting {\n    function userWinningTokens(uint, address) external view returns (bool, uint);\n}",
        "event/EventEmitter.sol": "pragma solidity ^0.5.0;\n\nimport \"../base/Authorizable.sol\";\n\n/** @title EventEmitter\n    @author Freydal\n    @dev A central event emitting contract supporting the Kosu contract system.\n*/\ncontract EventEmitter is Authorizable {\n\n    // Generic Kosu Event\n    event KosuEvent(string eventType, bytes32[] data, string stringData);\n\n    /** @dev Event emitter instantiated with Authorizable.\n        @notice Event emitter instantiated with Authorizable.\n        @param auth AuthorizedAddresses deployed address.\n    */\n    constructor(address auth) Authorizable(auth) public {\n    }\n\n    /** @dev Emits a standard event from the Kosu contract system.  The events can be decoded though the Kosu.js library.\n        @notice Emits a standard event from the Kosu contract system.  The events can be decoded though the Kosu.js library.\n        @param eventType String name/type of event.\n        @param data Bytes32 encoded data to be emitted.\n        @param stringData String containing optional additional information.\n    */\n    function emitEvent(string calldata eventType, bytes32[] calldata data, string calldata stringData) external isAuthorized {\n        emit KosuEvent(eventType, data, stringData);\n    }\n}\n\n\n\n"
    },
    "sourceTreeHashHex": "0x1661d4a4d7756c29dafd87151c1ac67ddd0fb5957ebd322813e9e0df4731acca",
    "compiler": {
        "name": "solc",
        "version": "soljson-v0.5.11+commit.c082d0b4.js",
        "settings": {
            "optimizer": {
                "enabled": true,
                "runs": 200,
                "details": {
                    "yul": true,
                    "deduplicate": true,
                    "cse": true,
                    "constantOptimizer": true
                }
            },
            "outputSelection": {
                "*": {
                    "*": [
                        "abi",
                        "devdoc",
                        "evm.bytecode.object",
                        "evm.bytecode.sourceMap",
                        "evm.deployedBytecode.object",
                        "evm.deployedBytecode.sourceMap"
                    ]
                }
            },
            "evmVersion": "constantinople",
            "remappings": [
                "openzeppelin-solidity=/Users/hen/GitHub/km/node_modules/openzeppelin-solidity"
            ]
        }
    },
    "networks": {}
}
