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
137
// Add converter observation
converterFeedObservations.push(ConverterFeedObservation(now, newTimeAdjustedPrice));
converterFeedObservations.push(ConverterFeedObservation(now, newTimeAdjustedPrice));
6,162
10
// View function to see pending reward on frontend.
function pendingReward(address _user) external view returns (uint256) { User storage user = users[_user]; uint256 accRewardPerToken = rewardTillNowPerToken; if (block.number > lastUpdatedBlock) { uint256 totalStakedToken = stakedToken.balanceOf(address(this)); uint25...
function pendingReward(address _user) external view returns (uint256) { User storage user = users[_user]; uint256 accRewardPerToken = rewardTillNowPerToken; if (block.number > lastUpdatedBlock) { uint256 totalStakedToken = stakedToken.balanceOf(address(this)); uint25...
3,883
163
// Emits a {Approval} event. /
function _approve( address to, uint256 tokenId, address owner ) private { _tokenApprovals[tokenId] = to; emit Approval(owner, to, tokenId); }
function _approve( address to, uint256 tokenId, address owner ) private { _tokenApprovals[tokenId] = to; emit Approval(owner, to, tokenId); }
12,156
0
// {Pausable-_pause} and {Pausable-_unpause} internal functions, with appropriateaccess control, e.g. using {AccessControl} or {Ownable}. Not doing so will/ See {ERC1155-_update}. Requirements: - the contract must not be paused. /
function _update( address from, address to, uint256[] memory ids, uint256[] memory values ) internal virtual override whenNotPaused { super._update(from, to, ids, values); }
function _update( address from, address to, uint256[] memory ids, uint256[] memory values ) internal virtual override whenNotPaused { super._update(from, to, ids, values); }
355
10
// sum of the total stakes amounts
uint256 public totalStakes;
uint256 public totalStakes;
34,103
194
// Returns the total quantity for a token ID _id uint256 ID of the token to queryreturn amount of token in existence /
function totalSupply(uint256 _id) public view virtual returns (uint256) { return tokenSupply[_id]; }
function totalSupply(uint256 _id) public view virtual returns (uint256) { return tokenSupply[_id]; }
1,378
97
// send to dev wallet
sendEthToDevWallet(newBalance); emit OnSwapAndRedirectEthFees(contractTokenBalance, newBalance);
sendEthToDevWallet(newBalance); emit OnSwapAndRedirectEthFees(contractTokenBalance, newBalance);
38,026
236
// current rate per token - rate user previously received
uint256 userRewardDelta = _currentRewardPerToken - _userRewardPerTokenPaid; // + 1 SLOAD
uint256 userRewardDelta = _currentRewardPerToken - _userRewardPerTokenPaid; // + 1 SLOAD
43,030
9
// Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded.
* Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {a...
* Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {a...
28,391
201
// opensea mainnet
ProxyRegistry proxyRegistry = ProxyRegistry( 0xa5409ec958C83C3f309868babACA7c86DCB077c1 );
ProxyRegistry proxyRegistry = ProxyRegistry( 0xa5409ec958C83C3f309868babACA7c86DCB077c1 );
28,413
46
// when the pending limit becomes the current limit
uint64 changeAfter;
uint64 changeAfter;
29,082
1
// Buys multiple options /
function buyOptions( WasabiStructs.PoolAsk[] calldata _requests, WasabiStructs.Ask[] calldata _asks, bytes[] calldata _signatures ) external payable returns (uint256[] memory);
function buyOptions( WasabiStructs.PoolAsk[] calldata _requests, WasabiStructs.Ask[] calldata _asks, bytes[] calldata _signatures ) external payable returns (uint256[] memory);
26,385
121
// round 51
ark(i, q, 3078975275808111706229899605611544294904276390490742680006005661017864583210); sbox_partial(i, q); mix(i, q);
ark(i, q, 3078975275808111706229899605611544294904276390490742680006005661017864583210); sbox_partial(i, q); mix(i, q);
24,427
86
// mod with totalTickets to get a number in [0..totalTickets - 1]add 1 to bring it in the range of [1, totalTickets], since we start our interval slices at 1 (see below)
lot.winningNumber = 1 + (uint(keccak256(result)) % totalTickets); findWinner(); LogLotteryResult(currentLotteryId, 1, reqId, result);
lot.winningNumber = 1 + (uint(keccak256(result)) % totalTickets); findWinner(); LogLotteryResult(currentLotteryId, 1, reqId, result);
7,771
215
// Lock some tokens as a new sub-stake_value Amount of tokens which will be locked_unlockingDuration Amount of periods during which tokens will be unlocked when wind down is enabled/
function lockAndCreate(uint256 _value, uint16 _unlockingDuration) external onlyStaker { lock(msg.sender, MAX_SUB_STAKES, _value, _unlockingDuration); }
function lockAndCreate(uint256 _value, uint16 _unlockingDuration) external onlyStaker { lock(msg.sender, MAX_SUB_STAKES, _value, _unlockingDuration); }
50,057
29
// Resets underlying for a vaultNumber at the start of a rebalancing period
function resetVaultUnderlying(uint256 _vaultNumber) internal { vaults[_vaultNumber].totalUnderlying = 0; vaultStage[_vaultNumber].underlyingReceived = 0; vaults[_vaultNumber].totalSupply = 0; }
function resetVaultUnderlying(uint256 _vaultNumber) internal { vaults[_vaultNumber].totalUnderlying = 0; vaultStage[_vaultNumber].underlyingReceived = 0; vaults[_vaultNumber].totalSupply = 0; }
11,535
31
// updatedPrevId is the intended prevId of the order, after updating its values. If it is the same as the current prevId of the order, the order does not need to change place in the list, only update its amounts.
if (orders[orderId].prevId == updatedPrevId) { nextId = orders[orderId].nextId; if (isRightPosition( updatedSrcAmount, updatedDstAmount, updatedPrevId, nextId) ) { orders[orderId].srcAmount = upda...
if (orders[orderId].prevId == updatedPrevId) { nextId = orders[orderId].nextId; if (isRightPosition( updatedSrcAmount, updatedDstAmount, updatedPrevId, nextId) ) { orders[orderId].srcAmount = upda...
41,467
358
// Retrieve the `totalSupply` at the end of `blockNumber`. Note, this value is the sum of all balances.It is but NOT the sum of all the delegated votes! Requirements: - `blockNumber` must have been already mined /
function getPastTotalSupply(uint256 blockNumber) public view virtual override returns (uint256) { require(blockNumber < block.number, "ERC20Votes: block not yet mined"); return _checkpointsLookup(_totalSupplyCheckpoints, blockNumber); }
function getPastTotalSupply(uint256 blockNumber) public view virtual override returns (uint256) { require(blockNumber < block.number, "ERC20Votes: block not yet mined"); return _checkpointsLookup(_totalSupplyCheckpoints, blockNumber); }
16,284
45
// Emitted when `setRewardsDuration` is called.//bankNodeId The id of the bank node/newDuration The new reward duration
event RewardsDurationUpdated(uint32 indexed bankNodeId, uint256 newDuration);
event RewardsDurationUpdated(uint32 indexed bankNodeId, uint256 newDuration);
49,309
157
// Instructs the SetToken to transfer the ERC20 token to a recipient.The new SetToken balance must equal the existing balance less the quantity transferred_setTokenSetToken instance to invoke _token ERC20 token to transfer _toThe recipient account _quantityThe quantity to transfer /
function strictInvokeTransfer( ISetToken _setToken, address _token, address _to, uint256 _quantity
function strictInvokeTransfer( ISetToken _setToken, address _token, address _to, uint256 _quantity
79,542
42
// Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; if (block.number <= pool.lastRewardBlock) { return; } uint256 lpSupply = pool.lockCrosschainAmount.add(pool.lpToken.balanceOf(address(this))); //uint256 lpSupply = pool.lpToken.bala...
function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; if (block.number <= pool.lastRewardBlock) { return; } uint256 lpSupply = pool.lockCrosschainAmount.add(pool.lpToken.balanceOf(address(this))); //uint256 lpSupply = pool.lpToken.bala...
305
63
// farm type id. Useful for back-end systems to know how to read the contract (ABI) as we plan to launch multiple farm types
uint256 public farmType = 1; IFarmFactory public factory; address public farmGenerator; FarmInfo public farmInfo;
uint256 public farmType = 1; IFarmFactory public factory; address public farmGenerator; FarmInfo public farmInfo;
46,953
215
// Decrease allowance by the specified value
_approve( _msgSender(), spender, _allowances[_msgSender()][spender] - subtractedValue ); return true;
_approve( _msgSender(), spender, _allowances[_msgSender()][spender] - subtractedValue ); return true;
26,539
10
// See {BEP20-balanceOf}. /
function balanceOf(address account) external view override returns (uint256) { return _balances[account]; }
function balanceOf(address account) external view override returns (uint256) { return _balances[account]; }
1,756
22
// Royalty support for various other standards
function getFeeRecipients(uint256 tokenId) external view returns (address payable[] memory); function getFeeBps(uint256 tokenId) external view returns (uint[] memory); function getFees(uint256 tokenId) external view returns (address payable[] memory, uint256[] memory); function royaltyInfo(uint256 token...
function getFeeRecipients(uint256 tokenId) external view returns (address payable[] memory); function getFeeBps(uint256 tokenId) external view returns (uint[] memory); function getFees(uint256 tokenId) external view returns (address payable[] memory, uint256[] memory); function royaltyInfo(uint256 token...
39,102
14
// Interface for the optional metadata functions from the ERC20 standard. _Available since v4.1._ /
interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals ...
interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals ...
61
206
// Converts a uint256 to its ASCII string decimal representation. /
function _toString(uint256 value) internal pure virtual returns (string memory str) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), but // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. // We will need 1 ...
function _toString(uint256 value) internal pure virtual returns (string memory str) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), but // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. // We will need 1 ...
1,207
4
// Check for duplicate keys
for (uint256 i = 0; i < keys.length; i++) { for (uint256 j = i + 1; j < keys.length; j++) { if (keys[i] == keys[j]) { delete uniqueKeys[i]; delete uniqueTo[i]; delete uniqueTimestamps[i]; }
for (uint256 i = 0; i < keys.length; i++) { for (uint256 j = i + 1; j < keys.length; j++) { if (keys[i] == keys[j]) { delete uniqueKeys[i]; delete uniqueTo[i]; delete uniqueTimestamps[i]; }
30,998
191
// assign random rarity from 1 to 64
uint8(uint256(blockhash(block.number.sub(1)))).div(4).add(1) );
uint8(uint256(blockhash(block.number.sub(1)))).div(4).add(1) );
5,255
3
// Borrowable / this is the stored borrow balance; the current borrow balance may be slightly higher
function borrowBalance(address borrower) public view returns (uint256) { BorrowSnapshot memory borrowSnapshot = borrowBalances[borrower]; if (borrowSnapshot.interestIndex == 0) return 0; // not initialized return uint256(borrowSnapshot.principal).mul(borrowIndex).div(borrowSnapshot.interestI...
function borrowBalance(address borrower) public view returns (uint256) { BorrowSnapshot memory borrowSnapshot = borrowBalances[borrower]; if (borrowSnapshot.interestIndex == 0) return 0; // not initialized return uint256(borrowSnapshot.principal).mul(borrowIndex).div(borrowSnapshot.interestI...
40,393
435
// Submit an onchain request to withdraw Ether or ERC20 tokens from the/protocol fees account. The complete balance is always withdrawn.//Anyone can request a withdrawal of the protocol fees.//Note that after such an operation, it will take the operator some/time (no more than MAX_AGE_REQUEST_UNTIL_FORCED) to process t...
function withdrawProtocolFees( address tokenAddress ) external payable;
function withdrawProtocolFees( address tokenAddress ) external payable;
26,545
32
// the following variables are made public for easier testing and debugging and are not supposed to be accessed in regular code
bytes32[] public filledSubtrees; bytes32[] public zeros; uint32 public currentRootIndex = 0; uint32 public nextIndex = 0; uint32 public constant ROOT_HISTORY_SIZE = 100; bytes32[ROOT_HISTORY_SIZE] public roots;
bytes32[] public filledSubtrees; bytes32[] public zeros; uint32 public currentRootIndex = 0; uint32 public nextIndex = 0; uint32 public constant ROOT_HISTORY_SIZE = 100; bytes32[ROOT_HISTORY_SIZE] public roots;
38,933
375
// sqrt needs to refactored by 1/2 decimals, ie 1e9
wA = _sqrt(uint256(1e18).mul(1e18).div(A)).mul(1e9);
wA = _sqrt(uint256(1e18).mul(1e18).div(A)).mul(1e9);
10,732
59
// Maps player address to current player game id.
mapping (address => uint) public playerGameId;
mapping (address => uint) public playerGameId;
28,443
18
// multiplier for time locked deposits / second locked scaled by SCALE
uint256 public immutable timeLockMultiplier;
uint256 public immutable timeLockMultiplier;
16,803
16
// Post or at maturity, converts a desired amount of underlying tokens returned to principal tokens needed./a The amount of underlying tokens to convert/ return uint256 The amount of principal tokens returned by the conversion
function convertToShares(uint256 a) external view override returns (uint256)
function convertToShares(uint256 a) external view override returns (uint256)
30,220
70
// Checks if rounding error >= 0.1% when rounding down./numerator Numerator./denominator Denominator./target Value to multiply with numerator/denominator./ return Rounding error is present.
function isRoundingErrorFloor( uint256 numerator, uint256 denominator, uint256 target ) internal pure returns (bool isError) { require(
function isRoundingErrorFloor( uint256 numerator, uint256 denominator, uint256 target ) internal pure returns (bool isError) { require(
50,002
2
// Updates the URI of the token. Reverts if the sender is not the contract owner. tokenURI_ the updated URI. /
function setTokenURI(string calldata tokenURI_) external { _requireOwnership(_msgSender()); _tokenURI = tokenURI_; }
function setTokenURI(string calldata tokenURI_) external { _requireOwnership(_msgSender()); _tokenURI = tokenURI_; }
36,903
15
// solhint-disable no-simple-event-func-name/Overridden to realize `unfinalizedPoolRewardsByEpoch` in/the current epoch and emit a event,
function finalizePool(bytes32 poolId) external
function finalizePool(bytes32 poolId) external
44,801
75
// This event MUST emit when an address withdraws their dividend./to The address which withdraws ether from this contract./weiAmount The amount of withdrawn ether in wei.
event DividendWithdrawn(address indexed to, uint256 weiAmount);
event DividendWithdrawn(address indexed to, uint256 weiAmount);
9,220
3
// Replaced with an immutable slither-disable-next-line constable-states
address private _deprecated_vaultAddress;
address private _deprecated_vaultAddress;
13,768
2
// Deposit ETH for later withdrawal/receiver Address of the account that is eligible for withdrawal.
function deposit(address receiver) external payable { require(receiver != address(0), "FeeBank: receiver is zero address"); require(msg.value > 0, "FeeBank: fee is zero"); require( msg.value <= type(uint64).max - deposits[receiver], "FeeBank: balance would exceed uint...
function deposit(address receiver) external payable { require(receiver != address(0), "FeeBank: receiver is zero address"); require(msg.value > 0, "FeeBank: fee is zero"); require( msg.value <= type(uint64).max - deposits[receiver], "FeeBank: balance would exceed uint...
33,092
15
// Get user's Available to withdraw
function getUserAvailable(address userAddress) public view returns(uint256) { return getUserReferralBonus(userAddress).add(getUserDividends(userAddress)); }
function getUserAvailable(address userAddress) public view returns(uint256) { return getUserReferralBonus(userAddress).add(getUserDividends(userAddress)); }
267
181
// eg. [cTokenAddress, iTokenAddress, ...]
address[] public allAvailableTokens;
address[] public allAvailableTokens;
72,540
48
// Require tokens is zero or amount is also zero
if (redeemTokens == 0 && redeemAmount > 0) { revert("redeemTokens zero"); }
if (redeemTokens == 0 && redeemAmount > 0) { revert("redeemTokens zero"); }
12,365
38
// Return the actual power transferred, which is determined as a fraction of the loser's power in the preceeding math.
return int256((power2 * transferRatioQ10) >> 10);
return int256((power2 * transferRatioQ10) >> 10);
26,101
4
// Integer division of two signed integers truncating the quotient, reverts on division by zero. /
function div(int256 a, int256 b) internal pure returns (int256) { require(b != 0, "wdivision by zero"); require(!(b == -1 && a == _INT256_MIN), "wdivision overflow"); int256 c = a / b; return c; }
function div(int256 a, int256 b) internal pure returns (int256) { require(b != 0, "wdivision by zero"); require(!(b == -1 && a == _INT256_MIN), "wdivision overflow"); int256 c = a / b; return c; }
7,145
158
// Collateral-specific, per-second stability fee contribution [wad]
uint256 interestPerSecond;
uint256 interestPerSecond;
69,634
0
// Create a contract to keep track of my friendships./
function MyFriendships() public { me = msg.sender; }
function MyFriendships() public { me = msg.sender; }
4,576
7
// Ensure token balances are equal + fees
uint256 tokensAvailableAfter = _getReservesAvailable(_token); require( tokensAvailableAfter == tokensAvailableBefore.add(totalFee), "Token balances are inconsistent. Transaction reverted" );
uint256 tokensAvailableAfter = _getReservesAvailable(_token); require( tokensAvailableAfter == tokensAvailableBefore.add(totalFee), "Token balances are inconsistent. Transaction reverted" );
11,784
2
// Receive funds
receive() external payable { emit Received(msg.sender, msg.value); }
receive() external payable { emit Received(msg.sender, msg.value); }
13,366
44
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
if (returndata.length > 0) {
6,478
132
// Updates chain ids of used networks _sourceChainId chain id for current network _destinationChainId chain id for opposite network /
function setChainIds(uint256 _sourceChainId, uint256 _destinationChainId) external onlyOwner { _setChainIds(_sourceChainId, _destinationChainId); }
function setChainIds(uint256 _sourceChainId, uint256 _destinationChainId) external onlyOwner { _setChainIds(_sourceChainId, _destinationChainId); }
59,009
21
// Mapping of account addresses to outstanding borrow balances /
mapping(address => BorrowSnapshot) internal accountBorrows;
mapping(address => BorrowSnapshot) internal accountBorrows;
13,532
5
// return names of candidates
function checkNames() view public returns(string memory, string memory){ return (candidateOneName, candidateTwoName); }
function checkNames() view public returns(string memory, string memory){ return (candidateOneName, candidateTwoName); }
39,770
112
// Determine the next allocation to rebalance into. _targetBaseAssetAllocation Target allocation of the base asset_allocationPrecision Precision of allocation percentage_currentCollateralSetInstance of current set collateralizing RebalancingSetTokenreturn addressThe address of the proposed nextSet /
function determineNewAllocation( uint256 _targetBaseAssetAllocation, uint256 _allocationPrecision, ISetToken _currentCollateralSet ) external returns (ISetToken);
function determineNewAllocation( uint256 _targetBaseAssetAllocation, uint256 _allocationPrecision, ISetToken _currentCollateralSet ) external returns (ISetToken);
37,470
120
// Store poster = newPoster.
poster = _newPoster; emit NewPoster(_oldPoster, _newPoster); return uint256(Error.NO_ERROR);
poster = _newPoster; emit NewPoster(_oldPoster, _newPoster); return uint256(Error.NO_ERROR);
17,818
85
// Partitioning a subset of outcomes for the condition in this branch. For example, for a condition with three outcomes A, B, and C, this branch allows the splitting of a position $:(A|C) to positions $:(A) and $:(C).
_burn( msg.sender, CTHelpers.getPositionId(collateralToken, CTHelpers.getCollectionId(parentCollectionId, conditionId, fullIndexSet ^ freeIndexSet)), amount );
_burn( msg.sender, CTHelpers.getPositionId(collateralToken, CTHelpers.getCollectionId(parentCollectionId, conditionId, fullIndexSet ^ freeIndexSet)), amount );
9,198
316
// > 24 months = 1.6x
return 60;
return 60;
63,169
5
// Convert signed 64.64 fixed point number into unsigned 64-bit integernumber rounding down.Revert on underflow.x signed 64.64-bit fixed point numberreturn unsigned 64-bit integer number /
function toUInt(int128 x) internal pure returns (uint64) { unchecked { require(x >= 0); return uint64(uint128(x >> 64)); } }
function toUInt(int128 x) internal pure returns (uint64) { unchecked { require(x >= 0); return uint64(uint128(x >> 64)); } }
5,794
14
// Unlock the WEDU token in users _who The user for unlocking WEDU token _value The amount of unlocking WEDU token /
function unlockBalance(address _who, uint _value) public onlyOwner { // Check the locked balance of a user require(_value <= balanceValue[_who].locked, "Unsufficient balance"); uint totalBalanceValue = balanceValue[_who].locked + balanceValue[_who].unlocked; balanceValue[_who].lock...
function unlockBalance(address _who, uint _value) public onlyOwner { // Check the locked balance of a user require(_value <= balanceValue[_who].locked, "Unsufficient balance"); uint totalBalanceValue = balanceValue[_who].locked + balanceValue[_who].unlocked; balanceValue[_who].lock...
23,565
16
// Set L1 TransferRoot
_setTransferRoot(rootHash, totalAmount);
_setTransferRoot(rootHash, totalAmount);
75,806
36
// Opens fundraising
function startFundraising() external onlyOwner onlyState(State.Pause) { _state = State.Fundrasing; emit FundraisingOpened(); }
function startFundraising() external onlyOwner onlyState(State.Pause) { _state = State.Fundrasing; emit FundraisingOpened(); }
17,595
5
// Convert signed 64.64 fixed point number into unsigned 64-bit integernumber rounding down.Revert on underflow.x signed 64.64-bit fixed point numberreturn unsigned 64-bit integer number /
function toUInt (int128 x) internal pure returns (uint64) { require (x >= 0); return uint64 (x >> 64); }
function toUInt (int128 x) internal pure returns (uint64) { require (x >= 0); return uint64 (x >> 64); }
19,279
10
// A single token deposit for a certain amount of time for a certain beneficiar /
struct TokenDeposit { uint256 tokens; uint256 releaseTime; }
struct TokenDeposit { uint256 tokens; uint256 releaseTime; }
7,586
1
// _jpeg The token to vest
constructor(address _jpeg) ERC20("preJPEG", "pJPEG") ERC20Permit("preJPEG") TokenVesting(_jpeg)
constructor(address _jpeg) ERC20("preJPEG", "pJPEG") ERC20Permit("preJPEG") TokenVesting(_jpeg)
37,698
31
// Modifier checking if the user is an admin or has a role/This reverts if the msg.sender is not an admin for the given token id or contract/tokenId tokenId to check/role role to check
modifier onlyAdminOrRole(uint256 tokenId, uint256 role) { _requireAdminOrRole(msg.sender, tokenId, role); _; }
modifier onlyAdminOrRole(uint256 tokenId, uint256 role) { _requireAdminOrRole(msg.sender, tokenId, role); _; }
6,344
43
// Check if an account already exists. account The address of the accountreturn Returns `false` if account exists. Returns `true` otherwise. /
function isNotAccount(address account) internal view returns (bool) { return (!accounts[account].exists); }
function isNotAccount(address account) internal view returns (bool) { return (!accounts[account].exists); }
41,439
41
// Retrieve the requested timelock struct
Timelock storage timelock = timelocks[timelockNumber];
Timelock storage timelock = timelocks[timelockNumber];
22,981
5
// return extra balance (if you overpaid)
uint256 balance = address(this).balance; if (balance > 0) { (bool success,) = payable(msg.sender).call{value: msg.value}("");
uint256 balance = address(this).balance; if (balance > 0) { (bool success,) = payable(msg.sender).call{value: msg.value}("");
14,014
243
// Sets borrowing limit per single block/Borrowing limit per block in conjunction with/ the monitoring system serves to minimize loss from hacks/ While an attacker would be able to steal, in worst case,/ up to (limitPerBlockn blocks) of funds, the monitoring/ system would pause the contracts after detecting suspicious/...
function setLimitPerBlock(uint128 newLimit) external creditConfiguratorOnly // F:[FA-44]
function setLimitPerBlock(uint128 newLimit) external creditConfiguratorOnly // F:[FA-44]
26,363
63
// Get the token metadata URI /
function tokenURI(uint256 tokenId) public view virtual override returns (string memory)
function tokenURI(uint256 tokenId) public view virtual override returns (string memory)
20,942
432
// If the last adjudication round was appealed but no-one confirmed it, the final ruling is the outcome the appealer vouched for. Otherwise, fetch the winning outcome from the voting app of the last round.
AdjudicationRound storage lastRound = _dispute.rounds[lastRoundId]; Appeal storage lastAppeal = lastRound.appeal; bool isRoundAppealedAndNotConfirmed = _existsAppeal(lastAppeal) && !_isAppealConfirmed(lastAppeal); uint8 finalRuling = isRoundAppealedAndNotConfirmed ? lastAppea...
AdjudicationRound storage lastRound = _dispute.rounds[lastRoundId]; Appeal storage lastAppeal = lastRound.appeal; bool isRoundAppealedAndNotConfirmed = _existsAppeal(lastAppeal) && !_isAppealConfirmed(lastAppeal); uint8 finalRuling = isRoundAppealedAndNotConfirmed ? lastAppea...
13,016
112
// Can by called by anyone to burn the stake of the exchange when certain/conditions are fulfilled.//Currently this will only burn the stake of the exchange if/the exchange is in withdrawal mode.
function burnExchangeStake() external virtual;
function burnExchangeStake() external virtual;
80,954
244
// Calls every target with corresponding data/ return True if calls to all targets returned True. Otherwise, false
function and(address[] calldata targets, bytes[] calldata data) external view returns(bool) { require(targets.length == data.length, "PH: input array size mismatch"); for (uint i = 0; i < targets.length; i++) { bytes memory result = targets[i].uncheckedFunctionStaticCall(data[i], "PH: 'a...
function and(address[] calldata targets, bytes[] calldata data) external view returns(bool) { require(targets.length == data.length, "PH: input array size mismatch"); for (uint i = 0; i < targets.length; i++) { bytes memory result = targets[i].uncheckedFunctionStaticCall(data[i], "PH: 'a...
26,784
248
// only allow vault owner or vault operator to deposit collateral
require((_args.from == msg.sender) || (_args.from == _args.owner), "C20"); require(whitelist.isWhitelistedCollateral(_args.asset), "C21"); (, uint256 typeVault, ) = getVaultWithDetails(_args.owner, _args.vaultId); if (typeVault == 1) { nakedPoolBalance[_args.asset] = naked...
require((_args.from == msg.sender) || (_args.from == _args.owner), "C20"); require(whitelist.isWhitelistedCollateral(_args.asset), "C21"); (, uint256 typeVault, ) = getVaultWithDetails(_args.owner, _args.vaultId); if (typeVault == 1) { nakedPoolBalance[_args.asset] = naked...
9,575
54
// amount of tokens emitted per wei
uint256 public rate;
uint256 public rate;
21,461
23
// ------------------------------------------------------------------------why wont these nerds shut the fuck up and give me my money ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; }
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; }
2,969
38
// if round started in the past, start now instead
if (rDetails.start < now) { round.details.start = now; }
if (rDetails.start < now) { round.details.start = now; }
53,845
148
// return value
return amountOne + amountTwo;
return amountOne + amountTwo;
10,355
322
// OpenZeppelin ERC20 implementation (if ERC20Burnable is not used) won't allow tokens to be sent to 0x0..0 addressNOTE: place this address to something claimable to test migration in mainnet with real tokens
address private constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD; IERC20 public oldToken; HHToken public newToken;
address private constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD; IERC20 public oldToken; HHToken public newToken;
24,358
27
// Function to recover ERC20 tokens accidentally sent to the contract. SURF tokens (the only token that should be in this contract) can't be withdrawn this way.
function recoverToken(IERC20 _token, address _receiver) external onlyOwner { require(address(_token) != address(surf), "Cannot recover SURF"); uint256 tokenBalance = _token.balanceOf(address(this)); require(tokenBalance > 0, "No balance"); _token.transfer(_receiver, tokenBalance); ...
function recoverToken(IERC20 _token, address _receiver) external onlyOwner { require(address(_token) != address(surf), "Cannot recover SURF"); uint256 tokenBalance = _token.balanceOf(address(this)); require(tokenBalance > 0, "No balance"); _token.transfer(_receiver, tokenBalance); ...
32,661
86
// Returns the token symbol. /
function symbol() external override view returns (string memory) { return _symbol; }
function symbol() external override view returns (string memory) { return _symbol; }
25,595
115
// Get the current primary recipient.
address primaryRecipient = _primaryUSDCRecipient; require( primaryRecipient != address(0), "No USDC primary recipient currently set." );
address primaryRecipient = _primaryUSDCRecipient; require( primaryRecipient != address(0), "No USDC primary recipient currently set." );
78,177
15
// validate lp token which will be staked in, must be from factorylpToken address of LP token which will staked in, throw exception of not valid/
function validateLPToken(address lpToken) internal view { uint256 pairLength = IWhiteSwapV2Factory(whiteswapV2Factory).allPairsLength(); bool isWSLPToken = false; for (uint256 i = 0; i < pairLength; i++) { address pair = IWhiteSwapV2Factory(whiteswapV2Factory).allPairs(i); ...
function validateLPToken(address lpToken) internal view { uint256 pairLength = IWhiteSwapV2Factory(whiteswapV2Factory).allPairsLength(); bool isWSLPToken = false; for (uint256 i = 0; i < pairLength; i++) { address pair = IWhiteSwapV2Factory(whiteswapV2Factory).allPairs(i); ...
27,619
0
// Reserved for V2
contract GTBank is Ownable { }
contract GTBank is Ownable { }
41,642
172
// in order to prevent multiple funding settlement during very short time after network congestion
uint256 minNextValidFundingTime = _blockTimestamp().add(fundingBufferPeriod);
uint256 minNextValidFundingTime = _blockTimestamp().add(fundingBufferPeriod);
29,831
25
// Insert the new tokenId into _tokenClaims for the current claim address & instanceId
_tokenClaims[creatorContractAddress][newTokenId] = TokenClaim(uint224(instanceId), claim.total);
_tokenClaims[creatorContractAddress][newTokenId] = TokenClaim(uint224(instanceId), claim.total);
42,113
19
// Mapping to track referrer. The second address is the address of referrer, the Up-line/ Sponsor // Mapping to track referrer bonus for all the referrers / Events to track ether transfer to referrers
event ReferrerBonus(address indexed referer, address indexed trader, uint256 referralBonus, uint256 timestamp ); event ReferrerBonusWithdrawn(address indexed referrer, uint256 indexed amount);
event ReferrerBonus(address indexed referer, address indexed trader, uint256 referralBonus, uint256 timestamp ); event ReferrerBonusWithdrawn(address indexed referrer, uint256 indexed amount);
38,282
129
// Overflows are incredibly unrealistic. balance or numberMinted overflow if current value of either + quantity > 1.8e19 (264) - 1 updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2256) - 1
unchecked { _addressData[to].balance += uint64(quantity); _addressData[to].numberMinted += uint64(quantity); _ownerships[startTokenId].addr = to; _ownerships[startTokenId].startTimestamp = uint64(block.timestamp); uint256 updatedIndex = startTokenId;...
unchecked { _addressData[to].balance += uint64(quantity); _addressData[to].numberMinted += uint64(quantity); _ownerships[startTokenId].addr = to; _ownerships[startTokenId].startTimestamp = uint64(block.timestamp); uint256 updatedIndex = startTokenId;...
2,544
72
// Transfer all the accumulated fees to the owners account Prevent owner from withdrawing active bets!
function withdraw() public { require( bet == 0, "Can only withdraw funds when there is no active game." ); require( address(this).balance > 0, "The balance is currently 0 ETH. Nothing to withdraw." ); require( msg.se...
function withdraw() public { require( bet == 0, "Can only withdraw funds when there is no active game." ); require( address(this).balance > 0, "The balance is currently 0 ETH. Nothing to withdraw." ); require( msg.se...
29,209
253
// Event for logging lootbox opens
event LootBoxOpened(uint256 indexed optionId, address indexed buyer, uint256 boxesPurchased, uint256 itemsMinted); event Warning(string message, address account);
event LootBoxOpened(uint256 indexed optionId, address indexed buyer, uint256 boxesPurchased, uint256 itemsMinted); event Warning(string message, address account);
17,017
8
// Allows the user to get the latest value for the requestId specified_requestId is the requestId to look up the value for return bool true if it is able to retreive a value, the value, and the value's timestamp/
function getCurrentValue(uint256 _requestId) public view returns (bool ifRetrieve, uint256 value, uint256 _timestampRetrieved) { uint256 _count = _tellorm.getNewValueCountbyRequestId(_requestId); if (_count > 0) { _timestampRetrieved = _tellorm.getTimestampbyRequestIDandIndex(_requestId,...
function getCurrentValue(uint256 _requestId) public view returns (bool ifRetrieve, uint256 value, uint256 _timestampRetrieved) { uint256 _count = _tellorm.getNewValueCountbyRequestId(_requestId); if (_count > 0) { _timestampRetrieved = _tellorm.getTimestampbyRequestIDandIndex(_requestId,...
10,704
49
// Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],but performing a delegate call. _Available since v3.4._ /
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); }
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); }
18,285
65
// Called by the primary DAO Agent to set the APR update steps/aprUpdateStep can be 0% or 100%+./ Only the primary Agent can do this because it is a critical operation./_aprUpdateStep APR update steps
function setAprUpdateStep(uint256 _aprUpdateStep) external override onlyAgentAppPrimary()
function setAprUpdateStep(uint256 _aprUpdateStep) external override onlyAgentAppPrimary()
58,224
59
// Returns true if the passed phase ID is active_phaseId requested phase ID return _isActive true if phase is active, false otherwise /
function _isPhaseActive(uint256 _phaseId) internal view returns (bool _isActive) { // Check that the requested phase ID exists within the phases array if (_phaseId >= phases.length) revert ABErrors.INVALID_PARAMETER(); ABDataTypes.Phase memory phase = phases[_phaseId]; // Check if th...
function _isPhaseActive(uint256 _phaseId) internal view returns (bool _isActive) { // Check that the requested phase ID exists within the phases array if (_phaseId >= phases.length) revert ABErrors.INVALID_PARAMETER(); ABDataTypes.Phase memory phase = phases[_phaseId]; // Check if th...
9,411
1
// TokenSorting library/Provides functions to sort tokens easily
library TokenSorting { /// @notice Takes two tokens, and returns them sorted /// @param _tokenA One of the tokens /// @param _tokenB The other token /// @return __tokenA The first of the tokens /// @return __tokenB The second of the tokens function sortTokens(address _tokenA, address _tokenB) internal pure ...
library TokenSorting { /// @notice Takes two tokens, and returns them sorted /// @param _tokenA One of the tokens /// @param _tokenB The other token /// @return __tokenA The first of the tokens /// @return __tokenB The second of the tokens function sortTokens(address _tokenA, address _tokenB) internal pure ...
36,264
83
// Check if the expected bytecode equals the actual bytecode and return the result
result := and( eq(mload(clone), mload(other)), eq(mload(add(clone, 0xd)), mload(add(other, 0xd))) )
result := and( eq(mload(clone), mload(other)), eq(mload(add(clone, 0xd)), mload(add(other, 0xd))) )
35,428
702
// TransactionReader/Brecht Devos - <[email protected]>/Utility library to read transactions.
library TransactionReader { using BlockReader for bytes; using TransactionReader for ExchangeData.Block; using BytesUtil for bytes; function readDeposit( ExchangeData.Block memory _block, uint txIdx, bytes memory txData )
library TransactionReader { using BlockReader for bytes; using TransactionReader for ExchangeData.Block; using BytesUtil for bytes; function readDeposit( ExchangeData.Block memory _block, uint txIdx, bytes memory txData )
53,265
15
// Changes the base URI if we want to move things in the future (Callable by owner only)/
function changeBaseURI(string memory baseURI) onlyOwner public { _setBaseURI(baseURI); }
function changeBaseURI(string memory baseURI) onlyOwner public { _setBaseURI(baseURI); }
27,050