GithubHelp home page GithubHelp logo

Comments (10)

madvas avatar madvas commented on August 23, 2024

Thanks Adam for a very nice audit! I have some questions:

Moderate: In general this contract uses unix timestamps (now) to control behavior. This value is somewhat manipulatable by miners (within bounds) and usually a better approach is to use block number as a proxy for date / time instead.

Could you provide some resources, why timestamp is less secure than block number? I was searching about this, asking around, didn't find much. There's been many major sales, which used timestamps and everything seems to go well.

Minor: In the function compensateContributors you calculate ratio to be the amount of tokens per ether contributed. You then take the amount contribute, turn this into an ether amount (divide by 10^18) and multiply by ratio. You could consider having ratio instead being the amount of tokens per wei contributed, which would avoid these divisions by 10^18 and make the code clearer.

Could you please explain this some more, not quite sure what you mean. Or maybe you could provide some code example?

from district0x-network-token.

adamdossa avatar adamdossa commented on August 23, 2024

from district0x-network-token.

madvas avatar madvas commented on August 23, 2024

Thanks!

  1. Although those changes may make code a bit cleaner, at this point, since there are some other audits in progress, I'd avoid doing major changes just for cosmetic purposes. So probably we won't implement.
  2. Yes, we're paying that much, but it's an audit from Jordi Baylina, rather than Griff. Prices of audits today literally range from $800-$80,000, that's why we decided to do this via Ethlance to bring more pricing transparency into this market.

from district0x-network-token.

adamdossa avatar adamdossa commented on August 23, 2024

from district0x-network-token.

madvas avatar madvas commented on August 23, 2024

Yes, 10% bonus applies to your review ;)
ok thanks, will test the code

from district0x-network-token.

adamdossa avatar adamdossa commented on August 23, 2024

from district0x-network-token.

madvas avatar madvas commented on August 23, 2024

Ah, so you just removed .mul(1000000000000000000) and .div(1000000000000000000), but that wouldn't work, because you'll lose precision too much. In solidity there are no float numbers, that's why is there this multiplying and dividing.
When I run tests with it, there're errors like:

expected: (bn/eq? expected-dnt (<! (contract-call-ch DNTToken :balance-of contributor)))
  actual: (not (bn/eq? #object[BigNumber 8.5714285714285714285714285e+25] #object[BigNumber 8.5714285e+25]))

You can see expected number of DNT tokens is 8.5714285714285714285714285e+25, but actual number is 8.5714285e+25 - lost 18 decimal points precision

from district0x-network-token.

adamdossa avatar adamdossa commented on August 23, 2024

from district0x-network-token.

madvas avatar madvas commented on August 23, 2024

yep, sure if you will

from district0x-network-token.

adamdossa avatar adamdossa commented on August 23, 2024

I have removed this Minor issue as per discussion.

from district0x-network-token.

Related Issues (13)

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.