How to Use VSCode

2018-11-23  本文已影响0人  五角场李小白

<h1 align="center">How to Use VSCode</h1>
<p align="center" class="version">Version 0.1</p>

1. What is VSCode Extension for Ontology

Visual Studio Code combines the simplicity of a source code editor with powerful developer tooling, like IntelliSense code completion and debugging.

Before start, please check you have download VSCode.This extension adds support for development and testing of smart contracts on Ontology blockchain.

<div align="center">
<img src="https://raw.githubusercontent.com/ontio-community/bounty-program-report/master/image/vscode.png" >
</div>

Features:

  1. Compile: VSCode supports Python smart contracts (.py) and CSharp smart contracts (.cs).
  2. Deploy: Deploy smart contracts to MainNet / TestNet/ PrivateNet.
  3. Invoke: Execute or pre-execute a smart contract.
  4. Debug: Support debug procedure (StepIn, StepOut, Next, Continue, Stop, Restart), setting breakpoints, variables preview and set, and state store manipulation.

2. Extension Settings

This extension contributes the following settings:

Those settings can be changed in standard VSCode settings by clicking the gear box icon in lower left corner.

Settings 1
Settings 2

3. How to use Ontology extension?

Go to extensions market first, and then find and install the VSCode Extension for Ontology extension. Open any .py or .cs file in VS Code. The extension is now activated. This extension enhances the whole Smart contract development process.

3.1 Compile

To compile a smart contract, show context menu on any .py or .cs file.

Compile

Press Compile smart contract. You will be notified about the outcome of compilation through notifications. The compilation will produce compiled code in .avm file and smart contract description file in _abi.json file, both in build folder.

3.2 Deploy

To deploy a smart contract, show context menu on compiled .avm file.

Deploy 1

Press Deploy smart contract. A new panel with description form will show up. Enter the necessary information and press Deploy. You will be notified about the outcome of compilation through notifications.

Invoke & Debug

To invoke a method in the smart contract, opening the _abi.json file. A new panel with smart contract methods will show up.

Invoke 1

Double click on any of the methods to show invocation form. Fill out all the parameters and click the invoke button.

Invoke 2
Invoke 3

You will be notified about the progress of invocation through notifications and a new panel with invocation result will show up.

Invoke 4

If you want to debug a smart contract instead of invocation, pressing the Debug button. You can use standard debug features of VSCode like StepIn, StepOut, Next, Continue, Restart, Stop and breakpoints together with variables preview and set.

Extension author

上一篇下一篇

猜你喜欢

热点阅读