Address further slither analysis

This commit is contained in:
Andy Tudhope 2019-04-10 00:55:39 +02:00
parent 0811d0f4ad
commit b153f1c686
No known key found for this signature in database
GPG Key ID: 02A3DFA93BF26AD2
4 changed files with 185733 additions and 12 deletions

View File

@ -73,8 +73,6 @@ contract DAppStore is ApproveAndCallFallBack, BancorFormula {
function _createDApp(address _from, bytes32 _id, uint _amount) internal {
require(_amount > 0, "You must spend some SNT to submit a ranking in order to avoid spam");
require (_amount < safeMax, "You cannot stake more SNT than the ceiling dictates");
require(SNT.allowance(_from, address(this)) >= _amount, "Not enough SNT allowance");
require(SNT.transferFrom(_from, address(this), _amount), "Transfer failed");
uint dappIdx = dapps.length;
@ -103,6 +101,9 @@ contract DAppStore is ApproveAndCallFallBack, BancorFormula {
id2index[_id] = dappIdx;
require(SNT.allowance(_from, address(this)) >= _amount, "Not enough SNT allowance");
require(SNT.transferFrom(_from, address(this), _amount), "Transfer failed");
emit DAppCreated(_id, d.votesMinted, d.effectiveBalance);
}
@ -164,8 +165,6 @@ contract DAppStore is ApproveAndCallFallBack, BancorFormula {
require(d.id == _id, "Error fetching correct data");
require(d.balance + _amount < safeMax, "You cannot upvote by this much, try with a lower amount");
require(SNT.allowance(_from, address(this)) >= _amount, "Not enough SNT allowance");
require(SNT.transferFrom(_from, address(this), _amount), "Transfer failed");
uint precision;
uint result;
@ -187,6 +186,9 @@ contract DAppStore is ApproveAndCallFallBack, BancorFormula {
uint effect = temp1 / temp2;
d.effectiveBalance = d.balance - effect;
require(SNT.allowance(_from, address(this)) >= _amount, "Not enough SNT allowance");
require(SNT.transferFrom(_from, address(this), _amount), "Transfer failed");
emit Upvote(_id, d.effectiveBalance);
}
@ -228,14 +230,14 @@ contract DAppStore is ApproveAndCallFallBack, BancorFormula {
(uint b, uint v_r, uint c) = downvoteCost(_id);
require(_amount == c, "Incorrect amount: valid iff effect on ranking is 1%");
require(SNT.allowance(_from, address(this)) >= _amount, "Not enough SNT allowance");
require(SNT.transferFrom(_from, address(this), _amount), "Transfer failed");
require(SNT.transfer(d.developer, _amount), "Transfer failed");
d.available = d.available - _amount;
d.votesCast = d.votesCast + v_r;
d.effectiveBalance = d.effectiveBalance - b;
require(SNT.allowance(_from, address(this)) >= _amount, "Not enough SNT allowance");
require(SNT.transferFrom(_from, address(this), _amount), "Transfer failed");
require(SNT.transfer(d.developer, _amount), "Transfer failed");
emit Downvote(_id, d.effectiveBalance);
}
@ -329,8 +331,7 @@ contract DAppStore is ApproveAndCallFallBack, BancorFormula {
function abiDecodeRegister(
bytes memory _data
)
private
pure
private
returns(
bytes4 sig,
bytes32 id,

View File

@ -569,7 +569,7 @@ contract MiniMeToken is MiniMeTokenInterface, Controlled {
* @param _addr The address being queried
* @return True if `_addr` is a contract
*/
function isContract(address _addr) internal view returns(bool) {
function isContract(address _addr) internal returns(bool) {
uint size;
if (_addr == address(0)) {
return false;

185720
crytic-export/contracts.json Normal file

File diff suppressed because one or more lines are too long

View File

@ -33,7 +33,7 @@
"eject": "react-scripts eject",
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
"slither": "slither . --exclude naming-convention"
"slither": "slither . --exclude naming-convention --filter-paths token"
},
"husky": {
"hooks": {