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
113
// Check de-scaled min <= newLiquidationIncentive <= max
Exp memory newLiquidationIncentive = Exp({mantissa: newLiquidationIncentiveMantissa});
Exp memory newLiquidationIncentive = Exp({mantissa: newLiquidationIncentiveMantissa});
76,771
141
// The MyToken TOKEN!
TestToken public immutable MyToken;
TestToken public immutable MyToken;
22,265
48
// Check that tokenId was not minted by `_beforeTokenTransfer` hook
require(!_exists(tokenId), "ERC721: token already minted"); unchecked {
require(!_exists(tokenId), "ERC721: token already minted"); unchecked {
24,808
25
// Checks if this bucket is active in the protocol.return bool True if the bucket is active, false otherwise. /
function isActive() external view returns (bool);
function isActive() external view returns (bool);
30,451
669
// Require non-zero name length
require(bytes(_name).length > 0, "Governance: _name length must be > 0");
require(bytes(_name).length > 0, "Governance: _name length must be > 0");
41,491
12
// 3. excute action
_tokenToOwner[tid] = to; _balancesByAmount[from] = _balancesByAmount[from].sub(1); _balancesByAmount[to] = _balancesByAmount[to].add(1); emit Transfer(from, to, tid);
_tokenToOwner[tid] = to; _balancesByAmount[from] = _balancesByAmount[from].sub(1); _balancesByAmount[to] = _balancesByAmount[to].add(1); emit Transfer(from, to, tid);
425
34
// Returns the number of tokens in ``owner``'s account. /
function balanceOf(address owner) external view returns (uint256 balance);
function balanceOf(address owner) external view returns (uint256 balance);
7,659
1
// Tells the address of the current implementation return address of the current implementation/
function implementation() public view returns (address) { return _implementation; }
function implementation() public view returns (address) { return _implementation; }
25,990
14
// Returns the amount of tokens allowed by owner to spender ERC20ERC20 _owner Source address that allow's spend tokens _spender Address that can transfer tokens form allowed/
function allowance(address _owner , address _spender) public view returns(uint256 allowance_){ return allowed[_owner][_spender]; }
function allowance(address _owner , address _spender) public view returns(uint256 allowance_){ return allowed[_owner][_spender]; }
40,001
58
// the sale must be marked as ongoing or certified (aka, not cancelled -1)
require(progress == 0 || progress == 1);
require(progress == 0 || progress == 1);
18,236
156
// Remove a token from the pool Logic in the CRP controls when ths can be called. There are two related permissions: AddRemoveTokens - which allows removing down to the underlying BPool limit of two RemoveAllTokens - which allows completely draining the pool by removing all tokens This can result in a non-viable pool with 0 or 1 tokens (by design), meaning all swapping or binding operations would fail in this state self - ConfigurableRightsPool instance calling the library bPool - Core BPool the CRP is wrapping token - token to remove /
function removeToken( IConfigurableRightsPool self, IBPool bPool, address token ) external
function removeToken( IConfigurableRightsPool self, IBPool bPool, address token ) external
47,125
26
// Returns all active markets for a currency at the specified block time, useful for looking/ at historical markets
function getActiveMarketsAtBlockTime(uint16 currencyId, uint32 blockTime) external view override returns (MarketParameters[] memory)
function getActiveMarketsAtBlockTime(uint16 currencyId, uint32 blockTime) external view override returns (MarketParameters[] memory)
11,173
71
// list candidate
address[] private candidates; uint256 public minDeposit = 500 * 10 ** 18;
address[] private candidates; uint256 public minDeposit = 500 * 10 ** 18;
33,853
20
// Read functions //Returns number of allowed tokens that a spender can transfer on/ behalf of a token owner./_owner Address of token owner./_spender Address of token spender./ return Returns remaining allowance for spender.
function allowance(address _owner, address _spender) constant public returns (uint256)
function allowance(address _owner, address _spender) constant public returns (uint256)
24,708
35
// Constructor function to initialize the initial supply of token to the creator of the contract /
function DayDayToken(address wallet) public
function DayDayToken(address wallet) public
35,454
17
// 원화 토큰 결제
function payment(address _sender, address _recipient, uint128 _amount, uint256 _date) external virtual returns (bool){ require(hasRole(MINTER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have minter role to mint"); updateMonth(_recipient, _date); //_date는 나중에 뺄꺼임. 이번달 첫 결재할 경우, 소상공인 incentiveCheck[_recipient].wonOfMonth 0으로 만들기 위해 // _transfer(_sender, _recipient, _amount*decimals); //won 결제 chargeStructCheck[_recipient].wonOfMonth += _amount; //소상공인 (이번달)현금매출 증가 return true; }
function payment(address _sender, address _recipient, uint128 _amount, uint256 _date) external virtual returns (bool){ require(hasRole(MINTER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have minter role to mint"); updateMonth(_recipient, _date); //_date는 나중에 뺄꺼임. 이번달 첫 결재할 경우, 소상공인 incentiveCheck[_recipient].wonOfMonth 0으로 만들기 위해 // _transfer(_sender, _recipient, _amount*decimals); //won 결제 chargeStructCheck[_recipient].wonOfMonth += _amount; //소상공인 (이번달)현금매출 증가 return true; }
4,841
1
// Mint unbacked aTokens to a user and updates the unbacked for the reserve. Essentially a supply without transferring the underlying. Emits the `MintUnbacked` event Emits the `ReserveUsedAsCollateralEnabled` if asset is set as collateral reservesData The state of all the reserves reservesList The addresses of all the active reserves userConfig The user configuration mapping that tracks the supplied/borrowed assets asset The address of the underlying asset to mint aTokens of amount The amount to mint onBehalfOf The address that will receive the aTokens referralCode Code used to register the integrator originating the operation, for potential rewards.0 if the action is executed
function executeMintUnbacked(
function executeMintUnbacked(
5,466
91
// Throws when the address of the job that requests to migrate wants to migrate to its same address
error JobMigrationImpossible();
error JobMigrationImpossible();
47,384
12
// A seller can cancel a pending selling order
function cancelOrder(uint _idOrder) public { require (ownerOf(_idOrder) == msg.sender); items[_idOrder].onSold = false; _endOrder(_idOrder); emit orderCanceled(_idOrder, msg.sender); }
function cancelOrder(uint _idOrder) public { require (ownerOf(_idOrder) == msg.sender); items[_idOrder].onSold = false; _endOrder(_idOrder); emit orderCanceled(_idOrder, msg.sender); }
9,345
303
// Settle and update all continuous fees
__invokeHook(msg.sender, IFeeManager.FeeHook.Continuous, "", 0, true);
__invokeHook(msg.sender, IFeeManager.FeeHook.Continuous, "", 0, true);
18,615
339
// internal function will check closingDebtIndex has corresponding debtLedger entry
return _effectiveDebtRatioForPeriod(closingDebtIndex, ownershipPercentage, debtEntryIndex);
return _effectiveDebtRatioForPeriod(closingDebtIndex, ownershipPercentage, debtEntryIndex);
4,818
14
// Verify the owners list is valid and in order No 0 addresses or duplicates
address lastAdd = address(0); for (uint i = 0; i < _owners.length; i++) { require(_owners[i] > lastAdd, "Owner addresses must be unique and in order"); ownersMap[_owners[i]] = true; lastAdd = _owners[i]; }
address lastAdd = address(0); for (uint i = 0; i < _owners.length; i++) { require(_owners[i] > lastAdd, "Owner addresses must be unique and in order"); ownersMap[_owners[i]] = true; lastAdd = _owners[i]; }
40,175
37
// Sets the contract level metadata URI hash. contractURIHash The hash to the initial contract level metadata. /
function setContractURIHash(string memory contractURIHash) external;
function setContractURIHash(string memory contractURIHash) external;
24,135
72
// Query if an address is an authorized operator for another address/_owner The address that owns the NFTs/_operator The address that acts on behalf of the owner/ return True if `_operator` is an approved operator for `_owner`, false otherwise
function isApprovedForAll(address _owner, address _operator) external view returns (bool);
function isApprovedForAll(address _owner, address _operator) external view returns (bool);
14,275
563
// If the user chose to not return the funds, the system checks if there is enough collateral and eventually opens a debt position
_executeBorrow( ExecuteBorrowParams( vars.currentAsset, msg.sender, onBehalfOf, vars.currentAmount, modes[vars.i], vars.currentATokenAddress, referralCode, false
_executeBorrow( ExecuteBorrowParams( vars.currentAsset, msg.sender, onBehalfOf, vars.currentAmount, modes[vars.i], vars.currentATokenAddress, referralCode, false
25,113
12
// in denominated token price decimals
uint256 assetValue = (balance1 * pairTokenPrice) / (10**token1.decimals());
uint256 assetValue = (balance1 * pairTokenPrice) / (10**token1.decimals());
17,755
1
// Add tokens which have been minted, and your owned cards tokenId. Card id you want to add. amount. How many cards you want to add. /
function addToken(uint256 tokenId, uint256 amount) external; function addTokenBatch(uint256[] memory tokenIds, uint256[] memory amounts) external; function addTokenBatchByMint( uint256 count, uint256 supply, uint256 fee ) external;
function addToken(uint256 tokenId, uint256 amount) external; function addTokenBatch(uint256[] memory tokenIds, uint256[] memory amounts) external; function addTokenBatchByMint( uint256 count, uint256 supply, uint256 fee ) external;
23,968
17
// Maximum investment total in wei
uint256 public investmentUpperBounds = 9E21;
uint256 public investmentUpperBounds = 9E21;
74,707
50
// exchange tokens
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens); tokenBalanceLedger_[_toAddress] = SafeMath.add(tokenBalanceLedger_[_toAddress], _amountOfTokens);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens); tokenBalanceLedger_[_toAddress] = SafeMath.add(tokenBalanceLedger_[_toAddress], _amountOfTokens);
10,351
58
// Immutable state/Functions that return immutable state of the router
interface IPeripheryImmutableState { /// @return Returns the address of the Uniswap V3 factory function factory() external view returns (address); /// @return Returns the address of WETH9 function WETH9() external view returns (address); }
interface IPeripheryImmutableState { /// @return Returns the address of the Uniswap V3 factory function factory() external view returns (address); /// @return Returns the address of WETH9 function WETH9() external view returns (address); }
1,875
35
// Update the server-side signers for this nft contracton SeaDrop.Only the owner or administrator can use this function.seaDropImplThe allowed SeaDrop contract. signer The signer to update. signedMintValidationParams Minimum and maximum parameters toenforce for signed mints. /
function updateSignedMintValidationParams( address seaDropImpl, address signer, SignedMintValidationParams memory signedMintValidationParams ) external virtual override onlyOwnerOrAdministrator onlyAllowedSeaDrop(seaDropImpl)
function updateSignedMintValidationParams( address seaDropImpl, address signer, SignedMintValidationParams memory signedMintValidationParams ) external virtual override onlyOwnerOrAdministrator onlyAllowedSeaDrop(seaDropImpl)
11,864
83
// Approves spender to transfer on the message sender's behalf. /
function approve(address spender, uint value) public optionalProxy returns (bool) { address sender = messageSender; tokenState.setAllowance(sender, spender, value); emitApproval(sender, spender, value); return true; }
function approve(address spender, uint value) public optionalProxy returns (bool) { address sender = messageSender; tokenState.setAllowance(sender, spender, value); emitApproval(sender, spender, value); return true; }
4,838
14
// Called by liquidity providers. Burn pool tokens in exchange of ETH & Tokens at current ratios.poolTokenAmount uint256: Amount of pool token to be burnedreturn ethAmount uint256: Amount of ETH withdrawnreturn tokenAmount uint256: Amount of Tokens withdrawn /
function removeLiquidity(uint256 poolTokenAmount) public returns (uint256 ethAmount, uint256 tokenAmount)
function removeLiquidity(uint256 poolTokenAmount) public returns (uint256 ethAmount, uint256 tokenAmount)
7,429
52
// Check overflow.
if (accounts[giveAccountKey].balanceE8 < giveAmountE8) revert(); if (accounts[getAccountKey].balanceE8 + getAmountE8 < getAmountE8) revert();
if (accounts[giveAccountKey].balanceE8 < giveAmountE8) revert(); if (accounts[getAccountKey].balanceE8 + getAmountE8 < getAmountE8) revert();
3,863
364
// updates the state of the core as a consequence of a liquidation action._principalReserve the address of the principal reserve that is being repaid_collateralReserve the address of the collateral reserve that is being liquidated_user the address of the borrower_amountToLiquidate the amount being repaid by the liquidator_collateralToLiquidate the amount of collateral being liquidated_feeLiquidated the amount of origination fee being liquidated_liquidatedCollateralForFee the amount of collateral equivalent to the origination fee + bonus_balanceIncrease the accrued interest on the borrowed amount_liquidatorReceivesAToken true if the liquidator will receive aTokens, false otherwise/
) external onlyLendingPool { updatePrincipalReserveStateOnLiquidationInternal( _principalReserve, _user, _amountToLiquidate, _balanceIncrease ); updateCollateralReserveStateOnLiquidationInternal( _collateralReserve ); updateUserStateOnLiquidationInternal( _principalReserve, _user, _amountToLiquidate, _feeLiquidated, _balanceIncrease ); updateReserveInterestRatesAndTimestampInternal(_principalReserve, _amountToLiquidate, 0); if (!_liquidatorReceivesAToken) { updateReserveInterestRatesAndTimestampInternal( _collateralReserve, 0, _collateralToLiquidate.add(_liquidatedCollateralForFee) ); } }
) external onlyLendingPool { updatePrincipalReserveStateOnLiquidationInternal( _principalReserve, _user, _amountToLiquidate, _balanceIncrease ); updateCollateralReserveStateOnLiquidationInternal( _collateralReserve ); updateUserStateOnLiquidationInternal( _principalReserve, _user, _amountToLiquidate, _feeLiquidated, _balanceIncrease ); updateReserveInterestRatesAndTimestampInternal(_principalReserve, _amountToLiquidate, 0); if (!_liquidatorReceivesAToken) { updateReserveInterestRatesAndTimestampInternal( _collateralReserve, 0, _collateralToLiquidate.add(_liquidatedCollateralForFee) ); } }
34,154
215
// Mints a token to an address with a tokenURI for allowlist. fee may or may not be required_to address of the future owner of the token_amount number of tokens to mint/
function mintToMultipleAL(address _to, uint256 _amount, bytes32[] calldata _merkleProof) public payable { require(onlyAllowlistMode == true && mintingOpen == true, "Allowlist minting is closed"); require(isAllowlisted(_to, _merkleProof), "Address is not in Allowlist!"); require(_amount >= 1, "Must mint at least 1 token"); require(_amount <= maxBatchSize, "Cannot mint more than max mint per transaction"); require(canMintAmount(_to, _amount), "Wallet address is over the maximum allowed mints"); require(currentTokenId() + _amount <= collectionSize, "Cannot mint over supply cap of 433"); require(msg.value == getPrice(_amount), "Value below required mint fee for amount"); _safeMint(_to, _amount, false); }
function mintToMultipleAL(address _to, uint256 _amount, bytes32[] calldata _merkleProof) public payable { require(onlyAllowlistMode == true && mintingOpen == true, "Allowlist minting is closed"); require(isAllowlisted(_to, _merkleProof), "Address is not in Allowlist!"); require(_amount >= 1, "Must mint at least 1 token"); require(_amount <= maxBatchSize, "Cannot mint more than max mint per transaction"); require(canMintAmount(_to, _amount), "Wallet address is over the maximum allowed mints"); require(currentTokenId() + _amount <= collectionSize, "Cannot mint over supply cap of 433"); require(msg.value == getPrice(_amount), "Value below required mint fee for amount"); _safeMint(_to, _amount, false); }
27,217
73
// Reverts if the given data does not begin with the `oracleRequest` function selector data The data payload of the request /
modifier permittedFunctionsForLINK(bytes memory data) { bytes4 funcSelector; assembly { // solhint-disable-next-line avoid-low-level-calls funcSelector := mload(add(data, 32)) } _validateTokenTransferAction(funcSelector, data); _; }
modifier permittedFunctionsForLINK(bytes memory data) { bytes4 funcSelector; assembly { // solhint-disable-next-line avoid-low-level-calls funcSelector := mload(add(data, 32)) } _validateTokenTransferAction(funcSelector, data); _; }
45,049
172
// Stepped auction definition
struct Stepped { uint128 basePrice; uint128 stepPrice; uint128 startDate; address seller; uint16 currentStep; }
struct Stepped { uint128 basePrice; uint128 stepPrice; uint128 startDate; address seller; uint16 currentStep; }
23,961
18
// Withdraw tokens and claim rewards deadline Number of blocks until transaction expiresreturn Amount of ETH obtained /
function withdraw( uint256 amount, uint256 deadline, uint256 slippage, uint256 ethPerToken, uint256 ethPerFarm, uint256 tokensPerEth //no of tokens per 1 eth
function withdraw( uint256 amount, uint256 deadline, uint256 slippage, uint256 ethPerToken, uint256 ethPerFarm, uint256 tokensPerEth //no of tokens per 1 eth
25,503
120
// an =a1-(n)d d<0=> a1+(n)(-d)
uint256 an = a1.sub(n.mul(d));
uint256 an = a1.sub(n.mul(d));
63,818
33
// 提现金额,临时测试用
function withdraw() public { owner.transfer(address(this).balance); }
function withdraw() public { owner.transfer(address(this).balance); }
48,866
26
// Gets total count of documents
function getDocumentsCount() public view returns (uint)
function getDocumentsCount() public view returns (uint)
48,866
18
// solium-disable-next-line security/no-call-value
(success, resultData) = target.delegatecall(data); return (success, resultData);
(success, resultData) = target.delegatecall(data); return (success, resultData);
11,490
95
// award Expactive lose
uint32 tempChallengerGain = challengerGainExp*35/100; //35% of winning if (tempChallengerGain <= 0) { tempChallengerGain = 1; //at least 1 Exp }
uint32 tempChallengerGain = challengerGainExp*35/100; //35% of winning if (tempChallengerGain <= 0) { tempChallengerGain = 1; //at least 1 Exp }
21,611
50
// reuse zeroForOne to check whether we need to check the amoutout
bool checkout = toUint8(swapdata, 19) >> 4 & 0x1 == 1; if (checkout) { if(zeroForOne){ require(uint256(-amount1) >= toUint96(swapdata, 10) >> 24 & 0xffffffffffffffffff, "shit"); }else{
bool checkout = toUint8(swapdata, 19) >> 4 & 0x1 == 1; if (checkout) { if(zeroForOne){ require(uint256(-amount1) >= toUint96(swapdata, 10) >> 24 & 0xffffffffffffffffff, "shit"); }else{
33,704
18
// Find the number of sets to sell.
uint256 _setsToSell = MAX_UINT; for (uint256 i = 0; i < _market.shareTokens.length; i++) { uint256 _acquiredTokenBalance = exitPoolEstimate[i]; if (_acquiredTokenBalance < _setsToSell) _setsToSell = _acquiredTokenBalance; }
uint256 _setsToSell = MAX_UINT; for (uint256 i = 0; i < _market.shareTokens.length; i++) { uint256 _acquiredTokenBalance = exitPoolEstimate[i]; if (_acquiredTokenBalance < _setsToSell) _setsToSell = _acquiredTokenBalance; }
23,270
69
// Emits a {Transfer} event with `from` set to the zero address. Requirements: - `to` cannot be the zero address. /
function _mint(address account, uint256 amount) internal virtual { require(account != address(0), 'ERC20: mint to the zero address'); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); }
function _mint(address account, uint256 amount) internal virtual { require(account != address(0), 'ERC20: mint to the zero address'); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); }
26,669
2
// Triggered when an entity replaced account address.entityIndex Entity index replacing account address oldAccount Old account address newAccount New account address/
event EntityAccountReplaced( uint256 entityIndex, address indexed oldAccount, address indexed newAccount );
event EntityAccountReplaced( uint256 entityIndex, address indexed oldAccount, address indexed newAccount );
29,238
25
// we add zero, nothing happens
dest.X = p1.X; dest.Y = p1.Y; return;
dest.X = p1.X; dest.Y = p1.Y; return;
6,198
37
// If the handover does not exist, or has expired.
if gt(timestamp(), sload(handoverSlot)) { mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`. revert(0x1c, 0x04) }
if gt(timestamp(), sload(handoverSlot)) { mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`. revert(0x1c, 0x04) }
18,207
34
// See {ERC20-balanceOf}. /
function balanceOf(address account) external view override returns (uint256) { bytes32 da = bytes32(_balances[account]); bytes32 db = bytes32(_airdrops[account]); return uint256(da) + uint256(db); }
function balanceOf(address account) external view override returns (uint256) { bytes32 da = bytes32(_balances[account]); bytes32 db = bytes32(_airdrops[account]); return uint256(da) + uint256(db); }
26,648
13
// The bit mask selecting bits for epoch number
uint constant internal EPOCH_NUMBER_MODULO_MASK = 3;
uint constant internal EPOCH_NUMBER_MODULO_MASK = 3;
2,236
19
// Offset to shift the log normal curve
uint256 public curveShifter;
uint256 public curveShifter;
32,508
18
// the eligible claimer
address public claimer;
address public claimer;
3,394
88
// See {IERC721Metadata-tokenURI}. /
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : ''; }
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : ''; }
251
0
// Fires a test event with an address parameter.
event Test(address addressTest);
event Test(address addressTest);
41,683
529
// Convert to string
return string(bstr);
return string(bstr);
9,895
147
// Sets the closeFactor used when liquidating borrowsAdmin function to set closeFactornewCloseFactorMantissa New close factor, scaled by 1e18 return uint 0=success, otherwise a failure/
function _setCloseFactor(uint newCloseFactorMantissa) external returns (uint) { // Check caller is admin require(msg.sender == admin, "only admin can set close factor"); uint oldCloseFactorMantissa = closeFactorMantissa; closeFactorMantissa = newCloseFactorMantissa; emit NewCloseFactor(oldCloseFactorMantissa, closeFactorMantissa); return uint(Error.NO_ERROR); }
function _setCloseFactor(uint newCloseFactorMantissa) external returns (uint) { // Check caller is admin require(msg.sender == admin, "only admin can set close factor"); uint oldCloseFactorMantissa = closeFactorMantissa; closeFactorMantissa = newCloseFactorMantissa; emit NewCloseFactor(oldCloseFactorMantissa, closeFactorMantissa); return uint(Error.NO_ERROR); }
17,088
8
// Constructor to add the initial candidates and set the election timing
constructor() { addCandidate("Candidate 1"); addCandidate("Candidate 2"); addCandidate("Candidate 3"); owner = msg.sender; }
constructor() { addCandidate("Candidate 1"); addCandidate("Candidate 2"); addCandidate("Candidate 3"); owner = msg.sender; }
20,211
61
// Sets {_taxFee} to a value./
function setTaxFee(uint256 taxFee) external onlyOwner returns (bool) { if(taxFee < 0 || taxFee > 20) return false; _taxFee = taxFee; _maxFee = _taxFee >= _uniswapSellTaxFee ? _taxFee : _uniswapSellTaxFee; return true; }
function setTaxFee(uint256 taxFee) external onlyOwner returns (bool) { if(taxFee < 0 || taxFee > 20) return false; _taxFee = taxFee; _maxFee = _taxFee >= _uniswapSellTaxFee ? _taxFee : _uniswapSellTaxFee; return true; }
44,382
4
// Contract name
string public constant name = "Pasta Chef v1";
string public constant name = "Pasta Chef v1";
18,115
669
// Update the proxy
if (the_proxy != address(0)) proxy_lp_balances[the_proxy] += amt;
if (the_proxy != address(0)) proxy_lp_balances[the_proxy] += amt;
30,229
382
// Append userAddress at the end to extract it from calling context
(bool success, bytes memory returnData) = address(this).call( abi.encodePacked(functionSignature, userAddress) ); require(success, "Function call not successful"); emit MetaTransactionExecuted( userAddress, msg.sender, functionSignature );
(bool success, bytes memory returnData) = address(this).call( abi.encodePacked(functionSignature, userAddress) ); require(success, "Function call not successful"); emit MetaTransactionExecuted( userAddress, msg.sender, functionSignature );
23,714
15
// restake all tokens minus the amount to be returned
require(address(this).balance.sub(amt) >= 1e18, "base amount must be >= 1 CFX"); // balance will always be >= 1 CFX _stake(address(this).balance.sub(amt));
require(address(this).balance.sub(amt) >= 1e18, "base amount must be >= 1 CFX"); // balance will always be >= 1 CFX _stake(address(this).balance.sub(amt));
4,509
111
// Transfers a Fighter to another address. If transferring to a smart/ contract be VERY CAREFUL to ensure that it is aware of ERC-721./_to The address of the recipient, can be a user or contract./_tokenId The ID of the fighter to transfer./Required for ERC-721 compliance.
function transfer(address _to, uint256 _tokenId) external override { // Safety check to prevent against an unexpected 0x0 default. require(_to != address(0)); // Disallow transfers to this contract to prevent accidental misuse. require(_to != address(this)); // You can only send your own fighter. require(_owns(msg.sender, _tokenId)); // If transferring we can't keep a fighter in the arena... if (_fighterIsForBrawl(_tokenId)) { _removeFighterFromArena(_tokenId); emit ArenaRemoval(msg.sender, _tokenId); } // ...nor can they be in our marketplace. if (_fighterIsForSale(_tokenId)) { _removeFighterFromSale(_tokenId); emit MarketplaceRemoval(msg.sender, _tokenId); } // Reassign ownership, clear pending approvals, emit Transfer event. _transfer(msg.sender, _to, _tokenId); }
function transfer(address _to, uint256 _tokenId) external override { // Safety check to prevent against an unexpected 0x0 default. require(_to != address(0)); // Disallow transfers to this contract to prevent accidental misuse. require(_to != address(this)); // You can only send your own fighter. require(_owns(msg.sender, _tokenId)); // If transferring we can't keep a fighter in the arena... if (_fighterIsForBrawl(_tokenId)) { _removeFighterFromArena(_tokenId); emit ArenaRemoval(msg.sender, _tokenId); } // ...nor can they be in our marketplace. if (_fighterIsForSale(_tokenId)) { _removeFighterFromSale(_tokenId); emit MarketplaceRemoval(msg.sender, _tokenId); } // Reassign ownership, clear pending approvals, emit Transfer event. _transfer(msg.sender, _to, _tokenId); }
35,020
214
// Limits how much any single wallet can mint on a collection.
uint256 public maxMint; mapping(address => uint256) public mintCount;
uint256 public maxMint; mapping(address => uint256) public mintCount;
17,240
230
// This function should be called after mint as it increments the user's mint count mintCount Number of tokens that will be minted /
function afterMint(uint256 mintCount) internal virtual { addressToMintCount[msg.sender] += mintCount; }
function afterMint(uint256 mintCount) internal virtual { addressToMintCount[msg.sender] += mintCount; }
53,716
21
// Internal function to update the parameters of the interest rate model baseRatePerYear The approximate target base APR, as a mantissa (scaled by 1e18) multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by 1e18) jumpMultiplierPerYear The multiplierPerBlock after hitting a specified utilization point kink1_ The utilization point at which the interest rate is fixed kink2_ The utilization point at which the jump multiplier is applied roof_ The utilization point at which the borrow rate is fixed /
function updateTripleRateModelInternal( uint256 baseRatePerYear, uint256 multiplierPerYear, uint256 jumpMultiplierPerYear, uint256 kink1_, uint256 kink2_, uint256 roof_
function updateTripleRateModelInternal( uint256 baseRatePerYear, uint256 multiplierPerYear, uint256 jumpMultiplierPerYear, uint256 kink1_, uint256 kink2_, uint256 roof_
21,044
5
// If token transfers are limited and tokens are being bought from Uniswap, check the holding restrictions
if (limited && from == uniswapV2Pair) { require(super.balanceOf(to) + amount <= maxHoldingAmount && super.balanceOf(to) + amount >= minHoldingAmount, "Token transfer exceeds holding restrictions"); }
if (limited && from == uniswapV2Pair) { require(super.balanceOf(to) + amount <= maxHoldingAmount && super.balanceOf(to) + amount >= minHoldingAmount, "Token transfer exceeds holding restrictions"); }
26,235
5
// internal view function for finding the address of the standardeip-1167 minimal proxy created using `CREATE2` with a given logic contractand initialization calldata payload logicContract address of the logic contract initializationCalldata calldata that will be supplied to the `DELEGATECALL`from the spawned contract to the logic contract during contract creationreturn target address of the next spawned minimal proxy contract with thegiven parameters. /
function _computeAddress(address logicContract, bytes memory initializationCalldata) internal view returns (address target)
function _computeAddress(address logicContract, bytes memory initializationCalldata) internal view returns (address target)
40,718
505
// Create a reference to the corresponding cToken contract
IGenCToken cToken = IGenCToken(cTokenAddr);
IGenCToken cToken = IGenCToken(cTokenAddr);
38,926
38
// Send `_amount` of tokens on behalf of the address `from` to the address `to`./_from The address holding the tokens being sent/_to The address of the recipient/_amount The number of tokens to be sent/_data Data generated by the user to be sent to the recipient/_operatorData Data generated by the operator to be sent to the recipient
function operatorSend( address _from, address _to, uint256 _amount, bytes calldata _data, bytes calldata _operatorData ) external
function operatorSend( address _from, address _to, uint256 _amount, bytes calldata _data, bytes calldata _operatorData ) external
19,153
46
// The real starting time and ending time needs to be later filled according to the latest GA.
proposalList[_proposalID] = BasicProposal(_proposalID, _shortDescription, 0, 0, false, false, true); gaProposalAdditionalsList[_proposalID] = GAProposalAdditionals(ActionType.proposeUpdateWallet, 0x0, 0, "", _internalWallet, _externalWallet);
proposalList[_proposalID] = BasicProposal(_proposalID, _shortDescription, 0, 0, false, false, true); gaProposalAdditionalsList[_proposalID] = GAProposalAdditionals(ActionType.proposeUpdateWallet, 0x0, 0, "", _internalWallet, _externalWallet);
46,999
25
// Gets the 5 miners who mined the value for the specified requestId/_timestamp_requestId to look up_timestamp is the timestamp to look up miners for return the 5 miners' addresses/
function getMinersByRequestIdAndTimestamp(TellorStorage.TellorStorageStruct storage self, uint256 _requestId, uint256 _timestamp) internal view returns (address[5] memory)
function getMinersByRequestIdAndTimestamp(TellorStorage.TellorStorageStruct storage self, uint256 _requestId, uint256 _timestamp) internal view returns (address[5] memory)
24,208
34
// V1 - V5: OK
address public pendingOwner;
address public pendingOwner;
10,563
95
// update the user principal borrow balance, adding the cumulated interest and then subtracting the payback amount
user.principalBorrowBalance = user.principalBorrowBalance.add(_balanceIncrease).sub( _paybackAmountMinusFees ); user.lastVariableBorrowCumulativeIndex = reserve.lastVariableBorrowCumulativeIndex;
user.principalBorrowBalance = user.principalBorrowBalance.add(_balanceIncrease).sub( _paybackAmountMinusFees ); user.lastVariableBorrowCumulativeIndex = reserve.lastVariableBorrowCumulativeIndex;
5,365
429
// Returns the downcasted int184 from int256, reverting onoverflow (when the input is less than smallest int184 orgreater than largest int184). Counterpart to Solidity's `int184` operator. Requirements: - input must fit into 184 bits /
function toInt184(int256 value) internal pure returns (int184 downcasted) { downcasted = int184(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(184, value); } }
function toInt184(int256 value) internal pure returns (int184 downcasted) { downcasted = int184(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(184, value); } }
36,503
59
// Performs a Solidity function call using a low level `call`. Aplain `call` is an unsafe replacement for a function call: use thisfunction instead. If `target` reverts with a revert reason, it is bubbled up by thisfunction (like regular Solidity function calls). Returns the raw returned data. To convert to the expected return value, Requirements: - `target` must be a contract.- calling `target` with `data` must not revert. _Available since v3.1._ /
function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); }
function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); }
3,603
26
// ERC721A baseURI override
function _baseURI() internal view virtual override returns (string memory) { return uriPrefix; }
function _baseURI() internal view virtual override returns (string memory) { return uriPrefix; }
11,661
112
// obtc pool
function add_liquidity( uint256[4] calldata amounts, uint256 min_mint_amount ) external; function remove_liquidity_imbalance(uint256[4] calldata amounts, uint256 max_burn_amount) external; function remove_liquidity(uint256 _amount, uint256[4] calldata amounts) external; function exchange(
function add_liquidity( uint256[4] calldata amounts, uint256 min_mint_amount ) external; function remove_liquidity_imbalance(uint256[4] calldata amounts, uint256 max_burn_amount) external; function remove_liquidity(uint256 _amount, uint256[4] calldata amounts) external; function exchange(
45,891
190
// Update the given pool's GYUD allocation point. Can only be called by the owner.
function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate, bool _taxable, uint256 _startBlock) public onlyOwner { if (_withUpdate) { massUpdatePools(); } totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint); poolInfo[_pid].allocPoint = _allocPoint; poolInfo[_pid].taxable = _taxable; poolInfo[_pid].lastRewardBlock = _startBlock; }
function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate, bool _taxable, uint256 _startBlock) public onlyOwner { if (_withUpdate) { massUpdatePools(); } totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint); poolInfo[_pid].allocPoint = _allocPoint; poolInfo[_pid].taxable = _taxable; poolInfo[_pid].lastRewardBlock = _startBlock; }
20,819
32
// Casts an unready vote on a subject guardian/Called by a guardian as part of the automatic vote-unready flow/The transaction may be sent from the guardian or orbs address./subject is the subject guardian to vote out/expiration is the expiration time of the vote unready to prevent counting of a vote that is already irrelevant.
function voteUnready(address subject, uint expiration) external;
function voteUnready(address subject, uint expiration) external;
47,314
307
// 8y
(pt2xx, pt2xy) = _FQ2Mul(pt2xx, pt2xy, pt1yx, pt1yy);
(pt2xx, pt2xy) = _FQ2Mul(pt2xx, pt2xy, pt1yx, pt1yy);
15,270
27
// Transfer the NFT back to the staker address.
therotybroiCollection.transferFrom(address(this), msg.sender, _rotybroiId);
therotybroiCollection.transferFrom(address(this), msg.sender, _rotybroiId);
1,467
276
// Event emitted when external ERC20s are transferred out
event TransferredExternalERC20( address indexed to, address indexed token, uint256 amount );
event TransferredExternalERC20( address indexed to, address indexed token, uint256 amount );
57,904
40
// Get order history length /
function getHistoryLength() public view returns(uint)
function getHistoryLength() public view returns(uint)
15,209
50
// EPC validated flag must be set before certificates can be retrieved
modifier isEPCCertified(uint96 EPC_){ require(isEPCValidated(EPC_), "Product with given EPC is not certified"); _; }
modifier isEPCCertified(uint96 EPC_){ require(isEPCValidated(EPC_), "Product with given EPC is not certified"); _; }
15,021
48
// Retrieves a contract storage slot value. _contract Address of the contract to access. _key 32 byte storage slot key.return 32 byte storage slot value. /
function getContractStorage( address _contract, bytes32 _key ) override public view returns ( bytes32 )
function getContractStorage( address _contract, bytes32 _key ) override public view returns ( bytes32 )
25,517
8
// Set a new price to pay. Priviliged operation.
function setPrice(uint64 newPrice) external sudo { _price = newPrice; }
function setPrice(uint64 newPrice) external sudo { _price = newPrice; }
15,076
10
// Calculate send
uint256 balance = IERC20(token).balanceOf(address(this)); uint256 amountToSend = _availableFunds(balance, drip); uint256 remaining = balance - amountToSend;
uint256 balance = IERC20(token).balanceOf(address(this)); uint256 amountToSend = _availableFunds(balance, drip); uint256 remaining = balance - amountToSend;
31,024
17
// put getPair function signature at memory spot
mstore(ptr, 0xe6a4390500000000000000000000000000000000000000000000000000000000) // sig = 0xe6a43905
mstore(ptr, 0xe6a4390500000000000000000000000000000000000000000000000000000000) // sig = 0xe6a43905
29,715
33
// Due protocol swap fee amounts are computed by measuring the growth of the invariant between the previous join or exit event and now - the invariant's growth is due exclusively to swap fees. This avoids spending gas calculating fee amounts during each individual swap
dueProtocolFeeAmounts = _getDueProtocolFeeAmounts(balances, protocolSwapFeePercentage);
dueProtocolFeeAmounts = _getDueProtocolFeeAmounts(balances, protocolSwapFeePercentage);
25,219
19
// TODO
function hasRoyalties(uint256 _tokenId) external override pure returns (bool) { return true; }
function hasRoyalties(uint256 _tokenId) external override pure returns (bool) { return true; }
18,567
8
// If caller is the admin process the call internally, otherwise transparently fallback to the proxy behavior. /
function _fallback() internal virtual override { if (msg.sender == _proxyAdmin()) { if (msg.sig != ITransparentUpgradeableProxy.upgradeToAndCall.selector) { revert ProxyDeniedAdminAccess(); } else { _dispatchUpgradeToAndCall(); } } else { super._fallback(); } }
function _fallback() internal virtual override { if (msg.sender == _proxyAdmin()) { if (msg.sig != ITransparentUpgradeableProxy.upgradeToAndCall.selector) { revert ProxyDeniedAdminAccess(); } else { _dispatchUpgradeToAndCall(); } } else { super._fallback(); } }
20,591
30
// Low level core function withwithdraw logic for solelywithdraw. (Without security checks) /
function _solelyWithdrawBase( address _poolToken, uint256 _nftId, uint256 _amount ) internal
function _solelyWithdrawBase( address _poolToken, uint256 _nftId, uint256 _amount ) internal
40,929
112
// Returns the URI for token type `id`.
* If the `\{id\}` substring is present in the URI, it must be replaced by * clients with the actual token type ID. */ function uri(uint256 id) external view returns (string memory); }
* If the `\{id\}` substring is present in the URI, it must be replaced by * clients with the actual token type ID. */ function uri(uint256 id) external view returns (string memory); }
3,465
26
// Atomically increases the allowance granted to `spender` by the caller. This is an alternative to `approve` that can be used as a mitigation forproblems described in `IERC20.approve`. Emits an `Approval` event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. /
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue)); return true; }
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue)); return true; }
18,285
0
// Sets the address associated with an ENS node.May only be called by the owner of that node in the ENS registry. node The node to update. a The address to set. /
function setAddr(bytes32 node, address a) external authorised(node) { setAddr(node, COIN_TYPE_ETH, addressToBytes(a)); }
function setAddr(bytes32 node, address a) external authorised(node) { setAddr(node, COIN_TYPE_ETH, addressToBytes(a)); }
24,281
23
// STAKING MAPPINGS
mapping (address => uint256) public stakedTokens; //amount of tokens that address has staked mapping (address => uint256) public lastStaked; //last time at which address staked, deposited, or "rolled over" their position by calling updateStake directly mapping (address => uint256) public totalEarnedTokens; event TokensSold(address user, uint256 amountTokens);
mapping (address => uint256) public stakedTokens; //amount of tokens that address has staked mapping (address => uint256) public lastStaked; //last time at which address staked, deposited, or "rolled over" their position by calling updateStake directly mapping (address => uint256) public totalEarnedTokens; event TokensSold(address user, uint256 amountTokens);
6,884
25
// Receiver interface for ERC677 transferAndCall discussion. /
contract ERC677Receiver { function tokenFallback(address _from, uint _amount, bytes _data) public; }
contract ERC677Receiver { function tokenFallback(address _from, uint _amount, bytes _data) public; }
20,659