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.5; | |
import "github.com/OpenZeppelin/openzeppelin-solidity/contracts/math/SafeMath.sol"; | |
contract TestStructCompactionImproved { | |
using SafeMath for uint256; | |
struct Vote { | |
address account; // The voter's account address. | |
uint256 votingPower; // Token balance of the account at the proposal's creation time. |
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.5; | |
import "github.com/OpenZeppelin/openzeppelin-solidity/contracts/math/SafeMath.sol"; | |
contract TestStructCompaction { | |
using SafeMath for uint256; | |
struct Vote { | |
address account; // The voter's account address. | |
uint256 votingPower; // Token balance of the account at the proposal's creation time. |
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
/* file: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol */ | |
pragma solidity ^0.5.0; | |
/** | |
* @title ERC20 interface | |
* @dev see https://github.com/ethereum/EIPs/issues/20 | |
*/ | |
interface IERC20 { | |
function transfer(address to, uint256 value) external returns (bool); |
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.0; | |
contract testManager { | |
address public manager; | |
modifier onlyManager() { | |
require(msg.sender == manager); | |
_; | |
} |
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
// endTime is already in day units from the 1st line, making the 2nd `* 1 days' incorrect in the 2nd require() statement | |
// endTime should be checked for > 0 | |
// the 2nd require() statment is not logical. now + N (N being an unint > 0) will always be > now | |
uint endTime = _endTimeInDays * 1 days; | |
require(endTime < maxAuditDuration); | |
require(block.timestamp + endTime * 1 days > block.timestamp); | |
require(msg.value > 0 && _maxAuditors > 0 && _stake > 0); | |
// Lines 14, 16, and 17 do NOT update state. Should be the following: | |
// 14: audits[_id].remainingReward = audits[_id].remainingReward.sub(_reward); |
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.24; | |
library SafeMathExtensions { | |
/** | |
* @dev Casts to uint8, throws on overflow. | |
*/ | |
function castTo8(uint256 a) internal pure returns (uint8 c) { | |
c = uint8(a); | |
assert(a == c); |
NewerOlder