How to Use VSCode

<h1 align="center">How to Use VSCode</h1>
<p align="center" class="version">Version 0.1</p>

1. What is VSCode Extension for Ontology

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.

<div align="center">
<img src="https://raw.githubusercontent.com/ontio-community/bounty-program-report/master/image/vscode.png" >
</div>

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.

2. Extension Settings

This extension contributes the following settings:

  • ontology.network.type: specifies which network will be used during deployment and invocation
  • ontology.network.private: PrivateNet address in the form of http://host:port
  • ontology.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 deployment
  • ontology.deploy.gasPrice: gas price used during deployment
  • ontology.invoke.gasLimit: gas limit used during invocation
  • ontology.invoke.gasPrice: gas price used during invocation

Those settings can be changed in standard VSCode settings by clicking the gear box icon in lower left corner.

Settings 1

Settings 2

3. How to use Ontology extension?

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.

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

3.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. You will be notified about the outcome of compilation through notifications.

Invoke & Debug

To invoke a method in the smart contract, opening 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 invocation form. Fill out all the parameters and click the invoke button.

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

Extension author

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末入蛆,一起剝皮案震驚了整個濱河市箕般,隨后出現(xiàn)的幾起案子岸霹,更是在濱河造成了極大的恐慌卤恳,老刑警劉巖般哼,帶你破解...
    沈念sama閱讀 218,451評論 6 506
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異嗤详,居然都是意外死亡娱局,警方通過查閱死者的電腦和手機,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,172評論 3 394
  • 文/潘曉璐 我一進店門泪漂,熙熙樓的掌柜王于貴愁眉苦臉地迎上來廊营,“玉大人,你說我怎么就攤上這事窖梁∽阜纾” “怎么了?”我有些...
    開封第一講書人閱讀 164,782評論 0 354
  • 文/不壞的土叔 我叫張陵纵刘,是天一觀的道長邀窃。 經(jīng)常有香客問我,道長,這世上最難降的妖魔是什么瞬捕? 我笑而不...
    開封第一講書人閱讀 58,709評論 1 294
  • 正文 為了忘掉前任鞍历,我火速辦了婚禮,結(jié)果婚禮上肪虎,老公的妹妹穿的比我還像新娘劣砍。我一直安慰自己,他們只是感情好扇救,可當我...
    茶點故事閱讀 67,733評論 6 392
  • 文/花漫 我一把揭開白布刑枝。 她就那樣靜靜地躺著,像睡著了一般迅腔。 火紅的嫁衣襯著肌膚如雪装畅。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,578評論 1 305
  • 那天沧烈,我揣著相機與錄音掠兄,去河邊找鬼。 笑死锌雀,一個胖子當著我的面吹牛蚂夕,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播腋逆,決...
    沈念sama閱讀 40,320評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼婿牍,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了闲礼?” 一聲冷哼從身側(cè)響起牍汹,我...
    開封第一講書人閱讀 39,241評論 0 276
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎柬泽,沒想到半個月后,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體嫁蛇,經(jīng)...
    沈念sama閱讀 45,686評論 1 314
  • 正文 獨居荒郊野嶺守林人離奇死亡锨并,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,878評論 3 336
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現(xiàn)自己被綠了睬棚。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片第煮。...
    茶點故事閱讀 39,992評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖抑党,靈堂內(nèi)的尸體忽然破棺而出包警,到底是詐尸還是另有隱情,我是刑警寧澤底靠,帶...
    沈念sama閱讀 35,715評論 5 346
  • 正文 年R本政府宣布害晦,位于F島的核電站,受9級特大地震影響暑中,放射性物質(zhì)發(fā)生泄漏壹瘟。R本人自食惡果不足惜鲫剿,卻給世界環(huán)境...
    茶點故事閱讀 41,336評論 3 330
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望稻轨。 院中可真熱鬧灵莲,春花似錦、人聲如沸殴俱。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,912評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽线欲。三九已至明场,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間询筏,已是汗流浹背榕堰。 一陣腳步聲響...
    開封第一講書人閱讀 33,040評論 1 270
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留嫌套,地道東北人逆屡。 一個月前我還...
    沈念sama閱讀 48,173評論 3 370
  • 正文 我出身青樓,卻偏偏與公主長得像踱讨,于是被迫代替她去往敵國和親魏蔗。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當晚...
    茶點故事閱讀 44,947評論 2 355

推薦閱讀更多精彩內(nèi)容