This extension add support for development and testing of Smart contracts on Ontology blockchain.
- Python smart contracts (.py)
- 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
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 invoke
Those settings can be changes in standard VSCode settings accessible using the Gear box icon in lower left corner.
See CHANGELOG.md
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.
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.
- Matus Zamborsky - Initial work - Backslash47
This project is licensed under the LGPL License - see the LICENSE.md file for details.