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 |
|---|---|---|---|---|
23 | // convert to lower case a-z | _temp[i] = byte(uint(_temp[i]) + 32);
| _temp[i] = byte(uint(_temp[i]) + 32);
| 14,867 |
1 | // Approve tokens for use in Strategy Restricted to avoid griefing attacks / | function setAllowances() public override onlyOwner {
depositToken.approve(address(conversionContract), MAX_UINT);
sBamboo.approve(address(stakingContract), MAX_UINT);
}
| function setAllowances() public override onlyOwner {
depositToken.approve(address(conversionContract), MAX_UINT);
sBamboo.approve(address(stakingContract), MAX_UINT);
}
| 34,046 |
44 | // Set the address of the sale contract.`saleContract` can make token transferseven when the token contract state is locked.Transfer lock serves the purpose of preventingthe creation of fake Uniswap pools. Added by WorkQuest Team./ | function setSaleContract(address saleContract) public {
require(msg.sender == _owner && _saleContract == address(0), "Caller must be owner and _saleContract yet unset");
_saleContract = saleContract;
}
| function setSaleContract(address saleContract) public {
require(msg.sender == _owner && _saleContract == address(0), "Caller must be owner and _saleContract yet unset");
_saleContract = saleContract;
}
| 25,986 |
5 | // Returns whether all relevant permission and other checks are met before any upgrade. | function isAuthorizedCallToUpgrade() internal view virtual override returns (bool) {
return hasRole(keccak256("EXTENSION_ROLE"), msg.sender);
}
| function isAuthorizedCallToUpgrade() internal view virtual override returns (bool) {
return hasRole(keccak256("EXTENSION_ROLE"), msg.sender);
}
| 30,993 |
5 | // Fee paid to HeyMint per NFT minted | uint256 public heymintFeePerToken;
uint256 public publicMintsAllowedPerAddress = 444;
uint256 public publicMintsAllowedPerTransaction = 444;
uint256 public publicPrice = 0.02 ether;
| uint256 public heymintFeePerToken;
uint256 public publicMintsAllowedPerAddress = 444;
uint256 public publicMintsAllowedPerTransaction = 444;
uint256 public publicPrice = 0.02 ether;
| 20,471 |
30 | // while designing plan make sure _buyPrice must be a cetrain minimum to fulfill platform fee and payouts sum total, else platform provider will not reaponsible for any buy failwhenever Your EtherInPlan will create/start a new tree structure,platform fee will be deducted, so calculate this while designing plan A check ... | event addEtherInPlanEv(uint256 timeNow, uint256 indexed _networkId, bytes16 indexed _name,uint128 _buyPrice,uint128 _planExpiry, uint8 _maxChild,bool _autoPlaceInTree,bool _allowJoinAgain, uint8 _etheroutPlanId,bool[] _triggerSubTree, bool indexed _triggerExternalContract );
function addEtherInPlan(uint256 _n... | event addEtherInPlanEv(uint256 timeNow, uint256 indexed _networkId, bytes16 indexed _name,uint128 _buyPrice,uint128 _planExpiry, uint8 _maxChild,bool _autoPlaceInTree,bool _allowJoinAgain, uint8 _etheroutPlanId,bool[] _triggerSubTree, bool indexed _triggerExternalContract );
function addEtherInPlan(uint256 _n... | 913 |
35 | // Update the `pool.totalBoostedAmount` | uint256 boostedLiquidityBefore = getBoostedLiquidity(_pid, msg.sender);
user.amount = user.amount.add(receivedAmount);
uint256 boostedLiquidityAfter = getBoostedLiquidity(_pid, msg.sender);
pool.totalBoostedAmount = pool.totalBoostedAmount.add(boostedLiquidityAfter).sub(boostedLiquidity... | uint256 boostedLiquidityBefore = getBoostedLiquidity(_pid, msg.sender);
user.amount = user.amount.add(receivedAmount);
uint256 boostedLiquidityAfter = getBoostedLiquidity(_pid, msg.sender);
pool.totalBoostedAmount = pool.totalBoostedAmount.add(boostedLiquidityAfter).sub(boostedLiquidity... | 14,480 |
17 | // Copy over character data (situated right after a 32-bit length prefix) | assembly {
| assembly {
| 37,590 |
47 | // Map from transaction ID to the transaction's location+1 in the `pendingTransactions` array. | mapping(uint => uint) private pendingTransactionMap;
| mapping(uint => uint) private pendingTransactionMap;
| 42,973 |
89 | // File: .deps/MultiAuction 6/interfaces/IDelegationRegistry.sol |
pragma solidity ^0.8.17;
|
pragma solidity ^0.8.17;
| 2,658 |
155 | // gets billingAccessControllerreturn address of billingAccessController contract / | function billingAccessController()
external
view
returns (AccessControllerInterface)
| function billingAccessController()
external
view
returns (AccessControllerInterface)
| 25,973 |
105 | // Set blacklisted status for the account. account address to set blacklist flag for _isBlacklisted blacklist flag value Requirements: - `msg.sender` should be owner. / | function setBlacklisted(address account, bool _isBlacklisted) external onlyOwner {
require(uint256(account) >= REDEMPTION_ADDRESS_COUNT, "TrueCurrency: blacklisting of redemption address is not allowed");
isBlacklisted[account] = _isBlacklisted;
emit Blacklisted(account, _isBlacklisted);
... | function setBlacklisted(address account, bool _isBlacklisted) external onlyOwner {
require(uint256(account) >= REDEMPTION_ADDRESS_COUNT, "TrueCurrency: blacklisting of redemption address is not allowed");
isBlacklisted[account] = _isBlacklisted;
emit Blacklisted(account, _isBlacklisted);
... | 39,606 |
35 | // Returns the prior number of `votes` for `account` as of `timeStamp`./account The user to check `votes` for./timeStamp The unix time to check `votes` for./ return votes Prior `votes` delegated to `account`. | function getPriorVotes(address account, uint timeStamp) public view returns (uint96 votes) {
require(timeStamp < block.timestamp,'!determined');
uint nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) return 0;
unchecked {
if (checkpoints[acc... | function getPriorVotes(address account, uint timeStamp) public view returns (uint96 votes) {
require(timeStamp < block.timestamp,'!determined');
uint nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) return 0;
unchecked {
if (checkpoints[acc... | 20,999 |
16 | // Configure so transfers of tokens created by the caller (must be extension) gets approvalfrom the extension before transferring / | function setApproveTransferExtension(bool enabled) external;
| function setApproveTransferExtension(bool enabled) external;
| 24,415 |
55 | // A token upgrade mechanism where users can opt-in amount of tokens to the next smart contract revision. First envisioned by Golem and Lunyr projects. / | contract UpgradeableToken is StandardToken {
/** Contract / person who can set the upgrade path. This can be the same as team multisig wallet, as what it is with its default value. */
address public upgradeMaster;
/** The next contract where the tokens will be migrated. */
UpgradeAgent public upgradeAgent;
... | contract UpgradeableToken is StandardToken {
/** Contract / person who can set the upgrade path. This can be the same as team multisig wallet, as what it is with its default value. */
address public upgradeMaster;
/** The next contract where the tokens will be migrated. */
UpgradeAgent public upgradeAgent;
... | 25,118 |
9 | // ============ State Variables ============ // ============ Constructor ============ //Instantiate addresses, methodology parameters, execution parameters, and incentive parameters._managerAddress of IBaseManager contract _strategy Struct of contract addresses _methodologyStruct containing methodology parameters _exec... | constructor(
IBaseManager _manager,
ContractSettings memory _strategy,
MethodologySettings memory _methodology,
ExecutionSettings memory _execution,
IncentiveSettings memory _incentive,
string[] memory _exchangeNames,
ExchangeSettings[] memory _exchangeSetting... | constructor(
IBaseManager _manager,
ContractSettings memory _strategy,
MethodologySettings memory _methodology,
ExecutionSettings memory _execution,
IncentiveSettings memory _incentive,
string[] memory _exchangeNames,
ExchangeSettings[] memory _exchangeSetting... | 29,316 |
25 | // update UserEarn info for a legacy (cleared during swap) limit order./an limit order we call it 'legacy' if it together with other limit order of same/direction and same point on the pool is cleared during one time of exchanging./if an limit order is convinced to be 'legacy', we should mark it as 'sold out',/etc, tra... | function updateLegacyOrder(
UserEarn.Data storage self,
uint128 addDelta,
uint256 currAccEarn,
uint160 sqrtPrice_96,
uint128 totalLegacyEarn,
bool isEarnY
| function updateLegacyOrder(
UserEarn.Data storage self,
uint128 addDelta,
uint256 currAccEarn,
uint160 sqrtPrice_96,
uint128 totalLegacyEarn,
bool isEarnY
| 18,851 |
201 | // mint settings | uint256 public maxSupply = 5000;
uint256 public maxPerMint = 20;
uint256 public pricePerToken = 50000000000000000;
uint256 public tokenfyPrice = 18300000000000000000000;
| uint256 public maxSupply = 5000;
uint256 public maxPerMint = 20;
uint256 public pricePerToken = 50000000000000000;
uint256 public tokenfyPrice = 18300000000000000000000;
| 9,639 |
12 | // Reset recipient and fee with newly data | for (uint i = 0; i < recipientCount; i++) {
recipient[i] = _recipient[i];
fee[i] = _fee[i];
}
| for (uint i = 0; i < recipientCount; i++) {
recipient[i] = _recipient[i];
fee[i] = _fee[i];
}
| 28,898 |
5 | // Timestamp of start of campaign | uint32 startAt;
| uint32 startAt;
| 1,755 |
13 | // Mapping from a bridge token into a whitelisted liquidity pool for the token./ Could be used for swaps on both origin and destination chains./ For swaps on destination chains, this is the only pool that could be used for swaps for the given token. | mapping(address => TypedPool) internal _bridgePools;
| mapping(address => TypedPool) internal _bridgePools;
| 8,150 |
14 | // Getters | function getChainId() external view returns (uint256);
function getStoredChainId() external view returns (uint256);
| function getChainId() external view returns (uint256);
function getStoredChainId() external view returns (uint256);
| 8,521 |
286 | // expmodsAndPoints.expmods[14] = traceGenerator^23. | mstore(add(expmodsAndPoints, 0x1c0),
mulmod(mload(add(expmodsAndPoints, 0x1a0)), // traceGenerator^22
traceGenerator, // traceGenerator^1
PRIME))
| mstore(add(expmodsAndPoints, 0x1c0),
mulmod(mload(add(expmodsAndPoints, 0x1a0)), // traceGenerator^22
traceGenerator, // traceGenerator^1
PRIME))
| 63,891 |
171 | // called when token is deposited on root chain Should be callable only by ChildChainManagerShould handle deposit by minting the required amount for userMake sure minting is done only by this function user user address for whom deposit is being done depositData abi encoded amount / | function deposit(address user, bytes calldata depositData)
external
override
only(DEPOSITOR_ROLE)
| function deposit(address user, bytes calldata depositData)
external
override
only(DEPOSITOR_ROLE)
| 22,571 |
0 | // Constant state/Constant state used by the swap router | library Constants {
/// @dev Used for identifying cases when this contract's balance of a token is to be used
uint256 internal constant CONTRACT_BALANCE = 0;
/// @dev Used as a flag for identifying msg.sender, saves gas by sending more 0 bytes
address internal constant MSG_SENDER = address(1);
///... | library Constants {
/// @dev Used for identifying cases when this contract's balance of a token is to be used
uint256 internal constant CONTRACT_BALANCE = 0;
/// @dev Used as a flag for identifying msg.sender, saves gas by sending more 0 bytes
address internal constant MSG_SENDER = address(1);
///... | 7,114 |
14 | // Gets the maximum age that the oracle price can be before the call is routed to fallback/ return the max age in seconds | function getMaxPriceAgeLimit() external view returns (uint256) {
return maxPriceAgeLimit;
}
| function getMaxPriceAgeLimit() external view returns (uint256) {
return maxPriceAgeLimit;
}
| 26,389 |
244 | // Returns true if the two slices contain the same text. self The first slice to compare. self The second slice to compare.return True if the slices are equal, false otherwise. / | function equals(slice memory self, slice memory other) internal pure returns (bool) {
return compare(self, other) == 0;
}
| function equals(slice memory self, slice memory other) internal pure returns (bool) {
return compare(self, other) == 0;
}
| 27,508 |
1 | // Error messages | string public constant MINT_BEFORE_START = "Sale not started";
string public constant INCORRECT_AMOUNT = "Incorrect amount sent";
string public constant PURCHACE_TOO_MANY = "Quantity was greater than 20";
string public constant NO_CHARACTERS = "No characters are available";
string public constant IN... | string public constant MINT_BEFORE_START = "Sale not started";
string public constant INCORRECT_AMOUNT = "Incorrect amount sent";
string public constant PURCHACE_TOO_MANY = "Quantity was greater than 20";
string public constant NO_CHARACTERS = "No characters are available";
string public constant IN... | 54,085 |
0 | // Counters to regulate the current amount of NFT Tokens minted | using Counters for Counters.Counter;
Counters.Counter private supply;
| using Counters for Counters.Counter;
Counters.Counter private supply;
| 19,210 |
25 | // Send commission to marketplace member address / | function handleIncomingPayment(address member)
private
| function handleIncomingPayment(address member)
private
| 19,426 |
32 | // PhotochainMarketplace Marketplace to make and accept offers using PhotonToken / | contract PhotochainMarketplace is Ownable {
/**
* Event for offer creation logging
* @param id Generated unique offer id
* @param seller Addess of seller of the photo
* @param licenseType Which license is applied on the offer
* @param photoDigest 256-bit hash of the photo
* @param pric... | contract PhotochainMarketplace is Ownable {
/**
* Event for offer creation logging
* @param id Generated unique offer id
* @param seller Addess of seller of the photo
* @param licenseType Which license is applied on the offer
* @param photoDigest 256-bit hash of the photo
* @param pric... | 39,117 |
37 | // The rank contract allows you to assign a rank to users./Nethny/Allows you to assign different parameters to users/By default, the first created rank is used for users./ This rank can be changed using various parameter change functions./ Ranks are 2 arrays (name array, value array), they are extensible/ and provide f... | contract Ranking is Ownable {
struct Rank {
string Name;
string[] pNames;
uint256[] pValues;
bool isChangeable;
}
//List of ranks
Rank[] public _ranks;
mapping(string => uint256) public _rankSequence;
uint256 _ranksHead;
//Table of ranks assigned to users
... | contract Ranking is Ownable {
struct Rank {
string Name;
string[] pNames;
uint256[] pValues;
bool isChangeable;
}
//List of ranks
Rank[] public _ranks;
mapping(string => uint256) public _rankSequence;
uint256 _ranksHead;
//Table of ranks assigned to users
... | 41,465 |
13 | // Allows _spender to withdraw the _allowance amount form sender / | function approve(address _spender, uint256 _allowance) returns (bool success) {
if (balances[msg.sender] >= _allowance) {
allowed[msg.sender][_spender] = _allowance;
Approval(msg.sender, _spender, _allowance);
return true;
} else {
return false;
... | function approve(address _spender, uint256 _allowance) returns (bool success) {
if (balances[msg.sender] >= _allowance) {
allowed[msg.sender][_spender] = _allowance;
Approval(msg.sender, _spender, _allowance);
return true;
} else {
return false;
... | 12,855 |
191 | // to admin | (bool success2, ) = admin.call.value(amount4admin)("");
require(success2, "Transfer failed.");
| (bool success2, ) = admin.call.value(amount4admin)("");
require(success2, "Transfer failed.");
| 83,089 |
383 | // deposits WETH into the reserve, using native ETH. A corresponding amount of the overlying asset (aTokens)is minted. onBehalfOf address of the user who will receive the aTokens representing the deposit referralCode integrators are assigned a referral code and can potentially receive rewards. / | function depositETH(address onBehalfOf, uint16 referralCode) external payable override {
WETH.deposit{value: msg.value}();
POOL.deposit(address(WETH), msg.value, onBehalfOf, referralCode);
}
| function depositETH(address onBehalfOf, uint16 referralCode) external payable override {
WETH.deposit{value: msg.value}();
POOL.deposit(address(WETH), msg.value, onBehalfOf, referralCode);
}
| 25,048 |
6 | // Record the time the contract bought the tokens. | uint256 public time_bought;
| uint256 public time_bought;
| 47,619 |
16 | // NoteRegistry creation method. Takes an id of the factory to use._linkedTokenAddress - address of any erc20 linked token (can not be 0x0 if canConvert is true)_scalingFactor - defines the number of tokens that an AZTEC note value of 1 maps to._canAdjustSupply - whether the noteRegistry can make use of minting and bur... | function createNoteRegistry(
address _linkedTokenAddress,
uint256 _scalingFactor,
bool _canAdjustSupply,
bool _canConvert,
uint24 _factoryId
| function createNoteRegistry(
address _linkedTokenAddress,
uint256 _scalingFactor,
bool _canAdjustSupply,
bool _canConvert,
uint24 _factoryId
| 30,062 |
23 | // Token state | enum Phase {
Created,
Running,
Paused,
Migrating,
Migrated
}
| enum Phase {
Created,
Running,
Paused,
Migrating,
Migrated
}
| 54,187 |
26 | // IERC20Metadata/Alchemix Finance | interface IERC20Metadata {
/// @notice Gets the name of the token.
///
/// @return The name.
function name() external view returns (string memory);
/// @notice Gets the symbol of the token.
///
/// @return The symbol.
function symbol() external view returns (string memory);
/// @no... | interface IERC20Metadata {
/// @notice Gets the name of the token.
///
/// @return The name.
function name() external view returns (string memory);
/// @notice Gets the symbol of the token.
///
/// @return The symbol.
function symbol() external view returns (string memory);
/// @no... | 55,662 |
3 | // Gets balance of third party ERC20 token/ | function getBalanceOfExternalERC20(address _erc20Address)
external
view
returns (uint256)
| function getBalanceOfExternalERC20(address _erc20Address)
external
view
returns (uint256)
| 55,331 |
48 | // called by the manager to pause, triggers stopped state / | function pauseContract() external onlyAllowedManager('pause_contract') whenContractNotPaused {
paused = true;
PauseEvent();
}
| function pauseContract() external onlyAllowedManager('pause_contract') whenContractNotPaused {
paused = true;
PauseEvent();
}
| 49,911 |
13 | // Returns true if an address has configurator rights/account Address to check | function isConfigurator(address account)
external
view
override
returns (bool)
| function isConfigurator(address account)
external
view
override
returns (bool)
| 22,657 |
52 | // operator | DependLike_3(seniorOperator).depend("tranche", seniorTranche);
DependLike_3(juniorOperator).depend("tranche", juniorTranche);
DependLike_3(seniorOperator).depend("token", seniorToken);
DependLike_3(juniorOperator).depend("token", juniorToken);
| DependLike_3(seniorOperator).depend("tranche", seniorTranche);
DependLike_3(juniorOperator).depend("tranche", juniorTranche);
DependLike_3(seniorOperator).depend("token", seniorToken);
DependLike_3(juniorOperator).depend("token", juniorToken);
| 36,109 |
4 | // permanently lock the first MINIMUM_LIQUIDITY tokens | mintTokens = mintTokens.sub(MINIMUM_LIQUIDITY);
_mint(address(0), MINIMUM_LIQUIDITY);
| mintTokens = mintTokens.sub(MINIMUM_LIQUIDITY);
_mint(address(0), MINIMUM_LIQUIDITY);
| 36,222 |
31 | // Current number of votes in opposition to this proposal | uint256 againstVotes;
| uint256 againstVotes;
| 9,634 |
29 | // Sets the final sum of user stakes for history and profit computation. Callable only once per cycle.The token balance of the contract may not be set as final stake, because there might have occurred unapproved deposits. value the number of EDG tokens that were transfered from the bankroll/ | function closeCycle(uint value) public onlyAuthorized bankrollPhase {
require(tokenBalance() >= value);
finalStakes[cycle] = safeSub(value, safeMul(updateGasCost, numHolders)/100);//updateGasCost is using 2 decimals
}
| function closeCycle(uint value) public onlyAuthorized bankrollPhase {
require(tokenBalance() >= value);
finalStakes[cycle] = safeSub(value, safeMul(updateGasCost, numHolders)/100);//updateGasCost is using 2 decimals
}
| 7,492 |
81 | // Actually unpause the contract. | super.unpause();
| super.unpause();
| 13,036 |
15 | // 给接收者加上相同的量 | balanceOf[_to] += _value;
| balanceOf[_to] += _value;
| 25,097 |
47 | // contributor reward update | function updateContribReward(address _from) external {
// require(msg.sender == address(metaGeckosContract));
uint256 time = min(block.timestamp, ends[_from]);
uint256 timerFrom = lastUpdate[_from];
if (timerFrom > 0)
rewards[_from] += rates[_from].mul((time.sub(timerFrom))).div(86400);
if (timerFrom... | function updateContribReward(address _from) external {
// require(msg.sender == address(metaGeckosContract));
uint256 time = min(block.timestamp, ends[_from]);
uint256 timerFrom = lastUpdate[_from];
if (timerFrom > 0)
rewards[_from] += rates[_from].mul((time.sub(timerFrom))).div(86400);
if (timerFrom... | 38,746 |
6 | // Returns the number of terms to maturity./ | function Maturity() public override pure returns (uint256) {
return 6;
}
| function Maturity() public override pure returns (uint256) {
return 6;
}
| 3,686 |
29 | // Fallback function for funding smart contract./ | function()
external
payable
| function()
external
payable
| 6,292 |
81 | // Enable the {transfer}, {mint} and {burn} functions of contract. Can only be called by the current owner.The contract must be paused. / | function unfreeze() public onlyOwner {
_unpause();
}
| function unfreeze() public onlyOwner {
_unpause();
}
| 79,238 |
146 | // then we shift left by the difference | amount = amount * 10**(decimalsAfter - decimalsBefore);
| amount = amount * 10**(decimalsAfter - decimalsBefore);
| 34,400 |
47 | // Mint new tokens./account Address to send newly minted tokens to./value Amount of tokens to mint. | function mint(address account, uint value)
public
onlyMintingAdmin
whitelistedAddress(account)
mpvNotPaused
| function mint(address account, uint value)
public
onlyMintingAdmin
whitelistedAddress(account)
mpvNotPaused
| 10,853 |
78 | // The Declaration constructor to define some constants / | constructor() public {
setFeeDistributionsAndStatusThresholds();
}
| constructor() public {
setFeeDistributionsAndStatusThresholds();
}
| 72,132 |
13 | // Verify if address is allowed to mint on project. _proof Merkle proof for address. _address Address to check.return inAllowlist true only if address is allowed to mint and validMerkle proof was provided / | function _verifyAddress(
address _address,
bytes32[] memory _proof
| function _verifyAddress(
address _address,
bytes32[] memory _proof
| 22,394 |
0 | // Concat Appends two strings together and returns a new value_base When being used for a data type this is the extended object otherwise this is the string which will be the concatenated prefix _value The value to be the concatenated suffixreturn string The resulting string from combining the base and value / | function concat(string memory _base, string memory _value)
internal
pure
returns (string memory)
| function concat(string memory _base, string memory _value)
internal
pure
returns (string memory)
| 16,387 |
147 | // acceptanceBudget - Paymaster expected gas budget to accept (or reject) a request This a gas required by any calculations that might need to reject the transaction, by preRelayedCall, forwarder and recipient. See value in BasePaymaster.PAYMASTER_ACCEPTANCE_BUDGET Transaction that gets rejected above that gas usage is... | struct GasAndDataLimits {
uint256 acceptanceBudget;
uint256 preRelayedCallGasLimit;
uint256 postRelayedCallGasLimit;
uint256 calldataSizeLimit;
}
| struct GasAndDataLimits {
uint256 acceptanceBudget;
uint256 preRelayedCallGasLimit;
uint256 postRelayedCallGasLimit;
uint256 calldataSizeLimit;
}
| 11,198 |
1 | // slither-disable-next-line unused-return | Address.functionCall(deployedProxy, _data);
| Address.functionCall(deployedProxy, _data);
| 18,217 |
1,028 | // Transfer funds to the beneficiary | if (address(0) == currencyCt && 0 == currencyId)
beneficiary.receiveEthersTo.value(uint256(value))(destWallet, "");
else {
| if (address(0) == currencyCt && 0 == currencyId)
beneficiary.receiveEthersTo.value(uint256(value))(destWallet, "");
else {
| 35,890 |
70 | // See {IERC20-approve}. NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on`transferFrom`. This is semantically equivalent to an infinite approval. Requirements: - `spender` cannot be the zero address. / | function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
| function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
| 31,408 |
32 | // / | function freezeWithTimestamp(
address _target,
uint256 _timestamp
)
public
| function freezeWithTimestamp(
address _target,
uint256 _timestamp
)
public
| 50,414 |
2 | // ----- VIEWS ----- | function getStoreAddress() external view returns (address) {
return _storeAddress;
}
| function getStoreAddress() external view returns (address) {
return _storeAddress;
}
| 49,615 |
14 | // mapping(owner address => mapping(channelId uint => nonce uint256))) public canceled; | mapping(address => mapping(uint256 => uint)) public canceled;
string public constant version = '2.0.0';
uint public applyWait = 1 days;
uint public feeRate = 10;
bool public withdrawEnabled = false;
bool public stop = false;
uint256 private DEFAULT_CHANNEL_ID = 0;
bool public depositToEn... | mapping(address => mapping(uint256 => uint)) public canceled;
string public constant version = '2.0.0';
uint public applyWait = 1 days;
uint public feeRate = 10;
bool public withdrawEnabled = false;
bool public stop = false;
uint256 private DEFAULT_CHANNEL_ID = 0;
bool public depositToEn... | 17,867 |
78 | // solhint-disable // Wrappers over Solidity's arithmetic operations with added overflowchecks. Arithmetic operations in Solidity wrap on overflow. This can easily resultin bugs, because programmers usually assume that an overflow raises anerror, which is the standard behavior in high level programming languages.`SafeM... | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
... | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
... | 63,927 |
25 | // Internal function that stores the new proxy admin address to the corresponding storage slot./ | function _setAdmin(address newAdmin) internal {
bytes32 slot = _ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
| function _setAdmin(address newAdmin) internal {
bytes32 slot = _ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
| 40,346 |
156 | // Flag indicating if Custom Token burning has been permanently finished or not. | bool public burningFinished;
| bool public burningFinished;
| 5,349 |
5 | // Function to withdraw all Ether from this contract. | function withdraw() public onlyOwner {
// get the amount of Ether stored in this contract
uint amount = address(this).balance;
// send all Ether to owner
// Owner can receive Ether since the address of owner is payable
(bool success, ) = _owner.call{value: amount}("");
... | function withdraw() public onlyOwner {
// get the amount of Ether stored in this contract
uint amount = address(this).balance;
// send all Ether to owner
// Owner can receive Ether since the address of owner is payable
(bool success, ) = _owner.call{value: amount}("");
... | 9,120 |
17 | // Removes the special transfer right, before transfers are enabled _from The address that the transfer grant is removed from / | function cancelTransferRight(address _from) onlyOwner public {
require(!transferable);
require(transferGrants[_from]);
transferGrants[_from] = false;
TransferRightCancelled(_from);
}
| function cancelTransferRight(address _from) onlyOwner public {
require(!transferable);
require(transferGrants[_from]);
transferGrants[_from] = false;
TransferRightCancelled(_from);
}
| 22,482 |
267 | // Ensure sufficient balance. | require(address(this).balance >= amount, "insufficient balance");
| require(address(this).balance >= amount, "insufficient balance");
| 19,957 |
67 | // See {IBEP20-transfer}. Requirements: - `recipient` cannot be the zero address.- the caller must have a balance of at least `amount`. / | function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
| function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
| 52,750 |
24 | // Returns true if `account` is a contract. [IMPORTANT]====It is unsafe to assume that an address for which this function returnsfalse is an externally-owned account (EOA) and not a contract. Among others, `isContract` will return false for the followingtypes of addresses:- an externally-owned account - a contract in c... | function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
... | function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
... | 28,656 |
121 | // address of the interest rate strategy | address interestRateStrategyAddress;
| address interestRateStrategyAddress;
| 22,680 |
86 | // Mapping owner address to token count | mapping(address => uint256) private _balances;
| mapping(address => uint256) private _balances;
| 57,976 |
100 | // Once verified, set the token allowance to tokenQty | require(token.approve(_kyberProxy, tokenQty));
| require(token.approve(_kyberProxy, tokenQty));
| 34,639 |
20 | // BlackList | contract BlackList is Ownable {
function getBlackListStatus(address _address) external view returns (bool) {
return isBlackListed[_address];
}
mapping (address => bool) public isBlackListed;
function addBlackList(address _evilUser) public onlyOwnerAdmin {
isBlackListed[_evilUser] ... | contract BlackList is Ownable {
function getBlackListStatus(address _address) external view returns (bool) {
return isBlackListed[_address];
}
mapping (address => bool) public isBlackListed;
function addBlackList(address _evilUser) public onlyOwnerAdmin {
isBlackListed[_evilUser] ... | 15,955 |
21 | // Returns array list of registered `members` accounts in Baal. | function getMemberList() external view returns (address[] memory membership) {
membership = memberList;
}
| function getMemberList() external view returns (address[] memory membership) {
membership = memberList;
}
| 9,341 |
80 | // offer id has been done by swapper | event Swapped(address indexed swapper, uint256 indexed offerId);
| event Swapped(address indexed swapper, uint256 indexed offerId);
| 7,016 |
257 | // tokenBalance here has already _newAmount counted | uint256 tokenBalance = IERC20(token).balanceOf(address(this));
if (tokenBalance == 0) {
return false;
}
| uint256 tokenBalance = IERC20(token).balanceOf(address(this));
if (tokenBalance == 0) {
return false;
}
| 37,632 |
91 | // Math library for computing sqrt prices from ticks and vice versa/Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports/ prices between 2-128 and 2128 | library TickMath {
/// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128
int24 internal constant MIN_TICK = -887272;
/// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128
int24 internal constant ... | library TickMath {
/// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128
int24 internal constant MIN_TICK = -887272;
/// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128
int24 internal constant ... | 1,061 |
55 | // Destroys `amount` tokens from `account`, reducing thetotal supply. | * Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0)... | * Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0)... | 186 |
4 | // - Directly repays a Lender using unused tokens already held by Line with no trading amount - amount of unused tokens to use to repay Lenderreturn - if function executed successfully / | function useAndRepay(uint256 amount) external returns (bool);
| function useAndRepay(uint256 amount) external returns (bool);
| 27,985 |
91 | // ============ Modifiers ============ //Throws if the sender is not the SetToken manager contract owner / | modifier onlyOwner(ISetToken _setToken) {
require(msg.sender == _manager(_setToken).owner(), "Must be owner");
_;
}
| modifier onlyOwner(ISetToken _setToken) {
require(msg.sender == _manager(_setToken).owner(), "Must be owner");
_;
}
| 71,684 |
17 | // Provides a safe ERC20.transfer version for different ERC-20 implementations./ Reverts on a failed transfer./token The address of the ERC-20 token./to Transfer tokens to./amount The token amount. | function safeTransfer(
IERC20 token,
address to,
uint256 amount
| function safeTransfer(
IERC20 token,
address to,
uint256 amount
| 6,587 |
12 | // namehash('eth') | bytes32 constant public TLD_NODE = 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;
bool public stopped = false;
address public registrarOwner;
address public migration;
address public registrar;
ENS public ens;
| bytes32 constant public TLD_NODE = 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;
bool public stopped = false;
address public registrarOwner;
address public migration;
address public registrar;
ENS public ens;
| 28,562 |
112 | // Gets the segment corresponding to the first pool in the path/path The bytes encoded swap path/ return The segment containing all data necessary to target the first pool in the path | function getFirstPool(bytes memory path) internal pure returns (bytes memory) {
return path.slice(0, POP_OFFSET);
}
| function getFirstPool(bytes memory path) internal pure returns (bytes memory) {
return path.slice(0, POP_OFFSET);
}
| 37,379 |
4 | // remove a operator role from an address _operator address / | function removeOperator(address _operator) public onlyOwner {
removeRole(_operator, ROLE_OPERATOR);
}
| function removeOperator(address _operator) public onlyOwner {
removeRole(_operator, ROLE_OPERATOR);
}
| 28,925 |
27 | // if first investment or investment after emergenct withdraw | if(!investors[msg.sender].isInvestor){
allInvestors.push(msg.sender);
investors[msg.sender].isInvestor = true;
investors[msg.sender].isLast = true;
if(allInvestors.length > 3) {
doublePercentsEnd[allInvestors[allInvestors.length.sub(4)]].push(block... | if(!investors[msg.sender].isInvestor){
allInvestors.push(msg.sender);
investors[msg.sender].isInvestor = true;
investors[msg.sender].isLast = true;
if(allInvestors.length > 3) {
doublePercentsEnd[allInvestors[allInvestors.length.sub(4)]].push(block... | 42,454 |
48 | // Add a delegate through an encoded signature | function addDelegateBySignature(address user, address delegate, uint deadline, uint8 v, bytes32 r, bytes32 s) public override {
require(deadline >= block.timestamp, 'Delegable: Signature expired');
bytes32 hashStruct = keccak256(
abi.encode(
SIGNATURE_TYPEHASH,
... | function addDelegateBySignature(address user, address delegate, uint deadline, uint8 v, bytes32 r, bytes32 s) public override {
require(deadline >= block.timestamp, 'Delegable: Signature expired');
bytes32 hashStruct = keccak256(
abi.encode(
SIGNATURE_TYPEHASH,
... | 45,448 |
94 | // sets the daily ROI | function setDailyROI(uint _dailyROI) external onlyOwner() {
dailyROI = _dailyROI;
}
| function setDailyROI(uint _dailyROI) external onlyOwner() {
dailyROI = _dailyROI;
}
| 27,660 |
320 | // Extends and/or updates the current component set and its target units with new components and targets,Validates inputs, requiring that that new components and new target units arrays are the same size, andthat the number of old components target units matches the number of current components. Throws ifa duplicate co... | function _getAggregateComponentsAndUnits(
address[] memory _currentComponents,
address[] calldata _newComponents,
uint256[] calldata _newComponentsTargetUnits,
uint256[] calldata _oldComponentsTargetUnits
)
internal
pure
returns (address[] memory aggregate... | function _getAggregateComponentsAndUnits(
address[] memory _currentComponents,
address[] calldata _newComponents,
uint256[] calldata _newComponentsTargetUnits,
uint256[] calldata _oldComponentsTargetUnits
)
internal
pure
returns (address[] memory aggregate... | 8,975 |
59 | // [LEGACY] Creates a new orderassetId - ID of the published NFTpriceInWei - Price in Wei for the supported coinexpiresAt - Duration of the order (in hours)/ | function createOrder(
uint256 assetId,
uint256 priceInWei,
uint256 expiresAt
)
public
whenNotPaused
| function createOrder(
uint256 assetId,
uint256 priceInWei,
uint256 expiresAt
)
public
whenNotPaused
| 43,224 |
53 | // Deploys a new proxy for some version, with some initialization arguments, using `create` (i.e. factory's nonce determines the address). | function _newInstance(uint256 version_, bytes memory arguments_) internal virtual returns (bool success_, address proxy_) {
address implementation = _implementationOf[version_];
if (implementation == address(0)) return (false, address(0));
proxy_ = address(new Proxy(address(this), implem... | function _newInstance(uint256 version_, bytes memory arguments_) internal virtual returns (bool success_, address proxy_) {
address implementation = _implementationOf[version_];
if (implementation == address(0)) return (false, address(0));
proxy_ = address(new Proxy(address(this), implem... | 3,073 |
62 | // token_amount -= (referralAmount + bonus); |
uint256 tokens = token_amount / 10;
uint256 balanceAmount = token_amount - tokens;
tokens += bonus;
|
uint256 tokens = token_amount / 10;
uint256 balanceAmount = token_amount - tokens;
tokens += bonus;
| 32,825 |
18 | // give winnings for a bet to the player - can be triggered only by player _betId - the bet idreturn uint256 - returns the claimed amount / | function claimWinnings(uint256 _betId) external returns (uint256 amount);
| function claimWinnings(uint256 _betId) external returns (uint256 amount);
| 49,989 |
216 | // mint for user and the first level referrer. | rose.mint(msg.sender, _amount.div(100));
rose.mint(referrer, _amount.mul(2).div(100));
| rose.mint(msg.sender, _amount.div(100));
rose.mint(referrer, _amount.mul(2).div(100));
| 14,478 |
34 | // Gets an owner by 0-indexed position (using numOwners as the count) | function getOwner(uint ownerIndex) external constant returns (address) {
return address(owners[ownerIndex + 1]);
}
| function getOwner(uint ownerIndex) external constant returns (address) {
return address(owners[ownerIndex + 1]);
}
| 24,364 |
210 | // Set the mapping entry for this lottery address. |
lotteryGasConfigs[ lotteryAddr ] = gasConfig;
|
lotteryGasConfigs[ lotteryAddr ] = gasConfig;
| 5,916 |
75 | // This way the claimant either gets the balance because he sniped the team Or he initiates the transfer to the rightful owner | teams[_teamId].owner.transfer(teams[_teamId].balance);
emit TeamOwnerPaid(_teamId, teams[_teamId].balance);
teams[_teamId].balance = 0;
| teams[_teamId].owner.transfer(teams[_teamId].balance);
emit TeamOwnerPaid(_teamId, teams[_teamId].balance);
teams[_teamId].balance = 0;
| 54,790 |
56 | // See {IERC1417-revokeVote}. / | function revokeVote() public virtual override {
Voter storage sender = _voters[_msgSender()];
require(sender.voted, "ERC1417: voter has not yet voted.");
uint256 proposalId = sender.vote;
uint256 voteWeight = sender.weight;
sender.voted = false;
_proposals[sender.v... | function revokeVote() public virtual override {
Voter storage sender = _voters[_msgSender()];
require(sender.voted, "ERC1417: voter has not yet voted.");
uint256 proposalId = sender.vote;
uint256 voteWeight = sender.weight;
sender.voted = false;
_proposals[sender.v... | 48,294 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.