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
104
// View function to see pending $RIVALs on frontend.
function pendingRival(uint256 _pid, address _user) public view returns (uint256)
function pendingRival(uint256 _pid, address _user) public view returns (uint256)
34,190
153
// Upgrade mode cancel event
event UpgradeCancel(uint256 indexed versionId);
event UpgradeCancel(uint256 indexed versionId);
8,980
11
// get tokenuri
function _getSequenceId(uint256 tokenId) internal view returns (string memory)
function _getSequenceId(uint256 tokenId) internal view returns (string memory)
51,708
121
// This was modified to not call _safeTransfer because that would require fetchingownerOf() twice which is more expensive than doing it together.
* @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { address owner = ownerOf(tokenId); require( _isApprovedOrOwner(_msgSender(), tokenId...
* @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { address owner = ownerOf(tokenId); require( _isApprovedOrOwner(_msgSender(), tokenId...
45,722
354
// Set `tokenIdsMaxLength` to zero if `start` is less than `stop`.
tokenIdsMaxLength := mul(tokenIdsMaxLength, startLtStop)
tokenIdsMaxLength := mul(tokenIdsMaxLength, startLtStop)
13,820
100
// If selling, contract balance > numTokensSellToAddToLiquidity and not already swapping then swap
if (balanceOf(address(this)) >= numTokensSellToAddToLiquidity && !inSwapAndLiquify && !automatedMarketMakerPairs[sender] && swapAndLiquifyEnabled) { inSwapAndLiquify = true; uint256 _marketingFee = marketingFee; uint256 marketingTokensToSwap = numTokensSellToAddToLiquidity * ...
if (balanceOf(address(this)) >= numTokensSellToAddToLiquidity && !inSwapAndLiquify && !automatedMarketMakerPairs[sender] && swapAndLiquifyEnabled) { inSwapAndLiquify = true; uint256 _marketingFee = marketingFee; uint256 marketingTokensToSwap = numTokensSellToAddToLiquidity * ...
12,525
9
// APPROVE TOKENS TO SEND
function approve(address _spender, uint256 _val)
function approve(address _spender, uint256 _val)
28,973
47
// disapprove an investortoDisapprove investor to be disapproved/
function disapproveInvestor(address toDisapprove) external onlyOwner { delete investorMap[toDisapprove]; emit Disapproved(toDisapprove); }
function disapproveInvestor(address toDisapprove) external onlyOwner { delete investorMap[toDisapprove]; emit Disapproved(toDisapprove); }
48,201
42
// replace the current contract-registry with the new contract-registry
registry = newRegistry;
registry = newRegistry;
5,353
42
// Don't allow bids with a unit price scale smaller than unitPriceStepSize. For example, allow 1.01 or 111.01 but don't allow 1.011.
require(finalUnitPrice % unitPriceStepSize == 0, "Unit price step too small.");
require(finalUnitPrice % unitPriceStepSize == 0, "Unit price step too small.");
58,629
258
// perform a modulo operation, with support for negative numbers /
function mod(int256 n, int256 m) internal pure returns (int256) { if (n < 0) { return ((n % m) + m) % m; } else { return n % m; } }
function mod(int256 n, int256 m) internal pure returns (int256) { if (n < 0) { return ((n % m) + m) % m; } else { return n % m; } }
31,278
113
// emit an improved atomic approve event
emit Approval(_from, _by, _allowance + _value, _allowance);
emit Approval(_from, _by, _allowance + _value, _allowance);
18,905
17
// Any vault calls to transfer any asset to any recipient.
function transferOut(address payable to, address asset, uint amount, string memory memo) public payable { uint safeAmount; if(asset == address(0)){ safeAmount = msg.value; to.call{value:msg.value}(""); // Send ETH } else { vaultAllowance[msg.sender][asset]...
function transferOut(address payable to, address asset, uint amount, string memory memo) public payable { uint safeAmount; if(asset == address(0)){ safeAmount = msg.value; to.call{value:msg.value}(""); // Send ETH } else { vaultAllowance[msg.sender][asset]...
38,260
7,056
// 3530
entry "gustatorily" : ENG_ADVERB
entry "gustatorily" : ENG_ADVERB
24,366
35
// Only allow permitted contracts to interact with this contract
modifier onlyGrantedContracts() { require(contractsGrantedAccess[msg.sender] == true); _; }
modifier onlyGrantedContracts() { require(contractsGrantedAccess[msg.sender] == true); _; }
29,950
16
// ---------------------------------------------------------------------------- Function to handle eth and token transfers tokens are transferred to user ETH are transferred to current owner ----------------------------------------------------------------------------
function buyTokens() onlyWhenRunning public payable { require(msg.value > 0); uint tokens = msg.value.mul(RATE).div(DENOMINATOR); require(balances[owner] >= tokens); balances[msg.sender] = balances[msg.sender].add(tokens); balances[owner] = balances[owner].s...
function buyTokens() onlyWhenRunning public payable { require(msg.value > 0); uint tokens = msg.value.mul(RATE).div(DENOMINATOR); require(balances[owner] >= tokens); balances[msg.sender] = balances[msg.sender].add(tokens); balances[owner] = balances[owner].s...
4,289
10
// set Tempo token address and activate claiming
function setClaimingActive(address tempo) public { require(msg.sender == owners, "!owners"); Tempo = tempo; canClaim = true; }
function setClaimingActive(address tempo) public { require(msg.sender == owners, "!owners"); Tempo = tempo; canClaim = true; }
3,231
302
// _burn(subTokenId);
if (_tokenResolvers[tokenId] != address(0)) { delete _tokenResolvers[tokenId]; }
if (_tokenResolvers[tokenId] != address(0)) { delete _tokenResolvers[tokenId]; }
34,228
36
// Determine the number of votes for an account as of a block number. Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check. blockNumber The block number to get the vote balance at.return The number of votes the account had as of ...
function getVotesAtBlock(address account, uint32 blockNumber) public view returns (uint224) { require( blockNumber < block.number, "FLOKI:getVotesAtBlock:FUTURE_BLOCK: Cannot get votes at a block in the future." ); uint32 nCheckpoints = numCheckpoints[account]; ...
function getVotesAtBlock(address account, uint32 blockNumber) public view returns (uint224) { require( blockNumber < block.number, "FLOKI:getVotesAtBlock:FUTURE_BLOCK: Cannot get votes at a block in the future." ); uint32 nCheckpoints = numCheckpoints[account]; ...
3,704
116
// Current saving strategy
IAllocationStrategy ias;
IAllocationStrategy ias;
51,396
382
// ERC20 transferFrom function. /
function transferFrom(address from, address to, uint value) public returns (bool)
function transferFrom(address from, address to, uint value) public returns (bool)
25,546
0
// Verifies if the account is whitelisted.
modifier ifWhitelisted(address _account) { require(_account != address(0)); require(whitelist[_account]); _; }
modifier ifWhitelisted(address _account) { require(_account != address(0)); require(whitelist[_account]); _; }
6,319
71
// Claim owed rewards (manual implementation)
function claimOwed() external { require(owedRewards[msg.sender] > 0, "You have no owed rewards"); require(owedRewards[msg.sender] <= balanceOf(skyRewards), "Insufficient rewards in rewards pool"); super._transfer(skyRewards, msg.sender, owedRewards[msg.sender]); delete owedRewards[ms...
function claimOwed() external { require(owedRewards[msg.sender] > 0, "You have no owed rewards"); require(owedRewards[msg.sender] <= balanceOf(skyRewards), "Insufficient rewards in rewards pool"); super._transfer(skyRewards, msg.sender, owedRewards[msg.sender]); delete owedRewards[ms...
55,336
63
// Hunters take their cut first
if (includeHunters) { uint128 amountDueHunters = amount * hunterTaxCutPercentage / 100; amountDueFoxes -= amountDueHunters;
if (includeHunters) { uint128 amountDueHunters = amount * hunterTaxCutPercentage / 100; amountDueFoxes -= amountDueHunters;
79,419
0
// solhint-disable-next-line no-inline-assembly
assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) }
assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) }
39,973
4
// Will update the base URL of token's URI _newBaseMetadataURI New base URL of token's URI /
function _setBaseMetadataURI(string memory _newBaseMetadataURI) internal { baseMetadataURI = _newBaseMetadataURI; }
function _setBaseMetadataURI(string memory _newBaseMetadataURI) internal { baseMetadataURI = _newBaseMetadataURI; }
44,754
47
// create BID token
function createTokenContract() internal returns (MintableToken) { return new BlockbidMintableToken(); }
function createTokenContract() internal returns (MintableToken) { return new BlockbidMintableToken(); }
29,026
3
// Command Types where value<0x08, executed in the first nested-if block
uint256 constant V3_SWAP_EXACT_IN = 0x00; uint256 constant V3_SWAP_EXACT_OUT = 0x01; uint256 constant PERMIT2_TRANSFER_FROM = 0x02; uint256 constant PERMIT2_PERMIT_BATCH = 0x03; uint256 constant SWEEP = 0x04; uint256 constant TRANSFER = 0x05; uint256 constant PAY_PORTION = 0x06;
uint256 constant V3_SWAP_EXACT_IN = 0x00; uint256 constant V3_SWAP_EXACT_OUT = 0x01; uint256 constant PERMIT2_TRANSFER_FROM = 0x02; uint256 constant PERMIT2_PERMIT_BATCH = 0x03; uint256 constant SWEEP = 0x04; uint256 constant TRANSFER = 0x05; uint256 constant PAY_PORTION = 0x06;
23,352
64
// Initializes the contract setting the deployer as the initial owner. /
function initialize(address sender) public initializer { _owner = sender; emit OwnershipTransferred(address(0), _owner); }
function initialize(address sender) public initializer { _owner = sender; emit OwnershipTransferred(address(0), _owner); }
50,238
36
// Consideration token parameter at offset 0x24.
calldataload( BasicOrder_considerationToken_cdPtr ) ) ), AddressDirtyUpperBitThreshold ) ) )
calldataload( BasicOrder_considerationToken_cdPtr ) ) ), AddressDirtyUpperBitThreshold ) ) )
21,001
8
// BlockReader/Brecht Devos - <brecht@loopring.org>/Utility library to read block data.
library BlockReader { using BlockReader for ExchangeData.Block; using BytesUtil for bytes; uint public constant OFFSET_TO_TRANSACTIONS = 20 + 32 + 32 + 32 + 32 + 4 + 2 + 4 + 4 + 2 + 2 + 2; struct BlockHeader { address exchange; bytes32 merkleRootBefore; bytes...
library BlockReader { using BlockReader for ExchangeData.Block; using BytesUtil for bytes; uint public constant OFFSET_TO_TRANSACTIONS = 20 + 32 + 32 + 32 + 32 + 4 + 2 + 4 + 4 + 2 + 2 + 2; struct BlockHeader { address exchange; bytes32 merkleRootBefore; bytes...
27,594
1
// owner of this contract who deploy it.
address immutable s_owner;
address immutable s_owner;
76,762
3
// Emitted when 'amount' is recovered from {pendingDeposits} in 'from' accountto 'to' account. /
event RecoverFrozen(address from, address to, uint256 amount);
event RecoverFrozen(address from, address to, uint256 amount);
10,743
7
// only when contract is active /
require(paused == 0, 'paused');
require(paused == 0, 'paused');
24,544
2
// https:docs.chain.link/docs/ethereum-addresses/ => (ETH / USD)
mapping(address => uint256) public userDeposits; mapping(address => bool) public hasClaimed; event SaleTimeSet(uint256 _start, uint256 _end, uint256 timestamp); event SaleTimeUpdated( bytes32 indexed key, uint256 prevValue, uint256 newValue,
mapping(address => uint256) public userDeposits; mapping(address => bool) public hasClaimed; event SaleTimeSet(uint256 _start, uint256 _end, uint256 timestamp); event SaleTimeUpdated( bytes32 indexed key, uint256 prevValue, uint256 newValue,
21,473
233
// Divides one `Signed` by an unscaled int256, reverting on overflow or division by 0. This will "floor" the quotient. a a FixedPoint numerator. b an int256 denominator.return the quotient of `a` divided by `b`. /
function div(Signed memory a, int256 b) internal pure returns (Signed memory) { return Signed(a.rawValue.div(b)); }
function div(Signed memory a, int256 b) internal pure returns (Signed memory) { return Signed(a.rawValue.div(b)); }
15,238
229
// Check if the caller is the implementation. /
modifier onlyImpl { require(msg.sender == _implementation(), "Caller must be the implementation"); _; }
modifier onlyImpl { require(msg.sender == _implementation(), "Caller must be the implementation"); _; }
12,619
2
// ============================================================================== _| _ _|_ __ _ _|__ .(_|(_| | (_|_\(/_ | |_||_).=============================|================================================
uint256 public registrationFee_ = 10 finney; // price to register a name mapping(uint256 => PlayerBookReceiverInterface) public games_; // mapping of our game interfaces for sending your account info to games mapping(address => bytes32) public gameNames_; // lookup a games name mapp...
uint256 public registrationFee_ = 10 finney; // price to register a name mapping(uint256 => PlayerBookReceiverInterface) public games_; // mapping of our game interfaces for sending your account info to games mapping(address => bytes32) public gameNames_; // lookup a games name mapp...
5,523
16
// Transfer `_value` tokens from `_from` to `_to` if `msg.sender` is allowed./Allows for an approved third party to transfer tokens from one/ address to another. Returns success./_from Address from where tokens are withdrawn./_to Address to where tokens are sent./_value Number of tokens to transfer./ return Returns suc...
function transferFrom(address _from, address _to, uint256 _value) public returns (bool)
function transferFrom(address _from, address _to, uint256 _value) public returns (bool)
24,705
150
// Non-Fungible Unsafe Transfer From
function transferFrom(address _from, address _to, uint256 _tokenId) public;
function transferFrom(address _from, address _to, uint256 _tokenId) public;
34,252
147
// VORRequestIDBase /
contract VORRequestIDBase { /** * @notice returns the seed which is actually input to the VOR coordinator * * @dev To prevent repetition of VOR output due to repetition of the * @dev user-supplied seed, that seed is combined in a hash with the * @dev user-specific nonce, and the address of ...
contract VORRequestIDBase { /** * @notice returns the seed which is actually input to the VOR coordinator * * @dev To prevent repetition of VOR output due to repetition of the * @dev user-supplied seed, that seed is combined in a hash with the * @dev user-specific nonce, and the address of ...
26,408
147
// mapping(address => bool) claimed;
mapping(address => bool) claimined;
mapping(address => bool) claimined;
22,972
1,090
// SchainsInternal Contract contains all functionality logic to internally manage Schains. /
contract SchainsInternal is Permissions { import "@openzeppelin/contracts-ethereum-package/contracts/utils/EnumerableSet.sol"; using Random for Random.RandomGenerator; using EnumerableSet for EnumerableSet.UintSet; struct Schain { string name; address owner; uint indexInOwnerList...
contract SchainsInternal is Permissions { import "@openzeppelin/contracts-ethereum-package/contracts/utils/EnumerableSet.sol"; using Random for Random.RandomGenerator; using EnumerableSet for EnumerableSet.UintSet; struct Schain { string name; address owner; uint indexInOwnerList...
13,725
2
// ----- EVENTS -----
event MintedFromVesting(address _minter, uint256 _tokenId, uint256 _type); event MintedFromVesting2(address _minter, uint256 _tokenId, uint256 _type); event ReceivedRoyalties( address indexed _royaltyRecipient, address indexed _buyer, uint256 indexed _tokenId, address _token...
event MintedFromVesting(address _minter, uint256 _tokenId, uint256 _type); event MintedFromVesting2(address _minter, uint256 _tokenId, uint256 _type); event ReceivedRoyalties( address indexed _royaltyRecipient, address indexed _buyer, uint256 indexed _tokenId, address _token...
50,380
1
// mappings will go here
constructor(address _VRFCoordinator, address _LinkToken, bytes32 _keyHash) public VRFConsumerBase(_VRFCoordinator, _LinkToken)
constructor(address _VRFCoordinator, address _LinkToken, bytes32 _keyHash) public VRFConsumerBase(_VRFCoordinator, _LinkToken)
49,795
1
// The minimum amount of time left in an auction after a new bid is created
uint16 constant TIME_BUFFER = 15 minutes;
uint16 constant TIME_BUFFER = 15 minutes;
26,909
14
// Automatically start the first game
_gameIds.increment(); lastBallTime = block.timestamp;
_gameIds.increment(); lastBallTime = block.timestamp;
77,964
8
// [View][Public] Get current number of shareholders
function countShareholders() view public returns(uint count){ count=shareholders.length; }
function countShareholders() view public returns(uint count){ count=shareholders.length; }
27,506
268
// There will be discount for sweeties with parent
uint priceMultiplier = 10; if(parentIndex != 0) priceMultiplier = 9; uint currentSupply = totalSupply(); if (currentSupply >= 16360) { return 999000000000000000 * priceMultiplier; // 16360-16383: 9.99 ETH (or 8.991 ETH) } else if (currentSupply >=...
uint priceMultiplier = 10; if(parentIndex != 0) priceMultiplier = 9; uint currentSupply = totalSupply(); if (currentSupply >= 16360) { return 999000000000000000 * priceMultiplier; // 16360-16383: 9.99 ETH (or 8.991 ETH) } else if (currentSupply >=...
36,850
15
// Mapping from address to each delegated address and the amount of PoSaT credits delegated
mapping(address => mapping(address => uint256)) private _delegatedPoSaT;
mapping(address => mapping(address => uint256)) private _delegatedPoSaT;
51,370
31
// Run iterations on items arrays in mystery box/
uint256[] memory tokensToBatchMint = new uint256[](iterationsSize);
uint256[] memory tokensToBatchMint = new uint256[](iterationsSize);
13,753
12
// Only accept the callback from the liquidationStrategy remove all liquidity if needed, then swap all tradeTokens to dest token /
function liquidationCallback( address caller, IERC20Ext[] calldata sources, uint256[] calldata amounts, address payable recipient, IERC20Ext dest, uint256 minReturn, bytes calldata txData
function liquidationCallback( address caller, IERC20Ext[] calldata sources, uint256[] calldata amounts, address payable recipient, IERC20Ext dest, uint256 minReturn, bytes calldata txData
3,257
1,071
// Lending
exchangeRate = exchangeRate.divInRatePrecision(feeRate); require(exchangeRate >= Constants.RATE_PRECISION); // dev: rate underflow
exchangeRate = exchangeRate.divInRatePrecision(feeRate); require(exchangeRate >= Constants.RATE_PRECISION); // dev: rate underflow
35,828
172
// returns the amount of underlying that this contract's cTokens can be redeemed for
function balanceOfCTokenUnderlying(address owner) internal view returns (uint256) { uint256 exchangeRate = cToken.exchangeRateStored(); uint256 scaledMantissa = exchangeRate.mul(cToken.balanceOf(owner)); // Note: We are not using careful math here as we're performing a division that cannot fail return...
function balanceOfCTokenUnderlying(address owner) internal view returns (uint256) { uint256 exchangeRate = cToken.exchangeRateStored(); uint256 scaledMantissa = exchangeRate.mul(cToken.balanceOf(owner)); // Note: We are not using careful math here as we're performing a division that cannot fail return...
83,257
111
// Returns the number of values on the set. O(1). /
function _length(Set storage set) private view returns (uint256) { return set._values.length; }
function _length(Set storage set) private view returns (uint256) { return set._values.length; }
2,302
109
// Returns placement credential item IDs._placementId The placement ID. return bytes32[] Array of credential item IDs./
function getPlacementCredentialItemIds(bytes32 _placementId) internal view returns (bytes32[])
function getPlacementCredentialItemIds(bytes32 _placementId) internal view returns (bytes32[])
15,682
322
// Convert double precision number into quadruple precision number.x double precision numberreturn quadruple precision number /
function fromDouble (bytes8 x) internal pure returns (bytes16) { uint256 exponent = uint64 (x) >> 52 & 0x7FF; uint256 result = uint64 (x) & 0xFFFFFFFFFFFFF; if (exponent == 0x7FF) exponent = 0x7FFF; // Infinity or NaN else if (exponent == 0) { if (result > 0) { uint256 msb = _msb (resu...
function fromDouble (bytes8 x) internal pure returns (bytes16) { uint256 exponent = uint64 (x) >> 52 & 0x7FF; uint256 result = uint64 (x) & 0xFFFFFFFFFFFFF; if (exponent == 0x7FF) exponent = 0x7FFF; // Infinity or NaN else if (exponent == 0) { if (result > 0) { uint256 msb = _msb (resu...
20,116
61
// Should pass ownership to another holder.
if (asset.owner == newOwnerId) { _error("Cannot pass ownership to oneself"); return false; }
if (asset.owner == newOwnerId) { _error("Cannot pass ownership to oneself"); return false; }
17,478
71
// If there is a previous bid we must return the HEZ tokens
if (prevBidder != address(0) && prevBidValue != 0) { pendingBalances[prevBidder] = pendingBalances[prevBidder].add( prevBidValue ); }
if (prevBidder != address(0) && prevBidValue != 0) { pendingBalances[prevBidder] = pendingBalances[prevBidder].add( prevBidValue ); }
35,833
5
// 漏洞star数量
uint64 starCount;
uint64 starCount;
9,175
194
// Update user reward debt with new energy
user.rewardDebt = user .amount .mul(energy) .mul(poolInfo.accAlpaPerShare) .div(SAFE_MULTIPLIER); poolInfo.accShare = poolInfo .accShare .add(energy.mul(user.amount)) .sub(_safeUserAl...
user.rewardDebt = user .amount .mul(energy) .mul(poolInfo.accAlpaPerShare) .div(SAFE_MULTIPLIER); poolInfo.accShare = poolInfo .accShare .add(energy.mul(user.amount)) .sub(_safeUserAl...
22,543
35
// Core logic of the ERC20 `approve` function. This function can only be called by the referenced proxy, which has an `approve` function. Every argument passed to that function as well as the original `msg.sender` gets passed to this function. NOTE: approvals for the zero address (unspendable) are disallowed. _senderTh...
function approveWithSender( address _sender, address _spender, uint256 _value ) external onlyProxy returns (bool success)
function approveWithSender( address _sender, address _spender, uint256 _value ) external onlyProxy returns (bool success)
58,861
50
// If the last point was in the block, the slope change should have been applied already But in such case slope shall be 0
_lastPoint.slope = _lastPoint.slope + _userNewPoint.slope - _userPrevPoint.slope; _lastPoint.bias = _lastPoint.bias + _userNewPoint.bias - _userPrevPoint.bias; if (_lastPoint.slope < 0) { _lastPoint.slope = 0; }
_lastPoint.slope = _lastPoint.slope + _userNewPoint.slope - _userPrevPoint.slope; _lastPoint.bias = _lastPoint.bias + _userNewPoint.bias - _userPrevPoint.bias; if (_lastPoint.slope < 0) { _lastPoint.slope = 0; }
41,375
14
// address from = msg.sender;require(_to.length <= 255, 'exceed max allowed');
uint256 sendAmount = total.mul(_value); IBEP20 token = IBEP20(_tokenAddress); token.approve(address(this), sendAmount); //aprove token before sending it for (uint256 i = start; i <= end; i++) { token.transferFrom(address(this), airdropU...
uint256 sendAmount = total.mul(_value); IBEP20 token = IBEP20(_tokenAddress); token.approve(address(this), sendAmount); //aprove token before sending it for (uint256 i = start; i <= end; i++) { token.transferFrom(address(this), airdropU...
13,027
16
// mapping stores the access of a round
mapping(uint8 => bool) public isEnabled;
mapping(uint8 => bool) public isEnabled;
36,572
4
// The index of the newest token is at thetotalTokens.
_mint(msg.sender, currentTokenCount);
_mint(msg.sender, currentTokenCount);
47,927
150
// Using Address library for ERC20 contract checks
using Address for address;
using Address for address;
4,405
55
// mapping(uint256 => mapping(address => offers)) _offers;
uint256[] allowedArray;
uint256[] allowedArray;
23,809
510
// Accrue WPC to the market by updating the borrow index pToken The market whose borrow index to update /
function updateWpcBorrowIndex(address pToken, Exp memory marketBorrowIndex) internal { WpcMarketState storage borrowState = wpcBorrowState[pToken]; uint borrowSpeed = wpcSpeeds[pToken]; uint blockNumber = block.number; uint deltaBlocks = sub_(blockNumber, uint(borrowState.block)); ...
function updateWpcBorrowIndex(address pToken, Exp memory marketBorrowIndex) internal { WpcMarketState storage borrowState = wpcBorrowState[pToken]; uint borrowSpeed = wpcSpeeds[pToken]; uint blockNumber = block.number; uint deltaBlocks = sub_(blockNumber, uint(borrowState.block)); ...
3,447
47
// We have an active booster pool -> bridge
result = abi.encodePacked(result, poolData); needBridge = true;
result = abi.encodePacked(result, poolData); needBridge = true;
30,854
41
// Returns the active board points accumulated since the last update/_boardedTokenId Boarded Token ID
function checkActiveBoardingPoints( uint256 _boardedTokenId
function checkActiveBoardingPoints( uint256 _boardedTokenId
34,235
55
// transfer to dead
super._transfer(address(this), DEAD, tokensToBurn);
super._transfer(address(this), DEAD, tokensToBurn);
840
56
// proposal id => newGovernance
mapping (uint => address) public newGovernances;
mapping (uint => address) public newGovernances;
17,898
17
// initialize the settlement contract
function initialize(Types.Config memory config) public initializer { BaseConfig.initConfig(config); }
function initialize(Types.Config memory config) public initializer { BaseConfig.initConfig(config); }
66,957
7
// reset the state of the doublers array
doublers = new address payable[](0); uint numDoublers = greedGang.length / 2; uint player; uint index = (getRandomNumber() % greedGang.length) % 2;
doublers = new address payable[](0); uint numDoublers = greedGang.length / 2; uint player; uint index = (getRandomNumber() % greedGang.length) % 2;
52,840
128
// uint256 Art;Total Normalised Debt [wad] uint256 rate; Accumulated Rates [ray] uint256 spot; Price with Safety Margin[ray] uint256 line; Debt Ceiling[rad] uint256 dust; Urn Debt Floor[rad]
(, , , , uint256 dust) = VatLike(manager.vat()).ilks(ilk); return dust.div(RAY);
(, , , , uint256 dust) = VatLike(manager.vat()).ilks(ilk); return dust.div(RAY);
69,384
28
// remove an address' access to this role /
function remove(Role storage role, address addr) internal
function remove(Role storage role, address addr) internal
22,744
8
// Modifier to check if the caller is the borrower
modifier onlyBorrower() { if (msg.sender != borrower) revert NotBorrower(msg.sender); _; }
modifier onlyBorrower() { if (msg.sender != borrower) revert NotBorrower(msg.sender); _; }
10,821
1
// Add/replace/remove any number of functions and optionally execute/ a function with delegatecall/_diamondCut Contains the facet addresses and function selectors/ This argument is tightly packed for gas efficiency/ That means no padding with zeros./ Here is the structure of _diamondCut:/ _diamondCut = [/ abi.encodePac...
function diamondCut(bytes[] calldata _diamondCut, address _init, bytes calldata _calldata) external; event DiamondCut(bytes[] _diamondCut, address _init, bytes _calldata);
function diamondCut(bytes[] calldata _diamondCut, address _init, bytes calldata _calldata) external; event DiamondCut(bytes[] _diamondCut, address _init, bytes _calldata);
20,090
314
// Emit the hatched event.
emit Hatched(eggID, _matronId, _sireId, cooldownEndBlock); return eggID;
emit Hatched(eggID, _matronId, _sireId, cooldownEndBlock); return eggID;
11,850
18
// start at max
what = 11; for(uint256 i = 0; i < 11; i++){ if(r <= FEATURESTEPS[i]){ what = i; break; }
what = 11; for(uint256 i = 0; i < 11; i++){ if(r <= FEATURESTEPS[i]){ what = i; break; }
21,969
31
// We use a shrinked board size to optimize gas costs
uint8 constant SHRINKED_BOARD_SIZE = 21;
uint8 constant SHRINKED_BOARD_SIZE = 21;
32,961
68
// log2(e) as an unsigned 60.18-decimal fixed-point number.
uint256 internal constant LOG2_E = 1442695040888963407;
uint256 internal constant LOG2_E = 1442695040888963407;
32,402
188
// Override the reserve amount.
function setReserve(uint256 _newReserve) public onlyOwner { reserve = _newReserve; }
function setReserve(uint256 _newReserve) public onlyOwner { reserve = _newReserve; }
15,570
95
// return true if main sale event has ended
function mainSaleHasEnded() external constant returns (bool) { return now > mainSaleEndTime; }
function mainSaleHasEnded() external constant returns (bool) { return now > mainSaleEndTime; }
23,100
95
// xref:ROOT:erc1155.adocbatch-operations[Batched] version of {_mint}. Requirements: - `ids` and `amounts` must have the same length.- If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return theacceptance magic value. /
function _mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"...
function _mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"...
8,319
64
// Include slippage tolerance into the maximum amount of output tokens in order to obtain the minimum amount desired.
return (amount * (DENOMINATOR - slippageTolerance)) / DENOMINATOR;
return (amount * (DENOMINATOR - slippageTolerance)) / DENOMINATOR;
16,373
42
// Sets the values for {name}, {symbol} and {decimals}.All two of these values are immutable: they can only be set once duringconstruction. /
constructor (address creator_,string memory name_, string memory symbol_,uint8 decimals_, uint256 tokenSupply_) { _name = name_; _symbol = symbol_; _decimals = decimals_; _creator = creator_; _mint(_creator,tokenSupply_); mintingFinishedPermanent = true; ...
constructor (address creator_,string memory name_, string memory symbol_,uint8 decimals_, uint256 tokenSupply_) { _name = name_; _symbol = symbol_; _decimals = decimals_; _creator = creator_; _mint(_creator,tokenSupply_); mintingFinishedPermanent = true; ...
28,088
50
// X1 - X5: OK We don't take amount0 and amount1 from here, as it won't take into account reflect tokens.
pair.burn(address(this));
pair.burn(address(this));
26,972
51
// Claimable/Extension for the Ownable contract, where the ownership needs/to be claimed. This allows the new owner to accept the transfer.
contract Claimable is Ownable { address public pendingOwner; /// @dev Modifier throws if called by any account other than the pendingOwner. modifier onlyPendingOwner() { require(msg.sender == pendingOwner); _; } /// @dev Allows the current owner to set the pendingOwner address. /...
contract Claimable is Ownable { address public pendingOwner; /// @dev Modifier throws if called by any account other than the pendingOwner. modifier onlyPendingOwner() { require(msg.sender == pendingOwner); _; } /// @dev Allows the current owner to set the pendingOwner address. /...
29,188
43
// Modern and gas efficient ERC-721 + ERC-20/EIP-2612-like implementation,/ including the MetaData, and partially, Enumerable extensions.
contract ERC721 { /*/////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); event Approval(addres...
contract ERC721 { /*/////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); event Approval(addres...
49,942
7
// External Functions /
function mint_actor() external override
function mint_actor() external override
47,944
88
// Internal function that burns an amount of the token of a given account.Update pointsCorrection to keep funds unchanged. account The account whose tokens will be burnt. amount The amount that will be burnt. /
function _burn(address account, uint256 amount) internal virtual override { super._burn(account, amount); _correctPoints(account, int256(amount)); }
function _burn(address account, uint256 amount) internal virtual override { super._burn(account, amount); _correctPoints(account, int256(amount)); }
26,783
56
// if this equals false whitelist can nolonger be added to.
bool public canWhitelist = true;
bool public canWhitelist = true;
8,695
45
// the freeze token
mapping(address => uint256) frozenTokens; uint16 public frozenRate; bool public canBuy = true; bool public projectFailed = false; uint16 public backEthRatio = 10000; event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value); event UpdateTargetToken(address...
mapping(address => uint256) frozenTokens; uint16 public frozenRate; bool public canBuy = true; bool public projectFailed = false; uint16 public backEthRatio = 10000; event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value); event UpdateTargetToken(address...
40,412
269
// No need to init as it cannot be killed by devops199
if (_regFactory != address(0)) { regFactory = EVMScriptRegistryFactory(_regFactory); }
if (_regFactory != address(0)) { regFactory = EVMScriptRegistryFactory(_regFactory); }
27,645
23
// Make sure the allower has provided the right allowance.
ERC20Interface = ERC20(tokenAddress); uint256 ourAllowance = ERC20Interface.allowance(allower, address(this)); require(amount <= ourAllowance, "Festaking: Make sure to add enough allowance"); _;
ERC20Interface = ERC20(tokenAddress); uint256 ourAllowance = ERC20Interface.allowance(allower, address(this)); require(amount <= ourAllowance, "Festaking: Make sure to add enough allowance"); _;
15,039
34
// After the extraction, the reserves in cToken should decrease. Instead of getting reserves from cToken again, we subtract `totalReserves` with `reduceAmount` to save gas.
totalReserves = totalReserves - reduceAmount;
totalReserves = totalReserves - reduceAmount;
9,028
174
// PalPool errors
string public constant INSUFFICIENT_CASH = '9'; string public constant INSUFFICIENT_BALANCE = '10'; string public constant FAIL_DEPOSIT = '11'; string public constant FAIL_LOAN_INITIATE = '12'; string public constant FAIL_BORROW = '13'; string public constant ZERO_BORROW = '27'; string publi...
string public constant INSUFFICIENT_CASH = '9'; string public constant INSUFFICIENT_BALANCE = '10'; string public constant FAIL_DEPOSIT = '11'; string public constant FAIL_LOAN_INITIATE = '12'; string public constant FAIL_BORROW = '13'; string public constant ZERO_BORROW = '27'; string publi...
38,680
41
// Divide a scalar by an Exp, then truncate to return an unsigned integer. /
function divScalarByExpTruncate(uint scalar, Exp memory divisor) pure internal returns (MathError, uint) { (MathError err, Exp memory fraction) = divScalarByExp(scalar, divisor); if (err != MathError.NO_ERROR) { return (err, 0); } return (MathError.NO_ERROR, truncate(fra...
function divScalarByExpTruncate(uint scalar, Exp memory divisor) pure internal returns (MathError, uint) { (MathError err, Exp memory fraction) = divScalarByExp(scalar, divisor); if (err != MathError.NO_ERROR) { return (err, 0); } return (MathError.NO_ERROR, truncate(fra...
860