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 |
|---|---|---|---|---|
100 | // Harvests SUSHI from `MASTER_CHEF` MCV1 and pool `MASTER_PID` to this MCV2 contract. | function harvestFromMasterChef() public {
MASTER_CHEF.deposit(MASTER_PID, 0);
}
| function harvestFromMasterChef() public {
MASTER_CHEF.deposit(MASTER_PID, 0);
}
| 2,639 |
85 | // check for conformant contract signature | if (sigAddr.code.length != 0 && IERC1271(sigAddr).isValidSignature(
digest, abi.encodePacked(sigs[i].r, sigs[i].s, sigs[i].v)) != 0x1626ba7e
)
revert InvalidSigner();
| if (sigAddr.code.length != 0 && IERC1271(sigAddr).isValidSignature(
digest, abi.encodePacked(sigs[i].r, sigs[i].s, sigs[i].v)) != 0x1626ba7e
)
revert InvalidSigner();
| 10,660 |
74 | // Computes the flows of collateral, quote token between the borrower, lender and kicker. totalCollateral_Total collateral in loan. inflator_ Current pool inflator. varsTakeParams for the take/buckettake / | function _calculateTakeFlowsAndBondChange(
uint256 totalCollateral_,
uint256 inflator_,
uint256 collateralScale_,
TakeLocalVars memory vars
) internal pure returns (
TakeLocalVars memory
| function _calculateTakeFlowsAndBondChange(
uint256 totalCollateral_,
uint256 inflator_,
uint256 collateralScale_,
TakeLocalVars memory vars
) internal pure returns (
TakeLocalVars memory
| 40,196 |
380 | // Tells whether this contract implements the interface defined by `interfaceId`. /See the corresponding https:eips.ethereum.org/EIPS/eip-165how-interfaces-are-identified[EIP section]/to learn more about how these ids are created. | function supportsInterface(bytes4) external view returns (bool);
| function supportsInterface(bytes4) external view returns (bool);
| 19,038 |
45 | // read a packId in the category list at a specific index _category listing category _index indexreturn packId on index / | function getCategoryPack(bytes4 _category, uint256 _index)
| function getCategoryPack(bytes4 _category, uint256 _index)
| 4,644 |
6 | // Transfers ETH to the recipient address/Fails with `STE`/to The destination of the transfer/value The value to be transferred | function safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
require(success, 'STE');
}
| function safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
require(success, 'STE');
}
| 17,347 |
22 | // Sends an order to withdraw all Convex LP tokens from the BaseRewardPool/ and immediately unwrap them into Curve LP tokens/claim Whether to claim rewards while withdrawing/ The input token does need to be disabled, because this spends the entire balance | function withdrawAllAndUnwrap(bool claim) external override {
_withdrawAndUnwrap(msg.data, claim, true); // F: [ACVX1_P_12]
}
| function withdrawAllAndUnwrap(bool claim) external override {
_withdrawAndUnwrap(msg.data, claim, true); // F: [ACVX1_P_12]
}
| 10,066 |
4 | // The amount of currency available to be lended. token The loan currency.return The amount of `token` that can be borrowed. / | function maxFlashLoan(address token) external view returns (uint256);
| function maxFlashLoan(address token) external view returns (uint256);
| 15,296 |
1 | // Sets allowance to specified amount, only owner may call it / | function setAllowance(address _who, uint _allowance) public onlyOwner {
emit AllowanceChanged(_who, msg.sender, allowance[_who], _allowance);
allowance[_who] = _allowance;
}
| function setAllowance(address _who, uint _allowance) public onlyOwner {
emit AllowanceChanged(_who, msg.sender, allowance[_who], _allowance);
allowance[_who] = _allowance;
}
| 53,631 |
17 | // check if token was minted from an original collection or minted by this bridge | if (mintedDeposits[collectionAddress][tokenId]) {
| if (mintedDeposits[collectionAddress][tokenId]) {
| 63,596 |
0 | // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); | bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
mapping(address => uint256) public nonces;
function initialize(
string memory _name,
string memory _symbol,
uint256 _initialSupply,
address _lzEndpoint
| bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
mapping(address => uint256) public nonces;
function initialize(
string memory _name,
string memory _symbol,
uint256 _initialSupply,
address _lzEndpoint
| 27,164 |
4 | // save to owner2Patents | bytes32[] storage pts = owner2Patents[caller];
bytes32 patentID = patent.patentID;
if (search(pts, patentID) < 0){
pts.push(patentID);
}
| bytes32[] storage pts = owner2Patents[caller];
bytes32 patentID = patent.patentID;
if (search(pts, patentID) < 0){
pts.push(patentID);
}
| 23,300 |
31 | // Emits a {Transfer} event./ | function transfer(address recipient, uint amount) external returns (bool);
| function transfer(address recipient, uint amount) external returns (bool);
| 28,405 |
245 | // If added staking: / | if (_addition) {
| if (_addition) {
| 10,650 |
104 | // Abacus Management /// | function setLinearDecrease(address _calc, uint256 _duration) public {
setValue(_calc, "tau", _duration);
}
| function setLinearDecrease(address _calc, uint256 _duration) public {
setValue(_calc, "tau", _duration);
}
| 2,356 |
119 | // Allows to swap ADEL token which belongs to vested unclaimed rewards merkleRootIndex Index of a merkle root to be used for calculations adelAllowedToSwap Maximum ADEL allowed for a user to swap merkleProofs Array of consiquent merkle hashes / | function swapFromRewardAdel(
uint256 merkleRootIndex,
uint256 adelAllowedToSwap,
bytes32[] memory merkleProofs
)
external nonReentrant swapEnabled
| function swapFromRewardAdel(
uint256 merkleRootIndex,
uint256 adelAllowedToSwap,
bytes32[] memory merkleProofs
)
external nonReentrant swapEnabled
| 16,460 |
5 | // logout from dapp, all pages are invalid / | function logout() external override {
users[msg.sender].isUserLoggedIn = false;
}
| function logout() external override {
users[msg.sender].isUserLoggedIn = false;
}
| 34,118 |
206 | // Emits an Approval Event. // Emits a Transfer and an Approval Event. / Kill the grant by updating wasRevoked and isActive. | _tokenGrants[grantHolder].wasRevoked = true;
_tokenGrants[grantHolder].isActive = false;
emit GrantRevoked(grantHolder, onDay);
| _tokenGrants[grantHolder].wasRevoked = true;
_tokenGrants[grantHolder].isActive = false;
emit GrantRevoked(grantHolder, onDay);
| 35,432 |
32 | // Get material certificate instances_materialTokenId Material token idreturn Material certificate instances / | function getMaterialCertificatesInstanceIds(uint256 _materialTokenId)
public
view
returns (uint256[] memory)
| function getMaterialCertificatesInstanceIds(uint256 _materialTokenId)
public
view
returns (uint256[] memory)
| 44,800 |
13 | // Construct crowd proposalauthor_ The crowd proposal authortargets_ The ordered list of target addresses for calls to be madevalues_ The ordered list of values (i.e. msg.value) to be passed to the calls to be madesignatures_ The ordered list of function signatures to be calledcalldatas_ The ordered list of calldata to... | constructor(address payable author_,
address[] memory targets_,
uint[] memory values_,
string[] memory signatures_,
bytes[] memory calldatas_,
string memory description_,
address comp_,
| constructor(address payable author_,
address[] memory targets_,
uint[] memory values_,
string[] memory signatures_,
bytes[] memory calldatas_,
string memory description_,
address comp_,
| 39,386 |
283 | // Reduce the totalStaked count | totalStaked = totalStaked - numTokens;
| totalStaked = totalStaked - numTokens;
| 60,729 |
10 | // not used other | Auction,
Raffle,
DutchAuction
| Auction,
Raffle,
DutchAuction
| 22,714 |
22 | // we output the result - how much was added to the Limbo | return maxCount;
| return maxCount;
| 28,974 |
4 | // send `_value` token to `_to` from `_from` on the condition it is approved by `_from`/_from The address of the sender/_to The address of the recipient/_value The amount of token to be transferred/ return Whether the transfer was successful or not | function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
| function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
| 8,697 |
235 | // Collateral factor within the buffer | uint256 safeColFactor = colFactor.sub(
colFactorLeverageBuffer.mul(1e18).div(colFactorLeverageBufferMax)
);
return safeColFactor;
| uint256 safeColFactor = colFactor.sub(
colFactorLeverageBuffer.mul(1e18).div(colFactorLeverageBufferMax)
);
return safeColFactor;
| 33,174 |
8 | // See https:github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/ERC20Votes.solL99 We run a binary search to look for the earliest checkpoint taken after `blockNumber`. During the loop, the index of the wanted checkpoint remains in the range [low-1, high). With each iteration, ei... | uint256 low = 0;
uint256 high = len;
Param[] storage ckpts = _checkpoints[name];
while (low < high) {
uint256 mid = average(low, high);
if (ckpts[mid].activation > blockNumber) {
high = mid;
} else {
| uint256 low = 0;
uint256 high = len;
Param[] storage ckpts = _checkpoints[name];
while (low < high) {
uint256 mid = average(low, high);
if (ckpts[mid].activation > blockNumber) {
high = mid;
} else {
| 20,249 |
145 | // add the same LP token only once | mapping(address => bool) lpExists;
event RewardAdded(uint256 reward);
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event RewardPaid(address indexed user, uint256 reward);
event EmergencyWithd... | mapping(address => bool) lpExists;
event RewardAdded(uint256 reward);
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event RewardPaid(address indexed user, uint256 reward);
event EmergencyWithd... | 80,710 |
27 | // Set or reaffirm the approved address for an NFTThe zero address indicates there is no approved address.Throws unless `msg.sender` is the current NFT owner, or an authorizedoperator of the current owner.approved_ The new approved NFT controllertokenId_ The NFT to approve | function approve(address approved_, uint tokenId_) external;
| function approve(address approved_, uint tokenId_) external;
| 26,550 |
18 | // / | function packFundingCycleGlobalMetadata(JBGlobalFundingCycleMetadata memory _metadata)
internal
pure
returns (uint256 packed)
| function packFundingCycleGlobalMetadata(JBGlobalFundingCycleMetadata memory _metadata)
internal
pure
returns (uint256 packed)
| 11,688 |
6 | // For some reason the Sovryn swap network tends to return a bit less than the expected rate. | minReturn = sovrynSwapNetwork.rateByPath(path, sourceTokenAmountUsed).mul(995).div(1000);
| minReturn = sovrynSwapNetwork.rateByPath(path, sourceTokenAmountUsed).mul(995).div(1000);
| 38,606 |
57 | // This function opens the contract up for token withdrawals. It can only be called by the owner during stage 3.The owner specifies the address of an ERC20 token contract that this contract has a balance in, and optionally a bool to prevent this token from being the default withdrawal (in the event of an airdrop, for e... | function enableTokenWithdrawals (address tokenAddr, bool notDefault) public onlyOwner noReentrancy {
require (contractStage == 3);
if (notDefault) {
require (activeToken != 0x00);
} else {
activeToken = tokenAddr;
}
var d = distributionMap[tokenAddr];
if (d.pct.length==0) d.tok... | function enableTokenWithdrawals (address tokenAddr, bool notDefault) public onlyOwner noReentrancy {
require (contractStage == 3);
if (notDefault) {
require (activeToken != 0x00);
} else {
activeToken = tokenAddr;
}
var d = distributionMap[tokenAddr];
if (d.pct.length==0) d.tok... | 74,901 |
3 | // Multiplies two signed integers, reverts on overflow./ | function mul(int256 a, int256 b) internal pure returns (int256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == ... | function mul(int256 a, int256 b) internal pure returns (int256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == ... | 38,074 |
220 | // ========== Modifier ========== / | modifier marketOpen() {
require(isMarketOpen, 'Market not open');
_;
}
| modifier marketOpen() {
require(isMarketOpen, 'Market not open');
_;
}
| 49,178 |
6 | // handles minting of the tokens specific to the IntelProperty file's ID supplied.'intelPropertyTokenLimit' determines theof tokens and this is divided by the of rightsHolders assigned to the IntelProperty file. Any remainder (beyond the evenly splitof tokens between rightsHolders) tokens will be assigned to the firstr... | function mintTokensForIntelPropertyFile(uint _nftID) internal {
(IntelPropertyFile storage sdFile) = (intelPropertyFile[_nftID]);
/** @dev we need to account for decimals when dividing tokens between rightsHolders.
* IMPORTANT: the first rightsHolder listed will receive the extra tokens after division */
... | function mintTokensForIntelPropertyFile(uint _nftID) internal {
(IntelPropertyFile storage sdFile) = (intelPropertyFile[_nftID]);
/** @dev we need to account for decimals when dividing tokens between rightsHolders.
* IMPORTANT: the first rightsHolder listed will receive the extra tokens after division */
... | 36,486 |
358 | // can `setPerformanceFee` on a vault | bytes32 public constant fee_setter_role = keccak256('fee_setter_role');
address public feeTo;
address public emergencyReturn;
uint24 public constant PERFORMANCE_FEE_PRECISION = 1e6;
event FeeToChanged(address indexed previousFeeTo, address indexed newFeeTo);
| bytes32 public constant fee_setter_role = keccak256('fee_setter_role');
address public feeTo;
address public emergencyReturn;
uint24 public constant PERFORMANCE_FEE_PRECISION = 1e6;
event FeeToChanged(address indexed previousFeeTo, address indexed newFeeTo);
| 50,362 |
25 | // EMG - This is a helper function that can be used for such purposes as testing modifiers | function setTestingMode
(
)
public
view
requireIsOperational()
| function setTestingMode
(
)
public
view
requireIsOperational()
| 41,733 |
11 | // Transfer from an address to another if allowed from The origin of the tokens to The destination of the tokens amount The amount of tokens to move / | function transferFrom(address from, address to, uint256 amount) external returns (bool success) {
require(allowance[from][msg.sender]>= amount, "You aren't allowed to spend this amount");
require(balanceOf[from]>=amount, "Insufficient balance");
allowance[from][msg.sender] -= amount... | function transferFrom(address from, address to, uint256 amount) external returns (bool success) {
require(allowance[from][msg.sender]>= amount, "You aren't allowed to spend this amount");
require(balanceOf[from]>=amount, "Insufficient balance");
allowance[from][msg.sender] -= amount... | 3,909 |
640 | // Pool state that can change/These methods compose the pool's state, and can change with any frequency including multiple times/ per transaction | interface IUniswapV3PoolState {
/// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas
/// when accessed externally.
/// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value
/// tick The current tick of the pool,... | interface IUniswapV3PoolState {
/// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas
/// when accessed externally.
/// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value
/// tick The current tick of the pool,... | 4,144 |
3 | // deployment checks for non-pool2 | require(_swapPairs.token0 > address(0), "Swap pair 0 is necessary but not supplied");
require(_swapPairs.token1 > address(0), "Swap pair 1 is necessary but not supplied");
swapPairToken0 = _swapPairs.token0;
swapPairToken1 = _swapPairs.token1;
require(
... | require(_swapPairs.token0 > address(0), "Swap pair 0 is necessary but not supplied");
require(_swapPairs.token1 > address(0), "Swap pair 1 is necessary but not supplied");
swapPairToken0 = _swapPairs.token0;
swapPairToken1 = _swapPairs.token1;
require(
... | 23,794 |
186 | // accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted admin fee withdrawal failed. | return
fail(
Error(error),
FailureInfo.WITHDRAW_ADMIN_FEES_ACCRUE_INTEREST_FAILED
);
| return
fail(
Error(error),
FailureInfo.WITHDRAW_ADMIN_FEES_ACCRUE_INTEREST_FAILED
);
| 18,314 |
161 | // Adds the provided identifier as a supported identifier. Price requests using this identifier will succeed after this call. identifier bytes32 encoding of the string identifier. Eg: BTC/USD. / | function addSupportedIdentifier(bytes32 identifier) external;
| function addSupportedIdentifier(bytes32 identifier) external;
| 9,792 |
2 | // Network: Mumbai TestnetOracle: 0xAcBfAF35Aa28Cb45beC5f21dad6478fA445fFcC5Job ID: e381e964377d4f978d534fa0973e4d73Fee: 0.001 LINK / | constructor() public {
setChainlinkToken(0x326C977E6efc84E512bB9C30f76E30c160eD06FB);
oracle = 0xAcBfAF35Aa28Cb45beC5f21dad6478fA445fFcC5;
jobId = "e381e964377d4f978d534fa0973e4d73";
fee = 0.001 * 10 ** 18; // 0.001 LINK
}
| constructor() public {
setChainlinkToken(0x326C977E6efc84E512bB9C30f76E30c160eD06FB);
oracle = 0xAcBfAF35Aa28Cb45beC5f21dad6478fA445fFcC5;
jobId = "e381e964377d4f978d534fa0973e4d73";
fee = 0.001 * 10 ** 18; // 0.001 LINK
}
| 4,870 |
3 | // allFunders.push(FunderName(address(msg.sender))); | addressToAmountFunded[msg.sender] += msg.value;
funders.push(msg.sender);
| addressToAmountFunded[msg.sender] += msg.value;
funders.push(msg.sender);
| 27,612 |
21 | // = endingTokensPerEth(1 + shareOfBonusBONUS) | return wmul(endingTokensPerEth, add(1 ether, actualBonus));
| return wmul(endingTokensPerEth, add(1 ether, actualBonus));
| 16,438 |
17 | // No need for lower level authorization to linger | if (_authorization == I_AM_ROOT && !authorized[_address][I_AM_ROOT])
authorized[_address][STAFF_MEMBER] = false;
authorized[_address][_authorization] = !authorized[_address][_authorization];
| if (_authorization == I_AM_ROOT && !authorized[_address][I_AM_ROOT])
authorized[_address][STAFF_MEMBER] = false;
authorized[_address][_authorization] = !authorized[_address][_authorization];
| 26,692 |
15 | // Used to track registered contracts on Seraph/We don't use a mapping based on client id since only one contract address can cohexist/ and two clients can not have the same address./ 1 to 1: One address has one Contract struct. | mapping(address => Tracking) internal _contractTracking;
| mapping(address => Tracking) internal _contractTracking;
| 34,930 |
3 | // Data Encryption | mapping(uint256 => bytes32) public patientDataHashes;
uint256[] public allPatientIDs; // Array to store all registered patient IDs
mapping(address => bool) public authorizedViewers; // Mapping to track authorized addresses
mapping(address => uint256[]) public walletToPatientIDs; // Mapping to track wal... | mapping(uint256 => bytes32) public patientDataHashes;
uint256[] public allPatientIDs; // Array to store all registered patient IDs
mapping(address => bool) public authorizedViewers; // Mapping to track authorized addresses
mapping(address => uint256[]) public walletToPatientIDs; // Mapping to track wal... | 9,648 |
27 | // owner totalBalance | uint256 public ownerTotalBalance;
| uint256 public ownerTotalBalance;
| 63,781 |
147 | // Wallet specific lock storage | mapping (address => Lock) internal locks;
| mapping (address => Lock) internal locks;
| 29,312 |
1 | // Set to true when a reward token is listed / | mapping(address => bool) private _rewardAssigned;
| mapping(address => bool) private _rewardAssigned;
| 25,071 |
47 | // Allows either the huddlers or the owners to call the provisioning to UniSwap / | function provisionLiquidity() public {
_provisionLiquidity();
}
| function provisionLiquidity() public {
_provisionLiquidity();
}
| 25,498 |
160 | // halving period time | uint256 public constant DURATION = 2 weeks;
uint256 public constant HALVING_DURATION = 8 weeks;
| uint256 public constant DURATION = 2 weeks;
uint256 public constant HALVING_DURATION = 8 weeks;
| 18,792 |
7 | // A pointer to the next token to be minted, zero indexed | uint256 public tokenIdPointer = 0;
| uint256 public tokenIdPointer = 0;
| 32,221 |
0 | // ================================= | modifier onlyOwner(){
require(msg.sender == dev);
_;
}
| modifier onlyOwner(){
require(msg.sender == dev);
_;
}
| 25,057 |
3,542 | // 1772 | entry "goosebumped" : ENG_ADJECTIVE
| entry "goosebumped" : ENG_ADJECTIVE
| 18,384 |
91 | // Provider interface for Revest FNFTs Address locks MUST be non-upgradeable to be considered for trusted status Revest / | interface IAddressLock is IRegistryProvider, IERC165{
/// Creates a lock to the specified lockID
/// @param fnftId the fnftId to map this lock to. Not recommended for typical locks, as it will break on splitting
/// @param lockId the lockId to map this lock to. Recommended uint for storing references to lo... | interface IAddressLock is IRegistryProvider, IERC165{
/// Creates a lock to the specified lockID
/// @param fnftId the fnftId to map this lock to. Not recommended for typical locks, as it will break on splitting
/// @param lockId the lockId to map this lock to. Recommended uint for storing references to lo... | 65,241 |
5,994 | // 2999 | entry "fair-handedly" : ENG_ADVERB
| entry "fair-handedly" : ENG_ADVERB
| 23,835 |
372 | // returns the pool migrator contract / | function poolMigrator() external view returns (IPoolMigrator);
| function poolMigrator() external view returns (IPoolMigrator);
| 66,148 |
13 | // Indicates that a challenge has been registered against `channelId`. channelId Unique identifier for a state channel. finalizesAt The unix timestamp when `channelId` finalized. / | event Concluded(bytes32 indexed channelId, uint48 finalizesAt);
| event Concluded(bytes32 indexed channelId, uint48 finalizesAt);
| 14,847 |
3 | // ERC 20 / | function balanceOf(address _owner) public constant returns (uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) ... | function balanceOf(address _owner) public constant returns (uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) ... | 38,074 |
30 | // Allocate space for the buffer data | buf.capacity = capacity;
assembly {
let ptr := mload(0x40)
mstore(buf, ptr)
mstore(ptr, 0)
mstore(0x40, add(ptr, capacity))
}
| buf.capacity = capacity;
assembly {
let ptr := mload(0x40)
mstore(buf, ptr)
mstore(ptr, 0)
mstore(0x40, add(ptr, capacity))
}
| 5,009 |
481 | // Apply the fee | fpi_out -= (fpi_out * mint_fee()) / FEE_PRECISION;
| fpi_out -= (fpi_out * mint_fee()) / FEE_PRECISION;
| 37,344 |
56 | // unstaking fee 0.50 percent | uint public constant unstakingFeeRate = 50;
| uint public constant unstakingFeeRate = 50;
| 38,074 |
3 | // The Receiver class / | function Lamp() {
Light memory light;
light.state != light.state;
}
| function Lamp() {
Light memory light;
light.state != light.state;
}
| 25,911 |
41 | // set the celebrity's agent to the current player | celeb.agent = newAgent;
| celeb.agent = newAgent;
| 6,358 |
15 | // check owner self staking | require(msg.sender != project.owner, "project_owner");
| require(msg.sender != project.owner, "project_owner");
| 18,245 |
465 | // Internal fns |
function _newVote(bytes _executionScript, string _metadata, bool _castVote, bool _executesIfDecided)
internal
returns (uint256 voteId)
|
function _newVote(bytes _executionScript, string _metadata, bool _castVote, bool _executesIfDecided)
internal
returns (uint256 voteId)
| 26,692 |
134 | // As opposed to {transferFrom}, this imposes no restrictions on msg.sender. Requirements: - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. Emits a {Transfer} event./ | function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId... | function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId... | 56,489 |
115 | // Returns the token owner. / | function getOwner() public view override returns (address) {
return owner();
}
| function getOwner() public view override returns (address) {
return owner();
}
| 2,639 |
16 | // Public token numbering starts after UTS_GIFT. And we don't want our tokens to start at 0 but at 1./ | uint256 tokenId = UTS_GIFT + totalPublicSupply + 1;
totalPublicSupply += 1;
_safeMint(msg.sender, tokenId);
| uint256 tokenId = UTS_GIFT + totalPublicSupply + 1;
totalPublicSupply += 1;
_safeMint(msg.sender, tokenId);
| 31,390 |
384 | // give a higher percent for refering a new user | uint256 percent = (balanceOf(tx.origin) == 0) ? referalNewPercent : referalPercent;
| uint256 percent = (balanceOf(tx.origin) == 0) ? referalNewPercent : referalPercent;
| 41,883 |
56 | // The extra value is transferred to the sender itself | if(need < msg.value) {
payable(msg.sender).transfer((msg.value).safeSub(need));
}
| if(need < msg.value) {
payable(msg.sender).transfer((msg.value).safeSub(need));
}
| 1,780 |
54 | // Minter interface / | contract IMinter {
// Events
event SetCurrentRewardTokens(uint256 currentMintableTokens, uint256 currentInflation);
// External functions
function createReward(uint256 _fracNum, uint256 _fracDenom) external returns (uint256);
function trustedTransferTokens(address _to, uint256 _amount) external;
... | contract IMinter {
// Events
event SetCurrentRewardTokens(uint256 currentMintableTokens, uint256 currentInflation);
// External functions
function createReward(uint256 _fracNum, uint256 _fracDenom) external returns (uint256);
function trustedTransferTokens(address _to, uint256 _amount) external;
... | 35,738 |
105 | // change liquidity fee for buying token | _liquidityFee = _liquidityFeeWhenBuy;
| _liquidityFee = _liquidityFeeWhenBuy;
| 15,699 |
11 | // make task completed taskID is the ID of task that allows us to understand which task we are going to complete. The task is limited to be performed only once per day, which is enforced by the 'dailyLimit'.The condition of whether the task has been completed or not can be checked using the 'dailyTaskLimit' mapping.Aft... | function completeTask(uint256 taskID) external {
require(
dailyTaskLimit[msg.sender] < dailyLimit,
"You have completed your task today."
);
dailyTasks[taskID] = true;
dailyTaskLimit[msg.sender]++;
countTaskCompleted[taskID]++;
emit TaskComplete... | function completeTask(uint256 taskID) external {
require(
dailyTaskLimit[msg.sender] < dailyLimit,
"You have completed your task today."
);
dailyTasks[taskID] = true;
dailyTaskLimit[msg.sender]++;
countTaskCompleted[taskID]++;
emit TaskComplete... | 26,073 |
20 | // The date when assets unlock | uint256 public constant unlockDate = 1551330000;
bool public redeemed = false;
bool public executed = false;
bool public redeemable = false;
address public thirdParty;
| uint256 public constant unlockDate = 1551330000;
bool public redeemed = false;
bool public executed = false;
bool public redeemable = false;
address public thirdParty;
| 2,481 |
23 | // Dropping Tokens to owners from previous contract / | function airdropTokens () public onlyOwner {
uint aazSupply = _aaz.totalSupply( ) - 2;
uint airdropCount = 0;
for ( uint i = 0; i < aazSupply; i ++ ) {
address recipient = _aaz.ownerOf( i );
// Airdrop token due.
_mint(recipient, getAntToBeClaimed());
claimedAntzPerWallet[recipient]++;
//... | function airdropTokens () public onlyOwner {
uint aazSupply = _aaz.totalSupply( ) - 2;
uint airdropCount = 0;
for ( uint i = 0; i < aazSupply; i ++ ) {
address recipient = _aaz.ownerOf( i );
// Airdrop token due.
_mint(recipient, getAntToBeClaimed());
claimedAntzPerWallet[recipient]++;
//... | 35,961 |
12 | // move pointer forward, ahead of length | rlpBytes := add(rlpBytes, 0x20)
| rlpBytes := add(rlpBytes, 0x20)
| 67,485 |
218 | // no need to reset cooldown on successful proposal | return;
| return;
| 46,215 |
89 | // |/ A distinct Uniform Resource Identifier (URI) for a given token. URIs are defined in RFC 3986. URIs are assumed to be deterministically generated based on token ID Token IDs are assumed to be represented in their hex format in URIsreturn URI string / | function uri(uint256 _id) public view returns (string memory) {
return
string(abi.encodePacked(baseMetadataURI, _uint2str(_id), ".json"));
}
| function uri(uint256 _id) public view returns (string memory) {
return
string(abi.encodePacked(baseMetadataURI, _uint2str(_id), ".json"));
}
| 1,865 |
98 | // Shareholders array | address[] private shareholders;
| address[] private shareholders;
| 19,420 |
1 | // required owner of the contract | modifier isOwner() {
require(msg.sender == _owner, "Not contract owner");
_;
}
| modifier isOwner() {
require(msg.sender == _owner, "Not contract owner");
_;
}
| 14,302 |
239 | // mint if below total cliffs | if (cliff < totalCliffs) {
| if (cliff < totalCliffs) {
| 17,403 |
18 | // Minters. | mapping (address => bool) public _minters;
| mapping (address => bool) public _minters;
| 27,708 |
6 | // Get robotId for a specific tokenId. / | function getRobotId(uint256 _tokenId) external view returns (uint8) {
return robotIds[_tokenId];
}
| function getRobotId(uint256 _tokenId) external view returns (uint8) {
return robotIds[_tokenId];
}
| 21,371 |
31 | // Adds liquidity & swaps back. functionality:- performs swaps to add liquidity & collect taxes / | function swapTokensForEth(uint256 tokenAmount) private {
// generate the uniswap pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = UNISWAP_ROUTER.WETH();
// make the swap
UNISWAP_ROUTER.swapExactTokensForETHSuppor... | function swapTokensForEth(uint256 tokenAmount) private {
// generate the uniswap pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = UNISWAP_ROUTER.WETH();
// make the swap
UNISWAP_ROUTER.swapExactTokensForETHSuppor... | 23,588 |
67 | // call this function to add your angel/pet/accessory to team 1. | checkTeamToAdd(angelId,petId,accessoryId);
IBattleboardData battleboardData = IBattleboardData(battleboardDataContract);
| checkTeamToAdd(angelId,petId,accessoryId);
IBattleboardData battleboardData = IBattleboardData(battleboardDataContract);
| 14,454 |
227 | // Searches a sorted `array` and returns the first index that containsa value greater or equal to `element`. If no such index exists (i.e. allvalues in the array are strictly less than `element`), the array length isreturned. Time complexity O(log n). `array` is expected to be sorted in ascending order, and to contain ... | function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
if (array.length == 0) {
return 0;
}
uint256 low = 0;
uint256 high = array.length;
while (low < high) {
uint256 mid = Math.average(low, high);
... | function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
if (array.length == 0) {
return 0;
}
uint256 low = 0;
uint256 high = array.length;
while (low < high) {
uint256 mid = Math.average(low, high);
... | 2,946 |
2 | // Mapping of cross-blockchain transaction id to time-out block time stamp. | mapping (uint256=> uint256) public timeout;
| mapping (uint256=> uint256) public timeout;
| 33,573 |
146 | // get link to a user data structure, we will write into it later | User storage user = users[_staker];
| User storage user = users[_staker];
| 11,186 |
38 | // Start a challenge between staker1 and staker2. Staker1 will defend the correctness of node1, and staker2 will challenge it. | address challengeAddress = challengeFactory.createChallenge(
address(this),
executionHashes[0],
maxMessageCounts[0],
stakers[0],
stakers[1],
commonEndTime.sub(proposedTimes[0]),
commonEndTime.sub(proposedTimes[1]),
s... | address challengeAddress = challengeFactory.createChallenge(
address(this),
executionHashes[0],
maxMessageCounts[0],
stakers[0],
stakers[1],
commonEndTime.sub(proposedTimes[0]),
commonEndTime.sub(proposedTimes[1]),
s... | 42,766 |
96 | // Caller must prove that they own the private key for the allocationID address The proof is an Ethereum signed message of KECCAK256(indexerAddress,allocationID) | bytes32 messageHash = keccak256(abi.encodePacked(_indexer, _allocationID));
bytes32 digest = ECDSA.toEthSignedMessageHash(messageHash);
require(ECDSA.recover(digest, _proof) == _allocationID, "!proof");
require(
__stakes[_indexer].tokensSecureStake() >= __minimumIndexerStake... | bytes32 messageHash = keccak256(abi.encodePacked(_indexer, _allocationID));
bytes32 digest = ECDSA.toEthSignedMessageHash(messageHash);
require(ECDSA.recover(digest, _proof) == _allocationID, "!proof");
require(
__stakes[_indexer].tokensSecureStake() >= __minimumIndexerStake... | 25,608 |
384 | // 193 | entry "prelocated" : ENG_ADJECTIVE
| entry "prelocated" : ENG_ADJECTIVE
| 16,805 |
23 | // pools will include the wrapepd SMT | address xSMT = xTokenWrapper.tokenToXToken(smt);
address xETH = xTokenWrapper.tokenToXToken(WETH_ADDRESS);
| address xSMT = xTokenWrapper.tokenToXToken(smt);
address xETH = xTokenWrapper.tokenToXToken(WETH_ADDRESS);
| 13,029 |
79 | // Wrappers over Solidity's arithmetic operations. NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler now has built in overflow checking./ | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
... | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
... | 24,505 |
29 | // _coinBIndex the index of _coinB in _coinA's array of unique coin's | function _unregisterCoinPair(address _coinA, address _coinB, uint256 _coinBIndex) internal {
require(_coinInfoMap[_coinA].swapFor[_coinBIndex] == _coinB);
// retrieve the last currently occupied index in coinA's array
uint256 coinAArrLastIdx = _coinInfoMap[_coinA].swapFor.length - 1;
... | function _unregisterCoinPair(address _coinA, address _coinB, uint256 _coinBIndex) internal {
require(_coinInfoMap[_coinA].swapFor[_coinBIndex] == _coinB);
// retrieve the last currently occupied index in coinA's array
uint256 coinAArrLastIdx = _coinInfoMap[_coinA].swapFor.length - 1;
... | 18,494 |
144 | // total token balance of an account, including unlocked but not withdrawn tokens | function lockedBalanceOf(address _user)
external
view
returns (uint256 amount);
| function lockedBalanceOf(address _user)
external
view
returns (uint256 amount);
| 80,524 |
9 | // NOLINTNEXTLINE: reentrancy-benign. | cairoVerifier.verifyProofExternal(proofParams, proof, (uint256[])(cairoPublicInput));
registerGpsFacts(taskMetadata, publicMemoryPages, cairoAuxInput[OFFSET_OUTPUT_BEGIN_ADDR]);
| cairoVerifier.verifyProofExternal(proofParams, proof, (uint256[])(cairoPublicInput));
registerGpsFacts(taskMetadata, publicMemoryPages, cairoAuxInput[OFFSET_OUTPUT_BEGIN_ADDR]);
| 75,916 |
205 | // Calculate taxes | uint256 marketingShare = ((amount * taxForMarketing) / 100);
uint256 liquidityShare = ((amount * taxForLiquidity) / 100);
uint256 transferAmount = amount - (marketingShare + liquidityShare);
| uint256 marketingShare = ((amount * taxForMarketing) / 100);
uint256 liquidityShare = ((amount * taxForLiquidity) / 100);
uint256 transferAmount = amount - (marketingShare + liquidityShare);
| 36,729 |
200 | // get input amount. returns how many base asset you will get with the input quote amount. _dir ADD_TO_AMM for long, REMOVE_FROM_AMM for short. _quoteAssetAmount quote asset amountreturn base asset amount / | function getInputPrice(Dir _dir, Decimal.decimal memory _quoteAssetAmount)
public
view
override
returns (Decimal.decimal memory)
| function getInputPrice(Dir _dir, Decimal.decimal memory _quoteAssetAmount)
public
view
override
returns (Decimal.decimal memory)
| 6,493 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.