@realitio/realitio-contracts
Version:
Collection of smart contracts for the Realitio fact verification platform
1,261 lines (1,260 loc) • 342 kB
JSON
{
"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": "0x",
"deployedBytecode": "0x",
"sourceMap": "",
"deployedSourceMap": "",
"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/truffle/contracts/SplitterWallet.sol",
"ast": {
"absolutePath": "/home/ed/working/realitio-contracts/truffle/contracts/SplitterWallet.sol",
"exportedSymbols": {
"SplitterWallet": [
9688
]
},
"id": 9689,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 9382,
"literals": [
"solidity",
"^",
"0.4",
".25"
],
"nodeType": "PragmaDirective",
"src": "0:24:19"
},
{
"absolutePath": "/home/ed/working/realitio-contracts/truffle/contracts/Owned.sol",
"file": "./Owned.sol",
"id": 9383,
"nodeType": "ImportDirective",
"scope": 9689,
"sourceUnit": 2749,
"src": "26:21:19",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "/home/ed/working/realitio-contracts/truffle/contracts/RealitioSafeMath256.sol",
"file": "./RealitioSafeMath256.sol",
"id": 9384,
"nodeType": "ImportDirective",
"scope": 9689,
"sourceUnit": 7069,
"src": "48:35:19",
"symbolAliases": [],
"unitAlias": ""
},
{
"baseContracts": [
{
"arguments": null,
"baseName": {
"contractScope": null,
"id": 9385,
"name": "Owned",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 2748,
"src": "1009:5:19",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Owned_$2748",
"typeString": "contract Owned"
}
},
"id": 9386,
"nodeType": "InheritanceSpecifier",
"src": "1009:5:19"
}
],
"contractDependencies": [
1365,
2748
],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": false,
"id": 9688,
"linearizedBaseContracts": [
9688,
2748,
1365
],
"name": "SplitterWallet",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": true,
"id": 9389,
"name": "MAX_RECIPIENTS",
"nodeType": "VariableDeclaration",
"scope": 9688,
"src": "1113:37:19",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 9387,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1113:7:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": {
"argumentTypes": null,
"hexValue": "313030",
"id": 9388,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1147:3:19",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_100_by_1",
"typeString": "int_const 100"
},
"value": "100"
},
"visibility": "internal"
},
{
"id": 9392,
"libraryName": {
"contractScope": null,
"id": 9390,
"name": "RealitioSafeMath256",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 7068,
"src": "1163:19:19",
"typeDescriptions": {
"typeIdentifier": "t_contract$_RealitioSafeMath256_$7068",
"typeString": "library RealitioSafeMath256"
}
},
"nodeType": "UsingForDirective",
"src": "1157:38:19",
"typeName": {
"id": 9391,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1187:7:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
},
{
"constant": false,
"id": 9396,
"name": "balanceOf",
"nodeType": "VariableDeclaration",
"scope": 9688,
"src": "1201:44:19",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
},
"typeName": {
"id": 9395,
"keyType": {
"id": 9393,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1209:7:19",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Mapping",
"src": "1201:27:19",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
},
"valueType": {
"id": 9394,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1220:7:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
},
"value": null,
"visibility": "public"
},
{
"constant": false,
"id": 9398,
"name": "balanceTotal",
"nodeType": "VariableDeclaration",
"scope": 9688,
"src": "1296:27:19",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 9397,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1296:7:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "public"
},
{
"constant": false,
"id": 9401,
"name": "recipients",
"nodeType": "VariableDeclaration",
"scope": 9688,
"src": "1400:27:19",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_address_$dyn_storage",
"typeString": "address[]"
},
"typeName": {
"baseType": {
"id": 9399,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1400:7:19",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 9400,
"length": null,
"nodeType": "ArrayTypeName",
"src": "1400:9:19",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_address_$dyn_storage_ptr",
"typeString": "address[]"
}
},
"value": null,
"visibility": "public"
},
{
"anonymous": false,
"documentation": null,
"id": 9407,
"name": "LogWithdraw",
"nodeType": "EventDefinition",
"parameters": {
"id": 9406,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 9403,
"indexed": true,
"name": "user",
"nodeType": "VariableDeclaration",
"scope": 9407,
"src": "1461:20:19",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 9402,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1461:7:19",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 9405,
"indexed": false,
"name": "amount",
"nodeType": "VariableDeclaration",
"scope": 9407,
"src": "1491:14:19",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 9404,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1491:7:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1451:60:19"
},
"src": "1434:78:19"
},
{
"body": {
"id": 9443,
"nodeType": "Block",
"src": "1612:201:19",
"statements": [
{
"assignments": [],
"declarations": [
{
"constant": false,
"id": 9415,
"name": "i",
"nodeType": "VariableDeclaration",
"scope": 9444,
"src": "1622:9:19",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 9414,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1622:7:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 9416,
"initialValue": null,
"nodeType": "VariableDeclarationStatement",
"src": "1622:9:19"
},
{
"body": {
"id": 9437,
"nodeType": "Block",
"src": "1676:92:19",
"statements": [
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 9432,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 9428,
"name": "recipients",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9401,
"src": "1694:10:19",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_address_$dyn_storage",
"typeString": "address[] storage ref"
}
},
"id": 9430,
"indexExpression": {
"argumentTypes": null,
"id": 9429,
"name": "i",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9415,
"src": "1705:1:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "1694:13:19",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"id": 9431,
"name": "addr",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9409,
"src": "1711:4:19",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "1694:21:19",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 9436,
"nodeType": "IfStatement",
"src": "1690:68:19",
"trueBody": {
"id": 9435,
"nodeType": "Block",
"src": "1717:41:19",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 9433,
"name": "i",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9415,
"src": "1742:1:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 9413,
"id": 9434,
"nodeType": "Return",
"src": "1735:8:19"
}
]
}
}
]
},
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 9424,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 9421,
"name": "i",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9415,
"src": "1650:1:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "<",
"rightExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 9422,
"name": "recipients",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9401,
"src": "1652:10:19",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_address_$dyn_storage",
"typeString": "address[] storage ref"
}
},
"id": 9423,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "length",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "1652:17:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1650:19:19",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 9438,
"initializationExpression": {
"expression": {
"argumentTypes": null,
"id": 9419,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 9417,
"name": "i",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9415,
"src": "1645:1:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"hexValue": "30",
"id": 9418,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1647:1:19",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "1645:3:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 9420,
"nodeType": "ExpressionStatement",
"src": "1645:3:19"
},
"loopExpression": {
"expression": {
"argumentTypes": null,
"id": 9426,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "UnaryOperation",
"operator": "++",
"prefix": false,
"src": "1671:3:19",
"subExpression": {
"argumentTypes": null,
"id": 9425,
"name": "i",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9415,
"src": "1671:1:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 9427,
"nodeType": "ExpressionStatement",
"src": "1671:3:19"
},
"nodeType": "ForStatement",
"src": "1641:127:19"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "526563697069656e74206e6f7420666f756e64",
"id": 9440,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1784:21:19",
"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": 9439,
"name": "revert",
"nodeType": "Identifier",
"overloadedDeclarations": [
9708,
9709
],
"referencedDeclaration": 9709,
"src": "1777:6:19",
"typeDescriptions": {
"typeIdentifier": "t_function_revert_pure$_t_string_memory_ptr_$returns$__$",
"typeString": "function (string memory) pure"
}
},
"id": 9441,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1777:29:19",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 9442,
"nodeType": "ExpressionStatement",
"src": "1777:29:19"
}
]
},
"documentation": null,
"id": 9444,
"implemented": true,
"isConstructor": false,
"isDeclaredConst": true,
"modifiers": [],
"name": "_firstRecipientIndex",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 9410,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 9409,
"name": "addr",
"nodeType": "VariableDeclaration",
"scope": 9444,
"src": "1548:12:19",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 9408,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1548:7:19",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1547:14:19"
},
"payable": false,
"returnParameters": {
"id": 9413,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 9412,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 9444,
"src": "1598:7:19",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 9411,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1598:7:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1597:9:19"
},
"scope": 9688,
"src": "1518:295:19",
"stateMutability": "view",
"superFunction": null,
"visibility": "internal"
},
{
"body": {
"id": 9465,
"nodeType": "Block",
"src": "2081:114:19",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 9455,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 9452,
"name": "recipients",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9401,
"src": "2099:10:19",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_address_$dyn_storage",
"typeString": "address[] storage ref"
}
},
"id": 9453,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "length",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "2099:17:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "<",
"rightExpression": {
"argumentTypes": null,
"id": 9454,
"name": "MAX_RECIPIENTS",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9389,
"src": "2119:14:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "2099:34:19",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "546f6f206d616e7920726563697069656e7473",
"id": 9456,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2135:21:19",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_45a01ff2d08f54e7df8aa7ce797bcd893de9361372881bed847a4facf2f85f66",
"typeString": "literal_string \"Too many recipients\""
},
"value": "Too many recipients"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_45a01ff2d08f54e7df8aa7ce797bcd893de9361372881bed847a4facf2f85f66",
"typeString": "literal_string \"Too many recipients\""
}
],
"id": 9451,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
9706,
9707
],
"referencedDeclaration": 9707,
"src": "2091:7:19",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 9457,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2091:66:19",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 9458,
"nodeType": "ExpressionStatement",
"src": "2091:66:19"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 9462,
"name": "addr",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9446,
"src": "2183:4:19",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"expression": {
"argumentTypes": null,
"id": 9459,
"name": "recipients",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9401,
"src": "2167:10:19",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_address_$dyn_storage",
"typeString": "address[] storage ref"
}
},
"id": 9461,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "push",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "2167:15:19",
"typeDescriptions": {
"typeIdentifier": "t_function_arraypush_nonpayable$_t_address_$returns$_t_uint256_$",
"typeString": "function (address) returns (uint256)"
}
},
"id": 9463,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2167:21:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 9464,
"nodeType": "ExpressionStatement",
"src": "2167:21:19"
}
]
},
"documentation": "@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",
"id": 9466,
"implemented": true,
"isConstructor": false,
"isDeclaredConst": false,
"modifiers": [
{
"arguments": null,
"id": 9449,
"modifierName": {
"argumentTypes": null,
"id": 9448,
"name": "onlyOwner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 2735,
"src": "2058:9:19",
"typeDescriptions": {
"typeIdentifier": "t_modifier$__$",
"typeString": "modifier ()"
}
},
"nodeType": "ModifierInvocation",
"src": "2058:9:19"
}
],
"name": "addRecipient",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 9447,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 9446,
"name": "addr",
"nodeType": "VariableDeclaration",
"scope": 9466,
"src": "2035:12:19",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 9445,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "2035:7:19",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "2034:14:19"
},
"payable": false,
"returnParameters": {
"id": 9450,
"nodeType": "ParameterList",
"parameters": [],
"src": "2081:0:19"
},
"scope": 9688,
"src": "2013:182:19",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "external"
},
{
"body": {
"id": 9512,
"nodeType": "Block",
"src": "2453:383:19",
"statements": [
{
"assignments": [
9474
],
"declarations": [
{
"constant": false,
"id": 9474,
"name": "idx",
"nodeType": "VariableDeclaration",
"scope": 9513,
"src": "2464:11:19",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 9473,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2464:7:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,