dexalot / contracts Goto Github PK
View Code? Open in Web Editor NEWSmart Contracts
License: Other
Smart Contracts
License: Other
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;
}
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++) {
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);
}
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.
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;
}
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;
Implemented a fee collection mechanism that does not need a separate Fee contract.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.