Skip to content

Extension for development and testing of Smart contracts on Ontology blockchain

License

Notifications You must be signed in to change notification settings

backslash47/vscode-ext-ontology

Repository files navigation

VSCode Extension for Ontology

Version Installs

This extension has been designed to help you in developing, testing and deploying smart contracts to Ontology blockchain network.

Features

Compile

  • Python smart contracts (.py) (Compiler v1 and v2)
  • CSharp smart contracts (.cs)

Deploy

  • Deployment to TestNet / MainNet / PrivateNet

Invoke

  • Payed and PreExec transactions

Debug

  • Debug advancing (StepIn, StepOut, Next, Continue, Stop, Restart)
  • Breakpoints
  • Variables preview and set
  • State store manipulation

Tools

  • String ↔ Hex string
  • Address ↔ Script hash
  • Number ↔ Hex string
  • Byte array ↔ Hex string
  • Endian conversion

Requirements

Optional requirements

To have proper code complete install also:

Release Notes

See CHANGELOG.md

Extension Settings

This extension contributes the following settings:

  • ontology.network.type: specifies which network will be used during deploy and invoke
  • ontology.network.private: PrivateNet address RPC address in the form http://host:port
  • ontology.wallet: wallet file used during deploy and invoke (you can use ${workspaceFolder} in the path)
  • ontology.payer: default payer address (must be found in wallet file)
  • ontology.deploy.gasLimit: gas limit used during deploy
  • ontology.deploy.gasPrice: gas price used during deploy
  • ontology.invoke.gasLimit: gas limit used during invoke
  • ontology.invoke.gasPrice: gas price used during invoke
  • ontology.compile.pythonCompiler2: use Python Compiler version 2.0

Those settings can be changes in standard VSCode settings accessible using the Gear box icon in lower left corner.

Settings 1 Settings 2

How to use this extension?

Press Ctrl+Shift+X or Cmd+Shift+X to open the Extensions pane. Find and install the VSCode Extension for Ontology extension. You can also install the extension from the Marketplace.

Screenshot

Open any .py or .cs file in VS Code. The extension is now activated. This extension enhances the whole Smart contract development process.

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.

How to use Python v2.0 compiler

Enable Python v2.0 compiler in extension settings:

Compile 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.

Deploy 2

You will be notified about the outcome of compilation through notifications.

Invoke & Debug

To invoke a method of smart contract open 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 invoke form. Fill out all the parameters and choose if you want to preExec the transaction or you want to make paid transaction.

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 instead debug the smart contract invocation in embedded virtual machine, press Debug. You can use standard debug features of VSCode as StepIn, StepOut, Next, Continue, Restart, Stop and breakpoints together with variables preview and set.

Tools

To open tools panel press Ctrl+Shift+P or Cmd+Shift+P and enter Ontology: Tools. Panel with all the supported conversion tools will be opened.

Tools

Authors

License

This project is licensed under the LGPL License - see the LICENSE.md file for details.

About

Extension for development and testing of Smart contracts on Ontology blockchain

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published