-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/hello world #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
TheDarkKnightAelf
wants to merge
8
commits into
master
Choose a base branch
from
feature/hello-world
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
db43d44
Initial commit
TheDarkKnightAelf ce53ae9
updates on helloworld with tests
TheDarkKnightAelf db4208f
updates in tests to pass based on dependencies
TheDarkKnightAelf 32c8dd0
Merge branch 'feature/hello-world' of github.com:AElfProject/examples…
TheDarkKnightAelf 260473b
comments added
TheDarkKnightAelf 7c663b3
Add .gitignore
gldeng 25be4a8
Fix folders
gldeng 8fa593f
fix bug
ymlalf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,158 @@ | ||
| ## Ignore Visual Studio temporary files, build results, and | ||
| ## files generated by popular Visual Studio add-ons. | ||
|
|
||
| # User-specific files | ||
| *.suo | ||
| *.user | ||
| *.sln.docstates | ||
|
|
||
| # Build results | ||
|
|
||
| [Dd]ebug/ | ||
| [Rr]elease/ | ||
| x64/ | ||
| [Bb]in/ | ||
| [Oo]bj/ | ||
|
|
||
| # MSTest test Results | ||
| [Tt]est[Rr]esult*/ | ||
| [Bb]uild[Ll]og.* | ||
|
|
||
| *_i.c | ||
| *_p.c | ||
| *_i.h | ||
| *.ilk | ||
| *.meta | ||
| *.obj | ||
| *.pch | ||
| *.pdb | ||
| *.pgc | ||
| *.pgd | ||
| *.rsp | ||
| *.sbr | ||
| *.tlb | ||
| *.tli | ||
| *.tlh | ||
| *.tmp | ||
| *.tmp_proj | ||
| *.log | ||
| *.vspscc | ||
| *.vssscc | ||
| .builds | ||
| *.pidb | ||
| *.log | ||
| *.svclog | ||
| *.scc | ||
|
|
||
| # Visual C++ cache files | ||
| ipch/ | ||
| *.aps | ||
| *.ncb | ||
| *.opensdf | ||
| *.sdf | ||
| *.cachefile | ||
|
|
||
| # Visual Studio profiler | ||
| *.psess | ||
| *.vsp | ||
| *.vspx | ||
|
|
||
| # Guidance Automation Toolkit | ||
| *.gpState | ||
|
|
||
| # ReSharper is a .NET coding add-in | ||
| _ReSharper*/ | ||
| *.[Rr]e[Ss]harper | ||
| *.DotSettings.user | ||
|
|
||
| # Click-Once directory | ||
| publish/ | ||
|
|
||
| # Publish Web Output | ||
| *.Publish.xml | ||
| *.pubxml | ||
| *.azurePubxml | ||
|
|
||
| # NuGet Packages Directory | ||
| ## TODO: If you have NuGet Package Restore enabled, uncomment the next line | ||
| packages/ | ||
| ## TODO: If the tool you use requires repositories.config, also uncomment the next line | ||
| !packages/repositories.config | ||
|
|
||
| # Windows Azure Build Output | ||
| csx/ | ||
| *.build.csdef | ||
|
|
||
| # Windows Store app package directory | ||
| AppPackages/ | ||
|
|
||
| # Others | ||
| sql/ | ||
| *.Cache | ||
| ClientBin/ | ||
| [Ss]tyle[Cc]op.* | ||
| ![Ss]tyle[Cc]op.targets | ||
| ~$* | ||
| *~ | ||
| *.dbmdl | ||
| *.[Pp]ublish.xml | ||
|
|
||
| *.publishsettings | ||
|
|
||
| # RIA/Silverlight projects | ||
| Generated_Code/ | ||
|
|
||
| # Backup & report files from converting an old project file to a newer | ||
| # Visual Studio version. Backup files are not needed, because we have git ;-) | ||
| _UpgradeReport_Files/ | ||
| Backup*/ | ||
| UpgradeLog*.XML | ||
| UpgradeLog*.htm | ||
|
|
||
| # SQL Server files | ||
| App_Data/*.mdf | ||
| App_Data/*.ldf | ||
|
|
||
| # ========================= | ||
| # Windows detritus | ||
| # ========================= | ||
|
|
||
| # Windows image file caches | ||
| Thumbs.db | ||
| ehthumbs.db | ||
|
|
||
| # Folder config file | ||
| Desktop.ini | ||
|
|
||
| # Recycle Bin used on file shares | ||
| $RECYCLE.BIN/ | ||
|
|
||
| # Mac desktop service store files | ||
| .DS_Store | ||
|
|
||
| _NCrunch* | ||
|
|
||
| # ================================= | ||
| # Common IntelliJ Platform excludes | ||
| # ================================= | ||
|
|
||
| # User specific | ||
| **/.idea/**/workspace.xml | ||
| **/.idea/**/tasks.xml | ||
| **/.idea/shelf/* | ||
| **/.idea/dictionaries | ||
| **/.idea/httpRequests/ | ||
|
|
||
| # Sensitive or high-churn files | ||
| **/.idea/**/dataSources/ | ||
| **/.idea/**/dataSources.ids | ||
| **/.idea/**/dataSources.xml | ||
| **/.idea/**/dataSources.local.xml | ||
| **/.idea/**/sqlDataSources.xml | ||
| **/.idea/**/dynamic.xml | ||
|
|
||
| # Rider | ||
| # Rider auto-generates .iml files, and contentModel.xml | ||
| **/.idea/**/*.iml | ||
| **/.idea/**/contentModel.xml | ||
| **/.idea/**/modules.xml |
This file contains hidden or 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,23 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
| <PropertyGroup> | ||
| <TargetFramework>net6.0</TargetFramework> | ||
| <RootNamespace>AElf.Contracts.HelloWorld</RootNamespace> | ||
| <IsContract>true</IsContract> | ||
| </PropertyGroup> | ||
| <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> | ||
| <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow> | ||
| </PropertyGroup> | ||
| <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> | ||
| <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="AElf.Sdk.CSharp" Version="1.3.0" /> | ||
| <PackageReference Include="AElf.Tools" Version="1.0.2"> | ||
| <PrivateAssets>all</PrivateAssets> | ||
| <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
| </PackageReference> | ||
| </ItemGroup> | ||
|
|
||
| </Project> | ||
|
|
This file contains hidden or 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,34 @@ | ||
| using AElf.Sdk.CSharp; | ||
| using Google.Protobuf.WellKnownTypes; | ||
|
|
||
| namespace AElf.Contracts.HelloWorld | ||
| { | ||
| public partial class HelloWorld : HelloWorldContainer.HelloWorldBase | ||
| { | ||
| // Method to update the message value. | ||
| public override Empty Update(StringValue input) | ||
| { | ||
| // Set the message value in the contract state | ||
| State.Message.Value = input.Value; | ||
| // Trigger an event to notify listeners about the message update | ||
| Context.Fire(new UpdatedMessage | ||
| { | ||
| Value = input.Value | ||
| }); | ||
| // Return an empty response | ||
| return new Empty(); | ||
| } | ||
|
|
||
| // Method to read the current message value | ||
| public override StringValue Read(Empty input) | ||
| { | ||
| // Create a new StringValue object to hold the message value | ||
| StringValue value = new StringValue(); | ||
| // Set the value from the contract state | ||
| value.Value = State.Message.Value; | ||
| // Return the StringValue object | ||
| return value; | ||
| } | ||
| } | ||
|
|
||
| } |
This file contains hidden or 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,9 @@ | ||
| using AElf.Sdk.CSharp.State; | ||
|
|
||
| namespace AElf.Contracts.HelloWorld | ||
| { | ||
| public partial class HelloWorldState : ContractState | ||
| { | ||
| public StringState Message { get; set; } | ||
| } | ||
| } |
This file contains hidden or 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,53 @@ | ||
| /** | ||
| * AElf Standards ACS1(Transaction Fee Standard) | ||
| * | ||
| * Used to manage the transaction fee. | ||
| */ | ||
| syntax = "proto3"; | ||
|
|
||
| package acs1; | ||
|
|
||
| import public "aelf/options.proto"; | ||
| import public "google/protobuf/empty.proto"; | ||
| import public "google/protobuf/wrappers.proto"; | ||
| import "aelf/core.proto"; | ||
| import "Protobuf/message/authority_info.proto"; | ||
|
|
||
| option (aelf.identity) = "acs1"; | ||
| option csharp_namespace = "AElf.Standards.ACS1"; | ||
|
|
||
| service MethodFeeProviderContract { | ||
|
|
||
| // Set the method fees for the specified method. Note that this will override all fees of the method. | ||
| rpc SetMethodFee (MethodFees) returns (google.protobuf.Empty) { | ||
| } | ||
|
|
||
| // Change the method fee controller, the default is parliament and default organization. | ||
| rpc ChangeMethodFeeController (AuthorityInfo) returns (google.protobuf.Empty) { | ||
| } | ||
|
|
||
| // Query method fee information by method name. | ||
| rpc GetMethodFee (google.protobuf.StringValue) returns (MethodFees) { | ||
| option (aelf.is_view) = true; | ||
| } | ||
|
|
||
| // Query the method fee controller. | ||
| rpc GetMethodFeeController (google.protobuf.Empty) returns (AuthorityInfo) { | ||
| option (aelf.is_view) = true; | ||
| } | ||
| } | ||
|
|
||
| message MethodFees { | ||
| // The name of the method to be charged. | ||
| string method_name = 1; | ||
| // List of fees to be charged. | ||
| repeated MethodFee fees = 2; | ||
| bool is_size_fee_free = 3;// Optional based on the implementation of SetMethodFee method. | ||
| } | ||
|
|
||
| message MethodFee { | ||
| // The token symbol of the method fee. | ||
| string symbol = 1; | ||
| // The amount of fees to be charged. | ||
| int64 basic_fee = 2; | ||
| } |
26 changes: 26 additions & 0 deletions
26
basics/hello-world/src/Protobuf/contract/hello_world_contract.proto
This file contains hidden or 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,26 @@ | ||
| syntax = "proto3"; | ||
|
|
||
| import "aelf/core.proto"; | ||
| import "aelf/options.proto"; | ||
| import "google/protobuf/empty.proto"; | ||
| import "google/protobuf/wrappers.proto"; | ||
|
|
||
| option csharp_namespace = "AElf.Contracts.HelloWorld"; | ||
|
|
||
| service HelloWorld { | ||
| option (aelf.csharp_state) = "AElf.Contracts.HelloWorld.HelloWorldState"; | ||
|
|
||
| // Actions | ||
| rpc Update (google.protobuf.StringValue) returns (google.protobuf.Empty) { | ||
| } | ||
|
|
||
| // Views | ||
| rpc Read (google.protobuf.Empty) returns (google.protobuf.StringValue) { | ||
| option (aelf.is_view) = true; | ||
| } | ||
| } | ||
|
|
||
| message UpdatedMessage { | ||
| option (aelf.is_event) = true; | ||
| string value = 1; | ||
| } |
10 changes: 10 additions & 0 deletions
10
basics/hello-world/src/Protobuf/message/authority_info.proto
This file contains hidden or 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,10 @@ | ||
| syntax = "proto3"; | ||
|
|
||
| import "aelf/core.proto"; | ||
|
|
||
| option csharp_namespace = "AElf.Contracts.HelloWorld"; | ||
|
|
||
| message AuthorityInfo { | ||
| aelf.Address contract_address = 1; | ||
| aelf.Address owner_address = 2; | ||
| } |
33 changes: 33 additions & 0 deletions
33
basics/hello-world/test/AElf.Contracts.HelloWorld.Tests.csproj
This file contains hidden or 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,33 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <TargetFramework>net6.0</TargetFramework> | ||
| <RootNamespace>AElf.Contracts.HelloWorld</RootNamespace> | ||
| </PropertyGroup> | ||
|
|
||
| <PropertyGroup> | ||
| <NoWarn>0436</NoWarn> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="AElf.Testing.TestBase" Version="1.0.0" /> | ||
| <PackageReference Include="AElf.EconomicSystem" Version="1.3.0" /> | ||
| <PackageReference Include="AElf.GovernmentSystem" Version="1.3.0" /> | ||
| <PackageReference Include="coverlet.msbuild" Version="2.5.1" /> | ||
| <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" /> | ||
| <PackageReference Include="Shouldly" Version="3.0.2" /> | ||
| <PackageReference Include="xunit" Version="2.4.1" /> | ||
| <PackageReference Include="xunit.runner.console" Version="2.4.1" /> | ||
| <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" /> | ||
| <PackageReference Include="AElf.ContractTestKit" Version="1.3.0" /> | ||
| <PackageReference Include="AElf.Tools" Version="1.0.2"> | ||
| <PrivateAssets>all</PrivateAssets> | ||
| <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
| </PackageReference> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\src\AElf.Contracts.HelloWorld.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to fix class name.
Fixed in the next commit.