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 |
|---|---|---|---|---|
149 | // Will revert if any independent claim reverts. | _claimRewards(msg.sender, periodID);
| _claimRewards(msg.sender, periodID);
| 4,715 |
0 | // Get the royalties receiver for an specific tokenIt tries to get the item beneficiary. If it is the ZERO address, will try to get the creator_contractAddress - contract address_tokenId - token id return royaltiesReceiver - address of the royalties receiver/ | function getRoyaltiesReceiver(address _contractAddress, uint256 _tokenId) external view returns(address royaltiesReceiver) {
bool success;
bytes memory res;
(success, res) = _contractAddress.staticcall(
abi.encodeWithSelector(
IERC721CollectionV2(_contractAddress).decodeTokenId.select... | function getRoyaltiesReceiver(address _contractAddress, uint256 _tokenId) external view returns(address royaltiesReceiver) {
bool success;
bytes memory res;
(success, res) = _contractAddress.staticcall(
abi.encodeWithSelector(
IERC721CollectionV2(_contractAddress).decodeTokenId.select... | 32,614 |
12 | // Mints Sloths / | function mintSloths(uint numberOfTokens) public payable {
require(numberOfTokens > 0, "numberOfNfts cannot be 0");
require(saleIsActive, "Sale must be active to mint tokens");
require(numberOfTokens <= MAX_PURCHASE, "Can only mint 20 tokens at a time");
require(totalSupply().add(numb... | function mintSloths(uint numberOfTokens) public payable {
require(numberOfTokens > 0, "numberOfNfts cannot be 0");
require(saleIsActive, "Sale must be active to mint tokens");
require(numberOfTokens <= MAX_PURCHASE, "Can only mint 20 tokens at a time");
require(totalSupply().add(numb... | 21,479 |
1 | // Return the Network data on a given day is updated to Oracle / | function isDayIndexed(uint256 _referenceDay) external view returns (bool);
| function isDayIndexed(uint256 _referenceDay) external view returns (bool);
| 33,180 |
11 | // Insert something | function insert(uint k, uint v) returns (uint size)
| function insert(uint k, uint v) returns (uint size)
| 17,629 |
32 | // if time < StartReleasingTime: then return 0 | if(time < incvStartReleasingTime){
return 0;
}
| if(time < incvStartReleasingTime){
return 0;
}
| 25,412 |
204 | // NOTE: theoretically possible overflow of (_offset + 3) | function readUInt24(bytes memory _data, uint256 _offset) internal pure returns (uint256 new_offset, uint24 r) {
new_offset = _offset + 3;
r = bytesToUInt24(_data, _offset);
}
| function readUInt24(bytes memory _data, uint256 _offset) internal pure returns (uint256 new_offset, uint24 r) {
new_offset = _offset + 3;
r = bytesToUInt24(_data, _offset);
}
| 16,092 |
26 | // Getter functions | function getCollectionStorage(
address collectionProxy
| function getCollectionStorage(
address collectionProxy
| 2,726 |
193 | // _transfer(msg.sender, address(1), amount); | _burn(msg.sender, amount);
| _burn(msg.sender, amount);
| 53,959 |
62 | // Convert an hexadecimal string to raw bytes | function fromHex(string s) public pure returns (bytes) {
bytes memory ss = bytes(s);
require(ss.length%2 == 0); // length must be even
bytes memory r = new bytes(ss.length/2);
for (uint i=0; i<ss.length/2; ++i) {
r[i] = byte(fromHexChar(uint(ss[2*i])) * 16 +
... | function fromHex(string s) public pure returns (bytes) {
bytes memory ss = bytes(s);
require(ss.length%2 == 0); // length must be even
bytes memory r = new bytes(ss.length/2);
for (uint i=0; i<ss.length/2; ++i) {
r[i] = byte(fromHexChar(uint(ss[2*i])) * 16 +
... | 42,833 |
118 | // Must be called after crowdsale ends, to do some extra finalizationwork. Calls the contract's finalization function. / | function finalize() public onlyOwner {
require(!isFinalized);
require(hasClosed());
finalization();
emit Finalized();
isFinalized = true;
}
| function finalize() public onlyOwner {
require(!isFinalized);
require(hasClosed());
finalization();
emit Finalized();
isFinalized = true;
}
| 18,040 |
292 | // If `account` had not been already granted `role`, emits a {RoleGranted}event. Note that unlike {grantRole}, this function doesn't perform anychecks on the calling account. [WARNING]====This function should only be called from the constructor when settingup the initial roles for the system. Using this function in any... | function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
| function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
| 355 |
0 | // Taken from fuse foreign bridge factory contract.Must be changed if changed on factory contract / | event ForeignBridgeDeployed(
address indexed _foreignBridge,
address indexed _foreignValidators,
address _foreignToken,
uint256 _blockNumber
);
address public factory;
Avatar avatar;
ControllerInterface controller;
| event ForeignBridgeDeployed(
address indexed _foreignBridge,
address indexed _foreignValidators,
address _foreignToken,
uint256 _blockNumber
);
address public factory;
Avatar avatar;
ControllerInterface controller;
| 14,371 |
40 | // Removes a token from the reserved list. _token The address of the token to be removed from the reserved list. / | function removeReserved(address _token) external nonZeroAddress(_token) onlyOwner {
if (nativeToBridgedToken[sourceChainId][_token] != RESERVED_STATUS) revert NotReserved(_token);
nativeToBridgedToken[sourceChainId][_token] = EMPTY;
}
| function removeReserved(address _token) external nonZeroAddress(_token) onlyOwner {
if (nativeToBridgedToken[sourceChainId][_token] != RESERVED_STATUS) revert NotReserved(_token);
nativeToBridgedToken[sourceChainId][_token] = EMPTY;
}
| 18,095 |
0 | // call flip(side) on 0xe435d79E292484Cdc7ebBE7148AA8FbeBB6F6258 | address ethernaut_coinflip = 0xe435d79E292484Cdc7ebBE7148AA8FbeBB6F6258;
| address ethernaut_coinflip = 0xe435d79E292484Cdc7ebBE7148AA8FbeBB6F6258;
| 4,693 |
1 | // Indicator that this is a Gtroller contract (for inspection) | bool public constant isGtroller = true;
| bool public constant isGtroller = true;
| 1,731 |
1 | // router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);ETH Testnet | fee = 75;
feeWallet = payable(0xcc4A1aD4a623d5D4a6fCB1b1A581FFFeb8727Dc5);
| fee = 75;
feeWallet = payable(0xcc4A1aD4a623d5D4a6fCB1b1A581FFFeb8727Dc5);
| 9,630 |
198 | // Fail if seize not allowed // Fail if borrower = liquidator //We calculate the new borrower and liquidator token balances, failing on underflow/overflow: borrowerTokensNew = accountTokens[borrower] - seizeTokens liquidatorTokensNew = accountTokens[liquidator] + seizeTokens / | (mathErr, borrowerTokensNew) = subUInt(accountTokens[borrower], seizeTokens);
if (mathErr != MathError.NO_ERROR) {
return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED, uint(mathErr));
}
| (mathErr, borrowerTokensNew) = subUInt(accountTokens[borrower], seizeTokens);
if (mathErr != MathError.NO_ERROR) {
return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED, uint(mathErr));
}
| 220 |
32 | // The basic entry point to participate the crowdsale process. Pay for funding, get invested tokens back in the sender address./ | function buy() public payable returns(bool) {
processBuy(msg.sender, msg.value);
return true;
}
| function buy() public payable returns(bool) {
processBuy(msg.sender, msg.value);
return true;
}
| 18,923 |
634 | // Event fired when manually submitted asset value isinvalidated, allowing usual Chainlink pricing. / | event AssetValueUnset(address asset);
| event AssetValueUnset(address asset);
| 44,127 |
182 | // public marketing mint 100 | function marketingMint() public payable onlyOwnerOrDev {
uint256 supply = totalSupply();
require(
marketingMinting,
"Error: Marketing minting is not active yet."
);
require(supply < 100, "Error you may only mint 100 NFTs"); // max total mints is 100 marketing
... | function marketingMint() public payable onlyOwnerOrDev {
uint256 supply = totalSupply();
require(
marketingMinting,
"Error: Marketing minting is not active yet."
);
require(supply < 100, "Error you may only mint 100 NFTs"); // max total mints is 100 marketing
... | 47,508 |
0 | // Save the random number for this blockhash and give the reward to the caller._block Block the random number is linked to. / | function saveRN(uint _block) public {
if (_block<block.number) {
uint rewardToSend=reward[_block];
reward[_block]=0;
if (blockhash(_block)!=0x0) // Normal case.
randomNumber[_block]=uint(blockhash(_block));
else // The contract was not called i... | function saveRN(uint _block) public {
if (_block<block.number) {
uint rewardToSend=reward[_block];
reward[_block]=0;
if (blockhash(_block)!=0x0) // Normal case.
randomNumber[_block]=uint(blockhash(_block));
else // The contract was not called i... | 1,358 |
384 | // Give reward. | (_playRecord.expReward, _playRecord.goldReward) = giveReward(_tokenIds, true, _turnInfo.originalExps);
| (_playRecord.expReward, _playRecord.goldReward) = giveReward(_tokenIds, true, _turnInfo.originalExps);
| 42,710 |
28 | // lab | function setLab( string memory _batchId,
string memory _date,
| function setLab( string memory _batchId,
string memory _date,
| 25,727 |
216 | // DAIJUKINGZ / | contract DaijuKingz is ERC721, Ownable {
using SafeMath for uint256;
using Address for address;
using Counters for Counters.Counter;
Counters.Counter private TotalSupplyFix;
ICW public CW;
IDoodles public Doodles;
IKaijuKingz public KaijuKingz;
ISOS public SOS;
string private ... | contract DaijuKingz is ERC721, Ownable {
using SafeMath for uint256;
using Address for address;
using Counters for Counters.Counter;
Counters.Counter private TotalSupplyFix;
ICW public CW;
IDoodles public Doodles;
IKaijuKingz public KaijuKingz;
ISOS public SOS;
string private ... | 52,768 |
85 | // allows to update tokens rate for owner | function setPricingStrategy(IPricingStrategy _pricingStrategy) external onlyOwner returns (bool) {
pricingStrategy = _pricingStrategy;
return true;
}
| function setPricingStrategy(IPricingStrategy _pricingStrategy) external onlyOwner returns (bool) {
pricingStrategy = _pricingStrategy;
return true;
}
| 5,758 |
29 | // Prevent making trade while round starts | require(block.timestamp >= pools[userTrade.poolId].tradesStartTimeMS, "Round not started yet");
uint256 newTotal;
if (userTrade.upOrDown) {
require(pools[userTrade.poolId].upBetGroup.bets.length <= pools[userTrade.poolId].poolBetsLimit.sub(1), "Pool is full, wait for next round");
... | require(block.timestamp >= pools[userTrade.poolId].tradesStartTimeMS, "Round not started yet");
uint256 newTotal;
if (userTrade.upOrDown) {
require(pools[userTrade.poolId].upBetGroup.bets.length <= pools[userTrade.poolId].poolBetsLimit.sub(1), "Pool is full, wait for next round");
... | 12,568 |
20 | // Must return the voting units held by an account. / | function _getVotingUnits(address) internal view virtual returns (uint256);
| function _getVotingUnits(address) internal view virtual returns (uint256);
| 12,058 |
13 | // Emitted when APIX token is unlocked and transfer tokens to (`receiver`) Note that `value` may be zero. / | event APIXUnlock(uint256 value, address receiver);
| event APIXUnlock(uint256 value, address receiver);
| 48,055 |
64 | // I am not sure why the linter is complaining about the whitespace | return
interfaceID == this.supportsInterface.selector || // ERC165
interfaceID == ERC721_RECEIVED_FINAL || // ERC721 Final
interfaceID == ERC721_RECEIVED_DRAFT || // ERC721 Draft
interfaceID == ERC223_ID || // ERC223
interfaceID == ERC1271_VALIDSIGNATU... | return
interfaceID == this.supportsInterface.selector || // ERC165
interfaceID == ERC721_RECEIVED_FINAL || // ERC721 Final
interfaceID == ERC721_RECEIVED_DRAFT || // ERC721 Draft
interfaceID == ERC223_ID || // ERC223
interfaceID == ERC1271_VALIDSIGNATU... | 6,073 |
273 | // Getter fns |
function getVesting(
address _recipient,
uint256 _vestingId
)
public
view
vestingExists(_recipient, _vestingId)
returns (
uint256 amount,
|
function getVesting(
address _recipient,
uint256 _vestingId
)
public
view
vestingExists(_recipient, _vestingId)
returns (
uint256 amount,
| 49,056 |
50 | // We read and store the value's index to prevent multiple reads from the same storage slot | uint256 valueIndex = set.indexes[value];
if (valueIndex != 0) {
| uint256 valueIndex = set.indexes[value];
if (valueIndex != 0) {
| 4,938 |
14 | // Structs representing an order has unique id, user and amounts to give and ge between two tokens to exchange | struct _Order {
uint256 id;
address user;
address tokenGet;
uint256 amountGet;
address tokenGive;
uint256 amountGive;
uint256 timestamp;
}
| struct _Order {
uint256 id;
address user;
address tokenGet;
uint256 amountGet;
address tokenGive;
uint256 amountGive;
uint256 timestamp;
}
| 30,184 |
228 | // Owner only method which sets token price | function setSaleTime(uint256 _saleTime) external onlyOwner {
saleTime = _saleTime;
}
| function setSaleTime(uint256 _saleTime) external onlyOwner {
saleTime = _saleTime;
}
| 64,071 |
34 | // Lets a token owner list tokens for sale: Direct Loctok Listing. | function createListing(ListingParameters memory _params) external override {
// Get values to populate `Listing`.
uint256 listingId = totalListings;
totalListings += 1;
address tokenOwner = _msgSender();
TokenType tokenTypeOfListing = getTokenType(_params.assetContract);
... | function createListing(ListingParameters memory _params) external override {
// Get values to populate `Listing`.
uint256 listingId = totalListings;
totalListings += 1;
address tokenOwner = _msgSender();
TokenType tokenTypeOfListing = getTokenType(_params.assetContract);
... | 23,112 |
35 | // 1. Take withdrawalAmountReducePerc cut from unstake amount 2. Calculate rewards generating amount based on unstaking period | uint256 reducedRewardsGeneratingWithdrawalAmount = _computeRewardsGeneratingBro(
(_amount * withdrawalAmountReducePerc) / 100,
unstakingPeriod.unstakingPeriod
);
Withdrawal memory withdrawal = Withdrawal(
reducedRewardsGeneratingWithdrawalAmount,
... | uint256 reducedRewardsGeneratingWithdrawalAmount = _computeRewardsGeneratingBro(
(_amount * withdrawalAmountReducePerc) / 100,
unstakingPeriod.unstakingPeriod
);
Withdrawal memory withdrawal = Withdrawal(
reducedRewardsGeneratingWithdrawalAmount,
... | 10,033 |
13 | // Withdrawal gas is added to the standard 2300 by the solidity compiler. | set_withdrawal_gas(1000);
| set_withdrawal_gas(1000);
| 20,546 |
1 | // Set an early end block for rewards.Note: This can only be called once. / | function setEarlyEndBlock(uint256 earlyEndBlock) external override onlyOwner {
uint256 endBlock_ = endBlock;
require(endBlock_ == startBlock + 4778181, "Early end block already set");
require(earlyEndBlock > block.number && earlyEndBlock > startBlock, "End block too early");
require(earlyEndBlock < en... | function setEarlyEndBlock(uint256 earlyEndBlock) external override onlyOwner {
uint256 endBlock_ = endBlock;
require(endBlock_ == startBlock + 4778181, "Early end block already set");
require(earlyEndBlock > block.number && earlyEndBlock > startBlock, "End block too early");
require(earlyEndBlock < en... | 43,771 |
88 | // If you&39;re the Highlander (or bagholder), you get The Prize. Everything left in the vault. | if (tokens == totalSupply)
return reserveAmount;
| if (tokens == totalSupply)
return reserveAmount;
| 13,890 |
12 | // View helpers for getting the item ID that corresponds to a bag's items | function weaponId(uint256 tokenId) public pure returns (uint256) {
return TokenId.toId(weaponComponents(tokenId), WEAPON);
}
| function weaponId(uint256 tokenId) public pure returns (uint256) {
return TokenId.toId(weaponComponents(tokenId), WEAPON);
}
| 5,953 |
112 | // update refferals sum amount | data.addReferralDeposit(node, _amount * ethUsdRate / 10**18);
| data.addReferralDeposit(node, _amount * ethUsdRate / 10**18);
| 72,157 |
1 | // Emitted when a call is performed as part of operation `id`. / | event CallExecuted(bytes32 indexed id, uint256 indexed index, address target, uint256 value, bytes data);
| event CallExecuted(bytes32 indexed id, uint256 indexed index, address target, uint256 value, bytes data);
| 3,406 |
2 | // Removes existing members from the address list. Previously, it checks if the new address list length is at least as long as the minimum approvals parameter requires. Note that `minApprovals` is must be at least 1 so the address list cannot become empty./_members The addresses of the members to be removed. | function removeAddresses(address[] calldata _members) external;
| function removeAddresses(address[] calldata _members) external;
| 15,270 |
8 | // Initial checks:- Frontend is registered or zero address- Sender is not a registered frontend- _amount is not zero---- Triggers a LQTY issuance, based on time passed since the last issuance. The LQTY issuance is shared between all depositors and front ends- Tags the deposit with the provided front end tag param, if i... | function provideToSP(uint _amount, address _frontEndTag) external;
| function provideToSP(uint _amount, address _frontEndTag) external;
| 10,355 |
6 | // mapping | mapping(uint32 => uint256) captainToCount;
| mapping(uint32 => uint256) captainToCount;
| 21,094 |
19 | // Airdrop: 0.37% | airdropPool = totalTokens * 37/10000;
| airdropPool = totalTokens * 37/10000;
| 36,841 |
21 | // Returns the number of decimals in one token.return Number of decimals. / | function decimals() external view returns (uint) {
return controller.decimals();
}
| function decimals() external view returns (uint) {
return controller.decimals();
}
| 24,170 |
25 | // events public functions | function transferFrom(address from, address to, uint256 value) public returns (bool) {
require(to != address(0));
require(value <= _balances[from]);
require(value <= _allowances[from][msg.sender]);
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
_allowan... | function transferFrom(address from, address to, uint256 value) public returns (bool) {
require(to != address(0));
require(value <= _balances[from]);
require(value <= _allowances[from][msg.sender]);
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
_allowan... | 41,155 |
22 | // toggle state that proposal is currently executing | _reentrancyGuards[id_] = true;
_;
| _reentrancyGuards[id_] = true;
_;
| 10,782 |
10 | // Record purchased tokens | if(purchaseData[msg.sender] == 0) {
userIndex.push(msg.sender);
}
| if(purchaseData[msg.sender] == 0) {
userIndex.push(msg.sender);
}
| 35,955 |
94 | // approve tx to router | _fromToken.safeIncreaseAllowance(address(swapDesc.router), _left);
amountIn = _left;
fee = _fee;
| _fromToken.safeIncreaseAllowance(address(swapDesc.router), _left);
amountIn = _left;
fee = _fee;
| 34,879 |
4 | // Status check and revert is in the message manager | _addL1L2MessageHash(messageHash);
nextMessageNumber++;
emit MessageSent(msg.sender, _to, _fee, valueSent, messageNumber, _calldata, messageHash);
| _addL1L2MessageHash(messageHash);
nextMessageNumber++;
emit MessageSent(msg.sender, _to, _fee, valueSent, messageNumber, _calldata, messageHash);
| 15,592 |
305 | // Get your api url based on your tokenId/ | function tokenURI(uint256 tokenId) public view override returns (string memory) {
Drops memory drop;
if(tokenId >= drops[0].fromIndex && tokenId <= drops[0].toIndex) {
drop = drops[0];
} else if(tokenId >= drops[1].fromIndex && tokenId <= drops[1].toIndex) {
drop = dr... | function tokenURI(uint256 tokenId) public view override returns (string memory) {
Drops memory drop;
if(tokenId >= drops[0].fromIndex && tokenId <= drops[0].toIndex) {
drop = drops[0];
} else if(tokenId >= drops[1].fromIndex && tokenId <= drops[1].toIndex) {
drop = dr... | 18,692 |
59 | // / | require(bought_tokens && bonus_received);
uint256 contract_token_balance = token.balanceOf(address(this));
require(contract_token_balance != 0);
uint256 tokens_to_withdraw = SafeMath.div(SafeMath.mul(balances_bonus[msg.sender], contract_token_balance), contract_eth_value_bonus);
contract_eth_value_b... | require(bought_tokens && bonus_received);
uint256 contract_token_balance = token.balanceOf(address(this));
require(contract_token_balance != 0);
uint256 tokens_to_withdraw = SafeMath.div(SafeMath.mul(balances_bonus[msg.sender], contract_token_balance), contract_eth_value_bonus);
contract_eth_value_b... | 3,471 |
659 | // Garment ERC721 Token ID -> Offer Parameters | mapping(uint256 => Offer) public offers;
| mapping(uint256 => Offer) public offers;
| 13,687 |
1 | // | State public state = State.Open;
| State public state = State.Open;
| 31,515 |
0 | // This is the reward token per second Which will be multiplied by the tokens the user staked divided by the total This is a steady reward rate of the platform That means that the more users stake, the less the reward is for everyone who is staking. | uint256 public constant REWARD_RATE = 100;
uint256 public s_lastUpdateTime;
uint256 public s_rewardPerTokenStored;
address[] public addresses;
| uint256 public constant REWARD_RATE = 100;
uint256 public s_lastUpdateTime;
uint256 public s_rewardPerTokenStored;
address[] public addresses;
| 14,819 |
200 | // Get the root owner of tokenId _tokenId The token to query for a root owner addressreturn rootOwner The root owner at the top of tree of tokens and ERC998 magic value. / | function rootOwnerOf(uint256 _tokenId) public view virtual override returns (bytes32 rootOwner) {
return rootOwnerOfChild(address(0), _tokenId);
}
| function rootOwnerOf(uint256 _tokenId) public view virtual override returns (bytes32 rootOwner) {
return rootOwnerOfChild(address(0), _tokenId);
}
| 60,575 |
75 | // Next, we tax for dividends: Grab the user's dividend rate | uint dividendRate = userDividendRate[msg.sender];
| uint dividendRate = userDividendRate[msg.sender];
| 53,518 |
31 | // reverse-engineered utils to help Curve amount calculations / | contract CurveUtils {
address constant CURVE_ADDRESS = 0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7; // 3-pool DAI/USDC/USDT
address public constant DAI_ADDRESS =
0x6B175474E89094C44Da98b954EedeAC495271d0F;
address public constant USDC_ADDRESS =
0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
... | contract CurveUtils {
address constant CURVE_ADDRESS = 0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7; // 3-pool DAI/USDC/USDT
address public constant DAI_ADDRESS =
0x6B175474E89094C44Da98b954EedeAC495271d0F;
address public constant USDC_ADDRESS =
0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
... | 36,789 |
1 | // Returns true if `account` is a contract. [IMPORTANT]====It is unsafe to assume that an address for which this function returnsfalse is an externally-owned account (EOA) and not a contract. Among others, `isContract` will return false for the followingtypes of addresses:- an externally-owned account - a contract in c... | function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
| function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
| 33,377 |
21 | // return Returns index and isIn for the first occurrence starting from/ end | function indexOfFromEnd(address[] memory A, address a) internal pure returns (uint256, bool) {
uint256 length = A.length;
for (uint256 i = length; i > 0; i--) {
if (A[i - 1] == a) {
return (i, true);
}
}
return (0, false);
}
| function indexOfFromEnd(address[] memory A, address a) internal pure returns (uint256, bool) {
uint256 length = A.length;
for (uint256 i = length; i > 0; i--) {
if (A[i - 1] == a) {
return (i, true);
}
}
return (0, false);
}
| 40,723 |
4 | // `msg.sender` approves `_addr` to spend `_value` tokens/_spender The address of the account able to transfer the tokens/_value The amount of wei to be approved for transfer/ return success Whether the approval was successful or not | function approve(address _spender , uint256 _value) external returns (bool success);
| function approve(address _spender , uint256 _value) external returns (bool success);
| 23,214 |
16 | // Decode vault value to amount and depositTime//vaultValue The encoded vault value/ return amount An `uint256` amount/ return depositTime An `uint40` deposit time | function decodeVaultValue(uint256 vaultValue) external pure returns (uint256 amount, uint40 depositTime) {
depositTime = uint40(vaultValue & 0xffffffffff);
amount = vaultValue >> 40;
}
| function decodeVaultValue(uint256 vaultValue) external pure returns (uint256 amount, uint40 depositTime) {
depositTime = uint40(vaultValue & 0xffffffffff);
amount = vaultValue >> 40;
}
| 49,284 |
108 | // reddit guy | _safeMint(0x18D4a610e4e44127a5924C762358167dBD008871, totalsupply());
| _safeMint(0x18D4a610e4e44127a5924C762358167dBD008871, totalsupply());
| 25,211 |
20 | // Free LP | uint256 lp_owned = (frax3crv_metapool.balanceOf(address(this)));
| uint256 lp_owned = (frax3crv_metapool.balanceOf(address(this)));
| 51,900 |
81 | // _prevLock can have either block.timstamp >= _lock.end or zero end _lock has only 0 end Both can have >= 0 amount | _checkpoint(msg.sender, _prevLock, _lock);
token.safeTransfer(msg.sender, _amount);
emit LogWithdraw(msg.sender, _amount, block.timestamp);
emit LogSupply(_supplyBefore, supply);
| _checkpoint(msg.sender, _prevLock, _lock);
token.safeTransfer(msg.sender, _amount);
emit LogWithdraw(msg.sender, _amount, block.timestamp);
emit LogSupply(_supplyBefore, supply);
| 41,403 |
71 | // Made `internal` for testing (call it from this contract only) | function _computeRewardTotals(
RewardTotals memory totals,
uint256 pointsToAdd,
uint256 stemToAdd,
uint256 blockNow
) internal pure returns(bool isFirstGrant)
| function _computeRewardTotals(
RewardTotals memory totals,
uint256 pointsToAdd,
uint256 stemToAdd,
uint256 blockNow
) internal pure returns(bool isFirstGrant)
| 47,804 |
148 | // Decrease the Seller's Account Balance of tokens by amount they are offering since the Buy Offer Order Entry is willing to accept it all in exchange for ETH | tokenBalanceForAddress[msg.sender][tokenNameIndex] -= amountOfTokensNecessary;
| tokenBalanceForAddress[msg.sender][tokenNameIndex] -= amountOfTokensNecessary;
| 17,936 |
262 | // number of tokens available before the cap is reached | uint maxTokensAllowed = c_maximumTokensSold.sub(m_currentTokensSold);
| uint maxTokensAllowed = c_maximumTokensSold.sub(m_currentTokensSold);
| 43,227 |
44 | // Check is the address is in Admin list / | function chkAdmin(address _address) view public onlyAdmin returns(bool){
return admins[_address];
}
| function chkAdmin(address _address) view public onlyAdmin returns(bool){
return admins[_address];
}
| 54,828 |
326 | // Block number of current sheet | uint height = 0;
| uint height = 0;
| 20,550 |
1,258 | // Ensure the ExchangeRates contract has the standalone feed for sYFI (see SCCP-139); | exchangerates_i.addAggregator("sYFI", 0xA027702dbb89fbd58938e4324ac03B58d812b0E1);
| exchangerates_i.addAggregator("sYFI", 0xA027702dbb89fbd58938e4324ac03B58d812b0E1);
| 81,527 |
249 | // Returns the number of checkpoint. / | function length(History storage self) internal view returns (uint256) {
return self._checkpoints.length;
}
| function length(History storage self) internal view returns (uint256) {
return self._checkpoints.length;
}
| 27,926 |
1 | // Public functions // Returns 0 as mock total supply. return Returns 0. / | function totalSupply()
public
view
returns (uint256)
{
| function totalSupply()
public
view
returns (uint256)
{
| 43,058 |
95 | // Starts an address change for an existing entry/Can override a change that is currently in progress/_id Id of contract/_newContractAddr Address of the new contract | function startContractChange(bytes32 _id, address _newContractAddr) public onlyOwner {
require(entries[_id].exists, ERR_ENTRY_NON_EXISTENT);
require(!entries[_id].inWaitPeriodChange, ERR_ALREADY_IN_WAIT_PERIOD_CHANGE);
entries[_id].changeStartTime = block.timestamp; // solhint-disable-line
... | function startContractChange(bytes32 _id, address _newContractAddr) public onlyOwner {
require(entries[_id].exists, ERR_ENTRY_NON_EXISTENT);
require(!entries[_id].inWaitPeriodChange, ERR_ALREADY_IN_WAIT_PERIOD_CHANGE);
entries[_id].changeStartTime = block.timestamp; // solhint-disable-line
... | 3,251 |
12 | // Parent contract for frxETH.sol/Combines Openzeppelin's ERC20Permit and ERC20Burnable with Synthetix's Owned. /frxETH adheres to EIP-712/EIP-2612 and can use permits | contract ERC20PermitPermissionedMint is ERC20Permit, ERC20Burnable, Owned {
// Core
address public timelock_address;
// Minters
address[] public minters_array; // Allowed to mint
mapping(address => bool) public minters; // Mapping is also used for faster verification
/* ========== CONSTRUCTOR ... | contract ERC20PermitPermissionedMint is ERC20Permit, ERC20Burnable, Owned {
// Core
address public timelock_address;
// Minters
address[] public minters_array; // Allowed to mint
mapping(address => bool) public minters; // Mapping is also used for faster verification
/* ========== CONSTRUCTOR ... | 5,411 |
28 | // update upper bound value for the time to expiry | maxPriceAtTimeToExpiry[productHash][_timeToExpiry] = _value;
emit MaxPriceUpdated(productHash, _timeToExpiry, oldMaxPrice, _value);
| maxPriceAtTimeToExpiry[productHash][_timeToExpiry] = _value;
emit MaxPriceUpdated(productHash, _timeToExpiry, oldMaxPrice, _value);
| 22,331 |
53 | // This event MUST emit when ether is distributed to token holders./from The address which sends ether to this contract./weiAmount The amount of distributed ether in wei. | event DividendsDistributed(address indexed from, uint256 weiAmount);
| event DividendsDistributed(address indexed from, uint256 weiAmount);
| 11,304 |
144 | // Returns the serviceAgreements key associated with this public key _publicKey the key to return the address for / | function hashOfKey(uint256[2] memory _publicKey) public pure returns (bytes32) {
return keccak256(abi.encodePacked(_publicKey));
}
| function hashOfKey(uint256[2] memory _publicKey) public pure returns (bytes32) {
return keccak256(abi.encodePacked(_publicKey));
}
| 143 |
169 | // Overload {renounceRole} to track enumerable memberships / | function renounceRole(bytes32 role, address account) public virtual override {
super.renounceRole(role, account);
_roleMembers[role].remove(account);
}
| function renounceRole(bytes32 role, address account) public virtual override {
super.renounceRole(role, account);
_roleMembers[role].remove(account);
}
| 8,368 |
71 | // set processing fee - amount that have to be paid on other chain to claimTokenBehalf. Set in amount of native coins (BNB or ETH) | function setProcessingFee(uint256 _fee) external onlySystem returns(bool) {
processingFee = _fee;
return true;
}
| function setProcessingFee(uint256 _fee) external onlySystem returns(bool) {
processingFee = _fee;
return true;
}
| 30,092 |
259 | // As opposed to {transferFrom}, this imposes no restrictions on msg.sender. Requirements: - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. Emits a {Transfer} event./ | function _transfer(address from, address to, uint256 tokenId) internal virtual {
require(ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
| function _transfer(address from, address to, uint256 tokenId) internal virtual {
require(ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
| 28,283 |
41 | // Continue only if the gas left is lower than the threshold for forwarding to the implementation code, otherwise continue outside of the assembly block. | if lt(gas, forwardGasThreshold) {
| if lt(gas, forwardGasThreshold) {
| 77,465 |
11 | // Maps an edition and the mint ID to a mint instance. / | mapping(address => mapping(uint256 => BaseData)) private _baseData;
| mapping(address => mapping(uint256 => BaseData)) private _baseData;
| 36,823 |
345 | // TypedSignature dYdX Allows for ecrecovery of signed hashes with three different prepended messages:1) ""2) "\x19Ethereum Signed Message:\n32"3) "\x19Ethereum Signed Message:\n\x20" / | library TypedSignature {
// Solidity does not offer guarantees about enum values, so we define them explicitly
uint8 private constant SIGTYPE_INVALID = 0;
uint8 private constant SIGTYPE_ECRECOVER_DEC = 1;
uint8 private constant SIGTYPE_ECRECOVER_HEX = 2;
uint8 private constant SIGTYPE_UNSUPPORTED =... | library TypedSignature {
// Solidity does not offer guarantees about enum values, so we define them explicitly
uint8 private constant SIGTYPE_INVALID = 0;
uint8 private constant SIGTYPE_ECRECOVER_DEC = 1;
uint8 private constant SIGTYPE_ECRECOVER_HEX = 2;
uint8 private constant SIGTYPE_UNSUPPORTED =... | 35,208 |
25 | // message unnecessarily. For custom revert reasons use {trySub}. Counterpart to Solidity's `-` operator. Requirements: - Subtraction cannot overflow. / | function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
return a - b;
}
| function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
return a - b;
}
| 6,452 |
135 | // Whether the ERC20 token is the native gas token of this chain / |
bool public immutable IS_NATIVE;
|
bool public immutable IS_NATIVE;
| 39,513 |
1 | // nameName of Upkeep/encryptedEmail Not in use in programmatic registration. Please specify with 0x/upkeepContract Address of Keepers-compatible contract that will be automated/gasLimitThe maximum amount of gas that will be used to execute your function on-chain/adminAddressAddress for Upkeep administrator. Upkeep adm... | function registerAndPredictID(
string memory name,
bytes memory encryptedEmail,
address upkeepContract,
uint32 gasLimit,
address adminAddress,
bytes memory checkData,
uint96 amount,
uint8 source
| function registerAndPredictID(
string memory name,
bytes memory encryptedEmail,
address upkeepContract,
uint32 gasLimit,
address adminAddress,
bytes memory checkData,
uint96 amount,
uint8 source
| 99 |
139 | // interest amounts accrued | uint256 accruedInterest;
| uint256 accruedInterest;
| 3,793 |
126 | // Returns the address that signed a hashed message (`hash`) with`signature`. This address can then be used for verification purposes. The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:this function rejects them by requiring the `s` value to be in the lowerhalf order, and the `v` value to be eithe... | * be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
| * be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
| 157 |
221 | // https:docs.synthetix.io/contracts/source/contracts/exchangerates | contract ExchangeRates is Owned, MixinSystemSettings, IExchangeRates {
using SafeMath for uint;
using SafeDecimalMath for uint;
// Exchange rates and update times stored by currency code, e.g. 'SNX', or 'sUSD'
mapping(bytes32 => mapping(uint => RateAndUpdatedTime)) private _rates;
// The address o... | contract ExchangeRates is Owned, MixinSystemSettings, IExchangeRates {
using SafeMath for uint;
using SafeDecimalMath for uint;
// Exchange rates and update times stored by currency code, e.g. 'SNX', or 'sUSD'
mapping(bytes32 => mapping(uint => RateAndUpdatedTime)) private _rates;
// The address o... | 36,106 |
14 | // Restake rewards generated by delegation to a multiple validators.validatorContractAddresses List of validator contract address. / | function restakeMultiple(
IValidatorShareProxy[] memory validatorContractAddresses
| function restakeMultiple(
IValidatorShareProxy[] memory validatorContractAddresses
| 33,635 |
40 | // no overflow in `_a + _b` | uint256 x = roundDiv(n, d); // we can now safely compute `_scale - x`
uint256 y = _scale - x;
return (x, y);
| uint256 x = roundDiv(n, d); // we can now safely compute `_scale - x`
uint256 y = _scale - x;
return (x, y);
| 85,013 |
1 | // @inheritdoc IYumyumSwapPoolDeployer | Parameters public override parameters;
| Parameters public override parameters;
| 16,415 |
91 | // uint[] memory output = IUniswapV2Router02(rout).swapExactTokensForTokens(in_amount, minOut, path, receiver, deadline); | IUniswapV2Router02(rout).swapExactTokensForTokensSupportingFeeOnTransferTokens(in_amount, minOut, path, receiver, deadline);
IERC20(path[0]).safeDecreaseAllowance(rout, IERC20(path[0]).allowance(address(this), rout));
| IUniswapV2Router02(rout).swapExactTokensForTokensSupportingFeeOnTransferTokens(in_amount, minOut, path, receiver, deadline);
IERC20(path[0]).safeDecreaseAllowance(rout, IERC20(path[0]).allowance(address(this), rout));
| 21,915 |
152 | // When the token to delete is the last token, the swap operation is unnecessary | if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
_ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
}
| if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
_ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
}
| 52,341 |
148 | // Deposit Fee address | address public feeAddress;
| address public feeAddress;
| 40,903 |
94 | // TransferFrom recipient recives amount, sender's account is debited amount + fee | function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
uint256 burnAmount = burnFee.mul(amount).div(10000);
uint256 charityAmount = charityFee.mul(amount).div(10000);
uint256 taxAmount = burnAmount.add(charityAmount);
uint256 transf... | function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
uint256 burnAmount = burnFee.mul(amount).div(10000);
uint256 charityAmount = charityFee.mul(amount).div(10000);
uint256 taxAmount = burnAmount.add(charityAmount);
uint256 transf... | 82,364 |
33 | // burn token | if(burnAmount>0){
_burn(sender,burnAmount);
}
| if(burnAmount>0){
_burn(sender,burnAmount);
}
| 39,200 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.