示例#1
0
        private static ExecutionState Data_Delete(RuntimeVM vm)
        {
            vm.ExpectStackSize(1);

            // for security reasons we don't accept the caller to specify a contract name
            var contractName = vm.CurrentContext.Name;

            vm.Expect(vm.ContractDeployed(contractName), $"contract {contractName} is not deployed");

            var field = vm.PopString("field");
            var key   = SmartContract.GetKeyForField(contractName, field, false);

            var contractAddress = SmartContract.GetAddressForName(contractName);

            vm.CallNativeContext(NativeContractKind.Storage, nameof(StorageContract.DeleteData), contractAddress, key);

            return(ExecutionState.Running);
        }