Exemplo n.º 1
0
        private static StructLog Populate(this StructLog structLog, JArray structLogArray, int currentIndex)
        {
            if (structLog.Op == OpCodes.Create)
            {
                structLog.To = structLog.FindAddressOfNewlyCreatedContract(structLogArray, currentIndex);
            }

            return(structLog);
        }
Exemplo n.º 2
0
        private static string FindAddressOfNewlyCreatedContract(this StructLog createLog, JArray structLogArray, int currentIndex)
        {
            var requiredDepth = createLog.Depth + 1;

            var indexOfNextReturnNode = structLogArray.FirstIndexOf(OpCodes.Return, requiredDepth, currentIndex);

            if (indexOfNextReturnNode != null)
            {
                var indexOfNextNode = indexOfNextReturnNode + 1;

                if (indexOfNextNode < structLogArray.Count)
                {
                    var nextLog = structLogArray[indexOfNextNode];
                    if (nextLog["stack"] is JArray stack)
                    {
                        return(stack.LastOrDefault().ConvertStructLogValueToAddress());
                    }
                }
            }

            return(null);
        }