Giter Club home page Giter Club logo

smart-contracts's Introduction

Smart-contracts

smart-contracts's People

Contributors

ethereumworks avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

smart-contracts's Issues

AuthentificationManagers too many copy-past

May be it will be better to rewrite it with

struct GrantedAccess {   
        bool isAdmin;
        bool canRead;
    }
mapping(address => GrantedAccess)  accessRights;
mapping(address => GrantedAccess)  accessRightsHistory;

it helps:
1)reduce boilerplate code for "admin" and "reader" (now it's almost copy-pasted) roles and makes it more easily to add new roles
2)Remove iterating over history
3)operations over mapping instead of array in this case lreduce gas consumption

Look at onlyPayloadSize usage

there is information that sometimes legal call of method can have data.length > sum of args lengths due to padding (transactions from parity multisig wallet for example)
So correct code for onlyPayloadSize should be
modifier onlyPayloadSize(uint size) { assert(msg.data.length >= size + 4); _; }

Also brief look at code shows what you check invariants of all arguments so actually this modifier maybe useless

Boilerplate code in XWinToken

Consider not using allTokenHolders[] in XWinToken and you can remove all related boilerplate
I understand it all appears cause of DividendManager.() payable( See #7) but without all this it will be much better

DividendManager fallback function costs to much (& dos't work)

DividendManager::function () payable
1)costs to much gas (gas limit for fallback function is 2300 )
2)Even without low gas limit it does't work as expected: if token becomes popular - you have to iterate over long array of owner addresses and do manipulation in storage. There is no gas-limit to complete this operation for sure. And this means that not all owners get their dividend record increase
3)Also - rewriting this code cause to remove all this allTokenHolders[] boilerplate code in XWinToken #8

AuthenticationManager is useless in XWinToken

I don't see why do you need all this whistles and blows with AuthenticationManager
In XWinToken You define accountReaderOnly function modifier but never use it.

I'am sure it will be better to completely remove it for now.
Also consider remove Reader access right from AuthenticationManager

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.