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 |
|---|---|---|---|---|
1,327 | // Emit reward retrieval for this vote. |
emit RewardsRetrieved(
voterAddress,
roundId,
toRetrieve[i].identifier,
toRetrieve[i].time,
|
emit RewardsRetrieved(
voterAddress,
roundId,
toRetrieve[i].identifier,
toRetrieve[i].time,
| 1,997 |
16 | // Market | bool public marketPaused;
bool public contractSealed;
mapping(address => uint256) public xDaiBalance;
mapping(bytes32 => bool) public cancelledOffers;
| bool public marketPaused;
bool public contractSealed;
mapping(address => uint256) public xDaiBalance;
mapping(bytes32 => bool) public cancelledOffers;
| 5,255 |
34 | // Returns the count of all users who have interacted with the contract. return _userCount The count of all users who have interacted with the contract./ | function getUserCount() public view returns(uint256 _userCount){
address[] memory _usersArray = userStorage.getUsersArray();
return _usersArray.length;
}
| function getUserCount() public view returns(uint256 _userCount){
address[] memory _usersArray = userStorage.getUsersArray();
return _usersArray.length;
}
| 7,970 |
1 | // lender Address of lender to verifyreturn Value indicating whether given lender address is allowed to put funds into an instrument or not / | function isAllowed(address lender) external view returns (bool);
| function isAllowed(address lender) external view returns (bool);
| 19,357 |
221 | // NiftyPlanetNiftyPlanet shared asset contract / | contract NiftyPlanet is AssetContract, ReentrancyGuard {
mapping(address => bool) public sharedProxyAddresses;
using SafeMath for uint256;
using TokenIdentifiers for uint256;
event CreatorChanged(uint256 indexed _id, address indexed _creator);
mapping(uint256 => address) internal _creatorOverride;... | contract NiftyPlanet is AssetContract, ReentrancyGuard {
mapping(address => bool) public sharedProxyAddresses;
using SafeMath for uint256;
using TokenIdentifiers for uint256;
event CreatorChanged(uint256 indexed _id, address indexed _creator);
mapping(uint256 => address) internal _creatorOverride;... | 28,348 |
85 | // See {IERC721Metadata-name}. / | function name() public view virtual override returns (string memory) {
return _name;
}
| function name() public view virtual override returns (string memory) {
return _name;
}
| 55,738 |
2 | // Used by the DAppChain Gateway to mint tokens that have been deposited to the Mainnet Gateway | function mintToGateway(uint256 _uid) public {
require(msg.sender == gateway);
_mint(gateway, _uid);
}
| function mintToGateway(uint256 _uid) public {
require(msg.sender == gateway);
_mint(gateway, _uid);
}
| 41,383 |
322 | // Siring auction will throw if the bid fails. | siringAuction.bid.value(currentPrice - auctioneerCut)(_sireId, msg.sender);
_breedWith(uint32(_matronId), uint32(_sireId));
| siringAuction.bid.value(currentPrice - auctioneerCut)(_sireId, msg.sender);
_breedWith(uint32(_matronId), uint32(_sireId));
| 15,260 |
233 | // Get the OPEN STATE/ | function getOpenState() external pure returns (STATE) {
return STATE.OPEN;
}
| function getOpenState() external pure returns (STATE) {
return STATE.OPEN;
}
| 53,291 |
33 | // returns the number of the airlines registred to the contract / | function getAirlinesNumber() external view requireIsOperational returns(uint256)
| function getAirlinesNumber() external view requireIsOperational returns(uint256)
| 39,324 |
84 | // PullPayment Base contract supporting async send for pull payments. Inherit from thiscontract and use _asyncTransfer instead of send or transfer. / | contract PullPayment {
Escrow private _escrow;
constructor () internal {
_escrow = new Escrow();
}
/**
* @dev Withdraw accumulated balance.
* @param payee Whose balance will be withdrawn.
*/
function withdrawPayments(address payable payee) public {
_escrow.withdraw(p... | contract PullPayment {
Escrow private _escrow;
constructor () internal {
_escrow = new Escrow();
}
/**
* @dev Withdraw accumulated balance.
* @param payee Whose balance will be withdrawn.
*/
function withdrawPayments(address payable payee) public {
_escrow.withdraw(p... | 47,195 |
21 | // The amount of ETH that is used to allocate to deposits and fill the pending unstake requests. | uint256 public unallocatedETH;
| uint256 public unallocatedETH;
| 32,721 |
1 | // @inheritdoc IEyeconsRebasePoolV1 | function initialize(
uint256 upgradingPrice_,
IERC20MetadataUpgradeable tether_,
address payable treasury_,
address eye_,
address eyecons_,
address authority_
)
external
initializer
| function initialize(
uint256 upgradingPrice_,
IERC20MetadataUpgradeable tether_,
address payable treasury_,
address eye_,
address eyecons_,
address authority_
)
external
initializer
| 41,675 |
204 | // Updates the pending claim start variable, the lowest claim id with a pending decision/payout. / | function setpendingClaimStart(uint _start) external onlyInternal {
require(pendingClaimStart <= _start);
pendingClaimStart = _start;
}
| function setpendingClaimStart(uint _start) external onlyInternal {
require(pendingClaimStart <= _start);
pendingClaimStart = _start;
}
| 33,312 |
5 | // See {IERC1888-issue}./`_to` cannot be the zero address. | function issue(address _to, bytes calldata _validityData, uint256 _topic, uint256 _value, bytes calldata _data) external override returns (uint256 id) {
require(_to != address(0x0), "_to must be non-zero.");
_validate(_msgSender(), _validityData);
id = ++_latestCertificateId;
ERC1155._mint(_to, id, _value,... | function issue(address _to, bytes calldata _validityData, uint256 _topic, uint256 _value, bytes calldata _data) external override returns (uint256 id) {
require(_to != address(0x0), "_to must be non-zero.");
_validate(_msgSender(), _validityData);
id = ++_latestCertificateId;
ERC1155._mint(_to, id, _value,... | 35,100 |
7 | // check if the nft address is erc1155 compliant | require(IERC165(_erc1155).supportsInterface(_INTERFACE_ID_ERC1155));
| require(IERC165(_erc1155).supportsInterface(_INTERFACE_ID_ERC1155));
| 34,318 |
79 | // Collects and distributes the primary sale value of NFTs being claimed. | function _collectMakePiggyFee() internal virtual {
if (makePiggyFee == 0) {
return;
}
require(msg.value == makePiggyFee, "Must send the correct fee");
CurrencyTransferLib.transferCurrency(
CurrencyTransferLib.NATIVE_TOKEN,
msg.sender,
... | function _collectMakePiggyFee() internal virtual {
if (makePiggyFee == 0) {
return;
}
require(msg.value == makePiggyFee, "Must send the correct fee");
CurrencyTransferLib.transferCurrency(
CurrencyTransferLib.NATIVE_TOKEN,
msg.sender,
... | 28,274 |
169 | // UTILS // Called by admin on deployment for KNC Approves Kyber Proxy contract to trade KNC Token to approve on proxy contract Pass _reset as true if resetting allowance to zero / | function approveKyberProxyContract(address _token, bool _reset)
external
onlyOwnerOrManager
| function approveKyberProxyContract(address _token, bool _reset)
external
onlyOwnerOrManager
| 75,852 |
226 | // lib/dss-test/lib/dss-interfaces/src/dss/EndAbstract.sol/ pragma solidity >=0.5.12; / https:github.com/makerdao/dss/blob/master/src/end.sol | interface EndAbstract {
function wards(address) external view returns (uint256);
function rely(address) external;
function deny(address) external;
function vat() external view returns (address);
function cat() external view returns (address);
function dog() external view returns (address);
f... | interface EndAbstract {
function wards(address) external view returns (uint256);
function rely(address) external;
function deny(address) external;
function vat() external view returns (address);
function cat() external view returns (address);
function dog() external view returns (address);
f... | 27,713 |
12 | // Irreversibly activate the kill switch. | kill_switch = true;
| kill_switch = true;
| 19,917 |
211 | // _rollupParams = [ confirmPeriodBlocks, extraChallengeTimeBlocks, arbGasSpeedLimitPerBlock, baseStake ] connectedContracts = [delayedBridge, sequencerInbox, outbox, rollupEventBridge, challengeFactory, nodeFactory] | function initialize(
bytes32 _machineHash,
uint256[4] calldata _rollupParams,
address _stakeToken,
address _owner,
bytes calldata _extraConfig,
address[6] calldata connectedContracts,
address[2] calldata _facets,
uint256[2] calldata sequencerInboxParam... | function initialize(
bytes32 _machineHash,
uint256[4] calldata _rollupParams,
address _stakeToken,
address _owner,
bytes calldata _extraConfig,
address[6] calldata connectedContracts,
address[2] calldata _facets,
uint256[2] calldata sequencerInboxParam... | 35,833 |
10 | // Read the bytes4 from array memory | assembly {
result := mload(add(b, add(index,32)))
| assembly {
result := mload(add(b, add(index,32)))
| 39,432 |
9 | // pause unpause | function pause() public onlyOwner {
_pause();
}
| function pause() public onlyOwner {
_pause();
}
| 12,598 |
150 | // Enable a delegate to act on the behalf of an user | function _addDelegate(address user, address delegate) internal {
require(!delegated[user][delegate], "Delegable: Already delegated");
delegated[user][delegate] = true;
emit Delegate(user, delegate, true);
}
| function _addDelegate(address user, address delegate) internal {
require(!delegated[user][delegate], "Delegable: Already delegated");
delegated[user][delegate] = true;
emit Delegate(user, delegate, true);
}
| 56,352 |
189 | // Multiplies an `Unsigned` and an unscaled uint256 and "ceil's" the product, reverting on overflow. a a FixedPoint. b a FixedPoint.return the product of `a` and `b`. / | function mulCeil(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {
// Since b is an int, there is no risk of truncation and we can just mul it normally
return Unsigned(a.rawValue.mul(b));
}
| function mulCeil(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {
// Since b is an int, there is no risk of truncation and we can just mul it normally
return Unsigned(a.rawValue.mul(b));
}
| 61,835 |
131 | // Mint tokens for each ids in _ids _to The address to mint tokens to _idsArray of ids to mint _amountsArray of amount of tokens to mint per id _dataData to pass if receiver is contract / | function _batchMint(address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data)
internal
| function _batchMint(address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data)
internal
| 27,171 |
12 | // If block timeFromExpectedUpdate is greater than interpolationThreshold we linearize the current price to try to reduce error | if (timeFromExpectedUpdate < interpolationThreshold) {
return currentEMAValue;
} else {
| if (timeFromExpectedUpdate < interpolationThreshold) {
return currentEMAValue;
} else {
| 27,809 |
94 | // cant take reward asset | require(_token != oliv, "oliv");
| require(_token != oliv, "oliv");
| 14,042 |
11 | // Bonus muliplier for early GovernanceToken makers. | uint256[] public REWARD_MULTIPLIER; // init in constructor function
uint256[] public HALVING_AT_BLOCK; // init in constructor function
uint256[] public blockDeltaStartStage;
uint256[] public blockDeltaEndStage;
uint256[] public userFeeStage;
uint256[] public devFeeStage;
uint256 public FINIS... | uint256[] public REWARD_MULTIPLIER; // init in constructor function
uint256[] public HALVING_AT_BLOCK; // init in constructor function
uint256[] public blockDeltaStartStage;
uint256[] public blockDeltaEndStage;
uint256[] public userFeeStage;
uint256[] public devFeeStage;
uint256 public FINIS... | 17,119 |
263 | // withdraw an amount of shares for underlying | function withdraw(uint256 shares) external override defense {
_withdraw(msg.sender, shares);
}
| function withdraw(uint256 shares) external override defense {
_withdraw(msg.sender, shares);
}
| 5,802 |
73 | // read deposit at specified index and return | return users[_user].deposits[_depositId];
| return users[_user].deposits[_depositId];
| 11,132 |
27 | // define packages here | definePackage("Silver Package", 30, 8);
definePackage("Gold Package", 60, 10);
definePackage("Platinum Package", 90, 12);
| definePackage("Silver Package", 30, 8);
definePackage("Gold Package", 60, 10);
definePackage("Platinum Package", 90, 12);
| 1,659 |
38 | // bool sell = false;this define input for limit | int256 yes = 1;
int256 no = 2;
| int256 yes = 1;
int256 no = 2;
| 4,700 |
49 | // Allows anyone to transfer the Change tokens once trading has started_from address The address which you want to send tokens from_to address The address which you want to transfer to_value uint the amout of tokens to be transfered / | function transferFrom(address _from, address _to, uint _value) hasStartedTrading whenNotPaused public returns (bool) {
return super.transferFrom(_from, _to, _value);
}
| function transferFrom(address _from, address _to, uint _value) hasStartedTrading whenNotPaused public returns (bool) {
return super.transferFrom(_from, _to, _value);
}
| 34,407 |
18 | // Construction method of Extra Holding contract/Arrays of recipients and their share parts should be equal and not empty/Sum of all shares should be exact equal to 10000/_holdingToken is address of affilated contract/_recipients is array of recipients/_partions is array of recipients shares | function ExtraHolderContract(
address _holdingToken,
address[] _recipients,
uint[] _partions)
public
| function ExtraHolderContract(
address _holdingToken,
address[] _recipients,
uint[] _partions)
public
| 41,608 |
19 | // the member is in the systemthe member is not in a community | if ((member[_newMember].isMember = true) && (member[_newMember].memberCommunity == 0)) {
member[_newMember].memberCommunity = _communityID;
member[_newMember].balance = 0;
member[_newMember].creditLine = community[_communityID].defaultCreditLine;
member[_newMember].trust = community[_communityID].defaultTrust... | if ((member[_newMember].isMember = true) && (member[_newMember].memberCommunity == 0)) {
member[_newMember].memberCommunity = _communityID;
member[_newMember].balance = 0;
member[_newMember].creditLine = community[_communityID].defaultCreditLine;
member[_newMember].trust = community[_communityID].defaultTrust... | 12,167 |
19 | // Compute the end of the cooldown time (based on current cooldownIndex) | aps.cooldownEndTime = uint48(now + uint256(cooldowns[aps.cooldownIndex]));
| aps.cooldownEndTime = uint48(now + uint256(cooldowns[aps.cooldownIndex]));
| 17,760 |
5 | // Address of the KeeperDAO liquidity pool. This is will be the/ address to which the `helloCallback` function must return all bororwed/ assets (and all excess profits). | address payable public liquidityPool;
| address payable public liquidityPool;
| 21,133 |
19 | // Convenience and rounding functions when dealing with numbers already factored by 1018 or 1027Math operations with safety checks that throw on error/ | library SafeMathFixedPoint {
using SafeMath for uint256;
function mul27(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = x.mul(y).add(5 * 10**26).div(10**27);
}
function mul18(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = x.mul(y).add(5 * 10**17).div(10**18);
}
function div18(ui... | library SafeMathFixedPoint {
using SafeMath for uint256;
function mul27(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = x.mul(y).add(5 * 10**26).div(10**27);
}
function mul18(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = x.mul(y).add(5 * 10**17).div(10**18);
}
function div18(ui... | 15,896 |
168 | // The minimum period of mining (block number) | uint256 public segment = 240;
CynToken public cyn;
address public devaddr;
uint256 public capacity = 1000000000 * 10**18;
uint256 public totalSupply = 0;
| uint256 public segment = 240;
CynToken public cyn;
address public devaddr;
uint256 public capacity = 1000000000 * 10**18;
uint256 public totalSupply = 0;
| 35,986 |
8 | // Mapping of Tier Package BitMap to Tier ID | mapping(uint256 => uint256) internal tiers;
| mapping(uint256 => uint256) internal tiers;
| 8,343 |
60 | // the minted token is added _totalSupply value tokens to be minted _address receiver of minted tokens / | function mint(uint256 value, address _address) external onlyOwner {
_mint(_address, value);
}
| function mint(uint256 value, address _address) external onlyOwner {
_mint(_address, value);
}
| 25,412 |
1 | // Info of each MCV2 user./ `amount` LP token amount the user has provided./ `rewardDebt` Used to calculate the correct amount of rewards. See explanation below.// We do some fancy math here. Basically, any point in time, the amount of POPS/ entitled to a user but is pending to be distributed is:// pending reward = (us... | struct UserInfo {
uint256 amount;
uint256 rewardDebt;
uint256 extraRewardDebt;
uint256 boostMultiplier;
}
| struct UserInfo {
uint256 amount;
uint256 rewardDebt;
uint256 extraRewardDebt;
uint256 boostMultiplier;
}
| 24,812 |
14 | // Each farmer starts with 5 fields & 3 Sunflowers | land.push(empty);
land.push(sunflower);
land.push(sunflower);
land.push(sunflower);
land.push(empty);
syncedAt[msg.sender] = block.timestamp;
| land.push(empty);
land.push(sunflower);
land.push(sunflower);
land.push(sunflower);
land.push(empty);
syncedAt[msg.sender] = block.timestamp;
| 52,193 |
39 | // An extra check to prevent re-entrancy through target call. | if (callResult == true) {
require(!transaction.executed, "This transaction has already been executed.");
transaction.executed = true;
}
| if (callResult == true) {
require(!transaction.executed, "This transaction has already been executed.");
transaction.executed = true;
}
| 11,564 |
72 | // // Adjust the scale of an integer adjustment Amount to adjust by e.g. scaleBy(1e18, -1) == 1e17 / | function scaleBy(uint256 x, int8 adjustment)
internal
pure
returns (uint256)
| function scaleBy(uint256 x, int8 adjustment)
internal
pure
returns (uint256)
| 27,203 |
387 | // This function will try encoding a timestamp and output-ing what happens | function encodeTimestamp(uint256 timestamp)
external
returns (string memory)
| function encodeTimestamp(uint256 timestamp)
external
returns (string memory)
| 32,954 |
2 | // Events | event LodgingFacilityCreated(bytes32 facilityId, address indexed owner, string dataURI);
event LodgingFacilityUpdated(bytes32 facilityId, string dataURI);
event LodgingFacilityActiveState(bytes32 facilityId, bool active);
event LodgingFacilityOwnershipTransfer(bytes32 facilityId, address indexed prevOwner, addr... | event LodgingFacilityCreated(bytes32 facilityId, address indexed owner, string dataURI);
event LodgingFacilityUpdated(bytes32 facilityId, string dataURI);
event LodgingFacilityActiveState(bytes32 facilityId, bool active);
event LodgingFacilityOwnershipTransfer(bytes32 facilityId, address indexed prevOwner, addr... | 21,281 |
59 | // Withdraws the ether distributed to the sender./SHOULD transfer `dividendOf(msg.sender)` wei to `msg.sender`, and `dividendOf(msg.sender)` SHOULD be 0 after the transfer./MUST emit a `DividendWithdrawn` event if the amount of ether transferred is greater than 0. | function withdrawDividend() external;
| function withdrawDividend() external;
| 24,022 |
8 | // calculate the quotient and remainder with the given precision | uint256 _precisionFactor = 10**_precision;
uint256 _quotient = _integerAsUint / _denominator;
uint256 _remainder = ((_integerAsUint * _precisionFactor) / _denominator) %
_precisionFactor;
if (_remainder == 0) {
return
string(
abi.encodePacked(_integerToString(_quotient), su... | uint256 _precisionFactor = 10**_precision;
uint256 _quotient = _integerAsUint / _denominator;
uint256 _remainder = ((_integerAsUint * _precisionFactor) / _denominator) %
_precisionFactor;
if (_remainder == 0) {
return
string(
abi.encodePacked(_integerToString(_quotient), su... | 33,041 |
48 | // ERC165 Interface ID for ERC721TokenReceiver. | interfaceId == this.onERC721Received.selector ||
| interfaceId == this.onERC721Received.selector ||
| 37,940 |
29 | // Sets the reward amount and merkle proof from off-chain. _rewardTokenAddress The reward token address proof the MerkleProof provided by AlphaHomora amount The accumulated (total) amount of rewards. / | function setProofAndAmount(
address _rewardTokenAddress,
bytes32[] calldata proof,
uint256 amount
| function setProofAndAmount(
address _rewardTokenAddress,
bytes32[] calldata proof,
uint256 amount
| 44,410 |
324 | // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96. we then downcast because we know the result always fits within 160 bits due to our tick input constraint we round up in the division so getTickAtSqrtRatio of the output price is always consistent | sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));
| sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));
| 6,313 |
9 | // ---------------------------------------------------------------------------- Ownership contract _newOwner is address of new owner ---------------------------------------------------------------------------- | contract Owned {
address public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = 0x94f5b6461b192B18c143417556Fbe2abB4460476;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
// transfer Own... | contract Owned {
address public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = 0x94f5b6461b192B18c143417556Fbe2abB4460476;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
// transfer Own... | 42,052 |
59 | // withdraw without caring about Rewards | function emergencyWithdraw(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(now.sub(depositTime[msg.sender]) > cliffTime, "Please wait before withdrawing!");
lastClaimedTime[msg.sender] = now;
lastDivPoin... | function emergencyWithdraw(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(now.sub(depositTime[msg.sender]) > cliffTime, "Please wait before withdrawing!");
lastClaimedTime[msg.sender] = now;
lastDivPoin... | 10,452 |
101 | // event for LP added to vBRIGHT tokenAmount amount of tokens added to LP ethAmount ETH paid for purchase liquidity the LP tokenAddress address / | event onLpvAdded(
uint256 tokenAmount,
| event onLpvAdded(
uint256 tokenAmount,
| 84,968 |
66 | // we paid out (using creditCigarettes()) more than the actual CIG harvested. This can happen if rewards were decreased. In this case, cancel out the reward from the paid credit, and remainder will be debited next time fetchCigarettes() is called. | paidCigDebt = paid - cigReward;
| paidCigDebt = paid - cigReward;
| 36,317 |
16 | // File: contracts/interfaces/controller/IManagerActions.sol/控制器合约基金经理操作接口定义 | interface IManagerActions {
/// @notice 设置代币交易路径
/// @dev This function can only be called by manager
/// @dev 设置路径时不能修改为0地址,且path路径里的token必须验证是否受信任
/// @param fund 基金地址
/// @param distToken 目标代币地址
/// @param path 符合uniswap v3格式的交易路径
function setPath(
address fund,
address ... | interface IManagerActions {
/// @notice 设置代币交易路径
/// @dev This function can only be called by manager
/// @dev 设置路径时不能修改为0地址,且path路径里的token必须验证是否受信任
/// @param fund 基金地址
/// @param distToken 目标代币地址
/// @param path 符合uniswap v3格式的交易路径
function setPath(
address fund,
address ... | 26,926 |
6 | // Returns array of exchange instances for a given pair _tokenThe address of the ERC-1155 token contract _currency The address of the ERC-20 token contract / | function getPairExchanges(address _token, address _currency) public override view returns (address[] memory) {
return pairExchanges[_token][_currency];
}
| function getPairExchanges(address _token, address _currency) public override view returns (address[] memory) {
return pairExchanges[_token][_currency];
}
| 51,643 |
15 | // Get token URI for a given Avastar Token ID.Reverts if given token id is not a valid Avastar Token ID. _tokenId the Token ID of a previously minted Avastar Prime or Replicantreturn uri the off-chain URI to the JSON metadata for the given Avastar / | function tokenURI(uint _tokenId)
external view
returns (string memory uri);
| function tokenURI(uint _tokenId)
external view
returns (string memory uri);
| 30,325 |
11 | // Dividend percentage should be a currently accepted value. | require (validDividendRates_[_divChoice]);
| require (validDividendRates_[_divChoice]);
| 53,469 |
22 | // accumulating penalty amount on each staked withdrawal to be sent to lockwallet | totalPenalty = totalPenalty.add(rewardPenalty);
| totalPenalty = totalPenalty.add(rewardPenalty);
| 47,662 |
118 | // The Token price storage | ITokenPriceRegistry public tokenPriceRegistry;
| ITokenPriceRegistry public tokenPriceRegistry;
| 26,249 |
66 | // fully redeem a past stake | newStakingShareSecondsToBurn = lastStake.stakingShares.mul(stakeTimeSec);
rewardAmount = computeNewReward(rewardAmount, newStakingShareSecondsToBurn, stakeTimeSec);
stakingShareSecondsToBurn = stakingShareSecondsToBurn.add(newStakingShareSecondsToBurn);
sh... | newStakingShareSecondsToBurn = lastStake.stakingShares.mul(stakeTimeSec);
rewardAmount = computeNewReward(rewardAmount, newStakingShareSecondsToBurn, stakeTimeSec);
stakingShareSecondsToBurn = stakingShareSecondsToBurn.add(newStakingShareSecondsToBurn);
sh... | 3,615 |
38 | // Get the "content hash" of a given subdomain.EIP1577 functionality / | function contenthash(bytes32 nodeID) public view returns (bytes memory) {
uint256 rescueOrder = getRescueOrderFromNodeId(nodeID);
return ContentsMapping[rescueOrder];
}
| function contenthash(bytes32 nodeID) public view returns (bytes memory) {
uint256 rescueOrder = getRescueOrderFromNodeId(nodeID);
return ContentsMapping[rescueOrder];
}
| 45,177 |
284 | // Maps collaterals to their custom fees on interest taken by the protocol./A fixed point number where 1e18 represents 100% and 0 represents 0%. | mapping(ERC20 => uint256) public getCustomFeePercentageForCollateral;
| mapping(ERC20 => uint256) public getCustomFeePercentageForCollateral;
| 61,561 |
304 | // Returns an Ethereum Signed Message, created from `s`. Thisproduces hash corresponding to the one signed with theJSON-RPC method as part of EIP-191. See {recover}. / | function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
| function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
| 20,810 |
26 | // Building the auction object | token_representation memory newAuction;
newAuction.contractAddress = _contract;
newAuction.tokenID = _tokenID;
newAuction.tokenKind = _tokenKind;
newAuction.tokenAmount = _tokenAmount;
uint256 auctionId;
if (_tokenKind == bytes4(keccak256("ERC721"))) {
... | token_representation memory newAuction;
newAuction.contractAddress = _contract;
newAuction.tokenID = _tokenID;
newAuction.tokenKind = _tokenKind;
newAuction.tokenAmount = _tokenAmount;
uint256 auctionId;
if (_tokenKind == bytes4(keccak256("ERC721"))) {
... | 19,367 |
5 | // Carries per-token metadata. | struct Token {
uint8 version;
uint8 highestRevealed;
// Changing a token to a different version requires an allowance,
// increasing by 1 per day. This is calculated as the difference in time
// since the token's allowance started incrementing, less the amount
// spen... | struct Token {
uint8 version;
uint8 highestRevealed;
// Changing a token to a different version requires an allowance,
// increasing by 1 per day. This is calculated as the difference in time
// since the token's allowance started incrementing, less the amount
// spen... | 6,187 |
15 | // Update or push new checkpoint | if (last._blockNumber == key) {
_unsafeAccess(self, pos - 1)._value = value;
} else {
| if (last._blockNumber == key) {
_unsafeAccess(self, pos - 1)._value = value;
} else {
| 6,433 |
617 | // Just a sanity case in the worst case if this function is called late (EVM only stores last 256 block hashes) | if (block.number.sub(startingIndexBlock) > 255) {
startingIndex = uint256(blockhash(block.number - 1)) % MAX_ITEMS;
}
| if (block.number.sub(startingIndexBlock) > 255) {
startingIndex = uint256(blockhash(block.number - 1)) % MAX_ITEMS;
}
| 2,889 |
15 | // Protocol-fee rate that will apply to newly-created VFs.E.g. 1.25% would be returned as 0.0125e18 / | function platformFeeRate_e18() external view returns (UFixed256x18) {
return _protocolFeeRate.toUFixed256x18();
}
| function platformFeeRate_e18() external view returns (UFixed256x18) {
return _protocolFeeRate.toUFixed256x18();
}
| 22,354 |
96 | // solhint-disable-next-line avoid-low-level-calls | (success, returnValue) = _contract.call(_data);
emit GENERICCALL1(_contract, _data, success);
| (success, returnValue) = _contract.call(_data);
emit GENERICCALL1(_contract, _data, success);
| 23,438 |
0 | // Whitelist / | function addToWhitelist(address _address) external onlyOwner {
whitelist[_address] = whitelistAllocation;
}
| function addToWhitelist(address _address) external onlyOwner {
whitelist[_address] = whitelistAllocation;
}
| 9,390 |
21 | // Defines a method for performing a delegation of coins from a delegator to a validator./delegatorAddress The address of the delegator/validatorAddress The address of the validator/amount The amount of the Coin to be delegated to the validator | function delegate(
address delegatorAddress,
string memory validatorAddress,
uint256 amount
) external returns (int64 completionTime);
| function delegate(
address delegatorAddress,
string memory validatorAddress,
uint256 amount
) external returns (int64 completionTime);
| 32,034 |
5 | // Require that the color is not pure. | modifier onlyImpureColor(bytes3 color) {
if (isPureColor(color)) revert PureColorNotAllowed();
_;
}
| modifier onlyImpureColor(bytes3 color) {
if (isPureColor(color)) revert PureColorNotAllowed();
_;
}
| 9,415 |
147 | // Function to change the fund owner wallet address/Only Gilgamesh Dev can trigger this function | function changeFundOwnerWalletAddress(address _fundOwnerWallet)
public
validate_address(_fundOwnerWallet)
| function changeFundOwnerWalletAddress(address _fundOwnerWallet)
public
validate_address(_fundOwnerWallet)
| 22,770 |
85 | // Get current day | uint dayIndex = statsByDay.length-1;
Day storage today = statsByDay[dayIndex];
| uint dayIndex = statsByDay.length-1;
Day storage today = statsByDay[dayIndex];
| 50,002 |
0 | // The Ownable constructor sets the original `owner` of the contract/to the sender. | constructor()
| constructor()
| 35,273 |
5 | // solium-disable-next-line linebreak-style / Implements a simple ownership model with 2-phase transfer. | contract Owned {
address public owner;
address public proposedOwner;
constructor() public
{
owner = msg.sender;
}
modifier onlyOwner() {
require(isOwner(msg.sender) == true, 'Require owner to execute transaction');
_;
}
function isOwner(address _address) pub... | contract Owned {
address public owner;
address public proposedOwner;
constructor() public
{
owner = msg.sender;
}
modifier onlyOwner() {
require(isOwner(msg.sender) == true, 'Require owner to execute transaction');
_;
}
function isOwner(address _address) pub... | 24,905 |
32 | // Add the new member | payees.push(payee);
balances[payee] = UserBalance(payees.length, 0);
| payees.push(payee);
balances[payee] = UserBalance(payees.length, 0);
| 36,936 |
7 | // Cryptographic utilities. | library CryptoUtils {
uint8 public constant UNCOMPRESSED_PUBLIC_KEY_SIZE = 64;
/// @dev Verifies ECDSA signature of a given message hash.
/// @param _hash bytes32 The hash which is the signed message.
/// @param _signature bytes The signature to verify.
/// @param _address The public address of the... | library CryptoUtils {
uint8 public constant UNCOMPRESSED_PUBLIC_KEY_SIZE = 64;
/// @dev Verifies ECDSA signature of a given message hash.
/// @param _hash bytes32 The hash which is the signed message.
/// @param _signature bytes The signature to verify.
/// @param _address The public address of the... | 7,756 |
26 | // Get the underlying price of a cToken, in the format expected by the Comptroller. Implements the PriceOracle interface for Compound v2. cToken The cToken address for price retrievalreturn Price denominated in USD for the given cToken address, in the format expected by the Comptroller. / | function getUnderlyingPrice(address cToken) external view returns (uint256) {
TokenConfig memory config = getTokenConfigByCToken(cToken);
// Comptroller needs prices in the format: ${raw price} * 1e36 / baseUnit
// The baseUnit of an asset is the amount of the smallest denomination of that a... | function getUnderlyingPrice(address cToken) external view returns (uint256) {
TokenConfig memory config = getTokenConfigByCToken(cToken);
// Comptroller needs prices in the format: ${raw price} * 1e36 / baseUnit
// The baseUnit of an asset is the amount of the smallest denomination of that a... | 14,546 |
152 | // TIME UTILITY FUNCTIONS / | function get_epoch_end(uint256 epoch) public view returns (uint256) {
return epoch_cycle.start_date.add(epoch.add(1).mul(epoch_cycle.duration));
}
| function get_epoch_end(uint256 epoch) public view returns (uint256) {
return epoch_cycle.start_date.add(epoch.add(1).mul(epoch_cycle.duration));
}
| 42,222 |
12 | // Mint a batch of tokens of length `batchSize` for `to`. Returns the token id of the first token minted in thebatch; if `batchSize` is 0, returns the number of consecutive ids minted so far. Requirements: | * - `batchSize` must not be greater than {_maxBatchSize}.
* - The function is called in the constructor of the contract (directly or indirectly).
*
* CAUTION: Does not emit a `Transfer` event. This is ERC721 compliant as long as it is done outside of the
* constructor, which is enforced by this... | * - `batchSize` must not be greater than {_maxBatchSize}.
* - The function is called in the constructor of the contract (directly or indirectly).
*
* CAUTION: Does not emit a `Transfer` event. This is ERC721 compliant as long as it is done outside of the
* constructor, which is enforced by this... | 10,409 |
26 | // withdraw AVT fees associated with each node for each month for a particular staker. node the index of the node from which fees are being withdrawn month the month for which the fees are being withdrawn / | function withdrawFees(uint8 node, uint8 month)
external
| function withdrawFees(uint8 node, uint8 month)
external
| 36,221 |
12 | // The second of the two tokens of the pool, sorted by address/ return The token contract address | function token1() external view returns (address);
| function token1() external view returns (address);
| 13,041 |
42 | // Check already added | require(participants[_participant].exists == true);
| require(participants[_participant].exists == true);
| 28,833 |
15 | // Reviews Function | function addReviews(uint256 productId, uint256 rating, string calldata comment, address user) external {
require(rating >= 1 && rating <= 5, "rating must be between 1 and 5");
Property storage property = properties[productId];
property.reviewers.push(user);
property.reviews.push(comment);
... | function addReviews(uint256 productId, uint256 rating, string calldata comment, address user) external {
require(rating >= 1 && rating <= 5, "rating must be between 1 and 5");
Property storage property = properties[productId];
property.reviewers.push(user);
property.reviews.push(comment);
... | 23,845 |
217 | // ----------------------------------------------------------------------------/BozyICO : ERC Token ICO - 0.00001 ETH/BOZY with max-cap of 60,000 ETH ---------------------------------------------------------------------------- | contract BozyICO is Bozy {
// Define public constant variables
mapping(address => uint256) public contributions;
address payable public deposit;
address public admin;
uint256 public raisedAmount;
uint256 public icoTokenSold;
uint256 public hardCap = 4000 ether;
//uint256 public g... | contract BozyICO is Bozy {
// Define public constant variables
mapping(address => uint256) public contributions;
address payable public deposit;
address public admin;
uint256 public raisedAmount;
uint256 public icoTokenSold;
uint256 public hardCap = 4000 ether;
//uint256 public g... | 4,877 |
35 | // compute bonus tokens | uint256 bonusTokenAmount = communityTokenAmount.mul(15);
bonusTokenAmount = bonusTokenAmount.div(100);
| uint256 bonusTokenAmount = communityTokenAmount.mul(15);
bonusTokenAmount = bonusTokenAmount.div(100);
| 4,367 |
141 | // `p` contains real length of the buffer now, allocate the resulting buffer of that size | bytes memory result = new bytes(p);
| bytes memory result = new bytes(p);
| 66,848 |
15 | // fixing lockup in safe | bool internal lockupIsSet;
| bool internal lockupIsSet;
| 37,994 |
342 | // VaultLib Contract/Enzyme Council <[email protected]>/The per-release proxiable library contract for VaultProxy/The difference in terminology between "asset" and "trackedAsset" is intentional./ A fund might actually have asset balances of un-tracked assets,/ but only tracked assets are used in gav calculations./ Note... | contract VaultLib is VaultLibBase1, IVault {
using SafeERC20 for ERC20;
| contract VaultLib is VaultLibBase1, IVault {
using SafeERC20 for ERC20;
| 63,341 |
7 | // Initialises contract to non-paused / | function EmergencySafe() public {
paused = false;
}
| function EmergencySafe() public {
paused = false;
}
| 25,188 |
51 | // Globally enable or disable admin access. / | bool allowAdmins = true;
| bool allowAdmins = true;
| 11,616 |
71 | // Adds Liquidity directly to the contract where LP are locked | function _addLiquidity(uint tokenamount, uint ethamount) private {
_approve(address(this), address(_uniswapRouter), tokenamount);
_uniswapRouter.addLiquidityETH{value: ethamount}(
address(this),
tokenamount,
0,
0,
address(this),
... | function _addLiquidity(uint tokenamount, uint ethamount) private {
_approve(address(this), address(_uniswapRouter), tokenamount);
_uniswapRouter.addLiquidityETH{value: ethamount}(
address(this),
tokenamount,
0,
0,
address(this),
... | 7,949 |
156 | // Spend `amount` form the allowance of `owner` toward `spender`. Does not update the allowance amount in case of infinite allowance.Revert if not enough allowance is available. | * Might emit an {Approval} event.
*/
function _spendAllowance(
address owner,
address spender,
uint256 amount
) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllow... | * Might emit an {Approval} event.
*/
function _spendAllowance(
address owner,
address spender,
uint256 amount
) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllow... | 1,700 |
43 | // In each step, the numerator is multiplied by z^2 | num = (num * z_squared) / ONE_20;
seriesSum += num / 3;
num = (num * z_squared) / ONE_20;
seriesSum += num / 5;
num = (num * z_squared) / ONE_20;
seriesSum += num / 7;
num = (num * z_squared) / ONE_20;
| num = (num * z_squared) / ONE_20;
seriesSum += num / 3;
num = (num * z_squared) / ONE_20;
seriesSum += num / 5;
num = (num * z_squared) / ONE_20;
seriesSum += num / 7;
num = (num * z_squared) / ONE_20;
| 38,840 |
48 | // queue is released by distributeRewards() / | function _addIntoQueue(address staker, address recipient, uint256 amount) internal {
require(
amount != 0 && recipient != address(0),
"GlobalPool: zero input values"
);
_pendingTotalUnstakes = _pendingTotalUnstakes.add(amount);
_pendingUnstakeClaimers.push(rec... | function _addIntoQueue(address staker, address recipient, uint256 amount) internal {
require(
amount != 0 && recipient != address(0),
"GlobalPool: zero input values"
);
_pendingTotalUnstakes = _pendingTotalUnstakes.add(amount);
_pendingUnstakeClaimers.push(rec... | 8,231 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.