amethysta
Version:
Smart Contract Validator
918 lines • 326 kB
JSON
{
"status": "success",
"info": "get smartContract",
"data": {
"type": "SourceUnit",
"children": [
{
"type": "PragmaDirective",
"name": "solidity",
"value": "^0.8.0"
},
{
"type": "ContractDefinition",
"name": "Pairing",
"baseContracts": [],
"subNodes": [
{
"type": "StructDefinition",
"name": "G1Point",
"members": [
{
"type": "VariableDeclaration",
"typeName": {
"type": "ElementaryTypeName",
"name": "uint",
"stateMutability": null
},
"name": "X",
"identifier": {
"type": "Identifier",
"name": "X"
},
"storageLocation": null,
"isStateVar": false,
"isIndexed": false,
"expression": null
},
{
"type": "VariableDeclaration",
"typeName": {
"type": "ElementaryTypeName",
"name": "uint",
"stateMutability": null
},
"name": "Y",
"identifier": {
"type": "Identifier",
"name": "Y"
},
"storageLocation": null,
"isStateVar": false,
"isIndexed": false,
"expression": null
}
]
},
{
"type": "StructDefinition",
"name": "G2Point",
"members": [
{
"type": "VariableDeclaration",
"typeName": {
"type": "ArrayTypeName",
"baseTypeName": {
"type": "ElementaryTypeName",
"name": "uint",
"stateMutability": null
},
"length": {
"type": "NumberLiteral",
"number": "2",
"subdenomination": null
}
},
"name": "X",
"identifier": {
"type": "Identifier",
"name": "X"
},
"storageLocation": null,
"isStateVar": false,
"isIndexed": false,
"expression": null
},
{
"type": "VariableDeclaration",
"typeName": {
"type": "ArrayTypeName",
"baseTypeName": {
"type": "ElementaryTypeName",
"name": "uint",
"stateMutability": null
},
"length": {
"type": "NumberLiteral",
"number": "2",
"subdenomination": null
}
},
"name": "Y",
"identifier": {
"type": "Identifier",
"name": "Y"
},
"storageLocation": null,
"isStateVar": false,
"isIndexed": false,
"expression": null
}
]
},
{
"type": "FunctionDefinition",
"name": "P1",
"parameters": [],
"returnParameters": [
{
"type": "VariableDeclaration",
"typeName": {
"type": "UserDefinedTypeName",
"namePath": "G1Point"
},
"name": null,
"identifier": null,
"storageLocation": "memory",
"isStateVar": false,
"isIndexed": false,
"expression": null
}
],
"body": {
"type": "Block",
"statements": [
{
"type": "ReturnStatement",
"expression": {
"type": "FunctionCall",
"expression": {
"type": "Identifier",
"name": "G1Point"
},
"arguments": [
{
"type": "NumberLiteral",
"number": "1",
"subdenomination": null
},
{
"type": "NumberLiteral",
"number": "2",
"subdenomination": null
}
],
"names": [],
"identifiers": []
}
}
]
},
"visibility": "internal",
"modifiers": [],
"override": null,
"isConstructor": false,
"isReceiveEther": false,
"isFallback": false,
"isVirtual": false,
"stateMutability": "pure"
},
{
"type": "FunctionDefinition",
"name": "P2",
"parameters": [],
"returnParameters": [
{
"type": "VariableDeclaration",
"typeName": {
"type": "UserDefinedTypeName",
"namePath": "G2Point"
},
"name": null,
"identifier": null,
"storageLocation": "memory",
"isStateVar": false,
"isIndexed": false,
"expression": null
}
],
"body": {
"type": "Block",
"statements": [
{
"type": "ReturnStatement",
"expression": {
"type": "FunctionCall",
"expression": {
"type": "Identifier",
"name": "G2Point"
},
"arguments": [
{
"type": "TupleExpression",
"components": [
{
"type": "NumberLiteral",
"number": "10857046999023057135944570762232829481370756359578518086990519993285655852781",
"subdenomination": null
},
{
"type": "NumberLiteral",
"number": "11559732032986387107991004021392285783925812861821192530917403151452391805634",
"subdenomination": null
}
],
"isArray": true
},
{
"type": "TupleExpression",
"components": [
{
"type": "NumberLiteral",
"number": "8495653923123431417604973247489272438418190587263600148770280649306958101930",
"subdenomination": null
},
{
"type": "NumberLiteral",
"number": "4082367875863433681332203403145435568316851327593401208105741076214120093531",
"subdenomination": null
}
],
"isArray": true
}
],
"names": [],
"identifiers": []
}
}
]
},
"visibility": "internal",
"modifiers": [],
"override": null,
"isConstructor": false,
"isReceiveEther": false,
"isFallback": false,
"isVirtual": false,
"stateMutability": "pure"
},
{
"type": "FunctionDefinition",
"name": "negate",
"parameters": [
{
"type": "VariableDeclaration",
"typeName": {
"type": "UserDefinedTypeName",
"namePath": "G1Point"
},
"name": "p",
"identifier": {
"type": "Identifier",
"name": "p"
},
"storageLocation": "memory",
"isStateVar": false,
"isIndexed": false,
"expression": null
}
],
"returnParameters": [
{
"type": "VariableDeclaration",
"typeName": {
"type": "UserDefinedTypeName",
"namePath": "G1Point"
},
"name": null,
"identifier": null,
"storageLocation": "memory",
"isStateVar": false,
"isIndexed": false,
"expression": null
}
],
"body": {
"type": "Block",
"statements": [
{
"type": "VariableDeclarationStatement",
"variables": [
{
"type": "VariableDeclaration",
"typeName": {
"type": "ElementaryTypeName",
"name": "uint",
"stateMutability": null
},
"name": "q",
"identifier": {
"type": "Identifier",
"name": "q"
},
"storageLocation": null,
"isStateVar": false,
"isIndexed": false,
"expression": null
}
],
"initialValue": {
"type": "NumberLiteral",
"number": "21888242871839275222246405745257275088696311157297823662689037894645226208583",
"subdenomination": null
}
},
{
"type": "IfStatement",
"condition": {
"type": "BinaryOperation",
"operator": "&&",
"left": {
"type": "BinaryOperation",
"operator": "==",
"left": {
"type": "MemberAccess",
"expression": {
"type": "Identifier",
"name": "p"
},
"memberName": "X"
},
"right": {
"type": "NumberLiteral",
"number": "0",
"subdenomination": null
}
},
"right": {
"type": "BinaryOperation",
"operator": "==",
"left": {
"type": "MemberAccess",
"expression": {
"type": "Identifier",
"name": "p"
},
"memberName": "Y"
},
"right": {
"type": "NumberLiteral",
"number": "0",
"subdenomination": null
}
}
},
"trueBody": {
"type": "ReturnStatement",
"expression": {
"type": "FunctionCall",
"expression": {
"type": "Identifier",
"name": "G1Point"
},
"arguments": [
{
"type": "NumberLiteral",
"number": "0",
"subdenomination": null
},
{
"type": "NumberLiteral",
"number": "0",
"subdenomination": null
}
],
"names": [],
"identifiers": []
}
},
"falseBody": null
},
{
"type": "ReturnStatement",
"expression": {
"type": "FunctionCall",
"expression": {
"type": "Identifier",
"name": "G1Point"
},
"arguments": [
{
"type": "MemberAccess",
"expression": {
"type": "Identifier",
"name": "p"
},
"memberName": "X"
},
{
"type": "BinaryOperation",
"operator": "-",
"left": {
"type": "Identifier",
"name": "q"
},
"right": {
"type": "TupleExpression",
"components": [
{
"type": "BinaryOperation",
"operator": "%",
"left": {
"type": "MemberAccess",
"expression": {
"type": "Identifier",
"name": "p"
},
"memberName": "Y"
},
"right": {
"type": "Identifier",
"name": "q"
}
}
],
"isArray": false
}
}
],
"names": [],
"identifiers": []
}
}
]
},
"visibility": "internal",
"modifiers": [],
"override": null,
"isConstructor": false,
"isReceiveEther": false,
"isFallback": false,
"isVirtual": false,
"stateMutability": "pure"
},
{
"type": "FunctionDefinition",
"name": "addition",
"parameters": [
{
"type": "VariableDeclaration",
"typeName": {
"type": "UserDefinedTypeName",
"namePath": "G1Point"
},
"name": "p1",
"identifier": {
"type": "Identifier",
"name": "p1"
},
"storageLocation": "memory",
"isStateVar": false,
"isIndexed": false,
"expression": null
},
{
"type": "VariableDeclaration",
"typeName": {
"type": "UserDefinedTypeName",
"namePath": "G1Point"
},
"name": "p2",
"identifier": {
"type": "Identifier",
"name": "p2"
},
"storageLocation": "memory",
"isStateVar": false,
"isIndexed": false,
"expression": null
}
],
"returnParameters": [
{
"type": "VariableDeclaration",
"typeName": {
"type": "UserDefinedTypeName",
"namePath": "G1Point"
},
"name": "r",
"identifier": {
"type": "Identifier",
"name": "r"
},
"storageLocation": "memory",
"isStateVar": false,
"isIndexed": false,
"expression": null
}
],
"body": {
"type": "Block",
"statements": [
{
"type": "VariableDeclarationStatement",
"variables": [
{
"type": "VariableDeclaration",
"typeName": {
"type": "ArrayTypeName",
"baseTypeName": {
"type": "ElementaryTypeName",
"name": "uint",
"stateMutability": null
},
"length": {
"type": "NumberLiteral",
"number": "4",
"subdenomination": null
}
},
"name": "input",
"identifier": {
"type": "Identifier",
"name": "input"
},
"storageLocation": "memory",
"isStateVar": false,
"isIndexed": false,
"expression": null
}
],
"initialValue": null
},
{
"type": "ExpressionStatement",
"expression": {
"type": "BinaryOperation",
"operator": "=",
"left": {
"type": "IndexAccess",
"base": {
"type": "Identifier",
"name": "input"
},
"index": {
"type": "NumberLiteral",
"number": "0",
"subdenomination": null
}
},
"right": {
"type": "MemberAccess",
"expression": {
"type": "Identifier",
"name": "p1"
},
"memberName": "X"
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "BinaryOperation",
"operator": "=",
"left": {
"type": "IndexAccess",
"base": {
"type": "Identifier",
"name": "input"
},
"index": {
"type": "NumberLiteral",
"number": "1",
"subdenomination": null
}
},
"right": {
"type": "MemberAccess",
"expression": {
"type": "Identifier",
"name": "p1"
},
"memberName": "Y"
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "BinaryOperation",
"operator": "=",
"left": {
"type": "IndexAccess",
"base": {
"type": "Identifier",
"name": "input"
},
"index": {
"type": "NumberLiteral",
"number": "2",
"subdenomination": null
}
},
"right": {
"type": "MemberAccess",
"expression": {
"type": "Identifier",
"name": "p2"
},
"memberName": "X"
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "BinaryOperation",
"operator": "=",
"left": {
"type": "IndexAccess",
"base": {
"type": "Identifier",
"name": "input"
},
"index": {
"type": "NumberLiteral",
"number": "3",
"subdenomination": null
}
},
"right": {
"type": "MemberAccess",
"expression": {
"type": "Identifier",
"name": "p2"
},
"memberName": "Y"
}
}
},
{
"type": "VariableDeclarationStatement",
"variables": [
{
"type": "VariableDeclaration",
"typeName": {
"type": "ElementaryTypeName",
"name": "bool",
"stateMutability": null
},
"name": "success",
"identifier": {
"type": "Identifier",
"name": "success"
},
"storageLocation": null,
"isStateVar": false,
"isIndexed": false,
"expression": null
}
],
"initialValue": null
},
{
"type": "InlineAssemblyStatement",
"language": null,
"body": {
"type": "AssemblyBlock",
"operations": [
{
"type": "AssemblyAssignment",
"names": [
{
"type": "Identifier",
"name": "success"
}
],
"expression": {
"type": "AssemblyCall",
"functionName": "staticcall",
"arguments": [
{
"type": "AssemblyCall",
"functionName": "sub",
"arguments": [
{
"type": "AssemblyCall",
"functionName": "gas",
"arguments": []
},
{
"type": "DecimalNumber",
"value": "2000"
}
]
},
{
"type": "DecimalNumber",
"value": "6"
},
{
"type": "AssemblyCall",
"functionName": "input",
"arguments": []
},
{
"type": "HexNumber",
"value": "0xc0"
},
{
"type": "AssemblyCall",
"functionName": "r",
"arguments": []
},
{
"type": "HexNumber",
"value": "0x60"
}
]
}
},
{
"type": "AssemblySwitch",
"expression": {
"type": "AssemblyCall",
"functionName": "success",
"arguments": []
},
"cases": [
{
"type": "AssemblyCase",
"block": {
"type": "AssemblyBlock",
"operations": [
{
"type": "AssemblyCall",
"functionName": "invalid",
"arguments": []
}
]
},
"value": {
"type": "DecimalNumber",
"value": "0"
},
"default": false
}
]
}
]
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "FunctionCall",
"expression": {
"type": "Identifier",
"name": "require"
},
"arguments": [
{
"type": "Identifier",
"name": "success"
}
],
"names": [],
"identifiers": []
}
}
]
},
"visibility": "internal",
"modifiers": [],
"override": null,
"isConstructor": false,
"isReceiveEther": false,
"isFallback": false,
"isVirtual": false,
"stateMutability": "view"
},
{
"type": "FunctionDefinition",
"name": "scalar_mul",
"parameters": [
{
"type": "VariableDeclaration",
"typeName": {
"type": "UserDefinedTypeName",
"namePath": "G1Point"
},
"name": "p",
"identifier": {
"type": "Identifier",
"name": "p"
},
"storageLocation": "memory",
"isStateVar": false,
"isIndexed": false,
"expression": null
},
{
"type": "VariableDeclaration",
"typeName": {
"type": "ElementaryTypeName",
"name": "uint",
"stateMutability": null
},
"name": "s",
"identifier": {
"type": "Identifier",
"name": "s"
},
"storageLocation": null,
"isStateVar": false,
"isIndexed": false,
"expression": null
}
],
"returnParameters": [
{
"type": "VariableDeclaration",
"typeName": {
"type": "UserDefinedTypeName",
"namePath": "G1Point"
},
"name": "r",
"identifier": {
"type": "Identifier",
"name": "r"
},
"storageLocation": "memory",
"isStateVar": false,
"isIndexed": false,
"expression": null
}
],
"body": {
"type": "Block",
"statements": [
{
"type": "VariableDeclarationStatement",
"variables": [
{
"type": "VariableDeclaration",
"typeName": {
"type": "ArrayTypeName",
"baseTypeName": {
"type": "ElementaryTypeName",
"name": "uint",
"stateMutability": null
},
"length": {
"type": "NumberLiteral",
"number": "3",
"subdenomination": null
}
},
"name": "input",
"identifier": {
"type": "Identifier",
"name": "input"
},
"storageLocation": "memory",
"isStateVar": false,
"isIndexed": false,
"expression": null
}
],
"initialValue": null
},
{
"type": "ExpressionStatement",
"expression": {
"type": "BinaryOperation",
"operator": "=",
"left": {
"type": "IndexAccess",
"base": {
"type": "Identifier",
"name": "input"
},
"index": {
"type": "NumberLiteral",
"number": "0",
"subdenomination": null
}
},
"right": {
"type": "MemberAccess",
"expression": {
"type": "Identifier",
"name": "p"
},
"memberName": "X"
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "BinaryOperation",
"operator": "=",
"left": {
"type": "IndexAccess",
"base": {
"type": "Identifier",
"name": "input"
},
"index": {
"type": "NumberLiteral",
"number": "1",
"subdenomination": null
}
},
"right": {
"type": "MemberAccess",
"expression":