Install ethcode extension from vscode marketplace.
Let's start by compiling the most simple ERC-20 token. We will use openzepplin EIP-20 implementations for our ERC-20 token.
pragma solidity ^0.6.0;
import "../openzeppelin-contracts/contracts/token/ERC20/ERC20.sol";contract ToolsToken is ERC20 {
constructor() ERC20("COVID-20", "CVD") public
{
_mint(msg.sender, 100);
}
}
Now we need to install ethcode the full-featured Ethereum extension for vscode.
Once installed we can hit ctrl+alt+c
to compile our solidity or vyper program.
Initially, we will run our smart contracts in ganache. Ethcode comes with ganache and Görli test network support. By default, ganache is selected. Click on the get gas estimate
button to generate estimated gas for your contract deployment. Constructor parameters can be submitted if any through a text input field in JSON
format.
Then we can deploy the smart contract. After deploying the contract, we will be able to call functions, access public variables. In this example, we are going to execute the balanceOf
function of openzepplin ERC-20 standard token.
If we want to transfer 10
tokens to another address we can use the transfer
function. Calling any state-changing function will create a transaction and use some gas from your account.
Read more about Ethcode on our GitHub.
Chat on our gitter channel.
Support us: 0xd22fE4aEFed0A984B1165dc24095728EE7005a36