mirror of
https://github.com/status-im/discover-dapps.git
synced 2025-01-11 19:24:29 +00:00
Address further slither analysis
This commit is contained in:
parent
0811d0f4ad
commit
b153f1c686
@ -73,8 +73,6 @@ contract DAppStore is ApproveAndCallFallBack, BancorFormula {
|
|||||||
function _createDApp(address _from, bytes32 _id, uint _amount) internal {
|
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 > 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 (_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;
|
uint dappIdx = dapps.length;
|
||||||
|
|
||||||
@ -103,6 +101,9 @@ contract DAppStore is ApproveAndCallFallBack, BancorFormula {
|
|||||||
|
|
||||||
id2index[_id] = dappIdx;
|
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);
|
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.id == _id, "Error fetching correct data");
|
||||||
|
|
||||||
require(d.balance + _amount < safeMax, "You cannot upvote by this much, try with a lower amount");
|
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 precision;
|
||||||
uint result;
|
uint result;
|
||||||
@ -187,6 +186,9 @@ contract DAppStore is ApproveAndCallFallBack, BancorFormula {
|
|||||||
uint effect = temp1 / temp2;
|
uint effect = temp1 / temp2;
|
||||||
|
|
||||||
d.effectiveBalance = d.balance - effect;
|
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);
|
emit Upvote(_id, d.effectiveBalance);
|
||||||
}
|
}
|
||||||
@ -228,14 +230,14 @@ contract DAppStore is ApproveAndCallFallBack, BancorFormula {
|
|||||||
(uint b, uint v_r, uint c) = downvoteCost(_id);
|
(uint b, uint v_r, uint c) = downvoteCost(_id);
|
||||||
|
|
||||||
require(_amount == c, "Incorrect amount: valid iff effect on ranking is 1%");
|
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.available = d.available - _amount;
|
||||||
d.votesCast = d.votesCast + v_r;
|
d.votesCast = d.votesCast + v_r;
|
||||||
d.effectiveBalance = d.effectiveBalance - b;
|
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);
|
emit Downvote(_id, d.effectiveBalance);
|
||||||
}
|
}
|
||||||
@ -329,8 +331,7 @@ contract DAppStore is ApproveAndCallFallBack, BancorFormula {
|
|||||||
function abiDecodeRegister(
|
function abiDecodeRegister(
|
||||||
bytes memory _data
|
bytes memory _data
|
||||||
)
|
)
|
||||||
private
|
private
|
||||||
pure
|
|
||||||
returns(
|
returns(
|
||||||
bytes4 sig,
|
bytes4 sig,
|
||||||
bytes32 id,
|
bytes32 id,
|
||||||
|
@ -569,7 +569,7 @@ contract MiniMeToken is MiniMeTokenInterface, Controlled {
|
|||||||
* @param _addr The address being queried
|
* @param _addr The address being queried
|
||||||
* @return True if `_addr` is a contract
|
* @return True if `_addr` is a contract
|
||||||
*/
|
*/
|
||||||
function isContract(address _addr) internal view returns(bool) {
|
function isContract(address _addr) internal returns(bool) {
|
||||||
uint size;
|
uint size;
|
||||||
if (_addr == address(0)) {
|
if (_addr == address(0)) {
|
||||||
return false;
|
return false;
|
||||||
|
185720
crytic-export/contracts.json
Normal file
185720
crytic-export/contracts.json
Normal file
File diff suppressed because one or more lines are too long
@ -33,7 +33,7 @@
|
|||||||
"eject": "react-scripts eject",
|
"eject": "react-scripts eject",
|
||||||
"predeploy": "npm run build",
|
"predeploy": "npm run build",
|
||||||
"deploy": "gh-pages -d build",
|
"deploy": "gh-pages -d build",
|
||||||
"slither": "slither . --exclude naming-convention"
|
"slither": "slither . --exclude naming-convention --filter-paths token"
|
||||||
},
|
},
|
||||||
"husky": {
|
"husky": {
|
||||||
"hooks": {
|
"hooks": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user