This extension has been designed to help you in developing, testing and deploying smart contracts to Ontology blockchain network.
- Python smart contracts (.py) (Compiler v1 and v2)
- CSharp smart contracts (.cs)
- Deployment to TestNet / MainNet / PrivateNet
- Payed and PreExec transactions
- Debug advancing (StepIn, StepOut, Next, Continue, Stop, Restart)
- Breakpoints
- Variables preview and set
- State store manipulation
- String ↔ Hex string
- Address ↔ Script hash
- Number ↔ Hex string
- Byte array ↔ Hex string
- Endian conversion
To have proper code complete install also:
See CHANGELOG.md
This extension contributes the following settings:
ontology.network.type
: specifies which network will be used during deploy and invokeontology.network.private
: PrivateNet address RPC address in the form http://host:portontology.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 deployontology.deploy.gasPrice
: gas price used during deployontology.invoke.gasLimit
: gas limit used during invokeontology.invoke.gasPrice
: gas price used during invokeontology.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.
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.
Open any .py or .cs file in VS Code. The extension is now activated. This extension enhances the whole Smart contract development process.
To compile a smart contract, show context menu on any .py or .cs file.
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.
Enable Python v2.0 compiler in extension settings:
To deploy a smart contract, show context menu on compiled .avm file.
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.
To invoke a method of smart contract open the _abi.json file. A new panel with smart contract methods will show up.
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.
You will be notified about the progress of invocation through notifications and a new panel with invocation result will show up.
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.
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.
- Matus Zamborsky - Initial work - Backslash47
This project is licensed under the LGPL License - see the LICENSE.md file for details.