diff --git a/examples/Example.SmartContract.Event/Event.cs b/examples/Example.SmartContract.Event/Event.cs index e9bae09f5..ea73b4889 100644 --- a/examples/Example.SmartContract.Event/Event.cs +++ b/examples/Example.SmartContract.Event/Event.cs @@ -22,7 +22,7 @@ namespace Event; [ContractDescription("A sample contract that demonstrates how to use Events")] [ContractVersion("0.0.1")] [ContractSourceCode("https://github.com/neo-project/neo-devpack-dotnet/tree/master/examples/")] -[ContractPermission(Permission.WildCard, Method.WildCard)] +[ContractPermission(Permission.Any, Method.Any)] public class SampleEvent : SmartContract { [DisplayName("new_event_name")] diff --git a/examples/Example.SmartContract.Exception/Exception.cs b/examples/Example.SmartContract.Exception/Exception.cs index 2aa12f608..636e58eca 100644 --- a/examples/Example.SmartContract.Exception/Exception.cs +++ b/examples/Example.SmartContract.Exception/Exception.cs @@ -20,7 +20,7 @@ namespace Exception [ContractDescription("A sample contract to demonstrate how to handle exception")] [ContractVersion("0.0.1")] [ContractSourceCode("https://github.com/neo-project/neo-devpack-dotnet/tree/master/examples/")] - [ContractPermission(Permission.WildCard, Method.WildCard)] + [ContractPermission(Permission.Any, Method.Any)] public class SampleException : SmartContract { [ByteArray("0a0b0c0d0E0F")] diff --git a/examples/Example.SmartContract.HelloWorld/HelloWorld.cs b/examples/Example.SmartContract.HelloWorld/HelloWorld.cs index 6a656178c..48f44d65b 100644 --- a/examples/Example.SmartContract.HelloWorld/HelloWorld.cs +++ b/examples/Example.SmartContract.HelloWorld/HelloWorld.cs @@ -21,7 +21,7 @@ namespace HelloWorld; [ContractEmail("dev@neo.org")] [ContractVersion("0.0.1")] [ContractSourceCode("https://github.com/neo-project/neo-devpack-dotnet/tree/master/examples/")] -[ContractPermission(Permission.WildCard, Method.WildCard)] +[ContractPermission(Permission.Any, Method.Any)] public class HelloWorldorld : SmartContract { /// diff --git a/examples/Example.SmartContract.Inscription/Inscription.cs b/examples/Example.SmartContract.Inscription/Inscription.cs index f9c6c1760..8074adcc6 100644 --- a/examples/Example.SmartContract.Inscription/Inscription.cs +++ b/examples/Example.SmartContract.Inscription/Inscription.cs @@ -22,7 +22,7 @@ namespace Inscription [ContractDescription("A sample inscription contract.")] [ContractVersion("0.0.1")] [ContractSourceCode("https://github.com/neo-project/neo-devpack-dotnet/tree/master/examples/")] - [ContractPermission(Permission.WildCard, Method.WildCard)] + [ContractPermission(Permission.Any, Method.Any)] public class SampleInscription : SmartContract { /// diff --git a/examples/Example.SmartContract.NEP17/SampleNep17Token.cs b/examples/Example.SmartContract.NEP17/SampleNep17Token.cs index fb5e5f99a..454fe2a6b 100644 --- a/examples/Example.SmartContract.NEP17/SampleNep17Token.cs +++ b/examples/Example.SmartContract.NEP17/SampleNep17Token.cs @@ -25,7 +25,7 @@ namespace NEP17 [ContractVersion("0.0.1")] [ContractDescription("A sample NEP-17 token")] [ContractSourceCode("https://github.com/neo-project/neo-devpack-dotnet/tree/master/examples/")] - [ContractPermission(Permission.WildCard, Method.WildCard)] + [ContractPermission(Permission.Any, Method.Any)] [SupportedStandards(NepStandard.Nep17)] public class SampleNep17Token : Nep17Token { diff --git a/examples/Example.SmartContract.NFT/Loot.cs b/examples/Example.SmartContract.NFT/Loot.cs index d3980e92e..78e365e7f 100644 --- a/examples/Example.SmartContract.NFT/Loot.cs +++ b/examples/Example.SmartContract.NFT/Loot.cs @@ -24,7 +24,7 @@ namespace NFT [ContractAuthor("core-dev", "dev@neo.org")] [ContractDescription("This is a text Example.SmartContract.NFT")] [SupportedStandards(NepStandard.Nep11)] - [ContractPermission(Permission.WildCard, Method.OnNEP11Payment)] + [ContractPermission(Permission.Any, Method.OnNEP11Payment)] [ContractSourceCode("https://github.com/neo-project/neo-devpack-dotnet/tree/master/examples/")] public partial class Loot : Nep11Token { diff --git a/examples/Example.SmartContract.Oracle/Oracle.cs b/examples/Example.SmartContract.Oracle/Oracle.cs index 09ef97c01..ee3d9a88d 100644 --- a/examples/Example.SmartContract.Oracle/Oracle.cs +++ b/examples/Example.SmartContract.Oracle/Oracle.cs @@ -24,7 +24,7 @@ namespace Oracle [ContractDescription("A sample contract to demonstrate how to use Example.SmartContract.Oracle Service")] [ContractVersion("0.0.1")] [ContractSourceCode("https://github.com/neo-project/neo-devpack-dotnet/tree/master/examples/")] - [ContractPermission(Permission.WildCard, Method.WildCard)] + [ContractPermission(Permission.Any, Method.Any)] public class SampleOracle : SmartContract, IOracle { [Safe] diff --git a/examples/Example.SmartContract.SampleRoyaltyNEP11Token/SampleRoyaltyNEP11Token.cs b/examples/Example.SmartContract.SampleRoyaltyNEP11Token/SampleRoyaltyNEP11Token.cs index 6c63899e4..1eb5555b4 100644 --- a/examples/Example.SmartContract.SampleRoyaltyNEP11Token/SampleRoyaltyNEP11Token.cs +++ b/examples/Example.SmartContract.SampleRoyaltyNEP11Token/SampleRoyaltyNEP11Token.cs @@ -11,6 +11,7 @@ using Neo.SmartContract.Framework; using Neo.SmartContract.Framework.Attributes; +using Neo.SmartContract.Framework.Interfaces; using Neo.SmartContract.Framework.Native; using Neo.SmartContract.Framework.Services; using System.ComponentModel; @@ -24,9 +25,9 @@ namespace NonDivisibleNEP11 [ContractVersion("0.0.1")] [ContractDescription("A sample of NEP-11 Royalty Feature")] [ContractSourceCode("https://github.com/neo-project/neo-devpack-dotnet/tree/master/examples/")] - [ContractPermission(Permission.WildCard, Method.WildCard)] + [ContractPermission(Permission.Any, Method.Any)] [SupportedStandards(NepStandard.Nep11)] - public class SampleRoyaltyNEP11Token : Nep11Token + public class SampleRoyaltyNEP11Token : Nep11Token, INep24 { #region Owner diff --git a/examples/Example.SmartContract.Storage/ExampleStorage.cs b/examples/Example.SmartContract.Storage/ExampleStorage.cs index 4943fd317..2416c53cc 100644 --- a/examples/Example.SmartContract.Storage/ExampleStorage.cs +++ b/examples/Example.SmartContract.Storage/ExampleStorage.cs @@ -21,7 +21,7 @@ namespace ExampleStorage [ContractDescription("A sample contract to demonstrate how to use storage")] [ContractVersion("0.0.1")] [ContractSourceCode("https://github.com/neo-project/neo-devpack-dotnet/tree/master/examples/")] - [ContractPermission(Permission.WildCard, Method.WildCard)] + [ContractPermission(Permission.Any, Method.Any)] public class SampleStorage : SmartContract { #region Byte diff --git a/examples/Example.SmartContract.Transfer/TransferContract.cs b/examples/Example.SmartContract.Transfer/TransferContract.cs index 355fd1f71..dce2d4943 100644 --- a/examples/Example.SmartContract.Transfer/TransferContract.cs +++ b/examples/Example.SmartContract.Transfer/TransferContract.cs @@ -27,7 +27,7 @@ namespace Transfer; [ContractDescription("A sample contract to demonstrate how to transfer NEO and GAS")] [ContractVersion("1.0.0.0")] [ContractSourceCode("https://github.com/neo-project/neo-devpack-dotnet/tree/master/examples/")] -[ContractPermission(Permission.WildCard, Method.WildCard)] +[ContractPermission(Permission.Any, Method.Any)] public class TransferContract : SmartContract { private static readonly UInt160 Owner = "NUuJw4C4XJFzxAvSZnFTfsNoWZytmQKXQP"; diff --git a/examples/Example.SmartContract.ZKP/ExampleZKP.cs b/examples/Example.SmartContract.ZKP/ExampleZKP.cs index 734291a7f..1450a95de 100644 --- a/examples/Example.SmartContract.ZKP/ExampleZKP.cs +++ b/examples/Example.SmartContract.ZKP/ExampleZKP.cs @@ -22,7 +22,7 @@ namespace ZKP [ContractVersion("0.0.1")] [ContractDescription("A sample contract to demonstrate how to use Example.SmartContract.ZKPil")] [ContractSourceCode("https://github.com/neo-project/neo-devpack-dotnet/tree/master/examples/")] - [ContractPermission(Permission.WildCard, Method.WildCard)] + [ContractPermission(Permission.Any, Method.Any)] public class ExampleZKP : SmartContract { public static readonly byte[] alphaPoint = diff --git a/examples/examples.sln b/examples/examples.sln deleted file mode 100644 index 3ac0f51e6..000000000 --- a/examples/examples.sln +++ /dev/null @@ -1,169 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.5.002.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.SmartContract.ContractCall", "Example.SmartContract.ContractCall\Example.SmartContract.ContractCall.csproj", "{4B1FA60F-2BA9-4B0B-AA92-84F107038E44}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.SmartContract.ContractCall.UnitTests", "Example.SmartContract.ContractCall.UnitTests\Example.SmartContract.ContractCall.UnitTests.csproj", "{557DCF3B-9A7F-4B15-BFA0-17BDCF5EDA0A}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.SmartContract.Event", "Example.SmartContract.Event\Example.SmartContract.Event.csproj", "{AAB0ACD4-C4D1-478D-B803-2FF44C919B83}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.SmartContract.Event.UnitTests", "Example.SmartContract.Event.UnitTests\Example.SmartContract.Event.UnitTests.csproj", "{668DB629-9007-481D-8B56-E8C08EA9B73A}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.SmartContract.Exception", "Example.SmartContract.Exception\Example.SmartContract.Exception.csproj", "{6FFC167F-4D36-4145-81FD-9793F42DE4E4}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.SmartContract.Exception.UnitTests", "Example.SmartContract.Exception.UnitTests\Example.SmartContract.Exception.UnitTests.csproj", "{C01CD0B7-4091-407B-9353-827EEE2451D2}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.SmartContract.HelloWorld", "Example.SmartContract.HelloWorld\Example.SmartContract.HelloWorld.csproj", "{5C82A72F-70CE-4F1A-BE83-69CEA748AA3B}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.SmartContract.HelloWorld.UnitTests", "Example.SmartContract.HelloWorld.UnitTests\Example.SmartContract.HelloWorld.UnitTests.csproj", "{B5EE5257-B378-455D-91CD-07FFAD054647}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.SmartContract.Inscription", "Example.SmartContract.Inscription\Example.SmartContract.Inscription.csproj", "{9645A263-1448-4105-A496-5A02603E01E3}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.SmartContract.Inscription.UnitTests", "Example.SmartContract.Inscription.UnitTests\Example.SmartContract.Inscription.UnitTests.csproj", "{134077C9-5A2E-4D64-A94B-0D8292D5BFF2}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.SmartContract.Modifier", "Example.SmartContract.Modifier\Example.SmartContract.Modifier.csproj", "{E3708CCA-B764-4AA4-8D00-EA834FB54A60}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.SmartContract.Modifier.UnitTests", "Example.SmartContract.Modifier.UnitTests\Example.SmartContract.Modifier.UnitTests.csproj", "{EEC8D596-521A-4B30-81BC-CF8BA2090063}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.SmartContract.NEP17", "Example.SmartContract.NEP17\Example.SmartContract.NEP17.csproj", "{D537CC3E-7735-4064-B9C1-1F2B9BD6D9FE}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.SmartContract.NEP17.UnitTests", "Example.SmartContract.NEP17.UnitTests\Example.SmartContract.NEP17.UnitTests.csproj", "{9DF7C0EE-2313-4887-9BAD-26D61DF6EF52}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.SmartContract.NFT", "Example.SmartContract.NFT\Example.SmartContract.NFT.csproj", "{4950351C-CCBF-4BC9-90C5-50618940B8B7}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.SmartContract.NFT.UnitTests", "Example.SmartContract.NFT.UnitTests\Example.SmartContract.NFT.UnitTests.csproj", "{CE854059-6999-45D4-974F-D7196BCC5FEB}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.SmartContract.Oracle", "Example.SmartContract.Oracle\Example.SmartContract.Oracle.csproj", "{9D4A4AA9-AC5F-47FA-9900-C0F9F5287BB0}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.SmartContract.Oracle.UnitTests", "Example.SmartContract.Oracle.UnitTests\Example.SmartContract.Oracle.UnitTests.csproj", "{EFBDB1BD-6849-4892-8A3B-E3ABAEC25388}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.SmartContract.Storage", "Example.SmartContract.Storage\Example.SmartContract.Storage.csproj", "{13C86782-9FC4-4343-8502-8232C0773E5B}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.SmartContract.Storage.UnitTests", "Example.SmartContract.Storage.UnitTests\Example.SmartContract.Storage.UnitTests.csproj", "{DC4B60AF-FB27-4B95-9AF0-D727B61CD8AD}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.SmartContract.Transfer", "Example.SmartContract.Transfer\Example.SmartContract.Transfer.csproj", "{5E3BB907-B5B3-4D89-9996-C1491931A735}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.SmartContract.Transfer.UnitTests", "Example.SmartContract.Transfer.UnitTests\Example.SmartContract.Transfer.UnitTests.csproj", "{EF635B6F-B117-4DED-8D28-F5C959215EAA}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.SmartContract.ZKP", "Example.SmartContract.ZKP\Example.SmartContract.ZKP.csproj", "{AAA1866A-61ED-4A7A-91D6-938B5136F40E}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.SmartContract.ZKP.UnitTests", "Example.SmartContract.ZKP.UnitTests\Example.SmartContract.ZKP.UnitTests.csproj", "{8FCB5C06-EBBE-4519-8093-E70A2E87DEAD}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.SmartContract.SampleRoyaltyNEP11Token.UnitTests", "Example.SmartContract.SampleRoyaltyNEP11Token.UnitTests\Example.SmartContract.SampleRoyaltyNEP11Token.UnitTests.csproj", "{6C0759A7-EAA8-4B27-BDD8-C4D7F535E113}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4B1FA60F-2BA9-4B0B-AA92-84F107038E44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4B1FA60F-2BA9-4B0B-AA92-84F107038E44}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4B1FA60F-2BA9-4B0B-AA92-84F107038E44}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4B1FA60F-2BA9-4B0B-AA92-84F107038E44}.Release|Any CPU.Build.0 = Release|Any CPU - {557DCF3B-9A7F-4B15-BFA0-17BDCF5EDA0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {557DCF3B-9A7F-4B15-BFA0-17BDCF5EDA0A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {557DCF3B-9A7F-4B15-BFA0-17BDCF5EDA0A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {557DCF3B-9A7F-4B15-BFA0-17BDCF5EDA0A}.Release|Any CPU.Build.0 = Release|Any CPU - {AAB0ACD4-C4D1-478D-B803-2FF44C919B83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AAB0ACD4-C4D1-478D-B803-2FF44C919B83}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AAB0ACD4-C4D1-478D-B803-2FF44C919B83}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AAB0ACD4-C4D1-478D-B803-2FF44C919B83}.Release|Any CPU.Build.0 = Release|Any CPU - {668DB629-9007-481D-8B56-E8C08EA9B73A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {668DB629-9007-481D-8B56-E8C08EA9B73A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {668DB629-9007-481D-8B56-E8C08EA9B73A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {668DB629-9007-481D-8B56-E8C08EA9B73A}.Release|Any CPU.Build.0 = Release|Any CPU - {6FFC167F-4D36-4145-81FD-9793F42DE4E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6FFC167F-4D36-4145-81FD-9793F42DE4E4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6FFC167F-4D36-4145-81FD-9793F42DE4E4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6FFC167F-4D36-4145-81FD-9793F42DE4E4}.Release|Any CPU.Build.0 = Release|Any CPU - {C01CD0B7-4091-407B-9353-827EEE2451D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C01CD0B7-4091-407B-9353-827EEE2451D2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C01CD0B7-4091-407B-9353-827EEE2451D2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C01CD0B7-4091-407B-9353-827EEE2451D2}.Release|Any CPU.Build.0 = Release|Any CPU - {5C82A72F-70CE-4F1A-BE83-69CEA748AA3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5C82A72F-70CE-4F1A-BE83-69CEA748AA3B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5C82A72F-70CE-4F1A-BE83-69CEA748AA3B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5C82A72F-70CE-4F1A-BE83-69CEA748AA3B}.Release|Any CPU.Build.0 = Release|Any CPU - {B5EE5257-B378-455D-91CD-07FFAD054647}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B5EE5257-B378-455D-91CD-07FFAD054647}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B5EE5257-B378-455D-91CD-07FFAD054647}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B5EE5257-B378-455D-91CD-07FFAD054647}.Release|Any CPU.Build.0 = Release|Any CPU - {9645A263-1448-4105-A496-5A02603E01E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9645A263-1448-4105-A496-5A02603E01E3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9645A263-1448-4105-A496-5A02603E01E3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9645A263-1448-4105-A496-5A02603E01E3}.Release|Any CPU.Build.0 = Release|Any CPU - {134077C9-5A2E-4D64-A94B-0D8292D5BFF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {134077C9-5A2E-4D64-A94B-0D8292D5BFF2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {134077C9-5A2E-4D64-A94B-0D8292D5BFF2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {134077C9-5A2E-4D64-A94B-0D8292D5BFF2}.Release|Any CPU.Build.0 = Release|Any CPU - {E3708CCA-B764-4AA4-8D00-EA834FB54A60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E3708CCA-B764-4AA4-8D00-EA834FB54A60}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E3708CCA-B764-4AA4-8D00-EA834FB54A60}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E3708CCA-B764-4AA4-8D00-EA834FB54A60}.Release|Any CPU.Build.0 = Release|Any CPU - {EEC8D596-521A-4B30-81BC-CF8BA2090063}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EEC8D596-521A-4B30-81BC-CF8BA2090063}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EEC8D596-521A-4B30-81BC-CF8BA2090063}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EEC8D596-521A-4B30-81BC-CF8BA2090063}.Release|Any CPU.Build.0 = Release|Any CPU - {D537CC3E-7735-4064-B9C1-1F2B9BD6D9FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D537CC3E-7735-4064-B9C1-1F2B9BD6D9FE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D537CC3E-7735-4064-B9C1-1F2B9BD6D9FE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D537CC3E-7735-4064-B9C1-1F2B9BD6D9FE}.Release|Any CPU.Build.0 = Release|Any CPU - {9DF7C0EE-2313-4887-9BAD-26D61DF6EF52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9DF7C0EE-2313-4887-9BAD-26D61DF6EF52}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9DF7C0EE-2313-4887-9BAD-26D61DF6EF52}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9DF7C0EE-2313-4887-9BAD-26D61DF6EF52}.Release|Any CPU.Build.0 = Release|Any CPU - {4950351C-CCBF-4BC9-90C5-50618940B8B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4950351C-CCBF-4BC9-90C5-50618940B8B7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4950351C-CCBF-4BC9-90C5-50618940B8B7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4950351C-CCBF-4BC9-90C5-50618940B8B7}.Release|Any CPU.Build.0 = Release|Any CPU - {CE854059-6999-45D4-974F-D7196BCC5FEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CE854059-6999-45D4-974F-D7196BCC5FEB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CE854059-6999-45D4-974F-D7196BCC5FEB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CE854059-6999-45D4-974F-D7196BCC5FEB}.Release|Any CPU.Build.0 = Release|Any CPU - {9D4A4AA9-AC5F-47FA-9900-C0F9F5287BB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9D4A4AA9-AC5F-47FA-9900-C0F9F5287BB0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9D4A4AA9-AC5F-47FA-9900-C0F9F5287BB0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9D4A4AA9-AC5F-47FA-9900-C0F9F5287BB0}.Release|Any CPU.Build.0 = Release|Any CPU - {EFBDB1BD-6849-4892-8A3B-E3ABAEC25388}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EFBDB1BD-6849-4892-8A3B-E3ABAEC25388}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EFBDB1BD-6849-4892-8A3B-E3ABAEC25388}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EFBDB1BD-6849-4892-8A3B-E3ABAEC25388}.Release|Any CPU.Build.0 = Release|Any CPU - {13C86782-9FC4-4343-8502-8232C0773E5B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {13C86782-9FC4-4343-8502-8232C0773E5B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {13C86782-9FC4-4343-8502-8232C0773E5B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {13C86782-9FC4-4343-8502-8232C0773E5B}.Release|Any CPU.Build.0 = Release|Any CPU - {DC4B60AF-FB27-4B95-9AF0-D727B61CD8AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DC4B60AF-FB27-4B95-9AF0-D727B61CD8AD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DC4B60AF-FB27-4B95-9AF0-D727B61CD8AD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DC4B60AF-FB27-4B95-9AF0-D727B61CD8AD}.Release|Any CPU.Build.0 = Release|Any CPU - {5E3BB907-B5B3-4D89-9996-C1491931A735}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5E3BB907-B5B3-4D89-9996-C1491931A735}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5E3BB907-B5B3-4D89-9996-C1491931A735}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5E3BB907-B5B3-4D89-9996-C1491931A735}.Release|Any CPU.Build.0 = Release|Any CPU - {EF635B6F-B117-4DED-8D28-F5C959215EAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EF635B6F-B117-4DED-8D28-F5C959215EAA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EF635B6F-B117-4DED-8D28-F5C959215EAA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EF635B6F-B117-4DED-8D28-F5C959215EAA}.Release|Any CPU.Build.0 = Release|Any CPU - {AAA1866A-61ED-4A7A-91D6-938B5136F40E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AAA1866A-61ED-4A7A-91D6-938B5136F40E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AAA1866A-61ED-4A7A-91D6-938B5136F40E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AAA1866A-61ED-4A7A-91D6-938B5136F40E}.Release|Any CPU.Build.0 = Release|Any CPU - {8FCB5C06-EBBE-4519-8093-E70A2E87DEAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8FCB5C06-EBBE-4519-8093-E70A2E87DEAD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8FCB5C06-EBBE-4519-8093-E70A2E87DEAD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8FCB5C06-EBBE-4519-8093-E70A2E87DEAD}.Release|Any CPU.Build.0 = Release|Any CPU - {6C0759A7-EAA8-4B27-BDD8-C4D7F535E113}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6C0759A7-EAA8-4B27-BDD8-C4D7F535E113}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6C0759A7-EAA8-4B27-BDD8-C4D7F535E113}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6C0759A7-EAA8-4B27-BDD8-C4D7F535E113}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {8E04F9CB-CF94-4AD1-8537-E7BDFFEB7D08} - EndGlobalSection -EndGlobal diff --git a/src/Neo.SmartContract.Framework/Attributes/ContractPermissionAttribute.cs b/src/Neo.SmartContract.Framework/Attributes/ContractPermissionAttribute.cs index 56d0ca674..1a8190d4e 100644 --- a/src/Neo.SmartContract.Framework/Attributes/ContractPermissionAttribute.cs +++ b/src/Neo.SmartContract.Framework/Attributes/ContractPermissionAttribute.cs @@ -18,11 +18,11 @@ public class ContractPermissionAttribute : Attribute /// /// Specify which contract and methods are allowed to call from this contract. /// - /// Address of contract allowed to call + /// Address of contract allowed to call from this contract /// Name of method allowed to call. /// - /// If the contract is specified as Permission.WildCard, then all contracts are allowed to call the specified methods. - /// If the method is specified as Method.WildCard, then all methods are allowed to call from the specified contract. + /// If the contract is specified as , then this contract is allowed to call the specified methods of any other contract. + /// If the method is specified as , then all methods of the specified contract can be called. /// public ContractPermissionAttribute(string contract, params string[] methods) { diff --git a/src/Neo.SmartContract.Framework/Interfaces/INEP24.cs b/src/Neo.SmartContract.Framework/Interfaces/INEP24.cs new file mode 100644 index 000000000..563f48b70 --- /dev/null +++ b/src/Neo.SmartContract.Framework/Interfaces/INEP24.cs @@ -0,0 +1,53 @@ +// Copyright (C) 2015-2024 The Neo Project. +// +// INEP24.cs file belongs to the neo project and is free +// software distributed under the MIT software license, see the +// accompanying file LICENSE in the main directory of the +// repository or http://www.opensource.org/licenses/mit-license.php +// for more details. +// +// Redistribution and use in source and binary forms with or without +// modifications are permitted. + +using System.Numerics; + +namespace Neo.SmartContract.Framework.Interfaces; + +/// +/// Interface of supporting royalty information for Non-Fungible Tokens (NFTs) +/// +public interface INep24 +{ + /// + /// This implements Royalty Standard: https://github.com/neo-project/proposals/pull/155/ + /// This method returns a map of NeoVM Array stack item with single or multi array, each array includes royaltyRecipient and royaltyAmount + /// + /// tokenId + /// royaltyToken hash for payment + /// royaltyToken amount for payment + /// royaltyInfo + /// + /// + /// [Safe] + /// public static Map[] RoyaltyInfo(ByteString tokenId, UInt160 royaltyToken, BigInteger salePrice) + /// { + /// ExecutionEngine.Assert(OwnerOf(tokenId) != null, "This TokenId doesn't exist!"); + /// byte[] data = (byte[])Storage.Get(PrefixRoyalty + tokenId); + /// if (data == null) + /// { + /// var royaltyInfo = new Map(); + /// royaltyInfo["royaltyRecipient"] = InitialRecipient; + /// royaltyInfo["royaltyAmount"] = InitialFactor; + /// return new[] { royaltyInfo }; + /// } + /// else + /// { + /// return (Map[])StdLib.Deserialize((ByteString)data); + /// } + /// } + /// + public static abstract Map[] RoyaltyInfo( + ByteString tokenId, + UInt160 royaltyToken, + BigInteger salePrice); +} diff --git a/src/Neo.SmartContract.Framework/Method.cs b/src/Neo.SmartContract.Framework/Method.cs index 943ef4583..aad5b5852 100644 --- a/src/Neo.SmartContract.Framework/Method.cs +++ b/src/Neo.SmartContract.Framework/Method.cs @@ -9,6 +9,8 @@ // Redistribution and use in source and binary forms with or without // modifications are permitted. +using System; + namespace Neo.SmartContract.Framework; public static class Method @@ -16,8 +18,14 @@ public static class Method /// /// Indicates that the contract is allowed to call any method of allowed contract. /// + [Obsolete("Use Any instead.")] public const string WildCard = "*"; + /// + /// Indicates that the contract is allowed to call any method of allowed contract. + /// + public const string Any = "*"; + /// /// The name of the method that is called when a contract receives NEP-17 tokens. /// diff --git a/src/Neo.SmartContract.Framework/NEPStandard.cs b/src/Neo.SmartContract.Framework/NEPStandard.cs index be989728c..2241dbb7f 100644 --- a/src/Neo.SmartContract.Framework/NEPStandard.cs +++ b/src/Neo.SmartContract.Framework/NEPStandard.cs @@ -18,22 +18,25 @@ public enum NepStandard Nep11, // The NEP-17 standard is used for fungible tokens. // Defined at https://github.com/neo-project/proposals/blob/master/nep-17.mediawiki - Nep17 + Nep17, + // 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. + // Defined at https://github.com/neo-project/proposals/blob/master/nep-24.mediawiki + Nep24 } public static class NepStandardExtensions { public static string ToStandard(this NepStandard standard) { - switch (standard) + return standard switch { - case NepStandard.Nep11: - return "NEP-11"; - case NepStandard.Nep17: - return "NEP-17"; - default: - return standard.ToString(); - } + NepStandard.Nep11 => "NEP-11", + NepStandard.Nep17 => "NEP-17", + NepStandard.Nep24 => "NEP-24", + _ => standard.ToString() + }; } } } diff --git a/src/Neo.SmartContract.Framework/Nep11Token.cs b/src/Neo.SmartContract.Framework/Nep11Token.cs index 2f0ac139e..6e067af1a 100644 --- a/src/Neo.SmartContract.Framework/Nep11Token.cs +++ b/src/Neo.SmartContract.Framework/Nep11Token.cs @@ -18,7 +18,7 @@ namespace Neo.SmartContract.Framework { [SupportedStandards(NepStandard.Nep11)] - [ContractPermission(Permission.WildCard, Method.OnNEP11Payment)] + [ContractPermission(Permission.Any, Method.OnNEP11Payment)] public abstract class Nep11Token : TokenContract where TokenState : Nep11TokenState { diff --git a/src/Neo.SmartContract.Framework/Nep17Token.cs b/src/Neo.SmartContract.Framework/Nep17Token.cs index e994e6978..807aa7e2b 100644 --- a/src/Neo.SmartContract.Framework/Nep17Token.cs +++ b/src/Neo.SmartContract.Framework/Nep17Token.cs @@ -18,7 +18,7 @@ namespace Neo.SmartContract.Framework { [SupportedStandards(NepStandard.Nep17)] - [ContractPermission(Permission.WildCard, Method.OnNEP17Payment)] + [ContractPermission(Permission.Any, Method.OnNEP17Payment)] public abstract class Nep17Token : TokenContract { public delegate void OnTransferDelegate(UInt160 from, UInt160 to, BigInteger amount); diff --git a/src/Neo.SmartContract.Framework/Permission.cs b/src/Neo.SmartContract.Framework/Permission.cs index ee63e38df..498bbb99c 100644 --- a/src/Neo.SmartContract.Framework/Permission.cs +++ b/src/Neo.SmartContract.Framework/Permission.cs @@ -9,12 +9,23 @@ // Redistribution and use in source and binary forms with or without // modifications are permitted. +using System; + namespace Neo.SmartContract.Framework; +/// +/// Sets the permission for the developing contract to call a method of another contract. +/// public static class Permission { /// /// Indicates that the contract is allowed to call of any contract. /// + [Obsolete("Use Any instead.")] public const string WildCard = "*"; + + /// + /// Indicates that the contract is allowed to call of any contract. + /// + public const string Any = "*"; } diff --git a/src/Neo.SmartContract.Template/templates/neocontractnep17/Nep17Contract.cs b/src/Neo.SmartContract.Template/templates/neocontractnep17/Nep17Contract.cs index d0c43375f..8080084a3 100644 --- a/src/Neo.SmartContract.Template/templates/neocontractnep17/Nep17Contract.cs +++ b/src/Neo.SmartContract.Template/templates/neocontractnep17/Nep17Contract.cs @@ -14,8 +14,8 @@ namespace Neo.SmartContract.Template [ContractDescription( "")] [ContractVersion("")] [ContractSourceCode("https://github.com/neo-project/neo-devpack-dotnet/tree/master/src/Neo.SmartContract.Template/templates/neocontractnep17/Nep17Contract.cs")] - [ContractPermission("*", "*")] - [SupportedStandards("NEP-17")] + [ContractPermission(Permission.Any, Method.Any)] + [SupportedStandards(NepStandard.Nep17)] public class Nep17Contract : Neo.SmartContract.Framework.Nep17Token { #region Owner diff --git a/src/Neo.SmartContract.Template/templates/neocontractoracle/OracleRequest.cs b/src/Neo.SmartContract.Template/templates/neocontractoracle/OracleRequest.cs index 41447c371..1b348e901 100644 --- a/src/Neo.SmartContract.Template/templates/neocontractoracle/OracleRequest.cs +++ b/src/Neo.SmartContract.Template/templates/neocontractoracle/OracleRequest.cs @@ -15,7 +15,7 @@ namespace Neo.SmartContract.Template [ContractDescription( "")] [ContractVersion("")] [ContractSourceCode("https://github.com/neo-project/neo-devpack-dotnet/tree/master/src/Neo.SmartContract.Template/templates/neocontractoracle/OracleRequest.cs")] - [ContractPermission("*", "*")] + [ContractPermission(Permission.Any, Method.Any)] public class OracleRequest : Neo.SmartContract.Framework.SmartContract { [Safe] diff --git a/src/Neo.SmartContract.Template/templates/neocontractowner/Ownable.cs b/src/Neo.SmartContract.Template/templates/neocontractowner/Ownable.cs index 9788505e9..3ddaf08c2 100644 --- a/src/Neo.SmartContract.Template/templates/neocontractowner/Ownable.cs +++ b/src/Neo.SmartContract.Template/templates/neocontractowner/Ownable.cs @@ -14,7 +14,7 @@ namespace Neo.SmartContract.Template [ContractDescription( "")] [ContractVersion("")] [ContractSourceCode("https://github.com/neo-project/neo-devpack-dotnet/tree/master/src/Neo.SmartContract.Template/templates/neocontractowner/Ownable.cs")] - [ContractPermission("*", "*")] + [ContractPermission(Permission.Any, Method.Any)] public class Ownable : Neo.SmartContract.Framework.SmartContract { #region Owner diff --git a/tests/Neo.Compiler.CSharp.TestContracts/Contract_ABIAttributes.cs b/tests/Neo.Compiler.CSharp.TestContracts/Contract_ABIAttributes.cs index fe3797a76..6df970a1e 100644 --- a/tests/Neo.Compiler.CSharp.TestContracts/Contract_ABIAttributes.cs +++ b/tests/Neo.Compiler.CSharp.TestContracts/Contract_ABIAttributes.cs @@ -3,7 +3,7 @@ namespace Neo.Compiler.CSharp.TestContracts; -[ContractPermission(Permission.WildCard, "c")] +[ContractPermission(Permission.Any, "c")] [ContractPermission("0x01ff00ff00ff00ff00ff00ff00ff00ff00ff00a4", "a", "b")] [ContractTrust("0x0a0b00ff00ff00ff00ff00ff00ff00ff00ff00a4")] public class Contract_ABIAttributes : SmartContract.Framework.SmartContract diff --git a/tests/Neo.Compiler.CSharp.TestContracts/Contract_ABIAttributes2.cs b/tests/Neo.Compiler.CSharp.TestContracts/Contract_ABIAttributes2.cs index e62339862..a2c2f8c98 100644 --- a/tests/Neo.Compiler.CSharp.TestContracts/Contract_ABIAttributes2.cs +++ b/tests/Neo.Compiler.CSharp.TestContracts/Contract_ABIAttributes2.cs @@ -3,14 +3,14 @@ namespace Neo.Compiler.CSharp.TestContracts; -[ContractPermission(Permission.WildCard, "c")] +[ContractPermission(Permission.Any, "c")] [ContractPermission("0x01ff00ff00ff00ff00ff00ff00ff00ff00ff00a4", "a", "b")] [ContractPermission("0x01ff00ff00ff00ff00ff00ff00ff00ff00ff00a4")] -[ContractPermission("0x01ff00ff00ff00ff00ff00ff00ff00ff00ff00a4", Permission.WildCard)] +[ContractPermission("0x01ff00ff00ff00ff00ff00ff00ff00ff00ff00a4", Permission.Any)] [ContractPermission("0x01ff00ff00ff00ff00ff00ff00ff00ff00ff00a4", "*")] [ContractPermission("0x01ff00ff00ff00ff00ff00ff00ff00ff00ff00a4", "a")] [ContractPermission("*", "a")] -[ContractPermission("*", "*")] +[ContractPermission(Permission.Any, Method.Any)] [ContractPermission("*", "b")] [ContractTrust("0x0a0b00ff00ff00ff00ff00ff00ff00ff00ff00a4")] public class Contract_ABIAttributes2 : SmartContract.Framework.SmartContract diff --git a/tests/Neo.Compiler.CSharp.TestContracts/Contract_NEP11.cs b/tests/Neo.Compiler.CSharp.TestContracts/Contract_NEP11.cs index c356ce087..a1d2fb673 100644 --- a/tests/Neo.Compiler.CSharp.TestContracts/Contract_NEP11.cs +++ b/tests/Neo.Compiler.CSharp.TestContracts/Contract_NEP11.cs @@ -3,7 +3,7 @@ namespace Neo.Compiler.CSharp.TestContracts { - [SupportedStandards("NEP-11")] + [SupportedStandards(NepStandard.Nep11)] public class Contract_NEP11 : Nep11Token { public override string Symbol { [Safe] get => "TEST"; } diff --git a/tests/Neo.Compiler.CSharp.TestContracts/Contract_NEP17.cs b/tests/Neo.Compiler.CSharp.TestContracts/Contract_NEP17.cs index 5ef3d7d0e..b046a452a 100644 --- a/tests/Neo.Compiler.CSharp.TestContracts/Contract_NEP17.cs +++ b/tests/Neo.Compiler.CSharp.TestContracts/Contract_NEP17.cs @@ -3,7 +3,7 @@ namespace Neo.Compiler.CSharp.TestContracts { - [SupportedStandards("NEP-17")] + [SupportedStandards(NepStandard.Nep17)] public class Contract_NEP17 : Nep17Token { public override byte Decimals { [Safe] get => 8; } diff --git a/tests/Neo.SmartContract.Framework.TestContracts/Contract_Contract.cs b/tests/Neo.SmartContract.Framework.TestContracts/Contract_Contract.cs index f6d7958d5..6ac4d2926 100644 --- a/tests/Neo.SmartContract.Framework.TestContracts/Contract_Contract.cs +++ b/tests/Neo.SmartContract.Framework.TestContracts/Contract_Contract.cs @@ -4,7 +4,7 @@ namespace Neo.SmartContract.Framework.UnitTests.TestClasses { - [ContractPermission(Permission.WildCard, Method.WildCard)] + [ContractPermission(Permission.Any, Method.Any)] public class Contract_Contract : SmartContract { public static object Call(UInt160 scriptHash, string method, CallFlags flag, object[] args) diff --git a/tests/Neo.SmartContract.Framework.TestContracts/Contract_Create.cs b/tests/Neo.SmartContract.Framework.TestContracts/Contract_Create.cs index ffe956fe1..cd56cc5f6 100644 --- a/tests/Neo.SmartContract.Framework.TestContracts/Contract_Create.cs +++ b/tests/Neo.SmartContract.Framework.TestContracts/Contract_Create.cs @@ -4,7 +4,7 @@ namespace Neo.SmartContract.Framework.UnitTests.TestClasses { - [ContractPermission(Permission.WildCard, Method.WildCard)] + [ContractPermission(Permission.Any, Method.Any)] public class Contract_Create : SmartContract { public static string OldContract() diff --git a/tests/Neo.SmartContract.Framework.TestContracts/Contract_SupportedStandard17Enum.cs b/tests/Neo.SmartContract.Framework.TestContracts/Contract_SupportedStandard17Enum.cs index e64387b69..3e2e3095f 100644 --- a/tests/Neo.SmartContract.Framework.TestContracts/Contract_SupportedStandard17Enum.cs +++ b/tests/Neo.SmartContract.Framework.TestContracts/Contract_SupportedStandard17Enum.cs @@ -11,7 +11,7 @@ namespace Neo.SmartContract.Framework.UnitTests.TestClasses [ManifestExtra("Email", "")] [ManifestExtra("Version", "")] [ContractSourceCode("https://github.com/neo-project/neo-devpack-dotnet/tree/master/src/Neo.SmartContract.Template")] - [ContractPermission(Permission.WildCard, Method.WildCard)] + [ContractPermission(Permission.Any, Method.Any)] [SupportedStandards(NepStandard.Nep17)] public class Contract_SupportedStandard17Enum : Nep17Token, INep17Payable { diff --git a/tests/Neo.SmartContract.Framework.TestContracts/Contract_SupportedStandards.cs b/tests/Neo.SmartContract.Framework.TestContracts/Contract_SupportedStandards.cs index 3869ba84e..075e40a9d 100644 --- a/tests/Neo.SmartContract.Framework.TestContracts/Contract_SupportedStandards.cs +++ b/tests/Neo.SmartContract.Framework.TestContracts/Contract_SupportedStandards.cs @@ -3,6 +3,7 @@ namespace Neo.SmartContract.Framework.UnitTests.TestClasses { + // Both NEP-10 and NEP-5 are obsolete, but this is just a test contract [SupportedStandards("NEP-10", "NEP-5")] public class Contract_SupportedStandards : SmartContract {