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 |
|---|---|---|---|---|
130 | // Hook that is called just after minting new tokens. To be used i.e.if the minted token/share is to be transferred to a different contract. / | function _afterMinting(uint256 amount) internal virtual {}
| function _afterMinting(uint256 amount) internal virtual {}
| 42,620 |
24 | // uint time_stfrozen; | uint time_end_frozen;
uint time_last_query;
uint256 frozen_total;
| uint time_end_frozen;
uint time_last_query;
uint256 frozen_total;
| 71,561 |
104 | // Moves the iterator to the next resource record.iter The iterator to advance./ | function next(RRIterator memory iter) internal pure {
iter.offset = iter.nextOffset;
if (iter.offset >= iter.data.length) {
return;
}
// Skip the name
uint off = iter.offset + nameLength(iter.data, iter.offset);
// Read type, class, and ttl
iter.... | function next(RRIterator memory iter) internal pure {
iter.offset = iter.nextOffset;
if (iter.offset >= iter.data.length) {
return;
}
// Skip the name
uint off = iter.offset + nameLength(iter.data, iter.offset);
// Read type, class, and ttl
iter.... | 16,944 |
13 | // Not enough token in vault to withdraw, try if enough if swap from other token in vault | (address token1, uint token1AmtInVault, address token2, uint token2AmtInVault) = getOtherTokenAndBal(token);
if (withdrawAmt < tokenAmtInVault + token1AmtInVault) {
| (address token1, uint token1AmtInVault, address token2, uint token2AmtInVault) = getOtherTokenAndBal(token);
if (withdrawAmt < tokenAmtInVault + token1AmtInVault) {
| 60,508 |
57 | // Default fallback method which will be called when any ethers are sent to contract / | function() public payable {
buyTokens(msg.sender);
}
| function() public payable {
buyTokens(msg.sender);
}
| 42,445 |
84 | // function getPolicyBookAPY(address policyBookAddress) external view returns (uint256); |
function restakeBMIProfit(uint256 tokenId) external;
function restakeStakerBMIProfit(address policyBookAddress) external;
function withdrawBMIProfit(uint256 tokenID) external;
function withdrawStakerBMIProfit(address policyBookAddress) external;
function withdrawFundsWithProfit(uint256 tokenID)... |
function restakeBMIProfit(uint256 tokenId) external;
function restakeStakerBMIProfit(address policyBookAddress) external;
function withdrawBMIProfit(uint256 tokenID) external;
function withdrawStakerBMIProfit(address policyBookAddress) external;
function withdrawFundsWithProfit(uint256 tokenID)... | 41,202 |
84 | // Check forced data matches | bytes32 hashedForcedBatchData = keccak256(
abi.encodePacked(
currentTransactionsHash,
currentBatch.globalExitRoot,
currentBatch.minForcedTimestamp
)
);
if (
... | bytes32 hashedForcedBatchData = keccak256(
abi.encodePacked(
currentTransactionsHash,
currentBatch.globalExitRoot,
currentBatch.minForcedTimestamp
)
);
if (
... | 6,231 |
127 | // Reads the uint32 at `cdPtr` in calldata. | function readUint32(
CalldataPointer cdPtr
| function readUint32(
CalldataPointer cdPtr
| 19,643 |
22 | // @note We utilize the storage slot for Universal Index State to store whether an account is a pool or not | bytes32[] memory data = new bytes32[](1);
data[0] = bytes32(uint256(1));
token.updateAgreementStateSlot(address(pool), _UNIVERSAL_INDEX_STATE_SLOT_ID, data);
emit PoolCreated(token, admin, pool);
| bytes32[] memory data = new bytes32[](1);
data[0] = bytes32(uint256(1));
token.updateAgreementStateSlot(address(pool), _UNIVERSAL_INDEX_STATE_SLOT_ID, data);
emit PoolCreated(token, admin, pool);
| 8,395 |
124 | // Gets the token symbolreturn string representing the token symbol / | function symbol() external pure returns(string memory) {
return "PHP";
}
| function symbol() external pure returns(string memory) {
return "PHP";
}
| 17,577 |
40 | // Burns a specific amount of tokens. _value The amount of token to be burned. / | function burn(uint256 _value) public {
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
... | function burn(uint256 _value) public {
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
... | 9,028 |
5 | // Base token Uri | string public baseUri;
| string public baseUri;
| 27,726 |
155 | // Sets or unsets the approval of a given operatorAn operator is allowed to transfer all tokens of the sender on their behalf to operator address to set the approval approved representing the status of the approval to be set / | function setApprovalForAll(address to, bool approved) public {
require(to != msg.sender);
_operatorApprovals[msg.sender][to] = approved;
emit ApprovalForAll(msg.sender, to, approved);
}
| function setApprovalForAll(address to, bool approved) public {
require(to != msg.sender);
_operatorApprovals[msg.sender][to] = approved;
emit ApprovalForAll(msg.sender, to, approved);
}
| 22,698 |
28 | // Send token to buyer | IERC721(erc721Address).safeTransferFrom(
listing.seller,
buyer,
listing.tokenId
);
_removeListing(erc721Address, listing.tokenId);
emit TokenBought({
erc721Address: erc721Address,
| IERC721(erc721Address).safeTransferFrom(
listing.seller,
buyer,
listing.tokenId
);
_removeListing(erc721Address, listing.tokenId);
emit TokenBought({
erc721Address: erc721Address,
| 20,312 |
19 | // 50% | return (5e17, 30 days);
| return (5e17, 30 days);
| 86,326 |
1 | // Manager rated by worker Worker rated by evaluator | if (_role == MANAGER) {
require(tasks[_id].roles[WORKER].user == msg.sender);
} else if (_role == WORKER) {
| if (_role == MANAGER) {
require(tasks[_id].roles[WORKER].user == msg.sender);
} else if (_role == WORKER) {
| 42,092 |
10 | // Set owner | idToOwner[tokenId] = msg.sender;
| idToOwner[tokenId] = msg.sender;
| 34,572 |
9 | // in case of emergency or fall function | function recoverAll() public onlyOscar{
addressOscar.transfer(this.balance);
}
| function recoverAll() public onlyOscar{
addressOscar.transfer(this.balance);
}
| 12,634 |
929 | // Disable script executor with ID `_executorId`_executorId Identifier of the executor in the registry/ | function disableScriptExecutor(uint256 _executorId)
external
authP(REGISTRY_MANAGER_ROLE, arr(_executorId))
| function disableScriptExecutor(uint256 _executorId)
external
authP(REGISTRY_MANAGER_ROLE, arr(_executorId))
| 14,529 |
10 | // only two token types | require(tokenIds[i] == 1 || tokenIds[i] == 2, "only token 1 or 2 available");
if (tokenIds[i] == 1) {
typeOneToMint += tokenAmounts[i];
} else if (tokenIds[i] == 2) {
| require(tokenIds[i] == 1 || tokenIds[i] == 2, "only token 1 or 2 available");
if (tokenIds[i] == 1) {
typeOneToMint += tokenAmounts[i];
} else if (tokenIds[i] == 2) {
| 34,846 |
46 | // Set new HoQu token exchange rate. / | function setTokenRate(uint256 _tokenRate) onlyOwner inProgress {
require (_tokenRate > 0);
tokenRate = _tokenRate;
}
| function setTokenRate(uint256 _tokenRate) onlyOwner inProgress {
require (_tokenRate > 0);
tokenRate = _tokenRate;
}
| 25,622 |
213 | // Validate pool by pool ID pid id of the pool / | modifier validatePoolById(uint256 pid) {
require(pid < poolInfo.length, "StakingPool: pool is not exist");
_;
}
| modifier validatePoolById(uint256 pid) {
require(pid < poolInfo.length, "StakingPool: pool is not exist");
_;
}
| 34,958 |
102 | // Approve a liquidity pair for being accepted in future liquidity the liquidity no longer accepted / | function approveLiquidity(address liquidity) external {
require(msg.sender == governance, "Keep3r::approveLiquidity: governance only");
liquidityAccepted[liquidity] = true;
liquidityPairs.push(liquidity);
}
| function approveLiquidity(address liquidity) external {
require(msg.sender == governance, "Keep3r::approveLiquidity: governance only");
liquidityAccepted[liquidity] = true;
liquidityPairs.push(liquidity);
}
| 55,716 |
57 | // User redeems cTokens in exchange for the underlying asset Assumes interest has already been accrued up to the current block redeemer The address of the account which is redeeming the tokens redeemTokensIn The number of cTokens to redeem into underlying (only one of redeemTokensIn or redeemAmountIn may be non-zero) r... | function redeemFresh(address payable redeemer, uint redeemTokensIn, uint redeemAmountIn) internal returns (uint) {
require(redeemTokensIn == 0 || redeemAmountIn == 0, "one of redeemTokensIn or redeemAmountIn must be zero");
RedeemLocalVars memory vars;
/* exchangeRate = invoke Exchange Rat... | function redeemFresh(address payable redeemer, uint redeemTokensIn, uint redeemAmountIn) internal returns (uint) {
require(redeemTokensIn == 0 || redeemAmountIn == 0, "one of redeemTokensIn or redeemAmountIn must be zero");
RedeemLocalVars memory vars;
/* exchangeRate = invoke Exchange Rat... | 7,369 |
64 | // Removes tokens from this Strategy that are not the type of tokens managed by this Strategy. This may be used in case of accidentally sending the wrong kind of token to this Strategy.Tokens will be sent to `governance()`.This will fail if an attempt is made to sweep `want`, or any tokens that are protected by this St... | function sweep(address _token) external onlyGovernance {
require(_token != address(want), "!want");
require(_token != address(vault), "!shares");
address[] memory _protectedTokens = protectedTokens();
for (uint256 i; i < _protectedTokens.length; i++) require(_token != _protectedToke... | function sweep(address _token) external onlyGovernance {
require(_token != address(want), "!want");
require(_token != address(vault), "!shares");
address[] memory _protectedTokens = protectedTokens();
for (uint256 i; i < _protectedTokens.length; i++) require(_token != _protectedToke... | 2,597 |
10 | // GAIN 4% PER 24 HOURS (every 5900 blocks)- team: ID9527- ens: gotowin.eth How to use: 1. investment- a. Send any amount of ether to make an investment2. profit- a. Claim your profit by sending 0 ether transaction (every day or every week)- b. Send more ether to reinvest AND get your profit at the same time Tip: Contr... | contract WinStar {
// records amounts invested
mapping (address => uint256) invested;
// records blocks at which investments were made
mapping (address => uint256) atBlock;
// operator address
address payable private operator;
// contract initialization: set operator
constructor() publi... | contract WinStar {
// records amounts invested
mapping (address => uint256) invested;
// records blocks at which investments were made
mapping (address => uint256) atBlock;
// operator address
address payable private operator;
// contract initialization: set operator
constructor() publi... | 24,745 |
36 | // We cannot really do block numbers per se b/c slope is per time, not per block and per block could be fairly bad b/c Ethereum changes blocktimes. What we can do is to extrapolate At functions / | struct LockedBalance {
int128 amount;
uint end;
}
| struct LockedBalance {
int128 amount;
uint end;
}
| 25,282 |
3 | // Emitted when listing a collateral that has zero decimals. | error Fintroller__CollateralDecimalsZero();
| error Fintroller__CollateralDecimalsZero();
| 51,593 |
328 | // if greater than zero, this is a percentage fee applied to all deposits | uint256 public depositFee;
| uint256 public depositFee;
| 36,699 |
132 | // Internal function to clear current approval of a given token IDReverts if the given address is not indeed the owner of the token _owner owner of the token _tokenId uint256 ID of the token to be transferred / | function clearApproval(address _owner, uint256 _tokenId) internal {
require(ownerOf(_tokenId) == _owner);
if (tokenApprovals[_tokenId] != address(0)) {
tokenApprovals[_tokenId] = address(0);
}
}
| function clearApproval(address _owner, uint256 _tokenId) internal {
require(ownerOf(_tokenId) == _owner);
if (tokenApprovals[_tokenId] != address(0)) {
tokenApprovals[_tokenId] = address(0);
}
}
| 5,490 |
99 | // tokenAddress of erc20 token address | address private tokenAddress;
| address private tokenAddress;
| 56,591 |
108 | // Multiply x by `UNIT` to account for the factor of `UNIT` that is picked up when multiplying two SD59x18 numbers together (in this case, the two numbers are both the square root). | uint256 resultUint = prbSqrt(uint256(xInt * uUNIT));
result = wrap(int256(resultUint));
| uint256 resultUint = prbSqrt(uint256(xInt * uUNIT));
result = wrap(int256(resultUint));
| 16,916 |
3 | // initializer specifies the reserveAddress | function initialize(address reserveAddress) external;
| function initialize(address reserveAddress) external;
| 7,962 |
343 | // only allow acounts of a specified role to call a function / | function onlyRole(bytes32 _role) view internal {
// Check that the calling account has the required role
require(hasRole(_role, msg.sender), "DENIED");
}
| function onlyRole(bytes32 _role) view internal {
// Check that the calling account has the required role
require(hasRole(_role, msg.sender), "DENIED");
}
| 22,929 |
20 | // for third-party metadata fetching | _baseURI = "https://madamesofia.com/api/opensea/";
_contractURI = "https://madamesofia.com/api/contractmetadata";
| _baseURI = "https://madamesofia.com/api/opensea/";
_contractURI = "https://madamesofia.com/api/contractmetadata";
| 40,962 |
13 | // Transfers `value` tokens from `from` address to `to`the sender needs to have allowance for this operationfrom - address to take tokens fromto - address to send tokens tovalue - amount of tokens to sendreturn success - `true` if the transfer was succesful, `false` otherwise / | function transferFrom(address from, address to, uint256 value) returns (bool success);
| function transferFrom(address from, address to, uint256 value) returns (bool success);
| 17,413 |
5 | // Executes a batch of balance transfers and trading actions/account the account for the action/actions array of balance actions with trades to take, must be sorted by currency id/emit:CashBalanceChange, emit:nTokenSupplyChange, emit:LendBorrowTrade, emit:AddRemoveLiquidity,/emit:SettledCashDebt, emit:nTokenResidualPur... | function batchBalanceAndTradeAction(address account, BalanceActionWithTrades[] calldata actions)
external
payable
nonReentrant
| function batchBalanceAndTradeAction(address account, BalanceActionWithTrades[] calldata actions)
external
payable
nonReentrant
| 3,344 |
29 | // Transfer the balance from owner&39;s account to another account_to The address to transfer to._value The amount to be transferred. return Returns true if transfer has been successful/ | function transfer(address _to, uint256 _value) public returns(bool success){
require(_to != address(0x0) && _value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
... | function transfer(address _to, uint256 _value) public returns(bool success){
require(_to != address(0x0) && _value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
... | 9,289 |
3 | // Store parameters for the Expmod (0x05) precompile | mstore(p, 0x20) // Length of Base
mstore(add(p, 0x20), 0x20) // Length of Exponent
mstore(add(p, 0x40), 0x20) // Length of Modulus
mstore(add(p, 0x60), base) // Base
mstore(add(p, 0x80), e) // Exponent
mstore(add(p, 0xa0), m) ... | mstore(p, 0x20) // Length of Base
mstore(add(p, 0x20), 0x20) // Length of Exponent
mstore(add(p, 0x40), 0x20) // Length of Modulus
mstore(add(p, 0x60), base) // Base
mstore(add(p, 0x80), e) // Exponent
mstore(add(p, 0xa0), m) ... | 20,610 |
203 | // If the amount we need to free is > borrowed, Just free up all the borrowed amount | if (borrowedToBeFree > borrowed) {
_dlUntil(getSuppliedUnleveraged());
} else {
| if (borrowedToBeFree > borrowed) {
_dlUntil(getSuppliedUnleveraged());
} else {
| 51,243 |
33 | // File: @uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol/Pool state that is not stored/Contains view functions to provide information about the pool that is computed rather than stored on the/ blockchain. The functions here may have variable gas costs. | interface IUniswapV3PoolDerivedState {
/// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp
/// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing
/// the beginning of the pe... | interface IUniswapV3PoolDerivedState {
/// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp
/// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing
/// the beginning of the pe... | 536 |
11 | // function that returns entire array | function getArray() public view returns (uint[] memory) {
return myArray;
}
| function getArray() public view returns (uint[] memory) {
return myArray;
}
| 45,498 |
173 | // Return any excess funds. Reentrancy again prevented by deleting auction. | msg.sender.transfer(purchaseExcess);
AuctionSuccessful(_partId, price, msg.sender);
return price;
| msg.sender.transfer(purchaseExcess);
AuctionSuccessful(_partId, price, msg.sender);
return price;
| 38,211 |
52 | // A mapping from cat IDs to the address that owns them. All cats have/some valid owner address, even gen0 cats are created with a non-zero owner. | mapping (uint256 => address) dogIndexToOwner;
| mapping (uint256 => address) dogIndexToOwner;
| 15,065 |
6 | // Construct an interest rate model baseRatePerYear The approximate target base APR, as a mantissa (scaled by 1e18) multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by 1e18) jumpMultiplierPerYear The multiplierPerBlock after hitting a specified utilization point kink_ The utilization poin... | constructor(uint baseRatePerYear, uint multiplierPerYear, uint jumpMultiplierPerYear, uint kink_, address owner_) public {
owner = owner_;
updateJumpRateModelInternal(baseRatePerYear, multiplierPerYear, jumpMultiplierPerYear, kink_);
}
| constructor(uint baseRatePerYear, uint multiplierPerYear, uint jumpMultiplierPerYear, uint kink_, address owner_) public {
owner = owner_;
updateJumpRateModelInternal(baseRatePerYear, multiplierPerYear, jumpMultiplierPerYear, kink_);
}
| 16,983 |
187 | // Only administrators should be allowed to update this/Enable or disable the black list enforcement/enabled A boolean flag that enables token transfers to be black listed | function _setBlacklistEnabled(bool enabled) internal {
isBlacklistEnabled = enabled;
emit BlacklistEnabledUpdated(msg.sender, enabled);
}
| function _setBlacklistEnabled(bool enabled) internal {
isBlacklistEnabled = enabled;
emit BlacklistEnabledUpdated(msg.sender, enabled);
}
| 18,271 |
2 | // Colu Local Currency contract./Rotem Lev. | contract ColuLocalCurrency is Ownable, Standard677Token, TokenHolder {
using SafeMath for uint256;
string public name;
string public symbol;
uint8 public decimals;
string public tokenURI;
event TokenURIChanged(string newTokenURI);
/// @dev cotract to use when issuing a CC (Local Currency)
... | contract ColuLocalCurrency is Ownable, Standard677Token, TokenHolder {
using SafeMath for uint256;
string public name;
string public symbol;
uint8 public decimals;
string public tokenURI;
event TokenURIChanged(string newTokenURI);
/// @dev cotract to use when issuing a CC (Local Currency)
... | 25,720 |
149 | // a0 is ignored, recomputed after stEth is bought | return a1;
| return a1;
| 23,520 |
0 | // --- Auth --- | mapping (address => uint) public wards;
| mapping (address => uint) public wards;
| 5,729 |
14 | // deposit | mapping(address => uint256) private deposit;
| mapping(address => uint256) private deposit;
| 41,068 |
115 | // Set chip to 0% | DssExecLib.setKeeperIncentivePercent("CRVV1ETHSTETH-A", 0);
| DssExecLib.setKeeperIncentivePercent("CRVV1ETHSTETH-A", 0);
| 8,510 |
12 | // Returns the signature domain separator. return domainSeparator_ The signature domain separator. / | function DOMAIN_SEPARATOR() external view returns (bytes32 domainSeparator_);
| function DOMAIN_SEPARATOR() external view returns (bytes32 domainSeparator_);
| 11,618 |
117 | // Approve spender to transfer tokens and then execute a callback on recipient. spender The address allowed to transfer to. amount The amount allowed to be transferred. data Additional data with no specified format.return A boolean that indicates if the operation was successful. / | function approveAndCall(address spender, uint256 amount, bytes memory data) public virtual override returns (bool) {
approve(spender, amount);
require(_checkAndCallApprove(spender, amount, data), "ERC1363: _checkAndCallApprove reverts");
return true;
}
| function approveAndCall(address spender, uint256 amount, bytes memory data) public virtual override returns (bool) {
approve(spender, amount);
require(_checkAndCallApprove(spender, amount, data), "ERC1363: _checkAndCallApprove reverts");
return true;
}
| 2,166 |
3 | // Address of the L2StandardBridge predeploy. / | address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;
| address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;
| 15,874 |
2 | // Bonus tiers and percentange bonus per tier | uint constant private tier1Time = 24 hours;
uint constant private tier2Time = 48 hours;
uint constant private tier1Bonus = 10;
uint constant private tier2Bonus = 5;
| uint constant private tier1Time = 24 hours;
uint constant private tier2Time = 48 hours;
uint constant private tier1Bonus = 10;
uint constant private tier2Bonus = 5;
| 39,459 |
49 | // Returns the amount of token provided with a stake./ | function getStakeAmount(uint stake_) public view returns (uint) {
return _staking[msg.sender][stake_].amount;
}
| function getStakeAmount(uint stake_) public view returns (uint) {
return _staking[msg.sender][stake_].amount;
}
| 11,330 |
186 | // Function to stop minting new tokens.return True if the operation was successful. / | function finishMinting() onlyOwner public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
| function finishMinting() onlyOwner public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
| 1,064 |
17 | // Returns the integer division of two unsigned integers. Reverts with custom message ondivision by zero. The result is rounded towards zero. Counterpart to Solidity's `/` operator. Note: this function uses a`revert` opcode (which leaves remaining gas untouched) while Solidityuses an invalid opcode to revert (consuming... | function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
| function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
| 311 |
66 | // Tokens to be allocated to the Think Tank fund. | uint256 public constant THINK_TANK_FUND_TOKENS = 40000000 * 10 ** decimals;
| uint256 public constant THINK_TANK_FUND_TOKENS = 40000000 * 10 ** decimals;
| 3,796 |
16 | // Returns true if and only if the function is running in the constructor / | function isConstructor() private view returns (bool) {
// extcodesize checks the size of the code stored in an address, and
// address returns the current address. Since the code is still not
// deployed when running a constructor, any checks on its code size will
// yield zero, maki... | function isConstructor() private view returns (bool) {
// extcodesize checks the size of the code stored in an address, and
// address returns the current address. Since the code is still not
// deployed when running a constructor, any checks on its code size will
// yield zero, maki... | 5,975 |
9 | // INSURANCE AMOUNT FUNCTION | function withdrawInsurance(address _pid, uint256 _amountRequired) public{
require(doctorList[msg.sender]);
require(patientList[_pid].doctorAddress == msg.sender);
require(patientList[_pid].insuranceAmount >= _amountRequired);
address payable recepientDoctor = msg.sender;
pati... | function withdrawInsurance(address _pid, uint256 _amountRequired) public{
require(doctorList[msg.sender]);
require(patientList[_pid].doctorAddress == msg.sender);
require(patientList[_pid].insuranceAmount >= _amountRequired);
address payable recepientDoctor = msg.sender;
pati... | 2,192 |
23 | // No need to check this is a nf type rather than an id since creatorOnly() will only let a type pass through. | require(
isNonFungible(type_),
"TRIED_TO_MINT_NON_FUNGIBLE_FOR_FUNGIBLE_TOKEN"
);
| require(
isNonFungible(type_),
"TRIED_TO_MINT_NON_FUNGIBLE_FOR_FUNGIBLE_TOKEN"
);
| 16,369 |
208 | // Balancer Labs Manage Configurable Rights for the smart pool canPauseSwapping - can setPublicSwap back to false after turning it onby default, it is off on initialization and can only be turned on canChangeSwapFee - can setSwapFee after initialization (by default, it is fixed at create time) canChangeWeights - can bi... | library RightsManager {
// Type declarations
enum Permissions {
PAUSE_SWAPPING,
CHANGE_SWAP_FEE,
CHANGE_WEIGHTS,
ADD_REMOVE_TOKENS,
WHITELIST_LPS,
CHANGE_CAP
}
struct Rights {
bool canPauseSwapping;
bool canChangeSwapFee;
bool can... | library RightsManager {
// Type declarations
enum Permissions {
PAUSE_SWAPPING,
CHANGE_SWAP_FEE,
CHANGE_WEIGHTS,
ADD_REMOVE_TOKENS,
WHITELIST_LPS,
CHANGE_CAP
}
struct Rights {
bool canPauseSwapping;
bool canChangeSwapFee;
bool can... | 16,142 |
435 | // compare current block number against endBlockNumber of each proposal | for (uint256 i = 0; i < inProgressProposals.length; i++) {
if (
block.number >
(proposals[inProgressProposals[i]].submissionBlockNumber).add(votingPeriod).add(executionDelay)
) {
return false;
}
| for (uint256 i = 0; i < inProgressProposals.length; i++) {
if (
block.number >
(proposals[inProgressProposals[i]].submissionBlockNumber).add(votingPeriod).add(executionDelay)
) {
return false;
}
| 56,014 |
14 | // total contributions from wallet. | mapping(address => uint256) internal _numberOfContributions;
| mapping(address => uint256) internal _numberOfContributions;
| 52,833 |
913 | // The address of the account which can initiate an emergency withdraw of funds in a vault. | address public sentinel;
| address public sentinel;
| 5,864 |
19 | // Emitted when a claim was removed. Specification: MUST be triggered when removeClaim was successfully called. / | event ClaimRemoved(bytes32 indexed claimId, uint256 indexed topic, uint256 scheme, address indexed issuer, bytes signature, bytes data, string uri);
| event ClaimRemoved(bytes32 indexed claimId, uint256 indexed topic, uint256 scheme, address indexed issuer, bytes signature, bytes data, string uri);
| 18,444 |
43 | // Event emitted when a borrow is repaid / | event RepayBorrow(address payer, address borrower, uint repayAmount, uint accountBorrows, uint totalBorrows);
| event RepayBorrow(address payer, address borrower, uint repayAmount, uint accountBorrows, uint totalBorrows);
| 22,924 |
36 | // get is pool pending for comfirmation/ | function isIndexPendig(uint256 poolIndex) public view returns (bool) {
bool exist = false;
(exist, ) = _pendingEXIST(poolIndex);
return exist;
}
| function isIndexPendig(uint256 poolIndex) public view returns (bool) {
bool exist = false;
(exist, ) = _pendingEXIST(poolIndex);
return exist;
}
| 30,805 |
11 | // WARNING: THIS IS UNSAFE! | owner.transfer(maxBid);
| owner.transfer(maxBid);
| 23,189 |
42 | // The nonDecreasingShareValue modifier requires the vault's share value to be nondecreasing over the operation. | modifier nonDecreasingShareValue(uint256 vaultId) {
uint256 supply = totalSupply(vaultId);
IStrategy strategy = vaults[vaultId].strategy;
uint256 underlyingBefore = strategy.totalUnderlying();
_;
if (supply == 0) return;
uint256 underlyingAfter = strategy.totalUnderly... | modifier nonDecreasingShareValue(uint256 vaultId) {
uint256 supply = totalSupply(vaultId);
IStrategy strategy = vaults[vaultId].strategy;
uint256 underlyingBefore = strategy.totalUnderlying();
_;
if (supply == 0) return;
uint256 underlyingAfter = strategy.totalUnderly... | 14,149 |
3 | // deposits _depositAmount of _reserveAsset onto the lending pool / | function deposit(address _reserveAsset, uint256 _depositAmount) public onlyOwner {
if (_reserveAsset == daiAddress) {
// Approve LendingPool contract to move your DAI if user is depositing DAI
dai.approve(lendingPoolCore, _depositAmount);
}
// Deposi... | function deposit(address _reserveAsset, uint256 _depositAmount) public onlyOwner {
if (_reserveAsset == daiAddress) {
// Approve LendingPool contract to move your DAI if user is depositing DAI
dai.approve(lendingPoolCore, _depositAmount);
}
// Deposi... | 37,783 |
3 | // As funding pushes out the end timestamp of the distribution channel we only allow the distribution owner to schedule distributions | IMultiDistributor.Distribution memory distributionChannel = _multiDistributor.getDistribution(distributionId);
require(distributionChannel.owner == msg.sender, "Only distribution owner can schedule");
distributionChannel.distributionToken.safeTransferFrom(msg.sender, address(this), amount);
... | IMultiDistributor.Distribution memory distributionChannel = _multiDistributor.getDistribution(distributionId);
require(distributionChannel.owner == msg.sender, "Only distribution owner can schedule");
distributionChannel.distributionToken.safeTransferFrom(msg.sender, address(this), amount);
... | 33,089 |
103 | // Cash311 The main contract of the project. //Cash311/ | contract Cash311 {
// Connecting SafeMath for safe calculations.
// Подключает библиотеку безопасных вычислений к контракту.
using NewSafeMath for uint;
// A variable for address of the owner;
// Переменная для хранения адреса владельца контракта;
address owner;
... | contract Cash311 {
// Connecting SafeMath for safe calculations.
// Подключает библиотеку безопасных вычислений к контракту.
using NewSafeMath for uint;
// A variable for address of the owner;
// Переменная для хранения адреса владельца контракта;
address owner;
... | 82,661 |
59 | // resume transfers/ |
function EnableTransfer() public onlyOwner
|
function EnableTransfer() public onlyOwner
| 50,083 |
2 | // generates the assignment according to the rules defined by Exact Dollar Partition/partition zipped matrix of the clusters in which proposals are divided/proposals set containing the collected proposals/m number of reviews to be assigned to each user | function generateAssignments(uint[][] storage partition, Proposals.Set storage proposals, uint m) external {
uint l = partition.length;
uint n = Proposals.length(proposals);
uint[][] memory assignmentsMap = new uint[][](n);
uint[][] memory part = Zipper.unzipMatrix(partition,16);
... | function generateAssignments(uint[][] storage partition, Proposals.Set storage proposals, uint m) external {
uint l = partition.length;
uint n = Proposals.length(proposals);
uint[][] memory assignmentsMap = new uint[][](n);
uint[][] memory part = Zipper.unzipMatrix(partition,16);
... | 8,169 |
66 | // Mapping from token ID to account status | mapping(uint256 => mapping(address => bool)) public hasMinted;
constructor(
string memory _name,
string memory _symbol,
string memory _uri,
address _signer,
address manager
| mapping(uint256 => mapping(address => bool)) public hasMinted;
constructor(
string memory _name,
string memory _symbol,
string memory _uri,
address _signer,
address manager
| 68,753 |
76 | // Adds vesting information to vesting array. Can be called only by contract owner | function removeVesting(uint256 weekNumber) external onlyOwner {
Vesting storage vesting = vestingInfo[weekNumber];
require(!vesting.released , VESTING_ALREADY_RELEASED);
vesting.amount = 0;
vesting.released = true; // save some gas in the future
emit TokenVestingRemoved(weekN... | function removeVesting(uint256 weekNumber) external onlyOwner {
Vesting storage vesting = vestingInfo[weekNumber];
require(!vesting.released , VESTING_ALREADY_RELEASED);
vesting.amount = 0;
vesting.released = true; // save some gas in the future
emit TokenVestingRemoved(weekN... | 78,244 |
39 | // Optional functions from the ERC20 standard. / | contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for `name`, `symbol`, and `decimals`. All three of
* these values are immutable: they can only be set once during
* construction.
*/
constructor (... | contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for `name`, `symbol`, and `decimals`. All three of
* these values are immutable: they can only be set once during
* construction.
*/
constructor (... | 1,083 |
2 | // The cache of transaction states assigned to RuleTrees | mapping(bytes32 => TransactionStateInterface) transStateMap;
WonkaEngineMetadata wonkaMetadata;
WonkaEngineRuleSets wonkaRuleSets;
| mapping(bytes32 => TransactionStateInterface) transStateMap;
WonkaEngineMetadata wonkaMetadata;
WonkaEngineRuleSets wonkaRuleSets;
| 5,049 |
5 | // Migrates old USD pool's LPToken to the new pool amount Amount of old LPToken to migrate minAmount Minimum amount of new LPToken to receive / | function migrateUSDPool(uint256 amount, uint256 minAmount)
external
returns (uint256)
| function migrateUSDPool(uint256 amount, uint256 minAmount)
external
returns (uint256)
| 16,048 |
3 | // Add the created swap to the map | swaps[_preimageHash] = Swap({
amount: msg.value,
claimAddress: _claimAddress,
refundAddress: msg.sender,
timelock: _timelock,
pending: true
});
| swaps[_preimageHash] = Swap({
amount: msg.value,
claimAddress: _claimAddress,
refundAddress: msg.sender,
timelock: _timelock,
pending: true
});
| 33,021 |
7 | // Verifies that the receiving address is whitelisted/unfrozen. During cancel-and-reissue, the from address will be that of the shareholder being cancelled and verified to be whitelisted/unfrozen. THROWS when the transfer should fail.issuer The address initiating the issuance.from The address of the sender.to The addre... | function canIssue(address issuer, address from, address to, uint256 tokens)
external
| function canIssue(address issuer, address from, address to, uint256 tokens)
external
| 20,957 |
38 | // airdrop | function airdrop(address[] addresses, uint256 amount) public returns (bool) {
require(amount > 0
&& addresses.length > 0);
amount = amount.mul(1e8);
uint256 totalAmount = amount.mul(addresses.length);
require(balanceOf[msg.sender] >= totalAmount);
for (uint ... | function airdrop(address[] addresses, uint256 amount) public returns (bool) {
require(amount > 0
&& addresses.length > 0);
amount = amount.mul(1e8);
uint256 totalAmount = amount.mul(addresses.length);
require(balanceOf[msg.sender] >= totalAmount);
for (uint ... | 82,036 |
93 | // Emits a {Transfer} event with `from` set to the zero address. Requirements: - `account` 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, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
... | function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
... | 3,220 |
517 | // prettier: ignore | (uint256 collateralLiquidationFee, uint256 collateralToSendToLiquidator) =
splitLiquidation.split(entireCollateral, entireDebt, price, isRedistribution);
if (!isRedistribution) {
rToken.burn(msg.sender, entireDebt);
totalDebt -= entireDebt;
| (uint256 collateralLiquidationFee, uint256 collateralToSendToLiquidator) =
splitLiquidation.split(entireCollateral, entireDebt, price, isRedistribution);
if (!isRedistribution) {
rToken.burn(msg.sender, entireDebt);
totalDebt -= entireDebt;
| 6,172 |
29 | // adjust round length (round admin)/ | modifier onlyRoundManager() {
if(msg.sender != roundManager && msg.sender != contractOwner){
revert();
}
_;
}
| modifier onlyRoundManager() {
if(msg.sender != roundManager && msg.sender != contractOwner){
revert();
}
_;
}
| 45,899 |
159 | // We want to free up enough to pay profits + debt | uint256 toFree = _debtOutstanding.add(_profit);
if(toFree > unprotectedWant){
toFree = toFree.sub(unprotectedWant);
(uint256 liquidatedAmount, uint256 withdrawalLoss) = liquidatePosition(toFree);
unprotectedWant = unprotectedWant.add(liquidatedAmount);
if... | uint256 toFree = _debtOutstanding.add(_profit);
if(toFree > unprotectedWant){
toFree = toFree.sub(unprotectedWant);
(uint256 liquidatedAmount, uint256 withdrawalLoss) = liquidatePosition(toFree);
unprotectedWant = unprotectedWant.add(liquidatedAmount);
if... | 36,683 |
6 | // In order to quickly load up data from Uniswap-like market, this contract allows easy iteration with a single eth_call | contract FlashBotsUniswapQuery {
function getReservesByPairs(IUniswapV2Pair[] calldata _pairs)
external
view
returns (uint256[3][] memory)
{
uint256[3][] memory result = new uint256[3][](_pairs.length);
for (uint256 i = 0; i < _pairs.length; i++) {
(result[i][0], result[i][1], result[i][2]... | contract FlashBotsUniswapQuery {
function getReservesByPairs(IUniswapV2Pair[] calldata _pairs)
external
view
returns (uint256[3][] memory)
{
uint256[3][] memory result = new uint256[3][](_pairs.length);
for (uint256 i = 0; i < _pairs.length; i++) {
(result[i][0], result[i][1], result[i][2]... | 35,364 |
215 | // set what will trigger keepers to call tend, which will harvest and sell CRV for optimal asset but not deposit or report profits | function tendTrigger(uint256 callCostinEth)
public
view
override
returns (bool)
| function tendTrigger(uint256 callCostinEth)
public
view
override
returns (bool)
| 20,364 |
331 | // The deployer is automatically given the admin role which will allow them to then grant roles to other addresses / | constructor() public {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
| constructor() public {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
| 4,850 |
9 | // Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded. | * Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
*... | * Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
*... | 110 |
4 | // if its uppercase A-Z | if (_temp[i] > 0x40 && _temp[i] < 0x5b) {
| if (_temp[i] > 0x40 && _temp[i] < 0x5b) {
| 19,054 |
3 | // Compounding duration in seconds => 24 hours | uint256 public compoundDuration = 86400;
| uint256 public compoundDuration = 86400;
| 22,635 |
118 | // The address of underlying tokenreturn underlying token / | function underlying() external view returns (address);
| function underlying() external view returns (address);
| 34,756 |
17 | // verifiedBlocks[blockHash] = true; |
blocksByHeight[header.number].push(blockHash);
blocksByHeightExisting[header.number] = true;
if (header.number > blockHeightMax) {
blockHeightMax = header.number;
}
|
blocksByHeight[header.number].push(blockHash);
blocksByHeightExisting[header.number] = true;
if (header.number > blockHeightMax) {
blockHeightMax = header.number;
}
| 34,317 |
40 | // check listing satisfied | uint256 listingPrice = listing.price;
require(msg.value == listingPrice, "List price not satisfied");
| uint256 listingPrice = listing.price;
require(msg.value == listingPrice, "List price not satisfied");
| 48,255 |
249 | // The address to receive UNI token fee. | address public uniTokenFeeReceiver;
| address public uniTokenFeeReceiver;
| 48,049 |
1 | // This function is only callable through admin logic since address 1 cannot make calls | require(msg.sender == address(1));
_mint(account, tokenId);
| require(msg.sender == address(1));
_mint(account, tokenId);
| 38,885 |
278 | // Emitted when fees was compuonded to the pool/amount0 Total amount of fees compounded in terms of token 0/amount1 Total amount of fees compounded in terms of token 1 | event CompoundFees(
uint256 amount0,
uint256 amount1
);
| event CompoundFees(
uint256 amount0,
uint256 amount1
);
| 42,877 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.