This is a set of boilerplate in order to develop smart contracts using VSCode. It includes the needed c_cpp_properties.json file in .vscode for recognizing #includes from eosiolib.
You should have at least completed the "start here" section on dev docs
This setup is intended for users running mac OSX... but I would imagine the same would work for most popular versions of linux by just replacing brew with whatever use use... perhaps apt?
This will not work on its own! Before attempting to use this you must do the following:
- install nodeos, keosd, & cleos via docker
- install EOS contract development toolkit
brew tap eosio/eosio.cdtbrew install eosio.cdt
- create needed symlinks
- navigate to
/usr/local/include/ ln -s /usr/local/Cellar/eosio.cdt/1.4.1/opt/eosio.cdt/include/eosiolib- navigate to
/usr/local/include/eosiolib lin -s /usr/local/Cellar/eosio.cdt/1.4.1/opt/eosio.cdt/include/boost
- install eosvsc.cdt
sudo ./install.sh
- create project
eosvsc.cdt projectName
After completing the above steps your VSCode should recognize #includes and intellisense should work.
Comple the contract:
mkdir -p build && cd build && make .. && make
or
eosio-cpp -o hello.wasm hello.cpp --abigen
Open wallet:
cleos wallet open
Unlock wallet:
cleos wallet unlock
Create an account for the contract:
cleos account create hello $EOS_PUBLIC_KEY
Create the contract:
cleos set contract hello $EOS_CONTRACT_DIR/hello
Update the contract:
- make changes
- compile
- Same as create
- done
Create another account if you dont have one:
cleos account create bob $EOS_PUBLIC_KEY
Call hi on hello:
cleos push action hello hi '["bob"]' -p bob
You should get the following back:
>> Hello bob
Call bye on hello:
cleos push action hello bye '["bob"]' -p bob
You should get the following back:
>> Bye bob
clone/fork/do whatever ytou want with this. The important files are in .vscode.
https://github.com/TovarishFin/eos-vscode-smart-contract-boilerplate