This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function splitDAO(uint _proposalID, address _newCurator) noEther onlyTokenholders returns (bool _success) { | |
... | |
uint fundsToBeMoved = (balances[msg.sender] * p.splitData[0].splitBalance) / p.splitData[0].totalSupply; | |
//Since the balance is never updated the attacker can pass this modifier several times | |
if (p.splitData[0].newDAO.createTokenProxy.value(fundsToBeMoved)(msg.sender) == false) throw; | |
... | |
// Burn DAO Tokens |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity 0.5.17; | |
contract adminChecker { | |
address admin = msg.sender; | |
function roleCheck() internal view returns (bool) { | |
return msg.sender == admin; | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fallback() external payable { | |
fallbackVulnerability.withdrawAllMoney(msg.value); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract fallbackVulnerability { | |
mapping (address => uint) private balances; | |
function addAllMoney (address Useraccount) public payable { | |
balances [Useraccount] = msg.value; | |
} | |
function withdrawAllMoney (uint Totalamount) public { | |
if (balances [msg.sender]>= Totalamount) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: GPL-3.0 | |
pragma solidity 0.8.7; | |
contract Test { | |
address public owner; | |
constructor() { | |
owner = msg.sender; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function _update( | |
uint128 baseBalance, | |
uint128 fyBalance, | |
uint112 _baseCached, | |
uint112 _fyTokenCached | |
) private { | |
.... | |
cumulativeBalancesRatio += | |
(scaledFYTokenCached / _baseCached) * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
contract Fee { | |
function caculateLowFee() public pure returns(uint){ | |
uint coins = 2; | |
uint Total_coins = 10; | |
uint fee = 15; | |
return((coins/Total_coins) * fee); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// bad | |
someAddress.send(123); | |
someAddress.call{msg.value: 12, gas: 1233}() // this is dangerous, as it will forward all remaining gas and doesn't check for the result | |
someAddress.call{msg.value: 100}(bytes4(sha3("deposit()"))); // if deposit fails, the call() will return false and the tx will not be reverted | |
// good, require() can also be used | |
if(!someAddress.send(123)) { | |
// error handling | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function SendCash(uint roundIndex, uint subpotIndex){ | |
var subpotsCount = getSubpotsCount(roundIndex); | |
if(subpotIndex>=subpotsCount) { | |
return; | |
} | |
var decisionBlocksNumber = getDecisionBlocksNumber(roundIndex,subpotIndex); | |
if(decisionBlocksNumber>block.number) { | |
return; | |
} | |
if(rounds[roundIndex].isCashed[subpotIndex]) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity 0.4.1; | |
contract ReturnValueCall { | |
function callchecked(address callee) public { | |
require(callee.call()); | |
} | |
function callnotchecked(address callee) public { | |
callee.call(); | |
} | |
} |
NewerOlder