UNPKG

@etherisc/gif-contracts

Version:

This repository holds the GIF core contracts and tools to develop, test and deploy GIF instances.

1,219 lines (1,218 loc) 173 kB
{ "abi": [], "allSourcePaths": { "71": "contracts/examples/strings.sol" }, "ast": { "absolutePath": "contracts/examples/strings.sol", "exportedSymbols": { "strings": [ 3096 ] }, "id": 3097, "license": "Apache2", "nodeType": "SourceUnit", "nodes": [ { "id": 2835, "literals": [ "solidity", "0.8", ".2" ], "nodeType": "PragmaDirective", "src": "2073:22:71" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "library", "fullyImplemented": true, "id": 3096, "linearizedBaseContracts": [ 3096 ], "name": "strings", "nameLocation": "2105:7:71", "nodeType": "ContractDefinition", "nodes": [ { "canonicalName": "strings.slice", "id": 2840, "members": [ { "constant": false, "id": 2837, "mutability": "mutable", "name": "_len", "nameLocation": "2148:4:71", "nodeType": "VariableDeclaration", "scope": 2840, "src": "2143:9:71", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 2836, "name": "uint", "nodeType": "ElementaryTypeName", "src": "2143:4:71", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" }, { "constant": false, "id": 2839, "mutability": "mutable", "name": "_ptr", "nameLocation": "2167:4:71", "nodeType": "VariableDeclaration", "scope": 2840, "src": "2162:9:71", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 2838, "name": "uint", "nodeType": "ElementaryTypeName", "src": "2162:4:71", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "name": "slice", "nameLocation": "2127:5:71", "nodeType": "StructDefinition", "scope": 3096, "src": "2120:58:71", "visibility": "public" }, { "body": { "id": 2892, "nodeType": "Block", "src": "2245:560:71", "statements": [ { "body": { "id": 2865, "nodeType": "Block", "src": "2335:136:71", "statements": [ { "AST": { "nodeType": "YulBlock", "src": "2358:56:71", "statements": [ { "expression": { "arguments": [ { "name": "dest", "nodeType": "YulIdentifier", "src": "2383:4:71" }, { "arguments": [ { "name": "src", "nodeType": "YulIdentifier", "src": "2395:3:71" } ], "functionName": { "name": "mload", "nodeType": "YulIdentifier", "src": "2389:5:71" }, "nodeType": "YulFunctionCall", "src": "2389:10:71" } ], "functionName": { "name": "mstore", "nodeType": "YulIdentifier", "src": "2376:6:71" }, "nodeType": "YulFunctionCall", "src": "2376:24:71" }, "nodeType": "YulExpressionStatement", "src": "2376:24:71" } ] }, "evmVersion": "istanbul", "externalReferences": [ { "declaration": 2842, "isOffset": false, "isSlot": false, "src": "2383:4:71", "valueSize": 1 }, { "declaration": 2844, "isOffset": false, "isSlot": false, "src": "2395:3:71", "valueSize": 1 } ], "id": 2856, "nodeType": "InlineAssembly", "src": "2349:65:71" }, { "expression": { "id": 2859, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "id": 2857, "name": "dest", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2842, "src": "2427:4:71", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "+=", "rightHandSide": { "hexValue": "3332", "id": 2858, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "2435:2:71", "typeDescriptions": { "typeIdentifier": "t_rational_32_by_1", "typeString": "int_const 32" }, "value": "32" }, "src": "2427:10:71", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 2860, "nodeType": "ExpressionStatement", "src": "2427:10:71" }, { "expression": { "id": 2863, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "id": 2861, "name": "src", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2844, "src": "2451:3:71", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "+=", "rightHandSide": { "hexValue": "3332", "id": 2862, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "2458:2:71", "typeDescriptions": { "typeIdentifier": "t_rational_32_by_1", "typeString": "int_const 32" }, "value": "32" }, "src": "2451:9:71", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 2864, "nodeType": "ExpressionStatement", "src": "2451:9:71" } ] }, "condition": { "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 2851, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "id": 2849, "name": "len_", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2846, "src": "2311:4:71", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": ">=", "rightExpression": { "hexValue": "3332", "id": 2850, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "2319:2:71", "typeDescriptions": { "typeIdentifier": "t_rational_32_by_1", "typeString": "int_const 32" }, "value": "32" }, "src": "2311:10:71", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "id": 2866, "loopExpression": { "expression": { "id": 2854, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "id": 2852, "name": "len_", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2846, "src": "2323:4:71", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "-=", "rightHandSide": { "hexValue": "3332", "id": 2853, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "2331:2:71", "typeDescriptions": { "typeIdentifier": "t_rational_32_by_1", "typeString": "int_const 32" }, "value": "32" }, "src": "2323:10:71", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 2855, "nodeType": "ExpressionStatement", "src": "2323:10:71" }, "nodeType": "ForStatement", "src": "2305:166:71" }, { "assignments": [ 2868 ], "declarations": [ { "constant": false, "id": 2868, "mutability": "mutable", "name": "mask", "nameLocation": "2518:4:71", "nodeType": "VariableDeclaration", "scope": 2892, "src": "2513:9:71", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 2867, "name": "uint", "nodeType": "ElementaryTypeName", "src": "2513:4:71", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "id": 2874, "initialValue": { "expression": { "arguments": [ { "id": 2871, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "2530:4:71", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint256_$", "typeString": "type(uint256)" }, "typeName": { "id": 2870, "name": "uint", "nodeType": "ElementaryTypeName", "src": "2530:4:71", "typeDescriptions": {} } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_type$_t_uint256_$", "typeString": "type(uint256)" } ], "id": 2869, "name": "type", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -27, "src": "2525:4:71", "typeDescriptions": { "typeIdentifier": "t_function_metatype_pure$__$returns$__$", "typeString": "function () pure" } }, "id": 2872, "isConstant": false, "isLValue": false, "isPure": true, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2525:10:71", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_magic_meta_type_t_uint256", "typeString": "type(uint256)" } }, "id": 2873, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "memberName": "max", "nodeType": "MemberAccess", "src": "2525:14:71", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "2513:26:71" }, { "condition": { "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 2877, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "id": 2875, "name": "len_", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2846, "src": "2553:4:71", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": ">", "rightExpression": { "hexValue": "30", "id": 2876, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "2560:1:71", "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "2553:8:71", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "id": 2890, "nodeType": "IfStatement", "src": "2549:68:71", "trueBody": { "id": 2889, "nodeType": "Block", "src": "2563:54:71", "statements": [ { "expression": { "id": 2887, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "id": 2878, "name": "mask", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2868, "src": "2577:4:71", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 2886, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 2884, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "hexValue": "323536", "id": 2879, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "2584:3:71", "typeDescriptions": { "typeIdentifier": "t_rational_256_by_1", "typeString": "int_const 256" }, "value": "256" }, "nodeType": "BinaryOperation", "operator": "**", "rightExpression": { "components": [ { "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 2882, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "hexValue": "3332", "id": 2880, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "2592:2:71", "typeDescriptions": { "typeIdentifier": "t_rational_32_by_1", "typeString": "int_const 32" }, "value": "32" }, "nodeType": "BinaryOperation", "operator": "-", "rightExpression": { "id": 2881, "name": "len_", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2846, "src": "2597:4:71", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2592:9:71", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "id": 2883, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "2591:11:71", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2584:18:71", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "-", "rightExpression": { "hexValue": "31", "id": 2885, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "2605:1:71", "typeDescriptions": { "typeIdentifier": "t_rational_1_by_1", "typeString": "int_const 1" }, "value": "1" }, "src": "2584:22:71", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2577:29:71", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 2888, "nodeType": "ExpressionStatement", "src": "2577:29:71" } ] } }, { "AST": { "nodeType": "YulBlock", "src": "2635:164:71", "statements": [ { "nodeType": "YulVariableDeclaration", "src": "2649:41:71", "value": { "arguments": [ { "arguments": [ { "name": "src", "nodeType": "YulIdentifier", "src": "2674:3:71" } ], "functionName": { "name": "mload", "nodeType": "YulIdentifier", "src": "2668:5:71" }, "nodeType": "YulFunctionCall", "src": "2668:10:71" }, { "arguments": [ { "name": "mask", "nodeType": "YulIdentifier", "src": "2684:4:71" } ], "functionName": { "name": "not", "nodeType": "YulIdentifier", "src": "2680:3:71" }, "nodeType": "YulFunctionCall", "src": "2680:9:71" } ], "functionName": { "name": "and", "nodeType": "YulIdentifier", "src": "2664:3:71" }, "nodeType": "YulFunctionCall", "src": "2664:26:71" }, "variables": [ { "name": "srcpart", "nodeType": "YulTypedName", "src": "2653:7:71", "type": "" } ] }, { "nodeType": "YulVariableDeclaration", "src": "2703:38:71", "value": { "arguments": [ { "arguments": [ { "name": "dest", "nodeType": "YulIdentifier", "src": "2729:4:71" } ], "functionName": { "name": "mload", "nodeType": "YulIdentifier", "src": "2723:5:71" }, "nodeType": "YulFunctionCall", "src": "2723:11:71" }, { "name": "mask", "nodeType": "YulIdentifier", "src": "2736:4:71" } ], "functionName": { "name": "and", "nodeType": "YulIdentifier", "src": "2719:3:71" }, "nodeType": "YulFunctionCall", "src": "2719:22:71" }, "variables": [ { "name": "destpart", "nodeType": "YulTypedName", "src": "2707:8:71", "type": "" } ] }, { "expression": { "arguments": [ { "name": "dest", "nodeType": "YulIdentifier", "src": "2761:4:71" }, { "arguments": [ { "name": "destpart", "nodeType": "YulIdentifier", "src": "2770:8:71" }, { "name": "srcpart", "nodeType": "YulIdentifier", "src": "2780:7:71" } ], "functionName": { "name": "or", "nodeType": "YulIdentifier", "src": "2767:2:71" }, "nodeType": "YulFunctionCall", "src": "2767:21:71" } ], "functionName": { "name": "mstore", "nodeType": "YulIdentifier", "src": "2754:6:71" }, "nodeType": "YulFunctionCall", "src": "2754:35:71" }, "nodeType": "YulExpressionStatement", "src": "2754:35:71" } ] }, "evmVersion": "istanbul", "externalReferences": [ { "declaration": 2842, "isOffset": false, "isSlot": false, "src": "2729:4:71", "valueSize": 1 }, { "declaration": 2842, "isOffset": false, "isSlot": false, "src": "2761:4:71", "valueSize": 1 }, { "declaration": 2868, "isOffset": false, "isSlot": false, "src": "2684:4:71", "valueSize": 1 }, { "declaration": 2868, "isOffset": false, "isSlot": false, "src": "2736:4:71", "valueSize": 1 }, { "declaration": 2844, "isOffset": false, "isSlot": false, "src": "2674:3:71", "valueSize": 1 } ], "id": 2891, "nodeType": "InlineAssembly", "src": "2626:173:71" } ] }, "id": 2893, "implemented": true, "kind": "function", "modifiers": [], "name": "memcpy", "nameLocation": "2193:6:71", "nodeType": "FunctionDefinition", "parameters": { "id": 2847, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 2842, "mutability": "mutable", "name": "dest", "nameLocation": "2205:4:71", "nodeType": "VariableDeclaration", "scope": 2893, "src": "2200:9:71", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 2841, "name": "uint", "nodeType": "ElementaryTypeName", "src": "2200:4:71", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" }, { "constant": false, "id": 2844, "mutability": "mutable", "name": "src", "nameLocation": "2216:3:71", "nodeType": "VariableDeclaration", "scope": 2893, "src": "2211:8:71", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 2843, "name": "uint", "nodeType": "ElementaryTypeName", "src": "2211:4:71", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" }, { "constant": false, "id": 2846, "mutability": "mutable", "name": "len_", "nameLocation": "2226:4:71", "nodeType": "VariableDeclaration", "scope": 2893, "src": "2221:9:71", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 2845, "name": "uint", "nodeType": "ElementaryTypeName", "src": "2221:4:71", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "src": "2199:32:71" }, "returnParameters": { "id": 2848, "nodeType": "ParameterList", "parameters": [], "src": "2245:0:71" }, "scope": 3096, "src": "2184:621:71", "stateMutability": "pure", "virtual": false, "visibility": "private" }, { "body": { "id": 3051, "nodeType": "Block", "src": "3057:750:71", "statements": [ { "assignments": [ 2901 ], "declarations": [ { "constant": false, "id": 2901, "mutability": "mutable", "name": "ret", "nameLocation": "3072:3:71", "nodeType": "VariableDeclaration", "scope": 3051, "src": "3067:8:71", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 2900, "name": "uint", "nodeType": "ElementaryTypeName", "src": "3067:4:71", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "id": 2902, "nodeType": "VariableDeclarationStatement", "src": "3067:8:71" }, { "condition": { "commonType": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "id": 2905, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "id": 2903, "name": "self", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2895, "src": "3089:4:71", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "hexValue": "30", "id": 2904, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "3097:1:71", "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "3089:9:71", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "id": 2908, "nodeType": "IfStatement", "src": "3085:35:71", "trueBody": { "expression": { "hexValue": "30", "id": 2906, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "3119:1:71", "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "functionReturnParameters": 2899, "id": 2907, "nodeType": "Return", "src": "3112:8:71" } }, { "condition": { "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 2920, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 2918, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "arguments": [ { "id": 2911, "name": "self", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2895, "src": "3139:4:71", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } ], "id": 2910, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "3134:4:71", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint256_$", "typeString": "type(uint256)" }, "typeName": { "id": 2909, "name": "uint", "nodeType": "ElementaryTypeName", "src": "3134:4:71", "typeDescriptions": {} } }, "id": 2912, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "3134:10:71", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "&", "rightExpression": { "expression": { "arguments": [ { "id": 2915, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "3152:7:71", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint128_$", "typeString": "type(uint128)" }, "typeName": { "id": 2914, "name": "uint128", "nodeType": "ElementaryTypeName", "src": "3152:7:71", "typeDescriptions": {} } } ],