示例#1
0
        // TODO proper exceptions
        private static ExecutionState Oracle_Read(RuntimeVM vm)
        {
            if (vm.Stack.Count < 1)
            {
                return(ExecutionState.Fault);
            }

            var temp = vm.Stack.Pop();

            if (temp.Type != VMType.String)
            {
                return(ExecutionState.Fault);
            }

            var url = temp.AsString();

            if (vm.OracleReader == null)
            {
                return(ExecutionState.Fault);
            }

            url = url.Trim().ToLowerInvariant();
            if (string.IsNullOrEmpty(url))
            {
                return(ExecutionState.Fault);
            }

            var result = vm.OracleReader(vm.Transaction.Hash, url);

            return(ExecutionState.Running);
        }