Version 0.1
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. And please disable pylint
when VSCode recommends it to you.
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.
This extension contributes the following settings:
ontology.network.type
: specifies which network will be used during deployment and invocationontology.network.private
: PrivateNet address in the form of http://host:portontology.wallet
: wallet file used during deployment and invocation (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 deploymentontology.deploy.gasPrice
: gas price used during deploymentontology.invoke.gasLimit
: gas limit used during invocationontology.invoke.gasPrice
: gas price used during invocationThose settings can be changed in standard VSCode settings by clicking the gear box icon in lower left corner.
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.
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 in the smart contract, opening the _abi.json file. A new panel with smart contract methods will show up.
Double click on any of the methods to show invocation form. Fill out all the parameters and click the invoke
button.
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 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.
punica-init-default-box
git clone https://github.com/punica-box/punica-init-default-box.git
OEP-4 smart contract
https://github.com/tonyclarking/python-template/blob/master/OEP4Sample/OEP4Sample.py
Please feel free to give any suggestionContact: Yue ZhaoWechat: 16621171248Email: messixaviinsta0303@163.com