UNPKG

@reality.eth/contracts

Version:

Collection of smart contracts for the Realitio fact verification platform

938 lines (937 loc) 355 kB
{ "contractName": "SplitterWallet", "abi": [ { "constant": true, "inputs": [], "name": "balanceTotal", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "", "type": "address" } ], "name": "balanceOf", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "owner", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "", "type": "uint256" } ], "name": "recipients", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "name": "newOwner", "type": "address" } ], "name": "transferOwnership", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "payable": true, "stateMutability": "payable", "type": "fallback" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "user", "type": "address" }, { "indexed": false, "name": "amount", "type": "uint256" } ], "name": "LogWithdraw", "type": "event" }, { "constant": false, "inputs": [ { "name": "addr", "type": "address" } ], "name": "addRecipient", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "old_addr", "type": "address" } ], "name": "removeRecipient", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "new_addr", "type": "address" } ], "name": "replaceSelf", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [], "name": "allocate", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [], "name": "withdraw", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" } ], "bytecode": "0x608060405260008054600160a060020a031916331790556108a2806100256000396000f3006080604052600436106100a35763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166312a2919881146100a55780631c3101d3146100c65780633ccfd60b146100e757806342b8c415146100fc5780634a3f864b1461012357806370a08231146101445780638da5cb5b14610165578063abaa991614610196578063d1bc76a1146101ab578063f2fde38b146101c3575b005b3480156100b157600080fd5b506100a3600160a060020a03600435166101e4565b3480156100d257600080fd5b506100a3600160a060020a03600435166102c9565b3480156100f357600080fd5b506100a3610399565b34801561010857600080fd5b50610111610498565b60408051918252519081900360200190f35b34801561012f57600080fd5b506100a3600160a060020a036004351661049e565b34801561015057600080fd5b50610111600160a060020a036004351661051a565b34801561017157600080fd5b5061017a61052c565b60408051600160a060020a039092168252519081900360200190f35b3480156101a257600080fd5b506100a361053b565b3480156101b757600080fd5b5061017a6004356106ee565b3480156101cf57600080fd5b506100a3600160a060020a0360043516610716565b600080548190600160a060020a031633146101fe57600080fd5b6102078361075c565b915082600160a060020a031660038381548110151561022257fe5b600091825260209091200154600160a060020a03161461023e57fe5b50600354600019018181146102b057600380548290811061025b57fe5b60009182526020909120015460038054600160a060020a03909216918490811061028157fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a031602179055505b60038054906102c390600019830161082c565b50505050565b600054600160a060020a031633146102e057600080fd5b60035460641161033a576040805160e560020a62461bcd02815260206004820152601360248201527f546f6f206d616e7920726563697069656e747300000000000000000000000000604482015290519081900360640190fd5b600380546001810182556000919091527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b01805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b33600090815260016020526040812054908111610400576040805160e560020a62461bcd02815260206004820152601860248201527f42616c616e6365206d75737420626520706f7369746976650000000000000000604482015290519081900360640190fd5b600254610413908263ffffffff61080416565b600255336000818152600160205260408082208290555183156108fc0291849190818181858888f19350505050158015610451573d6000803e3d6000fd5b5060408051828152905133917f4ce7033d118120e254016dccf195288400b28fc8936425acd5f17ce2df3ab708919081900360200190a26002543031101561049557fe5b50565b60025481565b60006104a93361075c565b600380549192503391839081106104bc57fe5b600091825260209091200154600160a060020a0316146104d857fe5b816003828154811015156104e857fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a031602179055505050565b60016020526000908152604090205481565b600054600160a060020a031681565b600080600080600061056260025430600160a060020a03163161080490919063ffffffff16565b9450600085116105bc576040805160e560020a62461bcd02815260206004820152601460248201527f4e6f2066756e647320746f20616c6c6f63617465000000000000000000000000604482015290519081900360640190fd5b600354935083858115156105cc57fe5b0492506000831161064d576040805160e560020a62461bcd02815260206004820152603160248201527f4e6f206d6f6e6579206c65667420746f20626520616c6c6f636174656420616660448201527f74657220726f756e64696e6720646f776e000000000000000000000000000000606482015290519081900360840190fd5b600091505b838210156106da57600380548390811061066857fe5b6000918252602080832090910154600160a060020a031680835260019091526040909120549091506106a0908463ffffffff61081616565b600160a060020a0382166000908152600160205260409020556002546106cc908463ffffffff61081616565b600255600190910190610652565b600254303110156106e757fe5b5050505050565b60038054829081106106fc57fe5b600091825260209091200154600160a060020a0316905081565b600054600160a060020a0316331461072d57600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000805b6003548110156107ae5782600160a060020a031660038281548110151561078357fe5b600091825260209091200154600160a060020a031614156107a6578091506107fe565b600101610760565b6040805160e560020a62461bcd02815260206004820152601360248201527f526563697069656e74206e6f7420666f756e6400000000000000000000000000604482015290519081900360640190fd5b50919050565b60008282111561081057fe5b50900390565b60008282018381101561082557fe5b9392505050565b81548183558181111561085057600083815260209020610850918101908301610855565b505050565b61087391905b8082111561086f576000815560010161085b565b5090565b905600a165627a7a72305820ca9029923b645eafaa4dceec0c5fbeb1ec3dfb2939ff6442b5b1205ecd7e335c0029", "deployedBytecode": "0x6080604052600436106100a35763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166312a2919881146100a55780631c3101d3146100c65780633ccfd60b146100e757806342b8c415146100fc5780634a3f864b1461012357806370a08231146101445780638da5cb5b14610165578063abaa991614610196578063d1bc76a1146101ab578063f2fde38b146101c3575b005b3480156100b157600080fd5b506100a3600160a060020a03600435166101e4565b3480156100d257600080fd5b506100a3600160a060020a03600435166102c9565b3480156100f357600080fd5b506100a3610399565b34801561010857600080fd5b50610111610498565b60408051918252519081900360200190f35b34801561012f57600080fd5b506100a3600160a060020a036004351661049e565b34801561015057600080fd5b50610111600160a060020a036004351661051a565b34801561017157600080fd5b5061017a61052c565b60408051600160a060020a039092168252519081900360200190f35b3480156101a257600080fd5b506100a361053b565b3480156101b757600080fd5b5061017a6004356106ee565b3480156101cf57600080fd5b506100a3600160a060020a0360043516610716565b600080548190600160a060020a031633146101fe57600080fd5b6102078361075c565b915082600160a060020a031660038381548110151561022257fe5b600091825260209091200154600160a060020a03161461023e57fe5b50600354600019018181146102b057600380548290811061025b57fe5b60009182526020909120015460038054600160a060020a03909216918490811061028157fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a031602179055505b60038054906102c390600019830161082c565b50505050565b600054600160a060020a031633146102e057600080fd5b60035460641161033a576040805160e560020a62461bcd02815260206004820152601360248201527f546f6f206d616e7920726563697069656e747300000000000000000000000000604482015290519081900360640190fd5b600380546001810182556000919091527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b01805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b33600090815260016020526040812054908111610400576040805160e560020a62461bcd02815260206004820152601860248201527f42616c616e6365206d75737420626520706f7369746976650000000000000000604482015290519081900360640190fd5b600254610413908263ffffffff61080416565b600255336000818152600160205260408082208290555183156108fc0291849190818181858888f19350505050158015610451573d6000803e3d6000fd5b5060408051828152905133917f4ce7033d118120e254016dccf195288400b28fc8936425acd5f17ce2df3ab708919081900360200190a26002543031101561049557fe5b50565b60025481565b60006104a93361075c565b600380549192503391839081106104bc57fe5b600091825260209091200154600160a060020a0316146104d857fe5b816003828154811015156104e857fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a031602179055505050565b60016020526000908152604090205481565b600054600160a060020a031681565b600080600080600061056260025430600160a060020a03163161080490919063ffffffff16565b9450600085116105bc576040805160e560020a62461bcd02815260206004820152601460248201527f4e6f2066756e647320746f20616c6c6f63617465000000000000000000000000604482015290519081900360640190fd5b600354935083858115156105cc57fe5b0492506000831161064d576040805160e560020a62461bcd02815260206004820152603160248201527f4e6f206d6f6e6579206c65667420746f20626520616c6c6f636174656420616660448201527f74657220726f756e64696e6720646f776e000000000000000000000000000000606482015290519081900360840190fd5b600091505b838210156106da57600380548390811061066857fe5b6000918252602080832090910154600160a060020a031680835260019091526040909120549091506106a0908463ffffffff61081616565b600160a060020a0382166000908152600160205260409020556002546106cc908463ffffffff61081616565b600255600190910190610652565b600254303110156106e757fe5b5050505050565b60038054829081106106fc57fe5b600091825260209091200154600160a060020a0316905081565b600054600160a060020a0316331461072d57600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000805b6003548110156107ae5782600160a060020a031660038281548110151561078357fe5b600091825260209091200154600160a060020a031614156107a6578091506107fe565b600101610760565b6040805160e560020a62461bcd02815260206004820152601360248201527f526563697069656e74206e6f7420666f756e6400000000000000000000000000604482015290519081900360640190fd5b50919050565b60008282111561081057fe5b50900390565b60008282018381101561082557fe5b9392505050565b81548183558181111561085057600083815260209020610850918101908301610855565b505050565b61087391905b8082111561086f576000815560010161085b565b5090565b905600a165627a7a72305820ca9029923b645eafaa4dceec0c5fbeb1ec3dfb2939ff6442b5b1205ecd7e335c0029", "sourceMap": "982:3680:12:-;;;111:5:7;:18;;-1:-1:-1;;;;;;111:18:7;119:10;111:18;;;982:3680:12;;;;;;", "deployedSourceMap": "982:3680:12:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2378:458;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2378:458:12;-1:-1:-1;;;;;2378:458:12;;;;;2013:182;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2013:182:12;-1:-1:-1;;;;;2013:182:12;;;;;4256:358;;8:9:-1;5:2;;;30:1;27;20:12;5:2;4256:358:12;;;;1296:27;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1296:27:12;;;;;;;;;;;;;;;;;;;;3027:199;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3027:199:12;-1:-1:-1;;;;;3027:199:12;;;;;1201:44;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1201:44:12;-1:-1:-1;;;;;1201:44:12;;;;;48:20:7;;8:9:-1;5:2;;;30:1;27;20:12;5:2;48:20:7;;;;;;;;-1:-1:-1;;;;;48:20:7;;;;;;;;;;;;;;3463:721:12;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3463:721:12;;;;1400:27;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1400:27:12;;;;;223:109:7;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;223:109:7;-1:-1:-1;;;;;223:109:7;;;;;2378:458:12;2464:11;193:5:7;;2464:11:12;;-1:-1:-1;;;;;193:5:7;179:10;:19;171:28;;;;;;2478:30:12;2499:8;2478:20;:30::i;:::-;2464:44;;2544:8;-1:-1:-1;;;;;2525:27:12;:10;2536:3;2525:15;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;2525:15:12;:27;2518:35;;;;-1:-1:-1;2685:10:12;:17;-1:-1:-1;;2685:21:12;2720:15;;;2716:84;;2769:10;:20;;2780:8;;2769:20;;;;;;;;;;;;;;;;2751:10;:15;;-1:-1:-1;;;;;2769:20:12;;;;2762:3;;2751:15;;;;;;;;;;;;;;:38;;;;;-1:-1:-1;;;;;2751:38:12;;;;;-1:-1:-1;;;;;2751:38:12;;;;;;2716:84;2810:10;:19;;;;;-1:-1:-1;;2810:19:12;;;:::i;:::-;;2378:458;;;:::o;2013:182::-;193:5:7;;-1:-1:-1;;;;;193:5:7;179:10;:19;171:28;;;;;;2099:10:12;:17;1147:3;-1:-1:-1;2091:66:12;;;;;-1:-1:-1;;;;;2091:66:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;2167:10;27::-1;;39:1;23:18;;45:23;;-1:-1;2167:21:12;;;;;;;;-1:-1:-1;;2167:21:12;-1:-1:-1;;;;;2167:21:12;;;;;;;;;;2013:182::o;4256:358::-;4325:10;4301:11;4315:21;;;:9;:21;;;;;;;4354:7;;4346:44;;;;;-1:-1:-1;;;;;4346:44:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;4416:12;;:21;;4433:3;4416:21;:16;:21;:::i;:::-;4401:12;:36;4457:10;4471:1;4447:21;;;:9;:21;;;;;;:25;;;4482:24;;;;;;4502:3;;4482:24;;4471:1;4482:24;4502:3;4457:10;4482:24;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;4522:28:12;;;;;;;;4534:10;;4522:28;;;;;;;;;;4593:12;;4576:4;4568:21;:37;;4561:45;;;;4256:358;:::o;1296:27::-;;;;:::o;3027:199::-;3090:11;3104:32;3125:10;3104:20;:32::i;:::-;3153:10;:15;;3090:46;;-1:-1:-1;3172:10:12;;3090:46;;3153:15;;;;;;;;;;;;;;;;-1:-1:-1;;;;;3153:15:12;:29;3146:37;;;;3211:8;3193:10;3204:3;3193:15;;;;;;;;;;;;;;;;;;:26;;;;;-1:-1:-1;;;;;3193:26:12;;;;;-1:-1:-1;;;;;3193:26:12;;;;;;3027:199;;:::o;1201:44::-;;;;;;;;;;;;;:::o;48:20:7:-;;;-1:-1:-1;;;;;48:20:7;;:::o;3463:721:12:-;3507:19;3637:22;3771:12;3905:9;3971:13;3529:39;3555:12;;3537:4;-1:-1:-1;;;;;3529:21:12;;:25;;:39;;;;:::i;:::-;3507:61;-1:-1:-1;3600:1:12;3586:15;;3578:48;;;;;-1:-1:-1;;;;;3578:48:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;3662:10;:17;;-1:-1:-1;3662:17:12;3786:11;:28;;;;;;;;;-1:-1:-1;3839:1:12;3832:8;;3824:70;;;;;-1:-1:-1;;;;;3824:70:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3931:1;3929:3;;3924:197;3936:14;3934:1;:16;3924:197;;;3987:10;:13;;3998:1;;3987:13;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;3987:13:12;4033:16;;;3987:13;4033:16;;;;;;;;3987:13;;-1:-1:-1;4033:26:12;;4054:4;4033:26;:20;:26;:::i;:::-;-1:-1:-1;;;;;4014:16:12;;;;;;:9;:16;;;;;:45;4088:12;;:22;;4105:4;4088:22;:16;:22;:::i;:::-;4073:12;:37;3952:3;;;;;3924:197;;;4163:12;;4146:4;4138:21;:37;;4131:45;;;;3463:721;;;;;:::o;1400:27::-;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1400:27:12;;-1:-1:-1;1400:27:12;:::o;223:109:7:-;193:5;;-1:-1:-1;;;;;193:5:7;179:10;:19;171:28;;;;;;309:5;:16;;-1:-1:-1;;309:16:7;-1:-1:-1;;;;;309:16:7;;;;;;;;;;223:109::o;1518:295:12:-;1598:7;;1641:127;1652:10;:17;1650:19;;1641:127;;;1711:4;-1:-1:-1;;;;;1694:21:12;:10;1705:1;1694:13;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1694:13:12;:21;1690:68;;;1742:1;1735:8;;;;1690:68;1671:3;;1641:127;;;1777:29;;;-1:-1:-1;;;;;1777:29:12;;;;;;;;;;;;;;;;;;;;;;;;;;;1518:295;;;;;:::o;605:110:9:-;663:7;685:6;;;;678:14;;;;-1:-1:-1;705:5:9;;;605:110::o;719:129::-;777:7;804:5;;;822:6;;;;815:14;;;;842:1;719:129;-1:-1:-1;;;719:129:9:o;982:3680:12:-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;:::o", "source": "pragma solidity ^0.4.25;\n\nimport './Owned.sol';\nimport './RealitioSafeMath256.sol';\n\n/*\nThis contract allows you to split ETH between up to 100 receivers.\n\nEach receiver can withdraw their own share of the funds without the cooperation of the others. \nThey can also replace their own address with a different one.\n\nThe receivers can be added by the `owner` contract, for example a multisig wallet. \nThe same receiver can be added multiple times if you want an unequal distribution.\nTransfer ownership to 0x0 if you want to lock the receiver list and prevent further changes.\n\nThis contract receives ETH normally, without using extra gas that could cause incoming payments to fail.\nAnyone can then call allocate() to assign any unassigned balance to the receivers.\nThe `allocate()` call may leave a small amount of ETH unassigned due to rounding. This can be allocated in a future call.\n\nOnce funds are allocated, each party can withdraw their own funds by calling `withdraw()`.\n*/\n\ncontract SplitterWallet is Owned {\n\n // We sometimes loop over our recipient list, so set a maximum to avoid gas exhaustion\n uint256 constant MAX_RECIPIENTS = 100;\n\n using RealitioSafeMath256 for uint256;\n\n mapping(address => uint256) public balanceOf;\n \n // Sum of all balances in balanceOf\n uint256 public balanceTotal; \n\n // List of recipients. May contain duplicates to get paid twice.\n address[] public recipients;\n\n event LogWithdraw(\n address indexed user,\n uint256 amount\n );\n\n function _firstRecipientIndex(address addr) \n internal\n view returns (uint256) \n {\n uint256 i;\n for(i=0; i<recipients.length; i++) {\n if (recipients[i] == addr) {\n return i;\n }\n }\n revert(\"Recipient not found\");\n }\n\n /// @notice Add a recipient to the list\n /// @param addr The address to add\n /// @dev Doesn't check for duplicates, it's OK to add the same recipient twice for an unequal distribution\n function addRecipient(address addr) \n onlyOwner\n external {\n require(recipients.length < MAX_RECIPIENTS, \"Too many recipients\");\n recipients.push(addr);\n }\n\n /// @notice Remove a recipient from the list\n /// @param old_addr The address to remove\n /// @dev If your address shows up more than once, removes the first occurance\n function removeRecipient(address old_addr) \n onlyOwner\n external {\n\n uint256 idx = _firstRecipientIndex(old_addr);\n assert(recipients[idx] == old_addr);\n\n // If you're not deleting the last item, copy the last item over to the thing you're deleting\n uint256 last_idx = recipients.length - 1;\n if (idx != last_idx) {\n recipients[idx] = recipients[last_idx];\n }\n\n recipients.length--;\n }\n\n /// @notice Replace your own address with a different one\n /// @param new_addr The new address\n /// @dev If your address shows up more than once, replaces the first occurance\n function replaceSelf(address new_addr) \n external {\n uint256 idx = _firstRecipientIndex(msg.sender);\n assert(recipients[idx] == msg.sender);\n recipients[idx] = new_addr;\n }\n\n /// @notice Allocate any unallocated funds from the contract balance\n /// @dev Any time the contract gets funds, they will appear as unallocated\n /// @dev Assign them to the current recipients, and mark them as allocated\n function allocate()\n external {\n\n uint256 unallocated = address(this).balance.sub(balanceTotal);\n require(unallocated > 0, \"No funds to allocate\");\n\n uint256 num_recipients = recipients.length;\n\n // NB Rounding may leave some funds unallocated, we can claim them later\n uint256 each = unallocated / num_recipients;\n require(each > 0, \"No money left to be allocated after rounding down\");\n\n uint256 i;\n for (i=0; i<num_recipients; i++) {\n address recip = recipients[i];\n balanceOf[recip] = balanceOf[recip].add(each);\n balanceTotal = balanceTotal.add(each);\n }\n\n assert(address(this).balance >= balanceTotal);\n\n }\n\n /// @notice Withdraw the address balance to the owner account\n function withdraw() \n external {\n\n uint256 bal = balanceOf[msg.sender];\n require(bal > 0, \"Balance must be positive\");\n\n balanceTotal = balanceTotal.sub(bal);\n balanceOf[msg.sender] = 0;\n msg.sender.transfer(bal);\n\n emit LogWithdraw(msg.sender, bal);\n\n assert(address(this).balance >= balanceTotal);\n\n }\n\n function()\n external payable {\n }\n\n}\n", "sourcePath": "/home/ed/working/realitio-contracts-newtest/truffle/contracts/SplitterWallet.sol", "ast": { "absolutePath": "/home/ed/working/realitio-contracts-newtest/truffle/contracts/SplitterWallet.sol", "exportedSymbols": { "SplitterWallet": [ 3347 ] }, "id": 3348, "nodeType": "SourceUnit", "nodes": [ { "id": 3041, "literals": [ "solidity", "^", "0.4", ".25" ], "nodeType": "PragmaDirective", "src": "0:24:12" }, { "absolutePath": "/home/ed/working/realitio-contracts-newtest/truffle/contracts/Owned.sol", "file": "./Owned.sol", "id": 3042, "nodeType": "ImportDirective", "scope": 3348, "sourceUnit": 848, "src": "26:21:12", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "/home/ed/working/realitio-contracts-newtest/truffle/contracts/RealitioSafeMath256.sol", "file": "./RealitioSafeMath256.sol", "id": 3043, "nodeType": "ImportDirective", "scope": 3348, "sourceUnit": 2964, "src": "48:35:12", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 3044, "name": "Owned", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 847, "src": "1009:5:12", "typeDescriptions": { "typeIdentifier": "t_contract$_Owned_$847", "typeString": "contract Owned" } }, "id": 3045, "nodeType": "InheritanceSpecifier", "src": "1009:5:12" } ], "contractDependencies": [ 847 ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 3347, "linearizedBaseContracts": [ 3347, 847 ], "name": "SplitterWallet", "nodeType": "ContractDefinition", "nodes": [ { "constant": true, "id": 3048, "name": "MAX_RECIPIENTS", "nodeType": "VariableDeclaration", "scope": 3347, "src": "1113:37:12", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3046, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1113:7:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": { "argumentTypes": null, "hexValue": "313030", "id": 3047, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1147:3:12", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_100_by_1", "typeString": "int_const 100" }, "value": "100" }, "visibility": "internal" }, { "id": 3051, "libraryName": { "contractScope": null, "id": 3049, "name": "RealitioSafeMath256", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 2963, "src": "1163:19:12", "typeDescriptions": { "typeIdentifier": "t_contract$_RealitioSafeMath256_$2963", "typeString": "library RealitioSafeMath256" } }, "nodeType": "UsingForDirective", "src": "1157:38:12", "typeName": { "id": 3050, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1187:7:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } }, { "constant": false, "id": 3055, "name": "balanceOf", "nodeType": "VariableDeclaration", "scope": 3347, "src": "1201:44:12", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", "typeString": "mapping(address => uint256)" }, "typeName": { "id": 3054, "keyType": { "id": 3052, "name": "address", "nodeType": "ElementaryTypeName", "src": "1209:7:12", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Mapping", "src": "1201:27:12", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", "typeString": "mapping(address => uint256)" }, "valueType": { "id": 3053, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1220:7:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } }, "value": null, "visibility": "public" }, { "constant": false, "id": 3057, "name": "balanceTotal", "nodeType": "VariableDeclaration", "scope": 3347, "src": "1296:27:12", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3056, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1296:7:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 3060, "name": "recipients", "nodeType": "VariableDeclaration", "scope": 3347, "src": "1400:27:12", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$dyn_storage", "typeString": "address[]" }, "typeName": { "baseType": { "id": 3058, "name": "address", "nodeType": "ElementaryTypeName", "src": "1400:7:12", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 3059, "length": null, "nodeType": "ArrayTypeName", "src": "1400:9:12", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$dyn_storage_ptr", "typeString": "address[]" } }, "value": null, "visibility": "public" }, { "anonymous": false, "documentation": null, "id": 3066, "name": "LogWithdraw", "nodeType": "EventDefinition", "parameters": { "id": 3065, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 3062, "indexed": true, "name": "user", "nodeType": "VariableDeclaration", "scope": 3066, "src": "1461:20:12", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 3061, "name": "address", "nodeType": "ElementaryTypeName", "src": "1461:7:12", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 3064, "indexed": false, "name": "amount", "nodeType": "VariableDeclaration", "scope": 3066, "src": "1491:14:12", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3063, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1491:7:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1451:60:12" }, "src": "1434:78:12" }, { "body": { "id": 3102, "nodeType": "Block", "src": "1612:201:12", "statements": [ { "assignments": [], "declarations": [ { "constant": false, "id": 3074, "name": "i", "nodeType": "VariableDeclaration", "scope": 3103, "src": "1622:9:12", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3073, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1622:7:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 3075, "initialValue": null, "nodeType": "VariableDeclarationStatement", "src": "1622:9:12" }, { "body": { "id": 3096, "nodeType": "Block", "src": "1676:92:12", "statements": [ { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 3091, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 3087, "name": "recipients", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3060, "src": "1694:10:12", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$dyn_storage", "typeString": "address[] storage ref" } }, "id": 3089, "indexExpression": { "argumentTypes": null, "id": 3088, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3074, "src": "1705:1:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1694:13:12", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "id": 3090, "name": "addr", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3068, "src": "1711:4:12", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "1694:21:12", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 3095, "nodeType": "IfStatement", "src": "1690:68:12", "trueBody": { "id": 3094, "nodeType": "Block", "src": "1717:41:12", "statements": [ { "expression": { "argumentTypes": null, "id": 3092, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3074, "src": "1742:1:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 3072, "id": 3093, "nodeType": "Return", "src": "1735:8:12" } ] } } ] }, "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 3083, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 3080, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3074, "src": "1650:1:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<", "rightExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 3081, "name": "recipients", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3060, "src": "1652:10:12", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$dyn_storage", "typeString": "address[] storage ref" } }, "id": 3082, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "length", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1652:17:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1650:19:12", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "id": 3097, "initializationExpression": { "expression": { "argumentTypes": null, "id": 3078, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 3076, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3074, "src": "1645:1:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "hexValue": "30", "id": 3077, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1647:1:12", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "1645:3:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 3079, "nodeType": "ExpressionStatement", "src": "1645:3:12" }, "loopExpression": { "expression": { "argumentTypes": null, "id": 3085, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "UnaryOperation", "operator": "++", "prefix": false, "src": "1671:3:12", "subExpression": { "argumentTypes": null, "id": 3084, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3074, "src": "1671:1:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 3086, "nodeType": "ExpressionStatement", "src": "1671:3:12" }, "nodeType": "ForStatement", "src": "1641:127:12" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "526563697069656e74206e6f7420666f756e64", "id": 3099, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "1784:21:12", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_93db40798ebf892ca23a5d6cec2fe2152d9e58f4b4cfd72807d0aa4100f88354", "typeString": "literal_string \"Recipient not found\"" }, "value": "Recipient not found" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_stringliteral_93db40798ebf892ca23a5d6cec2fe2152d9e58f4b4cfd72807d0aa4100f88354", "typeString": "literal_string \"Recipient not found\"" } ], "id": 3098, "name": "revert", "nodeType": "Identifier", "overloadedDeclarations": [ 3388, 3389 ], "referencedDeclaration": 3389, "src": "1777:6:12", "typeDescriptions": { "typeIdentifier": "t_function_revert_pure$_t_string_memory_ptr_$returns$__$", "typeString": "function (string memory) pure" } }, "id": 3100, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1777:29:12", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 3101, "nodeType": "ExpressionStatement", "src": "1777:29:12" } ] }, "documentation": null, "id": 3103, "implemented": true, "isConstructor": false, "isDeclaredConst": true, "modifiers": [], "name": "_firstRecipientIndex", "nodeType": "FunctionDefinition", "parameters": { "id": 3069, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 3068, "name": "addr", "nodeType": "VariableDeclaration", "scope": 3103, "src": "1548:12:12", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 3067, "name": "address", "nodeType": "ElementaryTypeName", "src": "1548:7:12", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "1547:14:12" }, "payable": false, "returnParameters": { "id": 3072, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 3071, "name": "", "nodeType": "VariableDeclaration", "scope": 3103, "src": "1598:7:12", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3070, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1598:7:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1597:9:12"