File tree Expand file tree Collapse file tree
Neo.SmartContract.Framework/Interfaces
tests/Neo.SmartContract.Framework.TestContracts Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -116,11 +116,17 @@ private List<CompilationContext> CompileProjectContracts(Compilation compilation
116116 return Contexts . Select ( p => p . Value ) . ToList ( ) ;
117117 }
118118
119+ /// <summary>
120+ /// Sort the classes based on their topological dependencies
121+ /// </summary>
122+ /// <param name="dependencies">Contract dependencies map</param>
123+ /// <returns>List of sorted contracts</returns>
124+ /// <exception cref="InvalidOperationException"></exception>
119125 private static List < INamedTypeSymbol > TopologicalSort ( Dictionary < INamedTypeSymbol , List < INamedTypeSymbol > > dependencies )
120126 {
121127 var sorted = new List < INamedTypeSymbol > ( ) ;
122128 var visited = new HashSet < INamedTypeSymbol > ( SymbolEqualityComparer . Default ) ;
123- var visiting = new HashSet < INamedTypeSymbol > ( SymbolEqualityComparer . Default ) ; // 添加中间状态以检测循环依赖
129+ var visiting = new HashSet < INamedTypeSymbol > ( SymbolEqualityComparer . Default ) ; // for detecting cycles
124130
125131 void Visit ( INamedTypeSymbol classSymbol )
126132 {
Original file line number Diff line number Diff line change 1+ using System . Numerics ;
2+
3+ namespace Neo . SmartContract . Framework . Interfaces ;
4+
5+ /// <summary>
6+ /// Interface of method that indicate a contract receive NEP-11 Payment
7+ /// </summary>
8+ public interface INep11Payment
9+ {
10+ /// <summary>
11+ /// NonFungibleToken contracts should implement the <see cref="OnNEP11Payment"/> method
12+ /// to receive assets and modify the Manifest file to trust the received asset contract.
13+ /// </summary>
14+ /// <param name="from">The address of the payer</param>
15+ /// <param name="amount">The amount of token to be transferred</param>
16+ /// <param name="data">Additional payment description data</param>
17+ public void OnNEP11Payment ( UInt160 from , BigInteger amount , object ? data = null ) ;
18+ }
Original file line number Diff line number Diff line change 1+ using System . Numerics ;
2+
3+ namespace Neo . SmartContract . Framework . Interfaces ;
4+
5+ /// <summary>
6+ /// Interface of method that indicate a contract receive NEP-17 Payment
7+ /// </summary>
8+ public interface INep17Payment
9+ {
10+ /// <summary>
11+ /// The Token contract should implement the <see cref="OnNEP17Payment"/> method
12+ /// to receive assets and modify the Manifest file to trust the received asset contract.
13+ /// </summary>
14+ /// <param name="from">The address of the payer</param>
15+ /// <param name="amount">The amount of token to be transferred</param>
16+ /// <param name="data">Additional payment description data</param>
17+ public void OnNEP17Payment ( UInt160 from , BigInteger amount , object ? data = null ) ;
18+ }
Original file line number Diff line number Diff line change 1+ using System . Numerics ;
12using Neo . SmartContract . Framework . Attributes ;
3+ using Neo . SmartContract . Framework . Interfaces ;
24
35namespace Neo . SmartContract . Framework . UnitTests . TestClasses
46{
57 [ SupportedStandards ( NEPStandard . NEP11 ) ]
6- public class Contract_SupportedStandard11Enum : Nep11Token < Nep11TokenState >
8+ public class Contract_SupportedStandard11Enum : Nep11Token < Nep11TokenState > , INep11Payment
79 {
810 public static bool TestStandard ( )
911 {
1012 return true ;
1113 }
1214
1315 public override string Symbol { [ Safe ] get ; }
16+
17+ public void OnNEP11Payment ( UInt160 from , BigInteger amount , object ? data = null )
18+ {
19+ }
1420 }
1521}
Original file line number Diff line number Diff line change 11using Neo . SmartContract . Framework . Attributes ;
22using System . ComponentModel ;
3+ using System . Numerics ;
4+ using Neo . SmartContract . Framework . Interfaces ;
35
46namespace Neo . SmartContract . Framework . UnitTests . TestClasses
57{
@@ -11,9 +13,13 @@ namespace Neo.SmartContract.Framework.UnitTests.TestClasses
1113 [ ContractSourceCode ( "https://github.com/neo-project/neo-devpack-dotnet/tree/master/src/Neo.SmartContract.Template" ) ]
1214 [ ContractPermission ( "*" , "*" ) ]
1315 [ SupportedStandards ( NEPStandard . NEP17 ) ]
14- public class Contract_SupportedStandard17Enum : Nep17Token
16+ public class Contract_SupportedStandard17Enum : Nep17Token , INep17Payment
1517 {
1618 public override string Symbol { [ Safe ] get ; }
1719 public override byte Decimals { [ Safe ] get ; }
20+
21+ public void OnNEP17Payment ( UInt160 from , BigInteger amount , object ? data = null )
22+ {
23+ }
1824 }
1925}
You can’t perform that action at this time.
0 commit comments