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
14
// Calculate accrued rewards for user if idx differs from previous
if (newIdx != asset.userIndex[_user]) { if (_userStake != 0) { accruedRewards = _calculateRewards( _userStake, newIdx, asset.userIndex[_user] ); }
if (newIdx != asset.userIndex[_user]) { if (_userStake != 0) { accruedRewards = _calculateRewards( _userStake, newIdx, asset.userIndex[_user] ); }
15,289
5
// If not processed yet:
processedTxNonce[msg.sender][_nonce] = true; _;
processedTxNonce[msg.sender][_nonce] = true; _;
32,061
0
// Set SwaceToken. _swa SwaceToken The address of swace token /
function setSwaceToken(SwaceToken _swa) public onlyOwner
function setSwaceToken(SwaceToken _swa) public onlyOwner
13,333
104
// event of exchange WRC-20 token with original chain token request/event invoked by storeman group/smgIDID of storemanGroup/tokenPairIDtoken pair ID of cross chain token/tokenAccount Rapidity shadow token account/valueRapidity value/userAccountaccount of shadow chain, used to receive token
event UserBurnLogger(bytes32 indexed smgID, uint indexed tokenPairID, address indexed tokenAccount, uint value, uint contractFee, uint fee, bytes userAccount);
event UserBurnLogger(bytes32 indexed smgID, uint indexed tokenPairID, address indexed tokenAccount, uint value, uint contractFee, uint fee, bytes userAccount);
1,615
112
// Can be overridden to add finalization logic. The overriding functionshould call super._finalization() to ensure the chain of finalization isexecuted entirely. /
function _finalization() internal { // solhint-disable-previous-line no-empty-blocks }
function _finalization() internal { // solhint-disable-previous-line no-empty-blocks }
34,654
0
// Create new participant in the network and log the starting datetime
function makePayment(int date) payable public { require(msg.value != 0); lastPayment[msg.sender] = date; }
function makePayment(int date) payable public { require(msg.value != 0); lastPayment[msg.sender] = date; }
53,734
2
// Sushiswap Interface
interface iPair { function sync() external; }
interface iPair { function sync() external; }
43,387
112
// If user is last to withdraw, don't take withdraw fee. And there may still have some pending rewards, we just simple ignore it now. If we want the reward later, we can upgrade the contract.
_withdrawable = _totalUnderlying;
_withdrawable = _totalUnderlying;
29,118
0
// For interacting with masterchef
interface IMasterchef { // Transfer want tokens vault -> masterchef function deposit(uint256 pid, uint256 _amount) external; // Transfer want tokens masterchef -> vault function withdraw(uint256 pid, uint256 _amount) external; //get the amount staked and reward debt for user function userI...
interface IMasterchef { // Transfer want tokens vault -> masterchef function deposit(uint256 pid, uint256 _amount) external; // Transfer want tokens masterchef -> vault function withdraw(uint256 pid, uint256 _amount) external; //get the amount staked and reward debt for user function userI...
12,448
326
// res += valcoefficients[59].
res := addmod(res, mulmod(val, /*coefficients[59]*/ mload(0xca0), PRIME), PRIME)
res := addmod(res, mulmod(val, /*coefficients[59]*/ mload(0xca0), PRIME), PRIME)
21,620
17
// Adds a new probability distribution for a given trait. /
function _pushProbabilities(uint256 traitId, uint64[] memory pdf) internal { if (traitId >= _numPerTrait.length) { revert InvalidTraitId(traitId); } if (pdf.length != _numPerTrait[traitId]) { revert IncorrectPDFLength(pdf.length, traitId, _numPerTrait[traitId]); ...
function _pushProbabilities(uint256 traitId, uint64[] memory pdf) internal { if (traitId >= _numPerTrait.length) { revert InvalidTraitId(traitId); } if (pdf.length != _numPerTrait[traitId]) { revert IncorrectPDFLength(pdf.length, traitId, _numPerTrait[traitId]); ...
7,681
8
// Performs a single exact input swap
function exactInputInternal( uint256 amountIn, address recipient, uint160 sqrtPriceLimitX96, SwapCallbackData memory data
function exactInputInternal( uint256 amountIn, address recipient, uint160 sqrtPriceLimitX96, SwapCallbackData memory data
10,190
3
// Modulo is the number of equiprobable outcomes in a game:2 for coin flip6 for dice roll66 = 36 for double dice37 for roulette100 for polyroll
uint constant MAX_MODULO = 100;
uint constant MAX_MODULO = 100;
26,998
13
// perform transfers
for (uint256 i = 0; i < ids.length; ++i) {
for (uint256 i = 0; i < ids.length; ++i) {
48,917
54
// Storing in local variables to avoid stack too deep
uint256[] memory _balances = balances; uint256 _protocolSwapFeePercentage = protocolSwapFeePercentage; amountsIn = new uint256[](2); amountsIn[tokenIndex] = amountIn; _upscaleArray(amountsIn); uint256 amountInForVirtualSwap;
uint256[] memory _balances = balances; uint256 _protocolSwapFeePercentage = protocolSwapFeePercentage; amountsIn = new uint256[](2); amountsIn[tokenIndex] = amountIn; _upscaleArray(amountsIn); uint256 amountInForVirtualSwap;
20,415
12
// ERC721Metadata methods
function name() external view returns (string _name) { return "SNFT"; }
function name() external view returns (string _name) { return "SNFT"; }
9,602
26
// Define 1%
uint256 private constant onePercent = 100000 * 10**_decimals;
uint256 private constant onePercent = 100000 * 10**_decimals;
1,733
7
// Make sure signature is valid and get the address of the signer
address signer = _verifyWithdrawToken(_data);
address signer = _verifyWithdrawToken(_data);
4,212
28
// Swap to ITS
swapTokenfortoken(WETH,token);
swapTokenfortoken(WETH,token);
39,457
129
// Divides value a by value b (result is rounded down). /
function preciseDiv(uint256 a, uint256 b) internal pure returns (uint256) { return a.mul(PRECISE_UNIT).div(b); }
function preciseDiv(uint256 a, uint256 b) internal pure returns (uint256) { return a.mul(PRECISE_UNIT).div(b); }
25,832
204
// return the previous eth to the bidder
if(currentBidder != address(0)) withdrawETH(currentBidder, prevBidPrice);
if(currentBidder != address(0)) withdrawETH(currentBidder, prevBidPrice);
35,710
164
// If order.makerAssetAmount is zero, we also reject the order. While the Exchange contract handles them correctly, they create edge cases in the supporting infrastructure because they have an 'infinite' price when computed by a simple division.
if (order.makerAssetAmount == 0) { orderInfo.orderStatus = uint8(OrderStatus.INVALID_MAKER_ASSET_AMOUNT); return orderInfo; }
if (order.makerAssetAmount == 0) { orderInfo.orderStatus = uint8(OrderStatus.INVALID_MAKER_ASSET_AMOUNT); return orderInfo; }
8,741
38
// Approves another address to transfer the given token ID The zero address indicates there is no approved address. There can only be one approved address per token at a given time. Can only be called by the token owner or an approved operator. _to address to be approved for the given token ID _tokenId uint256 ID of th...
function approve(address _to, uint256 _tokenId) public { address owner = ownerOf(_tokenId); require(_to != owner); require(msg.sender == owner || isApprovedForAll(owner, msg.sender)); if (getApproved(_tokenId) != address(0) || _to != address(0)) { tokenApprovals[_tokenId] = _to; emit Appr...
function approve(address _to, uint256 _tokenId) public { address owner = ownerOf(_tokenId); require(_to != owner); require(msg.sender == owner || isApprovedForAll(owner, msg.sender)); if (getApproved(_tokenId) != address(0) || _to != address(0)) { tokenApprovals[_tokenId] = _to; emit Appr...
18,627
512
// get APR from chainlink data by measuring (current month - previous month) / previous month/ return percentageChange percentage change in basis points over past month
function getMonthlyAPR() public view returns (int256 percentageChange) { int256 delta = int128(currentMonth) - int128(previousMonth); percentageChange = (delta * Constants.BP_INT) / int128(previousMonth); }
function getMonthlyAPR() public view returns (int256 percentageChange) { int256 delta = int128(currentMonth) - int128(previousMonth); percentageChange = (delta * Constants.BP_INT) / int128(previousMonth); }
12,837
109
// Check Token Total Supply
require(token.totalSupply() == TOTAL_SUPPLY, "Total supply check error.");
require(token.totalSupply() == TOTAL_SUPPLY, "Total supply check error.");
36,436
10
// index of decimal place (0 if no decimal)
uint8 decimalIndex;
uint8 decimalIndex;
7,611
11
// Modifier that requires the voter to be an active airline /
modifier requireVoterToBeActive(address airline) { require(this.isActiveAndFunded(airline), "Airline cannot vote"); _; }
modifier requireVoterToBeActive(address airline) { require(this.isActiveAndFunded(airline), "Airline cannot vote"); _; }
28,632
111
// Repays protocol fee
if (_reserve == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) { protocolFeePayoutAddress1.call.value(protocolFee.div(2))(""); protocolFeePayoutAddress2.call.value(protocolFee.div(2))(""); } else {
if (_reserve == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) { protocolFeePayoutAddress1.call.value(protocolFee.div(2))(""); protocolFeePayoutAddress2.call.value(protocolFee.div(2))(""); } else {
49,708
0
// Migration contract address
AssetContractShared public migrationTarget; mapping(address => bool) public sharedProxyAddresses;
AssetContractShared public migrationTarget; mapping(address => bool) public sharedProxyAddresses;
16,171
254
// check if there is any CRV we need to earmark
uint256 crvExpiry = rewardsContract.periodFinish(); if (crvExpiry < block.timestamp) { return true; }
uint256 crvExpiry = rewardsContract.periodFinish(); if (crvExpiry < block.timestamp) { return true; }
43,579
9
// ============ Constructor ============ /
{ require( _operatorFeeSplit <= PreciseUnitMath.preciseUnit(), "Operator Fee Split must be less than 1e18" ); setToken = _setToken; indexModule = _indexModule; feeModule = _feeModule; operator = _operator; methodologist = _meth...
{ require( _operatorFeeSplit <= PreciseUnitMath.preciseUnit(), "Operator Fee Split must be less than 1e18" ); setToken = _setToken; indexModule = _indexModule; feeModule = _feeModule; operator = _operator; methodologist = _meth...
14,636
214
// ERC721 Non-Fungible Token Standard basic implementationModified to remove the mint function and to replace itwith the _addTokenTo function.This function is very similar to the _mint function, but itdoes not emit a Transfer event /
contract NoMintERC721 is Context, ERC165, IERC721 { using SafeMath for uint256; using Address for address; using Counters for Counters.Counter; // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` // which can be also obtained as `IERC721Receiver(0).onERC721Received.s...
contract NoMintERC721 is Context, ERC165, IERC721 { using SafeMath for uint256; using Address for address; using Counters for Counters.Counter; // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` // which can be also obtained as `IERC721Receiver(0).onERC721Received.s...
35,165
44
// Check if address is a valid destination to transfer tokens to- must not be zero address- must not be the token address- must not be the owner&39;s address- must not be the admin&39;s address- must not be the token offering contract address /
modifier validDestination(address to) { require(to != address(0x0)); require(to != address(this)); require(to != owner); require(to != address(adminAddr)); require(to != address(tokenOfferingAddr)); _; }
modifier validDestination(address to) { require(to != address(0x0)); require(to != address(this)); require(to != owner); require(to != address(adminAddr)); require(to != address(tokenOfferingAddr)); _; }
40,144
61
// Events to allow tracking add/remove.
event AddressAddedToWhitelist(address indexed addedAddress, uint8 indexed whitelist, address indexed addedBy); event AddressRemovedFromWhitelist(address indexed removedAddress, uint8 indexed whitelist, address indexed removedBy); event OutboundWhitelistUpdated( address indexed updatedBy, uint8 index...
event AddressAddedToWhitelist(address indexed addedAddress, uint8 indexed whitelist, address indexed addedBy); event AddressRemovedFromWhitelist(address indexed removedAddress, uint8 indexed whitelist, address indexed removedBy); event OutboundWhitelistUpdated( address indexed updatedBy, uint8 index...
33,098
2
// Simple implementation of `ERC1155Receiver` that will allow a contract to hold ERC1155 tokens. IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will bestuck._Available since v3.1._ /
contract ERC1155Holder is ERC1155Receiver { function onERC1155Received( address, address, uint256, uint256, bytes memory ) public virtual override returns (bytes4) { return this.onERC1155Received.selector; } function onERC1155BatchReceived( addres...
contract ERC1155Holder is ERC1155Receiver { function onERC1155Received( address, address, uint256, uint256, bytes memory ) public virtual override returns (bytes4) { return this.onERC1155Received.selector; } function onERC1155BatchReceived( addres...
4,965
10
// Internal Functions // /
function _areAddressesEqual(address leftAddress, address rightAddress) internal view returns (bool)
function _areAddressesEqual(address leftAddress, address rightAddress) internal view returns (bool)
8,183
24
// Event emitted when the funds recipient is changed/newAddress new address for the funds recipient/changedBy address that the recipient is changed by
event FundsRecipientChanged( address indexed newAddress, address indexed changedBy );
event FundsRecipientChanged( address indexed newAddress, address indexed changedBy );
10,251
81
// uint issuedTokenSupply = token.totalSupply();uint restrictedTokens = issuedTokenSupply.mul(49).div(51);token.mint(multisigVault, restrictedTokens);
token.finishMinting(); token.transferOwnership(owner);
token.finishMinting(); token.transferOwnership(owner);
30,277
32
// copy last item in list to location of item to be removed, reduce length by 1
CToken[] storage storedList = accountAssets[msg.sender]; storedList[assetIndex] = storedList[storedList.length - 1]; storedList.pop(); emit MarketExited(cToken, msg.sender); return uint(Error.NO_ERROR);
CToken[] storage storedList = accountAssets[msg.sender]; storedList[assetIndex] = storedList[storedList.length - 1]; storedList.pop(); emit MarketExited(cToken, msg.sender); return uint(Error.NO_ERROR);
11,852
2
// A call has failed. returnData Data returned from the call. /
event CallFailed(bytes returnData);
event CallFailed(bytes returnData);
17,693
88
// Emitted when schain type added. /
event SchainTypeAdded(uint indexed schainType, uint partOfNode, uint numberOfNodes);
event SchainTypeAdded(uint indexed schainType, uint partOfNode, uint numberOfNodes);
41,387
24
// Sets the values for {token}, {trustedAccountAddress} and{walletAddress}. All three of these values are immutable: they can only be set once duringconstruction. /
constructor( address _tokenAddress, address _trustedAccountAddress, address _walletAddress ) { token = IERC20(_tokenAddress); trustedAccountAddress = _trustedAccountAddress; walletAddress = _walletAddress; }
constructor( address _tokenAddress, address _trustedAccountAddress, address _walletAddress ) { token = IERC20(_tokenAddress); trustedAccountAddress = _trustedAccountAddress; walletAddress = _walletAddress; }
18,687
5
// Computes a unique key for the particular salt and msg.sender/salt A salt used to generate the nonce key/ return A unique nonce key derived from the salt and msg.sender
function computeKey(bytes32 salt) view internal returns (bytes32)
function computeKey(bytes32 salt) view internal returns (bytes32)
27,334
80
// Update the lockToBlock
function lockToUpdate(uint256 _newLockTo) public onlyAuthorized { lockToBlock = _newLockTo; }
function lockToUpdate(uint256 _newLockTo) public onlyAuthorized { lockToBlock = _newLockTo; }
34,794
50
// Withdraw all Ether (fee) from auction contract to token contract. Only auction contract owner. /
function withdrawBalance() external { address tokenAddress = address(tokenContract); // Check sender as owner or token contract require(msg.sender == owner || msg.sender == tokenAddress); // Send Ether on this contract to token contract // Boolean method make sure that even if one fails it will ...
function withdrawBalance() external { address tokenAddress = address(tokenContract); // Check sender as owner or token contract require(msg.sender == owner || msg.sender == tokenAddress); // Send Ether on this contract to token contract // Boolean method make sure that even if one fails it will ...
32,734
70
// /
function _addToWhitelist(address addressToAdd, uint8 whitelist) internal { // Verify a valid address was passed in require(addressToAdd != address(0), "Cannot add address 0x0 to a whitelist."); // Verify the whitelist is valid require(whitelist != NO_WHITELIST, "Invalid whitelist ID...
function _addToWhitelist(address addressToAdd, uint8 whitelist) internal { // Verify a valid address was passed in require(addressToAdd != address(0), "Cannot add address 0x0 to a whitelist."); // Verify the whitelist is valid require(whitelist != NO_WHITELIST, "Invalid whitelist ID...
1,436
0
// ERC20 interface that includes the decimals read only method. /
interface IERC20Standard is IERC20 { /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` * (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imita...
interface IERC20Standard is IERC20 { /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` * (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imita...
33,453
23
// Check that the account wasn't already set as an admin for this epoch.
if (_isAdmin(adminEpoch, account)) revert DuplicateAdmin(account); if (account == address(0)) revert InvalidAdmins();
if (_isAdmin(adminEpoch, account)) revert DuplicateAdmin(account); if (account == address(0)) revert InvalidAdmins();
9,906
210
// Minting
function mint(uint256 _mintAmount) public payable { // Checks require(!paused, "DanaNFT: minting has not started yet"); require(_mintAmount > 0, "DanaNFT: you have to mint at least one"); require(_mintAmount <= maxMintAmount, "DanaNFT: you can only mint 10 at a time"); require(lastSupply >= _mint...
function mint(uint256 _mintAmount) public payable { // Checks require(!paused, "DanaNFT: minting has not started yet"); require(_mintAmount > 0, "DanaNFT: you have to mint at least one"); require(_mintAmount <= maxMintAmount, "DanaNFT: you can only mint 10 at a time"); require(lastSupply >= _mint...
20,522
15
// 1. deploy sushi LP
DAO storage fork = _dao[id]; address lp = IUniswapV2Factory(_commons.pool2Factory).getPair( fork.vision, _commons.weth ); if (lp == address(0)) { IUniswapV2Factory(_commons.pool2Factory).createPair( fork.vision, ...
DAO storage fork = _dao[id]; address lp = IUniswapV2Factory(_commons.pool2Factory).getPair( fork.vision, _commons.weth ); if (lp == address(0)) { IUniswapV2Factory(_commons.pool2Factory).createPair( fork.vision, ...
42,890
3
// extcodesize checks the size of the code stored in an address, and address returns the current address. Since the code is still not deployed when running a constructor, any checks on its code size will yield zero, making it an effective way to detect if a contract is under construction or not.
address self = address(this); uint256 cs;
address self = address(this); uint256 cs;
1,082
22
// Ballot receipt record for a voter
struct Receipt { // Whether or not a vote has been cast bool hasVoted; bool support; uint96 votes; }
struct Receipt { // Whether or not a vote has been cast bool hasVoted; bool support; uint96 votes; }
24,453
95
// See {IERC721-transferFrom}. /
function transferFrom(address from, address to, uint256 tokenId) public virtual override {
function transferFrom(address from, address to, uint256 tokenId) public virtual override {
429
84
// Accepts buy offer for the canvas. Caller has to be the owner of the canvas. You can specify minimal price, which is the protection against accidental calls./
function acceptBuyOffer(uint32 _canvasId, uint _minPrice) external stateOwned(_canvasId) forceOwned(_canvasId) { Canvas storage canvas = _getCanvas(_canvasId); require(canvas.owner == msg.sender); BuyOffer memory offer = buyOffers[_canvasId]; require(offer.hasOffer); require...
function acceptBuyOffer(uint32 _canvasId, uint _minPrice) external stateOwned(_canvasId) forceOwned(_canvasId) { Canvas storage canvas = _getCanvas(_canvasId); require(canvas.owner == msg.sender); BuyOffer memory offer = buyOffers[_canvasId]; require(offer.hasOffer); require...
40,755
59
// Emits {Approval} event to reflect reduced allowance `value` for this contract to spend from receiver account (`receiver`),/ unless allowance is set to `type(uint256).max`/ Emits two {Transfer} events for minting and burning of the flash-minted amount./ Returns boolean value indicating whether operation succeeded./ R...
function flashLoan( IERC3156FlashBorrower receiver, address token, uint256 value, bytes calldata data ) external override returns (bool) { require(token == address(this), "WETH: flash mint only WETH10"); require(value <= type(uint112).max, "WETH: individual loan limit exceeded"); flashMi...
function flashLoan( IERC3156FlashBorrower receiver, address token, uint256 value, bytes calldata data ) external override returns (bool) { require(token == address(this), "WETH: flash mint only WETH10"); require(value <= type(uint112).max, "WETH: individual loan limit exceeded"); flashMi...
50,342
47
// This functions returns a delimited list of founder wallets that have voted in the last 24 hours./A majority vote will allow a wallet to be removed and not receive their founder tokens./ return list of delimited wallet address who HAVE voted for a bad actor.
function getListOfWalletsWhoVotedInLast24Hrs() external view returns (string memory){ string memory walletsRecentlyVoted; //Make sure the wallet that is trying to see voting information is in the walletAddresses list (ie, they are one of the founder wallets). //Note: if a founder wallet ge...
function getListOfWalletsWhoVotedInLast24Hrs() external view returns (string memory){ string memory walletsRecentlyVoted; //Make sure the wallet that is trying to see voting information is in the walletAddresses list (ie, they are one of the founder wallets). //Note: if a founder wallet ge...
24,189
32
// Eq. ERC20 -> ERC1155
_swapERC20EquivalentForNFTViaNft20( nftToErc20[toNft], toIds, toAmounts, msg.sender );
_swapERC20EquivalentForNFTViaNft20( nftToErc20[toNft], toIds, toAmounts, msg.sender );
32,797
7
// 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, string memory errorMessage) internal pure returns (uint256) { // 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 ...
function mul(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // 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 ...
13,254
246
// pay 2% out to community rewards
uint256 _com = _eth / 50; uint256 _p3d; _p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100)); if (_p3d > 0) { token_community_addr.transfer(_p3d); _eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount); }
uint256 _com = _eth / 50; uint256 _p3d; _p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100)); if (_p3d > 0) { token_community_addr.transfer(_p3d); _eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount); }
18,686
28
// Index of next genesis branch
uint256 public nextGenesisBranchId = 1;
uint256 public nextGenesisBranchId = 1;
52,489
221
// sum of stages hard caps
if (hardCap_ != totalValue) { revert ValueMismatch(hardCap_, totalValue); }
if (hardCap_ != totalValue) { revert ValueMismatch(hardCap_, totalValue); }
13,741
90
// Convenience method to compute the code hash of an arbitrary contract
function codeHashOf(address a) external view returns (bytes32) { return a.codehash; }
function codeHashOf(address a) external view returns (bytes32) { return a.codehash; }
10,242
2
// In the case where tickAfter is initialized, we only want to count it if we are swapping downwards. If the initializable tick after the swap is initialized, our original tickAfter is a multiple of tick spacing, and we are swapping downwards we know that tickAfter is initialized and we shouldn't count it.
tickAfterInitialized = ((self.tickBitmap(wordPosAfter) & (1 << bitPosAfter)) > 0) && ((tickAfter % self.tickSpacing()) == 0) && (tickBefore > tickAfter);
tickAfterInitialized = ((self.tickBitmap(wordPosAfter) & (1 << bitPosAfter)) > 0) && ((tickAfter % self.tickSpacing()) == 0) && (tickBefore > tickAfter);
26,819
10
// check the positive case
function testGreeting() public { greeter.greet("yo"); require(keccak256(abi.encodePacked(greeter.greeting())) == keccak256(abi.encodePacked("yo")), "not equal"); }
function testGreeting() public { greeter.greet("yo"); require(keccak256(abi.encodePacked(greeter.greeting())) == keccak256(abi.encodePacked("yo")), "not equal"); }
16,452
5
// If the function that is called has no delay the function is called immediately, otherwise the function call is stored on-chain and can be executed later using `executeTransaction` when the necessary time has passed.
function transact( address to, bytes calldata data ) external override nonReentrant payable onlyAuthorized
function transact( address to, bytes calldata data ) external override nonReentrant payable onlyAuthorized
27,765
95
// exclude from max tx
_isExcludedFromMaxTx[owner()] = true; _isExcludedFromMaxTx[address(this)] = true; _isExcludedFromMaxTx[address(0x000000000000000000000000000000000000dEaD)] = true; _isExcludedFromMaxTx[address(0)] = true; emit Transfer(address(0), _msgSender(), _tTotal);
_isExcludedFromMaxTx[owner()] = true; _isExcludedFromMaxTx[address(this)] = true; _isExcludedFromMaxTx[address(0x000000000000000000000000000000000000dEaD)] = true; _isExcludedFromMaxTx[address(0)] = true; emit Transfer(address(0), _msgSender(), _tTotal);
11,011
8
// update status to completed (2)
tasks[msg.sender][index].status = 2;
tasks[msg.sender][index].status = 2;
32,062
53
// 🔥🔥🔥 100 billion max supply
uint256 public constant LITSUPPLY = 100_000_000_000 * 10**18;
uint256 public constant LITSUPPLY = 100_000_000_000 * 10**18;
61,379
30
// ============ Internal ============ //Instructs the SetToken to set approvals of the ERC20 token to a spender._setTokenSetToken instance to invoke _token ERC20 token to approve _spender The account allowed to spend the SetToken's balance _quantityThe quantity of allowance to allow /
function invokeApprove( ISetToken _setToken, address _token, address _spender, uint256 _quantity ) internal {
function invokeApprove( ISetToken _setToken, address _token, address _spender, uint256 _quantity ) internal {
19,718
237
// Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. /
function revokeRole(bytes32 role, address account) external;
function revokeRole(bytes32 role, address account) external;
2,364
133
// Deletes price record from index._id The price ID./
function unregisterRecord(bytes32 _id) internal { // Since the order of price records is not guaranteed, we can make deletion more efficient // by replacing record we want to delete with the last record, hence avoid reindex. // Calculate deletion record ID slot. bytes32 deletionInde...
function unregisterRecord(bytes32 _id) internal { // Since the order of price records is not guaranteed, we can make deletion more efficient // by replacing record we want to delete with the last record, hence avoid reindex. // Calculate deletion record ID slot. bytes32 deletionInde...
61,213
229
// Locks a specified amount of tokens against an address,for a specified reason and time_of address whose tokens are to be locked_reason The reason to lock tokens_amount Number of tokens to be locked_time Lock time in seconds/
function _lock(address _of, bytes32 _reason, uint256 _amount, uint256 _time) internal { require(_tokensLocked(_of, _reason) == 0); require(_amount != 0); if (locked[_of][_reason].amount == 0) { lockReason[_of].push(_reason); } require(token.operatorTransfer(_of, _amount)); uint256 val...
function _lock(address _of, bytes32 _reason, uint256 _amount, uint256 _time) internal { require(_tokensLocked(_of, _reason) == 0); require(_amount != 0); if (locked[_of][_reason].amount == 0) { lockReason[_of].push(_reason); } require(token.operatorTransfer(_of, _amount)); uint256 val...
34,659
17
// To recieve ether in contract
receive() external payable { } fallback() external payable { } }
receive() external payable { } fallback() external payable { } }
30,020
143
// Internal function to set the token URI for a given token. Reverts if the token ID does not exist. TIP: if all token IDs share a prefix (e.g. if your URIs look like
* `http://api.myproject.com/token/<id>`), use {_setBaseURI} to store * it and save gas. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal { require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; }
* `http://api.myproject.com/token/<id>`), use {_setBaseURI} to store * it and save gas. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal { require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; }
28,998
99
// Sender approves the account to borrow a given market based on given collateral/account Address that is allowed to borrow the given market/market Address of the given market/collateral Address of the given collateral/amount The amount is allowed to withdrawn
function approveBorrow (address account, address market, address collateral, uint256 amount) external accountIsValid(account) marketIsActive(market)
function approveBorrow (address account, address market, address collateral, uint256 amount) external accountIsValid(account) marketIsActive(market)
27,838
93
// Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp/To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing/ the beginning of the period and another for the end of the period. E.g., to get the last hour t...
function observe(uint32[] calldata secondsAgos) external view returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);
function observe(uint32[] calldata secondsAgos) external view returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);
10,273
7
// membershipId -> communityId.
mapping(string => string) public _memberOf;
mapping(string => string) public _memberOf;
13,535
51
// Mapping(Account => Stake)
mapping(address => uint) public accountStaked;
mapping(address => uint) public accountStaked;
1,681
61
// Integer division of two unsigned integers truncating the quotient, reverts on division by zero. /
function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, "SafeMath#div: DIVISION_BY_ZERO"); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; }
function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, "SafeMath#div: DIVISION_BY_ZERO"); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; }
8,256
16
// Contract functions //Deposits reward. Returns success.
function depositReward() public payable returns (bool)
function depositReward() public payable returns (bool)
48,831
90
// Allows the current owner to change administrator account of the contract to a newAdmin. newAdmin The address to transfer ownership to. /
function changeAdmin(address newAdmin) public onlyOwner { require(newAdmin != address(0)); emit AdminChanged(admin, newAdmin); admin = newAdmin; }
function changeAdmin(address newAdmin) public onlyOwner { require(newAdmin != address(0)); emit AdminChanged(admin, newAdmin); admin = newAdmin; }
32,579
33
// called by the owner to unpause, returns to normal state /
function unpause() onlyOwner whenPaused public { paused = false; Unpause(); }
function unpause() onlyOwner whenPaused public { paused = false; Unpause(); }
17,030
59
// (current price – base target price in usd)total supply / (base target price in usdlag factor)
int256 goldPrice = curGoldPrice.toInt256Safe(); int256 marketPrice = marketPrice.toInt256Safe(); int256 delta = marketPrice.sub(goldPrice); int256 lagSpawn = goldPrice.mul(rebaseLag.toInt256Safe()); return tt.totalSupply().toInt256Safe() .mul(delta)....
int256 goldPrice = curGoldPrice.toInt256Safe(); int256 marketPrice = marketPrice.toInt256Safe(); int256 delta = marketPrice.sub(goldPrice); int256 lagSpawn = goldPrice.mul(rebaseLag.toInt256Safe()); return tt.totalSupply().toInt256Safe() .mul(delta)....
36,830
33
// check if free mints available
if(AddressToFreebiesMap[msg.sender] == 0) revert NoFreeMintsHomie();
if(AddressToFreebiesMap[msg.sender] == 0) revert NoFreeMintsHomie();
2,117
20
// BUYTOKEN tokenomics2.0 buy tax value applied to itself
uint buyTokenA2 = (value * buyTokenInfo.addedToks.tokenA2TaxOnBuy) / 10000; if (buyTokenA2 > 0) { (bool success, bytes memory data) = buyToken.call(abi.encodeWithSelector(_TRANSFER, buyTokenInfo.feeReceiver, buyTokenA2)); require(success && (data.length == 0 || a...
uint buyTokenA2 = (value * buyTokenInfo.addedToks.tokenA2TaxOnBuy) / 10000; if (buyTokenA2 > 0) { (bool success, bytes memory data) = buyToken.call(abi.encodeWithSelector(_TRANSFER, buyTokenInfo.feeReceiver, buyTokenA2)); require(success && (data.length == 0 || a...
16,220
39
// TAX SELLERS 20% WHO SELL WITHIN 24 HOURS
if (_buyMap[from] != 0 && (_buyMap[from] + (24 hours) >= block.timestamp)) { _feeAddr1 = 2; _feeAddr2 = 20; } else {
if (_buyMap[from] != 0 && (_buyMap[from] + (24 hours) >= block.timestamp)) { _feeAddr1 = 2; _feeAddr2 = 20; } else {
46,785
166
// FRAX portion is FraxCR
uint256 frax_portion_with_cr = (allocations[2] * FRAX.global_collateral_ratio()) / PRICE_PRECISION;
uint256 frax_portion_with_cr = (allocations[2] * FRAX.global_collateral_ratio()) / PRICE_PRECISION;
34,925
23
// Used in place of the constructor to allow the contract to be upgradable via proxy. registryAddress The address of the registry core smart contract. minElectableValidators The minimum number of validators that can be elected. _maxNumGroupsVotedFor The maximum number of groups that an account can vote for at once. _el...
function initialize( address registryAddress, uint256 minElectableValidators, uint256 maxElectableValidators, uint256 _maxNumGroupsVotedFor, uint256 _electabilityThreshold
function initialize( address registryAddress, uint256 minElectableValidators, uint256 maxElectableValidators, uint256 _maxNumGroupsVotedFor, uint256 _electabilityThreshold
36,793
230
// withdraw reward too
require( rewardToken.transfer(msg.sender, balances[msg.sender]), "claim: transfer failed" ); tokenReceived[msg.sender] = tokenReceived[msg.sender].add(balances[msg.sender]);
require( rewardToken.transfer(msg.sender, balances[msg.sender]), "claim: transfer failed" ); tokenReceived[msg.sender] = tokenReceived[msg.sender].add(balances[msg.sender]);
72,544
184
// Get a reference to the amount still tappable in the current funding cycle.
uint256 _limit = _currentFundingCycle.target - _currentFundingCycle.tapped;
uint256 _limit = _currentFundingCycle.target - _currentFundingCycle.tapped;
28,596
50
// Indicates that the contract is in the process of being initialized. /
bool private initializing;
bool private initializing;
1,011
32
// Shared Manifold extension which supports letting users add arbitrary minting permissionsand per token royalties set at the time of minting. Version: 1.2 /
contract GlobalVerisartManifoldExtension is ICreatorExtensionRoyalties { bytes32 private constant _DOMAIN_TYPEHASH = keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract,bytes32 salt)" ); bytes32 private _eip712DomainSeparator = kecca...
contract GlobalVerisartManifoldExtension is ICreatorExtensionRoyalties { bytes32 private constant _DOMAIN_TYPEHASH = keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract,bytes32 salt)" ); bytes32 private _eip712DomainSeparator = kecca...
38,603
159
// Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function callencoded in `data`.
* Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallSecure(newImplementation, data, true); }
* Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallSecure(newImplementation, data, true); }
50,683
2
// View Functions
function upkeepEligibility() external view returns (uint256 numberOfDepositsEligible, uint256 amountOfYieldToSwap); function getOutstandingYield(uint256 id_) external view returns (uint256); function getPrincipalInGDUS(uint256 id_) external view returns (uint256); function getTotalHarvestableYieldGDU...
function upkeepEligibility() external view returns (uint256 numberOfDepositsEligible, uint256 amountOfYieldToSwap); function getOutstandingYield(uint256 id_) external view returns (uint256); function getPrincipalInGDUS(uint256 id_) external view returns (uint256); function getTotalHarvestableYieldGDU...
5,797
60
// Return a Bee with its image and data.
return outputBee;
return outputBee;
58,611
449
// Shh - we don't ever want this hook to be marked pure
if (false) { maxAssets = maxAssets; }
if (false) { maxAssets = maxAssets; }
12,569
104
// transfer HEAL tokens to crowdsale account from the account of controller
require(ethealToken.transferFrom(SALE, _sale, _amount));
require(ethealToken.transferFrom(SALE, _sale, _amount));
32,293
13
// For initial setup
bool private initialised;
bool private initialised;
38,048
99
// function to get Token lockstatus by id
function getTokenLockStatus(uint256 id)public view returns(bool){ return _TokenTransactionstatus[id]; }
function getTokenLockStatus(uint256 id)public view returns(bool){ return _TokenTransactionstatus[id]; }
22,926
62
// _pooId the id of the pool/_booster the address of the booster contract
constructor(uint256 _pooId, address _booster) { require(_booster != address(0), "invalid booster address"); poolId = _pooId; convexBooster = _booster; (lpToken, , , cvxRewards, , ) = IConvexDeposit(convexBooster).poolInfo(poolId); _approveConvexExtra(); }
constructor(uint256 _pooId, address _booster) { require(_booster != address(0), "invalid booster address"); poolId = _pooId; convexBooster = _booster; (lpToken, , , cvxRewards, , ) = IConvexDeposit(convexBooster).poolInfo(poolId); _approveConvexExtra(); }
50,602