Giter Site home page Giter Site logo

mana's Introduction

Decentraland MANA Token

Build Status

Solidity smart contracts for the Decentraland Crowdsale and MANA Token

mana's People

Contributors

abarmat avatar eordano avatar federicobond avatar fmiras avatar jakub-wojciechowski avatar maraoz avatar nachomazzara avatar nicosantangelo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mana's Issues

burnTokens() public

DO you want to allow the token holders to burn/destroy their tokens? Maybe you dont, I mean you want the tokens in circulation right? Would a user would want to destroy it?. In the case a account is hacked, and instead of draining the account the attacker decide to burn the tokens instead.

I dont understand 100% how you crowdsale will work, but if you need to destroy unsold tokens, you can allow only the crowdsale owner to do that.

If you want I can create the PR to let only the owner of the crowdsale burn tokens, let me know what you think :)

processPurchase() && getRate()

processPurchase() in MANACrowdsale overrides the function in ContiniousCrowdsale, Instead of overriding that method you can add the function getRate() on the ConiousCrowdsale and only override that function, I understand that is the only thing that you want to do, provide different rates for special addresses, its not a bug, just a change on the code that you can do, and I think It will look better.

Also, why is getRate() internal? I think it can be public, so the investors can verify the rate they are going to have before sending eth.

If you want I can create the PR, let me know what you think :)

Overflow Analysis TODO Removal

Line 127 of MANACrowdsale.sol:

// TODO: possibility of overflow in these operations should be analized

should be removed as there is no possibility of overflow. uint256 can store numbers larger than 10^77.

The line also contains a typo: analized should be analyzed.

It's also worth noting that the interest in the next two lines is calculated linearly instead of exponentially.

Split main crowdsale from continuous sale contract

We should transfer the ownership of the token once the main Crowdsale ends to a simpler contract that only handles the continuous issuance. This significantly reduces the attack surface of both contracts.

Broken hard cap for whitelisted investors

When a whitelisted investor is making a purchase the cap invariant check is skipped. This will allow a big whale investor to buy much more tokens than intended to be offered and put the whole crowd sale in jeopardy.

Test to demonstrate this bug:

it('whitelisted big whale investor should not exceed the cap', async function () {
    const cap = (await crowdsale.cap());
    const overCap = cap.mul(2);
    await crowdsale.addToWhitelist(investor);
    await crowdsale.buyTokens(investor, {value: overCap, from: investor}).should.be.rejectedWith(EVMThrow);
    const balance = await token.balanceOf(investor);
    const raised = await crowdsale.weiRaised();
    balance.should.be.bignumber.equal(0);
    raised.should.be.bignumber.most(cap);
  })

npm test not successful...

Hi,
I am a newbie in Ethereum contract programming. I am testing the code in an ubuntu machine with node, testrpc and truffle. Here is what I got after running "npm test"

reggie@UBC809:~/mana$ npm test

> [email protected] test /home/reggie/mana
> ./scripts/test.sh

Using existing testrpc instance
Compiling ./contracts/BurnableToken.sol...
Compiling ./contracts/ContinuousSale.sol...
Compiling ./contracts/MANAContinuousSale.sol...
Compiling ./contracts/MANACrowdsale.sol...
Compiling ./contracts/MANAToken.sol...
Compiling ./contracts/Migrations.sol...
Compiling ./contracts/WhitelistedCrowdsale.sol...
Compiling ./test/helpers/BurnableTokenMock.sol...
Compiling ./test/helpers/WhitelistedCrowdsaleImpl.sol...
Compiling zeppelin-solidity/contracts/crowdsale/CappedCrowdsale.sol...
Compiling zeppelin-solidity/contracts/crowdsale/Crowdsale.sol...
Compiling zeppelin-solidity/contracts/crowdsale/FinalizableCrowdsale.sol...
Compiling zeppelin-solidity/contracts/lifecycle/Pausable.sol...
Compiling zeppelin-solidity/contracts/math/SafeMath.sol...
Compiling zeppelin-solidity/contracts/ownership/Ownable.sol...
Compiling zeppelin-solidity/contracts/token/BasicToken.sol...
Compiling zeppelin-solidity/contracts/token/ERC20.sol...
Compiling zeppelin-solidity/contracts/token/ERC20Basic.sol...
Compiling zeppelin-solidity/contracts/token/MintableToken.sol...
Compiling zeppelin-solidity/contracts/token/PausableToken.sol...
Compiling zeppelin-solidity/contracts/token/StandardToken.sol...
Error: Error: Exceeds block gas limit
    at StateManager.queueTransaction (/usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:90571:21)
    at GethApiDouble.eth_sendTransaction (/usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:90071:14)
    at GethApiDouble.handleRequest (/usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:89870:10)
    at next (/usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:59378:18)
    at GethDefaults.handleRequest (/usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:89767:12)
    at next (/usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:59378:18)
    at FilterSubprovider.handleRequest (/usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:65832:7)
    at next (/usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:59378:18)
    at DelayedBlockFilter.handleRequest (/usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:89595:3)
    at next (/usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:59378:18)
    at Object.InvalidResponse (/home/reggie/mana/node_modules/truffle/build/cli.bundled.js:37047:16)
    at /home/reggie/mana/node_modules/truffle/build/cli.bundled.js:224634:36
    at XMLHttpRequest.request.onreadystatechange (/home/reggie/mana/node_modules/truffle/build/cli.bundled.js:223413:13)
    at XMLHttpRequestEventTarget.dispatchEvent (/home/reggie/mana/node_modules/truffle/build/cli.bundled.js:225286:18)
    at XMLHttpRequest._setReadyState (/home/reggie/mana/node_modules/truffle/build/cli.bundled.js:225576:12)
    at XMLHttpRequest._onHttpResponseEnd (/home/reggie/mana/node_modules/truffle/build/cli.bundled.js:225731:12)
    at IncomingMessage.<anonymous> (/home/reggie/mana/node_modules/truffle/build/cli.bundled.js:225691:24)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:188:7)
    at endReadableNT (_stream_readable.js:975:12)
npm ERR! Test failed.  See above for more details.
reggie@UBC809:~/mana$ node -v
v7.9.0
reggie@UBC809:~/mana$ npm -v
5.6.0

I don't have enough gas on testrpc?

Use SafeMath in MANACrowdsale.sol Constructor Function

Line 44:

require(_rate > _rateStepDecrease * (_endBlock - _startBlock));

and line 78 of MANACrowdsale.sol:

return rate.sub(rateStepDecrease.mul(block.number - startBlock));

should use SafeMath functions to be consistent with the rest of the codebase.

Specifically, line 44 should be changed to:

require(_rate > _rateStepDecrease.mul(_endBlock.sub(_startBlock)));

and line 78 should be changed to:

return rate.sub(rateStepDecrease.mul(block.number.sub(startBlock)));

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.