From 484771daeba4d2b068fb7b2d010b77297b450aef Mon Sep 17 00:00:00 2001 From: zhifenglee-aelf Date: Fri, 5 Jul 2024 10:42:34 +0800 Subject: [PATCH] feat(acs12): added acs12 into template --- .../contract/hello_world_contract.proto | 4 ++- .../src/Protobuf/reference/acs12.proto | 35 +++++++++++++++++++ .../test/Protobuf/reference/acs12.proto | 35 +++++++++++++++++++ .../Protobuf/stub/hello_world_contract.proto | 2 ++ 4 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 templates/HelloWorldContract/src/Protobuf/reference/acs12.proto create mode 100644 templates/HelloWorldContract/test/Protobuf/reference/acs12.proto diff --git a/templates/HelloWorldContract/src/Protobuf/contract/hello_world_contract.proto b/templates/HelloWorldContract/src/Protobuf/contract/hello_world_contract.proto index c3c19fb..66bd8cb 100644 --- a/templates/HelloWorldContract/src/Protobuf/contract/hello_world_contract.proto +++ b/templates/HelloWorldContract/src/Protobuf/contract/hello_world_contract.proto @@ -3,13 +3,15 @@ syntax = "proto3"; import "aelf/options.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/wrappers.proto"; +import "Protobuf/reference/acs12.proto"; // The namespace of this class option csharp_namespace = "AElf.Contracts.HelloWorld"; service HelloWorld { // The name of the state class the smart contract is going to use to access blockchain state option (aelf.csharp_state) = "AElf.Contracts.HelloWorld.HelloWorldState"; - + option (aelf.base) = "Protobuf/reference/acs12.proto"; + // Actions (methods that modify contract state) // Stores the value in contract state rpc Update (google.protobuf.StringValue) returns (google.protobuf.Empty) { diff --git a/templates/HelloWorldContract/src/Protobuf/reference/acs12.proto b/templates/HelloWorldContract/src/Protobuf/reference/acs12.proto new file mode 100644 index 0000000..e6ead4b --- /dev/null +++ b/templates/HelloWorldContract/src/Protobuf/reference/acs12.proto @@ -0,0 +1,35 @@ +/** + * AElf Standards ACS12(User Contract Standard) + * + * Used to manage user contract. + */ +syntax = "proto3"; + +package acs12; + +import public "aelf/options.proto"; +import public "google/protobuf/empty.proto"; +import public "google/protobuf/wrappers.proto"; +import "aelf/core.proto"; + +option (aelf.identity) = "acs12"; +option csharp_namespace = "AElf.Standards.ACS12"; + +service UserContract{ + +} + +//Specified method fee for user contract. +message UserContractMethodFees { + // List of fees to be charged. + repeated UserContractMethodFee fees = 2; + // Optional based on the implementation of SetConfiguration method. + bool is_size_fee_free = 3; +} + +message UserContractMethodFee { + // The token symbol of the method fee. + string symbol = 1; + // The amount of fees to be charged. + int64 basic_fee = 2; +} \ No newline at end of file diff --git a/templates/HelloWorldContract/test/Protobuf/reference/acs12.proto b/templates/HelloWorldContract/test/Protobuf/reference/acs12.proto new file mode 100644 index 0000000..e6ead4b --- /dev/null +++ b/templates/HelloWorldContract/test/Protobuf/reference/acs12.proto @@ -0,0 +1,35 @@ +/** + * AElf Standards ACS12(User Contract Standard) + * + * Used to manage user contract. + */ +syntax = "proto3"; + +package acs12; + +import public "aelf/options.proto"; +import public "google/protobuf/empty.proto"; +import public "google/protobuf/wrappers.proto"; +import "aelf/core.proto"; + +option (aelf.identity) = "acs12"; +option csharp_namespace = "AElf.Standards.ACS12"; + +service UserContract{ + +} + +//Specified method fee for user contract. +message UserContractMethodFees { + // List of fees to be charged. + repeated UserContractMethodFee fees = 2; + // Optional based on the implementation of SetConfiguration method. + bool is_size_fee_free = 3; +} + +message UserContractMethodFee { + // The token symbol of the method fee. + string symbol = 1; + // The amount of fees to be charged. + int64 basic_fee = 2; +} \ No newline at end of file diff --git a/templates/HelloWorldContract/test/Protobuf/stub/hello_world_contract.proto b/templates/HelloWorldContract/test/Protobuf/stub/hello_world_contract.proto index c3c19fb..866b27b 100644 --- a/templates/HelloWorldContract/test/Protobuf/stub/hello_world_contract.proto +++ b/templates/HelloWorldContract/test/Protobuf/stub/hello_world_contract.proto @@ -3,12 +3,14 @@ syntax = "proto3"; import "aelf/options.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/wrappers.proto"; +import "Protobuf/reference/acs12.proto"; // The namespace of this class option csharp_namespace = "AElf.Contracts.HelloWorld"; service HelloWorld { // The name of the state class the smart contract is going to use to access blockchain state option (aelf.csharp_state) = "AElf.Contracts.HelloWorld.HelloWorldState"; + option (aelf.base) = "Protobuf/reference/acs12.proto"; // Actions (methods that modify contract state) // Stores the value in contract state