Vscode Developing smart Contracts

Source: Internet
Author: User

Development tools EOS Development Ultimate Artifact-vscode (you absolutely can't find the dry goods)
Lome April 19, 2018 · Last from 18636292520 replies. On September 15, 2018 · 15,672 Reads

This post has been set as the essence of the posts!
EOS Development Ultimate Artifact-vscode (you will never find the dry goods)
Statement: This article by the EOS Chinese community, original first, reproduced please specify the original address, thank you.

Foreword: Recently has been suffering from EOS development does not have the use of the IDE, with a lot, tried a lot, people feel somewhat passable. As a result, the author in the long-time search practice, finally found the EOS development of the ultimate artifact-vscode. Of course this is only after the author after the test development attempt opinion.

Words not much to say below to get to the chase.

Vscode Installation
Download
We open a website to download vscode:https://code.visualstudio.com/download. Download and install are very convenient.

Installation
Win Windows installation, I believe everyone can successfully complete
Linux Linux, the official website downloads are Linux executables. deb,.rpm. Open the installation directly, it is also very convenient.
Mac OS, this I have not tried, should be installed very simple.
Configuration
The Vscode is very simple to install and easy to configure.

First, Eos is developed in C + +, so the C + + plugin is installed after opening vscode:

Ms-vscode.cpptools
This plugin is necessary, the other, there are many plugins are very useful, we can actively to find themselves.

Run Tests
First open the local EOS, and then you will see that there are many options at the bottom:

Build all Test
Click Build: After [all], you can select the area to build. Select [All] to build the entire EOS project.
Click Build[all] to build. :

Intelligent Contract Building
1. To create a smart contract, here I use the example of ' hello ' to illustrate.
The first is hello.cpp.

Include <eosiolib/eosio.hpp>include <eosiolib/print.hpp>

Namespaces with Eosio
using namespace Eosio;

All smart contracts are inherited from the contract class
Class Hello:public Eosio::contract {

Public
Using Contract::contract;

  /// @abi action  void hi( account_name user ) {     print( "Hello, ", name{user} );  }

};
Eosio_abi (Hello, (HI))
Hello.abi:

{
"Types": [],
"Structs": [{
"Name": "Hi",
"Base": "",
"Fields": [{
"Name": "User",
"Type": "Account_name"
}
]
}
],
"Actions": [{
"Name": "Hi",
"Type": "Hi"
}
],
"Tables": []
}
CMakeLists.txt:

File (GLOB abi_files "*.abi")
Configure_file ("${abi_files}" "${cmake_current_binary_dir}" copyonly)

Add_wast_executable (TARGET Hello
Include_folders "${standard_include_folders}"
LIBRARIES libc++ libc Eosiolib
Destination_folder ${cmake_current_binary_dir}
)
Then add hello to the CMakeLists.txt in the ' eos/contracts ' directory:
Add Command:

Add_subdirectory (Hello)
Then Build[all]. Build automatically after the CMake file. After the build is complete, you can see the well-built hello in the build/contracts directory:

After the build is complete, you can choose [Hello] after the build and compile it separately.

Code hints
Click Settings in the lower left corner, add the following configuration, and save, you will see a code hint:

"[CPP]": {
"Editor.autoindent": true,
"Editor.quicksuggestions": True
},
"[C]": {
"Editor.quicksuggestions": True
},
"Cmake-tools-helper.auto_set_cpptools_target": true,
Code hints Effect:

Vscode Debug
Debug mode is very simple, choose Debug: After you debug the code, hit a breakpoint, and then click on Debug can be debugged, the effect:

Everything is so simple, everything is so convenient.

Vscode Developing smart Contracts

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.