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
4
// Returns the address to approve source tokens to for trading. This is the Uniswap router address return address Address of the contract to approve tokens to /
function getSpender() external view returns (address)
function getSpender() external view returns (address)
36,702
97
// If there are funds leftover, mint the best available with it.
if (_leftoverAmount != 0) { _leftoverAmount = _mintBestAvailableTier( _leftoverAmount, _data.beneficiary, _expectMintFromExtraFunds ); if (_leftoverAmount != 0) {
if (_leftoverAmount != 0) { _leftoverAmount = _mintBestAvailableTier( _leftoverAmount, _data.beneficiary, _expectMintFromExtraFunds ); if (_leftoverAmount != 0) {
40,549
13
// create auction struct
Auction memory auction = Auction( _id, uint128(_price), uint64(_duration), uint64(_startTime), _seller );
Auction memory auction = Auction( _id, uint128(_price), uint64(_duration), uint64(_startTime), _seller );
30,838
35
// Whitelisted/STOKR
contract Whitelisted is Ownable { Whitelist public whitelist; /// @dev Log entry on change of whitelist contract instance /// @param previous Ethereum address of previous whitelist /// @param current Ethereum address of new whitelist event WhitelistChange(address indexed previous, address inde...
contract Whitelisted is Ownable { Whitelist public whitelist; /// @dev Log entry on change of whitelist contract instance /// @param previous Ethereum address of previous whitelist /// @param current Ethereum address of new whitelist event WhitelistChange(address indexed previous, address inde...
20,072
122
// Function to mint tokens to The address that will receive the minted tokens. amount The amount of tokens to mint.return A boolean that indicates if the operation was successful. /
function mint( address to, uint256 amount ) public onlyMinter onlyBeforeMintingFinished returns (bool)
function mint( address to, uint256 amount ) public onlyMinter onlyBeforeMintingFinished returns (bool)
36,242
170
// Ensures the input address is the interest model contract.
require( _newInterestRateModel.isInterestRateModel(), "_setInterestRateModel: This is not the rate model contract!" );
require( _newInterestRateModel.isInterestRateModel(), "_setInterestRateModel: This is not the rate model contract!" );
80,136
533
// called by the owner to remove and add new oracles as well asupdate the round related parameters that pertain to total oracle count _removed is the list of addresses for the new Oracles being removed _added is the list of addresses for the new Oracles being added _addedAdmins is the admin addresses for the new respec...
function changeOracles( address[] calldata _removed, address[] calldata _added, address[] calldata _addedAdmins, uint32 _minSubmissions, uint32 _maxSubmissions, uint32 _restartDelay
function changeOracles( address[] calldata _removed, address[] calldata _added, address[] calldata _addedAdmins, uint32 _minSubmissions, uint32 _maxSubmissions, uint32 _restartDelay
13,279
261
// Transfer rewards to this strategy
function updateReward() public onlyOwner { harvestRewardPool.getReward(); }
function updateReward() public onlyOwner { harvestRewardPool.getReward(); }
14,500
20
// Appends a byte to the end of the buffer. Resizes if doing so wouldexceed the capacity of the buffer. buf The buffer to append to. data The data to append.return The original buffer. /
function append(buffer memory buf, uint8 data) internal pure { if(buf.buf.length + 1 > buf.capacity) { resize(buf, buf.capacity * 2); } assembly { // Memory address of the buffer data let bufptr := mload(buf) // Length of existing buffer data ...
function append(buffer memory buf, uint8 data) internal pure { if(buf.buf.length + 1 > buf.capacity) { resize(buf, buf.capacity * 2); } assembly { // Memory address of the buffer data let bufptr := mload(buf) // Length of existing buffer data ...
20,780
15
// calculate token amount to be created
tokens = weiAmount.mul(rate);
tokens = weiAmount.mul(rate);
2,070
9
// getValidatorID represents the relation between a Validator address and the ID of the Validator.
mapping(address => uint256) public getValidatorID;
mapping(address => uint256) public getValidatorID;
24,953
39
// Get this deposit's lot size in TBTC./This is the same as lotSizeSatoshis(), but is multiplied to scale/to 18 decimal places./ return uint256 lot size in TBTC precision (max 18 decimal places).
function lotSizeTbtc() external view returns (uint256){ return self.lotSizeTbtc(); }
function lotSizeTbtc() external view returns (uint256){ return self.lotSizeTbtc(); }
31,510
2
// Sales mapping | tokenId: Sale
mapping(uint => Models.Sale) public sales;
mapping(uint => Models.Sale) public sales;
6,636
114
// SONE tokens created per block.
uint256 public REWARD_PER_BLOCK;
uint256 public REWARD_PER_BLOCK;
65,117
14
// Fire the cross chain event denoting there is a cross chain request from Ethereum network to other public chains through linq network network
emit CrossChainEvent(tx.origin, paramTxHash, msg.sender, toChainId, toContract, rawParam); return true;
emit CrossChainEvent(tx.origin, paramTxHash, msg.sender, toChainId, toContract, rawParam); return true;
16,249
132
// DODOIncentive DODO BreederTrade Incentive in DODO platform /
contract DODOIncentive is InitializableOwnable { using SafeMath for uint256; using SafeERC20 for IERC20; // ============ Storage ============ address public immutable _DODO_TOKEN_; address public _DODO_PROXY_; uint256 public dodoPerBlock; uint256 public defaultRate = 10; mapping(address...
contract DODOIncentive is InitializableOwnable { using SafeMath for uint256; using SafeERC20 for IERC20; // ============ Storage ============ address public immutable _DODO_TOKEN_; address public _DODO_PROXY_; uint256 public dodoPerBlock; uint256 public defaultRate = 10; mapping(address...
33,569
109
// returns the day number of the current day, in days since the UNIX epoch. /
function today() public view override returns (uint32) { return uint32(block.timestamp / SECONDS_PER_DAY); }
function today() public view override returns (uint32) { return uint32(block.timestamp / SECONDS_PER_DAY); }
26,811
40
// Sets the address and basis points for royalties.newInfo The struct to configure royalties. /
function setRoyaltyInfo(RoyaltyInfo calldata newInfo) external { // Ensure the sender is only the owner or contract itself. _onlyOwnerOrSelf(); // Revert if the new royalty address is the zero address. if (newInfo.royaltyAddress == address(0)) { revert RoyaltyAddressCann...
function setRoyaltyInfo(RoyaltyInfo calldata newInfo) external { // Ensure the sender is only the owner or contract itself. _onlyOwnerOrSelf(); // Revert if the new royalty address is the zero address. if (newInfo.royaltyAddress == address(0)) { revert RoyaltyAddressCann...
20,320
16
// Returns the total of rewards of an user, already accrued + not yet accrued user The address of the userreturn The rewards // Claims reward for an user, on all the assets of the lending pool, accumulating the pending rewards amount Amount of rewards to claim to Address that will be receiving the rewardsreturn Rewards...
function getUserUnclaimedRewards(address user) external view returns (uint256);
function getUserUnclaimedRewards(address user) external view returns (uint256);
50,889
336
// The proportion of interest accrued that is taken as a service fee (scaled by 1e18). /
uint256 private _interestFeeRate;
uint256 private _interestFeeRate;
35,842
28
// Returns product if no overflow occurred/a First factor/b Second factor/ return Product
function mul(uint a, uint b) internal pure returns (uint) { require(safeToMul(a, b)); return a * b; }
function mul(uint a, uint b) internal pure returns (uint) { require(safeToMul(a, b)); return a * b; }
45,675
4
// we have read readUntil bytes and add 1 more to skip the zero byte at the beginning of every 32 bytes
index += bytesToRead + 1;
index += bytesToRead + 1;
1,834
119
// zero out keys if the accumulated profit doubled
function checkDoubledProfit(uint256 _pID, uint256 _rID) private
function checkDoubledProfit(uint256 _pID, uint256 _rID) private
30,503
2
// The topic has expired, was not automatically renewed, and is in a 7 day grace period before the topic will be deleted unrecoverably. This error response code will not be returned until autoRenew functionality is supported by HAPI.
int32 internal constant TOPIC_EXPIRED = 162; int32 internal constant INVALID_CHUNK_NUMBER = 163; // chunk number must be from 1 to total (chunks) inclusive. int32 internal constant INVALID_CHUNK_TRANSACTION_ID = 164; // For every chunk, the payer account that is part of initialTransactionID must match the P...
int32 internal constant TOPIC_EXPIRED = 162; int32 internal constant INVALID_CHUNK_NUMBER = 163; // chunk number must be from 1 to total (chunks) inclusive. int32 internal constant INVALID_CHUNK_TRANSACTION_ID = 164; // For every chunk, the payer account that is part of initialTransactionID must match the P...
15,710
62
// Valid MD5 token
realWorldPlayers[_rosterIndex].metadata = _metadata;
realWorldPlayers[_rosterIndex].metadata = _metadata;
41,511
6
// Information about the rest of the supply Total that have been minted
uint256 totalMinted;
uint256 totalMinted;
1,419
12
// All funding phases information to their position in mapping
mapping(uint256 => FundPhase) internal fundingPhases_;
mapping(uint256 => FundPhase) internal fundingPhases_;
25,861
23
// Cut owner takes on each auction, measured in basis points (1/100 of a percent). Values 0-10,000 map to 0%-100%
uint256 public ownerCut;
uint256 public ownerCut;
1,668
12
// Farmer doesn't approve the order /
function notApprove() public onlyFarmer inState(State.Ordered)
function notApprove() public onlyFarmer inState(State.Ordered)
15,195
308
// we have a non number
if (_hasNonNumber == false) _hasNonNumber = true;
if (_hasNonNumber == false) _hasNonNumber = true;
21,219
5
// Removes the operator right from the _operator address_operator the address of the operator to remove/
function removeOperator(address _operator) public onlyOwner
function removeOperator(address _operator) public onlyOwner
25,038
0
// solhint-disable func-name-mixedcase
function OverspentEthError( uint256 ethSpent, uint256 ethAvailable ) internal pure returns (bytes memory)
function OverspentEthError( uint256 ethSpent, uint256 ethAvailable ) internal pure returns (bytes memory)
688
68
// setMinMax function to set the minimum or maximum investment amount/
function setMinMax (uint256 minMax, string eventType) public onlyOwner { require(minMax >= 0); // Set new maxAmmount if(compareStrings(eventType, "max")) maxAmmount = minMax; // Set new min to Contribute else if(compareStrings(eventType,"min")) minCont...
function setMinMax (uint256 minMax, string eventType) public onlyOwner { require(minMax >= 0); // Set new maxAmmount if(compareStrings(eventType, "max")) maxAmmount = minMax; // Set new min to Contribute else if(compareStrings(eventType,"min")) minCont...
37,625
59
// send excess amount back to sender
payable(msg.sender).transfer(msg.value - totalPrice);
payable(msg.sender).transfer(msg.value - totalPrice);
45,069
7
// state sender contract
IFxStateSender public fxRoot;
IFxStateSender public fxRoot;
24,729
66
// A mapping of handler addresses for lookups
mapping(address => bool) public handlerMap;
mapping(address => bool) public handlerMap;
44,409
2
// Tokens per wallet declaration
mapping(address => uint) public tokensPerWallet; // to limit max mint per wallet
mapping(address => uint) public tokensPerWallet; // to limit max mint per wallet
1,347
26
// Initialization function for upgradable proxy contracts _nexus Nexus contract address /
function _initialize(address _nexus) internal { require(_nexus != address(0), "Nexus address is zero"); nexus = INexus(_nexus); InitializableModuleKeys._initialize(); }
function _initialize(address _nexus) internal { require(_nexus != address(0), "Nexus address is zero"); nexus = INexus(_nexus); InitializableModuleKeys._initialize(); }
3,220
50
// tokensLeft is equal to amount at the beginning
tokens[1] = _data[0]; _src = wethToKyberEth(_src); _dest = wethToKyberEth(_dest);
tokens[1] = _data[0]; _src = wethToKyberEth(_src); _dest = wethToKyberEth(_dest);
84,880
2
// Struct to represent amount of vested tokens claimable for a vesting schedule scheduleID ID of vesting schedule claimableTokens number of vesting tokens claimable as of the current time /
struct ClaimableInfo { uint256 scheduleID; uint256 claimableTokens; }
struct ClaimableInfo { uint256 scheduleID; uint256 claimableTokens; }
39,518
27
// Internal function to approve tokens for the user /
function _approve( address owner, address spender, uint256 amount
function _approve( address owner, address spender, uint256 amount
31,256
54
// Calculate the reward amount for the current window - Need to consider pendingForApprovalAmount for Auto Approvals
totalAmount = stakeInfo.approvedAmount.add(stakeInfo.pendingForApprovalAmount); rewardAmount = _calculateRewardAmount(stakeMapIndex, totalAmount); totalAmount = totalAmount.add(rewardAmount);
totalAmount = stakeInfo.approvedAmount.add(stakeInfo.pendingForApprovalAmount); rewardAmount = _calculateRewardAmount(stakeMapIndex, totalAmount); totalAmount = totalAmount.add(rewardAmount);
10,633
62
// Verify caller is a valid vault contact Only callable from onlyVault modifier. Requirements: - msg.sender is contained in validVault address mapping /
function _onlyVault() private view { require( validVault[msg.sender], "Controller::_onlyVault: Can only be invoked by vault" ); }
function _onlyVault() private view { require( validVault[msg.sender], "Controller::_onlyVault: Can only be invoked by vault" ); }
48,023
40
// Clears the committee members vote-unready state upon declaring a guardian unready/committee is a list of the current committee members/subject is the subject guardian address
function clearCommitteeUnreadyVotes(address[] memory committee, address subject) private { for (uint i = 0; i < committee.length; i++) { voteUnreadyVotes[committee[i]][subject] = 0; // clear vote-outs } }
function clearCommitteeUnreadyVotes(address[] memory committee, address subject) private { for (uint i = 0; i < committee.length; i++) { voteUnreadyVotes[committee[i]][subject] = 0; // clear vote-outs } }
37,988
91
// Lower prodBoost of old tadpole owner
prodBoost[currentTadpoleOwner] = prodBoost[currentTadpoleOwner].sub(1);
prodBoost[currentTadpoleOwner] = prodBoost[currentTadpoleOwner].sub(1);
43,166
15
// Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings. /
function isApprovedForAll(address owner, address operator) public view override(IERC721, ERC721) returns (bool) { // Whitelist OpenSea proxy contract for easy trading. if (proxyRegistry.proxies(owner) == operator) { return true; } return super.isApprovedForAll(owner, oper...
function isApprovedForAll(address owner, address operator) public view override(IERC721, ERC721) returns (bool) { // Whitelist OpenSea proxy contract for easy trading. if (proxyRegistry.proxies(owner) == operator) { return true; } return super.isApprovedForAll(owner, oper...
50,423
71
// send fees if threshold has been reacheddon't do this on buys, breaks swap
if (providingLiquidity && sender != pair && feeswap > 0) handle_fees(feeswap, currentTaxes);
if (providingLiquidity && sender != pair && feeswap > 0) handle_fees(feeswap, currentTaxes);
30,200
2
// Adds a Metaverse to LandWorks./Sets the metaverse registries as consumable adapters./_metaverseId The id of the metaverse/_name Name of the metaverse/_metaverseRegistries A list of metaverse registries, that will be/ associated with the given metaverse id./_administrativeConsumers A list of administrative consumers,...
function addMetaverseWithoutAdapters( uint256 _metaverseId, string calldata _name, address[] calldata _metaverseRegistries, address[] calldata _administrativeConsumers
function addMetaverseWithoutAdapters( uint256 _metaverseId, string calldata _name, address[] calldata _metaverseRegistries, address[] calldata _administrativeConsumers
35,195
46
// check if there is actually enough funds
require((internalBalance >= _amount) && (getTokenBalance() >= _amount));
require((internalBalance >= _amount) && (getTokenBalance() >= _amount));
10,713
26
// List of revert message codes. Implementing dApp should handle showing the correct message.Based on 0xcert framework error codes. /
string constant ZERO_ADDRESS = "003001"; string constant NOT_VALID_NFT = "003002"; string constant NOT_OWNER_OR_OPERATOR = "003003"; string constant NOT_OWNER_APPROVED_OR_OPERATOR = "003004"; string constant NOT_ABLE_TO_RECEIVE_NFT = "003005"; string constant NFT_ALREADY_EXISTS = "003006"; string constant...
string constant ZERO_ADDRESS = "003001"; string constant NOT_VALID_NFT = "003002"; string constant NOT_OWNER_OR_OPERATOR = "003003"; string constant NOT_OWNER_APPROVED_OR_OPERATOR = "003004"; string constant NOT_ABLE_TO_RECEIVE_NFT = "003005"; string constant NFT_ALREADY_EXISTS = "003006"; string constant...
23,220
7
// gameRegistry(gameRegistryAddress).getWinners(_gameId);
for (uint8 i = 0; i < _competitorsLimit; i++) { for (uint8 j = 0; j < _winnersLength; j++) { if (i != _winners[j]) { amount += totalBidAmount[_gameId][i]; }
for (uint8 i = 0; i < _competitorsLimit; i++) { for (uint8 j = 0; j < _winnersLength; j++) { if (i != _winners[j]) { amount += totalBidAmount[_gameId][i]; }
36,534
64
// Modifier, which only allows server to call function.
modifier onlyServer() { require(msg.sender == serverAddress); _; }
modifier onlyServer() { require(msg.sender == serverAddress); _; }
50,191
2
// accept transfer of contract ownership /
function _acceptOwnership() internal virtual { _setOwner(msg.sender); delete SafeOwnableStorage.layout().nomineeOwner; }
function _acceptOwnership() internal virtual { _setOwner(msg.sender); delete SafeOwnableStorage.layout().nomineeOwner; }
22,904
6
// ========== VIEW FUNCTIONS ========== / budget
function getReserve() public view returns (uint256) { return accumulatedSeigniorage; }
function getReserve() public view returns (uint256) { return accumulatedSeigniorage; }
38,515
10
// The current cycle payout percentage to the darknodes.
uint256 public currentCyclePayoutPercent;
uint256 public currentCyclePayoutPercent;
12,241
22
// Incoming transfer from the Presale token buyer
function() payable { uint tokenAmount; // Amount of tzokens which is possible to buy for incoming transfer/payment uint amountToBePaid; // Amount to be paid uint amountTransfered = msg.value; // Cost/price in WEI of incoming transfer/payment if (amountTransfered <= 0) { Error('no eth was transfered'...
function() payable { uint tokenAmount; // Amount of tzokens which is possible to buy for incoming transfer/payment uint amountToBePaid; // Amount to be paid uint amountTransfered = msg.value; // Cost/price in WEI of incoming transfer/payment if (amountTransfered <= 0) { Error('no eth was transfered'...
51,521
12
// Initialize header start index
bytes32 digest; totalDifficulty = 0; for (uint256 start = 0; start < headers.length; start += 80) {
bytes32 digest; totalDifficulty = 0; for (uint256 start = 0; start < headers.length; start += 80) {
11,269
13
// Perfomr all necessary steps for the transition
tellor.uintVars[keccak256("currentReward")] = 1e18; tellor.uintVars[keccak256("stakeAmount")] = 500e18; tellor.uintVars[keccak256("disputeFee")] = 500e18;
tellor.uintVars[keccak256("currentReward")] = 1e18; tellor.uintVars[keccak256("stakeAmount")] = 500e18; tellor.uintVars[keccak256("disputeFee")] = 500e18;
61,801
22
// Returns true if the peer is whitelisted, otherwise false. /
function peerWhitelisted(address _peer) override view external returns(bool){ return _peer == exhibition && exhibition != address(0); }
function peerWhitelisted(address _peer) override view external returns(bool){ return _peer == exhibition && exhibition != address(0); }
18,595
155
// required for weth.withdraw() to work properly
require(msg.sender == WETH, "ExchangeIssuance: Direct deposits not allowed");
require(msg.sender == WETH, "ExchangeIssuance: Direct deposits not allowed");
30,688
83
// COLOR tokens created per block.
uint256 public colorPerBlock = 167700000000000000;
uint256 public colorPerBlock = 167700000000000000;
5,208
1,189
// Contract initializer. logic address of the initial implementation. admin Address of the proxy administrator. data Data to send as msg.data to the implementation to initialize the proxied contract.It should include the signature and the parameters of the function to be called, as described inThis parameter is optiona...
function initialize( address logic, address admin, bytes memory data
function initialize( address logic, address admin, bytes memory data
15,524
0
// Emitted when ERC20 token is recovered
event Recovered(address indexed token, uint256 amount);
event Recovered(address indexed token, uint256 amount);
25,351
267
// must have ten of external account
return getExternalAccountBalance() > 9;
return getExternalAccountBalance() > 9;
40,956
92
// Interface marker /
function isUpgradeAgent() public constant returns (bool) { return true; }
function isUpgradeAgent() public constant returns (bool) { return true; }
27,607
105
// IPriceOracleGetter interface Interface for the Aave price oracle. /
interface IPriceOracleGetter { /** * @dev returns the asset price in ETH * @param asset the address of the asset * @return the ETH price of the asset **/ function getAssetPrice(address asset) external view returns (uint256); }
interface IPriceOracleGetter { /** * @dev returns the asset price in ETH * @param asset the address of the asset * @return the ETH price of the asset **/ function getAssetPrice(address asset) external view returns (uint256); }
60,605
114
// No referrer
require(amount >= registrationFeeWithoutReferrer, "Must send at least enough LID to pay registration fee."); distribute(registrationFeeWithoutReferrer); finalAmount = amount.sub(registrationFeeWithoutReferrer);
require(amount >= registrationFeeWithoutReferrer, "Must send at least enough LID to pay registration fee."); distribute(registrationFeeWithoutReferrer); finalAmount = amount.sub(registrationFeeWithoutReferrer);
39,988
29
// The provided address should be valid.
require(_feeAccount != 0x0);
require(_feeAccount != 0x0);
34,360
602
// We've already checked the remaining budget with `_canMakePayment()`
_unsafeMakePaymentTransaction( payment.token, payment.receiver, payment.amount, _paymentId, payment.executions, "" );
_unsafeMakePaymentTransaction( payment.token, payment.receiver, payment.amount, _paymentId, payment.executions, "" );
26,772
40
// add vested BZRX to rewards balance
rewardsVested = vBZRXBalance .mul(multiplier) .div(1e36); bzrxRewardsEarned += rewardsVested;
rewardsVested = vBZRXBalance .mul(multiplier) .div(1e36); bzrxRewardsEarned += rewardsVested;
44,788
99
// Payable function to purchase cnix with eth at current crowdsale price
function buyCnix() public payable returns (bool) { address client = msg.sender; uint256 cnixToSend = msg.value * ethToCnix; forwardAddress.transfer(msg.value); car.mint(client, cnixToSend); return true; }
function buyCnix() public payable returns (bool) { address client = msg.sender; uint256 cnixToSend = msg.value * ethToCnix; forwardAddress.transfer(msg.value); car.mint(client, cnixToSend); return true; }
23,742
65
// Checks that a given channel is in the Challenge mode. Checks that a given channel is in the Challenge mode. channelId Unique identifier for a channel. /
function _requireOngoingChallenge(bytes32 channelId) internal view { require(_mode(channelId) == ChannelMode.Challenge, 'No ongoing challenge.'); }
function _requireOngoingChallenge(bytes32 channelId) internal view { require(_mode(channelId) == ChannelMode.Challenge, 'No ongoing challenge.'); }
4,141
173
// Aludel/Reward distribution contract with time multiplier/ Access Control/ - Power controller:/ Can power off / shutdown the Aludel/ Can withdraw rewards from reward pool once shutdown/ - Aludel admin:/ Can add funds to the Aludel, register bonus tokens, and whitelist new vault factories/ Is a subset of proxy owner p...
contract Aludel is IAludel, Powered, Ownable { using SafeMath for uint256; using EnumerableSet for EnumerableSet.AddressSet; /* constants */ // An upper bound on the number of active stakes per vault is required to prevent // calls to rageQuit() from reverting. // With 30 stakes in a vault, ra...
contract Aludel is IAludel, Powered, Ownable { using SafeMath for uint256; using EnumerableSet for EnumerableSet.AddressSet; /* constants */ // An upper bound on the number of active stakes per vault is required to prevent // calls to rageQuit() from reverting. // With 30 stakes in a vault, ra...
6,107
122
// Sets the maximum bet _max_bet the new maximum bet /
function setMaxBet(uint256 _max_bet) external onlyOwner { max_bet = _max_bet; }
function setMaxBet(uint256 _max_bet) external onlyOwner { max_bet = _max_bet; }
5,868
99
// the user balance to work with (share asset) from the user's balance index
UserBalance storage ub = us.userBalances[balanceIndex];
UserBalance storage ub = us.userBalances[balanceIndex];
21,892
50
// Whitelist Spotter to read the Osm data (only necessary if it is the first time the token is being added to an ilk) !!!!!!!! Only if PIP_BAL = Osm or PIP_BAL = Median and hasn't been already whitelisted due a previous deployed ilk
OsmAbstract(PIP_BAL).kiss(MCD_SPOT);
OsmAbstract(PIP_BAL).kiss(MCD_SPOT);
31,767
528
// solium-disable function-order Below, a few functions must be public to allow bytes memory parameters, but their being so triggers errors because public functions should be grouped below external functions. Since these would be external if it were possible, we ignore the issue.
contract DepositLog {
contract DepositLog {
31,736
28
// Ensure executed price is not lower than the order price: executedSellAmount / executedBuyAmount <= order.priceDenominator / order.priceNumerator
require( executedSellAmount.mul(order.priceNumerator) <= executedBuyAmount.mul(order.priceDenominator), "limit price not satisfied" );
require( executedSellAmount.mul(order.priceNumerator) <= executedBuyAmount.mul(order.priceDenominator), "limit price not satisfied" );
19,772
338
// Overflows are incredibly unrealistic. balance or numberMinted overflow if current value of either + quantity > 1.8e19 (264) - 1 _totalMinted overflows if _totalMinted + amount > 1.2e77 (2256) - 1
unchecked { _incrementAddressMintCounter(buyer, amount); _totalMinted += uint64(amount); }
unchecked { _incrementAddressMintCounter(buyer, amount); _totalMinted += uint64(amount); }
19,227
83
// Allow any customer who hold tokens to claim BTC tokenAmount Amount of tokens to be exchanged (needs to be multiplied by 10^18) userBtcAddress BTC address on which users willing to receive payment/!\ gas cost for calling this method : 37kgas /!\ /
function claimBTC(uint256 tokenAmount, string memory userBtcAddress) public virtual returns (bool) { _transfer(_msgSender(), owner(), tokenAmount); emit BtcToBePaid(_msgSender(), userBtcAddress, tokenAmount); return true; }
function claimBTC(uint256 tokenAmount, string memory userBtcAddress) public virtual returns (bool) { _transfer(_msgSender(), owner(), tokenAmount); emit BtcToBePaid(_msgSender(), userBtcAddress, tokenAmount); return true; }
84,153
195
// Redeem bonds. Parameters ---------------- |redemption_epochs|: An array of bonds to be redeemed. The bonds are identified by their redemption epochs. Returns ---------------- The number of successfully redeemed bonds.
function redeemBonds(uint[] memory redemption_epochs)
function redeemBonds(uint[] memory redemption_epochs)
13,896
203
// Calculate value for ERC20
address[] memory fromAddresses = new address[](tokenAddresses.length - 1); // Sub ETH uint256[] memory amounts = new uint256[](tokenAddresses.length - 1); uint index = 0; for (uint256 i = 1; i < tokenAddresses.length; i++) { fromAddresses[index] = tokenAddresses[i]; amounts[index] = IERC20(...
address[] memory fromAddresses = new address[](tokenAddresses.length - 1); // Sub ETH uint256[] memory amounts = new uint256[](tokenAddresses.length - 1); uint index = 0; for (uint256 i = 1; i < tokenAddresses.length; i++) { fromAddresses[index] = tokenAddresses[i]; amounts[index] = IERC20(...
3,902
13
// address(0) turns this contract into a native token staking pool
if(address(stakeToken) == address(0)) { isNativeTokenStaking = true; }
if(address(stakeToken) == address(0)) { isNativeTokenStaking = true; }
38,433
243
// Get this addesses contribution record
OrderBook storage order = orders[_addressToApprove];
OrderBook storage order = orders[_addressToApprove];
25,717
76
// If `account` had not been already granted `role`, emits a {RoleGranted}event. Requirements: - the caller must have ``role``'s admin role. /
function grantRole(bytes32 role, address account) public virtual override { require(hasRole(getRoleAdmin(role), _msgSender()), 'AccessControl: sender must be an admin to grant'); _grantRole(role, account); }
function grantRole(bytes32 role, address account) public virtual override { require(hasRole(getRoleAdmin(role), _msgSender()), 'AccessControl: sender must be an admin to grant'); _grantRole(role, account); }
20,048
6
// Flag to mark if a pause caused the fee to be waived. /
bool feeWaived;
bool feeWaived;
9,946
175
// Verify the Lengths add up to calldata size
verifyProofLength(add4(mul32(3), blockHeaderLength, transactionRootLength, transactionsLength))
verifyProofLength(add4(mul32(3), blockHeaderLength, transactionRootLength, transactionsLength))
21,505
21
// Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amount of tokens to be transferred /
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balance...
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balance...
4,543
20
// total number of tokens initially simplified from wei
function initialARXtokenSupply() constant returns (uint256 initialARXtokenSupplyCount) { initialARXtokenSupplyCount = safeDiv(initialARXSupplyInWei,1 ether); }
function initialARXtokenSupply() constant returns (uint256 initialARXtokenSupplyCount) { initialARXtokenSupplyCount = safeDiv(initialARXSupplyInWei,1 ether); }
26,885
22
// Only copy if we aren't removing the last index
if(nEndingIndex != a_nIndex) {
if(nEndingIndex != a_nIndex) {
31,128
43
// Cached data for the protocol fee
ProtocolFeeData protocolFeeData; ModeTime modeTime;
ProtocolFeeData protocolFeeData; ModeTime modeTime;
27,395
127
// See {IERC721Metadata-tokenURI}./
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString(), ...
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString(), ...
4,157
12
// can't claim any rewards from before sleep time
owner.pepeDebt = (accPepePerShare * owner.shareSize) / 1e12; totalShares += owner.shareSize; totalAsleep += userBalance; emit Sleep(msg.sender, block.timestamp + _seconds);
owner.pepeDebt = (accPepePerShare * owner.shareSize) / 1e12; totalShares += owner.shareSize; totalAsleep += userBalance; emit Sleep(msg.sender, block.timestamp + _seconds);
5,150
19
// Core harvest function.Get rewards from markets entered /
function _claimRewards() internal { IRewardDistributor(rewardDistributor).claimReward(0, payable(address(this)), markets); if (isNearRewardActive) { IRewardDistributor(rewardDistributor).claimReward(nearRewardIndex, payable(address(this)), markets); } }
function _claimRewards() internal { IRewardDistributor(rewardDistributor).claimReward(0, payable(address(this)), markets); if (isNearRewardActive) { IRewardDistributor(rewardDistributor).claimReward(nearRewardIndex, payable(address(this)), markets); } }
33,779
166
// |/Deposit (lock) funds to the relay contract for cross-chain transfer/
function deposit( address receiver, uint256 amount, uint256 toChainId
function deposit( address receiver, uint256 amount, uint256 toChainId
44,506
60
// Adds to a user's timelock balance.It will attempt to sweep before updating the balance./ Note that this will overwrite the previous unlock timestamp./user The user whose timelock balance should increase/amount The amount to increase by/timestamp The new unlock timestamp
function _mintTimelock(address user, uint256 amount, uint256 timestamp) internal { // Sweep the old balance, if any address[] memory users = new address[](1); users[0] = user; _sweepTimelockBalances(users); timelockTotalSupply = timelockTotalSupply.add(amount); _timelockBalances[user] = _time...
function _mintTimelock(address user, uint256 amount, uint256 timestamp) internal { // Sweep the old balance, if any address[] memory users = new address[](1); users[0] = user; _sweepTimelockBalances(users); timelockTotalSupply = timelockTotalSupply.add(amount); _timelockBalances[user] = _time...
16,378
59
// Total ETH
uint256 private _totalETH;
uint256 private _totalETH;
34,603
3
// List of all games tracked by the Nova Game contract
uint[] public games;
uint[] public games;
43,611
137
// vars added for v3
bool private v3Initialized; IRewardsDistributor private rewardsDistributor;
bool private v3Initialized; IRewardsDistributor private rewardsDistributor;
75,836
184
// YVAULT with Governance.
contract YVAULT is ERC20, Ownable { using SafeMath for uint256; uint256 public constant initialSupply = 1000; // 1k constructor () public ERC20("YVAULT.FINANCE", "YVAULT", 18, 2, initialSupply) { createUniswapPairMainnet(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 0x5C69bEe701ef814a2B6a3EDD4B1652CB...
contract YVAULT is ERC20, Ownable { using SafeMath for uint256; uint256 public constant initialSupply = 1000; // 1k constructor () public ERC20("YVAULT.FINANCE", "YVAULT", 18, 2, initialSupply) { createUniswapPairMainnet(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 0x5C69bEe701ef814a2B6a3EDD4B1652CB...
34,503