Giter Club home page Giter Club logo

contracts's People

Contributors

cdincoglu avatar jaimi-io avatar marjon-call avatar markjonat avatar ngurmen avatar nremond avatar r0x0ted 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

Watchers

 avatar  avatar  avatar  avatar  avatar

contracts's Issues

Prepare for final review

  • Version bumps
  • Relocate MockToken.sol out of the library folder into its own mock folder
  • Upgrade packages.

No events on setPortfolio function

The function setPortfolio updates a critical contract value therefore should emit an event for better tracking off-chain.
Recommendation: Please emit an event when changing the portfolio value.

Lines: Exchange.sol#105-108

function setPortfolio(IPortfolio _portfolio) public {
    require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "E-OACC-05");
    portfolio = _portfolio;
}

Reading state variable in the loop

Calling length() method of the EnumerableSetUpgradeable for the state variable is burning gas.
Recommendation: Please store result of the length() call to the local variable and use it in the loop.

Lines: Fee.sol#77

for (uint i=0; i<tokenList.length(); i++) {

Lines: Fee.sol#104

for (uint j= 0; j < tokenList.length(); j++) {

Lines: Fee.sol#145

for (uint j=0; j<tokenList.length(); j++) {

Multiple access for the state variable

Accessing the state variable in the function multiple times just burns the gas.
Recommendation: Please store the value of the state variable in the local variable.

Lines: Fee.sol#69-74

if (orderBookMap[_orderBookID].orderBook.exists(_price)) {
    (price, parent, left, right, red) = orderBookMap[_orderBookID].orderBook.getNode(_price);
    ( , head, ) = orderBookMap[_orderBookID].orderList[_price].getNode('');
    size = orderBookMap[_orderBookID].orderList[_price].sizeOf();
    return (price, parent, left, right, red, head, size);
}

openzeppelin-upgrades package fix

The openzeppelin-upgrades package fixed a bug in their latest version that handled transitive contracts correctly. It requires Dexalot contracts to switch to openzeppelin-contracts-upgradeable.

No events on setTradePairs function

The function setTradePairs updates a critical contract value therefore should emit an event for better tracking off-chain.
Recommendation: Please emit an event when changing the tradePairs value.

Lines: Exchange.sol#116-119

function setTradePairs(ITradePairs _tradePairs) public {
    require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "E-OACC-06");
    tradePairs = _tradePairs;
}

Implicit state variable visibility

When visibility is not explicitly declared it is assumed to be internal. But it could be unclear to reviewers.
Recommendation: Please add an explicit visibility declaration.

Lines: Fee.sol#36-49

// bytes32 symbols to ERC20 token map
mapping (bytes32 => IERC20) tokenMap;

// map for numerator for share percentages
mapping (address => uint) share;

// total witdrawn by all users mapped to asset
mapping (bytes32 => uint) totalWithdrawn;

// starting total for a specific user mapped to user and asset
mapping (address => mapping (bytes32 => uint)) userTotalStart;

// total withdrawn by a specific user mapped to user and asset
mapping (address => mapping (bytes32 => uint)) userWithdrawn;

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.