ETHcode — Ethereum IDE in vscode

0mkar
7Finney
Published in
2 min readJul 14, 2019

ETHcode is a TDD focused Ethereum IDE in vscode. We are announcing our first release of ETHcode v0.0.3. Developers can compile solidity code and run solidity unit testing using remix-tests in ETHcode. It is also possible to select between various compiler versions available for solidity.

Let’s start by writing a SimpleStorage contract example in solidity using ETHcode.

pragma solidity ^0.5.0;contract SimpleStorage {
uint public storedData;
constructor() public {
storedData = 100;
}
function set(uint x) public {
storedData = x;
}
function get() public view returns (uint retVal) {
return storedData;
}
}

Copy above contract code in a file called simple_storage.sol. Open it in vscode and hit ctrl+alt+e to activate ETHcode plugin. Once ETHcode extension is active press ctrl+alt+c to compile the contract.

Now let's try writing some unit tests for our SimpleStorage contract.

pragma solidity ^0.5.0;
import "./simple_storage.sol";
contract StorageTest {
SimpleStorage foo;
function beforeAll() public {
foo = new SimpleStorage();
}
function initialValueShouldBe_100() public returns (bool) {
return Assert.equal(foo.get(), 100, "initial value is not correct");
}
function initialValueShouldBe_200() public returns (bool) {
return Assert.equal(foo.get(), 200, "initial value is not correct");
}
}

Create a file named simple_storage_test.sol and copy the above code into it. To run this unit testing solidity program hit ctrl+alt+t .

Find more unit testing contracts in our git repository solidity-examples.

Help ETHcode development.

Ethereum address: 0xd22fE4aEFed0A984B1165dc24095728EE7005a36

Next — ETHcode remix-tests

--

--