Git Product home page Git Product logo

chronologic's People

Contributors

bokkypoobah avatar matt-lough avatar rohendra avatar sakaarbhatia avatar strategiclimited avatar toshendra avatar

Watchers

 avatar  avatar  avatar  avatar

chronologic's Issues

Value mismatch when purchasing minting address

// first get the offered DayToken in the token contract &
// then transfer the total sum (minBalanceToSend+_offerInDay) to the seller
balances[this] = safeAdd(balances[this], _offerInDay);
balances[msg.sender] = safeSub(balances[msg.sender], _offerInDay);

The logic in the comment above does not match with the code, the minBalanceToSend is not added to _offerInDay

balances[this] = safeSub(balances[this], minBalanceToSell + sellingPriceInDayOf[msg.sender]);
balances[msg.sender] = safeAdd(balances[msg.sender], minBalanceToSell + sellingPriceInDayOf[msg.sender]);

This line of code does match the comment from above, which means one of these is wrong.

In this current state you be able to withdraw more than you sold for.

ERC20 Token Standard Consistency

ERC20.sol and ERC20Basic.sol

The names of the parameters deviate from the standard naming conventions in ERC20 Token Standard. We would recommend following them exactly.

ERC20 Token Standard

Example:

ERC20Basic.sol
function balanceOf(address who) constant returns (uint);

ERC20 Token Standard
function balanceOf(address _owner) constant returns (uint balance);

DRY isContributor

DayToken.sol

There is a pattern used throughout this file for identifying if an ID is a contributor. The modifier onlyContributor uses it, and several other functions use it too. In the interest of not repeating yourself, a function should be created like

function isContributor(uint id) returns (bool isContributor) {
    return (id <= latestContributerId && id != 0);
}

Gender neutral language is recommended

UpgradeableToken.sol

* Somebody has upgraded some of his tokens.

Should probably say

* Somebody has upgraded some of their tokens.

DayToken.sol

/** Funtion to allow seller to get back his deposited amount of day tokens...

to

/** Function to allow seller to get back their deposited amount of day tokens...

etc

Code formatting is not consistent

We would recommend using a code linter and picking a consistent style guide.

This would make the code look cleaner, and more professional.

Magic numbers used in several functions

Examples:

if(latestContributerId >= 3227)

if(latestContributerId >= 3227 && latestContributerId <= 3245) //
{
latestContributerId = 3245;

require(latestContributerId < 3333);
if(latestContributerId == 3227)
{
id = latestContributerId = 3246;
}
else
{
id = ++latestContributerId;
}
if(latestContributerId >= 3246)

We would recommend using a static variable for these numbers so you can tell what they are meant to be, and change them easily if needed.

Transfer is not behaving correctly

DayToken.sol

https://github.com/BlockchainLabsNZ/chronologic/blob/dev/contracts/DayToken.sol#L380
balances[_to] = safeAdd(balances[msg.sender], _value);

When you make a transfer, the receivers balance will be equal to the senders balance plus the value sent, instead of the receivers balance plus the value sent.

The correct code would be:

balances[_to] = safeAdd(balances[_to], _value);

This error could inadvertently burn or clone all tokens in existence. If you make a transfer to the owner/team multisig address from an address with a small number of tokens, the entire supply other than the small number of tokens will be lost completely.

You could also clone tokens by transferring from a high balance address, to a low balance address.

Explicit declaration of variable access modifier

DayToken.sol

https://github.com/BlockchainLabsNZ/chronologic/blob/dev/contracts/DayToken.sol#L74

e.g

uint256 public bounty;
    /* Minimum Balance in Day tokens required to sell a minting address */
    uint256 minBalanceToSell;
    /* Team address lock down period from issued time, in seconds */
    uint256 teamLockPeriodInSec;  //Initialize and set function
    /* Duration in secs that we consider as a day. (For test deployment purposes,
       if we want to decrease length of a day. default: 84600)*/
    uint256 public DayInSecs;
    address crowdsaleAddress;

Some variables do not state public or private, it's best to be explicit.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.