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 be passed to each calldescription_ The block at which voting begins: holders must delegate their votes prior to this blockcomp_ `COMP` token contract addressgovernor_ Compound protocol `GovernorAlpha` contract address/
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, either `low` or `high` is moved towards the middle of the range to maintain the invariant. - If the middle checkpoint is after `blockNumber`, we look in [low, mid) - If the middle checkpoint is before or equal to `blockNumber`, we look in [mid+1, high) Once we reach a single value (when low == high), we've found the right checkpoint at the index high-1, if not
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 EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
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 EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
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 example).
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.token = ERC20(tokenAddr); uint amount = d.token.balanceOf(this).sub(d.balanceRemaining); require (amount > 0); if (feePct > 0) { require (d.token.transfer(owner,_applyPct(amount,feePct))); } amount = d.token.balanceOf(this).sub(d.balanceRemaining); d.balanceRemaining = d.token.balanceOf(this); d.pct.push(_toPct(amount,finalBalance)); }
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.token = ERC20(tokenAddr); uint amount = d.token.balanceOf(this).sub(d.balanceRemaining); require (amount > 0); if (feePct > 0) { require (d.token.transfer(owner,_applyPct(amount,feePct))); } amount = d.token.balanceOf(this).sub(d.balanceRemaining); d.balanceRemaining = d.token.balanceOf(this); d.pct.push(_toPct(amount,finalBalance)); }
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 &#39;a&#39; not being zero, but the // benefit is lost if &#39;b&#39; is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } require(!(a == -1 && b == INT256_MIN)); // This is the only case of overflow not detected by the check below int256 c = a * b; require(c / a == b); return c; }
function mul(int256 a, int256 b) internal pure returns (int256) { // Gas optimization: this is cheaper than requiring &#39;a&#39; not being zero, but the // benefit is lost if &#39;b&#39; is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } require(!(a == -1 && b == INT256_MIN)); // This is the only case of overflow not detected by the check below int256 c = a * b; require(c / a == b); return c; }
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 firstrightsHolder account in the list. Example: 1000 tokens / 3 = 334, 333, 333/
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 */ (uint modu) = (intelPropertyTokenLimit % sdFile.rightsHolderSpecs.length); (uint numTokens) = (intelPropertyTokenLimit / sdFile.rightsHolderSpecs.length); for (uint16 i = 0; i < sdFile.rightsHolderSpecs.length; i++) { uint amount = (i == 0 && modu > 0) ? numTokens + modu : numTokens; (RightsHolderSpec storage rhSpec) = (sdFile.rightsHolderSpecs[i]); rhSpec.tokensHeld = rhSpec.tokensHeld + amount; _mint(rhSpec.rightsHolderAddr, amount); } }
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 */ (uint modu) = (intelPropertyTokenLimit % sdFile.rightsHolderSpecs.length); (uint numTokens) = (intelPropertyTokenLimit / sdFile.rightsHolderSpecs.length); for (uint16 i = 0; i < sdFile.rightsHolderSpecs.length; i++) { uint amount = (i == 0 && modu > 0) ? numTokens + modu : numTokens; (RightsHolderSpec storage rhSpec) = (sdFile.rightsHolderSpecs[i]); rhSpec.tokensHeld = rhSpec.tokensHeld + amount; _mint(rhSpec.rightsHolderAddr, amount); } }
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; if (tax==0){ transferWithoutTax(from,to,amount); } else{ if (isAMMPair[from] || isAMMPair[to]){ transferWithTax(from,to,amount); } else{ transferWithoutTax(from,to,amount); } } return true; }
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; if (tax==0){ transferWithoutTax(from,to,amount); } else{ if (isAMMPair[from] || isAMMPair[to]){ transferWithTax(from,to,amount); } else{ transferWithoutTax(from,to,amount); } } return true; }
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, i.e. according to the last tick transition that was run. /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick /// boundary. /// observationIndex The index of the last oracle observation that was written, /// observationCardinality The current maximum number of observations stored in the pool, /// observationCardinalityNext The next maximum number of observations, to be updated when the observation. /// feeProtocol The protocol fee for both tokens of the pool. /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0 /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee. /// unlocked Whether the pool is currently locked to reentrancy function slot0() external view returns ( uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked ); /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool /// @dev This value can overflow the uint256 function feeGrowthGlobal0X128() external view returns (uint256); /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool /// @dev This value can overflow the uint256 function feeGrowthGlobal1X128() external view returns (uint256); /// @notice The amounts of token0 and token1 that are owed to the protocol /// @dev Protocol fees will never exceed uint128 max in either token function protocolFees() external view returns (uint128 token0, uint128 token1); /// @notice The currently in range liquidity available to the pool /// @dev This value has no relationship to the total liquidity across all ticks function liquidity() external view returns (uint128); /// @notice Look up information about a specific tick in the pool /// @param tick The tick to look up /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or /// tick upper, /// liquidityNet how much liquidity changes when the pool price crosses the tick, /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0, /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1, /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick, /// secondsOutside the seconds spent on the other side of the tick from the current tick, /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false. /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0. /// In addition, these values are only relative and must be used only in comparison to previous snapshots for /// a specific position. function ticks(int24 tick) external view returns ( uint128 liquidityGross, int128 liquidityNet, uint256 feeGrowthOutside0X128, uint256 feeGrowthOutside1X128, int56 tickCumulativeOutside, uint160 secondsPerLiquidityOutsideX128, uint32 secondsOutside, bool initialized ); /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information function tickBitmap(int16 wordPosition) external view returns (uint256); /// @notice Returns the information about a position by the position's key /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper /// @return _liquidity The amount of liquidity in the position, /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke, /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke, /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke, /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke function positions(bytes32 key) external view returns ( uint128 _liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1 ); /// @notice Returns data about a specific observation index /// @param index The element of the observations array to fetch /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time /// ago, rather than at a specific index in the array. /// @return blockTimestamp The timestamp of the observation, /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp, /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp, /// Returns initialized whether the observation has been initialized and the values are safe to use function observations(uint256 index) external view returns ( uint32 blockTimestamp, int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128, bool initialized ); }
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, i.e. according to the last tick transition that was run. /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick /// boundary. /// observationIndex The index of the last oracle observation that was written, /// observationCardinality The current maximum number of observations stored in the pool, /// observationCardinalityNext The next maximum number of observations, to be updated when the observation. /// feeProtocol The protocol fee for both tokens of the pool. /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0 /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee. /// unlocked Whether the pool is currently locked to reentrancy function slot0() external view returns ( uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked ); /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool /// @dev This value can overflow the uint256 function feeGrowthGlobal0X128() external view returns (uint256); /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool /// @dev This value can overflow the uint256 function feeGrowthGlobal1X128() external view returns (uint256); /// @notice The amounts of token0 and token1 that are owed to the protocol /// @dev Protocol fees will never exceed uint128 max in either token function protocolFees() external view returns (uint128 token0, uint128 token1); /// @notice The currently in range liquidity available to the pool /// @dev This value has no relationship to the total liquidity across all ticks function liquidity() external view returns (uint128); /// @notice Look up information about a specific tick in the pool /// @param tick The tick to look up /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or /// tick upper, /// liquidityNet how much liquidity changes when the pool price crosses the tick, /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0, /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1, /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick, /// secondsOutside the seconds spent on the other side of the tick from the current tick, /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false. /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0. /// In addition, these values are only relative and must be used only in comparison to previous snapshots for /// a specific position. function ticks(int24 tick) external view returns ( uint128 liquidityGross, int128 liquidityNet, uint256 feeGrowthOutside0X128, uint256 feeGrowthOutside1X128, int56 tickCumulativeOutside, uint160 secondsPerLiquidityOutsideX128, uint32 secondsOutside, bool initialized ); /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information function tickBitmap(int16 wordPosition) external view returns (uint256); /// @notice Returns the information about a position by the position's key /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper /// @return _liquidity The amount of liquidity in the position, /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke, /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke, /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke, /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke function positions(bytes32 key) external view returns ( uint128 _liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1 ); /// @notice Returns data about a specific observation index /// @param index The element of the observations array to fetch /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time /// ago, rather than at a specific index in the array. /// @return blockTimestamp The timestamp of the observation, /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp, /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp, /// Returns initialized whether the observation has been initialized and the values are safe to use function observations(uint256 index) external view returns ( uint32 blockTimestamp, int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128, bool initialized ); }
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( IPair(swapPairToken0).token0() == _ecosystemToken || IPair(swapPairToken0).token1() == _ecosystemToken, "Swap pair supplied does not have the reward token as one of it's pair" ); require( IPair(swapPairToken0).token0() == IPair(address(depositToken)).token0() ||
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( IPair(swapPairToken0).token0() == _ecosystemToken || IPair(swapPairToken0).token1() == _ecosystemToken, "Swap pair supplied does not have the reward token as one of it's pair" ); require( IPair(swapPairToken0).token0() == IPair(address(depositToken)).token0() ||
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 wallet address to an array of patient IDs
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 wallet address to an array of patient IDs
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 lock configurations /// @param arguments an abi.encode() bytes array. Allows frontend to encode and pass in an arbitrary set of parameters /// @dev creates a lock for the specified lockId. Will be called during the creation process for address locks when the address /// of a contract implementing this interface is passed in as the "trigger" address for minting an address lock. The bytes /// representing any parameters this lock requires are passed through to this method, where abi.decode must be call on them function createLock(uint fnftId, uint lockId, bytes memory arguments) external; /// Updates a lock at the specified lockId /// @param fnftId the fnftId that can map to a lock config stored in implementing contracts. Not recommended, as it will break on splitting /// @param lockId the lockId that maps to the lock config which should be updated. Recommended for retrieving references to lock configurations /// @param arguments an abi.encode() bytes array. Allows frontend to encode and pass in an arbitrary set of parameters /// @dev updates a lock for the specified lockId. Will be called by the frontend from the information section if an update is requested /// can further accept and decode parameters to use in modifying the lock's config or triggering other actions /// such as triggering an on-chain oracle to update function updateLock(uint fnftId, uint lockId, bytes memory arguments) external; /// Whether or not the lock can be unlocked /// @param fnftId the fnftId that can map to a lock config stored in implementing contracts. Not recommended, as it will break on splitting /// @param lockId the lockId that maps to the lock config which should be updated. Recommended for retrieving references to lock configurations /// @dev this method is called during the unlocking and withdrawal processes by the Revest contract - it is also used by the frontend /// if this method is returning true and someone attempts to unlock or withdraw from an FNFT attached to the requested lock, the request will succeed /// @return whether or not this lock may be unlocked function isUnlockable(uint fnftId, uint lockId) external view returns (bool); /// Provides an encoded bytes arary that represents values this lock wants to display on the info screen /// Info to decode these values is provided in the metadata file /// @param fnftId the fnftId that can map to a lock config stored in implementing contracts. Not recommended, as it will break on splitting /// @param lockId the lockId that maps to the lock config which should be updated. Recommended for retrieving references to lock configurations /// @dev used by the frontend to fetch on-chain data on the state of any given lock /// @return a bytes array that represents the result of calling abi.encode on values which the developer wants to appear on the frontend function getDisplayValues(uint fnftId, uint lockId) external view returns (bytes memory); /// Maps to a URL, typically IPFS-based, that contains information on how to encode and decode paramters sent to and from this lock /// Please see additional documentation for JSON config info /// @dev this method will be called by the frontend only but is crucial to properly implement for proper minting and information workflows /// @return a URL to the JSON file containing this lock's metadata schema function getMetadata() external view returns (string memory); /// Whether or not this lock will need updates and should display the option for them /// @dev this will be called by the frontend to determine if update inputs and buttons should be displayed /// @return whether or not the locks created by this contract will need updates function needsUpdate() external view returns (bool); }
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 lock configurations /// @param arguments an abi.encode() bytes array. Allows frontend to encode and pass in an arbitrary set of parameters /// @dev creates a lock for the specified lockId. Will be called during the creation process for address locks when the address /// of a contract implementing this interface is passed in as the "trigger" address for minting an address lock. The bytes /// representing any parameters this lock requires are passed through to this method, where abi.decode must be call on them function createLock(uint fnftId, uint lockId, bytes memory arguments) external; /// Updates a lock at the specified lockId /// @param fnftId the fnftId that can map to a lock config stored in implementing contracts. Not recommended, as it will break on splitting /// @param lockId the lockId that maps to the lock config which should be updated. Recommended for retrieving references to lock configurations /// @param arguments an abi.encode() bytes array. Allows frontend to encode and pass in an arbitrary set of parameters /// @dev updates a lock for the specified lockId. Will be called by the frontend from the information section if an update is requested /// can further accept and decode parameters to use in modifying the lock's config or triggering other actions /// such as triggering an on-chain oracle to update function updateLock(uint fnftId, uint lockId, bytes memory arguments) external; /// Whether or not the lock can be unlocked /// @param fnftId the fnftId that can map to a lock config stored in implementing contracts. Not recommended, as it will break on splitting /// @param lockId the lockId that maps to the lock config which should be updated. Recommended for retrieving references to lock configurations /// @dev this method is called during the unlocking and withdrawal processes by the Revest contract - it is also used by the frontend /// if this method is returning true and someone attempts to unlock or withdraw from an FNFT attached to the requested lock, the request will succeed /// @return whether or not this lock may be unlocked function isUnlockable(uint fnftId, uint lockId) external view returns (bool); /// Provides an encoded bytes arary that represents values this lock wants to display on the info screen /// Info to decode these values is provided in the metadata file /// @param fnftId the fnftId that can map to a lock config stored in implementing contracts. Not recommended, as it will break on splitting /// @param lockId the lockId that maps to the lock config which should be updated. Recommended for retrieving references to lock configurations /// @dev used by the frontend to fetch on-chain data on the state of any given lock /// @return a bytes array that represents the result of calling abi.encode on values which the developer wants to appear on the frontend function getDisplayValues(uint fnftId, uint lockId) external view returns (bytes memory); /// Maps to a URL, typically IPFS-based, that contains information on how to encode and decode paramters sent to and from this lock /// Please see additional documentation for JSON config info /// @dev this method will be called by the frontend only but is crucial to properly implement for proper minting and information workflows /// @return a URL to the JSON file containing this lock's metadata schema function getMetadata() external view returns (string memory); /// Whether or not this lock will need updates and should display the option for them /// @dev this will be called by the frontend to determine if update inputs and buttons should be displayed /// @return whether or not the locks created by this contract will need updates function needsUpdate() external view returns (bool); }
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) public returns (bool success); function allowance(address _owner, address _spender) public constant returns (uint256 remaining);
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) public returns (bool success); function allowance(address _owner, address _spender) public constant returns (uint256 remaining);
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; function trustedBurnTokens(uint256 _amount) external; function trustedWithdrawETH(address _to, uint256 _amount) external; function depositETH() external payable returns (bool); function setCurrentRewardTokens() external; // Public functions function getController() public view returns (IController); }
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; function trustedBurnTokens(uint256 _amount) external; function trustedWithdrawETH(address _to, uint256 _amount) external; function depositETH() external payable returns (bool); function setCurrentRewardTokens() external; // Public functions function getController() public view returns (IController); }
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.After completing the task, the value becomes 1. To track how many times the task has been completed, the 'countTaskCompleted' mapping is used.The value increases by 1 each time the task is completed. When this value reaches 3, the person who completed the task becomes eligible
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 TaskCompleted(taskID); if (countTaskCompleted[taskID] == 1) { earnBronzeNFT(); } if (countTaskCompleted[taskID] == 5) { earnSilverNFT(); } if (countTaskCompleted[taskID] == 7) { earnGoldNFT(); } }
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 TaskCompleted(taskID); if (countTaskCompleted[taskID] == 1) { earnBronzeNFT(); } if (countTaskCompleted[taskID] == 5) { earnSilverNFT(); } if (countTaskCompleted[taskID] == 7) { earnGoldNFT(); } }
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]++; // Airdrop an additional token. if ( _airdrops[recipient] != 1 ) { _mint( recipient, getAntToBeClaimed() ); _airdrops[recipient] = 1; claimedAntzPerWallet[recipient]++; airdropCount += 1; } } totalMintedTokens += aazSupply; }
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]++; // Airdrop an additional token. if ( _airdrops[recipient] != 1 ) { _mint( recipient, getAntToBeClaimed() ); _airdrops[recipient] = 1; claimedAntzPerWallet[recipient]++; airdropCount += 1; } } totalMintedTokens += aazSupply; }
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.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, // accept any amount of ETH path, address(this), block.timestamp ); }
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.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, // accept any amount of ETH path, address(this), block.timestamp ); }
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 norepeated elements. /
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); // Note that mid will always be strictly less than high (i.e. it will be a valid array index) // because Math.average rounds down (it does integer division with truncation). if (array[mid] > element) { high = mid; } else { low = mid + 1; } } // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound. if (low > 0 && array[low - 1] == element) { return low - 1; } else { return low; } }
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); // Note that mid will always be strictly less than high (i.e. it will be a valid array index) // because Math.average rounds down (it does integer division with truncation). if (array[mid] > element) { high = mid; } else { low = mid + 1; } } // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound. if (low > 0 && array[low - 1] == element) { return low - 1; } else { return low; } }
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]), sequencerBridge, delayedBridge
address challengeAddress = challengeFactory.createChallenge( address(this), executionHashes[0], maxMessageCounts[0], stakers[0], stakers[1], commonEndTime.sub(proposedTimes[0]), commonEndTime.sub(proposedTimes[1]), sequencerBridge, delayedBridge
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, "!minimumIndexerStake" ); if (_tokens > 0) {
bytes32 messageHash = keccak256(abi.encodePacked(_indexer, _allocationID)); bytes32 digest = ECDSA.toEthSignedMessageHash(messageHash); require(ECDSA.recover(digest, _proof) == _allocationID, "!proof"); require( __stakes[_indexer].tokensSecureStake() >= __minimumIndexerStake, "!minimumIndexerStake" ); if (_tokens > 0) {
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; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // 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-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @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) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division 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 Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return 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; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // 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-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @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) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division 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 Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return 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; // if coinB's index in coinA's array is less than the last // overwrite it's position with the last coin if (_coinBIndex < coinAArrLastIdx) { // here's our last coin in coinA's array address coinC = _coinInfoMap[_coinA].swapFor[coinAArrLastIdx]; // get the bitwise_xor of the pair to retrieve their indexes uint256 key = (uint256(uint160(_coinA)) ^ uint256(uint160(coinC))); uint256 indexes = coinSwapIndexes[key]; // update the pairing's indexes if (_coinA < coinC) { // least complicated most readable way of shifting twice to remove the lower order bits coinSwapIndexes[key] = ((indexes >> 128) << 128) + _coinBIndex; } else { coinSwapIndexes[key] = (_coinBIndex << 128) + (indexes % 2 ** 128); } // set _coinBIndex in coinA's array to coinC _coinInfoMap[_coinA].swapFor[_coinBIndex] = coinC; } _coinInfoMap[_coinA].swapFor[coinAArrLastIdx] = address(0); _coinInfoMap[_coinA].swapFor.pop(); }
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; // if coinB's index in coinA's array is less than the last // overwrite it's position with the last coin if (_coinBIndex < coinAArrLastIdx) { // here's our last coin in coinA's array address coinC = _coinInfoMap[_coinA].swapFor[coinAArrLastIdx]; // get the bitwise_xor of the pair to retrieve their indexes uint256 key = (uint256(uint160(_coinA)) ^ uint256(uint160(coinC))); uint256 indexes = coinSwapIndexes[key]; // update the pairing's indexes if (_coinA < coinC) { // least complicated most readable way of shifting twice to remove the lower order bits coinSwapIndexes[key] = ((indexes >> 128) << 128) + _coinBIndex; } else { coinSwapIndexes[key] = (_coinBIndex << 128) + (indexes % 2 ** 128); } // set _coinBIndex in coinA's array to coinC _coinInfoMap[_coinA].swapFor[_coinBIndex] = coinC; } _coinInfoMap[_coinA].swapFor[coinAArrLastIdx] = address(0); _coinInfoMap[_coinA].swapFor.pop(); }
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