Skip to content

Commit f6c637e

Browse files
Jim8yvncoelhoshargon
authored
[Framework Add] implement payable (#990)
* implement payable * adopt NEP25 and NEP26 * Apply suggestions from code review * Fix nep11 * Remove safe check * fix onnep11payable * use NEP 26 and NEP 27 --------- Co-authored-by: Vitor Nazário Coelho <[email protected]> Co-authored-by: Shargon <[email protected]>
1 parent 923e9f3 commit f6c637e

File tree

10 files changed

+189
-5
lines changed

10 files changed

+189
-5
lines changed

src/Neo.Compiler.CSharp/ContractManifestExtension.cs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,45 @@ private static void CheckNep17Compliant(this ContractManifest manifest)
163163
}
164164
}
165165

166+
private static void CheckNep11PayableCompliant(this ContractManifest manifest)
167+
{
168+
try
169+
{
170+
var onNEP11PaymentMethod = manifest.Abi.GetMethod("onNEP11Payment", 4);
171+
var onNEP11PaymentValid = onNEP11PaymentMethod is { ReturnType: ContractParameterType.Void } &&
172+
onNEP11PaymentMethod.Parameters[0].Type == ContractParameterType.Hash160 &&
173+
onNEP11PaymentMethod.Parameters[1].Type == ContractParameterType.Integer &&
174+
onNEP11PaymentMethod.Parameters[2].Type == ContractParameterType.String &&
175+
onNEP11PaymentMethod.Parameters[3].Type == ContractParameterType.Any;
176+
177+
if (!onNEP11PaymentValid) throw new CompilationException(DiagnosticId.IncorrectNEPStandard,
178+
$"Incomplete NEP standard {NepStandard.Nep11Payable.ToStandard()} implementation: onNEP11Payment");
179+
}
180+
catch (Exception ex) when (ex is not CompilationException)
181+
{
182+
throw new CompilationException(DiagnosticId.IncorrectNEPStandard, $"Incomplete NEP standard {NepStandard.Nep11Payable.ToStandard()} implementation: Unidentified issue.");
183+
}
184+
}
185+
186+
private static void CheckNep17PayableCompliant(this ContractManifest manifest)
187+
{
188+
try
189+
{
190+
var onNEP17PaymentMethod = manifest.Abi.GetMethod("onNEP17Payment", 3);
191+
var onNEP17PaymentValid = onNEP17PaymentMethod is { ReturnType: ContractParameterType.Void } &&
192+
onNEP17PaymentMethod.Parameters[0].Type == ContractParameterType.Hash160 &&
193+
onNEP17PaymentMethod.Parameters[1].Type == ContractParameterType.Integer &&
194+
onNEP17PaymentMethod.Parameters[2].Type == ContractParameterType.Any;
195+
196+
if (!onNEP17PaymentValid) throw new CompilationException(DiagnosticId.IncorrectNEPStandard,
197+
$"Incomplete NEP standard {NepStandard.Nep17Payable.ToStandard()} implementation: onNEP17Payment");
198+
}
199+
catch (Exception ex) when (ex is not CompilationException)
200+
{
201+
throw new CompilationException(DiagnosticId.IncorrectNEPStandard, $"Incomplete NEP standard {NepStandard.Nep17Payable.ToStandard()} implementation: Unidentified issue.");
202+
}
203+
}
204+
166205
internal static ContractManifest CheckStandards(this ContractManifest manifest)
167206
{
168207
if (manifest.SupportedStandards.Contains(NepStandard.Nep11.ToStandard()))
@@ -175,6 +214,16 @@ internal static ContractManifest CheckStandards(this ContractManifest manifest)
175214
manifest.CheckNep17Compliant();
176215
}
177216

217+
if (manifest.SupportedStandards.Contains(NepStandard.Nep11Payable.ToStandard()))
218+
{
219+
manifest.CheckNep11PayableCompliant();
220+
}
221+
222+
if (manifest.SupportedStandards.Contains(NepStandard.Nep17Payable.ToStandard()))
223+
{
224+
manifest.CheckNep17PayableCompliant();
225+
}
226+
178227
return manifest;
179228
}
180229
}

src/Neo.SmartContract.Framework/Interfaces/INEP11Payable.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public interface INep11Payable
2626
/// </summary>
2727
/// <param name="from">The address of the payer</param>
2828
/// <param name="amount">The amount of token to be transferred</param>
29+
/// <param name="tokenId">The token id to be transferred</param>
2930
/// <param name="data">Additional payment description data</param>
3031
/// <remarks>
3132
/// This interface method is defined as non-static,
@@ -34,5 +35,5 @@ public interface INep11Payable
3435
/// Both static and non-static methods of smart contract interface works,
3536
/// they differs on how you process static field.
3637
/// </remarks>
37-
public void OnNEP11Payment(UInt160 from, BigInteger amount, object? data = null);
38+
public void OnNEP11Payment(UInt160 from, BigInteger amount, string tokenId, object? data = null);
3839
}

src/Neo.SmartContract.Framework/NEPStandard.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@ public enum NepStandard
1919
// The NEP-17 standard is used for fungible tokens.
2020
// Defined at https://github.com/neo-project/proposals/blob/master/nep-17.mediawiki
2121
Nep17,
22+
// Smart contract transfer callback for non-fungible tokens (NFTs).
23+
// This is an extension standard of NEP-11.
24+
// Defined at https://github.com/neo-project/proposals/pull/169/files#diff-2b5f7c12a23f7dbe4cb46bbf4be6936882f8e0f0b3a4db9d8c58eb294b02e6ed
25+
Nep26,
26+
// This is the nick name of NEP-25.
27+
Nep11Payable,
28+
// Smart contract transfer callback for fungible tokens.
29+
// This is an extension standard of NEP-17.
30+
// Defined at https://github.com/neo-project/proposals/pull/169/files#diff-70768f307c9aa84f8c94e790495a76d47fffeca2331444592ebba6f13b1e6460
31+
Nep27,
32+
// This is the nick name of NEP-26.
33+
Nep17Payable,
2234
// This NEP defines a global standard to get royalty payment information for Non-Fungible Tokens (NFTs)
2335
// in order to enable support for royalty payments across all NFT marketplaces in the NEO Smart Economy.
2436
// This NEP requires NEP-11.
@@ -35,6 +47,8 @@ public static string ToStandard(this NepStandard standard)
3547
NepStandard.Nep11 => "NEP-11",
3648
NepStandard.Nep17 => "NEP-17",
3749
NepStandard.Nep24 => "NEP-24",
50+
NepStandard.Nep11Payable or NepStandard.Nep26 => "NEP-26",
51+
NepStandard.Nep17Payable or NepStandard.Nep27 => "NEP-27",
3852
_ => standard.ToString()
3953
};
4054
}

tests/Neo.SmartContract.Framework.TestContracts/Contract_SupportedStandard11Enum.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static bool TestStandard()
1414

1515
public override string Symbol { [Safe] get; } = "EXAMPLE";
1616

17-
public void OnNEP11Payment(UInt160 from, BigInteger amount, object? data = null)
17+
public void OnNEP11Payment(UInt160 from, BigInteger amount, string tokenId, object? data = null)
1818
{
1919
}
2020
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using Neo.SmartContract.Framework.Attributes;
2+
using System.ComponentModel;
3+
using System.Numerics;
4+
using Neo.SmartContract.Framework.Interfaces;
5+
6+
namespace Neo.SmartContract.Framework.TestContracts
7+
{
8+
[DisplayName(nameof(Contract_SupportedStandard11Payable))]
9+
[ContractDescription("<Description Here>")]
10+
[ContractAuthor("<Your Name Or Company Here>", "<Your Public Email Here>")]
11+
[ContractVersion("<Version String Here>")]
12+
[ContractPermission(Permission.Any, Method.Any)]
13+
[SupportedStandards(NepStandard.Nep11Payable)]
14+
public class Contract_SupportedStandard11Payable : SmartContract, INep11Payable
15+
{
16+
public void OnNEP11Payment(UInt160 from, BigInteger amount, string tokenId, object? data = null)
17+
{
18+
}
19+
}
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using Neo.SmartContract.Framework.Attributes;
2+
using System.ComponentModel;
3+
using System.Numerics;
4+
using Neo.SmartContract.Framework.Interfaces;
5+
6+
namespace Neo.SmartContract.Framework.TestContracts
7+
{
8+
[DisplayName(nameof(Contract_SupportedStandard17Payable))]
9+
[ContractDescription("<Description Here>")]
10+
[ContractAuthor("<Your Name Or Company Here>", "<Your Public Email Here>")]
11+
[ContractVersion("<Version String Here>")]
12+
[ContractPermission(Permission.Any, Method.Any)]
13+
[SupportedStandards(NepStandard.Nep17Payable)]
14+
public class Contract_SupportedStandard17Payable : SmartContract, INep17Payable
15+
{
16+
public void OnNEP17Payment(UInt160 from, BigInteger amount, object? data = null)
17+
{
18+
}
19+
}
20+
}

tests/Neo.SmartContract.Framework.UnitTests/SupportedStandardsTest.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,17 @@ public void TestStandardNEP17AttributeEnum()
2323
{
2424
CollectionAssert.AreEqual(Contract_SupportedStandard17Enum.Manifest.SupportedStandards, new string[] { "NEP-17" });
2525
}
26+
27+
[TestMethod]
28+
public void TestStandardNEP11PayableAttribute()
29+
{
30+
CollectionAssert.AreEqual(Contract_SupportedStandard11Payable.Manifest.SupportedStandards, new string[] { "NEP-26" });
31+
}
32+
33+
[TestMethod]
34+
public void TestStandardNEP17PayableAttribute()
35+
{
36+
CollectionAssert.AreEqual(Contract_SupportedStandard17Payable.Manifest.SupportedStandards, new string[] { "NEP-27" });
37+
}
2638
}
2739
}

tests/Neo.SmartContract.Framework.UnitTests/TestingArtifacts/Contract_SupportedStandard11Enum.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ public abstract class Contract_SupportedStandard11Enum : Neo.SmartContract.Testi
1010
{
1111
#region Compiled data
1212

13-
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"":{}}");
13+
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"":{}}");
1414

15-
public static readonly Neo.SmartContract.NefFile Nef = Neo.IO.Helper.AsSerializable<Neo.SmartContract.NefFile>(Convert.FromBase64String(@"TkVGM1Rlc3RpbmdFbmdpbmUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATA7znO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Bm/ZnzhLAcHlowUVTi1BBkl3oMTcAAHFpEM5yakH4J+yMqiYHENsgIjVqeJgmJXhKaRBR0EVpNwEASnlowUVTi1BB5j8YhEUPeWo0ExF5eDQOenl4ajRKEdsgIgJAVwIDeng1tP3//0VBm/ZnzhQRiE4QUdBQEsBweHmL2yhxehC3JhEQaWjBRVOLUEHmPxiEIg5paMFFU4tQQS9Yxe1AVwEEwkp4z0p5z0oRz0p6zwwIVHJhbnNmZXJBlQFvYXlwaAuXqiQHENsgIgt5NwIAcGgLl6omIHt6EXgUwB8MDm9uTkVQMTFQYXltZW50eUFifVtSRUAR2yAiAkBXAARAVgMKFP7//wqL/P//Cl78//8TwGAKAv7//wp5/P//CxPAYUALEcBKWM9KNUP8//8jO/z//8JKWc9KNUf8//8jVPz//8JKWc9KNTj8//8jyf3//wsRwEpYz0o1FPz//yKeK4TEhA=="));
15+
public static readonly Neo.SmartContract.NefFile Nef = Neo.IO.Helper.AsSerializable<Neo.SmartContract.NefFile>(Convert.FromBase64String(@"TkVGM1Rlc3RpbmdFbmdpbmUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATA7znO4OTpJcbCoGp54UQN2G/OrAtkZXNlcmlhbGl6ZQEAAQ/A7znO4OTpJcbCoGp54UQN2G/OrAlzZXJpYWxpemUBAAEP/aP6Q0bqUyolj8SX3a3bZDfJ/f8LZ2V0Q29udHJhY3QBAAEPG/V1qxGJaIQTYQo1oSiGzeC2bHIGc2hhMjU2AQABDwAA/fYDEM5AVwABeBAMB0VYQU1QTEXQeDQDQFcAAXg0A0BXAAF4NANAVwABQFcAARBAWtgmFwwBAEH2tGviQZJd6DFK2CYERRBKYkBXAQF4cGgLlyYHEdsgIg14StkoUMoAFLOrqiYlDCBUaGUgYXJndW1lbnQgIm93bmVyIiBpcyBpbnZhbGlkLjpBm/ZnzhERiE4QUdBQEsBweGjBRVOLUEGSXegxStgmBEUQ2yEiAk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//8jVPz//8JKWc9KNTj8//8jyf3//wsRwEpYz0o1FPz//yKevncGMg=="));
1616

1717
#endregion
1818

@@ -83,7 +83,7 @@ public abstract class Contract_SupportedStandard11Enum : Neo.SmartContract.Testi
8383
/// Unsafe method
8484
/// </summary>
8585
[DisplayName("onNEP11Payment")]
86-
public abstract void OnNEP11Payment(UInt160? from, BigInteger? amount, object? data = null);
86+
public abstract void OnNEP11Payment(UInt160? from, BigInteger? amount, string? tokenId, object? data = null);
8787

8888
/// <summary>
8989
/// Unsafe method
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using Neo.Cryptography.ECC;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.ComponentModel;
5+
using System.Numerics;
6+
7+
namespace Neo.SmartContract.Testing;
8+
9+
public abstract class Contract_SupportedStandard11Payable : Neo.SmartContract.Testing.SmartContract
10+
{
11+
#region Compiled data
12+
13+
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""}}");
14+
15+
public static readonly Neo.SmartContract.NefFile Nef = Neo.IO.Helper.AsSerializable<Neo.SmartContract.NefFile>(Convert.FromBase64String(@"TkVGM1Rlc3RpbmdFbmdpbmUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABVXAAVAVwABeDQDQFcAAUDCSjTzIu1tevRy"));
16+
17+
#endregion
18+
19+
#region Unsafe methods
20+
21+
/// <summary>
22+
/// Unsafe method
23+
/// </summary>
24+
[DisplayName("onNEP11Payment")]
25+
public abstract void OnNEP11Payment(UInt160? from, BigInteger? amount, string? tokenId, object? data = null);
26+
27+
#endregion
28+
29+
#region Constructor for internal use only
30+
31+
protected Contract_SupportedStandard11Payable(Neo.SmartContract.Testing.SmartContractInitialize initialize) : base(initialize) { }
32+
33+
#endregion
34+
}

0 commit comments

Comments
 (0)