Unnamed: 0 int64 0 7.36k | comments stringlengths 3 35.2k | code_string stringlengths 1 527k | code stringlengths 1 527k | __index_level_0__ int64 0 88.6k |
|---|---|---|---|---|
38 | // Query if a contract implements an interface, does not check ERC165 support account The address of the contract to query for support of an interface interfaceId The interface identifier, as specified in ERC-165return true if the contract at account indicates support of the interface withidentifier interfaceId, false otherwise Assumes that account contains a contract that supports ERC165, otherwisethe behavior of this method is undefined. This precondition can be checkedwith the `supportsERC165` method in this library.Interface identification is specified in ERC-165. / | function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) {
// success determines whether the staticcall succeeded and result determines
// whether the contract at account indicates support of _interfaceId
(bool success, bool result) = _callERC165SupportsInterface(account, interfaceId);
return (success && result);
}
| function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) {
// success determines whether the staticcall succeeded and result determines
// whether the contract at account indicates support of _interfaceId
(bool success, bool result) = _callERC165SupportsInterface(account, interfaceId);
return (success && result);
}
| 30,931 |
115 | // Check if the Loan is past the default grace period and that the account triggering the default has a percentage of total LoanFDTs that is greater than the minimum equity needed (specified in globals) | return pastDefaultGracePeriod && balance >= ((totalSupply * _globals(superFactory).minLoanEquity()) / 10_000);
| return pastDefaultGracePeriod && balance >= ((totalSupply * _globals(superFactory).minLoanEquity()) / 10_000);
| 4,131 |
5 | // yourToken.approve(address(this), amountOfTokens); | require(yourToken.allowance(msg.sender, address(this)) >= amountOfTokens, "Approve Token with correct allowance!");
uint256 soldAmount = amountOfTokens.div(tokensPerEth);
bool sent = yourToken.transferFrom(msg.sender, address(this), amountOfTokens);
require(sent, "Token transfer failed!");
| require(yourToken.allowance(msg.sender, address(this)) >= amountOfTokens, "Approve Token with correct allowance!");
uint256 soldAmount = amountOfTokens.div(tokensPerEth);
bool sent = yourToken.transferFrom(msg.sender, address(this), amountOfTokens);
require(sent, "Token transfer failed!");
| 33,137 |
97 | // If the position does not exist, create a new Position and add to the SetToken. If it already exists,then set the position units. If the new units is 0, remove the position. Handles adding/removing of components where needed (in light of potential external positions)._setToken Address of SetToken being modified _componentAddress of the component _newUnitQuantity of Position units - must be >= 0 / | function editDefaultPosition(ISetToken _setToken, address _component, uint256 _newUnit) internal {
bool isPositionFound = hasDefaultPosition(_setToken, _component);
if (!isPositionFound && _newUnit > 0) {
// If there is no Default Position and no External Modules, then component does not exist
if (!hasExternalPosition(_setToken, _component)) {
_setToken.addComponent(_component);
}
} else if (isPositionFound && _newUnit == 0) {
// If there is a Default Position and no external positions, remove the component
if (!hasExternalPosition(_setToken, _component)) {
_setToken.removeComponent(_component);
}
}
_setToken.editDefaultPositionUnit(_component, _newUnit.toInt256());
}
| function editDefaultPosition(ISetToken _setToken, address _component, uint256 _newUnit) internal {
bool isPositionFound = hasDefaultPosition(_setToken, _component);
if (!isPositionFound && _newUnit > 0) {
// If there is no Default Position and no External Modules, then component does not exist
if (!hasExternalPosition(_setToken, _component)) {
_setToken.addComponent(_component);
}
} else if (isPositionFound && _newUnit == 0) {
// If there is a Default Position and no external positions, remove the component
if (!hasExternalPosition(_setToken, _component)) {
_setToken.removeComponent(_component);
}
}
_setToken.editDefaultPositionUnit(_component, _newUnit.toInt256());
}
| 17,095 |
238 | // Update snapshot timestamp | snapshotTime = block.timestamp;
| snapshotTime = block.timestamp;
| 80,715 |
20 | // add delegates to the minter | _moveDelegates(address(0), _delegates[to], veloValue);
emit Mint(to, amount);
| _moveDelegates(address(0), _delegates[to], veloValue);
emit Mint(to, amount);
| 16,664 |
469 | // Sets the logarithm of the invariant in `data`, returning the updated value. / | function setLogInvariant(bytes32 data, int256 _logInvariant) internal pure returns (bytes32) {
return data.insertInt22(_logInvariant, _LOG_INVARIANT_OFFSET);
}
| function setLogInvariant(bytes32 data, int256 _logInvariant) internal pure returns (bytes32) {
return data.insertInt22(_logInvariant, _LOG_INVARIANT_OFFSET);
}
| 6,899 |
90 | // As setupOwners can only be called if the contract has not been initialized we don't need a check for setupModules | setupModules(to, data);
if (payment > 0) {
| setupModules(to, data);
if (payment > 0) {
| 26,656 |
85 | // Make the swap | uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
ethAmount = address(this).balance.sub(ethAmount);
emit SwapedTokenForEth(tokenAmount,ethAmount);
| uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
ethAmount = address(this).balance.sub(ethAmount);
emit SwapedTokenForEth(tokenAmount,ethAmount);
| 24,300 |
422 | // defaultRewardLevels = [2000, 4000, 6000, 8000]; | rewardsLevels[i] = 2000*(i+1);
| rewardsLevels[i] = 2000*(i+1);
| 46,151 |
2 | // Given the address of a user and an asset, returns the index of the marketplace listingReturns 0 if user doesn't have a listing in the given assetuser Address of the userasset Address of the asset return uint Index of the user's marketplace listing/ | function getListingIndex(address user, address asset) external view returns (uint);
| function getListingIndex(address user, address asset) external view returns (uint);
| 29,359 |
11 | // Load wild data | matrix[28][17] = Weight({attack:250,defense:200,life:0}); // elk 7036
| matrix[28][17] = Weight({attack:250,defense:200,life:0}); // elk 7036
| 7,541 |
3 | // Constructor / | constructor(string memory newBaseURI) ERC721("FakeThoughts", "FAKETHOUGHTS") {
_nextTokenId.increment();
setBaseURI(newBaseURI);
}
| constructor(string memory newBaseURI) ERC721("FakeThoughts", "FAKETHOUGHTS") {
_nextTokenId.increment();
setBaseURI(newBaseURI);
}
| 28,515 |
359 | // Update the user's stored ending timestamp | IveFXS.LockedBalance memory curr_locked_bal_pack = veFXS.locked(account);
userVeFXSEndpointCheckpointed[account] = curr_locked_bal_pack.end;
| IveFXS.LockedBalance memory curr_locked_bal_pack = veFXS.locked(account);
userVeFXSEndpointCheckpointed[account] = curr_locked_bal_pack.end;
| 16,376 |
74 | // Returns a token ID owned by owner at a given index of its token list. | * Use along with {balanceOf} to enumerate all of owner's tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
/**
* @dev Returns a token ID at a given index of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
| * Use along with {balanceOf} to enumerate all of owner's tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
/**
* @dev Returns a token ID at a given index of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
| 13,020 |
39 | // Update the state of the contract now that a deposit has been made/_bidId the bid that won the right to the deposit | function _processDeposit(uint256 _bidId) internal {
bidIdToStaker[_bidId] = msg.sender;
uint256 validatorId = _bidId;
address etherfiNode = createEtherfiNode(validatorId);
nodesManagerIntefaceInstance.setEtherFiNodePhase(
validatorId,
IEtherFiNode.VALIDATOR_PHASE.STAKE_DEPOSITED
);
emit StakeDeposit(msg.sender, _bidId, etherfiNode);
}
| function _processDeposit(uint256 _bidId) internal {
bidIdToStaker[_bidId] = msg.sender;
uint256 validatorId = _bidId;
address etherfiNode = createEtherfiNode(validatorId);
nodesManagerIntefaceInstance.setEtherFiNodePhase(
validatorId,
IEtherFiNode.VALIDATOR_PHASE.STAKE_DEPOSITED
);
emit StakeDeposit(msg.sender, _bidId, etherfiNode);
}
| 10,920 |
131 | // Mints tokens being sold during the crowdsale phase as part of the implementation of releaseTokensTo functionfrom the KYCBase contract. to The address that will receive the minted tokens. amount The amount of tokens to mint. / | function mintTokens(address to, uint256 amount) private {
token.mint(to, amount);
}
| function mintTokens(address to, uint256 amount) private {
token.mint(to, amount);
}
| 40,396 |
117 | // Distributes dividends whenever ether is paid to this contract. | receive() external payable {
distributeDividends();
}
| receive() external payable {
distributeDividends();
}
| 16,750 |
92 | // Call calculateMatchPrice - Solidity ABI encoding limitation workaround, hopefully temporary. / | function calculateMatchPrice_(
address[14] addrs,
uint[18] uints,
uint8[8] feeMethodsSidesKindsHowToCalls,
bytes calldataBuy,
bytes calldataSell,
bytes replacementPatternBuy,
bytes replacementPatternSell,
bytes staticExtradataBuy,
bytes staticExtradataSell)
| function calculateMatchPrice_(
address[14] addrs,
uint[18] uints,
uint8[8] feeMethodsSidesKindsHowToCalls,
bytes calldataBuy,
bytes calldataSell,
bytes replacementPatternBuy,
bytes replacementPatternSell,
bytes staticExtradataBuy,
bytes staticExtradataSell)
| 65,094 |
1 | // Emitted when a `viewingSatelliteCounterAddress` retrieves the `count` of a`viewedSatelliteCounterAddress`. `count` is the current count of the viewed address. Requirements:- Only emitted by Master chains. / | event CountRetrieved(
address indexed viewingSatelliteCounterAddress,
address indexed viewedSatelliteCounterAddress,
int256 count
);
| event CountRetrieved(
address indexed viewingSatelliteCounterAddress,
address indexed viewedSatelliteCounterAddress,
int256 count
);
| 24,858 |
252 | // Get the pending LP interests for a stakerreturn dueInterests Returns the interest amount / | function redeemLpInterests(uint256 expiry, address user)
| function redeemLpInterests(uint256 expiry, address user)
| 76,671 |
303 | // Referral percentages | uint256[] public referralPercentages = [0, 1250, 800, 400, 200];
mapping(uint256 => uint256) public nftRewards;
| uint256[] public referralPercentages = [0, 1250, 800, 400, 200];
mapping(uint256 => uint256) public nftRewards;
| 22,232 |
0 | // MISOMarket template id for the factory contract./For different marketplace types, this must be incremented. | uint256 public constant override marketTemplate = 1;
| uint256 public constant override marketTemplate = 1;
| 48,078 |
270 | // msg.sender (owner) is the root and admin | _presalesCounter.reset();
_tokenIdCounter.reset();
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
| _presalesCounter.reset();
_tokenIdCounter.reset();
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
| 76,568 |
38 | // Remove the address that you want to allow to be sent._whiteAddress address The specify what to send target./ | function removeAllowedSender(address _whiteAddress) public onlyOwner {
require(_whiteAddress != address(0), "SendLimiter/Not-Allow-Zero-Address");
delete sendWhitelist[_whiteAddress];
emit SendDelisted(_whiteAddress);
}
| function removeAllowedSender(address _whiteAddress) public onlyOwner {
require(_whiteAddress != address(0), "SendLimiter/Not-Allow-Zero-Address");
delete sendWhitelist[_whiteAddress];
emit SendDelisted(_whiteAddress);
}
| 1,631 |
88 | // The offerer must match on both items. | eq(
mload(paramsPtr),
mload(
add(execution, Execution_offerer_offset)
)
),
| eq(
mload(paramsPtr),
mload(
add(execution, Execution_offerer_offset)
)
),
| 32,921 |
8 | // Emitted when pause guardian is changed | event NewPauseGuardian(address oldPauseGuardian, address newPauseGuardian);
| event NewPauseGuardian(address oldPauseGuardian, address newPauseGuardian);
| 3,127 |
10 | // amount of wei raised | uint public raisedAmount;
uint256 public minBuyLimit = 10 ** 15; // min buyAmount is 0.1ETH
event TokenPurchase(
address indexed purchaser,
uint256 amount,
uint256 tokenAmount
);
| uint public raisedAmount;
uint256 public minBuyLimit = 10 ** 15; // min buyAmount is 0.1ETH
event TokenPurchase(
address indexed purchaser,
uint256 amount,
uint256 tokenAmount
);
| 12,391 |
24 | // Just pass if asset not in list | function _removeFromOwnedAssets(address _asset) internal {
if (!isInAssetList[_asset]) { return; }
isInAssetList[_asset] = false;
for (uint i; i < ownedAssets.length; i++) {
if (ownedAssets[i] == _asset) {
ownedAssets[i] = ownedAssets[ownedAssets.length - 1];
ownedAssets.pop();
break;
}
}
emit AssetRemoval(_asset);
}
| function _removeFromOwnedAssets(address _asset) internal {
if (!isInAssetList[_asset]) { return; }
isInAssetList[_asset] = false;
for (uint i; i < ownedAssets.length; i++) {
if (ownedAssets[i] == _asset) {
ownedAssets[i] = ownedAssets[ownedAssets.length - 1];
ownedAssets.pop();
break;
}
}
emit AssetRemoval(_asset);
}
| 33,100 |
1 | // Check Admin Accessadmin - Address of Adminreturn whether minter has access / | function isAdmin(address admin) public view returns (bool) {
return _admins[admin];
}
| function isAdmin(address admin) public view returns (bool) {
return _admins[admin];
}
| 28,885 |
19 | // Sets the royalty percentage to: _percent the percentage in basis points. When entering royalty, make sure you are using basis points (points per 10000). Usage example: This is to handle the decimals in solidity. Because solidity doesn't support floats. / | function setRoyaltyAmountTo(uint16 _percent) public onlyOwner {
require(_percent >= 0 && _percent <= 20000, "Royalty can only be between 0-20 percent of the sale");
royaltyPercentage = _percent;
}
| function setRoyaltyAmountTo(uint16 _percent) public onlyOwner {
require(_percent >= 0 && _percent <= 20000, "Royalty can only be between 0-20 percent of the sale");
royaltyPercentage = _percent;
}
| 39,582 |
69 | // PUBLIC SET function | function claimComp(address[] memory cTokens) public authCheck {
IComptroller(COMPTROLLER).claimComp(address(this), cTokens);
IERC20(COMP_ADDRESS).transfer(msg.sender, IERC20(COMP_ADDRESS).balanceOf(address(this)));
}
| function claimComp(address[] memory cTokens) public authCheck {
IComptroller(COMPTROLLER).claimComp(address(this), cTokens);
IERC20(COMP_ADDRESS).transfer(msg.sender, IERC20(COMP_ADDRESS).balanceOf(address(this)));
}
| 5,867 |
6 | // remove Deposit | depositsOf[_msgSender()][_depositId] = depositsOf[_msgSender()][depositsOf[_msgSender()].length - 1];
depositsOf[_msgSender()].pop();
| depositsOf[_msgSender()][_depositId] = depositsOf[_msgSender()][depositsOf[_msgSender()].length - 1];
depositsOf[_msgSender()].pop();
| 16,449 |
2 | // Founders' Tokens | _mint(address(0xb9Cf3B8237927C23298505F909BeC9f499761008), 5 * M * units);
_mint(address(0xDC7AF6D9a2F1C35e15d6E555dA84Cc6286B36299), 5 * M * units);
| _mint(address(0xb9Cf3B8237927C23298505F909BeC9f499761008), 5 * M * units);
_mint(address(0xDC7AF6D9a2F1C35e15d6E555dA84Cc6286B36299), 5 * M * units);
| 51,785 |
168 | // Swap half USDT for token | uint256 _usdt = IERC20(usdt).balanceOf(address(this));
if (_usdt > 0) {
_swapSushiswapWithPath(usdt_token1_path, _usdt.div(2));
}
| uint256 _usdt = IERC20(usdt).balanceOf(address(this));
if (_usdt > 0) {
_swapSushiswapWithPath(usdt_token1_path, _usdt.div(2));
}
| 8,916 |
104 | // Constructor function. / | constructor () public {
// register the supported interface to conform to ERC721Enumerable via ERC165
_registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
}
| constructor () public {
// register the supported interface to conform to ERC721Enumerable via ERC165
_registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
}
| 27,232 |
22 | // ERC-721 Non-Fungible Token Standard, optional enumeration extension The ERC-165 identifier for this interface is 0x780e9d63.William Entriken, Dieter Shirley, Jacob Evans, Nastassia Sachs / | interface ERC721Enumerable is ERC721 {
/// @notice Count NFTs tracked by this contract
/// @return A count of valid NFTs tracked by this contract, where each one of
/// them has an assigned and queryable owner not equal to the zero address
function totalSupply() external view returns (uint256);
/// @notice Enumerate valid NFTs
/// @dev Throws if `_index` >= `totalSupply()`.
/// @param _index A counter less than `totalSupply()`
/// @return The token identifier for the `_index`th NFT,
/// (sort order not specified)
function tokenByIndex(uint256 _index) external view returns (uint256);
/// @notice Enumerate NFTs assigned to an owner
/// @dev Throws if `_index` >= `balanceOf(_owner)` or if
/// `_owner` is the zero address, representing invalid NFTs.
/// @param _owner An address where we are interested in NFTs owned by them
/// @param _index A counter less than `balanceOf(_owner)`
/// @return The token identifier for the `_index`th NFT assigned to `_owner`,
/// (sort order not specified)
function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256);
}
| interface ERC721Enumerable is ERC721 {
/// @notice Count NFTs tracked by this contract
/// @return A count of valid NFTs tracked by this contract, where each one of
/// them has an assigned and queryable owner not equal to the zero address
function totalSupply() external view returns (uint256);
/// @notice Enumerate valid NFTs
/// @dev Throws if `_index` >= `totalSupply()`.
/// @param _index A counter less than `totalSupply()`
/// @return The token identifier for the `_index`th NFT,
/// (sort order not specified)
function tokenByIndex(uint256 _index) external view returns (uint256);
/// @notice Enumerate NFTs assigned to an owner
/// @dev Throws if `_index` >= `balanceOf(_owner)` or if
/// `_owner` is the zero address, representing invalid NFTs.
/// @param _owner An address where we are interested in NFTs owned by them
/// @param _index A counter less than `balanceOf(_owner)`
/// @return The token identifier for the `_index`th NFT assigned to `_owner`,
/// (sort order not specified)
function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256);
}
| 40,665 |
138 | // Subtract the Taxed Tokens from the amount | uint256 taxedAmount=amount-(contractToken);
| uint256 taxedAmount=amount-(contractToken);
| 13,584 |
6 | // uint256 amountOut = uniswapRouter.exactInputSingle(params); | uniswapRouter.exactInputSingle(params);
| uniswapRouter.exactInputSingle(params);
| 14,087 |
9 | // Returns the start and end timestamps of the current gradual weight change. poolState - The byte32 state of the Pool.return startTime - The timestamp at which the current gradual swap fee change started/will start.return endTime - The timestamp at which the current gradual swap fee change finished/will finish.return startSwapFeePercentage - The swap fee value at the start of the current gradual swap fee change.return endSwapFeePercentage - The swap fee value at the end of the current gradual swap fee change. / | function getSwapFeeFields(bytes32 poolState)
internal
pure
returns (
uint256 startTime,
uint256 endTime,
uint256 startSwapFeePercentage,
uint256 endSwapFeePercentage
)
| function getSwapFeeFields(bytes32 poolState)
internal
pure
returns (
uint256 startTime,
uint256 endTime,
uint256 startSwapFeePercentage,
uint256 endSwapFeePercentage
)
| 22,222 |
202 | // convert an amount in asset A to equivalent amount of asset B, based on a live price function includes the amount and applies .mul() first to increase the accuracy _amount amount in asset A _assetA asset A _assetB asset Breturn _amount in asset B / | function _convertAmountOnLivePrice(
FPI.FixedPointInt memory _amount,
address _assetA,
address _assetB
| function _convertAmountOnLivePrice(
FPI.FixedPointInt memory _amount,
address _assetA,
address _assetB
| 22,644 |
268 | // min balance can't be set to lower than 10k1 year | minBalance = _minBalance;
emit MinimumBalanceSet(_minBalance);
| minBalance = _minBalance;
emit MinimumBalanceSet(_minBalance);
| 67,949 |
0 | // Address => tokenIDs | mapping(address => uint256) public mintRecords;
| mapping(address => uint256) public mintRecords;
| 430 |
74 | // Burns the position at the index, to be called only from FuseMargin/tokenId tokenId of position to close | function closePosition(uint256 tokenId) external returns (address);
| function closePosition(uint256 tokenId) external returns (address);
| 83,329 |
37 | // cannot trust compiler with not turning bit operations into EXP opcode | return uint(b) / (BYTES_14_OFFSET * BYTES_14_OFFSET);
| return uint(b) / (BYTES_14_OFFSET * BYTES_14_OFFSET);
| 34,300 |
37 | // Make it more easily readable number without changing outcome | randomness = randomness % 1000000;
if (randomness % 2 == 0) {
payable(game.p1).transfer(payout);
} else {
| randomness = randomness % 1000000;
if (randomness % 2 == 0) {
payable(game.p1).transfer(payout);
} else {
| 53,048 |
15 | // Abstract implementation of managing token offersin multi classes / | abstract contract MultiClassOffer is IMultiClassOffer {
//index mapping of classId to offer
mapping(uint256 => uint256) private _offer;
//index mapping of classId to creator
mapping(uint256 => address) private _creator;
//index mapping of classId to sale period
mapping(uint256 => uint256[2]) private _period;
/**
* @dev abstract; defined in Ownable; Returns the address of the
* current owner.
*/
function owner() public view virtual returns (address);
/**
* @dev abstract; defined in Context; Returns the msg.sender.
*/
function _msgSender() internal view virtual returns (address);
/**
* @dev Checks the validity of the offer
*/
modifier offerValid(uint256 classId) {
uint256 offer = _offer[classId];
require(_creator[classId] != address(0), "No offer recipient");
require(_offer[classId] > 0, "No offer availalable");
require(
_period[classId][0] == 0 || block.timestamp >= _period[classId][0],
"Offer not started"
);
require(
_period[classId][1] == 0 || block.timestamp <= _period[classId][1],
"Offer has ended"
);
_;
}
/**
* @dev Permission for creator or owner
*/
modifier onlyCreatorOrOwner(uint256 classId) {
uint256 offer = _offer[classId];
address sender = _msgSender();
require(
sender == owner() || sender == _creator[classId],
"Caller is not the owner or creator"
);
_;
}
/**
* @dev Returns the offer of a `classId`
*/
function offerOf(uint256 classId)
public view returns(uint256)
{
return _offer[classId];
}
/**
* @dev Returns the creator of a `classId`
*/
function creatorOf(uint256 classId)
public view returns(address)
{
return _creator[classId];
}
/**
* @dev Sets the offer of `amount` in `classId`
*/
function _makeOffer(
uint256 classId,
uint256 amount,
uint256 start,
uint256 end
) internal virtual {
require(_creator[classId] != address(0), "No offer recipient");
require(amount > 0, "Offer amount should be more than zero");
require(
(start == 0 && end == 0) || end > start,
"Start time exceeds end time"
);
_offer[classId] = amount;
if (start > 0) {
_period[classId][0] = start;
}
if (end > 0) {
_period[classId][1] = end;
}
}
/**
* @dev Sets the `creator` of the `classId`
*/
function _setCreator(uint256 classId, address creator)
internal virtual
{
_creator[classId] = creator;
}
}
| abstract contract MultiClassOffer is IMultiClassOffer {
//index mapping of classId to offer
mapping(uint256 => uint256) private _offer;
//index mapping of classId to creator
mapping(uint256 => address) private _creator;
//index mapping of classId to sale period
mapping(uint256 => uint256[2]) private _period;
/**
* @dev abstract; defined in Ownable; Returns the address of the
* current owner.
*/
function owner() public view virtual returns (address);
/**
* @dev abstract; defined in Context; Returns the msg.sender.
*/
function _msgSender() internal view virtual returns (address);
/**
* @dev Checks the validity of the offer
*/
modifier offerValid(uint256 classId) {
uint256 offer = _offer[classId];
require(_creator[classId] != address(0), "No offer recipient");
require(_offer[classId] > 0, "No offer availalable");
require(
_period[classId][0] == 0 || block.timestamp >= _period[classId][0],
"Offer not started"
);
require(
_period[classId][1] == 0 || block.timestamp <= _period[classId][1],
"Offer has ended"
);
_;
}
/**
* @dev Permission for creator or owner
*/
modifier onlyCreatorOrOwner(uint256 classId) {
uint256 offer = _offer[classId];
address sender = _msgSender();
require(
sender == owner() || sender == _creator[classId],
"Caller is not the owner or creator"
);
_;
}
/**
* @dev Returns the offer of a `classId`
*/
function offerOf(uint256 classId)
public view returns(uint256)
{
return _offer[classId];
}
/**
* @dev Returns the creator of a `classId`
*/
function creatorOf(uint256 classId)
public view returns(address)
{
return _creator[classId];
}
/**
* @dev Sets the offer of `amount` in `classId`
*/
function _makeOffer(
uint256 classId,
uint256 amount,
uint256 start,
uint256 end
) internal virtual {
require(_creator[classId] != address(0), "No offer recipient");
require(amount > 0, "Offer amount should be more than zero");
require(
(start == 0 && end == 0) || end > start,
"Start time exceeds end time"
);
_offer[classId] = amount;
if (start > 0) {
_period[classId][0] = start;
}
if (end > 0) {
_period[classId][1] = end;
}
}
/**
* @dev Sets the `creator` of the `classId`
*/
function _setCreator(uint256 classId, address creator)
internal virtual
{
_creator[classId] = creator;
}
}
| 38,525 |
28 | // check if an account is frozenaccount address to check return true iff the address is in the list of frozen accounts and hasn&39;t been unfrozen/ | function isFrozen(address account) public view returns (bool) {
return frozenAccounts[account];
}
| function isFrozen(address account) public view returns (bool) {
return frozenAccounts[account];
}
| 13,718 |
36 | // AuctionFinalized is fired when an auction is finalized | event AuctionFinalized(address _owner, uint _auctionId);
| event AuctionFinalized(address _owner, uint _auctionId);
| 104 |
7 | // Store Items Count | uint public itemCount;
| uint public itemCount;
| 23,240 |
142 | // Start earning COMP tokens, yay! | return true;
| return true;
| 7,767 |
15 | // mint token that was redeemed for / | function _mintRedemption(address to) internal {
require(_redemptionCount < _redemptionMax, "Redeem: No redemptions remaining");
_redemptionCount++;
// Mint token
uint256 tokenId = _mint(to, _redemptionCount);
_mintedTokens.push(tokenId);
_mintNumbers[tokenId] = _redemptionCount;
}
| function _mintRedemption(address to) internal {
require(_redemptionCount < _redemptionMax, "Redeem: No redemptions remaining");
_redemptionCount++;
// Mint token
uint256 tokenId = _mint(to, _redemptionCount);
_mintedTokens.push(tokenId);
_mintNumbers[tokenId] = _redemptionCount;
}
| 1,850 |
4 | // Sets an Aave Oracle contract to enforce rewards with a source of value. Only callable by the emission admin of the given reward At the moment of reward configuration, the Incentives Controller performsa check to see if the reward asset oracle is compatible with IEACAggregator proxy.This check is enforced for integrators to be able to show incentives atthe current Aave UI without the need to setup an external price registry reward The address of the reward to set the price aggregator rewardOracle The address of price aggregator that follows IEACAggregatorProxy interface / | function setRewardOracle(address reward, IEACAggregatorProxy rewardOracle) external;
| function setRewardOracle(address reward, IEACAggregatorProxy rewardOracle) external;
| 6,222 |
43 | // Enables token to token transfers | function enableTransfers() external onlyOwner {
transfersActive = true;
}
| function enableTransfers() external onlyOwner {
transfersActive = true;
}
| 15,068 |
19 | // console.log("Withdrawing for user (raw)", rawTokenAmount); perform transfer | if (withdrawToken.balanceOf(address(this)) < rawTokenAmount) {
uint256 borrowedAmount = rawTokenAmount - withdrawToken.balanceOf(address(this));
insurance.settleDebt(borrowedAmount);
badDebt += borrowedAmount;
emit BadDebtGenerated(0, user, borrowedAmount);
}
| if (withdrawToken.balanceOf(address(this)) < rawTokenAmount) {
uint256 borrowedAmount = rawTokenAmount - withdrawToken.balanceOf(address(this));
insurance.settleDebt(borrowedAmount);
badDebt += borrowedAmount;
emit BadDebtGenerated(0, user, borrowedAmount);
}
| 8,539 |
75 | // Triple check all information received is valid for business | address business = businessesWallets[index];
require(business == addr, 'MonedaPR: Incorrect index sent');
string memory businessName = businessesMap[addr];
require(keccak256(abi.encodePacked((businessName))) == keccak256(abi.encodePacked((name))), 'MonedaPR: Incorrect name passed');
delete businessesMap[addr];
delete businessesWallets[index];
return true;
| address business = businessesWallets[index];
require(business == addr, 'MonedaPR: Incorrect index sent');
string memory businessName = businessesMap[addr];
require(keccak256(abi.encodePacked((businessName))) == keccak256(abi.encodePacked((name))), 'MonedaPR: Incorrect name passed');
delete businessesMap[addr];
delete businessesWallets[index];
return true;
| 20,155 |
193 | // Tokens can be minted only before minting finished. / | modifier canMint() {
require(!_mintingFinished, "ERC20Mintable: minting is finished");
_;
}
| modifier canMint() {
require(!_mintingFinished, "ERC20Mintable: minting is finished");
_;
}
| 11,023 |
97 | // sels the project's token to buyers | function sellTokens(address payable _recepient, uint256 _value) internal
nonReentrant
hasBeenStarted() // crowdsale started
hasntStopped() // wasn't cancelled by owner
whenCrowdsaleAlive() // in active state
| function sellTokens(address payable _recepient, uint256 _value) internal
nonReentrant
hasBeenStarted() // crowdsale started
hasntStopped() // wasn't cancelled by owner
whenCrowdsaleAlive() // in active state
| 12,043 |
23 | // this accumulates the shards the wallet gained from all the tokens | if (claimingAvailable) {
shardsGained += shards.determineYield(tokenYield[_token]);
}
| if (claimingAvailable) {
shardsGained += shards.determineYield(tokenYield[_token]);
}
| 29,964 |
238 | // Returns x - y, reverts if overflows or underflows/x The minuend/y The subtrahend/ return z The difference of x and y | function sub(int256 x, int256 y) internal pure returns (int256 z) {
require((z = x - y) <= x == (y >= 0));
}
| function sub(int256 x, int256 y) internal pure returns (int256 z) {
require((z = x - y) <= x == (y >= 0));
}
| 1,112 |
0 | // Mediation between a Fund and exchanges | interface ITrading {
function callOnExchange(
uint exchangeIndex,
string calldata methodSignature,
address[8] calldata orderAddresses,
uint[8] calldata orderValues,
bytes[4] calldata orderData,
bytes32 identifier,
bytes calldata signature
) external;
function addOpenMakeOrder(
address ofExchange,
address ofSellAsset,
address ofBuyAsset,
address ofFeeAsset,
uint orderId,
uint expiryTime
) external;
function removeOpenMakeOrder(
address ofExchange,
address ofSellAsset
) external;
function updateAndGetQuantityBeingTraded(address _asset) external returns (uint256);
function getOpenMakeOrdersAgainstAsset(address _asset) external view returns (uint256);
}
| interface ITrading {
function callOnExchange(
uint exchangeIndex,
string calldata methodSignature,
address[8] calldata orderAddresses,
uint[8] calldata orderValues,
bytes[4] calldata orderData,
bytes32 identifier,
bytes calldata signature
) external;
function addOpenMakeOrder(
address ofExchange,
address ofSellAsset,
address ofBuyAsset,
address ofFeeAsset,
uint orderId,
uint expiryTime
) external;
function removeOpenMakeOrder(
address ofExchange,
address ofSellAsset
) external;
function updateAndGetQuantityBeingTraded(address _asset) external returns (uint256);
function getOpenMakeOrdersAgainstAsset(address _asset) external view returns (uint256);
}
| 33,069 |
37 | // Returns item positions from caller. / | function fetchMyPositions()
external
view
returns (PositionResponse[] memory)
| function fetchMyPositions()
external
view
returns (PositionResponse[] memory)
| 17,939 |
17 | // Take tokens from seller ... | balanceOf [msg.sender] -= _value;
| balanceOf [msg.sender] -= _value;
| 3,428 |
319 | // CHECKS / | SellerConfig memory config = sellerConfig;
uint256 n = config.maxPerTx == 0
? requested
: Math.min(requested, config.maxPerTx);
| SellerConfig memory config = sellerConfig;
uint256 n = config.maxPerTx == 0
? requested
: Math.min(requested, config.maxPerTx);
| 62,733 |
10 | // Mint NFTs during whitelist mint _amt the number of nfts to mint. / | function whitelistMint(uint256 _amt) public payable whenNotPaused {
require(wlMintOpen, "Whitelist mint closed");
require(msg.value >= wlPrice * _amt, "Not enough eth to mint");
require(whiteList[msg.sender], "Not on the whitelist.");
mint(_amt);
}
| function whitelistMint(uint256 _amt) public payable whenNotPaused {
require(wlMintOpen, "Whitelist mint closed");
require(msg.value >= wlPrice * _amt, "Not enough eth to mint");
require(whiteList[msg.sender], "Not on the whitelist.");
mint(_amt);
}
| 51,931 |
55 | // burn the credit | _burnCredit(from, controlledToken, burnedCredit);
| _burnCredit(from, controlledToken, burnedCredit);
| 38,611 |
270 | // Withdraw component from the Vault and send to the user | coreInstance.withdrawModule(
address(this),
msg.sender,
currentComponent,
currentComponentQuantity
);
| coreInstance.withdrawModule(
address(this),
msg.sender,
currentComponent,
currentComponentQuantity
);
| 42,644 |
74 | // masks | uint256 mask1 = _generateMask_5x5(seed, verticalExpand1, horizontalExpand1);
seed = seed >> 32;
uint256 mask2 = _generateMask_5x5(seed, verticalExpand2, horizontalExpand2);
seed = seed >> 32;
uint256 mask3 = _generateMask_8x8(seed);
seed = seed >> 64;
uint256 combinedMask = mask1 & mask2;
uint256 highlightMask = mask1 & mask3;
uint256 invaderId = ((mask1 & ~combinedMask & ~highlightMask) & color1) | ((combinedMask & ~highlightMask) & color2) | (highlightMask & color3);
| uint256 mask1 = _generateMask_5x5(seed, verticalExpand1, horizontalExpand1);
seed = seed >> 32;
uint256 mask2 = _generateMask_5x5(seed, verticalExpand2, horizontalExpand2);
seed = seed >> 32;
uint256 mask3 = _generateMask_8x8(seed);
seed = seed >> 64;
uint256 combinedMask = mask1 & mask2;
uint256 highlightMask = mask1 & mask3;
uint256 invaderId = ((mask1 & ~combinedMask & ~highlightMask) & color1) | ((combinedMask & ~highlightMask) & color2) | (highlightMask & color3);
| 45,466 |
54 | // _sold in weis, softCap in weis | modifier capNotReached {
require(softCap > _sold);
_;
}
| modifier capNotReached {
require(softCap > _sold);
_;
}
| 79,680 |
158 | // 0x proxy for performing buys | address public immutable ZERO_EX_EXCHANGE_V3;
| address public immutable ZERO_EX_EXCHANGE_V3;
| 28,668 |
27 | // Total number of participants for this round / | function totalParticipants() public view returns (uint32) {
return uint32(participants.length);
}
| function totalParticipants() public view returns (uint32) {
return uint32(participants.length);
}
| 8,711 |
129 | // ensure that `signature` is really `message` signed by `msg.sender` | require(Message.isMessageValid(message));
require(msg.sender == Message.recoverAddressFromSignedMessage(signature, message, false));
bytes32 hashMsg = keccak256(abi.encodePacked(message));
bytes32 hashSender = keccak256(abi.encodePacked(msg.sender, hashMsg));
uint256 signed = numMessagesSigned(hashMsg);
require(!isAlreadyProcessed(signed));
| require(Message.isMessageValid(message));
require(msg.sender == Message.recoverAddressFromSignedMessage(signature, message, false));
bytes32 hashMsg = keccak256(abi.encodePacked(message));
bytes32 hashSender = keccak256(abi.encodePacked(msg.sender, hashMsg));
uint256 signed = numMessagesSigned(hashMsg);
require(!isAlreadyProcessed(signed));
| 19,155 |
5 | // Item auction ended and settled | bool settled;
| bool settled;
| 29,972 |
270 | // Calculates the vault's total holdings of token0 and token1 - inother words, how much of each token the vault would hold if it withdrewall its liquidity from Uniswap. / | function getTotalAmounts() public view override returns (uint256 total0, uint256 total1) {
(uint256 baseAmount0, uint256 baseAmount1) = getPositionAmounts(baseLower, baseUpper);
(uint256 limitAmount0, uint256 limitAmount1) =
getPositionAmounts(limitLower, limitUpper);
total0 = getBalance0().add(baseAmount0).add(limitAmount0);
total1 = getBalance1().add(baseAmount1).add(limitAmount1);
}
| function getTotalAmounts() public view override returns (uint256 total0, uint256 total1) {
(uint256 baseAmount0, uint256 baseAmount1) = getPositionAmounts(baseLower, baseUpper);
(uint256 limitAmount0, uint256 limitAmount1) =
getPositionAmounts(limitLower, limitUpper);
total0 = getBalance0().add(baseAmount0).add(limitAmount0);
total1 = getBalance1().add(baseAmount1).add(limitAmount1);
}
| 38,657 |
9 | // solhint-disable no-unused-vars | contract StakingMock is IStaking {
address public override rewardsToken;
address public override stakingToken;
uint256 public override periodFinish;
uint256 public override rewardRate;
uint256 public override rewardsDuration;
uint256 public override totalSupply;
mapping(address => uint256) internal _rewards;
mapping(address => uint256) internal _balances;
constructor(
address _rewardsToken,
address _stakingToken,
uint256 _rewardsDuration,
uint256 _rewardRate
) {
rewardsToken = _rewardsToken;
stakingToken = _stakingToken;
rewardsDuration = _rewardsDuration;
rewardRate = _rewardRate;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function earned(address account) public view override returns (uint256) {
return _rewards[account];
}
function stake(uint256 amount) external override {
IERC20(stakingToken).transferFrom(msg.sender, address(this), amount);
_balances[msg.sender] += amount;
totalSupply += amount;
}
function withdraw(uint256 amount) public override {
require(balanceOf(msg.sender) >= amount, "withdraw: transfer amount exceeds balance");
_balances[msg.sender] -= amount;
totalSupply -= amount;
IERC20(stakingToken).transfer(msg.sender, amount);
}
function getReward() public override {
uint256 reward = _rewards[msg.sender];
require(reward > 0, "getReward: transfer amount exceeds balance");
_rewards[msg.sender] = 0;
IERC20(rewardsToken).transfer(msg.sender, reward);
}
function exit() external override {
withdraw(balanceOf(msg.sender));
getReward();
}
function notifyRewardAmount(uint256 reward) external override {
IERC20(rewardsToken).transferFrom(msg.sender, address(this), reward);
_rewards[msg.sender] += reward;
periodFinish = block.number + rewardsDuration;
}
function setReward(address account, uint256 amount) external {
_rewards[account] += amount;
}
}
| contract StakingMock is IStaking {
address public override rewardsToken;
address public override stakingToken;
uint256 public override periodFinish;
uint256 public override rewardRate;
uint256 public override rewardsDuration;
uint256 public override totalSupply;
mapping(address => uint256) internal _rewards;
mapping(address => uint256) internal _balances;
constructor(
address _rewardsToken,
address _stakingToken,
uint256 _rewardsDuration,
uint256 _rewardRate
) {
rewardsToken = _rewardsToken;
stakingToken = _stakingToken;
rewardsDuration = _rewardsDuration;
rewardRate = _rewardRate;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function earned(address account) public view override returns (uint256) {
return _rewards[account];
}
function stake(uint256 amount) external override {
IERC20(stakingToken).transferFrom(msg.sender, address(this), amount);
_balances[msg.sender] += amount;
totalSupply += amount;
}
function withdraw(uint256 amount) public override {
require(balanceOf(msg.sender) >= amount, "withdraw: transfer amount exceeds balance");
_balances[msg.sender] -= amount;
totalSupply -= amount;
IERC20(stakingToken).transfer(msg.sender, amount);
}
function getReward() public override {
uint256 reward = _rewards[msg.sender];
require(reward > 0, "getReward: transfer amount exceeds balance");
_rewards[msg.sender] = 0;
IERC20(rewardsToken).transfer(msg.sender, reward);
}
function exit() external override {
withdraw(balanceOf(msg.sender));
getReward();
}
function notifyRewardAmount(uint256 reward) external override {
IERC20(rewardsToken).transferFrom(msg.sender, address(this), reward);
_rewards[msg.sender] += reward;
periodFinish = block.number + rewardsDuration;
}
function setReward(address account, uint256 amount) external {
_rewards[account] += amount;
}
}
| 37,811 |
26 | // Checks if `_operator` is an approved operator for `_owner`. _owner The address that owns the NFTs. _operator The address that acts on behalf of the owner.return True if approved for all, false otherwise. / | function isApprovedForAll(address _owner, address _operator)
external
view
override
returns (bool)
| function isApprovedForAll(address _owner, address _operator)
external
view
override
returns (bool)
| 18,991 |
187 | // mintable | function mint(address to, uint256 tokenId) public {
require(
hasRole(MINTER_ROLE, _msgSender()),
"ERC721Mintble: must have minter role to mint"
);
_mint(to, tokenId);
}
| function mint(address to, uint256 tokenId) public {
require(
hasRole(MINTER_ROLE, _msgSender()),
"ERC721Mintble: must have minter role to mint"
);
_mint(to, tokenId);
}
| 24,747 |
150 | // Fee Conversion Logic |
function sweepFees()
public
|
function sweepFees()
public
| 55,876 |
0 | // planet object | struct Planet {
string name;
address owner;
uint price;
uint ownerPlanet;
}
| struct Planet {
string name;
address owner;
uint price;
uint ownerPlanet;
}
| 26,222 |
12 | // Emitted when an instance of `ProtocolControl` is migrated to this registry. | event MigratedProtocolControl(address indexed deployer, uint256 indexed version, address indexed controlAddress);
| event MigratedProtocolControl(address indexed deployer, uint256 indexed version, address indexed controlAddress);
| 55,066 |
33 | // Set notary wallet address. The notary is used as a way to sign and validate proof of stake function calls. notary Address of notary wallet to use. / | function setNotary (address notary) public onlyOwner {
_notary = notary;
}
| function setNotary (address notary) public onlyOwner {
_notary = notary;
}
| 28,318 |
249 | // Saves a min check if there is no withdrawal limit. | _maxWithdraw = convertToAssets(balanceOf(_owner));
| _maxWithdraw = convertToAssets(balanceOf(_owner));
| 31,680 |
55 | // User chooses to apply a provider / | function applyFlashLiquidateProvider() external {
pendingFlashLiquidateProvider[msg.sender] = true;
emit FlashLiquidateProvider(msg.sender, 1);
}
| function applyFlashLiquidateProvider() external {
pendingFlashLiquidateProvider[msg.sender] = true;
emit FlashLiquidateProvider(msg.sender, 1);
}
| 17,796 |
19 | // Loan creation event with indexed NFT owner | event LoanCreated(
uint256 loanId,
address indexed owner,
address tokenAddress,
uint256 tokenId,
uint256 maxLoanAmount,
uint256 loanCompleteTime
);
| event LoanCreated(
uint256 loanId,
address indexed owner,
address tokenAddress,
uint256 tokenId,
uint256 maxLoanAmount,
uint256 loanCompleteTime
);
| 8,903 |
12 | // Reinvest rewards from staking contract to deposit tokens This external function requires minimum tokens to be met / | function reinvest() external onlyEOA {
uint unclaimedRewards = checkReward();
require(unclaimedRewards >= MIN_TOKENS_TO_REINVEST, "MIN_TOKENS_TO_REINVEST");
_reinvest(unclaimedRewards);
}
| function reinvest() external onlyEOA {
uint unclaimedRewards = checkReward();
require(unclaimedRewards >= MIN_TOKENS_TO_REINVEST, "MIN_TOKENS_TO_REINVEST");
_reinvest(unclaimedRewards);
}
| 5,489 |
84 | // PoW failed | return 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
| return 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
| 44,287 |
516 | // Updating Currently playing? | if (_addressPredictionMade[msg.sender][id] != true){
_playableAddresses[id].push(msg.sender);
_addressPredictionMade[msg.sender][id] = true;
}
| if (_addressPredictionMade[msg.sender][id] != true){
_playableAddresses[id].push(msg.sender);
_addressPredictionMade[msg.sender][id] = true;
}
| 23,959 |
1 | // returns total user score | function addScore(address userId, uint256 badgeId) external returns (uint256);
function distribute(address userId) external;
function approve(address userId) external;
function challenge(uint256 badgeId) external payable;
function createBadge() external returns (uint256);
| function addScore(address userId, uint256 badgeId) external returns (uint256);
function distribute(address userId) external;
function approve(address userId) external;
function challenge(uint256 badgeId) external payable;
function createBadge() external returns (uint256);
| 21,626 |
94 | // Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),reverting with custom message when dividing by zero. CAUTION: This function is deprecated because it requires allocating memory for the errormessage unnecessarily. For custom revert reasons use {tryMod}. Counterpart to Solidity's `%` operator. This function uses a `revert`opcode (which leaves remaining gas untouched) while Solidity uses aninvalid opcode to revert (consuming all remaining gas). Requirements: - The divisor cannot be zero. / | function mod(
| function mod(
| 28,118 |
7 | // store new vault address. | vaultList[_sender] = vault;
| vaultList[_sender] = vault;
| 22,271 |
10 | // SafeMath Unsigned math operations with safety checks that revert on error / | library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath::mul: Integer overflow");
return c;
}
/**
* @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath::div: Invalid divisor zero");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath::sub: Integer underflow");
uint256 c = a - b;
return c;
}
/**
* @dev Adds two unsigned integers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath::add: Integer overflow");
return c;
}
/**
* @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath::mod: Invalid divisor zero");
return a % b;
}
}
| library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath::mul: Integer overflow");
return c;
}
/**
* @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath::div: Invalid divisor zero");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath::sub: Integer underflow");
uint256 c = a - b;
return c;
}
/**
* @dev Adds two unsigned integers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath::add: Integer overflow");
return c;
}
/**
* @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath::mod: Invalid divisor zero");
return a % b;
}
}
| 819 |
63 | // Returns the total value of payout to challengers that have been claimed/ return Value of claimed payouts in wei | function totalPaidOut() external view returns (uint256);
| function totalPaidOut() external view returns (uint256);
| 8,630 |
2 | // Iterate through the reserves to get all the information from the (a/s/v) Tokens | for (uint256 i = 0; i < reserves.length; i++) {
AggregatedReserveIncentiveData memory reserveIncentiveData = reservesIncentiveData[i];
reserveIncentiveData.underlyingAsset = reserves[i];
DataTypes.ReserveData memory baseData = pool.getReserveData(reserves[i]);
| for (uint256 i = 0; i < reserves.length; i++) {
AggregatedReserveIncentiveData memory reserveIncentiveData = reservesIncentiveData[i];
reserveIncentiveData.underlyingAsset = reserves[i];
DataTypes.ReserveData memory baseData = pool.getReserveData(reserves[i]);
| 18,337 |
76 | // Emitted when the pause is lifted by `account`. / | event Unpaused(address account);
bool private _paused;
| event Unpaused(address account);
bool private _paused;
| 371 |
7 | // event to store blood transfer from Blood Bank to Hospital on Chain | event BloodTransfer(
uint256 id,
string newOwner,
uint256 verified,
string status
);
| event BloodTransfer(
uint256 id,
string newOwner,
uint256 verified,
string status
);
| 25,317 |
96 | // Transfers collateral tokens (this market) to the liquidator. Will fail unless called by another bToken during the process of liquidation. Its absolutely critical to use msg.sender as the borrowed bToken and not a parameter. liquidator The account receiving seized collateral borrower The account having collateral seized seizeTokens The number of bTokens to seizereturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) / | function seize(address liquidator, address borrower, uint seizeTokens) external returns (uint) {
liquidator; borrower; seizeTokens; // Shh
delegateAndReturn();
}
| function seize(address liquidator, address borrower, uint seizeTokens) external returns (uint) {
liquidator; borrower; seizeTokens; // Shh
delegateAndReturn();
}
| 13,523 |
66 | // internal exclude from max tx | _isExcludedFromMaxTx[owner()] = true;
_isExcludedFromMaxTx[address(this)] = true;
| _isExcludedFromMaxTx[owner()] = true;
_isExcludedFromMaxTx[address(this)] = true;
| 41,431 |
14 | // initial holder | address holder = dataAddress["treasury"];
string memory initialHolderKey = __i(i, "initialHolder");
dataAddress[initialHolderKey] = holder;
| address holder = dataAddress["treasury"];
string memory initialHolderKey = __i(i, "initialHolder");
dataAddress[initialHolderKey] = holder;
| 23,510 |
154 | // Emitted when `addr` is removed from the {superWhiteListed}. / | event UnSuperWhitelist(address addr);
| event UnSuperWhitelist(address addr);
| 18,773 |
16 | // 2% from a referral deposit transfer to a referrer | uint payReferrer = msg.value * 2 / 100; // 2% from referral deposit to referrer
| uint payReferrer = msg.value * 2 / 100; // 2% from referral deposit to referrer
| 36,852 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.