You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1688 lines
67 KiB
JSON
1688 lines
67 KiB
JSON
3 years ago
|
{
|
||
|
"contractName": "Counters",
|
||
|
"abi": [],
|
||
|
"metadata": "{\"compiler\":{\"version\":\"0.8.11+commit.d7f03943\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Matt Condon (@shrugs)\",\"details\":\"Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number of elements in a mapping, issuing ERC721 ids, or counting request ids. Include with `using Counters for Counters.Counter;`\",\"kind\":\"dev\",\"methods\":{},\"title\":\"Counters\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/Counters.sol\":\"Counters\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/Counters.sol\":{\"keccak256\":\"0xf0018c2440fbe238dd3a8732fa8e17a0f9dce84d31451dc8a32f6d62b349c9f1\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://59e1c62884d55b70f3ae5432b44bb3166ad71ae3acd19c57ab6ddc3c87c325ee\",\"dweb:/ipfs/QmezuXg5GK5oeA4F91EZhozBFekhq5TD966bHPH18cCqhu\"]}},\"version\":1}",
|
||
|
"bytecode": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122023510280639f1987959a3a3f8fd335c3ebdb9e1a5eec465f08f1e0b67a895eeb64736f6c634300080b0033",
|
||
|
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122023510280639f1987959a3a3f8fd335c3ebdb9e1a5eec465f08f1e0b67a895eeb64736f6c634300080b0033",
|
||
|
"immutableReferences": {},
|
||
|
"generatedSources": [],
|
||
|
"deployedGeneratedSources": [],
|
||
|
"sourceMap": "424:971:8:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;424:971:8;;;;;;;;;;;;;;;;;",
|
||
|
"deployedSourceMap": "424:971:8:-:0;;;;;;;;",
|
||
|
"source": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary Counters {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n",
|
||
|
"sourcePath": "@openzeppelin/contracts/utils/Counters.sol",
|
||
|
"ast": {
|
||
|
"absolutePath": "@openzeppelin/contracts/utils/Counters.sol",
|
||
|
"exportedSymbols": {
|
||
|
"Counters": [
|
||
|
1617
|
||
|
]
|
||
|
},
|
||
|
"id": 1618,
|
||
|
"license": "MIT",
|
||
|
"nodeType": "SourceUnit",
|
||
|
"nodes": [
|
||
|
{
|
||
|
"id": 1545,
|
||
|
"literals": [
|
||
|
"solidity",
|
||
|
"^",
|
||
|
"0.8",
|
||
|
".0"
|
||
|
],
|
||
|
"nodeType": "PragmaDirective",
|
||
|
"src": "87:23:8"
|
||
|
},
|
||
|
{
|
||
|
"abstract": false,
|
||
|
"baseContracts": [],
|
||
|
"canonicalName": "Counters",
|
||
|
"contractDependencies": [],
|
||
|
"contractKind": "library",
|
||
|
"documentation": {
|
||
|
"id": 1546,
|
||
|
"nodeType": "StructuredDocumentation",
|
||
|
"src": "112:311:8",
|
||
|
"text": " @title Counters\n @author Matt Condon (@shrugs)\n @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n of elements in a mapping, issuing ERC721 ids, or counting request ids.\n Include with `using Counters for Counters.Counter;`"
|
||
|
},
|
||
|
"fullyImplemented": true,
|
||
|
"id": 1617,
|
||
|
"linearizedBaseContracts": [
|
||
|
1617
|
||
|
],
|
||
|
"name": "Counters",
|
||
|
"nameLocation": "432:8:8",
|
||
|
"nodeType": "ContractDefinition",
|
||
|
"nodes": [
|
||
|
{
|
||
|
"canonicalName": "Counters.Counter",
|
||
|
"id": 1549,
|
||
|
"members": [
|
||
|
{
|
||
|
"constant": false,
|
||
|
"id": 1548,
|
||
|
"mutability": "mutable",
|
||
|
"name": "_value",
|
||
|
"nameLocation": "794:6:8",
|
||
|
"nodeType": "VariableDeclaration",
|
||
|
"scope": 1549,
|
||
|
"src": "786:14:8",
|
||
|
"stateVariable": false,
|
||
|
"storageLocation": "default",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
},
|
||
|
"typeName": {
|
||
|
"id": 1547,
|
||
|
"name": "uint256",
|
||
|
"nodeType": "ElementaryTypeName",
|
||
|
"src": "786:7:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
}
|
||
|
},
|
||
|
"visibility": "internal"
|
||
|
}
|
||
|
],
|
||
|
"name": "Counter",
|
||
|
"nameLocation": "454:7:8",
|
||
|
"nodeType": "StructDefinition",
|
||
|
"scope": 1617,
|
||
|
"src": "447:374:8",
|
||
|
"visibility": "public"
|
||
|
},
|
||
|
{
|
||
|
"body": {
|
||
|
"id": 1560,
|
||
|
"nodeType": "Block",
|
||
|
"src": "901:38:8",
|
||
|
"statements": [
|
||
|
{
|
||
|
"expression": {
|
||
|
"expression": {
|
||
|
"id": 1557,
|
||
|
"name": "counter",
|
||
|
"nodeType": "Identifier",
|
||
|
"overloadedDeclarations": [],
|
||
|
"referencedDeclaration": 1552,
|
||
|
"src": "918:7:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_struct$_Counter_$1549_storage_ptr",
|
||
|
"typeString": "struct Counters.Counter storage pointer"
|
||
|
}
|
||
|
},
|
||
|
"id": 1558,
|
||
|
"isConstant": false,
|
||
|
"isLValue": true,
|
||
|
"isPure": false,
|
||
|
"lValueRequested": false,
|
||
|
"memberName": "_value",
|
||
|
"nodeType": "MemberAccess",
|
||
|
"referencedDeclaration": 1548,
|
||
|
"src": "918:14:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
}
|
||
|
},
|
||
|
"functionReturnParameters": 1556,
|
||
|
"id": 1559,
|
||
|
"nodeType": "Return",
|
||
|
"src": "911:21:8"
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
"id": 1561,
|
||
|
"implemented": true,
|
||
|
"kind": "function",
|
||
|
"modifiers": [],
|
||
|
"name": "current",
|
||
|
"nameLocation": "836:7:8",
|
||
|
"nodeType": "FunctionDefinition",
|
||
|
"parameters": {
|
||
|
"id": 1553,
|
||
|
"nodeType": "ParameterList",
|
||
|
"parameters": [
|
||
|
{
|
||
|
"constant": false,
|
||
|
"id": 1552,
|
||
|
"mutability": "mutable",
|
||
|
"name": "counter",
|
||
|
"nameLocation": "860:7:8",
|
||
|
"nodeType": "VariableDeclaration",
|
||
|
"scope": 1561,
|
||
|
"src": "844:23:8",
|
||
|
"stateVariable": false,
|
||
|
"storageLocation": "storage",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_struct$_Counter_$1549_storage_ptr",
|
||
|
"typeString": "struct Counters.Counter"
|
||
|
},
|
||
|
"typeName": {
|
||
|
"id": 1551,
|
||
|
"nodeType": "UserDefinedTypeName",
|
||
|
"pathNode": {
|
||
|
"id": 1550,
|
||
|
"name": "Counter",
|
||
|
"nodeType": "IdentifierPath",
|
||
|
"referencedDeclaration": 1549,
|
||
|
"src": "844:7:8"
|
||
|
},
|
||
|
"referencedDeclaration": 1549,
|
||
|
"src": "844:7:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_struct$_Counter_$1549_storage_ptr",
|
||
|
"typeString": "struct Counters.Counter"
|
||
|
}
|
||
|
},
|
||
|
"visibility": "internal"
|
||
|
}
|
||
|
],
|
||
|
"src": "843:25:8"
|
||
|
},
|
||
|
"returnParameters": {
|
||
|
"id": 1556,
|
||
|
"nodeType": "ParameterList",
|
||
|
"parameters": [
|
||
|
{
|
||
|
"constant": false,
|
||
|
"id": 1555,
|
||
|
"mutability": "mutable",
|
||
|
"name": "",
|
||
|
"nameLocation": "-1:-1:-1",
|
||
|
"nodeType": "VariableDeclaration",
|
||
|
"scope": 1561,
|
||
|
"src": "892:7:8",
|
||
|
"stateVariable": false,
|
||
|
"storageLocation": "default",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
},
|
||
|
"typeName": {
|
||
|
"id": 1554,
|
||
|
"name": "uint256",
|
||
|
"nodeType": "ElementaryTypeName",
|
||
|
"src": "892:7:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
}
|
||
|
},
|
||
|
"visibility": "internal"
|
||
|
}
|
||
|
],
|
||
|
"src": "891:9:8"
|
||
|
},
|
||
|
"scope": 1617,
|
||
|
"src": "827:112:8",
|
||
|
"stateMutability": "view",
|
||
|
"virtual": false,
|
||
|
"visibility": "internal"
|
||
|
},
|
||
|
{
|
||
|
"body": {
|
||
|
"id": 1574,
|
||
|
"nodeType": "Block",
|
||
|
"src": "998:70:8",
|
||
|
"statements": [
|
||
|
{
|
||
|
"id": 1573,
|
||
|
"nodeType": "UncheckedBlock",
|
||
|
"src": "1008:54:8",
|
||
|
"statements": [
|
||
|
{
|
||
|
"expression": {
|
||
|
"id": 1571,
|
||
|
"isConstant": false,
|
||
|
"isLValue": false,
|
||
|
"isPure": false,
|
||
|
"lValueRequested": false,
|
||
|
"leftHandSide": {
|
||
|
"expression": {
|
||
|
"id": 1567,
|
||
|
"name": "counter",
|
||
|
"nodeType": "Identifier",
|
||
|
"overloadedDeclarations": [],
|
||
|
"referencedDeclaration": 1564,
|
||
|
"src": "1032:7:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_struct$_Counter_$1549_storage_ptr",
|
||
|
"typeString": "struct Counters.Counter storage pointer"
|
||
|
}
|
||
|
},
|
||
|
"id": 1569,
|
||
|
"isConstant": false,
|
||
|
"isLValue": true,
|
||
|
"isPure": false,
|
||
|
"lValueRequested": true,
|
||
|
"memberName": "_value",
|
||
|
"nodeType": "MemberAccess",
|
||
|
"referencedDeclaration": 1548,
|
||
|
"src": "1032:14:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
}
|
||
|
},
|
||
|
"nodeType": "Assignment",
|
||
|
"operator": "+=",
|
||
|
"rightHandSide": {
|
||
|
"hexValue": "31",
|
||
|
"id": 1570,
|
||
|
"isConstant": false,
|
||
|
"isLValue": false,
|
||
|
"isPure": true,
|
||
|
"kind": "number",
|
||
|
"lValueRequested": false,
|
||
|
"nodeType": "Literal",
|
||
|
"src": "1050:1:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_rational_1_by_1",
|
||
|
"typeString": "int_const 1"
|
||
|
},
|
||
|
"value": "1"
|
||
|
},
|
||
|
"src": "1032:19:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
}
|
||
|
},
|
||
|
"id": 1572,
|
||
|
"nodeType": "ExpressionStatement",
|
||
|
"src": "1032:19:8"
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
"id": 1575,
|
||
|
"implemented": true,
|
||
|
"kind": "function",
|
||
|
"modifiers": [],
|
||
|
"name": "increment",
|
||
|
"nameLocation": "954:9:8",
|
||
|
"nodeType": "FunctionDefinition",
|
||
|
"parameters": {
|
||
|
"id": 1565,
|
||
|
"nodeType": "ParameterList",
|
||
|
"parameters": [
|
||
|
{
|
||
|
"constant": false,
|
||
|
"id": 1564,
|
||
|
"mutability": "mutable",
|
||
|
"name": "counter",
|
||
|
"nameLocation": "980:7:8",
|
||
|
"nodeType": "VariableDeclaration",
|
||
|
"scope": 1575,
|
||
|
"src": "964:23:8",
|
||
|
"stateVariable": false,
|
||
|
"storageLocation": "storage",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_struct$_Counter_$1549_storage_ptr",
|
||
|
"typeString": "struct Counters.Counter"
|
||
|
},
|
||
|
"typeName": {
|
||
|
"id": 1563,
|
||
|
"nodeType": "UserDefinedTypeName",
|
||
|
"pathNode": {
|
||
|
"id": 1562,
|
||
|
"name": "Counter",
|
||
|
"nodeType": "IdentifierPath",
|
||
|
"referencedDeclaration": 1549,
|
||
|
"src": "964:7:8"
|
||
|
},
|
||
|
"referencedDeclaration": 1549,
|
||
|
"src": "964:7:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_struct$_Counter_$1549_storage_ptr",
|
||
|
"typeString": "struct Counters.Counter"
|
||
|
}
|
||
|
},
|
||
|
"visibility": "internal"
|
||
|
}
|
||
|
],
|
||
|
"src": "963:25:8"
|
||
|
},
|
||
|
"returnParameters": {
|
||
|
"id": 1566,
|
||
|
"nodeType": "ParameterList",
|
||
|
"parameters": [],
|
||
|
"src": "998:0:8"
|
||
|
},
|
||
|
"scope": 1617,
|
||
|
"src": "945:123:8",
|
||
|
"stateMutability": "nonpayable",
|
||
|
"virtual": false,
|
||
|
"visibility": "internal"
|
||
|
},
|
||
|
{
|
||
|
"body": {
|
||
|
"id": 1602,
|
||
|
"nodeType": "Block",
|
||
|
"src": "1127:176:8",
|
||
|
"statements": [
|
||
|
{
|
||
|
"assignments": [
|
||
|
1582
|
||
|
],
|
||
|
"declarations": [
|
||
|
{
|
||
|
"constant": false,
|
||
|
"id": 1582,
|
||
|
"mutability": "mutable",
|
||
|
"name": "value",
|
||
|
"nameLocation": "1145:5:8",
|
||
|
"nodeType": "VariableDeclaration",
|
||
|
"scope": 1602,
|
||
|
"src": "1137:13:8",
|
||
|
"stateVariable": false,
|
||
|
"storageLocation": "default",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
},
|
||
|
"typeName": {
|
||
|
"id": 1581,
|
||
|
"name": "uint256",
|
||
|
"nodeType": "ElementaryTypeName",
|
||
|
"src": "1137:7:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
}
|
||
|
},
|
||
|
"visibility": "internal"
|
||
|
}
|
||
|
],
|
||
|
"id": 1585,
|
||
|
"initialValue": {
|
||
|
"expression": {
|
||
|
"id": 1583,
|
||
|
"name": "counter",
|
||
|
"nodeType": "Identifier",
|
||
|
"overloadedDeclarations": [],
|
||
|
"referencedDeclaration": 1578,
|
||
|
"src": "1153:7:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_struct$_Counter_$1549_storage_ptr",
|
||
|
"typeString": "struct Counters.Counter storage pointer"
|
||
|
}
|
||
|
},
|
||
|
"id": 1584,
|
||
|
"isConstant": false,
|
||
|
"isLValue": true,
|
||
|
"isPure": false,
|
||
|
"lValueRequested": false,
|
||
|
"memberName": "_value",
|
||
|
"nodeType": "MemberAccess",
|
||
|
"referencedDeclaration": 1548,
|
||
|
"src": "1153:14:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
}
|
||
|
},
|
||
|
"nodeType": "VariableDeclarationStatement",
|
||
|
"src": "1137:30:8"
|
||
|
},
|
||
|
{
|
||
|
"expression": {
|
||
|
"arguments": [
|
||
|
{
|
||
|
"commonType": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
},
|
||
|
"id": 1589,
|
||
|
"isConstant": false,
|
||
|
"isLValue": false,
|
||
|
"isPure": false,
|
||
|
"lValueRequested": false,
|
||
|
"leftExpression": {
|
||
|
"id": 1587,
|
||
|
"name": "value",
|
||
|
"nodeType": "Identifier",
|
||
|
"overloadedDeclarations": [],
|
||
|
"referencedDeclaration": 1582,
|
||
|
"src": "1185:5:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
}
|
||
|
},
|
||
|
"nodeType": "BinaryOperation",
|
||
|
"operator": ">",
|
||
|
"rightExpression": {
|
||
|
"hexValue": "30",
|
||
|
"id": 1588,
|
||
|
"isConstant": false,
|
||
|
"isLValue": false,
|
||
|
"isPure": true,
|
||
|
"kind": "number",
|
||
|
"lValueRequested": false,
|
||
|
"nodeType": "Literal",
|
||
|
"src": "1193:1:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_rational_0_by_1",
|
||
|
"typeString": "int_const 0"
|
||
|
},
|
||
|
"value": "0"
|
||
|
},
|
||
|
"src": "1185:9:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_bool",
|
||
|
"typeString": "bool"
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"hexValue": "436f756e7465723a2064656372656d656e74206f766572666c6f77",
|
||
|
"id": 1590,
|
||
|
"isConstant": false,
|
||
|
"isLValue": false,
|
||
|
"isPure": true,
|
||
|
"kind": "string",
|
||
|
"lValueRequested": false,
|
||
|
"nodeType": "Literal",
|
||
|
"src": "1196:29:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_stringliteral_1dfd0d5389474d871b8e8929aab9d4def041f55f90f625754fb5f9a9ba08af6f",
|
||
|
"typeString": "literal_string \"Counter: decrement overflow\""
|
||
|
},
|
||
|
"value": "Counter: decrement overflow"
|
||
|
}
|
||
|
],
|
||
|
"expression": {
|
||
|
"argumentTypes": [
|
||
|
{
|
||
|
"typeIdentifier": "t_bool",
|
||
|
"typeString": "bool"
|
||
|
},
|
||
|
{
|
||
|
"typeIdentifier": "t_stringliteral_1dfd0d5389474d871b8e8929aab9d4def041f55f90f625754fb5f9a9ba08af6f",
|
||
|
"typeString": "literal_string \"Counter: decrement overflow\""
|
||
|
}
|
||
|
],
|
||
|
"id": 1586,
|
||
|
"name": "require",
|
||
|
"nodeType": "Identifier",
|
||
|
"overloadedDeclarations": [
|
||
|
4294967278,
|
||
|
4294967278
|
||
|
],
|
||
|
"referencedDeclaration": 4294967278,
|
||
|
"src": "1177:7:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
|
||
|
"typeString": "function (bool,string memory) pure"
|
||
|
}
|
||
|
},
|
||
|
"id": 1591,
|
||
|
"isConstant": false,
|
||
|
"isLValue": false,
|
||
|
"isPure": false,
|
||
|
"kind": "functionCall",
|
||
|
"lValueRequested": false,
|
||
|
"names": [],
|
||
|
"nodeType": "FunctionCall",
|
||
|
"src": "1177:49:8",
|
||
|
"tryCall": false,
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_tuple$__$",
|
||
|
"typeString": "tuple()"
|
||
|
}
|
||
|
},
|
||
|
"id": 1592,
|
||
|
"nodeType": "ExpressionStatement",
|
||
|
"src": "1177:49:8"
|
||
|
},
|
||
|
{
|
||
|
"id": 1601,
|
||
|
"nodeType": "UncheckedBlock",
|
||
|
"src": "1236:61:8",
|
||
|
"statements": [
|
||
|
{
|
||
|
"expression": {
|
||
|
"id": 1599,
|
||
|
"isConstant": false,
|
||
|
"isLValue": false,
|
||
|
"isPure": false,
|
||
|
"lValueRequested": false,
|
||
|
"leftHandSide": {
|
||
|
"expression": {
|
||
|
"id": 1593,
|
||
|
"name": "counter",
|
||
|
"nodeType": "Identifier",
|
||
|
"overloadedDeclarations": [],
|
||
|
"referencedDeclaration": 1578,
|
||
|
"src": "1260:7:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_struct$_Counter_$1549_storage_ptr",
|
||
|
"typeString": "struct Counters.Counter storage pointer"
|
||
|
}
|
||
|
},
|
||
|
"id": 1595,
|
||
|
"isConstant": false,
|
||
|
"isLValue": true,
|
||
|
"isPure": false,
|
||
|
"lValueRequested": true,
|
||
|
"memberName": "_value",
|
||
|
"nodeType": "MemberAccess",
|
||
|
"referencedDeclaration": 1548,
|
||
|
"src": "1260:14:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
}
|
||
|
},
|
||
|
"nodeType": "Assignment",
|
||
|
"operator": "=",
|
||
|
"rightHandSide": {
|
||
|
"commonType": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
},
|
||
|
"id": 1598,
|
||
|
"isConstant": false,
|
||
|
"isLValue": false,
|
||
|
"isPure": false,
|
||
|
"lValueRequested": false,
|
||
|
"leftExpression": {
|
||
|
"id": 1596,
|
||
|
"name": "value",
|
||
|
"nodeType": "Identifier",
|
||
|
"overloadedDeclarations": [],
|
||
|
"referencedDeclaration": 1582,
|
||
|
"src": "1277:5:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
}
|
||
|
},
|
||
|
"nodeType": "BinaryOperation",
|
||
|
"operator": "-",
|
||
|
"rightExpression": {
|
||
|
"hexValue": "31",
|
||
|
"id": 1597,
|
||
|
"isConstant": false,
|
||
|
"isLValue": false,
|
||
|
"isPure": true,
|
||
|
"kind": "number",
|
||
|
"lValueRequested": false,
|
||
|
"nodeType": "Literal",
|
||
|
"src": "1285:1:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_rational_1_by_1",
|
||
|
"typeString": "int_const 1"
|
||
|
},
|
||
|
"value": "1"
|
||
|
},
|
||
|
"src": "1277:9:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
}
|
||
|
},
|
||
|
"src": "1260:26:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
}
|
||
|
},
|
||
|
"id": 1600,
|
||
|
"nodeType": "ExpressionStatement",
|
||
|
"src": "1260:26:8"
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
"id": 1603,
|
||
|
"implemented": true,
|
||
|
"kind": "function",
|
||
|
"modifiers": [],
|
||
|
"name": "decrement",
|
||
|
"nameLocation": "1083:9:8",
|
||
|
"nodeType": "FunctionDefinition",
|
||
|
"parameters": {
|
||
|
"id": 1579,
|
||
|
"nodeType": "ParameterList",
|
||
|
"parameters": [
|
||
|
{
|
||
|
"constant": false,
|
||
|
"id": 1578,
|
||
|
"mutability": "mutable",
|
||
|
"name": "counter",
|
||
|
"nameLocation": "1109:7:8",
|
||
|
"nodeType": "VariableDeclaration",
|
||
|
"scope": 1603,
|
||
|
"src": "1093:23:8",
|
||
|
"stateVariable": false,
|
||
|
"storageLocation": "storage",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_struct$_Counter_$1549_storage_ptr",
|
||
|
"typeString": "struct Counters.Counter"
|
||
|
},
|
||
|
"typeName": {
|
||
|
"id": 1577,
|
||
|
"nodeType": "UserDefinedTypeName",
|
||
|
"pathNode": {
|
||
|
"id": 1576,
|
||
|
"name": "Counter",
|
||
|
"nodeType": "IdentifierPath",
|
||
|
"referencedDeclaration": 1549,
|
||
|
"src": "1093:7:8"
|
||
|
},
|
||
|
"referencedDeclaration": 1549,
|
||
|
"src": "1093:7:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_struct$_Counter_$1549_storage_ptr",
|
||
|
"typeString": "struct Counters.Counter"
|
||
|
}
|
||
|
},
|
||
|
"visibility": "internal"
|
||
|
}
|
||
|
],
|
||
|
"src": "1092:25:8"
|
||
|
},
|
||
|
"returnParameters": {
|
||
|
"id": 1580,
|
||
|
"nodeType": "ParameterList",
|
||
|
"parameters": [],
|
||
|
"src": "1127:0:8"
|
||
|
},
|
||
|
"scope": 1617,
|
||
|
"src": "1074:229:8",
|
||
|
"stateMutability": "nonpayable",
|
||
|
"virtual": false,
|
||
|
"visibility": "internal"
|
||
|
},
|
||
|
{
|
||
|
"body": {
|
||
|
"id": 1615,
|
||
|
"nodeType": "Block",
|
||
|
"src": "1358:35:8",
|
||
|
"statements": [
|
||
|
{
|
||
|
"expression": {
|
||
|
"id": 1613,
|
||
|
"isConstant": false,
|
||
|
"isLValue": false,
|
||
|
"isPure": false,
|
||
|
"lValueRequested": false,
|
||
|
"leftHandSide": {
|
||
|
"expression": {
|
||
|
"id": 1609,
|
||
|
"name": "counter",
|
||
|
"nodeType": "Identifier",
|
||
|
"overloadedDeclarations": [],
|
||
|
"referencedDeclaration": 1606,
|
||
|
"src": "1368:7:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_struct$_Counter_$1549_storage_ptr",
|
||
|
"typeString": "struct Counters.Counter storage pointer"
|
||
|
}
|
||
|
},
|
||
|
"id": 1611,
|
||
|
"isConstant": false,
|
||
|
"isLValue": true,
|
||
|
"isPure": false,
|
||
|
"lValueRequested": true,
|
||
|
"memberName": "_value",
|
||
|
"nodeType": "MemberAccess",
|
||
|
"referencedDeclaration": 1548,
|
||
|
"src": "1368:14:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
}
|
||
|
},
|
||
|
"nodeType": "Assignment",
|
||
|
"operator": "=",
|
||
|
"rightHandSide": {
|
||
|
"hexValue": "30",
|
||
|
"id": 1612,
|
||
|
"isConstant": false,
|
||
|
"isLValue": false,
|
||
|
"isPure": true,
|
||
|
"kind": "number",
|
||
|
"lValueRequested": false,
|
||
|
"nodeType": "Literal",
|
||
|
"src": "1385:1:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_rational_0_by_1",
|
||
|
"typeString": "int_const 0"
|
||
|
},
|
||
|
"value": "0"
|
||
|
},
|
||
|
"src": "1368:18:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
}
|
||
|
},
|
||
|
"id": 1614,
|
||
|
"nodeType": "ExpressionStatement",
|
||
|
"src": "1368:18:8"
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
"id": 1616,
|
||
|
"implemented": true,
|
||
|
"kind": "function",
|
||
|
"modifiers": [],
|
||
|
"name": "reset",
|
||
|
"nameLocation": "1318:5:8",
|
||
|
"nodeType": "FunctionDefinition",
|
||
|
"parameters": {
|
||
|
"id": 1607,
|
||
|
"nodeType": "ParameterList",
|
||
|
"parameters": [
|
||
|
{
|
||
|
"constant": false,
|
||
|
"id": 1606,
|
||
|
"mutability": "mutable",
|
||
|
"name": "counter",
|
||
|
"nameLocation": "1340:7:8",
|
||
|
"nodeType": "VariableDeclaration",
|
||
|
"scope": 1616,
|
||
|
"src": "1324:23:8",
|
||
|
"stateVariable": false,
|
||
|
"storageLocation": "storage",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_struct$_Counter_$1549_storage_ptr",
|
||
|
"typeString": "struct Counters.Counter"
|
||
|
},
|
||
|
"typeName": {
|
||
|
"id": 1605,
|
||
|
"nodeType": "UserDefinedTypeName",
|
||
|
"pathNode": {
|
||
|
"id": 1604,
|
||
|
"name": "Counter",
|
||
|
"nodeType": "IdentifierPath",
|
||
|
"referencedDeclaration": 1549,
|
||
|
"src": "1324:7:8"
|
||
|
},
|
||
|
"referencedDeclaration": 1549,
|
||
|
"src": "1324:7:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_struct$_Counter_$1549_storage_ptr",
|
||
|
"typeString": "struct Counters.Counter"
|
||
|
}
|
||
|
},
|
||
|
"visibility": "internal"
|
||
|
}
|
||
|
],
|
||
|
"src": "1323:25:8"
|
||
|
},
|
||
|
"returnParameters": {
|
||
|
"id": 1608,
|
||
|
"nodeType": "ParameterList",
|
||
|
"parameters": [],
|
||
|
"src": "1358:0:8"
|
||
|
},
|
||
|
"scope": 1617,
|
||
|
"src": "1309:84:8",
|
||
|
"stateMutability": "nonpayable",
|
||
|
"virtual": false,
|
||
|
"visibility": "internal"
|
||
|
}
|
||
|
],
|
||
|
"scope": 1618,
|
||
|
"src": "424:971:8",
|
||
|
"usedErrors": []
|
||
|
}
|
||
|
],
|
||
|
"src": "87:1309:8"
|
||
|
},
|
||
|
"legacyAST": {
|
||
|
"absolutePath": "@openzeppelin/contracts/utils/Counters.sol",
|
||
|
"exportedSymbols": {
|
||
|
"Counters": [
|
||
|
1617
|
||
|
]
|
||
|
},
|
||
|
"id": 1618,
|
||
|
"license": "MIT",
|
||
|
"nodeType": "SourceUnit",
|
||
|
"nodes": [
|
||
|
{
|
||
|
"id": 1545,
|
||
|
"literals": [
|
||
|
"solidity",
|
||
|
"^",
|
||
|
"0.8",
|
||
|
".0"
|
||
|
],
|
||
|
"nodeType": "PragmaDirective",
|
||
|
"src": "87:23:8"
|
||
|
},
|
||
|
{
|
||
|
"abstract": false,
|
||
|
"baseContracts": [],
|
||
|
"canonicalName": "Counters",
|
||
|
"contractDependencies": [],
|
||
|
"contractKind": "library",
|
||
|
"documentation": {
|
||
|
"id": 1546,
|
||
|
"nodeType": "StructuredDocumentation",
|
||
|
"src": "112:311:8",
|
||
|
"text": " @title Counters\n @author Matt Condon (@shrugs)\n @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n of elements in a mapping, issuing ERC721 ids, or counting request ids.\n Include with `using Counters for Counters.Counter;`"
|
||
|
},
|
||
|
"fullyImplemented": true,
|
||
|
"id": 1617,
|
||
|
"linearizedBaseContracts": [
|
||
|
1617
|
||
|
],
|
||
|
"name": "Counters",
|
||
|
"nameLocation": "432:8:8",
|
||
|
"nodeType": "ContractDefinition",
|
||
|
"nodes": [
|
||
|
{
|
||
|
"canonicalName": "Counters.Counter",
|
||
|
"id": 1549,
|
||
|
"members": [
|
||
|
{
|
||
|
"constant": false,
|
||
|
"id": 1548,
|
||
|
"mutability": "mutable",
|
||
|
"name": "_value",
|
||
|
"nameLocation": "794:6:8",
|
||
|
"nodeType": "VariableDeclaration",
|
||
|
"scope": 1549,
|
||
|
"src": "786:14:8",
|
||
|
"stateVariable": false,
|
||
|
"storageLocation": "default",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
},
|
||
|
"typeName": {
|
||
|
"id": 1547,
|
||
|
"name": "uint256",
|
||
|
"nodeType": "ElementaryTypeName",
|
||
|
"src": "786:7:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
}
|
||
|
},
|
||
|
"visibility": "internal"
|
||
|
}
|
||
|
],
|
||
|
"name": "Counter",
|
||
|
"nameLocation": "454:7:8",
|
||
|
"nodeType": "StructDefinition",
|
||
|
"scope": 1617,
|
||
|
"src": "447:374:8",
|
||
|
"visibility": "public"
|
||
|
},
|
||
|
{
|
||
|
"body": {
|
||
|
"id": 1560,
|
||
|
"nodeType": "Block",
|
||
|
"src": "901:38:8",
|
||
|
"statements": [
|
||
|
{
|
||
|
"expression": {
|
||
|
"expression": {
|
||
|
"id": 1557,
|
||
|
"name": "counter",
|
||
|
"nodeType": "Identifier",
|
||
|
"overloadedDeclarations": [],
|
||
|
"referencedDeclaration": 1552,
|
||
|
"src": "918:7:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_struct$_Counter_$1549_storage_ptr",
|
||
|
"typeString": "struct Counters.Counter storage pointer"
|
||
|
}
|
||
|
},
|
||
|
"id": 1558,
|
||
|
"isConstant": false,
|
||
|
"isLValue": true,
|
||
|
"isPure": false,
|
||
|
"lValueRequested": false,
|
||
|
"memberName": "_value",
|
||
|
"nodeType": "MemberAccess",
|
||
|
"referencedDeclaration": 1548,
|
||
|
"src": "918:14:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
}
|
||
|
},
|
||
|
"functionReturnParameters": 1556,
|
||
|
"id": 1559,
|
||
|
"nodeType": "Return",
|
||
|
"src": "911:21:8"
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
"id": 1561,
|
||
|
"implemented": true,
|
||
|
"kind": "function",
|
||
|
"modifiers": [],
|
||
|
"name": "current",
|
||
|
"nameLocation": "836:7:8",
|
||
|
"nodeType": "FunctionDefinition",
|
||
|
"parameters": {
|
||
|
"id": 1553,
|
||
|
"nodeType": "ParameterList",
|
||
|
"parameters": [
|
||
|
{
|
||
|
"constant": false,
|
||
|
"id": 1552,
|
||
|
"mutability": "mutable",
|
||
|
"name": "counter",
|
||
|
"nameLocation": "860:7:8",
|
||
|
"nodeType": "VariableDeclaration",
|
||
|
"scope": 1561,
|
||
|
"src": "844:23:8",
|
||
|
"stateVariable": false,
|
||
|
"storageLocation": "storage",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_struct$_Counter_$1549_storage_ptr",
|
||
|
"typeString": "struct Counters.Counter"
|
||
|
},
|
||
|
"typeName": {
|
||
|
"id": 1551,
|
||
|
"nodeType": "UserDefinedTypeName",
|
||
|
"pathNode": {
|
||
|
"id": 1550,
|
||
|
"name": "Counter",
|
||
|
"nodeType": "IdentifierPath",
|
||
|
"referencedDeclaration": 1549,
|
||
|
"src": "844:7:8"
|
||
|
},
|
||
|
"referencedDeclaration": 1549,
|
||
|
"src": "844:7:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_struct$_Counter_$1549_storage_ptr",
|
||
|
"typeString": "struct Counters.Counter"
|
||
|
}
|
||
|
},
|
||
|
"visibility": "internal"
|
||
|
}
|
||
|
],
|
||
|
"src": "843:25:8"
|
||
|
},
|
||
|
"returnParameters": {
|
||
|
"id": 1556,
|
||
|
"nodeType": "ParameterList",
|
||
|
"parameters": [
|
||
|
{
|
||
|
"constant": false,
|
||
|
"id": 1555,
|
||
|
"mutability": "mutable",
|
||
|
"name": "",
|
||
|
"nameLocation": "-1:-1:-1",
|
||
|
"nodeType": "VariableDeclaration",
|
||
|
"scope": 1561,
|
||
|
"src": "892:7:8",
|
||
|
"stateVariable": false,
|
||
|
"storageLocation": "default",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
},
|
||
|
"typeName": {
|
||
|
"id": 1554,
|
||
|
"name": "uint256",
|
||
|
"nodeType": "ElementaryTypeName",
|
||
|
"src": "892:7:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
}
|
||
|
},
|
||
|
"visibility": "internal"
|
||
|
}
|
||
|
],
|
||
|
"src": "891:9:8"
|
||
|
},
|
||
|
"scope": 1617,
|
||
|
"src": "827:112:8",
|
||
|
"stateMutability": "view",
|
||
|
"virtual": false,
|
||
|
"visibility": "internal"
|
||
|
},
|
||
|
{
|
||
|
"body": {
|
||
|
"id": 1574,
|
||
|
"nodeType": "Block",
|
||
|
"src": "998:70:8",
|
||
|
"statements": [
|
||
|
{
|
||
|
"id": 1573,
|
||
|
"nodeType": "UncheckedBlock",
|
||
|
"src": "1008:54:8",
|
||
|
"statements": [
|
||
|
{
|
||
|
"expression": {
|
||
|
"id": 1571,
|
||
|
"isConstant": false,
|
||
|
"isLValue": false,
|
||
|
"isPure": false,
|
||
|
"lValueRequested": false,
|
||
|
"leftHandSide": {
|
||
|
"expression": {
|
||
|
"id": 1567,
|
||
|
"name": "counter",
|
||
|
"nodeType": "Identifier",
|
||
|
"overloadedDeclarations": [],
|
||
|
"referencedDeclaration": 1564,
|
||
|
"src": "1032:7:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_struct$_Counter_$1549_storage_ptr",
|
||
|
"typeString": "struct Counters.Counter storage pointer"
|
||
|
}
|
||
|
},
|
||
|
"id": 1569,
|
||
|
"isConstant": false,
|
||
|
"isLValue": true,
|
||
|
"isPure": false,
|
||
|
"lValueRequested": true,
|
||
|
"memberName": "_value",
|
||
|
"nodeType": "MemberAccess",
|
||
|
"referencedDeclaration": 1548,
|
||
|
"src": "1032:14:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
}
|
||
|
},
|
||
|
"nodeType": "Assignment",
|
||
|
"operator": "+=",
|
||
|
"rightHandSide": {
|
||
|
"hexValue": "31",
|
||
|
"id": 1570,
|
||
|
"isConstant": false,
|
||
|
"isLValue": false,
|
||
|
"isPure": true,
|
||
|
"kind": "number",
|
||
|
"lValueRequested": false,
|
||
|
"nodeType": "Literal",
|
||
|
"src": "1050:1:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_rational_1_by_1",
|
||
|
"typeString": "int_const 1"
|
||
|
},
|
||
|
"value": "1"
|
||
|
},
|
||
|
"src": "1032:19:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
}
|
||
|
},
|
||
|
"id": 1572,
|
||
|
"nodeType": "ExpressionStatement",
|
||
|
"src": "1032:19:8"
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
"id": 1575,
|
||
|
"implemented": true,
|
||
|
"kind": "function",
|
||
|
"modifiers": [],
|
||
|
"name": "increment",
|
||
|
"nameLocation": "954:9:8",
|
||
|
"nodeType": "FunctionDefinition",
|
||
|
"parameters": {
|
||
|
"id": 1565,
|
||
|
"nodeType": "ParameterList",
|
||
|
"parameters": [
|
||
|
{
|
||
|
"constant": false,
|
||
|
"id": 1564,
|
||
|
"mutability": "mutable",
|
||
|
"name": "counter",
|
||
|
"nameLocation": "980:7:8",
|
||
|
"nodeType": "VariableDeclaration",
|
||
|
"scope": 1575,
|
||
|
"src": "964:23:8",
|
||
|
"stateVariable": false,
|
||
|
"storageLocation": "storage",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_struct$_Counter_$1549_storage_ptr",
|
||
|
"typeString": "struct Counters.Counter"
|
||
|
},
|
||
|
"typeName": {
|
||
|
"id": 1563,
|
||
|
"nodeType": "UserDefinedTypeName",
|
||
|
"pathNode": {
|
||
|
"id": 1562,
|
||
|
"name": "Counter",
|
||
|
"nodeType": "IdentifierPath",
|
||
|
"referencedDeclaration": 1549,
|
||
|
"src": "964:7:8"
|
||
|
},
|
||
|
"referencedDeclaration": 1549,
|
||
|
"src": "964:7:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_struct$_Counter_$1549_storage_ptr",
|
||
|
"typeString": "struct Counters.Counter"
|
||
|
}
|
||
|
},
|
||
|
"visibility": "internal"
|
||
|
}
|
||
|
],
|
||
|
"src": "963:25:8"
|
||
|
},
|
||
|
"returnParameters": {
|
||
|
"id": 1566,
|
||
|
"nodeType": "ParameterList",
|
||
|
"parameters": [],
|
||
|
"src": "998:0:8"
|
||
|
},
|
||
|
"scope": 1617,
|
||
|
"src": "945:123:8",
|
||
|
"stateMutability": "nonpayable",
|
||
|
"virtual": false,
|
||
|
"visibility": "internal"
|
||
|
},
|
||
|
{
|
||
|
"body": {
|
||
|
"id": 1602,
|
||
|
"nodeType": "Block",
|
||
|
"src": "1127:176:8",
|
||
|
"statements": [
|
||
|
{
|
||
|
"assignments": [
|
||
|
1582
|
||
|
],
|
||
|
"declarations": [
|
||
|
{
|
||
|
"constant": false,
|
||
|
"id": 1582,
|
||
|
"mutability": "mutable",
|
||
|
"name": "value",
|
||
|
"nameLocation": "1145:5:8",
|
||
|
"nodeType": "VariableDeclaration",
|
||
|
"scope": 1602,
|
||
|
"src": "1137:13:8",
|
||
|
"stateVariable": false,
|
||
|
"storageLocation": "default",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
},
|
||
|
"typeName": {
|
||
|
"id": 1581,
|
||
|
"name": "uint256",
|
||
|
"nodeType": "ElementaryTypeName",
|
||
|
"src": "1137:7:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
}
|
||
|
},
|
||
|
"visibility": "internal"
|
||
|
}
|
||
|
],
|
||
|
"id": 1585,
|
||
|
"initialValue": {
|
||
|
"expression": {
|
||
|
"id": 1583,
|
||
|
"name": "counter",
|
||
|
"nodeType": "Identifier",
|
||
|
"overloadedDeclarations": [],
|
||
|
"referencedDeclaration": 1578,
|
||
|
"src": "1153:7:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_struct$_Counter_$1549_storage_ptr",
|
||
|
"typeString": "struct Counters.Counter storage pointer"
|
||
|
}
|
||
|
},
|
||
|
"id": 1584,
|
||
|
"isConstant": false,
|
||
|
"isLValue": true,
|
||
|
"isPure": false,
|
||
|
"lValueRequested": false,
|
||
|
"memberName": "_value",
|
||
|
"nodeType": "MemberAccess",
|
||
|
"referencedDeclaration": 1548,
|
||
|
"src": "1153:14:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
}
|
||
|
},
|
||
|
"nodeType": "VariableDeclarationStatement",
|
||
|
"src": "1137:30:8"
|
||
|
},
|
||
|
{
|
||
|
"expression": {
|
||
|
"arguments": [
|
||
|
{
|
||
|
"commonType": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
},
|
||
|
"id": 1589,
|
||
|
"isConstant": false,
|
||
|
"isLValue": false,
|
||
|
"isPure": false,
|
||
|
"lValueRequested": false,
|
||
|
"leftExpression": {
|
||
|
"id": 1587,
|
||
|
"name": "value",
|
||
|
"nodeType": "Identifier",
|
||
|
"overloadedDeclarations": [],
|
||
|
"referencedDeclaration": 1582,
|
||
|
"src": "1185:5:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
}
|
||
|
},
|
||
|
"nodeType": "BinaryOperation",
|
||
|
"operator": ">",
|
||
|
"rightExpression": {
|
||
|
"hexValue": "30",
|
||
|
"id": 1588,
|
||
|
"isConstant": false,
|
||
|
"isLValue": false,
|
||
|
"isPure": true,
|
||
|
"kind": "number",
|
||
|
"lValueRequested": false,
|
||
|
"nodeType": "Literal",
|
||
|
"src": "1193:1:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_rational_0_by_1",
|
||
|
"typeString": "int_const 0"
|
||
|
},
|
||
|
"value": "0"
|
||
|
},
|
||
|
"src": "1185:9:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_bool",
|
||
|
"typeString": "bool"
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"hexValue": "436f756e7465723a2064656372656d656e74206f766572666c6f77",
|
||
|
"id": 1590,
|
||
|
"isConstant": false,
|
||
|
"isLValue": false,
|
||
|
"isPure": true,
|
||
|
"kind": "string",
|
||
|
"lValueRequested": false,
|
||
|
"nodeType": "Literal",
|
||
|
"src": "1196:29:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_stringliteral_1dfd0d5389474d871b8e8929aab9d4def041f55f90f625754fb5f9a9ba08af6f",
|
||
|
"typeString": "literal_string \"Counter: decrement overflow\""
|
||
|
},
|
||
|
"value": "Counter: decrement overflow"
|
||
|
}
|
||
|
],
|
||
|
"expression": {
|
||
|
"argumentTypes": [
|
||
|
{
|
||
|
"typeIdentifier": "t_bool",
|
||
|
"typeString": "bool"
|
||
|
},
|
||
|
{
|
||
|
"typeIdentifier": "t_stringliteral_1dfd0d5389474d871b8e8929aab9d4def041f55f90f625754fb5f9a9ba08af6f",
|
||
|
"typeString": "literal_string \"Counter: decrement overflow\""
|
||
|
}
|
||
|
],
|
||
|
"id": 1586,
|
||
|
"name": "require",
|
||
|
"nodeType": "Identifier",
|
||
|
"overloadedDeclarations": [
|
||
|
4294967278,
|
||
|
4294967278
|
||
|
],
|
||
|
"referencedDeclaration": 4294967278,
|
||
|
"src": "1177:7:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
|
||
|
"typeString": "function (bool,string memory) pure"
|
||
|
}
|
||
|
},
|
||
|
"id": 1591,
|
||
|
"isConstant": false,
|
||
|
"isLValue": false,
|
||
|
"isPure": false,
|
||
|
"kind": "functionCall",
|
||
|
"lValueRequested": false,
|
||
|
"names": [],
|
||
|
"nodeType": "FunctionCall",
|
||
|
"src": "1177:49:8",
|
||
|
"tryCall": false,
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_tuple$__$",
|
||
|
"typeString": "tuple()"
|
||
|
}
|
||
|
},
|
||
|
"id": 1592,
|
||
|
"nodeType": "ExpressionStatement",
|
||
|
"src": "1177:49:8"
|
||
|
},
|
||
|
{
|
||
|
"id": 1601,
|
||
|
"nodeType": "UncheckedBlock",
|
||
|
"src": "1236:61:8",
|
||
|
"statements": [
|
||
|
{
|
||
|
"expression": {
|
||
|
"id": 1599,
|
||
|
"isConstant": false,
|
||
|
"isLValue": false,
|
||
|
"isPure": false,
|
||
|
"lValueRequested": false,
|
||
|
"leftHandSide": {
|
||
|
"expression": {
|
||
|
"id": 1593,
|
||
|
"name": "counter",
|
||
|
"nodeType": "Identifier",
|
||
|
"overloadedDeclarations": [],
|
||
|
"referencedDeclaration": 1578,
|
||
|
"src": "1260:7:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_struct$_Counter_$1549_storage_ptr",
|
||
|
"typeString": "struct Counters.Counter storage pointer"
|
||
|
}
|
||
|
},
|
||
|
"id": 1595,
|
||
|
"isConstant": false,
|
||
|
"isLValue": true,
|
||
|
"isPure": false,
|
||
|
"lValueRequested": true,
|
||
|
"memberName": "_value",
|
||
|
"nodeType": "MemberAccess",
|
||
|
"referencedDeclaration": 1548,
|
||
|
"src": "1260:14:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
}
|
||
|
},
|
||
|
"nodeType": "Assignment",
|
||
|
"operator": "=",
|
||
|
"rightHandSide": {
|
||
|
"commonType": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
},
|
||
|
"id": 1598,
|
||
|
"isConstant": false,
|
||
|
"isLValue": false,
|
||
|
"isPure": false,
|
||
|
"lValueRequested": false,
|
||
|
"leftExpression": {
|
||
|
"id": 1596,
|
||
|
"name": "value",
|
||
|
"nodeType": "Identifier",
|
||
|
"overloadedDeclarations": [],
|
||
|
"referencedDeclaration": 1582,
|
||
|
"src": "1277:5:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
}
|
||
|
},
|
||
|
"nodeType": "BinaryOperation",
|
||
|
"operator": "-",
|
||
|
"rightExpression": {
|
||
|
"hexValue": "31",
|
||
|
"id": 1597,
|
||
|
"isConstant": false,
|
||
|
"isLValue": false,
|
||
|
"isPure": true,
|
||
|
"kind": "number",
|
||
|
"lValueRequested": false,
|
||
|
"nodeType": "Literal",
|
||
|
"src": "1285:1:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_rational_1_by_1",
|
||
|
"typeString": "int_const 1"
|
||
|
},
|
||
|
"value": "1"
|
||
|
},
|
||
|
"src": "1277:9:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
}
|
||
|
},
|
||
|
"src": "1260:26:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
}
|
||
|
},
|
||
|
"id": 1600,
|
||
|
"nodeType": "ExpressionStatement",
|
||
|
"src": "1260:26:8"
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
"id": 1603,
|
||
|
"implemented": true,
|
||
|
"kind": "function",
|
||
|
"modifiers": [],
|
||
|
"name": "decrement",
|
||
|
"nameLocation": "1083:9:8",
|
||
|
"nodeType": "FunctionDefinition",
|
||
|
"parameters": {
|
||
|
"id": 1579,
|
||
|
"nodeType": "ParameterList",
|
||
|
"parameters": [
|
||
|
{
|
||
|
"constant": false,
|
||
|
"id": 1578,
|
||
|
"mutability": "mutable",
|
||
|
"name": "counter",
|
||
|
"nameLocation": "1109:7:8",
|
||
|
"nodeType": "VariableDeclaration",
|
||
|
"scope": 1603,
|
||
|
"src": "1093:23:8",
|
||
|
"stateVariable": false,
|
||
|
"storageLocation": "storage",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_struct$_Counter_$1549_storage_ptr",
|
||
|
"typeString": "struct Counters.Counter"
|
||
|
},
|
||
|
"typeName": {
|
||
|
"id": 1577,
|
||
|
"nodeType": "UserDefinedTypeName",
|
||
|
"pathNode": {
|
||
|
"id": 1576,
|
||
|
"name": "Counter",
|
||
|
"nodeType": "IdentifierPath",
|
||
|
"referencedDeclaration": 1549,
|
||
|
"src": "1093:7:8"
|
||
|
},
|
||
|
"referencedDeclaration": 1549,
|
||
|
"src": "1093:7:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_struct$_Counter_$1549_storage_ptr",
|
||
|
"typeString": "struct Counters.Counter"
|
||
|
}
|
||
|
},
|
||
|
"visibility": "internal"
|
||
|
}
|
||
|
],
|
||
|
"src": "1092:25:8"
|
||
|
},
|
||
|
"returnParameters": {
|
||
|
"id": 1580,
|
||
|
"nodeType": "ParameterList",
|
||
|
"parameters": [],
|
||
|
"src": "1127:0:8"
|
||
|
},
|
||
|
"scope": 1617,
|
||
|
"src": "1074:229:8",
|
||
|
"stateMutability": "nonpayable",
|
||
|
"virtual": false,
|
||
|
"visibility": "internal"
|
||
|
},
|
||
|
{
|
||
|
"body": {
|
||
|
"id": 1615,
|
||
|
"nodeType": "Block",
|
||
|
"src": "1358:35:8",
|
||
|
"statements": [
|
||
|
{
|
||
|
"expression": {
|
||
|
"id": 1613,
|
||
|
"isConstant": false,
|
||
|
"isLValue": false,
|
||
|
"isPure": false,
|
||
|
"lValueRequested": false,
|
||
|
"leftHandSide": {
|
||
|
"expression": {
|
||
|
"id": 1609,
|
||
|
"name": "counter",
|
||
|
"nodeType": "Identifier",
|
||
|
"overloadedDeclarations": [],
|
||
|
"referencedDeclaration": 1606,
|
||
|
"src": "1368:7:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_struct$_Counter_$1549_storage_ptr",
|
||
|
"typeString": "struct Counters.Counter storage pointer"
|
||
|
}
|
||
|
},
|
||
|
"id": 1611,
|
||
|
"isConstant": false,
|
||
|
"isLValue": true,
|
||
|
"isPure": false,
|
||
|
"lValueRequested": true,
|
||
|
"memberName": "_value",
|
||
|
"nodeType": "MemberAccess",
|
||
|
"referencedDeclaration": 1548,
|
||
|
"src": "1368:14:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
}
|
||
|
},
|
||
|
"nodeType": "Assignment",
|
||
|
"operator": "=",
|
||
|
"rightHandSide": {
|
||
|
"hexValue": "30",
|
||
|
"id": 1612,
|
||
|
"isConstant": false,
|
||
|
"isLValue": false,
|
||
|
"isPure": true,
|
||
|
"kind": "number",
|
||
|
"lValueRequested": false,
|
||
|
"nodeType": "Literal",
|
||
|
"src": "1385:1:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_rational_0_by_1",
|
||
|
"typeString": "int_const 0"
|
||
|
},
|
||
|
"value": "0"
|
||
|
},
|
||
|
"src": "1368:18:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_uint256",
|
||
|
"typeString": "uint256"
|
||
|
}
|
||
|
},
|
||
|
"id": 1614,
|
||
|
"nodeType": "ExpressionStatement",
|
||
|
"src": "1368:18:8"
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
"id": 1616,
|
||
|
"implemented": true,
|
||
|
"kind": "function",
|
||
|
"modifiers": [],
|
||
|
"name": "reset",
|
||
|
"nameLocation": "1318:5:8",
|
||
|
"nodeType": "FunctionDefinition",
|
||
|
"parameters": {
|
||
|
"id": 1607,
|
||
|
"nodeType": "ParameterList",
|
||
|
"parameters": [
|
||
|
{
|
||
|
"constant": false,
|
||
|
"id": 1606,
|
||
|
"mutability": "mutable",
|
||
|
"name": "counter",
|
||
|
"nameLocation": "1340:7:8",
|
||
|
"nodeType": "VariableDeclaration",
|
||
|
"scope": 1616,
|
||
|
"src": "1324:23:8",
|
||
|
"stateVariable": false,
|
||
|
"storageLocation": "storage",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_struct$_Counter_$1549_storage_ptr",
|
||
|
"typeString": "struct Counters.Counter"
|
||
|
},
|
||
|
"typeName": {
|
||
|
"id": 1605,
|
||
|
"nodeType": "UserDefinedTypeName",
|
||
|
"pathNode": {
|
||
|
"id": 1604,
|
||
|
"name": "Counter",
|
||
|
"nodeType": "IdentifierPath",
|
||
|
"referencedDeclaration": 1549,
|
||
|
"src": "1324:7:8"
|
||
|
},
|
||
|
"referencedDeclaration": 1549,
|
||
|
"src": "1324:7:8",
|
||
|
"typeDescriptions": {
|
||
|
"typeIdentifier": "t_struct$_Counter_$1549_storage_ptr",
|
||
|
"typeString": "struct Counters.Counter"
|
||
|
}
|
||
|
},
|
||
|
"visibility": "internal"
|
||
|
}
|
||
|
],
|
||
|
"src": "1323:25:8"
|
||
|
},
|
||
|
"returnParameters": {
|
||
|
"id": 1608,
|
||
|
"nodeType": "ParameterList",
|
||
|
"parameters": [],
|
||
|
"src": "1358:0:8"
|
||
|
},
|
||
|
"scope": 1617,
|
||
|
"src": "1309:84:8",
|
||
|
"stateMutability": "nonpayable",
|
||
|
"virtual": false,
|
||
|
"visibility": "internal"
|
||
|
}
|
||
|
],
|
||
|
"scope": 1618,
|
||
|
"src": "424:971:8",
|
||
|
"usedErrors": []
|
||
|
}
|
||
|
],
|
||
|
"src": "87:1309:8"
|
||
|
},
|
||
|
"compiler": {
|
||
|
"name": "solc",
|
||
|
"version": "0.8.11+commit.d7f03943.Emscripten.clang"
|
||
|
},
|
||
|
"networks": {},
|
||
|
"schemaVersion": "3.4.4",
|
||
|
"updatedAt": "2021-12-29T22:14:28.599Z",
|
||
|
"devdoc": {
|
||
|
"author": "Matt Condon (@shrugs)",
|
||
|
"details": "Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number of elements in a mapping, issuing ERC721 ids, or counting request ids. Include with `using Counters for Counters.Counter;`",
|
||
|
"kind": "dev",
|
||
|
"methods": {},
|
||
|
"title": "Counters",
|
||
|
"version": 1
|
||
|
},
|
||
|
"userdoc": {
|
||
|
"kind": "user",
|
||
|
"methods": {},
|
||
|
"version": 1
|
||
|
}
|
||
|
}
|