diff --git a/src/Neo.Compiler.CSharp/ContractManifestExtension.cs b/src/Neo.Compiler.CSharp/ContractManifestExtension.cs index 5955304b4..bf696f550 100644 --- a/src/Neo.Compiler.CSharp/ContractManifestExtension.cs +++ b/src/Neo.Compiler.CSharp/ContractManifestExtension.cs @@ -163,6 +163,45 @@ private static void CheckNep17Compliant(this ContractManifest manifest) } } + private static void CheckNep11PayableCompliant(this ContractManifest manifest) + { + try + { + var onNEP11PaymentMethod = manifest.Abi.GetMethod("onNEP11Payment", 4); + var onNEP11PaymentValid = onNEP11PaymentMethod is { ReturnType: ContractParameterType.Void } && + onNEP11PaymentMethod.Parameters[0].Type == ContractParameterType.Hash160 && + onNEP11PaymentMethod.Parameters[1].Type == ContractParameterType.Integer && + onNEP11PaymentMethod.Parameters[2].Type == ContractParameterType.String && + onNEP11PaymentMethod.Parameters[3].Type == ContractParameterType.Any; + + if (!onNEP11PaymentValid) throw new CompilationException(DiagnosticId.IncorrectNEPStandard, + $"Incomplete NEP standard {NepStandard.Nep11Payable.ToStandard()} implementation: onNEP11Payment"); + } + catch (Exception ex) when (ex is not CompilationException) + { + throw new CompilationException(DiagnosticId.IncorrectNEPStandard, $"Incomplete NEP standard {NepStandard.Nep11Payable.ToStandard()} implementation: Unidentified issue."); + } + } + + private static void CheckNep17PayableCompliant(this ContractManifest manifest) + { + try + { + var onNEP17PaymentMethod = manifest.Abi.GetMethod("onNEP17Payment", 3); + var onNEP17PaymentValid = onNEP17PaymentMethod is { ReturnType: ContractParameterType.Void } && + onNEP17PaymentMethod.Parameters[0].Type == ContractParameterType.Hash160 && + onNEP17PaymentMethod.Parameters[1].Type == ContractParameterType.Integer && + onNEP17PaymentMethod.Parameters[2].Type == ContractParameterType.Any; + + if (!onNEP17PaymentValid) throw new CompilationException(DiagnosticId.IncorrectNEPStandard, + $"Incomplete NEP standard {NepStandard.Nep17Payable.ToStandard()} implementation: onNEP17Payment"); + } + catch (Exception ex) when (ex is not CompilationException) + { + throw new CompilationException(DiagnosticId.IncorrectNEPStandard, $"Incomplete NEP standard {NepStandard.Nep17Payable.ToStandard()} implementation: Unidentified issue."); + } + } + internal static ContractManifest CheckStandards(this ContractManifest manifest) { if (manifest.SupportedStandards.Contains(NepStandard.Nep11.ToStandard())) @@ -175,6 +214,16 @@ internal static ContractManifest CheckStandards(this ContractManifest manifest) manifest.CheckNep17Compliant(); } + if (manifest.SupportedStandards.Contains(NepStandard.Nep11Payable.ToStandard())) + { + manifest.CheckNep11PayableCompliant(); + } + + if (manifest.SupportedStandards.Contains(NepStandard.Nep17Payable.ToStandard())) + { + manifest.CheckNep17PayableCompliant(); + } + return manifest; } } diff --git a/src/Neo.SmartContract.Framework/Interfaces/INEP11Payable.cs b/src/Neo.SmartContract.Framework/Interfaces/INEP11Payable.cs index 8cbde24c2..8a87e121b 100644 --- a/src/Neo.SmartContract.Framework/Interfaces/INEP11Payable.cs +++ b/src/Neo.SmartContract.Framework/Interfaces/INEP11Payable.cs @@ -26,6 +26,7 @@ public interface INep11Payable /// /// The address of the payer /// The amount of token to be transferred + /// The token id to be transferred /// Additional payment description data /// /// This interface method is defined as non-static, @@ -34,5 +35,5 @@ public interface INep11Payable /// Both static and non-static methods of smart contract interface works, /// they differs on how you process static field. /// - public void OnNEP11Payment(UInt160 from, BigInteger amount, object? data = null); + public void OnNEP11Payment(UInt160 from, BigInteger amount, string tokenId, object? data = null); } diff --git a/src/Neo.SmartContract.Framework/NEPStandard.cs b/src/Neo.SmartContract.Framework/NEPStandard.cs index 2241dbb7f..ca6817815 100644 --- a/src/Neo.SmartContract.Framework/NEPStandard.cs +++ b/src/Neo.SmartContract.Framework/NEPStandard.cs @@ -19,6 +19,18 @@ public enum NepStandard // The NEP-17 standard is used for fungible tokens. // Defined at https://github.com/neo-project/proposals/blob/master/nep-17.mediawiki Nep17, + // Smart contract transfer callback for non-fungible tokens (NFTs). + // This is an extension standard of NEP-11. + // Defined at https://github.com/neo-project/proposals/pull/169/files#diff-2b5f7c12a23f7dbe4cb46bbf4be6936882f8e0f0b3a4db9d8c58eb294b02e6ed + Nep26, + // This is the nick name of NEP-25. + Nep11Payable, + // Smart contract transfer callback for fungible tokens. + // This is an extension standard of NEP-17. + // Defined at https://github.com/neo-project/proposals/pull/169/files#diff-70768f307c9aa84f8c94e790495a76d47fffeca2331444592ebba6f13b1e6460 + Nep27, + // This is the nick name of NEP-26. + Nep17Payable, // This NEP defines a global standard to get royalty payment information for Non-Fungible Tokens (NFTs) // in order to enable support for royalty payments across all NFT marketplaces in the NEO Smart Economy. // This NEP requires NEP-11. @@ -35,6 +47,8 @@ public static string ToStandard(this NepStandard standard) NepStandard.Nep11 => "NEP-11", NepStandard.Nep17 => "NEP-17", NepStandard.Nep24 => "NEP-24", + NepStandard.Nep11Payable or NepStandard.Nep26 => "NEP-26", + NepStandard.Nep17Payable or NepStandard.Nep27 => "NEP-27", _ => standard.ToString() }; } diff --git a/tests/Neo.SmartContract.Framework.TestContracts/Contract_SupportedStandard11Enum.cs b/tests/Neo.SmartContract.Framework.TestContracts/Contract_SupportedStandard11Enum.cs index 980a1beb1..0ad716ab1 100644 --- a/tests/Neo.SmartContract.Framework.TestContracts/Contract_SupportedStandard11Enum.cs +++ b/tests/Neo.SmartContract.Framework.TestContracts/Contract_SupportedStandard11Enum.cs @@ -14,7 +14,7 @@ public static bool TestStandard() public override string Symbol { [Safe] get; } = "EXAMPLE"; - public void OnNEP11Payment(UInt160 from, BigInteger amount, object? data = null) + public void OnNEP11Payment(UInt160 from, BigInteger amount, string tokenId, object? data = null) { } } diff --git a/tests/Neo.SmartContract.Framework.TestContracts/Contract_SupportedStandard11Payable.cs b/tests/Neo.SmartContract.Framework.TestContracts/Contract_SupportedStandard11Payable.cs new file mode 100644 index 000000000..800669059 --- /dev/null +++ b/tests/Neo.SmartContract.Framework.TestContracts/Contract_SupportedStandard11Payable.cs @@ -0,0 +1,20 @@ +using Neo.SmartContract.Framework.Attributes; +using System.ComponentModel; +using System.Numerics; +using Neo.SmartContract.Framework.Interfaces; + +namespace Neo.SmartContract.Framework.TestContracts +{ + [DisplayName(nameof(Contract_SupportedStandard11Payable))] + [ContractDescription("")] + [ContractAuthor("", "")] + [ContractVersion("")] + [ContractPermission(Permission.Any, Method.Any)] + [SupportedStandards(NepStandard.Nep11Payable)] + public class Contract_SupportedStandard11Payable : SmartContract, INep11Payable + { + public void OnNEP11Payment(UInt160 from, BigInteger amount, string tokenId, object? data = null) + { + } + } +} diff --git a/tests/Neo.SmartContract.Framework.TestContracts/Contract_SupportedStandard17Payable.cs b/tests/Neo.SmartContract.Framework.TestContracts/Contract_SupportedStandard17Payable.cs new file mode 100644 index 000000000..0b9977dea --- /dev/null +++ b/tests/Neo.SmartContract.Framework.TestContracts/Contract_SupportedStandard17Payable.cs @@ -0,0 +1,20 @@ +using Neo.SmartContract.Framework.Attributes; +using System.ComponentModel; +using System.Numerics; +using Neo.SmartContract.Framework.Interfaces; + +namespace Neo.SmartContract.Framework.TestContracts +{ + [DisplayName(nameof(Contract_SupportedStandard17Payable))] + [ContractDescription("")] + [ContractAuthor("", "")] + [ContractVersion("")] + [ContractPermission(Permission.Any, Method.Any)] + [SupportedStandards(NepStandard.Nep17Payable)] + public class Contract_SupportedStandard17Payable : SmartContract, INep17Payable + { + public void OnNEP17Payment(UInt160 from, BigInteger amount, object? data = null) + { + } + } +} diff --git a/tests/Neo.SmartContract.Framework.UnitTests/SupportedStandardsTest.cs b/tests/Neo.SmartContract.Framework.UnitTests/SupportedStandardsTest.cs index fc38dc99a..e2d356741 100644 --- a/tests/Neo.SmartContract.Framework.UnitTests/SupportedStandardsTest.cs +++ b/tests/Neo.SmartContract.Framework.UnitTests/SupportedStandardsTest.cs @@ -23,5 +23,17 @@ public void TestStandardNEP17AttributeEnum() { CollectionAssert.AreEqual(Contract_SupportedStandard17Enum.Manifest.SupportedStandards, new string[] { "NEP-17" }); } + + [TestMethod] + public void TestStandardNEP11PayableAttribute() + { + CollectionAssert.AreEqual(Contract_SupportedStandard11Payable.Manifest.SupportedStandards, new string[] { "NEP-26" }); + } + + [TestMethod] + public void TestStandardNEP17PayableAttribute() + { + CollectionAssert.AreEqual(Contract_SupportedStandard17Payable.Manifest.SupportedStandards, new string[] { "NEP-27" }); + } } } diff --git a/tests/Neo.SmartContract.Framework.UnitTests/TestingArtifacts/Contract_SupportedStandard11Enum.cs b/tests/Neo.SmartContract.Framework.UnitTests/TestingArtifacts/Contract_SupportedStandard11Enum.cs index 7d60c9fb4..c2d5316b9 100644 --- a/tests/Neo.SmartContract.Framework.UnitTests/TestingArtifacts/Contract_SupportedStandard11Enum.cs +++ b/tests/Neo.SmartContract.Framework.UnitTests/TestingArtifacts/Contract_SupportedStandard11Enum.cs @@ -10,9 +10,9 @@ public abstract class Contract_SupportedStandard11Enum : Neo.SmartContract.Testi { #region Compiled data - public static readonly Neo.SmartContract.Manifest.ContractManifest Manifest = Neo.SmartContract.Manifest.ContractManifest.Parse(@"{""name"":""Contract_SupportedStandard11Enum"",""groups"":[],""features"":{},""supportedstandards"":[""NEP-11""],""abi"":{""methods"":[{""name"":""symbol"",""parameters"":[],""returntype"":""String"",""offset"":953,""safe"":true},{""name"":""decimals"",""parameters"":[],""returntype"":""Integer"",""offset"":970,""safe"":true},{""name"":""totalSupply"",""parameters"":[],""returntype"":""Integer"",""offset"":45,""safe"":true},{""name"":""balanceOf"",""parameters"":[{""name"":""owner"",""type"":""Hash160""}],""returntype"":""Integer"",""offset"":71,""safe"":true},{""name"":""ownerOf"",""parameters"":[{""name"":""tokenId"",""type"":""ByteArray""}],""returntype"":""Hash160"",""offset"":267,""safe"":true},{""name"":""properties"",""parameters"":[{""name"":""tokenId"",""type"":""ByteArray""}],""returntype"":""Map"",""offset"":985,""safe"":true},{""name"":""tokens"",""parameters"":[],""returntype"":""InteropInterface"",""offset"":472,""safe"":true},{""name"":""tokensOf"",""parameters"":[{""name"":""owner"",""type"":""Hash160""}],""returntype"":""InteropInterface"",""offset"":502,""safe"":true},{""name"":""transfer"",""parameters"":[{""name"":""to"",""type"":""Hash160""},{""name"":""tokenId"",""type"":""ByteArray""},{""name"":""data"",""type"":""Any""}],""returntype"":""Boolean"",""offset"":595,""safe"":false},{""name"":""testStandard"",""parameters"":[],""returntype"":""Boolean"",""offset"":908,""safe"":false},{""name"":""onNEP11Payment"",""parameters"":[{""name"":""from"",""type"":""Hash160""},{""name"":""amount"",""type"":""Integer""},{""name"":""data"",""type"":""Any""}],""returntype"":""Void"",""offset"":1000,""safe"":false},{""name"":""_initialize"",""parameters"":[],""returntype"":""Void"",""offset"":918,""safe"":false}],""events"":[{""name"":""Transfer"",""parameters"":[{""name"":""from"",""type"":""Hash160""},{""name"":""to"",""type"":""Hash160""},{""name"":""amount"",""type"":""Integer""},{""name"":""tokenId"",""type"":""ByteArray""}]}]},""permissions"":[{""contract"":""0x726cb6e0cd8628a1350a611384688911ab75f51b"",""methods"":[""sha256""]},{""contract"":""0xacce6fd80d44e1796aa0c2c625e9e4e0ce39efc0"",""methods"":[""deserialize"",""serialize""]},{""contract"":""0xfffdc93764dbaddd97c48f252a53ea4643faa3fd"",""methods"":[""getContract""]},{""contract"":""*"",""methods"":[""onNEP11Payment""]}],""trusts"":[],""extra"":{}}"); + public static readonly Neo.SmartContract.Manifest.ContractManifest Manifest = Neo.SmartContract.Manifest.ContractManifest.Parse(@"{""name"":""Contract_SupportedStandard11Enum"",""groups"":[],""features"":{},""supportedstandards"":[""NEP-11""],""abi"":{""methods"":[{""name"":""symbol"",""parameters"":[],""returntype"":""String"",""offset"":953,""safe"":true},{""name"":""decimals"",""parameters"":[],""returntype"":""Integer"",""offset"":970,""safe"":true},{""name"":""totalSupply"",""parameters"":[],""returntype"":""Integer"",""offset"":45,""safe"":true},{""name"":""balanceOf"",""parameters"":[{""name"":""owner"",""type"":""Hash160""}],""returntype"":""Integer"",""offset"":71,""safe"":true},{""name"":""ownerOf"",""parameters"":[{""name"":""tokenId"",""type"":""ByteArray""}],""returntype"":""Hash160"",""offset"":267,""safe"":true},{""name"":""properties"",""parameters"":[{""name"":""tokenId"",""type"":""ByteArray""}],""returntype"":""Map"",""offset"":985,""safe"":true},{""name"":""tokens"",""parameters"":[],""returntype"":""InteropInterface"",""offset"":472,""safe"":true},{""name"":""tokensOf"",""parameters"":[{""name"":""owner"",""type"":""Hash160""}],""returntype"":""InteropInterface"",""offset"":502,""safe"":true},{""name"":""transfer"",""parameters"":[{""name"":""to"",""type"":""Hash160""},{""name"":""tokenId"",""type"":""ByteArray""},{""name"":""data"",""type"":""Any""}],""returntype"":""Boolean"",""offset"":595,""safe"":false},{""name"":""testStandard"",""parameters"":[],""returntype"":""Boolean"",""offset"":908,""safe"":false},{""name"":""onNEP11Payment"",""parameters"":[{""name"":""from"",""type"":""Hash160""},{""name"":""amount"",""type"":""Integer""},{""name"":""tokenId"",""type"":""String""},{""name"":""data"",""type"":""Any""}],""returntype"":""Void"",""offset"":1000,""safe"":false},{""name"":""_initialize"",""parameters"":[],""returntype"":""Void"",""offset"":918,""safe"":false}],""events"":[{""name"":""Transfer"",""parameters"":[{""name"":""from"",""type"":""Hash160""},{""name"":""to"",""type"":""Hash160""},{""name"":""amount"",""type"":""Integer""},{""name"":""tokenId"",""type"":""ByteArray""}]}]},""permissions"":[{""contract"":""0x726cb6e0cd8628a1350a611384688911ab75f51b"",""methods"":[""sha256""]},{""contract"":""0xacce6fd80d44e1796aa0c2c625e9e4e0ce39efc0"",""methods"":[""deserialize"",""serialize""]},{""contract"":""0xfffdc93764dbaddd97c48f252a53ea4643faa3fd"",""methods"":[""getContract""]},{""contract"":""*"",""methods"":[""onNEP11Payment""]}],""trusts"":[],""extra"":{}}"); - public static readonly Neo.SmartContract.NefFile Nef = Neo.IO.Helper.AsSerializable(Convert.FromBase64String(@"TkVGM1Rlc3RpbmdFbmdpbmUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATA7znO4OTpJcbCoGp54UQN2G/OrAtkZXNlcmlhbGl6ZQEAAQ/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qiYHENsgIjVqeJgmJXhKaRBR0EVpNwEASnlowUVTi1BB5j8YhEUPeWo0ExF5eDQOenl4ajRKEdsgIgJAVwIDeng1tP3//0VBm/ZnzhQRiE4QUdBQEsBweHmL2yhxehC3JhEQaWjBRVOLUEHmPxiEIg5paMFFU4tQQS9Yxe1AVwEEwkp4z0p5z0oRz0p6zwwIVHJhbnNmZXJBlQFvYXlwaAuXqiQHENsgIgt5NwIAcGgLl6omIHt6EXgUwB8MDm9uTkVQMTFQYXltZW50eUFifVtSRUAR2yAiAkBXAARAVgMKFP7//wqL/P//Cl78//8TwGAKAv7//wp5/P//CxPAYUALEcBKWM9KNUP8//8jO/z//8JKWc9KNUf8//8jVPz//8JKWc9KNTj8//8jyf3//wsRwEpYz0o1FPz//yKeK4TEhA==")); + public static readonly Neo.SmartContract.NefFile Nef = Neo.IO.Helper.AsSerializable(Convert.FromBase64String(@"TkVGM1Rlc3RpbmdFbmdpbmUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATA7znO4OTpJcbCoGp54UQN2G/OrAtkZXNlcmlhbGl6ZQEAAQ/A7znO4OTpJcbCoGp54UQN2G/OrAlzZXJpYWxpemUBAAEP/aP6Q0bqUyolj8SX3a3bZDfJ/f8LZ2V0Q29udHJhY3QBAAEPG/V1qxGJaIQTYQo1oSiGzeC2bHIGc2hhMjU2AQABDwAA/fYDEM5AVwABeBAMB0VYQU1QTEXQeDQDQFcAAXg0A0BXAAF4NANAVwABQFcAARBAWtgmFwwBAEH2tGviQZJd6DFK2CYERRBKYkBXAQF4cGgLlyYHEdsgIg14StkoUMoAFLOrqiYlDCBUaGUgYXJndW1lbnQgIm93bmVyIiBpcyBpbnZhbGlkLjpBm/ZnzhERiE4QUdBQEsBweGjBRVOLUEGSXegxStgmBEUQ2yEiAkBXAgJBm/ZnzhERiE4QUdBQEsBweGjBRVOLUEGSXegxStgmBEUQ2yFxaXmeSnFFaRC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83,7 @@ public abstract class Contract_SupportedStandard11Enum : Neo.SmartContract.Testi /// Unsafe method /// [DisplayName("onNEP11Payment")] - public abstract void OnNEP11Payment(UInt160? from, BigInteger? amount, object? data = null); + public abstract void OnNEP11Payment(UInt160? from, BigInteger? amount, string? tokenId, object? data = null); /// /// Unsafe method diff --git a/tests/Neo.SmartContract.Framework.UnitTests/TestingArtifacts/Contract_SupportedStandard11Payable.cs b/tests/Neo.SmartContract.Framework.UnitTests/TestingArtifacts/Contract_SupportedStandard11Payable.cs new file mode 100644 index 000000000..bef090158 --- /dev/null +++ b/tests/Neo.SmartContract.Framework.UnitTests/TestingArtifacts/Contract_SupportedStandard11Payable.cs @@ -0,0 +1,34 @@ +using Neo.Cryptography.ECC; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Numerics; + +namespace Neo.SmartContract.Testing; + +public abstract class Contract_SupportedStandard11Payable : Neo.SmartContract.Testing.SmartContract +{ + #region Compiled data + + public static readonly Neo.SmartContract.Manifest.ContractManifest Manifest = Neo.SmartContract.Manifest.ContractManifest.Parse(@"{""name"":""Contract_SupportedStandard11Payable"",""groups"":[],""features"":{},""supportedstandards"":[""NEP-26""],""abi"":{""methods"":[{""name"":""onNEP11Payment"",""parameters"":[{""name"":""from"",""type"":""Hash160""},{""name"":""amount"",""type"":""Integer""},{""name"":""tokenId"",""type"":""String""},{""name"":""data"",""type"":""Any""}],""returntype"":""Void"",""offset"":15,""safe"":false}],""events"":[]},""permissions"":[{""contract"":""*"",""methods"":""*""}],""trusts"":[],""extra"":{""Description"":""\u003CDescription Here\u003E"",""Author"":""\u003CYour Name Or Company Here\u003E"",""Version"":""\u003CVersion String Here\u003E""}}"); + + public static readonly Neo.SmartContract.NefFile Nef = Neo.IO.Helper.AsSerializable(Convert.FromBase64String(@"TkVGM1Rlc3RpbmdFbmdpbmUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABVXAAVAVwABeDQDQFcAAUDCSjTzIu1tevRy")); + + #endregion + + #region Unsafe methods + + /// + /// Unsafe method + /// + [DisplayName("onNEP11Payment")] + public abstract void OnNEP11Payment(UInt160? from, BigInteger? amount, string? tokenId, object? data = null); + + #endregion + + #region Constructor for internal use only + + protected Contract_SupportedStandard11Payable(Neo.SmartContract.Testing.SmartContractInitialize initialize) : base(initialize) { } + + #endregion +} diff --git a/tests/Neo.SmartContract.Framework.UnitTests/TestingArtifacts/Contract_SupportedStandard17Payable.cs b/tests/Neo.SmartContract.Framework.UnitTests/TestingArtifacts/Contract_SupportedStandard17Payable.cs new file mode 100644 index 000000000..35b371918 --- /dev/null +++ b/tests/Neo.SmartContract.Framework.UnitTests/TestingArtifacts/Contract_SupportedStandard17Payable.cs @@ -0,0 +1,34 @@ +using Neo.Cryptography.ECC; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Numerics; + +namespace Neo.SmartContract.Testing; + +public abstract class Contract_SupportedStandard17Payable : Neo.SmartContract.Testing.SmartContract +{ + #region Compiled data + + public static readonly Neo.SmartContract.Manifest.ContractManifest Manifest = Neo.SmartContract.Manifest.ContractManifest.Parse(@"{""name"":""Contract_SupportedStandard17Payable"",""groups"":[],""features"":{},""supportedstandards"":[""NEP-27""],""abi"":{""methods"":[{""name"":""onNEP17Payment"",""parameters"":[{""name"":""from"",""type"":""Hash160""},{""name"":""amount"",""type"":""Integer""},{""name"":""data"",""type"":""Any""}],""returntype"":""Void"",""offset"":15,""safe"":false}],""events"":[]},""permissions"":[{""contract"":""*"",""methods"":""*""}],""trusts"":[],""extra"":{""Description"":""\u003CDescription Here\u003E"",""Author"":""\u003CYour Name Or Company Here\u003E"",""Version"":""\u003CVersion String Here\u003E""}}"); + + public static readonly Neo.SmartContract.NefFile Nef = Neo.IO.Helper.AsSerializable(Convert.FromBase64String(@"TkVGM1Rlc3RpbmdFbmdpbmUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABVXAARAVwABeDQDQFcAAUDCSjTzIu3rbva0")); + + #endregion + + #region Unsafe methods + + /// + /// Unsafe method + /// + [DisplayName("onNEP17Payment")] + public abstract void OnNEP17Payment(UInt160? from, BigInteger? amount, object? data = null); + + #endregion + + #region Constructor for internal use only + + protected Contract_SupportedStandard17Payable(Neo.SmartContract.Testing.SmartContractInitialize initialize) : base(initialize) { } + + #endregion +}