Skip to content

Commit

Permalink
Merge pull request #46 from AElfProject/add-acs12-hello-world-contract
Browse files Browse the repository at this point in the history
feat(acs12): added acs12 into template
  • Loading branch information
zhifenglee-aelf authored Jul 5, 2024
2 parents dbbf03a + 484771d commit 179fdf1
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
35 changes: 35 additions & 0 deletions templates/HelloWorldContract/src/Protobuf/reference/acs12.proto
Original file line number Diff line number Diff line change
@@ -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;
}
35 changes: 35 additions & 0 deletions templates/HelloWorldContract/test/Protobuf/reference/acs12.proto
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 179fdf1

Please sign in to comment.