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
14
// All Types
function identifier(bytes29 _view) internal pure returns (uint8) { return uint8(_view.indexUint(0, 1)); }
function identifier(bytes29 _view) internal pure returns (uint8) { return uint8(_view.indexUint(0, 1)); }
27,852
182
// The amount of tokens to burn
uint256 burnAmount = _amount.mul(burnFeePercent).div(100);
uint256 burnAmount = _amount.mul(burnFeePercent).div(100);
26,486
24
// Factory contract: keeps track of meme for only leaderboard and view purposes
contract MemeRecorder { address[] public memeContracts; constructor() public {} function addMeme(string _ipfsHash, string _name) public { Meme newMeme; newMeme = new Meme(_ipfsHash, msg.sender, _name, 18, 1, 10000000000); memeContracts.push(newMeme); } function getMemes() ...
contract MemeRecorder { address[] public memeContracts; constructor() public {} function addMeme(string _ipfsHash, string _name) public { Meme newMeme; newMeme = new Meme(_ipfsHash, msg.sender, _name, 18, 1, 10000000000); memeContracts.push(newMeme); } function getMemes() ...
69,262
240
// Domain and version for use in signatures (EIP-712)
bytes constant internal DOMAIN_NAME = "SWAP"; bytes constant internal DOMAIN_VERSION = "2";
bytes constant internal DOMAIN_NAME = "SWAP"; bytes constant internal DOMAIN_VERSION = "2";
26,331
9
// =============== ERC721x ===============
function supportsInterface(bytes4 _interfaceId) public view virtual override(ERC2981, ERC4907A) returns (bool)
function supportsInterface(bytes4 _interfaceId) public view virtual override(ERC2981, ERC4907A) returns (bool)
31,858
54
// Initiate Payout /
function InitiatePayout(address _addr, string _exchange, string _token) external onlyOwner
function InitiatePayout(address _addr, string _exchange, string _token) external onlyOwner
2,465
6
// ============ Re-entrency vulnerabilities ============ /
modifier callerIsUser() { require(tx.origin == msg.sender, "The caller is another contract"); _; }
modifier callerIsUser() { require(tx.origin == msg.sender, "The caller is another contract"); _; }
24,786
32
// add ref. bonus
_dividends += referralBalance_[_customerAddress]; referralBalance_[_customerAddress] = 0; if (_recipient == address(0x0)){ _recipient = msg.sender; }
_dividends += referralBalance_[_customerAddress]; referralBalance_[_customerAddress] = 0; if (_recipient == address(0x0)){ _recipient = msg.sender; }
52,260
10
// Make sure the claim has a valid id
require(_claim.id > 0 && _claim.id <= claimCount);
require(_claim.id > 0 && _claim.id <= claimCount);
42,709
289
// Initialize the stored rewards
rewardsPerTokenStored.push(0);
rewardsPerTokenStored.push(0);
71,309
1
// Administrator for this contract /
address public admin; address public underWriterAdmin;
address public admin; address public underWriterAdmin;
27,224
147
// The easiest way to bubble the revert reason is using memory via assembly
assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) }
assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) }
32,035
87
// Calculates referrer bonusvalue of etherto get bonus for return bonus tokens/
function getReferrerBonus(uint256 value) view public returns(uint256) { return value.mul(baseRate).mul(referrerBonusPercent).div(PERCENT_DIVIDER); }
function getReferrerBonus(uint256 value) view public returns(uint256) { return value.mul(baseRate).mul(referrerBonusPercent).div(PERCENT_DIVIDER); }
20,621
15
// Move the OSD gas compensation to the Gas Pool
_withdrawOSD(contractsCache.activePool, contractsCache.osdToken, gasPoolAddress, OSD_GAS_COMPENSATION, OSD_GAS_COMPENSATION); emit VaultUpdated(msg.sender, vars.compositeDebt, vars.netColl, vars.stake, uint8(BorrowerOperation.openVault)); emit BorrowFeeInROSE(msg.sender, vars.ROSEFee);
_withdrawOSD(contractsCache.activePool, contractsCache.osdToken, gasPoolAddress, OSD_GAS_COMPENSATION, OSD_GAS_COMPENSATION); emit VaultUpdated(msg.sender, vars.compositeDebt, vars.netColl, vars.stake, uint8(BorrowerOperation.openVault)); emit BorrowFeeInROSE(msg.sender, vars.ROSEFee);
31,258
51
// Allow withdrawing any token other than the relevant one /
function releaseForeignToken(ERC20 _token, uint256 amount) onlyOwner { require(_token != token); _token.transfer(owner, amount); }
function releaseForeignToken(ERC20 _token, uint256 amount) onlyOwner { require(_token != token); _token.transfer(owner, amount); }
21,827
14
// uint8 r = fromHexChar(uint8(ss[0]))16 + fromHexChar(uint8(ss[1]));
for (uint i = 0; i < ss.length / 2; ++i) { r[i] = bytes1(fromHexChar(uint8(ss[2*i])) * 16 + fromHexChar(uint8(ss[2*i+1]))); }
for (uint i = 0; i < ss.length / 2; ++i) { r[i] = bytes1(fromHexChar(uint8(ss[2*i])) * 16 + fromHexChar(uint8(ss[2*i+1]))); }
22,159
33
// Safely manipulate unsigned fixed-point decimals at a given precision level. Functions accepting uints in this contract and derived contractsare taken to be such fixed point decimals of a specified precision (either standardor high). /
library SafeDecimalMath { using SafeMath for uint; /* Number of decimal places in the representations. */ uint8 public constant decimals = 18; uint8 public constant highPrecisionDecimals = 27; /* The number representing 1.0. */ uint public constant UNIT = 10 ** uint(decimals); /* The num...
library SafeDecimalMath { using SafeMath for uint; /* Number of decimal places in the representations. */ uint8 public constant decimals = 18; uint8 public constant highPrecisionDecimals = 27; /* The number representing 1.0. */ uint public constant UNIT = 10 ** uint(decimals); /* The num...
6,032
4
// add a function prefixed with test here so forge coverage will ignore this file
function testChillOnHelper() public {} }
function testChillOnHelper() public {} }
16,686
105
// Explicit conversion to address takes bottom 160 bits
address expected = address(uint256(keccak256(abi.encodePacked(product)))); return (actual == expected);
address expected = address(uint256(keccak256(abi.encodePacked(product)))); return (actual == expected);
26,379
191
// Initial price is 0 and increases by 0.01 ETH every 100 tokens until reaching 0.08 ETH. The price will remain at 0.08 ETH for nearly the remainder of the mint. When only 200 tokens remain the price will increase once more to 0.09 ETH. When only 100 tokens remain the price will update to the final price of 0.10 ETH.
require(tx.origin == msg.sender, "Minting from another contract is not supported."); if (currentPrice == 0) { require(balanceOf(msg.sender) + quantity <= MAX_FREE_PER_WALLET, "The max a single wallet can mint when price is 0.00 ETH is 5. Once the price is higher than 0, the max a single wa...
require(tx.origin == msg.sender, "Minting from another contract is not supported."); if (currentPrice == 0) { require(balanceOf(msg.sender) + quantity <= MAX_FREE_PER_WALLET, "The max a single wallet can mint when price is 0.00 ETH is 5. Once the price is higher than 0, the max a single wa...
47,566
20
// Standard Way of deriving salt
bytes32 salt = keccak256(abi.encode(_user, _saltNonce));
bytes32 salt = keccak256(abi.encode(_user, _saltNonce));
21,780
35
// Get parameters of many collaterals assets asset addresses owner owner address /
function getMultiCollateralParameters(address[] calldata assets, address owner) external view returns (CollateralParameters[] memory r) { uint length = assets.length;
function getMultiCollateralParameters(address[] calldata assets, address owner) external view returns (CollateralParameters[] memory r) { uint length = assets.length;
55,769
227
// Checks the whitelist for msg.sender.// Reverts if msg.sender is not in the whitelist.
function _onlyWhitelisted() internal view { // Check if the message sender is an EOA. In the future, this potentially may break. It is important that functions // which rely on the whitelist not be explicitly vulnerable in the situation where this no longer holds true. if (tx.origin == msg.s...
function _onlyWhitelisted() internal view { // Check if the message sender is an EOA. In the future, this potentially may break. It is important that functions // which rely on the whitelist not be explicitly vulnerable in the situation where this no longer holds true. if (tx.origin == msg.s...
69,056
46
// public variables of reward distribution
mapping(address => uint256) public investorContribution; //Track record whether token holder exist or not address[] public icoContributors; //Array of addresses of ICO contributors uint256 public tokenHolderIndex = 0; //To split the iterations of For Loop ...
mapping(address => uint256) public investorContribution; //Track record whether token holder exist or not address[] public icoContributors; //Array of addresses of ICO contributors uint256 public tokenHolderIndex = 0; //To split the iterations of For Loop ...
24,367
9
// shares The amount of shares that would be minted/ return assets The amount of assets that would be required, under ideal conditions only
function previewMint(uint256 shares) external view returns (uint256 assets);
function previewMint(uint256 shares) external view returns (uint256 assets);
38,975
24
// initial min amount is 0 revert in case we received 0 tokens after swap
if (_amount <= minTokenAmount[_transitToken]) { revert LessOrEqualsMinAmount(); }
if (_amount <= minTokenAmount[_transitToken]) { revert LessOrEqualsMinAmount(); }
26,787
8
// The Ownable constructor sets the original `owner` o the contract to the sender account/
constructor() public { _owner = msg.sender; }
constructor() public { _owner = msg.sender; }
1,906
127
// Emitted when an address has been added to or removed from the token transfer allowlist. accountAddress that was added to or removed from the token transfer allowlist.isAllowedTrue if the address was added to the allowlist, false if removed. /
event TransferAllowlistUpdated( address account, bool isAllowed );
event TransferAllowlistUpdated( address account, bool isAllowed );
27,582
240
// now let's check if there is better apr somewhere else.If there is and profit potential is worth changing then lets do it
(uint256 lowest, uint256 lowestApr, , uint256 potential) = estimateAdjustPosition();
(uint256 lowest, uint256 lowestApr, , uint256 potential) = estimateAdjustPosition();
5,902
190
// finally transfer the ether, this withdrawal pattern prevents re-entry attacks
msg.sender.transfer(revenue); Transfer(msg.sender, this, _amount); return revenue;
msg.sender.transfer(revenue); Transfer(msg.sender, this, _amount); return revenue;
45,830
14
// permit transaction
bool isLock = true;
bool isLock = true;
15,597
6
// The next token ID of the NFT to "lazy mint".
uint256 public nextTokenIdToMint;
uint256 public nextTokenIdToMint;
71,781
27
// Allows for the total credit (bonus + non-bonus) of an address to be queried. This is a constant function which does not alter the state of the contract and therefore does notrequire any gas or a signature to be executed._addr The address of which to query the total credits. return The total amount of credit the addr...
function getTotalDropsOf(address _addr) public view returns(uint256) { return getDropsOf(_addr).add(getBonusDropsOf(_addr)); }
function getTotalDropsOf(address _addr) public view returns(uint256) { return getDropsOf(_addr).add(getBonusDropsOf(_addr)); }
21,974
59
// https:docs.Pynthetix.io/contracts/source/contracts/Pynthetixstate
contract PynthetixState is Owned, State, IPynthetixState { using SafeMath for uint; using SafeDecimalMath for uint; // A struct for handing values associated with an individual user's debt position struct IssuanceData { // Percentage of the total debt owned at the time // of issuance. T...
contract PynthetixState is Owned, State, IPynthetixState { using SafeMath for uint; using SafeDecimalMath for uint; // A struct for handing values associated with an individual user's debt position struct IssuanceData { // Percentage of the total debt owned at the time // of issuance. T...
39,811
14
// game controllers they can access special functions
mapping(address => bool) public controllers;
mapping(address => bool) public controllers;
2,968
146
// Check if signature would still be valid (i.e. effectiveBlock > block.number)
require(effectiveBlock > block.number, "CerticolDAO: signature has expired");
require(effectiveBlock > block.number, "CerticolDAO: signature has expired");
51,500
104
// calculate total payment required to close the loan
uint256 totalPaymentRequired = loan.remainingPrincipal + periodInterest;
uint256 totalPaymentRequired = loan.remainingPrincipal + periodInterest;
31,890
117
// call the before callback
if (optype == FlowChangeType.CREATE_FLOW) { cbStates.noopBit = SuperAppDefinitions.BEFORE_AGREEMENT_CREATED_NOOP; } else if (optype == FlowChangeType.UPDATE_FLOW) {
if (optype == FlowChangeType.CREATE_FLOW) { cbStates.noopBit = SuperAppDefinitions.BEFORE_AGREEMENT_CREATED_NOOP; } else if (optype == FlowChangeType.UPDATE_FLOW) {
35,666
83
// Override ERC1155 such that zero amount token transfers are disallowed.This prevents arbitrary 'creation' of new tokens in the collection by anyone. /
function safeTransferFrom( address from, address to, uint256 tokenId, uint256 amount, bytes memory data
function safeTransferFrom( address from, address to, uint256 tokenId, uint256 amount, bytes memory data
17,118
7
// The seller's address (to receive ETH upon distribution, and for authing safeties)
address seller = 0xB00Ae1e677B27Eee9955d632FF07a8590210B366;
address seller = 0xB00Ae1e677B27Eee9955d632FF07a8590210B366;
37,997
13
// get the user's share (in underlying)/
function underlyingBalanceWithInvestmentForHolder(address holder) view external override returns (uint256) { if (totalSupply() == 0) { return 0; } return underlyingBalanceWithInvestment() .mul(balanceOf(holder)) .div(totalSupply()); }
function underlyingBalanceWithInvestmentForHolder(address holder) view external override returns (uint256) { if (totalSupply() == 0) { return 0; } return underlyingBalanceWithInvestment() .mul(balanceOf(holder)) .div(totalSupply()); }
8,367
200
// ============================ Yield Farming ==================================
function creditAvailable() external view returns (uint256); function debtOutstanding() external view returns (uint256); function report( uint256 _gain, uint256 _loss, uint256 _debtPayment ) external;
function creditAvailable() external view returns (uint256); function debtOutstanding() external view returns (uint256); function report( uint256 _gain, uint256 _loss, uint256 _debtPayment ) external;
30,032
461
// transfer staking token in
uint actualAmount = doTransferIn(lpAddress, account, amount);
uint actualAmount = doTransferIn(lpAddress, account, amount);
31,137
34
// FXX can only become stronger
require(_price <= sellPrice); sellPrice = _price;
require(_price <= sellPrice); sellPrice = _price;
25,446
100
// for these knobs, we allow updating to zero value
if (providerSecurity != market.providerSecurity) { markets[marketId].providerSecurity = providerSecurity; wasChanged = true; }
if (providerSecurity != market.providerSecurity) { markets[marketId].providerSecurity = providerSecurity; wasChanged = true; }
23,834
538
// load into memory
address sender = msg.sender; uint256 pendingz = tokensInBucket[toTransmute];
address sender = msg.sender; uint256 pendingz = tokensInBucket[toTransmute];
18,511
48
// Throws if called by any account other than the owner./
modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; }
modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; }
802
239
// Conduct sanity checks on Pool parameters.
PoolLib.poolSanityChecks(_globals(msg.sender), _liquidityAsset, _stakeAsset, _stakingFee, _delegateFee);
PoolLib.poolSanityChecks(_globals(msg.sender), _liquidityAsset, _stakeAsset, _stakingFee, _delegateFee);
20,855
178
// - EIP 2612 compliance: See {ERC20-permit} method, which can be used to change an account's ERC20 allowance by/
constructor(string memory _name, string memory _symbol) ERC20Permit(_name, _symbol) { _setupOwner(msg.sender); }
constructor(string memory _name, string memory _symbol) ERC20Permit(_name, _symbol) { _setupOwner(msg.sender); }
8,212
63
// Get a reference to the funding cycle being tapped.
uint256 fundingCycleId = _tappable(_projectId);
uint256 fundingCycleId = _tappable(_projectId);
27,341
44
// Calculate traits
syncTraits.baseColors = getColorsHexStrings(tokenId); if (syncTraits.rarity_roll % 333 == 0) {
syncTraits.baseColors = getColorsHexStrings(tokenId); if (syncTraits.rarity_roll % 333 == 0) {
32,180
3
// Allows for arbitrary batched callsAll external calls made through this function will msg.sender == contract addressexCallData Struct consisting of1) target - contract to call2) data - data to call target with3) value - eth value to call target with /
function multiexcall( ExCallData[] calldata exCallData
function multiexcall( ExCallData[] calldata exCallData
22,255
209
// pragma solidity >0.4.13; /
contract DSMath { function add(uint x, uint y) internal pure returns (uint z) { require((z = x + y) >= x, "ds-math-add-overflow"); } function sub(uint x, uint y) internal pure returns (uint z) { require((z = x - y) <= x, "ds-math-sub-underflow"); } function mul(uint x, uint y) intern...
contract DSMath { function add(uint x, uint y) internal pure returns (uint z) { require((z = x + y) >= x, "ds-math-add-overflow"); } function sub(uint x, uint y) internal pure returns (uint z) { require((z = x - y) <= x, "ds-math-sub-underflow"); } function mul(uint x, uint y) intern...
26,829
92
// check if fees should apply to this transaction
if ( _minTotalSupply >= _totalSupply || feelessSender[sender] || feelessReciever[recipient] ) { return (amount, 0); }
if ( _minTotalSupply >= _totalSupply || feelessSender[sender] || feelessReciever[recipient] ) { return (amount, 0); }
31,630
132
// transfer from auction maker to offer maker
erc721.safeTransferFrom(auctionOrder.maker, offerOrder.maker, auctionOrder.tokenId);
erc721.safeTransferFrom(auctionOrder.maker, offerOrder.maker, auctionOrder.tokenId);
19,684
24
// ------------------------------------------------------------------------ Get the token balance for account `tokenOwner` ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public view returns (uint balance) { return balances[tokenOwner]; }
function balanceOf(address tokenOwner) public view returns (uint balance) { return balances[tokenOwner]; }
11,505
1
// pausable per network
mapping(uint256 => bool) public pausedNetwork;
mapping(uint256 => bool) public pausedNetwork;
2,745
16
// ------ Events ------
event Paused(address account); /// @dev Emitted when the pause is triggered by `account`. event Unpaused(address account); /// @dev Emitted when the pause is lifted by `account`.
event Paused(address account); /// @dev Emitted when the pause is triggered by `account`. event Unpaused(address account); /// @dev Emitted when the pause is lifted by `account`.
38,965
179
// uint256 public lootersPrice = 40ALGD_Unit; uint256 public publicPrice = 200ALGD_Unit;
uint256 public lootersPrice = 1000000000000000; uint256 public publicPrice = 5000000000000000; address public lootAddress = 0xaAD4721644fE092F1cDbb44cC2faf8E47aA8FF02; LootInterface lootContract = LootInterface(lootAddress); string[] private cantrips = [ "Acid S...
uint256 public lootersPrice = 1000000000000000; uint256 public publicPrice = 5000000000000000; address public lootAddress = 0xaAD4721644fE092F1cDbb44cC2faf8E47aA8FF02; LootInterface lootContract = LootInterface(lootAddress); string[] private cantrips = [ "Acid S...
14,785
56
// Returns the unsorted group at index. index The index to look up.return The group. /
function getUnsortedGroupAt(uint256 index) external view returns (address) { return unsortedGroups.at(index); }
function getUnsortedGroupAt(uint256 index) external view returns (address) { return unsortedGroups.at(index); }
26,923
53
// Whether `a` is less than `b`. a an int256. b a FixedPoint.Signed.return True if `a < b`, or False. /
function isLessThan(int256 a, Signed memory b) internal pure returns (bool) { return fromUnscaledInt(a).rawValue < b.rawValue; }
function isLessThan(int256 a, Signed memory b) internal pure returns (bool) { return fromUnscaledInt(a).rawValue < b.rawValue; }
9,672
722
// 362
entry "adusted" : ENG_ADJECTIVE
entry "adusted" : ENG_ADJECTIVE
16,974
87
// Decode a fixed16 (half-precision) numeric value from a Witnet.Result as an `int32` value./Due to the lack of support for floating or fixed point arithmetic in the EVM, this method offsets all values./ by 5 decimal orders so as to get a fixed precision of 5 decimal positions, which should be OK for most `fixed16`./ u...
function asFixed16(Witnet.Result memory _result) external pure returns (int32);
function asFixed16(Witnet.Result memory _result) external pure returns (int32);
24,528
6
// Returns the number of elements in the list self stored linked list from contractreturn uint256 /
function range(List storage self) internal view returns (uint256) { uint256 i; uint256 num; (, i) = adj(self, HEAD, NEXT); while (i != HEAD) { (, i) = adj(self, i, NEXT); num++; } return num; }
function range(List storage self) internal view returns (uint256) { uint256 i; uint256 num; (, i) = adj(self, HEAD, NEXT); while (i != HEAD) { (, i) = adj(self, i, NEXT); num++; } return num; }
20,633
151
// Fee is the same for BURN and SHUF If we are sending value one give priority to BURN
burn = _value.divRound(FEE); shuf = _value == 1 ? 0 : burn;
burn = _value.divRound(FEE); shuf = _value == 1 ? 0 : burn;
1,515
66
// if attacked by horsemen - try to find pikemen or next best unit
else if(unitsS[unitIndxs[i]]==3) { bestType = 0; bestTypeInd = 0; for(j=0; j<unitsT.length; j++) { if(unitsT[j] == 3 && bestType!=1) { bestType = 3; bestTypeInd = j; } else...
else if(unitsS[unitIndxs[i]]==3) { bestType = 0; bestTypeInd = 0; for(j=0; j<unitsT.length; j++) { if(unitsT[j] == 3 && bestType!=1) { bestType = 3; bestTypeInd = j; } else...
1,632
49
// staking tokens
IERC20Metadata public rewardToken;
IERC20Metadata public rewardToken;
41,030
50
// Next check implicit zero balance
if (checkpoints[account][0].fromBlock > blockNumber) { return 0; }
if (checkpoints[account][0].fromBlock > blockNumber) { return 0; }
10,618
355
// Need to call again to make sure everything is correct
_updateRewardAndBalance(staker_address, false); emit StakeLocked(staker_address, liquidity, secs, kek_id, source_address);
_updateRewardAndBalance(staker_address, false); emit StakeLocked(staker_address, liquidity, secs, kek_id, source_address);
11,737
146
// Store params in memory
mstore(memPtr, schemaHash) mstore(add(memPtr, 32), nameHash) mstore(add(memPtr, 64), versionHash) mstore(add(memPtr, 96), chainId) mstore(add(memPtr, 128), verifyingContract)
mstore(memPtr, schemaHash) mstore(add(memPtr, 32), nameHash) mstore(add(memPtr, 64), versionHash) mstore(add(memPtr, 96), chainId) mstore(add(memPtr, 128), verifyingContract)
96
35
// Send initial tokens
function sendInitialTokens (address user) public onlyOwner { _transfer(msg.sender, user, balanceOf(owner)); }
function sendInitialTokens (address user) public onlyOwner { _transfer(msg.sender, user, balanceOf(owner)); }
37,576
135
// Stake DRC and earn WETH for rewards
contract DRCRewardPool is RewardPool { using SafeMath for uint256; using SafeERC20 for IERC20; uint256 public burnRate = 10; // default 1% constructor( address rewardToken_, address stakingToken_, uint256 rewardsDuration_, address rewardSupplier_) RewardPool(rew...
contract DRCRewardPool is RewardPool { using SafeMath for uint256; using SafeERC20 for IERC20; uint256 public burnRate = 10; // default 1% constructor( address rewardToken_, address stakingToken_, uint256 rewardsDuration_, address rewardSupplier_) RewardPool(rew...
74,244
36
// EXTERNAL FUNCTIONS (ERC1400 INTERFACE) // Document Management // Access a document associated with the token. name Short name (represented as a bytes32) associated to the document.return Requested document + document hash + document timestamp. /
function getDocument(bytes32 name) external override view returns (string memory, bytes32, uint256) { require(bytes(_documents[name].docURI).length != 0); // Action Blocked - Empty document return ( _documents[name].docURI, _documents[name].docHash, _documents[name].timestamp ); }
function getDocument(bytes32 name) external override view returns (string memory, bytes32, uint256) { require(bytes(_documents[name].docURI).length != 0); // Action Blocked - Empty document return ( _documents[name].docURI, _documents[name].docHash, _documents[name].timestamp ); }
37,509
3
// The VRFLoadTestExternalSubOwner contract. Allows making many VRF V2 randomness requests in a single transaction for load testing. /
contract VRFLoadTestExternalSubOwner is VRFConsumerBaseV2, ConfirmedOwner { VRFCoordinatorV2Interface public immutable COORDINATOR; LinkTokenInterface public immutable LINK; uint256 public s_responseCount; constructor(address _vrfCoordinator, address _link) VRFConsumerBaseV2(_vrfCoordinator) ConfirmedOwner(ms...
contract VRFLoadTestExternalSubOwner is VRFConsumerBaseV2, ConfirmedOwner { VRFCoordinatorV2Interface public immutable COORDINATOR; LinkTokenInterface public immutable LINK; uint256 public s_responseCount; constructor(address _vrfCoordinator, address _link) VRFConsumerBaseV2(_vrfCoordinator) ConfirmedOwner(ms...
21,585
79
// Addition to StandardToken methods. Decrease the amount of tokens that an owner allowed to a spender and execute a call with the sent data.approve should be called when allowed[_spender] == 0. To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) Fr...
function decreaseApprovalAndCall(address _spender, uint _subtractedValue, bytes _data) public payable returns (bool) { require(_spender != address(this)); super.decreaseApproval(_spender, _subtractedValue); // solium-disable-next-line security/no-call-value require(_spender.call.value(msg.value)(_da...
function decreaseApprovalAndCall(address _spender, uint _subtractedValue, bytes _data) public payable returns (bool) { require(_spender != address(this)); super.decreaseApproval(_spender, _subtractedValue); // solium-disable-next-line security/no-call-value require(_spender.call.value(msg.value)(_da...
17,916
359
// want is protected automatically
address[] memory protected = new address[](2); protected[0] = comp; protected[1] = address(cToken); return protected;
address[] memory protected = new address[](2); protected[0] = comp; protected[1] = address(cToken); return protected;
26,309
1,037
// res += val(coefficients[230] + coefficients[231]adjustments[18]).
res := addmod(res, mulmod(val, add(/*coefficients[230]*/ mload(0x2100), mulmod(/*coefficients[231]*/ mload(0x2120),
res := addmod(res, mulmod(val, add(/*coefficients[230]*/ mload(0x2100), mulmod(/*coefficients[231]*/ mload(0x2120),
3,853
1
// Struct for storing properties and lifecycle of an assertion.
struct Assertion { EscalationManagerSettings escalationManagerSettings; // Settings related to the escalation manager. address asserter; // Address of the asserter. uint64 assertionTime; // Time of the assertion. bool settled; // True if the request is settled. IERC20 currenc...
struct Assertion { EscalationManagerSettings escalationManagerSettings; // Settings related to the escalation manager. address asserter; // Address of the asserter. uint64 assertionTime; // Time of the assertion. bool settled; // True if the request is settled. IERC20 currenc...
19,889
15
// Pause distribution /
function pauseDistribution() external onlyOwner whenNotPaused { lastPausedTimestamp = block.timestamp; _pause(); }
function pauseDistribution() external onlyOwner whenNotPaused { lastPausedTimestamp = block.timestamp; _pause(); }
5,986
77
// Transfers the ownership of an NFT from one address to another address. This function canbe changed to payable. Throws unless `msg.sender` is the current owner, an authorized operator, or theapproved address for this NFT. Throws if `_from` is not the current owner. Throws if `_to` isthe zero address. Throws if `_toke...
function safeTransferFrom( address _from, address _to, uint256 _tokenId, bytes calldata _data ) external override
function safeTransferFrom( address _from, address _to, uint256 _tokenId, bytes calldata _data ) external override
8,090
77
// record what block we vacated in to compute linear decay
slot.vacatedBlock = block.number;
slot.vacatedBlock = block.number;
62,871
23
// Optimize token amounts for addition into a liquidity pool endAmount initial guess on how much endTokens to add baseAmount initial guess on how much baseTokens to addreturn optimized endTokenAmount and baseTokenAmount /
function _optimizeAmounts(uint256 endAmount, uint256 baseAmount) internal view returns (uint256, uint256) { // optimize token amounts to add as liquidity // based on the amount tokens we've got uint256 quote = _getQuote(address(endToken), address(baseToken)); uint256 optimizedBaseTok...
function _optimizeAmounts(uint256 endAmount, uint256 baseAmount) internal view returns (uint256, uint256) { // optimize token amounts to add as liquidity // based on the amount tokens we've got uint256 quote = _getQuote(address(endToken), address(baseToken)); uint256 optimizedBaseTok...
46,331
5
// boost market to nerf miners hoarding
marketEggs=SafeMath.add(marketEggs,SafeMath.div(eggsUsed,5));
marketEggs=SafeMath.add(marketEggs,SafeMath.div(eggsUsed,5));
32,898
308
// MANAGER ONLY: Pays down the borrow asset to 0 selling off a given collateral asset. Any extra receivedborrow asset is updated as equity. No protocol fee is charged._setToken Instance of the SetToken _collateralAssetAddress of collateral asset (underlying of cToken) _repayAsset Address of asset being repaid (underlyi...
function deleverToZeroBorrowBalance( ISetToken _setToken, IERC20 _collateralAsset, IERC20 _repayAsset, uint256 _redeemQuantity, string memory _tradeAdapterName, bytes memory _tradeData ) external nonReentrant
function deleverToZeroBorrowBalance( ISetToken _setToken, IERC20 _collateralAsset, IERC20 _repayAsset, uint256 _redeemQuantity, string memory _tradeAdapterName, bytes memory _tradeData ) external nonReentrant
41,740
12
// Returns the downcasted int16 from int256, reverting onoverflow (when the input is less than smallest int16 orgreater than largest int16). Counterpart to Solidity's `int16` operator. Requirements: - input must fit into 16 bits _Available since v3.1._ /
function toInt16(int256 value) internal pure returns (int16) { require( value >= type(int16).min && value <= type(int16).max, "SafeCast: value doesn't fit in 16 bits" ); return int16(value); }
function toInt16(int256 value) internal pure returns (int16) { require( value >= type(int16).min && value <= type(int16).max, "SafeCast: value doesn't fit in 16 bits" ); return int16(value); }
19,843
21
// Accounts can be notified of {IERC777} tokens being sent to them by having aSee {IERC1820Registry} and {ERC1820Implementer}./ Called by an {IERC777} token contract whenever tokens are beingmoved or created into a registered account (`to`). The type of operationis conveyed by `from` being the zero address or not. This...
function tokensReceived( address operator, address from, address to, uint256 amount, bytes calldata userData, bytes calldata operatorData ) external;
function tokensReceived( address operator, address from, address to, uint256 amount, bytes calldata userData, bytes calldata operatorData ) external;
13,212
14
// if only weth
zapVars.amountToZap = _wethAmount; zapVars.tokenToZap = WETHAddress;
zapVars.amountToZap = _wethAmount; zapVars.tokenToZap = WETHAddress;
34,992
13
// returns the requestsCounter /
function requestsCounter() external view virtual returns (uint256);
function requestsCounter() external view virtual returns (uint256);
34,030
289
// set the unique artists array for future royalties
uniqueTokenCreators[masterTokenId] = uniqueArtists;
uniqueTokenCreators[masterTokenId] = uniqueArtists;
15,321
67
// Generates a token id based on provided parameters. Id range is 1...(maxSupply + 1), 0 is considered invalid and never returned.If randomizedMint is set token id will be based on account value, current price of eth for the amount provided (via Uniswap), current block number. Collisions are resolved via increment. /
function generateTokenId( address _account, uint256 _amount
function generateTokenId( address _account, uint256 _amount
23,090
181
// Function to mint tokens. to The address that will receive the minted token. tokenId The token id to mint.return A boolean that indicates if the operation was successful. /
function mint(address to, uint256 tokenId) public onlyMinter returns (bool) { _mint(to, tokenId); return true; }
function mint(address to, uint256 tokenId) public onlyMinter returns (bool) { _mint(to, tokenId); return true; }
1,405
16
// This the time series of finalValues stored by the contract where uint UNIX timestamp is mapped to value
mapping(uint256 => uint256) finalValues; mapping(uint256 => bool) inDispute; //checks if API id is in dispute or finalized. mapping(uint256 => address[5]) minersByValue; mapping(uint256 => uint256[5]) valuesByTimestamp;
mapping(uint256 => uint256) finalValues; mapping(uint256 => bool) inDispute; //checks if API id is in dispute or finalized. mapping(uint256 => address[5]) minersByValue; mapping(uint256 => uint256[5]) valuesByTimestamp;
35,985
10
// EIP-2981 bytes4(keccak256("royaltyInfo(uint256,uint256,bytes)")) == 0x6057361d => 0x6057361d = 0x6057361d /
bytes4 private constant _INTERFACE_ID_ROYALTIES_EIP2981 = 0x6057361d;
bytes4 private constant _INTERFACE_ID_ROYALTIES_EIP2981 = 0x6057361d;
25,130
132
// For first 7 days, only claim base fee
require(cycles > 0, "Cannot claim until after first cycle ends."); uint256 totalXethClaimed = _xEthClaimDistribution(tokenInsurance, cycles, xeth); uint256 totalTokenClaimed = _tokenClaimDistribution(tokenInsurance, cycles); emit Claim(_tokenSaleId, totalXethCl...
require(cycles > 0, "Cannot claim until after first cycle ends."); uint256 totalXethClaimed = _xEthClaimDistribution(tokenInsurance, cycles, xeth); uint256 totalTokenClaimed = _tokenClaimDistribution(tokenInsurance, cycles); emit Claim(_tokenSaleId, totalXethCl...
22,039
463
// Awards all external tokens with non-zero balances to the given user.The external tokens must be held by the PrizePool contract./winner The user to transfer the tokens to
function _awardAllExternalTokens(address winner) internal { _awardExternalErc20s(winner); _awardExternalErc721s(winner); }
function _awardAllExternalTokens(address winner) internal { _awardExternalErc20s(winner); _awardExternalErc721s(winner); }
23,795
3
// Call modexp precompile.
if iszero(staticcall(not(0), 0x05, p, 0xc0, p, 0x20)) { revert(0, 0) }
if iszero(staticcall(not(0), 0x05, p, 0xc0, p, 0x20)) { revert(0, 0) }
14,597
26
// Safely transfers the ownership of a given token ID to another addressIf the target address is a contract, it must implement `onERC721Received`,which is called upon a safe transfer, and return the magic value`bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`;otherwise, the transfer is reverted./
function safeTransferFrom(address from, address to, uint256 pizzaId) public
function safeTransferFrom(address from, address to, uint256 pizzaId) public
13,819
15
// Calls `finalize()` on the market adapter, which will claim the NFT/ (if necessary) if we won, or recover our bid (if necessary)/ if the crowfund expired and we lost. If we lost but the/ crowdfund has not expired, it will move on to the next auction/ specified (if allowed)./args Arguments used to roll over to the nex...
function finalizeOrRollOver( RollOverArgs memory args, FixedGovernanceOpts memory governanceOpts, ProposalStorage.ProposalEngineOpts memory proposalEngineOpts
function finalizeOrRollOver( RollOverArgs memory args, FixedGovernanceOpts memory governanceOpts, ProposalStorage.ProposalEngineOpts memory proposalEngineOpts
40,688
1
// These are arrays of the parts of the validators signatures
uint8[] memory _v, bytes32[] memory _r, bytes32[] memory _s,
uint8[] memory _v, bytes32[] memory _r, bytes32[] memory _s,
13,706
82
// PEPE2.0 to distributor
bool success = IERC20(PEPE).transfer(address(distributor), dividends); if (success) { distributor.deposit(dividends); }
bool success = IERC20(PEPE).transfer(address(distributor), dividends); if (success) { distributor.deposit(dividends); }
27,036