forked from neo-project/neo-devpack-dotnet
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Framework] add interfaces (neo-project#952)
- Loading branch information
1 parent
bbe2a8f
commit 909e4c4
Showing
5 changed files
with
57 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/Neo.SmartContract.Framework/Interfaces/INEP11Payment.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System.Numerics; | ||
|
||
namespace Neo.SmartContract.Framework.Interfaces; | ||
|
||
/// <summary> | ||
/// Interface of method that indicate a contract receive NEP-11 Payment | ||
/// </summary> | ||
public interface INep11Payment | ||
{ | ||
/// <summary> | ||
/// NonFungibleToken contracts should implement the <see cref="OnNEP11Payment"/> method | ||
/// to receive assets and modify the Manifest file to trust the received asset contract. | ||
/// </summary> | ||
/// <param name="from">The address of the payer</param> | ||
/// <param name="amount">The amount of token to be transferred</param> | ||
/// <param name="data">Additional payment description data</param> | ||
public void OnNEP11Payment(UInt160 from, BigInteger amount, object? data = null); | ||
} |
18 changes: 18 additions & 0 deletions
18
src/Neo.SmartContract.Framework/Interfaces/INEP17Payment.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System.Numerics; | ||
|
||
namespace Neo.SmartContract.Framework.Interfaces; | ||
|
||
/// <summary> | ||
/// Interface of method that indicate a contract receive NEP-17 Payment | ||
/// </summary> | ||
public interface INep17Payment | ||
{ | ||
/// <summary> | ||
/// The Token contract should implement the <see cref="OnNEP17Payment"/> method | ||
/// to receive assets and modify the Manifest file to trust the received asset contract. | ||
/// </summary> | ||
/// <param name="from">The address of the payer</param> | ||
/// <param name="amount">The amount of token to be transferred</param> | ||
/// <param name="data">Additional payment description data</param> | ||
public void OnNEP17Payment(UInt160 from, BigInteger amount, object? data = null); | ||
} |
8 changes: 7 additions & 1 deletion
8
tests/Neo.SmartContract.Framework.TestContracts/Contract_SupportedStandard11Enum.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,21 @@ | ||
using System.Numerics; | ||
using Neo.SmartContract.Framework.Attributes; | ||
using Neo.SmartContract.Framework.Interfaces; | ||
|
||
namespace Neo.SmartContract.Framework.UnitTests.TestClasses | ||
{ | ||
[SupportedStandards(NEPStandard.NEP11)] | ||
public class Contract_SupportedStandard11Enum : Nep11Token<Nep11TokenState> | ||
public class Contract_SupportedStandard11Enum : Nep11Token<Nep11TokenState>, INep11Payment | ||
{ | ||
public static bool TestStandard() | ||
{ | ||
return true; | ||
} | ||
|
||
public override string Symbol { [Safe] get; } | ||
|
||
public void OnNEP11Payment(UInt160 from, BigInteger amount, object? data = null) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters