# Contract Debugging
# Debugging Environment
In order to debug smart contract, you need setup a local node and do debugging through your node's RPC interface.
Vite provides 2 debugging environments: development and testing.
- Account balance is NOT verified before sending transaction.
- Each transaction can utilize maximum 47.62
UTquota with no staking.
- Quota and balance are verified normally. Pay attention to your balance and quota during debugging.
It is possible to debug your smart contract in Microsoft Visual Studio Code (aka VS Code) in development environment.
# Debug Contracts in VS Code
Soliditypp extension for VS Code supports debugging
solidity++ smart contract in local development environment.
Following features are supported:
solidity++code auto completion
- Auto compilation when saving
- Compilation error highlighting
- Detailed error message displaying when mouse over
- One-click smart contract deployment and debugging
- Support for multiple smart contract interaction
- Deployment/debugging result displaying
- Support for offchain queries
# Install Soliditypp Extension
Search for "soliditypp" in VS Code and install.
# Generate examples
Open VS Code workbench, press
F1) in Mac(or
Ctrl+Shift+P in Windows) to bring Command Palette, and then execute command
soliditypp: Generate Examples. This will generate example contracts in the working directory.
# Write Smart Contract
Write your contract in a new
.solpp file and then save it by pressing
⌘S in Mac(or
Ctrl+S in Windows). Your source file will be automatically compiled each time it is saved.
Lines with compilation error in the code will be marked with red underscore. Detailed error message will be displayed when you mouse over.
VS Code will recognize
.solpp file as
solidity++ source by default.
# Deploy/Debug Smart Contract
In Debug panel, start debugging and choose
Soliditypp environment. This will launch a local
gvite node and all following deployment and debugging steps will take place on this node.
Please note that all data will be cleared from the node after debugging is complete.
# Debug Contracts in CLI
# Create A Boilerplate
Clone the examples project from: https://github.com/vitelabs/soliditypp-examples as a boilerplate.
# Quick Start
# Test on Release Environment
Contracts are compiled by the release version of solppc and deployed on local network running the release version of gvite.
# Test on Beta Environment
Contracts are compiled by the beta version of solppc and deployed on local network running the beta version of gvite.
Beta version means gvite is deployed on testnet but not deployed on mainnet yet.
# Test on Nightly Environment
Contracts are compiled by the nightly version of solppc and deployed on local network running the nightly version of gvite.
Nightly version is the developing build of solppc and gvite.
# Create Your Own Contract
.solpp file in
contracts directory and write contract code in it.
.spec.ts file in
test directory and write tests in it.
# Compile Contracts
Use solppc-js to compile contracts: https://github.com/vitelabs/solppc-js.