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
29
// Walk through the tree parent skills up to the root
while (notAtRoot) {
while (notAtRoot) {
13,374
116
// initialMint_
10**6 * 10**9, // 1,000,000 tokens * decimals
10**6 * 10**9, // 1,000,000 tokens * decimals
28,101
1
// For debug purposes and for multiple instances of contract
uint256 static _randomNonce;
uint256 static _randomNonce;
5,711
186
// Check current mint count for token and address_id token id to query against_address address to check mint count of/
function currentMintCount(uint256 _id, address _address) public view returns(uint256) { return walletMints[_address][_id]; }
function currentMintCount(uint256 _id, address _address) public view returns(uint256) { return walletMints[_address][_id]; }
12,068
0
// Cashflow struct
struct Cashflow { address subscriber; string name; uint256 value; uint256 commit; uint256 interestRate; uint256 duration; uint256 balance; uint256 payedValue; uint256 created; uint256 lastPayment; uint256 stackingTokens; }...
struct Cashflow { address subscriber; string name; uint256 value; uint256 commit; uint256 interestRate; uint256 duration; uint256 balance; uint256 payedValue; uint256 created; uint256 lastPayment; uint256 stackingTokens; }...
10,096
281
// The minimum moderator quarter point required below this, reputation will be deducted for moderators
uint256 moderatorMinimalParticipationPoint;
uint256 moderatorMinimalParticipationPoint;
53,334
17
// land owner methods
function setContent(string memory quad,string memory content) public returns (Land memory) { require(lands[quad].owner!=address(0),_error_invalid_quad); require(lands[quad].owner==msg.sender,_error_quad_not_your_property); lands[quad].content=content; return (lands[quad]); }
function setContent(string memory quad,string memory content) public returns (Land memory) { require(lands[quad].owner!=address(0),_error_invalid_quad); require(lands[quad].owner==msg.sender,_error_quad_not_your_property); lands[quad].content=content; return (lands[quad]); }
4,738
8
// do stuff here
emit Log("amount", amount); emit Log("amount0", _amount0); emit Log("amount1", _amount1); emit Log("fee", fee); emit Log("amount to repay", amountToRepay); IERC20(tokenBorrow).transfer(pair, amountToRepay);
emit Log("amount", amount); emit Log("amount0", _amount0); emit Log("amount1", _amount1); emit Log("fee", fee); emit Log("amount to repay", amountToRepay); IERC20(tokenBorrow).transfer(pair, amountToRepay);
6,993
84
// sets the controller
function setController(address _controller) external onlymanyowners(sha3(msg.data)) { m_controller = _controller; ControllerSet(m_controller); }
function setController(address _controller) external onlymanyowners(sha3(msg.data)) { m_controller = _controller; ControllerSet(m_controller); }
24,701
0
// Masks the lower `bytesPerTokenId` bytes of a word So if `bytesPerTokenId` == 1, then bitmask = 0xffif `bytesPerTokenId` == 2, then bitmask = 0xffff, etc.
uint256 bitMask = ~(type(uint256).max << (_bytesPerTokenId << 3)); assembly {
uint256 bitMask = ~(type(uint256).max << (_bytesPerTokenId << 3)); assembly {
10,637
27
// Returns true if operator is filtered by a given address or its subscription. /
function isOperatorFiltered(address registrant, address operator) external view returns (bool) { address registration = _registrations[registrant]; if (registration != registrant) { return _filteredOperators[registration].contains(operator); } return _filteredOperators[re...
function isOperatorFiltered(address registrant, address operator) external view returns (bool) { address registration = _registrations[registrant]; if (registration != registrant) { return _filteredOperators[registration].contains(operator); } return _filteredOperators[re...
20,769
203
// PRIVELEGED MODULE FUNCTION. Unlocks the SetToken and clears the locker /
function unlock() external onlyModule { require(isLocked, "Must be locked"); require(locker == msg.sender, "Must be locker"); delete locker; isLocked = false; }
function unlock() external onlyModule { require(isLocked, "Must be locked"); require(locker == msg.sender, "Must be locker"); delete locker; isLocked = false; }
67,704
29
// Special Wall Street Market Platform control from scam game contracts on Wall Street Market platform
mapping(address => bool) public canAcceptTokens_; // contracts, which can accept Wall Street tokens
mapping(address => bool) public canAcceptTokens_; // contracts, which can accept Wall Street tokens
57,295
63
// A new investor
investorCount++;
investorCount++;
28,703
36
// in is B, out is A
tokenOutBalance = tokenABalance; tokenInBalance = tokenBBalance;
tokenOutBalance = tokenABalance; tokenInBalance = tokenBBalance;
26,383
104
// Removes an address to the team._address the ETH address to remove, cannot be 0x and must be in team/
function removeFromTeam(address _address) public onlyOwner { if(_address == address(0)) revert InvalidTeamAddress(); if(!inTeam(_address)) revert InvalidTeamAddress(); team[_address] = false; }
function removeFromTeam(address _address) public onlyOwner { if(_address == address(0)) revert InvalidTeamAddress(); if(!inTeam(_address)) revert InvalidTeamAddress(); team[_address] = false; }
2,354
41
// bool public checkDiscountStage = true;
uint256 limit; uint256 period;
uint256 limit; uint256 period;
31,348
109
// Save token type
typeOfToken[_tokenId] = _tokenType;
typeOfToken[_tokenId] = _tokenType;
51,039
3
// edition id guaranteed to be = 0
IAuctionManager(auctionManagerAddress).createAuctionForNewEdition( auctionId, IAuctionManager.EnglishAuction( address(this), auctionCurrency, msg.sender, auctionPaymentRecipient, ...
IAuctionManager(auctionManagerAddress).createAuctionForNewEdition( auctionId, IAuctionManager.EnglishAuction( address(this), auctionCurrency, msg.sender, auctionPaymentRecipient, ...
13,674
24
// TO Define: Tokens not claimed should go back to time after release time?
require(_claimedAmount == _raisedETH || block.timestamp >= _releaseTime, "Launchpad: Tokens still to be claimed"); require(amount > 0, "Launchpad: no tokens to release"); token.safeTransfer(_owner, amount);
require(_claimedAmount == _raisedETH || block.timestamp >= _releaseTime, "Launchpad: Tokens still to be claimed"); require(amount > 0, "Launchpad: no tokens to release"); token.safeTransfer(_owner, amount);
11,568
4
// function is to get the donator for any specific help raised by the user
function getDonators(uint256 _id) public view returns(address[] memory,uint256[] memory){ //Checks whether the id is valid or not require(_id>=0 && _id<helpsCount,"Invalid id"); return(helps[_id].donor,helps[_id].donations); }
function getDonators(uint256 _id) public view returns(address[] memory,uint256[] memory){ //Checks whether the id is valid or not require(_id>=0 && _id<helpsCount,"Invalid id"); return(helps[_id].donor,helps[_id].donations); }
17,394
143
// Pull out tokens accidentally sent to the contract. Doesnt work with the reward token or any staked token. Can only be called by the owner.
function rescueToken(address tokenAddress) public onlyOwner { require((tokenAddress != address(rwt)) && !poolExistence[IERC20(tokenAddress)], "rescueToken : wrong token address"); uint256 bal = IERC20(tokenAddress).balanceOf(address(this)); IERC20(tokenAddress).transfer(msg.sender, bal); ...
function rescueToken(address tokenAddress) public onlyOwner { require((tokenAddress != address(rwt)) && !poolExistence[IERC20(tokenAddress)], "rescueToken : wrong token address"); uint256 bal = IERC20(tokenAddress).balanceOf(address(this)); IERC20(tokenAddress).transfer(msg.sender, bal); ...
18,192
5
// current owner of the coupon
address owner;
address owner;
5,111
84
// credit keeper with fee overflow should be impossible with validated distributorFee
ethBalances[ distributorAddress != address(0) ? distributorAddress : msg.sender ] += distributorFeeAmount;
ethBalances[ distributorAddress != address(0) ? distributorAddress : msg.sender ] += distributorFeeAmount;
24,824
0
// checks the avatar of the module (will be the gnosis safe) and ensures the EOA is a signer on the safe.
modifier onlySafeOwner() { require( OwnerManager(avatar).isOwner(msg.sender), "BULLAMODULE: Not safe owner" ); _; }
modifier onlySafeOwner() { require( OwnerManager(avatar).isOwner(msg.sender), "BULLAMODULE: Not safe owner" ); _; }
31,883
113
// move forward to the first element after inner array:
self = _subitems[_subitems.length - 1];
self = _subitems[_subitems.length - 1];
18,912
7
// Else, normal transfer
else { if (sender != owner()) { require(isTradable, "Transfers are not allowed at the moment"); }
else { if (sender != owner()) { require(isTradable, "Transfers are not allowed at the moment"); }
11,359
64
// wipe the message
graffiti = "";
graffiti = "";
3,428
108
// Interface for Zora Protocol's Market /
interface IMarket {
interface IMarket {
41,900
113
// Donate a skin to player. Only COO can operate
function donateSkin(uint128 specifiedAppearance, address donee) external whenNotPaused onlyCOO { Skin memory newSkin = Skin({appearance: specifiedAppearance, cooldownEndTime: uint64(now), mixingWithId: 0}); skins[nextSkinId] = newSkin; skinIdToOwner[nextSkinId] = donee; isOnSale[next...
function donateSkin(uint128 specifiedAppearance, address donee) external whenNotPaused onlyCOO { Skin memory newSkin = Skin({appearance: specifiedAppearance, cooldownEndTime: uint64(now), mixingWithId: 0}); skins[nextSkinId] = newSkin; skinIdToOwner[nextSkinId] = donee; isOnSale[next...
7,677
49
// check that the reward is non-zero
if (reward > 0) {
if (reward > 0) {
11,196
43
// Get the address of token for staking in this staking pool/ return The staking token address
function stakingToken() external view returns (address);
function stakingToken() external view returns (address);
8,606
24
// external stake creates a stake for a different account than the caller. It takes an extra param the staker address
// @param amount {uint256} - AXN amount to be staked // @param stakingDays {uint256} - number of days to be staked // @param staker {address} - account address to create the stake for function externalStake( uint256 amount, uint256 stakingDays, address staker ) external overr...
// @param amount {uint256} - AXN amount to be staked // @param stakingDays {uint256} - number of days to be staked // @param staker {address} - account address to create the stake for function externalStake( uint256 amount, uint256 stakingDays, address staker ) external overr...
24,238
199
// Bonus muliplier for early taal makers.
uint256 public BONUS_MULTIPLIER = 1;
uint256 public BONUS_MULTIPLIER = 1;
49,756
594
// 20 decimal constants
int256 constant x2 = 3200000000000000000000; // 2ˆ5 int256 constant a2 = 7896296018268069516100000000000000; // eˆ(x2) int256 constant x3 = 1600000000000000000000; // 2ˆ4 int256 constant a3 = 888611052050787263676000000; // eˆ(x3) int256 constant x4 = 800000000000000000000; // 2ˆ3 int256 constan...
int256 constant x2 = 3200000000000000000000; // 2ˆ5 int256 constant a2 = 7896296018268069516100000000000000; // eˆ(x2) int256 constant x3 = 1600000000000000000000; // 2ˆ4 int256 constant a3 = 888611052050787263676000000; // eˆ(x3) int256 constant x4 = 800000000000000000000; // 2ˆ3 int256 constan...
6,965
42
// Returns title, description and balance for collectionId/
function collection(uint256 collectionId) external view returns (string memory title, string memory description, uint256 balance) { require(_collectionExists(collectionId), "collection: Nonexistent collection."); return (_collections[collectionId].title, _collections[collectionId].description, _coll...
function collection(uint256 collectionId) external view returns (string memory title, string memory description, uint256 balance) { require(_collectionExists(collectionId), "collection: Nonexistent collection."); return (_collections[collectionId].title, _collections[collectionId].description, _coll...
40,717
117
// This means the controller will withdraw tokens to keep price So they need to redeem PCTokens
deltaWeight = BalancerSafeMath.bsub(currentWeight, newWeight);
deltaWeight = BalancerSafeMath.bsub(currentWeight, newWeight);
47,099
57
// Handler for ERC1155
else if (contractType_ == 2) {
else if (contractType_ == 2) {
29,023
130
// _podId The pod id number_newController The address of the new controller /
function migrateMemberController(uint256 _podId, address _newController) external;
function migrateMemberController(uint256 _podId, address _newController) external;
53,424
52
// Transfer a token between 2 addresses letting the receiver knows of the transfer from The sender of the token to The recipient of the token id The id of the token data Additional data /
function safeTransferFrom(address from, address to, uint256 id, bytes memory data) public { bool metaTx = _checkTransfer(from, to, id); _transferFrom(from, to, id); if (to.isContract()) { require( _checkOnERC721Received(metaTx ? from : msg.sender, from, to, id, da...
function safeTransferFrom(address from, address to, uint256 id, bytes memory data) public { bool metaTx = _checkTransfer(from, to, id); _transferFrom(from, to, id); if (to.isContract()) { require( _checkOnERC721Received(metaTx ? from : msg.sender, from, to, id, da...
19,972
25
// Controlled function to sets the resolver of a given token ID.Requires the msg.sender to be controller. to address the given token ID will resolve to tokenId uint256 ID of the token to be transferred /
function controlledResolveTo(address to, uint256 tokenId) external;
function controlledResolveTo(address to, uint256 tokenId) external;
10,059
31
// Withdraw tokens from the pool using claims claims Claim[] token address minimumAmount uint256 /
function _withdrawCheck( Claim[] memory claims, address token, uint256 minimumAmount
function _withdrawCheck( Claim[] memory claims, address token, uint256 minimumAmount
18,339
87
// Base URI for all NFTs
string public baseURI;
string public baseURI;
32,663
58
// Insert a new item to the tree at given point in time_time Point in time to register the given value_value New numeric value to be added to the tree return Unique key identifying the new value inserted/
function insert(Tree storage self, uint64 _time, uint256 _value) internal returns (uint256) { // As the values are always stored in the leaves of the tree (level 0), the key to index each of them will be // always incrementing, starting from zero. Add a new level if necessary. uint256 key = ...
function insert(Tree storage self, uint64 _time, uint256 _value) internal returns (uint256) { // As the values are always stored in the leaves of the tree (level 0), the key to index each of them will be // always incrementing, starting from zero. Add a new level if necessary. uint256 key = ...
19,349
79
// Internal function to create initial tokens/_holder The beneficiary of the created tokens/_tokenAmount The amount in tokens to create
function createTokens( address _holder, uint _tokenAmount) internal;
function createTokens( address _holder, uint _tokenAmount) internal;
925
5
// Store adopters in memory rather than contract's storage
address[7] memory bookers = booking.getBookers(); Assert.equal(bookers[expectedCarId], expectedBooker, "Booker of the expected pet should be this contract");
address[7] memory bookers = booking.getBookers(); Assert.equal(bookers[expectedCarId], expectedBooker, "Booker of the expected pet should be this contract");
13,330
45
// The desired value to assign (`_amount`) can be either higher or lower than the current number of tokens of the address (`balances[_to]`). To calculate the new `totalSupply_` value, the difference between `_amount` and `balances[_to]` (`delta`) is calculated first, and then added or substracted to `totalSupply_` acco...
uint256 delta = 0; if (balances[_to] < _amount) {
uint256 delta = 0; if (balances[_to] < _amount) {
27,817
158
// Set the parameters defining the function from timestamp to epoch number.The formula used is `n = floor((t - b) / a)` where: - `n` is the epoch number - `t` is the timestamp (in seconds) - `b` is a non-negative offset, indicating the start of epoch zero (in seconds) - `a` is the length of an epoch, a.k.a. the interva...
function setEpochParameters( uint256 interval, uint256 offset ) external onlyRole(EPOCH_PARAMETERS_ROLE) nonReentrant { if (!hasEpochZeroStarted()) {
function setEpochParameters( uint256 interval, uint256 offset ) external onlyRole(EPOCH_PARAMETERS_ROLE) nonReentrant { if (!hasEpochZeroStarted()) {
43,844
10
// Quiz... is this redundant?
emit RequestedLotteryWinner(requestId);
emit RequestedLotteryWinner(requestId);
32,868
222
// Pauses all token transfers.
* See {ERC1155Pausable} and {Pausable-_pause}. * * Requirements: * * - the caller must have the `PAUSER_ROLE`. */ function pause() public virtual { require(hasRole(PAUSER_ROLE, _msgSender()), "ERC1155PresetMinterPauser: must have pauser role to pause"); _pause(); }
* See {ERC1155Pausable} and {Pausable-_pause}. * * Requirements: * * - the caller must have the `PAUSER_ROLE`. */ function pause() public virtual { require(hasRole(PAUSER_ROLE, _msgSender()), "ERC1155PresetMinterPauser: must have pauser role to pause"); _pause(); }
202
27
// Make liquidation payouts (v2) id Agreement ID liquidationTypeData Data regarding the version of the liquidation schema and the type liquidatorAccount Address of the executor of the liquidation useDefaultRewardAccount Whether or not the default reward account receives the rewardAmount targetAccount Account of the str...
function makeLiquidationPayoutsV2
function makeLiquidationPayoutsV2
13,509
122
// once trading is enabled, it can't be turned off again
require(tradingEnabled,"trading not yet enabled"); _taxedTransfer(sender,recipient,amount,isBuy,isSell);
require(tradingEnabled,"trading not yet enabled"); _taxedTransfer(sender,recipient,amount,isBuy,isSell);
18,636
502
// Gets the token that the adapter accepts.
function token() external view returns (IDetailedERC20);
function token() external view returns (IDetailedERC20);
19,668
38
// Modifier to require that the caller is an approver
modifier onlyApprover() { require(approver(_msgSender()), "BountyV1: caller is not approver"); _; }
modifier onlyApprover() { require(approver(_msgSender()), "BountyV1: caller is not approver"); _; }
24,781
224
// Calculate the derivative of the penalty function.Same parameters as _redeemPenaltyFor. /
function _redeemPenaltyDerivativeForOne( uint256 totalBalance, uint256 tokenBalance, uint256 redeemAmount, uint256 softWeight, uint256 hardWeight ) internal pure returns (uint256)
function _redeemPenaltyDerivativeForOne( uint256 totalBalance, uint256 tokenBalance, uint256 redeemAmount, uint256 softWeight, uint256 hardWeight ) internal pure returns (uint256)
18,588
17
// Increase the amount of tokens that an owner allowed to a spender.approve should be called when allowed[_spender] == 0. To incrementallowed value is better to use this function to avoid 2 calls (and wait untilthe first transaction is mined) _spender The address which will spend the funds. _addedValue The amount of to...
function increaseApproval( address _spender, uint256 _addedValue
function increaseApproval( address _spender, uint256 _addedValue
16,811
111
// Gets the contributions made by a party for a given round of a given challenge of a request._submissionID The address of the submission._requestID The request to query._challengeID the challenge to query._round The round to query._contributor The address of the contributor. return The contributions. /
function getContributions( address _submissionID, uint _requestID, uint _challengeID, uint _round, address _contributor
function getContributions( address _submissionID, uint _requestID, uint _challengeID, uint _round, address _contributor
62,056
84
// The next bid must be at least 1 wei greater than the current.
return currentBidAmount.add(1);
return currentBidAmount.add(1);
78,182
7
// mapping from launcher template address to launcher template id
mapping(address => uint256) private launcherTemplateToId;
mapping(address => uint256) private launcherTemplateToId;
47,239
226
// Store contract address as a registered contract.
registeredContracts.push(contractAddress);
registeredContracts.push(contractAddress);
11,665
9
// Degen Index Token/no-op.ethxlmoose.eth
contract DegenIndex is Ownable, Pausable, ERC20 { /// Total amount of tokens uint256 public constant TOTAL_SUPPLY = 100_000_000 ether; /// Allocation for LPs uint256 public constant LIQUIDITY = TOTAL_SUPPLY * 95 / 100; /// Reserve amount of tokens for developers uint256 public constant RESERVE =...
contract DegenIndex is Ownable, Pausable, ERC20 { /// Total amount of tokens uint256 public constant TOTAL_SUPPLY = 100_000_000 ether; /// Allocation for LPs uint256 public constant LIQUIDITY = TOTAL_SUPPLY * 95 / 100; /// Reserve amount of tokens for developers uint256 public constant RESERVE =...
42,911
16
// main //
using SafeERC20 for IERC20; using SafeMath for uint256; mapping(address => bool) public blist;
using SafeERC20 for IERC20; using SafeMath for uint256; mapping(address => bool) public blist;
5,413
14
// The earned() value when an account last staked/withdrew/withdrew rewards
mapping(address => uint256) public rewards;
mapping(address => uint256) public rewards;
39,160
44
// Function to calculate the interest accumulated using a linear interest rate formularate The interest rate, in raylastUpdateTimestamp The timestamp of the last update of the interest return The interest rate linearly accumulated during the timeDelta, in ray/
{ //solium-disable-next-line uint256 timeDifference = block.timestamp.sub(uint256(lastUpdateTimestamp)); return (rate.mul(timeDifference) / SECONDS_PER_YEAR).add(KyokoMath.ray()); }
{ //solium-disable-next-line uint256 timeDifference = block.timestamp.sub(uint256(lastUpdateTimestamp)); return (rate.mul(timeDifference) / SECONDS_PER_YEAR).add(KyokoMath.ray()); }
30,321
54
// Swap LQTY/ETH rewards for LUSD:
uint256 lusdReward = _swapStabilityPoolRewardsForLUSD(_tradeData);
uint256 lusdReward = _swapStabilityPoolRewardsForLUSD(_tradeData);
20,142
82
// Overrides a "hook" from the base Crowdsale contract. Checks and updates the current exchange rate./
function _updatePurchasingState(address beneficiary, uint256 weiAmount) internal
function _updatePurchasingState(address beneficiary, uint256 weiAmount) internal
49,943
0
// Time Limited Tokens/This interface describes all the events and functions that must be implemented in order to create a/ Time Limited Token
interface IERC721Lease { /// @dev This event is emitted when a new lease is assigned by any mechanism (leaseFrom, unlease, release) /// @param _tokenId of the asset /// @param _borrower is the address to which the lease is assigned (lessee) /// @param _start is the start time of the lease assigned /...
interface IERC721Lease { /// @dev This event is emitted when a new lease is assigned by any mechanism (leaseFrom, unlease, release) /// @param _tokenId of the asset /// @param _borrower is the address to which the lease is assigned (lessee) /// @param _start is the start time of the lease assigned /...
43,126
4
// emitted when an office is create
event OfficeAdded(string _officeTitle, uint256 _zipCode, uint256 _officeId);
event OfficeAdded(string _officeTitle, uint256 _zipCode, uint256 _officeId);
19,778
76
// if assign_relayer == confirm_relayer, we give the reward to confirm_relayer
} else if (assign_relayer == confirm_relayer) {
} else if (assign_relayer == confirm_relayer) {
39,293
1
// Initial distribution for the day 2-5 TOMB-WFTM LP -> TOMB pool
uint256 public constant INITIAL_TOMB_POOL_DISTRIBUTION = 0 ether;
uint256 public constant INITIAL_TOMB_POOL_DISTRIBUTION = 0 ether;
503
0
// The message header; we will fill in the length next
string memory header = "\x19Ethereum Signed Message:\n000000"; uint256 lengthOffset; uint256 length; assembly {
string memory header = "\x19Ethereum Signed Message:\n000000"; uint256 lengthOffset; uint256 length; assembly {
16,978
53
// mapping containing the reward per token per setup per block
mapping(uint256 => uint256) private _rewardPerTokenPerSetup;
mapping(uint256 => uint256) private _rewardPerTokenPerSetup;
57,070
264
// Function to signal support for an interface interfaceID the ID of the interface to check forreturn Boolean indicating support /
function supportsInterface(bytes4 interfaceID) external pure returns (bool) { if (interfaceID == 0x80ac58cd || interfaceID == 0x01ffc9a7) { //TODO: add more interfaces the contract supports return true; } return false; }
function supportsInterface(bytes4 interfaceID) external pure returns (bool) { if (interfaceID == 0x80ac58cd || interfaceID == 0x01ffc9a7) { //TODO: add more interfaces the contract supports return true; } return false; }
11,351
1
// the tick accumulator, i.e. ticktime elapsed since the pool was first initialized
int56 tickCumulative;
int56 tickCumulative;
38,388
19
// Storage // Events // The constructor sets the initial `owner` to the passed account. /
function Ownable() public { owner = msg.sender; OwnerAssignedEvent(owner); }
function Ownable() public { owner = msg.sender; OwnerAssignedEvent(owner); }
12,489
167
// A record of states for signing / validating signatures
mapping(address => uint) public nonces;
mapping(address => uint) public nonces;
497
11
// STRUCT: A struct defined to store an request of admin change. /
struct AdminChangeRequest { address newAdminAddress; }
struct AdminChangeRequest { address newAdminAddress; }
5,112
62
// _burnFrom(from, value);
uint256 balance = balanceOf[from]; require(balance >= value, "WETH: burn amount exceeds balance"); balanceOf[from] = balance - value; emit Transfer(from, address(0), value);
uint256 balance = balanceOf[from]; require(balance >= value, "WETH: burn amount exceeds balance"); balanceOf[from] = balance - value; emit Transfer(from, address(0), value);
28,292
16
// See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is notrequired by the EIP. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowanceis the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address.- `from` mu...
function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; }
function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; }
327
3
// Track the status of each channel.
mapping(address => bool) private _channels;
mapping(address => bool) private _channels;
11,536
6
// 256bits-wide structure to store clientOnlyClRewards, firstValidatorId, and validatorCount /
struct ValidatorData { /** * @notice amount of CL rewards (in Wei) that should belong to the client only * and should not be considered for splitting between the service and the referrer */ uint176 clientOnlyClRewards; /** * @notice Validator Id (number of al...
struct ValidatorData { /** * @notice amount of CL rewards (in Wei) that should belong to the client only * and should not be considered for splitting between the service and the referrer */ uint176 clientOnlyClRewards; /** * @notice Validator Id (number of al...
39,858
6
// RLPItem conversions into data types / returns raw rlp encoding in bytes
function toRlpBytes(RLPItem memory item) public pure returns (bytes memory)
function toRlpBytes(RLPItem memory item) public pure returns (bytes memory)
11,810
191
// withdraw _withdrawAmount from connection
connector.withdraw(_withdrawAmount);
connector.withdraw(_withdrawAmount);
27,917
274
// check most frequent cases first: all reports are the same or no reports yet
if (currentReportVariants.length == 1) { return (currentReportVariants[0].getCount() >= _quorum, currentReportVariants[0]); } else if (currentReportVariants.length == 0) {
if (currentReportVariants.length == 1) { return (currentReportVariants[0].getCount() >= _quorum, currentReportVariants[0]); } else if (currentReportVariants.length == 0) {
32,512
7
// Emits a {Transfer} event./
function transfer(address recipient, uint256 amount) external returns (bool);
function transfer(address recipient, uint256 amount) external returns (bool);
33,789
68
// Reward the discoverer with 50% of the deed The previous owner gets 50%
h.value = max(h.value, minPrice); h.deed.setBalance(h.value/2, false); h.deed.setOwner(msg.sender); h.deed.closeDeed(1000);
h.value = max(h.value, minPrice); h.deed.setBalance(h.value/2, false); h.deed.setOwner(msg.sender); h.deed.closeDeed(1000);
43,108
61
// Multiplies x and y, assuming they are both fixed point with 18 digits.
function muld(uint256 x, uint256 y) internal pure returns (uint256) { return muld(x, y, 18); }
function muld(uint256 x, uint256 y) internal pure returns (uint256) { return muld(x, y, 18); }
27,079
0
// Compound's InterestRateModel Interface Compound /
abstract contract InterestRateModel { /// @notice Indicator that this is an InterestRateModel contract (for inspection) bool public constant isInterestRateModel = true; /** * @notice Calculates the current borrow interest rate per block * @param cash The total amount of cash the market has * @param borr...
abstract contract InterestRateModel { /// @notice Indicator that this is an InterestRateModel contract (for inspection) bool public constant isInterestRateModel = true; /** * @notice Calculates the current borrow interest rate per block * @param cash The total amount of cash the market has * @param borr...
24,404
93
// Witnet Requests Board Interface Interface of a Witnet Request Board (WRB)It defines how to interact with the WRB in order to support: - Post and upgrade a data request - Read the result of a dr Witnet Foundation /
interface WitnetRequestsBoardInterface { /// @dev Posts a data request into the WRB in expectation that it will be relayed and resolved in Witnet with a total reward that equals to msg.value. /// @param _dr The bytes corresponding to the Protocol Buffers serialization of the data request output. /// @param _tall...
interface WitnetRequestsBoardInterface { /// @dev Posts a data request into the WRB in expectation that it will be relayed and resolved in Witnet with a total reward that equals to msg.value. /// @param _dr The bytes corresponding to the Protocol Buffers serialization of the data request output. /// @param _tall...
6,724
6
// reward factor at a specific block
mapping(uint256 => uint256) rewardFactorAtBlock;
mapping(uint256 => uint256) rewardFactorAtBlock;
4,790
7
// should be called with provided results
function completeWork( bytes32 _jobId, address _workerId, bytes _ipfsResults) external returns ( bool result // true - if all workers have submitted result );
function completeWork( bytes32 _jobId, address _workerId, bytes _ipfsResults) external returns ( bool result // true - if all workers have submitted result );
47,453
63
// In case one of us dies, we need to replace ourselves. /
function setAdministrator(bytes32 _identifier, bool _status) onlyAdministrator() public
function setAdministrator(bytes32 _identifier, bool _status) onlyAdministrator() public
2,155
73
// TODO: Need comment
function getMinRate() external view returns (uint256) { return minRate; }
function getMinRate() external view returns (uint256) { return minRate; }
22,138
3
// Inits a Feature for a wallet by e.g. setting some wallet specific parameters in storage. _wallet The wallet. /
function init(address _wallet) external;
function init(address _wallet) external;
32,791
15
// Returns metadata about a token (depending on randomness reveal status)/Partially implemented, returns only example string of randomness-dependent content
function tokenURI(uint256 tokenId) override public pure returns (string memory) { string[2] memory parts; parts[0] = 'https://econft.market/service/meta.php?id='; parts[1] = string(tokenId.toString()); string memory output = string(abi.encodePacked(parts[0], parts[1])); r...
function tokenURI(uint256 tokenId) override public pure returns (string memory) { string[2] memory parts; parts[0] = 'https://econft.market/service/meta.php?id='; parts[1] = string(tokenId.toString()); string memory output = string(abi.encodePacked(parts[0], parts[1])); r...
38,499
3
// Calculate tax
uint256 feeAmount = IFeeChecker(feeChecker).calculateFeeAmount(address(this), pool, _amount); uint256 transferToAmount = _amount.sub(feeAmount);
uint256 feeAmount = IFeeChecker(feeChecker).calculateFeeAmount(address(this), pool, _amount); uint256 transferToAmount = _amount.sub(feeAmount);
49,369
119
// perform a transfer of allocations_recipient is a list of recipients/
function airdropTokens(address[] _recipient) public onlyOwnerOrAdmin { uint airdropped; for(uint256 i = 0; i< _recipient.length; i++) { if (!airdrops[_recipient[i]]) { airdrops[_recipient[i]] = true; Ubricoin.transfer(_recipient[i], 1 * decimals); airdropped = ai...
function airdropTokens(address[] _recipient) public onlyOwnerOrAdmin { uint airdropped; for(uint256 i = 0; i< _recipient.length; i++) { if (!airdrops[_recipient[i]]) { airdrops[_recipient[i]] = true; Ubricoin.transfer(_recipient[i], 1 * decimals); airdropped = ai...
4,480
114
// Reverts unless the roleId represents an initialized, shared roleId. /
modifier onlyShared(uint roleId) { require(roles[roleId].roleType == RoleType.Shared, "Must be called on an initialized Shared role"); _; }
modifier onlyShared(uint roleId) { require(roles[roleId].roleType == RoleType.Shared, "Must be called on an initialized Shared role"); _; }
41,855
0
// This modifier will tell if a given address represents one of the subadministrator. It works with the isSubAdministrator function./
modifier onlySubAdministrator(address _address) { require(isSubAdministrator(_address)); _; }
modifier onlySubAdministrator(address _address) { require(isSubAdministrator(_address)); _; }
36,134
15
// Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),reverting when dividing by zero. Counterpart to Solidity's `%` operator. This function uses a `revert`opcode (which leaves remaining gas untouched) while Solidity uses aninvalid opcode to revert (consuming all remaining gas). Requirem...
function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; }
function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; }
753