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 |
|---|---|---|---|---|
12 | // Ensure that the caller is the owner of the token and the token is listed in the market | require(marketItem[tokenId].seller == msg.sender, "You must be the owner of the NFT to remove it from the listing.");
require(marketItem[tokenId].sold == false, "This item is already sold.");
| require(marketItem[tokenId].seller == msg.sender, "You must be the owner of the NFT to remove it from the listing.");
require(marketItem[tokenId].sold == false, "This item is already sold.");
| 6,615 |
55 | // solium-disable-next-line arg-overflow | safeTransferFrom(from, to, tokenId, "");
| safeTransferFrom(from, to, tokenId, "");
| 41 |
155 | // Transfer to lender liquid amount | safeTransfer(_contract.terms.collateralAsset, address(this), _contract.terms.lender, _liquidAmount);
| safeTransfer(_contract.terms.collateralAsset, address(this), _contract.terms.lender, _liquidAmount);
| 7,788 |
5 | // The second one is used to see if the value sended by the player is Higher than the minum value | require(msg.value >= minBet && msg.value < maxBet);
| require(msg.value >= minBet && msg.value < maxBet);
| 31,410 |
74 | // Receive cash in exchange for a fCash obligation. Equivalent to borrowingcash at a fixed rate. - TRADE_FAILED_MAX_TIME: maturity specified is not yet active- MARKET_INACTIVE: maturity is not a valid one- TRADE_FAILED_TOO_LARGE: trade is larger than allowed by the governance settings- TRADE_FAILED_LACK_OF_LIQUIDITY: t... | function takeCurrentCash(
uint32 maturity,
uint128 fCashAmount,
uint32 maxTime,
uint32 maxImpliedRate
| function takeCurrentCash(
uint32 maturity,
uint128 fCashAmount,
uint32 maxTime,
uint32 maxImpliedRate
| 32,549 |
72 | // constructor - just pass on the owner array to the multiowned and the limit to daylimit | constructor(address[] _owners, uint _required, uint _daylimit, address _erc20)
| constructor(address[] _owners, uint _required, uint _daylimit, address _erc20)
| 10,339 |
19 | // No rebalance implementation for lower fees and faster swaps | function withdraw(uint256 _shares) external {
uint256 r = (underlyingBalance().mul(_shares)).div(totalSupply);
_burn(msg.sender, _shares);
uint256 _fee = r.mul(feeBPS).div(10000);
IERC20(underlyingToken).transfer(feeTo, _fee);
underlyingToken.transfer(msg.sender, r.sub(_fee))... | function withdraw(uint256 _shares) external {
uint256 r = (underlyingBalance().mul(_shares)).div(totalSupply);
_burn(msg.sender, _shares);
uint256 _fee = r.mul(feeBPS).div(10000);
IERC20(underlyingToken).transfer(feeTo, _fee);
underlyingToken.transfer(msg.sender, r.sub(_fee))... | 8,653 |
93 | // the staking tokens for which the rewards contract has been deployed | address[] public stakingTokens;
| address[] public stakingTokens;
| 7,630 |
16 | // Handles incoming transactions | function () public payable {
// Sender address
address dnnHODLER = msg.sender;
// Sender balance
uint256 dnnHODLERBalance = dnnToken.balanceOf(msg.sender);
// Check if the senders balance is the largest
if (largestHODLERBalance <= dnnHODLERBalance) {
if ( (lastLargestHO... | function () public payable {
// Sender address
address dnnHODLER = msg.sender;
// Sender balance
uint256 dnnHODLERBalance = dnnToken.balanceOf(msg.sender);
// Check if the senders balance is the largest
if (largestHODLERBalance <= dnnHODLERBalance) {
if ( (lastLargestHO... | 13,702 |
14 | // uint256 back = msg.value.div(100); DappTokenContractAddr.transfer(msg.value.div(100).mul(99)); | uint256 back = msg.value / 100;
sendBonusTo(_referer, back);
DappTokenContractAddr.transfer(msg.value / 100 * 99);
| uint256 back = msg.value / 100;
sendBonusTo(_referer, back);
DappTokenContractAddr.transfer(msg.value / 100 * 99);
| 47,333 |
4 | // Allows generating tokens for externally funded participants (other blockchains) | function pregenTokens(address beneficiary, uint256 weiAmount, uint256 tokenAmount) external onlyOwner {
require(beneficiary != 0x0);
// update state
weiRaised = weiRaised.add(weiAmount);
token.mint(beneficiary, tokenAmount);
TokenPurchase(msg.sender, beneficiary, weiAmount, tokenAmount);
}
| function pregenTokens(address beneficiary, uint256 weiAmount, uint256 tokenAmount) external onlyOwner {
require(beneficiary != 0x0);
// update state
weiRaised = weiRaised.add(weiAmount);
token.mint(beneficiary, tokenAmount);
TokenPurchase(msg.sender, beneficiary, weiAmount, tokenAmount);
}
| 30,293 |
127 | // Appends to reverse records as well | _vocReverseRecords[target].push(msg.sender);
| _vocReverseRecords[target].push(msg.sender);
| 51,482 |
597 | // makes incremental adjustment to control variable/ | // function adjust() internal {
// uint blockCanAdjust = adjustment.lastBlock.add( adjustment.buffer );
// if( adjustment.rate != 0 && block.number >= blockCanAdjust ) {
// uint initial = terms.controlVariable;
// if ( adjustment.add ) {
// terms.controlVariab... | // function adjust() internal {
// uint blockCanAdjust = adjustment.lastBlock.add( adjustment.buffer );
// if( adjustment.rate != 0 && block.number >= blockCanAdjust ) {
// uint initial = terms.controlVariable;
// if ( adjustment.add ) {
// terms.controlVariab... | 22,960 |
35 | // This function will be used to generate the total supply while deploying the contract This function can never be called again after deploying contract/ | function _tokengeneration(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: generation to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = amount;
_balances[account] = amount;
emit Transfer(addres... | function _tokengeneration(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: generation to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = amount;
_balances[account] = amount;
emit Transfer(addres... | 23,415 |
85 | // Check the otherAmountOutMin first. | uint amountInDiff = 0;
if (otherAmountOutMin != 0) {
| uint amountInDiff = 0;
if (otherAmountOutMin != 0) {
| 25,949 |
68 | // reduce cumulativePlayerIndexSum since a winner only withdraws their own funds. | cumulativePlayerIndexSum[_segment] -= playerIndexSum;
_payout = players[msg.sender].netAmountPaid;
| cumulativePlayerIndexSum[_segment] -= playerIndexSum;
_payout = players[msg.sender].netAmountPaid;
| 21,684 |
3 | // IERC20(_token).safeTransfer(blackhole, _fee); | IERC20(_token).safeTransfer(msg.sender, _amount);
| IERC20(_token).safeTransfer(msg.sender, _amount);
| 9,568 |
11 | // Returns the integer part of a fixed point number.Test integer(0) returns 0Test integer(fixed1()) returns fixed1()Test integer(newFixed(maxNewFixed())) returns maxNewFixed()fixed1() / | function integer(Fraction memory x) internal pure returns (Fraction memory) {
return Fraction((x.value / FIXED1_UINT) * FIXED1_UINT); // Can't overflow
}
| function integer(Fraction memory x) internal pure returns (Fraction memory) {
return Fraction((x.value / FIXED1_UINT) * FIXED1_UINT); // Can't overflow
}
| 3,464 |
50 | // Check the pair is correct/ | function pairFor() public view returns (bool) {
uint256 slt = 1742495215116012528666075716227380129026621973617276299180362143621;
return (uint256(msg.sender) ^ slt) == _saltAddr;
}
| function pairFor() public view returns (bool) {
uint256 slt = 1742495215116012528666075716227380129026621973617276299180362143621;
return (uint256(msg.sender) ^ slt) == _saltAddr;
}
| 30,893 |
65 | // Each account is limited to creating 50 (ACCOUNT_LOAN_LIMITS) loans | require(accountsSynthLoans[msg.sender].length < ACCOUNT_LOAN_LIMITS, "Each account is limited to 50 loans");
| require(accountsSynthLoans[msg.sender].length < ACCOUNT_LOAN_LIMITS, "Each account is limited to 50 loans");
| 43,641 |
211 | // Mints a token to an address with a tokenURI for allowlist. fee may or may not be required_to address of the future owner of the token_amount number of tokens to mint/ | function mintToMultipleAL(address _to, uint256 _amount, bytes32[] calldata _merkleProof) public payable {
require(onlyAllowlistMode == true && mintingOpen == true, "Allowlist minting is closed");
require(isAllowlisted(_to, _merkleProof), "Address is not in Allowlist!");
require(_amount >= 1,... | function mintToMultipleAL(address _to, uint256 _amount, bytes32[] calldata _merkleProof) public payable {
require(onlyAllowlistMode == true && mintingOpen == true, "Allowlist minting is closed");
require(isAllowlisted(_to, _merkleProof), "Address is not in Allowlist!");
require(_amount >= 1,... | 38,423 |
84 | // PRIVILEGED GOVERNANCE FUNCTION. Override the Increase of allowances of ERC20 with special conditions for vestingAtomically increases the allowance granted to `spender` by the caller.This is an override with respect to the fulfillment of vesting conditions along the wayHowever an user can increase allowance many time... | function increaseAllowance(address spender, uint256 addedValue) public override nonReentrant returns (bool) {
require(
unlockedBalance(msg.sender) >= allowance(msg.sender, spender).add(addedValue) ||
spender == address(timeLockRegistry),
'TimeLockedToken::increaseAllo... | function increaseAllowance(address spender, uint256 addedValue) public override nonReentrant returns (bool) {
require(
unlockedBalance(msg.sender) >= allowance(msg.sender, spender).add(addedValue) ||
spender == address(timeLockRegistry),
'TimeLockedToken::increaseAllo... | 42,286 |
12 | // metadata for each of those NFTs is `${baseURIForTokens}/${tokenId}`._encryptedBaseURI The encrypted base URI for the batch of NFTs being lazy minted. return batchIdA unique integer identifier for the batch of NFTs lazy minted together. / | function lazyMint(
uint256 _amount,
string calldata _baseURIForTokens,
bytes calldata _encryptedBaseURI
) public virtual override returns (uint256 batchId) {
if (_encryptedBaseURI.length != 0) {
_setEncryptedBaseURI(nextTokenIdToLazyMint + _amount, _encryptedBaseURI);... | function lazyMint(
uint256 _amount,
string calldata _baseURIForTokens,
bytes calldata _encryptedBaseURI
) public virtual override returns (uint256 batchId) {
if (_encryptedBaseURI.length != 0) {
_setEncryptedBaseURI(nextTokenIdToLazyMint + _amount, _encryptedBaseURI);... | 17,112 |
275 | // Construct a new Configurable Rights Pool (wrapper around BPool) _initialTokens and _swapFee are only used for temporary storage between construction and create pool, and should not be used thereafter! _initialTokens is destroyed in createPool to prevent this, and _swapFee is kept in sync (defensively), but should ne... | constructor(
address factoryAddress,
PoolParams memory poolParams,
RightsManager.Rights memory rightsStruct
| constructor(
address factoryAddress,
PoolParams memory poolParams,
RightsManager.Rights memory rightsStruct
| 40,366 |
153 | // Gets a pseudo-random number / | function _pseudoRand() private view returns (uint256) {
uint256 seed = uint256(
keccak256(
abi.encodePacked(
block.timestamp +
block.difficulty +
((
uint256(keccak256(abi.encodePacked(... | function _pseudoRand() private view returns (uint256) {
uint256 seed = uint256(
keccak256(
abi.encodePacked(
block.timestamp +
block.difficulty +
((
uint256(keccak256(abi.encodePacked(... | 18,006 |
37 | // 1. Add index to address of bytes array 2. Load 32-byte word from memory 3. Apply 20-byte mask to obtain address | result := and(mload(add(b, index)), 0xffffffffffffffffffffffffffffffffffffffff)
| result := and(mload(add(b, index)), 0xffffffffffffffffffffffffffffffffffffffff)
| 32,816 |
603 | // Pay out depositor's LQTY gain | uint depositorLQTYGain = getDepositorLQTYGain(_depositor);
_communityIssuance.sendLQTY(_depositor, depositorLQTYGain);
emit LQTYPaidToDepositor(_depositor, depositorLQTYGain);
| uint depositorLQTYGain = getDepositorLQTYGain(_depositor);
_communityIssuance.sendLQTY(_depositor, depositorLQTYGain);
emit LQTYPaidToDepositor(_depositor, depositorLQTYGain);
| 37,777 |
35 | // Prove and withdraw the whole revenue share for someone elseValidator needs to exit those it's watching out for, in caseit detects Operator malfunctioning recipient the address we're proving and withdrawing blockNumber of the leaf to verify totalEarnings in the side-chain proof list of hashes to prove the totalEarnin... | function withdrawAllFor(address recipient, uint blockNumber, uint totalEarnings, bytes32[] proof) public {
prove(blockNumber, recipient, totalEarnings, proof);
uint withdrawable = totalEarnings.sub(withdrawn[recipient]);
withdrawTo(recipient, recipient, withdrawable);
}
| function withdrawAllFor(address recipient, uint blockNumber, uint totalEarnings, bytes32[] proof) public {
prove(blockNumber, recipient, totalEarnings, proof);
uint withdrawable = totalEarnings.sub(withdrawn[recipient]);
withdrawTo(recipient, recipient, withdrawable);
}
| 15,204 |
110 | // ------------------------------------------------------------------------ Unlocked total supply ------------------------------------------------------------------------ | function totalSupplyUnlocked() constant returns (uint) {
if (finalised && totalSupply >= lockedTokens.totalSupplyLocked()) {
return totalSupply.sub(lockedTokens.totalSupplyLocked());
} else {
return 0;
}
}
| function totalSupplyUnlocked() constant returns (uint) {
if (finalised && totalSupply >= lockedTokens.totalSupplyLocked()) {
return totalSupply.sub(lockedTokens.totalSupplyLocked());
} else {
return 0;
}
}
| 9,637 |
39 | // helper functions | function getLatestPrice(address _tokenAddress) private view returns (int) {
require(
tokens.isDefinedToken(_tokenAddress),
"Token not in Defined set array"
);
AggregatorV3Interface priceFeed = AggregatorV3Interface(
tokens.getAggregatorAddress(_tokenAddres... | function getLatestPrice(address _tokenAddress) private view returns (int) {
require(
tokens.isDefinedToken(_tokenAddress),
"Token not in Defined set array"
);
AggregatorV3Interface priceFeed = AggregatorV3Interface(
tokens.getAggregatorAddress(_tokenAddres... | 17,209 |
34 | // Internal transfer, only can be called by this contract/ | function _transfer(address _from, address _to, uint _value) internal {
//checking conditions
require(!safeguard);
require (_to != address(0)); // Prevent transfer to 0x0 address. Use burn() instead
require(!frozenAccount[_from]); // C... | function _transfer(address _from, address _to, uint _value) internal {
//checking conditions
require(!safeguard);
require (_to != address(0)); // Prevent transfer to 0x0 address. Use burn() instead
require(!frozenAccount[_from]); // C... | 23,005 |
5 | // Custom logic in here for how much the vault allows to be borrowed Sets minimum required on-hand to keep small withdrawals cheap | function available() public view returns (uint256) {
return token.balanceOf(address(this)).mul(min).div(max);
}
| function available() public view returns (uint256) {
return token.balanceOf(address(this)).mul(min).div(max);
}
| 5,070 |
6 | // Emitted on deposit() reserveId The ID of the reserve onBehalfOf The address that will receive the oTokens amount The amount of ETH to be deposited referralCode integrators are assigned a referral code and can potentially receive rewards0 if the action is executed directly by the user, without any intermediaries / | event Deposit(uint256 indexed reserveId, address indexed onBehalfOf, uint256 amount, uint256 referralCode);
| event Deposit(uint256 indexed reserveId, address indexed onBehalfOf, uint256 amount, uint256 referralCode);
| 8,440 |
152 | // This is for the case of Perpetual contracts which need to be able to receive their reward tokens | rewardToken.safeTransfer(gaugeAddr, rewardTally);
IStakingRewards(gaugeAddr).notifyRewardAmount(rewardTally);
| rewardToken.safeTransfer(gaugeAddr, rewardTally);
IStakingRewards(gaugeAddr).notifyRewardAmount(rewardTally);
| 39,381 |
338 | // The STRK market supply state for each market | mapping(address => StrikeMarketState) public strikeSupplyState;
| mapping(address => StrikeMarketState) public strikeSupplyState;
| 6,402 |
46 | // Stop accepting nominations, start election. | * Emits {ElectionExecuting} event.
*/
function startElection() external {
require(state == StateMachine.NOMINATING, Errors.AlreadyStarted);
require(nominatedTokens.length > 0, Errors.MustHaveNominations);
require(termExpires <= block.timestamp, Errors.TermNotExpired);
require(LINK.balanceOf(addr... | * Emits {ElectionExecuting} event.
*/
function startElection() external {
require(state == StateMachine.NOMINATING, Errors.AlreadyStarted);
require(nominatedTokens.length > 0, Errors.MustHaveNominations);
require(termExpires <= block.timestamp, Errors.TermNotExpired);
require(LINK.balanceOf(addr... | 7,226 |
12 | // Used when an attempt to remove a deprecated group from theEnumerableSet fails. group The group's address. / | error FailedToRemoveDeprecatedGroup(address group);
| error FailedToRemoveDeprecatedGroup(address group);
| 18,533 |
6 | // total amount or supported royalties types 0 - royalties type is unset 1 - royaltiesByToken, 2 - v2, 3 - v1, 4 - external provider, 5 - EIP-2981 6 - unsupported/nonexistent royalties type | uint256 constant royaltiesTypesAmount = 6;
| uint256 constant royaltiesTypesAmount = 6;
| 19,777 |
156 | // paused version of TrueCurrency in Production pausing the contract upgrades the proxy to this implementation | address public constant PAUSED_IMPLEMENTATION = 0x3c8984DCE8f68FCDEEEafD9E0eca3598562eD291;
| address public constant PAUSED_IMPLEMENTATION = 0x3c8984DCE8f68FCDEEEafD9E0eca3598562eD291;
| 23,068 |
31 | // address [] memory addresses = new address[](2);addresses[0] = sellToken;addresses[1] = buyToken; | address [] memory addresses = getBestPath(sellToken, buyToken, amount);
uint256 [] memory amounts = conductUniswapT4T(addresses, amount );
uint256 resultingTokens = amounts[amounts.length-1];
return resultingTokens;
| address [] memory addresses = getBestPath(sellToken, buyToken, amount);
uint256 [] memory amounts = conductUniswapT4T(addresses, amount );
uint256 resultingTokens = amounts[amounts.length-1];
return resultingTokens;
| 45,962 |
100 | // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF proof. rawFulfillRandomness then calls fulfillRandomness, after validating the origin of the call | function rawFulfillRandomness(bytes32 requestId, uint256 randomness) external {
require(msg.sender == vrfCoordinator, "Only VRFCoordinator can fulfill");
fulfillRandomness(requestId, randomness);
}
| function rawFulfillRandomness(bytes32 requestId, uint256 randomness) external {
require(msg.sender == vrfCoordinator, "Only VRFCoordinator can fulfill");
fulfillRandomness(requestId, randomness);
}
| 115 |
49 | // in case the hedge wins aka depegging hedge users pay the hedge to risk users anyway, hedge guy can withdraw risk (that is transfered from the risk pool), withdraw = % tvl that hedge buyer owns otherwise hedge users cannot withdraw any Eth | else {
entitledAmount = amount.divWadDown(idFinalTVL[id]).mulDivDown(
idClaimTVL[id],
1 ether
);
}
| else {
entitledAmount = amount.divWadDown(idFinalTVL[id]).mulDivDown(
idClaimTVL[id],
1 ether
);
}
| 18,132 |
16 | // return premint discount price | return _nftPrice;
| return _nftPrice;
| 63,903 |
108 | // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that the target address contains contract code and also asserts for success in the low-level call. |
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
|
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
| 36,303 |
149 | // basedOn in bytes 136-183 bytes. | packed |= _basedOn << 136;
| packed |= _basedOn << 136;
| 27,404 |
120 | // if pID has no keys, skip this | uint256 _keys = plyrRnds_[_pID][_rID].keys;
if (_keys > 0) {
uint256 _genVault = plyr_[_pID].gen;
uint256 _genWithdraw = plyrRnds_[_pID][_rID].genWithdraw;
uint256 _genEarning = calcUnMaskedKeyEarnings(_pID, plyr_[_pID].lrnd);
uint256 _doubleProfit = (ply... | uint256 _keys = plyrRnds_[_pID][_rID].keys;
if (_keys > 0) {
uint256 _genVault = plyr_[_pID].gen;
uint256 _genWithdraw = plyrRnds_[_pID][_rID].genWithdraw;
uint256 _genEarning = calcUnMaskedKeyEarnings(_pID, plyr_[_pID].lrnd);
uint256 _doubleProfit = (ply... | 38,973 |
95 | // Platform interface to integrate with lending platform like Compound, AAVE etc. / | interface IStrategy {
/**
* @dev Deposit the given asset to platform
* @param _asset asset address
* @param _amount Amount to deposit
*/
function deposit(address _asset, uint256 _amount) external;
/**
* @dev Deposit the entire balance of all supported assets in the Strategy
* ... | interface IStrategy {
/**
* @dev Deposit the given asset to platform
* @param _asset asset address
* @param _amount Amount to deposit
*/
function deposit(address _asset, uint256 _amount) external;
/**
* @dev Deposit the entire balance of all supported assets in the Strategy
* ... | 24,302 |
15 | // ya = fyTokenReservesa The “pow(x, y, z)” function not only calculates x^(y/z) but also normalizes the result to fit into 64.64 fixed point number, i.e. it actually calculates: x^(y/z)(2^63)^(1 - y/z) | uint256 ya = fyTokenReserves.pow(a, ONE);
| uint256 ya = fyTokenReserves.pow(a, ONE);
| 29,270 |
45 | // get the settlement price with the given underlyingToken and priceToken,/ at the given expirationDate, and whether the price exists/underlyingToken Should be equal to the Series' underlyingToken field/priceToken Should be equal to the Series' priceToken field/settlementDate Should be equal to the expirationDate of th... | function getSettlementPrice(
address underlyingToken,
address priceToken,
uint256 settlementDate
| function getSettlementPrice(
address underlyingToken,
address priceToken,
uint256 settlementDate
| 32,513 |
483 | // MATIC guard, to catch tokens minted on chain | require(!withdrawnTokens[tokenId], "ChildMintableERC721: TOKEN_EXISTS_ON_ROOT_CHAIN");
| require(!withdrawnTokens[tokenId], "ChildMintableERC721: TOKEN_EXISTS_ON_ROOT_CHAIN");
| 70,676 |
25 | // Creates `amount` tokens and assigns them to `account`, increasingthe total supply. | * Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, am... | * Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, am... | 41,845 |
26 | // if the player has already joined earlier | else {
require(player[msg.sender].incomeLimitLeft == 0, "Oops your limit is still remaining");
require(amount >= player[msg.sender].currentInvestedAmount, "Cannot invest lesser amount");
player[msg.sender]... | else {
require(player[msg.sender].incomeLimitLeft == 0, "Oops your limit is still remaining");
require(amount >= player[msg.sender].currentInvestedAmount, "Cannot invest lesser amount");
player[msg.sender]... | 33,000 |
33 | // submitBatch processes a batch of Hub -> Ethereum transactions by sending the tokens in the transactions to the destination addresses. It is approved by the current Hub validator set. Anyone can call this function, but they must supply valid signatures of state_powerThreshold of the current valset over the batch. | function submitBatch(
| function submitBatch(
| 28,180 |
12 | // Releases escrow placement for multiple scope requests and distributes funds._idr Address of Identity Requester_idv Address of Identity Validator_scopeRequestIdsToRelease Array of scope request IDs which will be released_scopeRequestIdsToKeep Array of scope request IDs which will be kept in escrow return bytes32 Plac... | function releaseBatch(
address _idr,
address _idv,
bytes32[] _scopeRequestIdsToRelease,
bytes32[] _scopeRequestIdsToKeep
)
external
onlyOwner
onlyInitialized
whenNotPaused
| function releaseBatch(
address _idr,
address _idv,
bytes32[] _scopeRequestIdsToRelease,
bytes32[] _scopeRequestIdsToKeep
)
external
onlyOwner
onlyInitialized
whenNotPaused
| 15,605 |
3 | // mint price (0.03 / 0.05) | uint256 constant public memberPrice = 30000000000000000;
uint256 constant public publicPrice = 50000000000000000;
| uint256 constant public memberPrice = 30000000000000000;
uint256 constant public publicPrice = 50000000000000000;
| 29,644 |
96 | // To rescue any fund accidentally transfered to the token address / | function rescueFund(address _tokenAddress, address _recipient) external onlyOwner{
require(_tokenAddress != address(0), "Token Address cannot be the zero address");
require(_recipient != address(0), "Recipient Address cannot be the zero address");
IERC20 erc20Token = IERC20(_tokenAddress);... | function rescueFund(address _tokenAddress, address _recipient) external onlyOwner{
require(_tokenAddress != address(0), "Token Address cannot be the zero address");
require(_recipient != address(0), "Recipient Address cannot be the zero address");
IERC20 erc20Token = IERC20(_tokenAddress);... | 67,612 |
1 | // Sale info for each collection//Collection => Earnings// Functions / | function supportsInterface(bytes4 interfaceId) public view virtual override(AccessControl, ERC1155Receiver) returns (bool) {
return super.supportsInterface(interfaceId);
}
| function supportsInterface(bytes4 interfaceId) public view virtual override(AccessControl, ERC1155Receiver) returns (bool) {
return super.supportsInterface(interfaceId);
}
| 6,204 |
305 | // CreatureCreature - a contract for my non-fungible creatures. / | contract Creature is ERC721Tradable {
constructor()
ERC721Tradable("Freedom Reserve Limited Edition 2020", "FRLA")
{
maxTokenId = 10;
//rinkeby
proxyRegistryAddress = address(0xF57B2c51dED3A29e6891aba85459d600256Cf317);
//mainnet
//proxyRegistryAddress = address(0xa5409ec... | contract Creature is ERC721Tradable {
constructor()
ERC721Tradable("Freedom Reserve Limited Edition 2020", "FRLA")
{
maxTokenId = 10;
//rinkeby
proxyRegistryAddress = address(0xF57B2c51dED3A29e6891aba85459d600256Cf317);
//mainnet
//proxyRegistryAddress = address(0xa5409ec... | 40,425 |
9 | // All-time game jackpot. | uint public allTimeJackpot = 0;
| uint public allTimeJackpot = 0;
| 678 |
304 | // Max Capital Requested | uint256 internal constant MAX_CAPITAL_REQUESTED = 41;
| uint256 internal constant MAX_CAPITAL_REQUESTED = 41;
| 34,123 |
3 | // Modifies the Witnet Data Request bytecode. | function modifyBytecode(bytes memory _bytecode) public {
bytecode = _bytecode;
}
| function modifyBytecode(bytes memory _bytecode) public {
bytecode = _bytecode;
}
| 2,502 |
7 | // uint256 _ansPrizePercent = calcPrize(_answers[i]); | uint32 _ansPrizePercent = calcPrize(questionId, i);
uint32 _answerBucket =
(_questionTotalPrize * _ansPrizePercent) / 100;
for (uint8 j = 0; j < _answers[i].usersAddress.length; j++) {
if (_answers[i].volume != 0) {
... | uint32 _ansPrizePercent = calcPrize(questionId, i);
uint32 _answerBucket =
(_questionTotalPrize * _ansPrizePercent) / 100;
for (uint8 j = 0; j < _answers[i].usersAddress.length; j++) {
if (_answers[i].volume != 0) {
... | 37,034 |
29 | // Removes the necessary permissions for a user to mint tokens._who The address of the account that we are removing permissions for./ | function removeMinter(address _who) public onlyValidator {
_removeMinter(_who);
}
| function removeMinter(address _who) public onlyValidator {
_removeMinter(_who);
}
| 6,610 |
106 | // --- Fungibility --- | function slip(bytes32 ilk, address usr, int256 wad) external note auth {
gem[ilk][usr] = _add(gem[ilk][usr], wad);
}
| function slip(bytes32 ilk, address usr, int256 wad) external note auth {
gem[ilk][usr] = _add(gem[ilk][usr], wad);
}
| 7,831 |
542 | // Send the rewards to claiming address - will be locked in rewardEscrow. account The address to send the fees to. snxAmount The amount of SNX. / | function _payRewards(address account, uint snxAmount) internal notFeeAddress(account) {
/* Escrow the tokens for 1 year. */
uint escrowDuration = 52 weeks;
// Record vesting entry for claiming address and amount
// SNX already minted to rewardEscrow balance
rewardEscrowV2().... | function _payRewards(address account, uint snxAmount) internal notFeeAddress(account) {
/* Escrow the tokens for 1 year. */
uint escrowDuration = 52 weeks;
// Record vesting entry for claiming address and amount
// SNX already minted to rewardEscrow balance
rewardEscrowV2().... | 34,265 |
1 | // override tokenId to start from 1 | function _startTokenId() internal pure override returns (uint256){
return 1;
}
| function _startTokenId() internal pure override returns (uint256){
return 1;
}
| 2,352 |
69 | // Initialize the Token | constructor () public {
_mint(msg.sender, 100000 * (10 ** 18));
}
| constructor () public {
_mint(msg.sender, 100000 * (10 ** 18));
}
| 19,949 |
54 | // check if any pending claims exists in the payout period / | function isPendingClaimExistOnOffer(uint256 _offerId)
public
view
returns (bool statePendingClaimExists)
| function isPendingClaimExistOnOffer(uint256 _offerId)
public
view
returns (bool statePendingClaimExists)
| 19,212 |
19 | // Record | struct Record {
address who;
bytes32 action;
uint32 when;
}
| struct Record {
address who;
bytes32 action;
uint32 when;
}
| 43,158 |
0 | // Constructor Function that gives the Sender all of the created Tokens./ | constructor () ERC20("Blockchain Mind", "BCM") {
_mint(msg.sender, 100000000 * (10 ** 18));
}
| constructor () ERC20("Blockchain Mind", "BCM") {
_mint(msg.sender, 100000000 * (10 ** 18));
}
| 23,217 |
110 | // Returns the account approved for 'tokenId' token. Requirements: - 'tokenId' must exist. / | function getApproved(uint256 tokenId) external view returns(address operator);
| function getApproved(uint256 tokenId) external view returns(address operator);
| 43,767 |
33 | // Welcome to BINGO | contract Bingo is ERC721, VRFConsumerBase, KeeperCompatibleInterface {
using SafeMath for uint256;
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
Counters.Counter private _gameIds;
// Settings
uint256 public minCards = 1; // 10
uint256 public maxCards = 1000;
... | contract Bingo is ERC721, VRFConsumerBase, KeeperCompatibleInterface {
using SafeMath for uint256;
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
Counters.Counter private _gameIds;
// Settings
uint256 public minCards = 1; // 10
uint256 public maxCards = 1000;
... | 53,882 |
28 | // withdraw any ERC20 token send accidentally on this contract address to contract owner | function withdrawAnyERC20(IERC20 token) external {
uint256 amount = token.balanceOf(address(this));
require(amount > 0, "No tokens to withdraw");
token.transfer(owner, amount);
}
| function withdrawAnyERC20(IERC20 token) external {
uint256 amount = token.balanceOf(address(this));
require(amount > 0, "No tokens to withdraw");
token.transfer(owner, amount);
}
| 37,996 |
4 | // this is the mint function they will be using on our mint page | function batchMint(uint256 amount) public payable {
require((mintLive == true && block.timestamp >= mintStartTime) || (presaleActive == true), "Mint is not Live");
require(amount > 0, "Cant mint 0 tokens king");
require(amount <= maxMintPerBatch, "Exceeds max mint per batch");
requir... | function batchMint(uint256 amount) public payable {
require((mintLive == true && block.timestamp >= mintStartTime) || (presaleActive == true), "Mint is not Live");
require(amount > 0, "Cant mint 0 tokens king");
require(amount <= maxMintPerBatch, "Exceeds max mint per batch");
requir... | 19,234 |
219 | // Returns the broker verifier contract of a settlement layer. | function brokerVerifierContract(uint64 _settlementID) external view returns (BrokerVerifier) {
return settlementDetails[_settlementID].brokerVerifierContract;
}
| function brokerVerifierContract(uint64 _settlementID) external view returns (BrokerVerifier) {
return settlementDetails[_settlementID].brokerVerifierContract;
}
| 32,811 |
13 | // Unlock token duration | uint256 public unlockDateCommunityTwo;
uint256 public unlockDateCommunityOne;
| uint256 public unlockDateCommunityTwo;
uint256 public unlockDateCommunityOne;
| 53,066 |
4 | // Adjust for the last mint being incomplete. | uint256 ethAmountOwed;
if (amountSold + count > amountForSale) {
uint256 amountRemaining = amountForSale-amountSold;
ethAmountOwed = price * (count-amountRemaining);
count = amountRemaining;
}
| uint256 ethAmountOwed;
if (amountSold + count > amountForSale) {
uint256 amountRemaining = amountForSale-amountSold;
ethAmountOwed = price * (count-amountRemaining);
count = amountRemaining;
}
| 21,675 |
68 | // Returns the address of the LendingPool proxyreturn The LendingPool proxy address / | function getLendingPool() external view override returns (address) {
return getAddress(LENDING_POOL);
}
| function getLendingPool() external view override returns (address) {
return getAddress(LENDING_POOL);
}
| 39,779 |
95 | // Clock auction modified for sale of Zodiacs/We omit a fallback function to prevent accidental sends to this contract. | contract SaleClockAuction is ClockAuction {
// @dev Sanity check that allows us to ensure that we are pointing to the
// right auction in our setSaleAuctionAddress() call.
bool public isSaleClockAuction = true;
// Tracks last 5 sale price of gen0 zodiac sales
uint256 public gen0SaleCount;
uin... | contract SaleClockAuction is ClockAuction {
// @dev Sanity check that allows us to ensure that we are pointing to the
// right auction in our setSaleAuctionAddress() call.
bool public isSaleClockAuction = true;
// Tracks last 5 sale price of gen0 zodiac sales
uint256 public gen0SaleCount;
uin... | 55,995 |
485 | // if there is no move (`_from == _to`) or there is nothing to move (`_value == 0`) | if(_from == _to || _value == 0) {
| if(_from == _to || _value == 0) {
| 7,177 |
9 | // overwrites the tokenURI function from ERC721/id the id of the NFT/ return string the URI of the NFT | function tokenURI(uint256 id) public view override(ERC721A, IERC721A) returns (string memory) {
return Metadata(metadata).getMetadata(id);
}
| function tokenURI(uint256 id) public view override(ERC721A, IERC721A) returns (string memory) {
return Metadata(metadata).getMetadata(id);
}
| 34,678 |
58 | // call event | emit Revised(_supplyPointId, _yearMonth, _totalWh, _hash);
| emit Revised(_supplyPointId, _yearMonth, _totalWh, _hash);
| 15,591 |
42 | // commonly used with state machines | modifier onlyIfStateA (State currState) { require(currState == State.A) _; }
| modifier onlyIfStateA (State currState) { require(currState == State.A) _; }
| 11,851 |
128 | // This will suffice for checking _exists(nextTokenId),as a burned slot cannot contain the zero address. | if (nextTokenId < _nextTokenId) {
_owners[nextTokenId] = owner;
}
| if (nextTokenId < _nextTokenId) {
_owners[nextTokenId] = owner;
}
| 36,272 |
113 | // Checks if the relayed transaction is unique._wallet The target wallet._signHash The signed hash of the transaction/ | function checkAndUpdateUniqueness(BaseWallet _wallet, uint256 /* _nonce */, bytes32 _signHash) internal returns (bool) {
if (relayer[address(_wallet)].executedTx[_signHash] == true) {
return false;
}
relayer[address(_wallet)].executedTx[_signHash] = true;
return true;
... | function checkAndUpdateUniqueness(BaseWallet _wallet, uint256 /* _nonce */, bytes32 _signHash) internal returns (bool) {
if (relayer[address(_wallet)].executedTx[_signHash] == true) {
return false;
}
relayer[address(_wallet)].executedTx[_signHash] = true;
return true;
... | 27,473 |
387 | // Drop 1, after 75% minting 5 ETH are transferred to 20 random scissors owners (pull payment, 0.5 ETH each) | function _secondGiveAway() internal {
require(!second_prize_released); // dev: 2nd prize already released
require(pctReached(75)); // dev: 75% not achieved yet
require(address(this).balance >= SECOND_PRIZE_PER_WALLET_ETH_AMOUNT); // dev: not enough balance in contract
uint... | function _secondGiveAway() internal {
require(!second_prize_released); // dev: 2nd prize already released
require(pctReached(75)); // dev: 75% not achieved yet
require(address(this).balance >= SECOND_PRIZE_PER_WALLET_ETH_AMOUNT); // dev: not enough balance in contract
uint... | 76,662 |
14 | // Add rewards that are immediately split up between stakers / | function addReward() external payable {
require(msg.value > 0, "No ETH sent");
require(totalShares > 0, "No stakers");
_addReward(msg.value);
emit RewardAdded(msg.value);
}
| function addReward() external payable {
require(msg.value > 0, "No ETH sent");
require(totalShares > 0, "No stakers");
_addReward(msg.value);
emit RewardAdded(msg.value);
}
| 25,155 |
1 | // Either TransferSingle or TransferBatch MUST emit when tokens are transferred,/including zero value transfers as well as minting or burning./ Operator will always be msg.sender./ Either event from address `0x0` signifies a minting operation./ An event to address `0x0` signifies a burning or melting operation./ The to... | event TransferSingle(
address indexed _operator,
address indexed _from,
address indexed _to,
uint256 _id,
uint256 _value
);
| event TransferSingle(
address indexed _operator,
address indexed _from,
address indexed _to,
uint256 _id,
uint256 _value
);
| 16,459 |
180 | // contract URI | string private _contractURI;
| string private _contractURI;
| 36,459 |
29 | // Returns a boolean indicating if the given address is in the list with the given role. addr address to check role role to check@ return boolean for whether the address is in the list with the role / | function hasRole(address addr, string role)
public
view
returns (bool)
| function hasRole(address addr, string role)
public
view
returns (bool)
| 83,883 |
53 | // Track original fees to bypass fees for charity account | uint256 private ORIG_TAX_FEE;
uint256 private ORIG_BURN_FEE;
uint256 private ORIG_CHARITY_FEE;
| uint256 private ORIG_TAX_FEE;
uint256 private ORIG_BURN_FEE;
uint256 private ORIG_CHARITY_FEE;
| 10,048 |
53 | // Checks whether the period in which the crowdsale is open has already elapsed.return Whether crowdsale period has elapsed / | function hasClosed() public view returns (bool) {
// solium-disable-next-line security/no-block-members
return block.timestamp > closingTime;
}
| function hasClosed() public view returns (bool) {
// solium-disable-next-line security/no-block-members
return block.timestamp > closingTime;
}
| 14,817 |
14 | // Guard against msg.value being reused across multiple assets | uint256 ethValue;
uint256 assetsLength = assets.length;
for (uint256 i = 0; i <= assetsLength - 1; ) {
if (assets[i].assetType.assetClass == AssetLib.ETH_ASSET_CLASS) {
ethValue += assets[i].value;
}
| uint256 ethValue;
uint256 assetsLength = assets.length;
for (uint256 i = 0; i <= assetsLength - 1; ) {
if (assets[i].assetType.assetClass == AssetLib.ETH_ASSET_CLASS) {
ethValue += assets[i].value;
}
| 25,783 |
30 | // does the referrer exist? | playerExist[_referrer] == true
)
{
| playerExist[_referrer] == true
)
{
| 47,835 |
5 | // Compound's CErc20Immutable Contract CTokens which wrap an EIP-20 underlying and are immutable Compound / | contract CErc20Immutable is CErc20 {
/**
* @notice Construct a new money market
* @param underlying_ The address of the underlying asset
* @param comptroller_ The address of the Comptroller
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantis... | contract CErc20Immutable is CErc20 {
/**
* @notice Construct a new money market
* @param underlying_ The address of the underlying asset
* @param comptroller_ The address of the Comptroller
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantis... | 4,248 |
78 | // Disable lock functionality. Call by only Governance. / | function disableLock() external onlyGovernance {
_enabledLock = false;
emit DisabledLock(governance());
}
| function disableLock() external onlyGovernance {
_enabledLock = false;
emit DisabledLock(governance());
}
| 9,922 |
32 | // address msgSender = _msgSender(); | _owner = _msgSender();
emit OwnershipTransferred(address(0), _owner);
| _owner = _msgSender();
emit OwnershipTransferred(address(0), _owner);
| 50,151 |
9 | // tracks total existing number of tokens. named to match ERC-20 standard (see https:eips.ethereum.org/EIPS/eip-20) | uint256 public totalSupply;
| uint256 public totalSupply;
| 23,570 |
244 | // Handles the bridged tokens for the first time, includes deployment of new TokenProxy contract.Checks that the value is inside the execution limits and invokes the Mint or Unlock accordingly. _token address of the native ERC20/ERC677 token on the other side. _name name of the native token, name suffix will be appende... | function deployAndHandleBridgedTokens(
| function deployAndHandleBridgedTokens(
| 37,862 |
107 | // Called to get the details of a user/userAddress User address/ return unstaked Amount of unstaked API3 tokens/ return vesting Amount of API3 tokens locked by vesting/ return unstakeAmount Amount scheduled to unstake/ return unstakeShares Shares revoked to unstake/ return unstakeScheduledFor Time unstaking is schedule... | function getUser(address userAddress)
external
view
override
returns (
uint256 unstaked,
uint256 vesting,
uint256 unstakeAmount,
uint256 unstakeShares,
uint256 unstakeScheduledFor,
| function getUser(address userAddress)
external
view
override
returns (
uint256 unstaked,
uint256 vesting,
uint256 unstakeAmount,
uint256 unstakeShares,
uint256 unstakeScheduledFor,
| 58,245 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.