Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test.sol from solidity-antlr4 #1

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ISolidityParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import { CommonTokenStream } from "./CommonTokenStream.ts";
import { SolidityParser } from "./SolidityParser.ts";
import { SolidityLexer } from "./SolidityLexer.ts";

const inputStream = new InputStream("./${INPUT}.sol");

const inputStream = new InputStream("./test/test.sol");

const lexer = new SolidityLexer(inputStream);
const tokenStream = new CommonTokenStream(lexer);
const parser = new SolidityParser(tokenStream);
Expand Down
84 changes: 84 additions & 0 deletions ast.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
[
{
"anonymous": false,
"inputs": [
{
"components": [
{
"internalType": "bytes4",
"name": "functionSelector",
"type": "bytes4"
},
{
"internalType": "address",
"name": "oldProxyTarget",
"type": "address"
},
{
"internalType": "address",
"name": "newProxyTarget",
"type": "address"
}
],
"indexed": false,
"internalType": "struct IDiamondCut.FacetCut[]",
"name": "_facetCuts",
"type": "tuple[]"
},
{
"indexed": false,
"internalType": "address",
"name": "_initializationContract",
"type": "address"
},
{
"indexed": false,
"internalType": "bytes",
"name": "_initializationCalldata",
"type": "bytes"
}
],
"name": "DiamondCut",
"type": "event"
},
{
"inputs": [
{
"components": [
{
"internalType": "bytes4",
"name": "functionSelector",
"type": "bytes4"
},
{
"internalType": "address",
"name": "oldProxyTarget",
"type": "address"
},
{
"internalType": "address",
"name": "newProxyTarget",
"type": "address"
}
],
"internalType": "struct IDiamondCut.FacetCut[]",
"name": "_facetCuts",
"type": "tuple[]"
},
{
"internalType": "address",
"name": "_initializationContract",
"type": "address"
},
{
"internalType": "bytes",
"name": "_initializationCalldata",
"type": "bytes"
}
],
"name": "diamondCut",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
59 changes: 59 additions & 0 deletions export.abi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
export declare type Encodable = EncodablePrimitive | EncodableTuple | EncodableArray;
export declare type EncodablePrimitive = Uint8Array | string | boolean | bigint;
export interface EncodableTuple {
[x: string]: Encodable;
}
export interface EncodableArray extends ReadonlyArray<Encodable> {
}
export interface FunctionDescription {
readonly type?: 'function';
readonly name: string;
readonly inputs: ReadonlyArray<ParameterDescription>;
readonly outputs?: ReadonlyArray<ParameterDescription>;
readonly stateMutability?: 'pure' | 'view' | 'nonpayable' | 'payable';
}
export interface EventDescription {
readonly type: 'event';
readonly name: string;
readonly inputs: ReadonlyArray<EventParameterDescription>;
readonly anonymous?: boolean;
}
export interface ConstructorDescription {
readonly type: 'constructor';
readonly inputs?: ReadonlyArray<ParameterDescription>;
readonly stateMutability?: 'pure' | 'view' | 'nonpayable' | 'payable';
}
export interface FallbackDescription {
readonly type: 'fallback';
readonly stateMutability?: 'pure' | 'view' | 'nonpayable' | 'payable';
}
export declare type AbiDescription = FunctionDescription | EventDescription | ConstructorDescription | FallbackDescription;
export interface ParameterDescription {
readonly name: string;
readonly type: string;
readonly components?: ReadonlyArray<ParameterDescription>;
}
export interface EventParameterDescription extends ParameterDescription {
readonly indexed: boolean;
}
export interface DecodedEvent {
readonly name: string;
readonly parameters: EncodableTuple;
}
export declare function parseSignature(functionSignature: string): FunctionDescription;
export declare function generateFullSignature(functionDescription: FunctionDescription): string;
export declare function generateCanonicalSignature(functionDescription: FunctionDescription): string;
export declare function decodeMethod(keccak256: (message: Uint8Array) => Promise<bigint>, functionDescription: FunctionDescription, bytes: Uint8Array): Promise<EncodableTuple>;
export declare function decodeMethod(keccak256: (message: Uint8Array) => Promise<bigint>, functionSignature: string, bytes: Uint8Array): Promise<EncodableTuple>;
export declare function decodeMethod(functionSelector: number, parameterDescriptions: ReadonlyArray<ParameterDescription>, bytes: Uint8Array): EncodableTuple;
export declare function decodeParameters(descriptions: ReadonlyArray<ParameterDescription>, data: Uint8Array): EncodableTuple;
export declare function encodeMethod(keccak256: (message: Uint8Array) => Promise<bigint>, functionDescription: FunctionDescription, parameters: EncodableArray): Promise<Uint8Array>;
export declare function encodeMethod(keccak256: (message: Uint8Array) => Promise<bigint>, functionSignature: string, parameters: EncodableArray): Promise<Uint8Array>;
export declare function encodeMethod(functionSelector: number, parameterDescriptions: ReadonlyArray<ParameterDescription>, parameters: EncodableArray): Uint8Array;
export declare function encodeParameters(descriptions: ReadonlyArray<ParameterDescription>, parameters: EncodableArray): Uint8Array;
export declare function decodeUnknownEvent(keccak256: (message: Uint8Array) => Promise<bigint>, abi: ReadonlyArray<AbiDescription>, topics: ReadonlyArray<bigint>, data: Uint8Array): Promise<DecodedEvent>;
export declare function decodeEvent(eventDescription: EventDescription, topics: ReadonlyArray<bigint>, data: Uint8Array): DecodedEvent;
declare global {
interface ArrayConstructor {
isArray(arg: ReadonlyArray<any> | any): arg is ReadonlyArray<any>;
}
Loading