Show / Hide Table of Contents

ContractManagement.Destroy 方法

销毁合约。

命名空间: Neo.SmartContract.Framework.Native

程序集:Neo.SmartContract.Framework

语法

public static extern void Destroy();

示例

public class Contract1 : SmartContract.Framework.SmartContract
{
    private static readonly UInt160 Owner = "NXsG3zwpwcfvBiA3bNMx6mWZGEro9ZqTqM".ToScriptHash();

    public static void Destroy()
    {
        if (!Runtime.CheckWitness(Owner)) throw new Exception("No authorization.");
        ContractManagement.Destroy();
    }
}

部署后,调用该合约,响应正文为:

[{"type":"Any"}]

响应说明:

  • Void类型:合约销毁成功。

  • 其他:失败。

返回上级