Files
2022-08-09 18:26:30 +02:00

4036 lines
173 KiB
JSON

{
"contractName": "DelegateRegistry",
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "delegator",
"type": "address"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "id",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "delegate",
"type": "address"
}
],
"name": "ClearDelegate",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "delegator",
"type": "address"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "id",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "delegate",
"type": "address"
}
],
"name": "SetDelegate",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"name": "delegation",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "id",
"type": "bytes32"
},
{
"internalType": "address",
"name": "delegate",
"type": "address"
}
],
"name": "setDelegate",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "id",
"type": "bytes32"
}
],
"name": "clearDelegate",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
],
"metadata": "{\"compiler\":{\"version\":\"0.7.2+commit.51b20bc0\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\"}],\"name\":\"ClearDelegate\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\"}],\"name\":\"SetDelegate\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"}],\"name\":\"clearDelegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"delegation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\"}],\"name\":\"setDelegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"clearDelegate(bytes32)\":{\"details\":\"Clears a delegate for the msg.sender and a specific id. The combination of msg.sender and the id can be seen as a unique key.\",\"params\":{\"id\":\"Id for which the delegate should be set\"}},\"setDelegate(bytes32,address)\":{\"details\":\"Sets a delegate for the msg.sender and a specific id. The combination of msg.sender and the id can be seen as a unique key.\",\"params\":{\"delegate\":\"Address of the delegate\",\"id\":\"Id for which the delegate should be set\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"/Users/moaazalthahabee/Documents/Repositories/delegate-registry/contracts/DelegateRegistry.sol\":\"DelegateRegistry\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/moaazalthahabee/Documents/Repositories/delegate-registry/contracts/DelegateRegistry.sol\":{\"keccak256\":\"0xe0903a644e8a4150ef099d1fd56eb74efd336d500ba5c591f35bda5e95401489\",\"license\":\"LGPL-3.0-only\",\"urls\":[\"bzz-raw://cafe09ca067adb33d1b1c61fa322436cf0fd24cca34fb54679446b6bb30cbc03\",\"dweb:/ipfs/QmP6jnkpvtFbhD5pGRGDGhJ24CwhvSyf6iz6o2udqNZV1h\"]}},\"version\":1}",
"bytecode": "0x608060405234801561001057600080fd5b50610794806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806374c6c45414610046578063bd86e508146100be578063f0bedbe21461010c575b600080fd5b6100926004803603604081101561005c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061013a565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61010a600480360360408110156100d457600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061017c565b005b6101386004803603602081101561012257600080fd5b8101908080359060200190929190505050610538565b005b60006020528160005260406000206020528060005260406000206000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b3373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561021e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f43616e27742064656c656761746520746f2073656c660000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156102c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f43616e27742064656c656761746520746f20307830000000000000000000000081525060200191505060405180910390fd5b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156103ba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061073e6021913960400191505060405180910390fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600085815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146104d8578073ffffffffffffffffffffffffffffffffffffffff16833373ffffffffffffffffffffffffffffffffffffffff167f9c4f00c4291262731946e308dc2979a56bd22cce8f95906b975065e96cd5a06460405160405180910390a45b8173ffffffffffffffffffffffffffffffffffffffff16833373ffffffffffffffffffffffffffffffffffffffff167fa9a7fd460f56bddb880a465a9c3e9730389c70bc53108148f16d55a87a6c468e60405160405180910390a4505050565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561064f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f4e6f2064656c656761746520736574000000000000000000000000000000000081525060200191505060405180910390fd5b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff16823373ffffffffffffffffffffffffffffffffffffffff167f9c4f00c4291262731946e308dc2979a56bd22cce8f95906b975065e96cd5a06460405160405180910390a4505056fe416c72656164792064656c65676174656420746f20746869732061646472657373a2646970667358221220d231ceeec414c2729578a31c3f8a68858a326d88fd3993cf6c58970d79fc047c64736f6c63430007020033",
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c806374c6c45414610046578063bd86e508146100be578063f0bedbe21461010c575b600080fd5b6100926004803603604081101561005c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061013a565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61010a600480360360408110156100d457600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061017c565b005b6101386004803603602081101561012257600080fd5b8101908080359060200190929190505050610538565b005b60006020528160005260406000206020528060005260406000206000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b3373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561021e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f43616e27742064656c656761746520746f2073656c660000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156102c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f43616e27742064656c656761746520746f20307830000000000000000000000081525060200191505060405180910390fd5b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156103ba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061073e6021913960400191505060405180910390fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600085815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146104d8578073ffffffffffffffffffffffffffffffffffffffff16833373ffffffffffffffffffffffffffffffffffffffff167f9c4f00c4291262731946e308dc2979a56bd22cce8f95906b975065e96cd5a06460405160405180910390a45b8173ffffffffffffffffffffffffffffffffffffffff16833373ffffffffffffffffffffffffffffffffffffffff167fa9a7fd460f56bddb880a465a9c3e9730389c70bc53108148f16d55a87a6c468e60405160405180910390a4505050565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561064f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f4e6f2064656c656761746520736574000000000000000000000000000000000081525060200191505060405180910390fd5b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff16823373ffffffffffffffffffffffffffffffffffffffff167f9c4f00c4291262731946e308dc2979a56bd22cce8f95906b975065e96cd5a06460405160405180910390a4505056fe416c72656164792064656c65676174656420746f20746869732061646472657373a2646970667358221220d231ceeec414c2729578a31c3f8a68858a326d88fd3993cf6c58970d79fc047c64736f6c63430007020033",
"immutableReferences": {},
"generatedSources": [],
"deployedGeneratedSources": [],
"sourceMap": "75:2077:0:-:0;;;;;;;;;;;;;;;;;;;",
"deployedSourceMap": "75:2077:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;225:67;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;965:621;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;1806:344;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;225:67;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;965:621::-;1054:10;1042:22;;:8;:22;;;;1033:58;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1130:1;1110:22;;:8;:22;;;;1101:57;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1168:23;1194:10;:22;1205:10;1194:22;;;;;;;;;;;;;;;:26;1217:2;1194:26;;;;;;;;;;;;;;;;;;;;;1168:52;;1251:15;1239:27;;:8;:27;;;;1230:74;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1389:8;1360:10;:22;1371:10;1360:22;;;;;;;;;;;;;;;:26;1383:2;1360:26;;;;;;;;;;;;:37;;;;;;;;;;;;;;;;;;1447:1;1420:29;;:15;:29;;;1416:111;;1500:15;1470:46;;1496:2;1484:10;1470:46;;;;;;;;;;;;1416:111;1570:8;1542:37;;1566:2;1554:10;1542:37;;;;;;;;;;;;965:621;;;:::o;1806:344::-;1858:23;1884:10;:22;1895:10;1884:22;;;;;;;;;;;;;;;:26;1907:2;1884:26;;;;;;;;;;;;;;;;;;;;;1858:52;;1956:1;1929:29;;:15;:29;;;;1920:58;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2071:1;2034:10;:22;2045:10;2034:22;;;;;;;;;;;;;;;:26;2057:2;2034:26;;;;;;;;;;;;:39;;;;;;;;;;;;;;;;;;2127:15;2097:46;;2123:2;2111:10;2097:46;;;;;;;;;;;;1806:344;;:::o",
"source": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.8.0;\n\ncontract DelegateRegistry {\n \n // The first key is the delegator and the second key a id. \n // The value is the address of the delegate \n mapping (address => mapping (bytes32 => address)) public delegation;\n \n // Using these events it is possible to process the events to build up reverse lookups.\n // The indeces allow it to be very partial about how to build this lookup (e.g. only for a specific delegate).\n event SetDelegate(address indexed delegator, bytes32 indexed id, address indexed delegate);\n event ClearDelegate(address indexed delegator, bytes32 indexed id, address indexed delegate);\n \n /// @dev Sets a delegate for the msg.sender and a specific id.\n /// The combination of msg.sender and the id can be seen as a unique key.\n /// @param id Id for which the delegate should be set\n /// @param delegate Address of the delegate\n function setDelegate(bytes32 id, address delegate) public {\n require (delegate != msg.sender, \"Can't delegate to self\");\n require (delegate != address(0), \"Can't delegate to 0x0\");\n address currentDelegate = delegation[msg.sender][id];\n require (delegate != currentDelegate, \"Already delegated to this address\");\n \n // Update delegation mapping\n delegation[msg.sender][id] = delegate;\n \n if (currentDelegate != address(0)) {\n emit ClearDelegate(msg.sender, id, currentDelegate);\n }\n\n emit SetDelegate(msg.sender, id, delegate);\n }\n \n /// @dev Clears a delegate for the msg.sender and a specific id.\n /// The combination of msg.sender and the id can be seen as a unique key.\n /// @param id Id for which the delegate should be set\n function clearDelegate(bytes32 id) public {\n address currentDelegate = delegation[msg.sender][id];\n require (currentDelegate != address(0), \"No delegate set\");\n \n // update delegation mapping\n delegation[msg.sender][id] = address(0);\n \n emit ClearDelegate(msg.sender, id, currentDelegate);\n }\n}",
"sourcePath": "/Users/moaazalthahabee/Documents/Repositories/delegate-registry/contracts/DelegateRegistry.sol",
"ast": {
"absolutePath": "/Users/moaazalthahabee/Documents/Repositories/delegate-registry/contracts/DelegateRegistry.sol",
"exportedSymbols": {
"DelegateRegistry": [
143
]
},
"id": 144,
"license": "LGPL-3.0-only",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1,
"literals": [
"solidity",
">=",
"0.7",
".0",
"<",
"0.8",
".0"
],
"nodeType": "PragmaDirective",
"src": "42:31:0"
},
{
"abstract": false,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"fullyImplemented": true,
"id": 143,
"linearizedBaseContracts": [
143
],
"name": "DelegateRegistry",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": false,
"functionSelector": "74c6c454",
"id": 7,
"mutability": "mutable",
"name": "delegation",
"nodeType": "VariableDeclaration",
"scope": 143,
"src": "225:67:0",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_bytes32_$_t_address_$_$",
"typeString": "mapping(address => mapping(bytes32 => address))"
},
"typeName": {
"id": 6,
"keyType": {
"id": 2,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "234:7:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Mapping",
"src": "225:49:0",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_bytes32_$_t_address_$_$",
"typeString": "mapping(address => mapping(bytes32 => address))"
},
"valueType": {
"id": 5,
"keyType": {
"id": 3,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "254:7:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"nodeType": "Mapping",
"src": "245:28:0",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_address_$",
"typeString": "mapping(bytes32 => address)"
},
"valueType": {
"id": 4,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "265:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
}
},
"visibility": "public"
},
{
"anonymous": false,
"id": 15,
"name": "SetDelegate",
"nodeType": "EventDefinition",
"parameters": {
"id": 14,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 9,
"indexed": true,
"mutability": "mutable",
"name": "delegator",
"nodeType": "VariableDeclaration",
"scope": 15,
"src": "528:25:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 8,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "528:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 11,
"indexed": true,
"mutability": "mutable",
"name": "id",
"nodeType": "VariableDeclaration",
"scope": 15,
"src": "555:18:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 10,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "555:7:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 13,
"indexed": true,
"mutability": "mutable",
"name": "delegate",
"nodeType": "VariableDeclaration",
"scope": 15,
"src": "575:24:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 12,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "575:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "527:73:0"
},
"src": "510:91:0"
},
{
"anonymous": false,
"id": 23,
"name": "ClearDelegate",
"nodeType": "EventDefinition",
"parameters": {
"id": 22,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 17,
"indexed": true,
"mutability": "mutable",
"name": "delegator",
"nodeType": "VariableDeclaration",
"scope": 23,
"src": "626:25:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 16,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "626:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 19,
"indexed": true,
"mutability": "mutable",
"name": "id",
"nodeType": "VariableDeclaration",
"scope": 23,
"src": "653:18:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 18,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "653:7:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 21,
"indexed": true,
"mutability": "mutable",
"name": "delegate",
"nodeType": "VariableDeclaration",
"scope": 23,
"src": "673:24:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 20,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "673:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "625:73:0"
},
"src": "606:93:0"
},
{
"body": {
"id": 96,
"nodeType": "Block",
"src": "1023:563:0",
"statements": [
{
"expression": {
"arguments": [
{
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 35,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 32,
"name": "delegate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 28,
"src": "1042:8:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"expression": {
"id": 33,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -15,
"src": "1054:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 34,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"src": "1054:10:0",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"src": "1042:22:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"hexValue": "43616e27742064656c656761746520746f2073656c66",
"id": 36,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1066:24:0",
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_5035307d70ed84558309ed7fc8f6da544cc0b07707e66bbbcf66762e48f302e3",
"typeString": "literal_string \"Can't delegate to self\""
},
"value": "Can't delegate to self"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_5035307d70ed84558309ed7fc8f6da544cc0b07707e66bbbcf66762e48f302e3",
"typeString": "literal_string \"Can't delegate to self\""
}
],
"id": 31,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "1033:7:0",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 37,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1033:58:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 38,
"nodeType": "ExpressionStatement",
"src": "1033:58:0"
},
{
"expression": {
"arguments": [
{
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 45,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 40,
"name": "delegate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 28,
"src": "1110:8:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"arguments": [
{
"hexValue": "30",
"id": 43,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1130:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
}
],
"id": 42,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1122:7:0",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 41,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1122:7:0",
"typeDescriptions": {}
}
},
"id": 44,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1122:10:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"src": "1110:22:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"hexValue": "43616e27742064656c656761746520746f20307830",
"id": 46,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1134:23:0",
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_82ef33feeb6ae0784601712b22163bd2e4b11d53a6e0c6d6f6a4cdf326d396a8",
"typeString": "literal_string \"Can't delegate to 0x0\""
},
"value": "Can't delegate to 0x0"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_82ef33feeb6ae0784601712b22163bd2e4b11d53a6e0c6d6f6a4cdf326d396a8",
"typeString": "literal_string \"Can't delegate to 0x0\""
}
],
"id": 39,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "1101:7:0",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 47,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1101:57:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 48,
"nodeType": "ExpressionStatement",
"src": "1101:57:0"
},
{
"assignments": [
50
],
"declarations": [
{
"constant": false,
"id": 50,
"mutability": "mutable",
"name": "currentDelegate",
"nodeType": "VariableDeclaration",
"scope": 96,
"src": "1168:23:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 49,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1168:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"id": 57,
"initialValue": {
"baseExpression": {
"baseExpression": {
"id": 51,
"name": "delegation",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 7,
"src": "1194:10:0",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_bytes32_$_t_address_$_$",
"typeString": "mapping(address => mapping(bytes32 => address))"
}
},
"id": 54,
"indexExpression": {
"expression": {
"id": 52,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -15,
"src": "1205:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 53,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"src": "1205:10:0",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "1194:22:0",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_address_$",
"typeString": "mapping(bytes32 => address)"
}
},
"id": 56,
"indexExpression": {
"id": 55,
"name": "id",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 26,
"src": "1217:2:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "1194:26:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1168:52:0"
},
{
"expression": {
"arguments": [
{
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 61,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 59,
"name": "delegate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 28,
"src": "1239:8:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"id": 60,
"name": "currentDelegate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 50,
"src": "1251:15:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "1239:27:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"hexValue": "416c72656164792064656c65676174656420746f20746869732061646472657373",
"id": 62,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1268:35:0",
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_9e7ccb90f4fc3502f47815618f041ee685bbd94029654e8a15b0622b5f877c41",
"typeString": "literal_string \"Already delegated to this address\""
},
"value": "Already delegated to this address"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_9e7ccb90f4fc3502f47815618f041ee685bbd94029654e8a15b0622b5f877c41",
"typeString": "literal_string \"Already delegated to this address\""
}
],
"id": 58,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "1230:7:0",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 63,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1230:74:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 64,
"nodeType": "ExpressionStatement",
"src": "1230:74:0"
},
{
"expression": {
"id": 72,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"baseExpression": {
"baseExpression": {
"id": 65,
"name": "delegation",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 7,
"src": "1360:10:0",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_bytes32_$_t_address_$_$",
"typeString": "mapping(address => mapping(bytes32 => address))"
}
},
"id": 69,
"indexExpression": {
"expression": {
"id": 66,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -15,
"src": "1371:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 67,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"src": "1371:10:0",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "1360:22:0",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_address_$",
"typeString": "mapping(bytes32 => address)"
}
},
"id": 70,
"indexExpression": {
"id": 68,
"name": "id",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 26,
"src": "1383:2:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "IndexAccess",
"src": "1360:26:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"id": 71,
"name": "delegate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 28,
"src": "1389:8:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "1360:37:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 73,
"nodeType": "ExpressionStatement",
"src": "1360:37:0"
},
{
"condition": {
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 79,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 74,
"name": "currentDelegate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 50,
"src": "1420:15:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"arguments": [
{
"hexValue": "30",
"id": 77,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1447:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
}
],
"id": 76,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1439:7:0",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 75,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1439:7:0",
"typeDescriptions": {}
}
},
"id": 78,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1439:10:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"src": "1420:29:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 88,
"nodeType": "IfStatement",
"src": "1416:111:0",
"trueBody": {
"id": 87,
"nodeType": "Block",
"src": "1451:76:0",
"statements": [
{
"eventCall": {
"arguments": [
{
"expression": {
"id": 81,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -15,
"src": "1484:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 82,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"src": "1484:10:0",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
{
"id": 83,
"name": "id",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 26,
"src": "1496:2:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
{
"id": 84,
"name": "currentDelegate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 50,
"src": "1500:15:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 80,
"name": "ClearDelegate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 23,
"src": "1470:13:0",
"typeDescriptions": {
"typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_bytes32_$_t_address_$returns$__$",
"typeString": "function (address,bytes32,address)"
}
},
"id": 85,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1470:46:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 86,
"nodeType": "EmitStatement",
"src": "1465:51:0"
}
]
}
},
{
"eventCall": {
"arguments": [
{
"expression": {
"id": 90,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -15,
"src": "1554:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 91,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"src": "1554:10:0",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
{
"id": 92,
"name": "id",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 26,
"src": "1566:2:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
{
"id": 93,
"name": "delegate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 28,
"src": "1570:8:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 89,
"name": "SetDelegate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 15,
"src": "1542:11:0",
"typeDescriptions": {
"typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_bytes32_$_t_address_$returns$__$",
"typeString": "function (address,bytes32,address)"
}
},
"id": 94,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1542:37:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 95,
"nodeType": "EmitStatement",
"src": "1537:42:0"
}
]
},
"documentation": {
"id": 24,
"nodeType": "StructuredDocumentation",
"src": "709:251:0",
"text": "@dev Sets a delegate for the msg.sender and a specific id.\n The combination of msg.sender and the id can be seen as a unique key.\n @param id Id for which the delegate should be set\n @param delegate Address of the delegate"
},
"functionSelector": "bd86e508",
"id": 97,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "setDelegate",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 29,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 26,
"mutability": "mutable",
"name": "id",
"nodeType": "VariableDeclaration",
"scope": 97,
"src": "986:10:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 25,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "986:7:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 28,
"mutability": "mutable",
"name": "delegate",
"nodeType": "VariableDeclaration",
"scope": 97,
"src": "998:16:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 27,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "998:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "985:30:0"
},
"returnParameters": {
"id": 30,
"nodeType": "ParameterList",
"parameters": [],
"src": "1023:0:0"
},
"scope": 143,
"src": "965:621:0",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "public"
},
{
"body": {
"id": 141,
"nodeType": "Block",
"src": "1848:302:0",
"statements": [
{
"assignments": [
104
],
"declarations": [
{
"constant": false,
"id": 104,
"mutability": "mutable",
"name": "currentDelegate",
"nodeType": "VariableDeclaration",
"scope": 141,
"src": "1858:23:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 103,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1858:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"id": 111,
"initialValue": {
"baseExpression": {
"baseExpression": {
"id": 105,
"name": "delegation",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 7,
"src": "1884:10:0",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_bytes32_$_t_address_$_$",
"typeString": "mapping(address => mapping(bytes32 => address))"
}
},
"id": 108,
"indexExpression": {
"expression": {
"id": 106,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -15,
"src": "1895:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 107,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"src": "1895:10:0",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "1884:22:0",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_address_$",
"typeString": "mapping(bytes32 => address)"
}
},
"id": 110,
"indexExpression": {
"id": 109,
"name": "id",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 100,
"src": "1907:2:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "1884:26:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1858:52:0"
},
{
"expression": {
"arguments": [
{
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 118,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 113,
"name": "currentDelegate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 104,
"src": "1929:15:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"arguments": [
{
"hexValue": "30",
"id": 116,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1956:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
}
],
"id": 115,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1948:7:0",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 114,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1948:7:0",
"typeDescriptions": {}
}
},
"id": 117,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1948:10:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"src": "1929:29:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"hexValue": "4e6f2064656c656761746520736574",
"id": 119,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1960:17:0",
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_cfbb4dc7139fe2cdb7822efd476656db7563fd5bb749dcbb40f2d7c1caead919",
"typeString": "literal_string \"No delegate set\""
},
"value": "No delegate set"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_cfbb4dc7139fe2cdb7822efd476656db7563fd5bb749dcbb40f2d7c1caead919",
"typeString": "literal_string \"No delegate set\""
}
],
"id": 112,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "1920:7:0",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 120,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1920:58:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 121,
"nodeType": "ExpressionStatement",
"src": "1920:58:0"
},
{
"expression": {
"id": 132,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"baseExpression": {
"baseExpression": {
"id": 122,
"name": "delegation",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 7,
"src": "2034:10:0",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_bytes32_$_t_address_$_$",
"typeString": "mapping(address => mapping(bytes32 => address))"
}
},
"id": 126,
"indexExpression": {
"expression": {
"id": 123,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -15,
"src": "2045:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 124,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"src": "2045:10:0",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "2034:22:0",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_address_$",
"typeString": "mapping(bytes32 => address)"
}
},
"id": 127,
"indexExpression": {
"id": 125,
"name": "id",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 100,
"src": "2057:2:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "IndexAccess",
"src": "2034:26:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"arguments": [
{
"hexValue": "30",
"id": 130,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2071:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
}
],
"id": 129,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "2063:7:0",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 128,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "2063:7:0",
"typeDescriptions": {}
}
},
"id": 131,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2063:10:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"src": "2034:39:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 133,
"nodeType": "ExpressionStatement",
"src": "2034:39:0"
},
{
"eventCall": {
"arguments": [
{
"expression": {
"id": 135,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -15,
"src": "2111:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 136,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"src": "2111:10:0",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
{
"id": 137,
"name": "id",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 100,
"src": "2123:2:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
{
"id": 138,
"name": "currentDelegate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 104,
"src": "2127:15:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 134,
"name": "ClearDelegate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 23,
"src": "2097:13:0",
"typeDescriptions": {
"typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_bytes32_$_t_address_$returns$__$",
"typeString": "function (address,bytes32,address)"
}
},
"id": 139,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2097:46:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 140,
"nodeType": "EmitStatement",
"src": "2092:51:0"
}
]
},
"documentation": {
"id": 98,
"nodeType": "StructuredDocumentation",
"src": "1596:205:0",
"text": "@dev Clears a delegate for the msg.sender and a specific id.\n The combination of msg.sender and the id can be seen as a unique key.\n @param id Id for which the delegate should be set"
},
"functionSelector": "f0bedbe2",
"id": 142,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "clearDelegate",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 101,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 100,
"mutability": "mutable",
"name": "id",
"nodeType": "VariableDeclaration",
"scope": 142,
"src": "1829:10:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 99,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "1829:7:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"visibility": "internal"
}
],
"src": "1828:12:0"
},
"returnParameters": {
"id": 102,
"nodeType": "ParameterList",
"parameters": [],
"src": "1848:0:0"
},
"scope": 143,
"src": "1806:344:0",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "public"
}
],
"scope": 144,
"src": "75:2077:0"
}
],
"src": "42:2110:0"
},
"legacyAST": {
"absolutePath": "/Users/moaazalthahabee/Documents/Repositories/delegate-registry/contracts/DelegateRegistry.sol",
"exportedSymbols": {
"DelegateRegistry": [
143
]
},
"id": 144,
"license": "LGPL-3.0-only",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1,
"literals": [
"solidity",
">=",
"0.7",
".0",
"<",
"0.8",
".0"
],
"nodeType": "PragmaDirective",
"src": "42:31:0"
},
{
"abstract": false,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"fullyImplemented": true,
"id": 143,
"linearizedBaseContracts": [
143
],
"name": "DelegateRegistry",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": false,
"functionSelector": "74c6c454",
"id": 7,
"mutability": "mutable",
"name": "delegation",
"nodeType": "VariableDeclaration",
"scope": 143,
"src": "225:67:0",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_bytes32_$_t_address_$_$",
"typeString": "mapping(address => mapping(bytes32 => address))"
},
"typeName": {
"id": 6,
"keyType": {
"id": 2,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "234:7:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Mapping",
"src": "225:49:0",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_bytes32_$_t_address_$_$",
"typeString": "mapping(address => mapping(bytes32 => address))"
},
"valueType": {
"id": 5,
"keyType": {
"id": 3,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "254:7:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"nodeType": "Mapping",
"src": "245:28:0",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_address_$",
"typeString": "mapping(bytes32 => address)"
},
"valueType": {
"id": 4,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "265:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
}
},
"visibility": "public"
},
{
"anonymous": false,
"id": 15,
"name": "SetDelegate",
"nodeType": "EventDefinition",
"parameters": {
"id": 14,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 9,
"indexed": true,
"mutability": "mutable",
"name": "delegator",
"nodeType": "VariableDeclaration",
"scope": 15,
"src": "528:25:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 8,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "528:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 11,
"indexed": true,
"mutability": "mutable",
"name": "id",
"nodeType": "VariableDeclaration",
"scope": 15,
"src": "555:18:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 10,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "555:7:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 13,
"indexed": true,
"mutability": "mutable",
"name": "delegate",
"nodeType": "VariableDeclaration",
"scope": 15,
"src": "575:24:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 12,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "575:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "527:73:0"
},
"src": "510:91:0"
},
{
"anonymous": false,
"id": 23,
"name": "ClearDelegate",
"nodeType": "EventDefinition",
"parameters": {
"id": 22,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 17,
"indexed": true,
"mutability": "mutable",
"name": "delegator",
"nodeType": "VariableDeclaration",
"scope": 23,
"src": "626:25:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 16,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "626:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 19,
"indexed": true,
"mutability": "mutable",
"name": "id",
"nodeType": "VariableDeclaration",
"scope": 23,
"src": "653:18:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 18,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "653:7:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 21,
"indexed": true,
"mutability": "mutable",
"name": "delegate",
"nodeType": "VariableDeclaration",
"scope": 23,
"src": "673:24:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 20,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "673:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "625:73:0"
},
"src": "606:93:0"
},
{
"body": {
"id": 96,
"nodeType": "Block",
"src": "1023:563:0",
"statements": [
{
"expression": {
"arguments": [
{
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 35,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 32,
"name": "delegate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 28,
"src": "1042:8:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"expression": {
"id": 33,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -15,
"src": "1054:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 34,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"src": "1054:10:0",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"src": "1042:22:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"hexValue": "43616e27742064656c656761746520746f2073656c66",
"id": 36,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1066:24:0",
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_5035307d70ed84558309ed7fc8f6da544cc0b07707e66bbbcf66762e48f302e3",
"typeString": "literal_string \"Can't delegate to self\""
},
"value": "Can't delegate to self"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_5035307d70ed84558309ed7fc8f6da544cc0b07707e66bbbcf66762e48f302e3",
"typeString": "literal_string \"Can't delegate to self\""
}
],
"id": 31,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "1033:7:0",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 37,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1033:58:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 38,
"nodeType": "ExpressionStatement",
"src": "1033:58:0"
},
{
"expression": {
"arguments": [
{
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 45,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 40,
"name": "delegate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 28,
"src": "1110:8:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"arguments": [
{
"hexValue": "30",
"id": 43,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1130:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
}
],
"id": 42,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1122:7:0",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 41,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1122:7:0",
"typeDescriptions": {}
}
},
"id": 44,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1122:10:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"src": "1110:22:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"hexValue": "43616e27742064656c656761746520746f20307830",
"id": 46,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1134:23:0",
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_82ef33feeb6ae0784601712b22163bd2e4b11d53a6e0c6d6f6a4cdf326d396a8",
"typeString": "literal_string \"Can't delegate to 0x0\""
},
"value": "Can't delegate to 0x0"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_82ef33feeb6ae0784601712b22163bd2e4b11d53a6e0c6d6f6a4cdf326d396a8",
"typeString": "literal_string \"Can't delegate to 0x0\""
}
],
"id": 39,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "1101:7:0",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 47,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1101:57:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 48,
"nodeType": "ExpressionStatement",
"src": "1101:57:0"
},
{
"assignments": [
50
],
"declarations": [
{
"constant": false,
"id": 50,
"mutability": "mutable",
"name": "currentDelegate",
"nodeType": "VariableDeclaration",
"scope": 96,
"src": "1168:23:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 49,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1168:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"id": 57,
"initialValue": {
"baseExpression": {
"baseExpression": {
"id": 51,
"name": "delegation",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 7,
"src": "1194:10:0",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_bytes32_$_t_address_$_$",
"typeString": "mapping(address => mapping(bytes32 => address))"
}
},
"id": 54,
"indexExpression": {
"expression": {
"id": 52,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -15,
"src": "1205:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 53,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"src": "1205:10:0",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "1194:22:0",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_address_$",
"typeString": "mapping(bytes32 => address)"
}
},
"id": 56,
"indexExpression": {
"id": 55,
"name": "id",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 26,
"src": "1217:2:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "1194:26:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1168:52:0"
},
{
"expression": {
"arguments": [
{
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 61,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 59,
"name": "delegate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 28,
"src": "1239:8:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"id": 60,
"name": "currentDelegate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 50,
"src": "1251:15:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "1239:27:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"hexValue": "416c72656164792064656c65676174656420746f20746869732061646472657373",
"id": 62,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1268:35:0",
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_9e7ccb90f4fc3502f47815618f041ee685bbd94029654e8a15b0622b5f877c41",
"typeString": "literal_string \"Already delegated to this address\""
},
"value": "Already delegated to this address"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_9e7ccb90f4fc3502f47815618f041ee685bbd94029654e8a15b0622b5f877c41",
"typeString": "literal_string \"Already delegated to this address\""
}
],
"id": 58,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "1230:7:0",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 63,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1230:74:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 64,
"nodeType": "ExpressionStatement",
"src": "1230:74:0"
},
{
"expression": {
"id": 72,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"baseExpression": {
"baseExpression": {
"id": 65,
"name": "delegation",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 7,
"src": "1360:10:0",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_bytes32_$_t_address_$_$",
"typeString": "mapping(address => mapping(bytes32 => address))"
}
},
"id": 69,
"indexExpression": {
"expression": {
"id": 66,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -15,
"src": "1371:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 67,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"src": "1371:10:0",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "1360:22:0",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_address_$",
"typeString": "mapping(bytes32 => address)"
}
},
"id": 70,
"indexExpression": {
"id": 68,
"name": "id",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 26,
"src": "1383:2:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "IndexAccess",
"src": "1360:26:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"id": 71,
"name": "delegate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 28,
"src": "1389:8:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "1360:37:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 73,
"nodeType": "ExpressionStatement",
"src": "1360:37:0"
},
{
"condition": {
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 79,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 74,
"name": "currentDelegate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 50,
"src": "1420:15:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"arguments": [
{
"hexValue": "30",
"id": 77,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1447:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
}
],
"id": 76,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1439:7:0",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 75,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1439:7:0",
"typeDescriptions": {}
}
},
"id": 78,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1439:10:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"src": "1420:29:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 88,
"nodeType": "IfStatement",
"src": "1416:111:0",
"trueBody": {
"id": 87,
"nodeType": "Block",
"src": "1451:76:0",
"statements": [
{
"eventCall": {
"arguments": [
{
"expression": {
"id": 81,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -15,
"src": "1484:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 82,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"src": "1484:10:0",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
{
"id": 83,
"name": "id",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 26,
"src": "1496:2:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
{
"id": 84,
"name": "currentDelegate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 50,
"src": "1500:15:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 80,
"name": "ClearDelegate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 23,
"src": "1470:13:0",
"typeDescriptions": {
"typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_bytes32_$_t_address_$returns$__$",
"typeString": "function (address,bytes32,address)"
}
},
"id": 85,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1470:46:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 86,
"nodeType": "EmitStatement",
"src": "1465:51:0"
}
]
}
},
{
"eventCall": {
"arguments": [
{
"expression": {
"id": 90,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -15,
"src": "1554:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 91,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"src": "1554:10:0",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
{
"id": 92,
"name": "id",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 26,
"src": "1566:2:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
{
"id": 93,
"name": "delegate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 28,
"src": "1570:8:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 89,
"name": "SetDelegate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 15,
"src": "1542:11:0",
"typeDescriptions": {
"typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_bytes32_$_t_address_$returns$__$",
"typeString": "function (address,bytes32,address)"
}
},
"id": 94,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1542:37:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 95,
"nodeType": "EmitStatement",
"src": "1537:42:0"
}
]
},
"documentation": {
"id": 24,
"nodeType": "StructuredDocumentation",
"src": "709:251:0",
"text": "@dev Sets a delegate for the msg.sender and a specific id.\n The combination of msg.sender and the id can be seen as a unique key.\n @param id Id for which the delegate should be set\n @param delegate Address of the delegate"
},
"functionSelector": "bd86e508",
"id": 97,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "setDelegate",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 29,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 26,
"mutability": "mutable",
"name": "id",
"nodeType": "VariableDeclaration",
"scope": 97,
"src": "986:10:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 25,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "986:7:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 28,
"mutability": "mutable",
"name": "delegate",
"nodeType": "VariableDeclaration",
"scope": 97,
"src": "998:16:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 27,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "998:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "985:30:0"
},
"returnParameters": {
"id": 30,
"nodeType": "ParameterList",
"parameters": [],
"src": "1023:0:0"
},
"scope": 143,
"src": "965:621:0",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "public"
},
{
"body": {
"id": 141,
"nodeType": "Block",
"src": "1848:302:0",
"statements": [
{
"assignments": [
104
],
"declarations": [
{
"constant": false,
"id": 104,
"mutability": "mutable",
"name": "currentDelegate",
"nodeType": "VariableDeclaration",
"scope": 141,
"src": "1858:23:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 103,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1858:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"id": 111,
"initialValue": {
"baseExpression": {
"baseExpression": {
"id": 105,
"name": "delegation",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 7,
"src": "1884:10:0",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_bytes32_$_t_address_$_$",
"typeString": "mapping(address => mapping(bytes32 => address))"
}
},
"id": 108,
"indexExpression": {
"expression": {
"id": 106,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -15,
"src": "1895:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 107,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"src": "1895:10:0",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "1884:22:0",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_address_$",
"typeString": "mapping(bytes32 => address)"
}
},
"id": 110,
"indexExpression": {
"id": 109,
"name": "id",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 100,
"src": "1907:2:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "1884:26:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1858:52:0"
},
{
"expression": {
"arguments": [
{
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 118,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 113,
"name": "currentDelegate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 104,
"src": "1929:15:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"arguments": [
{
"hexValue": "30",
"id": 116,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1956:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
}
],
"id": 115,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1948:7:0",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 114,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1948:7:0",
"typeDescriptions": {}
}
},
"id": 117,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1948:10:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"src": "1929:29:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"hexValue": "4e6f2064656c656761746520736574",
"id": 119,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1960:17:0",
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_cfbb4dc7139fe2cdb7822efd476656db7563fd5bb749dcbb40f2d7c1caead919",
"typeString": "literal_string \"No delegate set\""
},
"value": "No delegate set"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_cfbb4dc7139fe2cdb7822efd476656db7563fd5bb749dcbb40f2d7c1caead919",
"typeString": "literal_string \"No delegate set\""
}
],
"id": 112,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "1920:7:0",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 120,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1920:58:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 121,
"nodeType": "ExpressionStatement",
"src": "1920:58:0"
},
{
"expression": {
"id": 132,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"baseExpression": {
"baseExpression": {
"id": 122,
"name": "delegation",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 7,
"src": "2034:10:0",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_bytes32_$_t_address_$_$",
"typeString": "mapping(address => mapping(bytes32 => address))"
}
},
"id": 126,
"indexExpression": {
"expression": {
"id": 123,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -15,
"src": "2045:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 124,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"src": "2045:10:0",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "2034:22:0",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_address_$",
"typeString": "mapping(bytes32 => address)"
}
},
"id": 127,
"indexExpression": {
"id": 125,
"name": "id",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 100,
"src": "2057:2:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "IndexAccess",
"src": "2034:26:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"arguments": [
{
"hexValue": "30",
"id": 130,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2071:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
}
],
"id": 129,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "2063:7:0",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 128,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "2063:7:0",
"typeDescriptions": {}
}
},
"id": 131,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2063:10:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"src": "2034:39:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 133,
"nodeType": "ExpressionStatement",
"src": "2034:39:0"
},
{
"eventCall": {
"arguments": [
{
"expression": {
"id": 135,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -15,
"src": "2111:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 136,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"src": "2111:10:0",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
{
"id": 137,
"name": "id",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 100,
"src": "2123:2:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
{
"id": 138,
"name": "currentDelegate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 104,
"src": "2127:15:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 134,
"name": "ClearDelegate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 23,
"src": "2097:13:0",
"typeDescriptions": {
"typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_bytes32_$_t_address_$returns$__$",
"typeString": "function (address,bytes32,address)"
}
},
"id": 139,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2097:46:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 140,
"nodeType": "EmitStatement",
"src": "2092:51:0"
}
]
},
"documentation": {
"id": 98,
"nodeType": "StructuredDocumentation",
"src": "1596:205:0",
"text": "@dev Clears a delegate for the msg.sender and a specific id.\n The combination of msg.sender and the id can be seen as a unique key.\n @param id Id for which the delegate should be set"
},
"functionSelector": "f0bedbe2",
"id": 142,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "clearDelegate",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 101,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 100,
"mutability": "mutable",
"name": "id",
"nodeType": "VariableDeclaration",
"scope": 142,
"src": "1829:10:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 99,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "1829:7:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"visibility": "internal"
}
],
"src": "1828:12:0"
},
"returnParameters": {
"id": 102,
"nodeType": "ParameterList",
"parameters": [],
"src": "1848:0:0"
},
"scope": 143,
"src": "1806:344:0",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "public"
}
],
"scope": 144,
"src": "75:2077:0"
}
],
"src": "42:2110:0"
},
"compiler": {
"name": "solc",
"version": "0.7.2+commit.51b20bc0.Emscripten.clang"
},
"networks": {
"4": {
"events": {
"0x9c4f00c4291262731946e308dc2979a56bd22cce8f95906b975065e96cd5a064": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "delegator",
"type": "address"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "id",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "delegate",
"type": "address"
}
],
"name": "ClearDelegate",
"type": "event"
},
"0xa9a7fd460f56bddb880a465a9c3e9730389c70bc53108148f16d55a87a6c468e": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "delegator",
"type": "address"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "id",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "delegate",
"type": "address"
}
],
"name": "SetDelegate",
"type": "event"
}
},
"links": {},
"address": "0x469788fE6E9E9681C6ebF3bF78e7Fd26Fc015446",
"transactionHash": "0x6987fb77279d3df3177c62e20520a8735a07a2342b5eb8ad0f978958d8656979"
},
"42": {
"events": {
"0x9c4f00c4291262731946e308dc2979a56bd22cce8f95906b975065e96cd5a064": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "delegator",
"type": "address"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "id",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "delegate",
"type": "address"
}
],
"name": "ClearDelegate",
"type": "event"
},
"0xa9a7fd460f56bddb880a465a9c3e9730389c70bc53108148f16d55a87a6c468e": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "delegator",
"type": "address"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "id",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "delegate",
"type": "address"
}
],
"name": "SetDelegate",
"type": "event"
}
},
"links": {},
"address": "0x469788fE6E9E9681C6ebF3bF78e7Fd26Fc015446",
"transactionHash": "0x983f6a0fab4cfdd3d6cadd0b865a0366b3069d5b5622d1b95c1e3e77f45046bb"
}
},
"schemaVersion": "3.3.0",
"updatedAt": "2022-06-22T11:48:02.807Z",
"devdoc": {
"kind": "dev",
"methods": {
"clearDelegate(bytes32)": {
"details": "Clears a delegate for the msg.sender and a specific id. The combination of msg.sender and the id can be seen as a unique key.",
"params": {
"id": "Id for which the delegate should be set"
}
},
"setDelegate(bytes32,address)": {
"details": "Sets a delegate for the msg.sender and a specific id. The combination of msg.sender and the id can be seen as a unique key.",
"params": {
"delegate": "Address of the delegate",
"id": "Id for which the delegate should be set"
}
}
},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
}