Skip to content

Added Travis file for Travis implementation #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
language: node_js
node_js:
- "stable"

services:
- docker

cache:
directories:
- node_modules

before_install:
- npm install -g truffle
- docker run -d -p 8545:8545 trufflesuite/ganache-cli:latest

script:
- truffle migrate
- truffle test
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# testcoders-blockchain-meetup

## Getting started
Make sure you have `truffle` and `testrpc` installed
Make sure you have `truffle` and `ganache-cli` installed
```bash
npm install -g truffle ethereumjs-testrpc
npm install -g truffle npm ganache-cli
```

Run ganache (formerly known as testrpc)
```bash
ganache-cli
```

`cd` into the repository directory and run the following command to create build artifacts for the smart contract:
Expand Down
35 changes: 18 additions & 17 deletions contracts/TestCodersToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@ pragma solidity ^0.4.18;
contract ERC20Interface {

// Get the total token supply
function totalSupply() constant returns (uint256);
function totalSupply() public constant returns (uint256);

// Get the account balance of another account with address _owner
function balanceOf(address _owner) constant returns (uint256 balance);
function balanceOf(address _owner) public constant returns (uint256 balance);

// Send _value amount of tokens to address _to
function transfer(address _to, uint256 _value) returns (bool success);
function transfer(address _to, uint256 _value) public returns (bool success);

// Send _value amount of tokens from address _from to address _to
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);

// Allow _spender to withdraw from your account, multiple times, up to the _value amount.
// If this function is called again it overwrites the current allowance with _value.
// this function is required for some DEX functionality
function approve(address _spender, uint256 _value) returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);

// Returns the amount which _spender is still allowed to withdraw from _owner
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
function allowance(address _owner, address _spender) public constant returns (uint256 remaining);

// Triggered when tokens are transferred.
event Transfer(address indexed _from, address indexed _to, uint256 _value);
Expand Down Expand Up @@ -53,26 +53,26 @@ contract TestCodersToken is ERC20Interface {
}

// Constructor
function TestCodersToken() {
function TestCodersToken() public {
owner = msg.sender;
balances[owner] = _totalSupply;
}

function totalSupply() constant returns (uint256) {
function totalSupply() constant public returns (uint256) {
return _totalSupply;
}

// What is the balance of a particular account?
function balanceOf(address _owner) constant returns (uint256 balance) {
function balanceOf(address _owner) constant public returns (uint256 balance) {
return balances[_owner];
}

// Transfer the balance from owner's account to another account
function transfer(address _to, uint256 _amount) returns (bool success) {
function transfer(address _to, uint256 _amount) public returns (bool success) {
if (balances[msg.sender] >= _amount && _amount > 0 && balances[_to] + _amount > balances[_to]) {
balances[msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(msg.sender, _to, _amount);
emit Transfer(msg.sender, _to, _amount);
return true;
} else {
return false;
Expand All @@ -89,12 +89,13 @@ contract TestCodersToken is ERC20Interface {
address _from,
address _to,
uint256 _amount
) returns (bool success)
{ if (balances[_from] >= _amount && allowed[_from][msg.sender] >= _amount && _amount > 0 && balances[_to] + _amount > balances[_to]) {
) public returns (bool success)
{
if (balances[_from] >= _amount && allowed[_from][msg.sender] >= _amount && _amount > 0 && balances[_to] + _amount > balances[_to]) {
balances[_from] -= _amount;
allowed[_from][msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(_from, _to, _amount);
emit Transfer(_from, _to, _amount);
return true;
} else {
return false;
Expand All @@ -103,13 +104,13 @@ contract TestCodersToken is ERC20Interface {

// Allow _spender to withdraw from your account, multiple times, up to the _value amount.
// If this function is called again it overwrites the current allowance with _value.
function approve(address _spender, uint256 _amount) returns (bool success) {
function approve(address _spender, uint256 _amount) public returns (bool success) {
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
emit Approval(msg.sender, _spender, _amount);
return true;
}

function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}