예제 #1
0
        public static List <DecodedContainer> DecodeIntoContainerList(string path, string address, string ethURL, List <string> searchpath,
                                                                      Dictionary <string, string> multiContracts, string className = "")
        {
            StreamReader     txt = new StreamReader(path);
            AntlrInputStream inputStream;

            if (String.IsNullOrEmpty(className))
            {
                inputStream = new AntlrInputStream(txt.ReadToEnd());
            }
            else
            {
                if (!multiContracts.ContainsKey(className))
                {
                    throw new KeyNotFoundException("Error the className " + className + " Not in file");
                }
                inputStream = new AntlrInputStream(multiContracts[className]);
            }
            SolidityLexer     speakLexer        = new SolidityLexer(inputStream);
            CommonTokenStream commonTokenStream = new CommonTokenStream(speakLexer);
            SolidityParser    solParser         = new SolidityParser(commonTokenStream);
            var lst = new SolList(searchpath, multiContracts);

            solParser.AddParseListener(lst);
            solParser.sourceUnit();
            Web3 connect = new Web3(ethURL);

            return(DecodIntoContainer(lst.variableList, connect, address, 0));
        }
예제 #2
0
        public static SolList DecodeInoSubDecoder(string txtContent, string address, string ethURL, List <string> searchpath, Dictionary <string, string> subcontracts)
        {
            AntlrInputStream  inputStream       = new AntlrInputStream(txtContent);
            SolidityLexer     speakLexer        = new SolidityLexer(inputStream);
            CommonTokenStream commonTokenStream = new CommonTokenStream(speakLexer);
            SolidityParser    solParser         = new SolidityParser(commonTokenStream);
            var lst = new SolList(searchpath, subcontracts);

            solParser.AddParseListener(lst);
            solParser.sourceUnit();
            return(lst);
        }