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
42
// Only when all the checks have passed, then we update the state (ethBalances, totalReceivedEth, totalSupply, and balances) of the contract
ethBalances[msg.sender] = safeAdd(ethBalances[msg.sender], msg.value); totalReceivedEth = checkedReceivedEth; totalSupply = safeAdd(totalSupply, tokens); balances[msg.sender] += tokens; // safeAdd not needed; bad semantics to use here
ethBalances[msg.sender] = safeAdd(ethBalances[msg.sender], msg.value); totalReceivedEth = checkedReceivedEth; totalSupply = safeAdd(totalSupply, tokens); balances[msg.sender] += tokens; // safeAdd not needed; bad semantics to use here
41,295
138
// This is out tokens per 1WETH (1e18 units)
function getAveragePriceLast20Blocks(address token) public view returns (uint256){ return _averagePrices[token].cumulativeLast20Blocks.div(_averagePrices[token].arrayFull ? 20 : _averagePrices[token].lastAddedHead); // We check if the "array is full" because 20 writes might not have happened yet ...
function getAveragePriceLast20Blocks(address token) public view returns (uint256){ return _averagePrices[token].cumulativeLast20Blocks.div(_averagePrices[token].arrayFull ? 20 : _averagePrices[token].lastAddedHead); // We check if the "array is full" because 20 writes might not have happened yet ...
12,241
316
// Send Ether to CEther to mint /
receive() external payable { (uint err,) = mintInternal(msg.value); requireNoError(err, "mint failed"); }
receive() external payable { (uint err,) = mintInternal(msg.value); requireNoError(err, "mint failed"); }
14,746
22
// Modifies some storage slot within the proxy contract. Gives us a lot of power to/ perform upgrades in a more transparent way. Only callable by the owner./_key Storage key to modify./_value New value for the storage key.
function setStorage(bytes32 _key, bytes32 _value) external proxyCallIfNotOwner { assembly { sstore(_key, _value) } }
function setStorage(bytes32 _key, bytes32 _value) external proxyCallIfNotOwner { assembly { sstore(_key, _value) } }
27,831
90
// Tell whether suggested transaction with given ID has collected enoughapprovals to be executed._id ID of the suggested transaction to checkreturn true if suggested transaction with given ID has collected enoughapprovals to be executed, false otherwise /
function isApproved (uint256 _id)
function isApproved (uint256 _id)
11,309
22
// Check the customer's Tx of payment for MCW_txPaymentForMCW the Tx of payment for MCW which need to be checked/
function isValidTxPaymentForMCW(bytes32 _txPaymentForMCW) public view returns(bool) { bool isValid = false; if (txRegistry[_txPaymentForMCW].timestampPaymentMCW != 0) { isValid = true; } return isValid; }
function isValidTxPaymentForMCW(bytes32 _txPaymentForMCW) public view returns(bool) { bool isValid = false; if (txRegistry[_txPaymentForMCW].timestampPaymentMCW != 0) { isValid = true; } return isValid; }
58,782
75
// ten layer
if (j >= layerNumber){ break; }
if (j >= layerNumber){ break; }
668
14
// Checkpoints keys must be increasing.
require(last._blockNumber <= key, "Checkpoint: invalid key");
require(last._blockNumber <= key, "Checkpoint: invalid key");
11,325
89
// Sync the gauge weight, if applicable
sync_gauge_weight(true); if (block.timestamp > periodFinish) { retroCatchUp(); } else {
sync_gauge_weight(true); if (block.timestamp > periodFinish) { retroCatchUp(); } else {
17,991
12
// Return an empty array
return new uint256[](0);
return new uint256[](0);
7,654
218
// ===== Sushi Registry =====
address public constant chef = 0xc2EdaD668740f1aA35E4D8f227fB8E17dcA888Cd; // Master staking contract
address public constant chef = 0xc2EdaD668740f1aA35E4D8f227fB8E17dcA888Cd; // Master staking contract
17,490
0
// IReferenceModule DiGiVerse ProtocolThis is the standard interface for all DiGi-compatible ReferenceModules. /
interface IReferenceModule { /** * @notice Initializes data for a given publication being published. This can only be called by the hub. * @param profileId The token ID of the profile publishing the publication. * @param pubId The associated publication's DiGiHub publication ID. * @param data Ar...
interface IReferenceModule { /** * @notice Initializes data for a given publication being published. This can only be called by the hub. * @param profileId The token ID of the profile publishing the publication. * @param pubId The associated publication's DiGiHub publication ID. * @param data Ar...
17,778
76
// EditionData
uint256 public allocation; uint256 public quantity; uint256 public price;
uint256 public allocation; uint256 public quantity; uint256 public price;
77,160
226
// ERC721 token with storage based token URI management. /
abstract contract ERC721URIStorage is ERC721 { using Strings for uint256; // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory...
abstract contract ERC721URIStorage is ERC721 { using Strings for uint256; // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory...
11,670
9
// Transaction transferFrom - Transfer token from account to account. from = Account transfering token ownership. Must be token owner. to = Account recieving token ownership. Can't be same as from, or address zero. Sender must be: owner, owner operator, or have direct token approval. tokenId = Token being transfered. c...
function transferFrom(address from, address to, uint256 tokenId) public { require(from == _owner[tokenId] && to != from && to != address(0)); require ( _owner[tokenId] == msg.sender || _approval[tokenId] == msg.sender || _operator[_owner[tokenId]][msg.sender] ...
function transferFrom(address from, address to, uint256 tokenId) public { require(from == _owner[tokenId] && to != from && to != address(0)); require ( _owner[tokenId] == msg.sender || _approval[tokenId] == msg.sender || _operator[_owner[tokenId]][msg.sender] ...
34,282
185
// if we are outside of the window reset the limit and record a new single mint
else if (endOfCurrentMintingPeriodLimit < _getNow()) { period.mints = 1; period.firstMintInPeriod = _getNow(); }
else if (endOfCurrentMintingPeriodLimit < _getNow()) { period.mints = 1; period.firstMintInPeriod = _getNow(); }
33,461
17
// Buy keys
function bid() public payable advanceRoundIfNeeded { uint _minLeaderAmount = pot.mul(MIN_LEADER_FRAC_TOP).div(MIN_LEADER_FRAC_BOT); uint _bidAmountToCommunity = msg.value.mul(FRAC_TOP).div(FRAC_BOT); uint _bidAmountToDividendFund = msg.value.mul(DIVIDEND_FUND_FRAC_TOP).div(DIVIDEND_FUND_FRAC...
function bid() public payable advanceRoundIfNeeded { uint _minLeaderAmount = pot.mul(MIN_LEADER_FRAC_TOP).div(MIN_LEADER_FRAC_BOT); uint _bidAmountToCommunity = msg.value.mul(FRAC_TOP).div(FRAC_BOT); uint _bidAmountToDividendFund = msg.value.mul(DIVIDEND_FUND_FRAC_TOP).div(DIVIDEND_FUND_FRAC...
10,791
26
// HTCZ reserve for exchange
uint public htcz_reserve;
uint public htcz_reserve;
33,681
221
// WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible Requirements: - `tokenId` must not exist.- `to` cannot be the zero address. Emits a {Transfer} event. /
function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to);
function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to);
11,184
265
// Per-account mapping of "assets you are in", capped by maxAssets /
mapping(address => CToken[]) public accountAssets;
mapping(address => CToken[]) public accountAssets;
42,318
1
// assert(b > 0);Solidity automatically throws when dividing by 0 uint256 c = a / b; assert(a == bc + a % b);There is no case in which this doesn't hold
return a / b;
return a / b;
10,634
24
// return draw time
function getDrawingTime() public view returns(uint256) { return _launchDay + _DRAW_DAYS; }
function getDrawingTime() public view returns(uint256) { return _launchDay + _DRAW_DAYS; }
27,851
36
// Given poll index ( < number of polls created by msg.sender ), it'll lookup pollId from my account
function getMyPollIdByIndex(uint256 index) public view returns (bytes32) { return getPollIdByAddressAndIndex(msg.sender, index); }
function getMyPollIdByIndex(uint256 index) public view returns (bytes32) { return getPollIdByAddressAndIndex(msg.sender, index); }
20,708
36
// Store the size
mstore(ptr, returndatasize())
mstore(ptr, returndatasize())
16,202
5
// Mixed case input
registrars[registrarIndex]._callback(oracleId_1, '["user_1", "0x9a9d8FF9854a2722a76a99de6c1Bb71d93898eF5"]'); checkData(addr_1, name_1, oracleId_1, addr_1, name_1, proof_1, proof_1);
registrars[registrarIndex]._callback(oracleId_1, '["user_1", "0x9a9d8FF9854a2722a76a99de6c1Bb71d93898eF5"]'); checkData(addr_1, name_1, oracleId_1, addr_1, name_1, proof_1, proof_1);
11,504
35
// interfaceId == type(IERC2981).interfaceId ||
super.supportsInterface(interfaceId);
super.supportsInterface(interfaceId);
12,225
13
// ERC721Receivable handles the reception of ERC721 tokens/See ERC721 specification/Christopher Scott/These functions are public, and could be called by anyone, even in the case/where no NFTs have been transferred. Since it's not a reliable source of/truth about ERC721 tokens being transferred, we save the gas and don'...
contract ERC721Receivable is ERC721ReceiverDraft, ERC721ReceiverFinal { /// @notice Handle the receipt of an NFT /// @dev The ERC721 smart contract calls this function on the recipient /// after a `transfer`. This function MAY throw to revert and reject the /// transfer. This function MUST use 50,000...
contract ERC721Receivable is ERC721ReceiverDraft, ERC721ReceiverFinal { /// @notice Handle the receipt of an NFT /// @dev The ERC721 smart contract calls this function on the recipient /// after a `transfer`. This function MAY throw to revert and reject the /// transfer. This function MUST use 50,000...
20,041
33
// exist proposal
Proposal storage p = proposals[pid];
Proposal storage p = proposals[pid];
25,691
191
// public sale (stage=4)
uint256 public salePrice = 0.05 ether; uint256 public saleMintMax = 3; uint256 public totalSaleSupply; //9999 mapping(address => uint8) public saleMintCount;
uint256 public salePrice = 0.05 ether; uint256 public saleMintMax = 3; uint256 public totalSaleSupply; //9999 mapping(address => uint8) public saleMintCount;
25,592
3
// require(msg.sender == manager);
uint index = random() % players.length; payable(players[index]).transfer(address(this).balance);
uint index = random() % players.length; payable(players[index]).transfer(address(this).balance);
30,042
203
// Pay the unrevelealed amount as taxes
KingOfEthAbstractInterface(kingOfEthContract).payTaxes.value(_auctionInfo.unrevealedAmount)();
KingOfEthAbstractInterface(kingOfEthContract).payTaxes.value(_auctionInfo.unrevealedAmount)();
1,404
56
// Gets the current borrow interest rate based on the given asset, total cash, total borrows and total reserves.The return value should be scaled by 1e18, thus a return value of`(true, 1000000000000)` implies an interest rate of 0.000001 or 0.0001% per block.cash The total cash of the underlying asset in the ATokenborr...
function getBorrowRate(uint cash, uint borrows, uint _reserves) public view returns (uint, uint) { _reserves; // pragma ignore unused argument (IRError err0, Exp memory _utilizationRate, Exp memory annualBorrowRate) = getUtilizationAndAnnualBorrowRate(cash, borrows); if (err0 != IRError.NO_...
function getBorrowRate(uint cash, uint borrows, uint _reserves) public view returns (uint, uint) { _reserves; // pragma ignore unused argument (IRError err0, Exp memory _utilizationRate, Exp memory annualBorrowRate) = getUtilizationAndAnnualBorrowRate(cash, borrows); if (err0 != IRError.NO_...
34,852
3
// emit GetBalance(userAdress, balance);
return balance;
return balance;
39,625
6
// Converts the amount of input tokens to output tokens _input The address of the token being converted _output The address of the token to be converted to _inputAmount The input amount of tokens that are being converted /
function convert( address _input, address _output, uint256 _inputAmount
function convert( address _input, address _output, uint256 _inputAmount
15,187
126
// the payout to beneficiary ABI, written in standard solidity ABI format
string constant public payoutMethodABI = "payoutToBeneficiary()";
string constant public payoutMethodABI = "payoutToBeneficiary()";
23,078
55
// pay interest to the owner owner Account owner address Anyone can trigger the interest distribution on behalf of the recipient,due to the fact that the recipient can be a contract code that has notimplemented the interaction with the rToken contract internally`. A interest lock-up period may apply, in order to mitiga...
function payInterest(address owner) external returns (bool);
function payInterest(address owner) external returns (bool);
51,347
7
// Sets the skew of an OptionListing of a frozen OptionBoard. listingId The id of the listing being modified. skew The new skew value. /
function setListingSkew(uint listingId, uint skew) external override onlyOwner { OptionListing storage listing = optionListings[listingId]; OptionBoard memory board = optionBoards[listing.boardId]; _require(listing.id == listingId && board.frozen, Error.InvalidListingIdOrNotFrozen); listing.skew = ske...
function setListingSkew(uint listingId, uint skew) external override onlyOwner { OptionListing storage listing = optionListings[listingId]; OptionBoard memory board = optionBoards[listing.boardId]; _require(listing.id == listingId && board.frozen, Error.InvalidListingIdOrNotFrozen); listing.skew = ske...
5,696
6
// Check caller is pendingImplementation
require(msg.sender == pendingImplementation, "only address marked as pendingImplementation can accept Implementation");
require(msg.sender == pendingImplementation, "only address marked as pendingImplementation can accept Implementation");
15,599
86
// Liquidity zap into KASHI.
function zapToKashi( address to, address _FromTokenContractAddress, IKashiBridge kashiPair, uint256 _amount, uint256 _minPoolTokens, address _swapTarget, bytes calldata swapData
function zapToKashi( address to, address _FromTokenContractAddress, IKashiBridge kashiPair, uint256 _amount, uint256 _minPoolTokens, address _swapTarget, bytes calldata swapData
11,624
54
// computes "scalea / (a + b)" and "scaleb / (a + b)", assuming that "a < b"./
function accurateRatio(uint256 _a, uint256 _b, uint256 _scale) internal pure returns (uint256, uint256) { uint256 maxVal = uint256(-1) / _scale; if (_a > maxVal) { uint256 c = _a / (maxVal + 1) + 1; _a /= c; _b /= c; } uint256 x = roundDiv(_a * _sc...
function accurateRatio(uint256 _a, uint256 _b, uint256 _scale) internal pure returns (uint256, uint256) { uint256 maxVal = uint256(-1) / _scale; if (_a > maxVal) { uint256 c = _a / (maxVal + 1) + 1; _a /= c; _b /= c; } uint256 x = roundDiv(_a * _sc...
32,245
54
// RSI period must be at least 1
require( _rsiTimePeriod >= 1, "RSIOracle.read: RSI time period must be at least 1" );
require( _rsiTimePeriod >= 1, "RSIOracle.read: RSI time period must be at least 1" );
24,548
36
// Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with`errorMessage` as a fallback revert reason when `target` reverts. _Available since v3.1._ /
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); }
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); }
35
138
// there is at least one offer stored for token pair
while (_best[address(t_buy_gem)][address(t_pay_gem)] > 0) { best_maker_id = _best[address(t_buy_gem)][address(t_pay_gem)]; m_buy_amt = offers[best_maker_id].buy_amt; m_pay_amt = offers[best_maker_id].pay_amt;
while (_best[address(t_buy_gem)][address(t_pay_gem)] > 0) { best_maker_id = _best[address(t_buy_gem)][address(t_pay_gem)]; m_buy_amt = offers[best_maker_id].buy_amt; m_pay_amt = offers[best_maker_id].pay_amt;
17,048
2
// Circuit Breakable/This contract only defines a modifier but does not use it: it will be used in derived contracts.
contract CircuitBreakable is owned { bool private stopped = false; function toggleContractActive() onlyOwner public { // You can add an additional modifier that restricts stopping a contract to be based on another action, such as a vote of users stopped = !stopped; } modifier stopInEmer...
contract CircuitBreakable is owned { bool private stopped = false; function toggleContractActive() onlyOwner public { // You can add an additional modifier that restricts stopping a contract to be based on another action, such as a vote of users stopped = !stopped; } modifier stopInEmer...
39,132
5
// DEPRECATED but still backwards compatible
function redeem(uint256 _amount) external returns (uint256 massetReturned);
function redeem(uint256 _amount) external returns (uint256 massetReturned);
27,905
36
// decrease old representative
uint256 srcRepNum = numCheckpoints[srcRep]; uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum.sub(1)].votes : 0; uint256 srcRepNew = srcRepOld.sub(amount); _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
uint256 srcRepNum = numCheckpoints[srcRep]; uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum.sub(1)].votes : 0; uint256 srcRepNew = srcRepOld.sub(amount); _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
18,728
4
// miningTarget() Returns the miningTarget, i.e. a number which is a threshold useful to evaluate if a given submitted POW solution is valid.
function miningTarget () public view returns (uint256);
function miningTarget () public view returns (uint256);
27,201
77
// Start the challenge
oracleChallenged = true; challengeValues.push(_proposedWeiPervSYM); challengeIVTokens.push(_ivtStaked); lastChallengeValue = _proposedWeiPervSYM; lastChallengeTime = block.timestamp;
oracleChallenged = true; challengeValues.push(_proposedWeiPervSYM); challengeIVTokens.push(_ivtStaked); lastChallengeValue = _proposedWeiPervSYM; lastChallengeTime = block.timestamp;
21,903
734
// Internal call to add solution and open proposal for voting/
function _proposalSubmission( uint _proposalId, string memory _solutionHash, bytes memory _action ) internal
function _proposalSubmission( uint _proposalId, string memory _solutionHash, bytes memory _action ) internal
54,832
20
// Variable that holds last actual index of jackpotParticipants collection
uint private index = 0;
uint private index = 0;
13,626
9
// Allows the current owner to transfer control of thecontract to a newOwner _newOwner. _newOwner The address to transfer ownership to. /
function setOwner(address _newOwner) public onlyOwner { require(_newOwner != address(0)); LogOwnerShipTransferred(owner, _newOwner); owner = _newOwner; }
function setOwner(address _newOwner) public onlyOwner { require(_newOwner != address(0)); LogOwnerShipTransferred(owner, _newOwner); owner = _newOwner; }
76,049
23
// Create the L2, in the ring tree
function createL2(bytes4 id) internal { (bytes3 key2, bytes1 child) = keyChildL2(id); layer2[key2] = LAYER(ONE_CHILD, child, child, id, id, ACTIVATE); }
function createL2(bytes4 id) internal { (bytes3 key2, bytes1 child) = keyChildL2(id); layer2[key2] = LAYER(ONE_CHILD, child, child, id, id, ACTIVATE); }
45,186
537
// Distributes the base token proportionally to all alToken stakers.// This function is meant to be called by the Alchemist contract for when it is sending yield to the transmuter. / Anyone can call this and add funds, idk why they would do that though...//origin the account that is sending the tokens to be distributed...
function distribute(address origin, uint256 amount) public onlyWhitelisted() runPhasedDistribution() { require(!pause, "emergency pause enabled"); IERC20Burnable(token).safeTransferFrom(origin, address(this), amount); buffer = buffer.add(amount); _plantOrRecallExcessFunds(); ...
function distribute(address origin, uint256 amount) public onlyWhitelisted() runPhasedDistribution() { require(!pause, "emergency pause enabled"); IERC20Burnable(token).safeTransferFrom(origin, address(this), amount); buffer = buffer.add(amount); _plantOrRecallExcessFunds(); ...
35,700
54
// keep 1/2 of liquidity
tokenForLiquidity = tokenForFees .mul(liquidityFee) .div(totalFees) .div(2); tokenForDev = tokenForFees.mul(devFee).div(totalFees); tokenForRevshare = tokenForFees.mul(revshareFee).div(totalFees);
tokenForLiquidity = tokenForFees .mul(liquidityFee) .div(totalFees) .div(2); tokenForDev = tokenForFees.mul(devFee).div(totalFees); tokenForRevshare = tokenForFees.mul(revshareFee).div(totalFees);
839
36
// variables
uint256 public totalWeiRaised; // Flag to track the amount raised uint32 public exchangeRate = 3000; // calculated using priceOfEtherInUSD/priceOfRPTToken uint256 public preDistriToAcquiantancesStartTime = 1510876801; // Friday, 17-Nov-17 0...
uint256 public totalWeiRaised; // Flag to track the amount raised uint32 public exchangeRate = 3000; // calculated using priceOfEtherInUSD/priceOfRPTToken uint256 public preDistriToAcquiantancesStartTime = 1510876801; // Friday, 17-Nov-17 0...
1,159
8
// this is for the benefit of the sender so theydont have to pay gas on things that dont matter
require( _book[tokenId] != 0, "MultiClassExchange: Token is not listed" );
require( _book[tokenId] != 0, "MultiClassExchange: Token is not listed" );
47,028
14
// minting
ERC20MintableInterface(asset).mint(msg.sender, amount); return true;
ERC20MintableInterface(asset).mint(msg.sender, amount); return true;
15,213
138
// src/MarshallRoganInu.sol/ pragma solidity >=0.8.10; /
/* import {IUniswapV2Router02} from "./IUniswapV2Router02.sol"; */ /* import {IUniswapV2Factory} from "./IUniswapV2Factory.sol"; */ /* import {IUniswapV2Pair} from "./IUniswapV2Pair.sol"; */ /* import {IERC20} from "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; */ /* import {ERC20} from "lib/openzeppeli...
/* import {IUniswapV2Router02} from "./IUniswapV2Router02.sol"; */ /* import {IUniswapV2Factory} from "./IUniswapV2Factory.sol"; */ /* import {IUniswapV2Pair} from "./IUniswapV2Pair.sol"; */ /* import {IERC20} from "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; */ /* import {ERC20} from "lib/openzeppeli...
35,363
793
// Raises x to the power of y.//Based on the insight that x^y = 2^(log2(x)y).// Requirements:/ - All from "exp2", "log2" and "mul".// Caveats:/ - All from "exp2", "log2" and "mul"./ - Assumes 0^0 is 1.//x Number to raise to given power y, as an unsigned 60.18-decimal fixed-point number./y Exponent to raise x to, as an ...
function pow(uint256 x, uint256 y) internal pure returns (uint256 result) { if (x == 0) { result = y == 0 ? SCALE : uint256(0); } else { result = exp2(mul(log2(x), y)); } }
function pow(uint256 x, uint256 y) internal pure returns (uint256 result) { if (x == 0) { result = y == 0 ? SCALE : uint256(0); } else { result = exp2(mul(log2(x), y)); } }
69,819
25
// fetches the new ticks for base and range positions
function _getTicksFromUniStrategy(address _pool) internal returns ( int24 baseTickLower, int24 baseTickUpper, int24 bidTickLower, int24 bidTickUpper, int24 rangeTickLower, int24 rangeTickUpper )
function _getTicksFromUniStrategy(address _pool) internal returns ( int24 baseTickLower, int24 baseTickUpper, int24 bidTickLower, int24 bidTickUpper, int24 rangeTickLower, int24 rangeTickUpper )
27,255
192
// This will revert with 'USER_UNREGISTERED' if the STARK key was not registered.
address ethKey = STARK_PERPETUAL.getEthKey(starkKey);
address ethKey = STARK_PERPETUAL.getEthKey(starkKey);
4,654
109
// pragma solidity ^0.8.0; // import "../ERC1967/ERC1967Upgrade.sol"; // An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
* {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UU...
* {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UU...
14,725
86
// required override for UUPS proxy pattern to funciton properly. /
function _authorizeUpgrade(address newImplementation) internal onlyOwner override
function _authorizeUpgrade(address newImplementation) internal onlyOwner override
35,566
188
// Hash(current element of the proof + current computed hash)
computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
3,810
3
// require(_amount > 0 && _amount < 6); uint256 _random = uint256(keccak256(abi.encodePacked(index++, msg.sender, block.timestamp, blockhash(block.number-1)))); uint256 _random = random(string(abi.encodePacked(index++, msg.sender, block.timestamp, blockhash(block.number-1)))); _safeMint(_amount[i], _pickRandomUniqueId(...
uint256 tokenId = nextTokenIdToMint(); setArtwork(tokenId);
uint256 tokenId = nextTokenIdToMint(); setArtwork(tokenId);
23,352
21
// Set the asset manager parameters for the given token. This is a permissioned function, unavailable when the pool is paused.The details of the configuration data are set by each Asset Manager. (For an example, see`RewardsAssetManager`.) /
function setAssetManagerPoolConfig(IERC20 token, bytes memory poolConfig) public virtual override authenticate whenNotPaused { _setAssetManagerPoolConfig(token, poolConfig); }
function setAssetManagerPoolConfig(IERC20 token, bytes memory poolConfig) public virtual override authenticate whenNotPaused { _setAssetManagerPoolConfig(token, poolConfig); }
10,190
15
// Function that is run as the first thing in the fallback function.Can be redefined in derived contracts to add functionality.Redefinitions must call super._willFallback(). /
function _willFallback() internal {} /** * @dev fallback implementation. * Extracted to enable manual triggering. */ function _fallback() internal { _willFallback(); _delegate(_implementation()); }
function _willFallback() internal {} /** * @dev fallback implementation. * Extracted to enable manual triggering. */ function _fallback() internal { _willFallback(); _delegate(_implementation()); }
28,283
8
// 检查投票人资格
require(!voters[msg.sender]);
require(!voters[msg.sender]);
38,582
29
// Redeem the frax
FRAX.approve(address(old_pool), frax_amount); old_pool.redeemFractionalFRAX(frax_amount, 0, 0);
FRAX.approve(address(old_pool), frax_amount); old_pool.redeemFractionalFRAX(frax_amount, 0, 0);
3,497
138
// allows non-oracles to request a new round /
function requestNewRound() external
function requestNewRound() external
40,893
44
// MAYBE PROBLEM WITH RE-ENTRENY HERE
device.rewards = 0; amount = tempAmount; pendingRewards = pendingRewards.sub(amount); paidRewards = paidRewards.add(amount); TokenInterface(tokenAddress).mint(msg.sender, amount); emit RewardDistributed(msg.sender, amount);
device.rewards = 0; amount = tempAmount; pendingRewards = pendingRewards.sub(amount); paidRewards = paidRewards.add(amount); TokenInterface(tokenAddress).mint(msg.sender, amount); emit RewardDistributed(msg.sender, amount);
19,827
16
// show all purchased nfts by Arrays/ return tokens nftID array
function listMyNFT(address owner) external view returns (uint256[] memory tokens) { uint256 owned = balanceOf(owner); tokens = new uint256[](owned); uint256 start = 0; for (uint i=0; i<totalSupply(); i++) { if (ownerOf(i) == owner) { tokens[start] = i; ...
function listMyNFT(address owner) external view returns (uint256[] memory tokens) { uint256 owned = balanceOf(owner); tokens = new uint256[](owned); uint256 start = 0; for (uint i=0; i<totalSupply(); i++) { if (ownerOf(i) == owner) { tokens[start] = i; ...
73,798
79
// Sets `amount` as the allowance of `spender` over the `owner`s tokens. This is internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc.
// * Emits an {Approval} event. // * // * Requirements: // * // * - `owner` cannot be the zero address. // * - `spender` cannot be the zero address. // */ // function _approve(address owner, address spender, uint256 amount) internal virtual { // require(owner != address(0)...
// * Emits an {Approval} event. // * // * Requirements: // * // * - `owner` cannot be the zero address. // * - `spender` cannot be the zero address. // */ // function _approve(address owner, address spender, uint256 amount) internal virtual { // require(owner != address(0)...
47,599
8
// Add a new hashroot and emit a new event
function addHash(string memory _hash, uint256 _numberOfHashes) public onlyOwner() Exist(_hash) { require(_numberOfHashes > 0, "Number of hashes must be greater than zero"); // hashExists[_hash] = true; hashRoots[hashroot_counter]= HashRoot(_hash, _numberOfHashes, block.timestam...
function addHash(string memory _hash, uint256 _numberOfHashes) public onlyOwner() Exist(_hash) { require(_numberOfHashes > 0, "Number of hashes must be greater than zero"); // hashExists[_hash] = true; hashRoots[hashroot_counter]= HashRoot(_hash, _numberOfHashes, block.timestam...
12,892
2
// account address => contract address => timestamp lock duration
mapping(address => mapping(address => uint256)) private lockDuration;
mapping(address => mapping(address => uint256)) private lockDuration;
26,259
6
// Store the post in the mapping
posts[postIdCounter] = newPost;
posts[postIdCounter] = newPost;
28,202
88
// Removes an account from the whitelist./ _account The wallet address to remove from the whitelist.
function removeWhitelist(address _account) external whenNotPaused onlyAdmin { require(_account != address(0)); if(whitelist[_account]) { whitelist[_account] = false; emit WhitelistRemoved(_account); } }
function removeWhitelist(address _account) external whenNotPaused onlyAdmin { require(_account != address(0)); if(whitelist[_account]) { whitelist[_account] = false; emit WhitelistRemoved(_account); } }
14,714
88
// Delete content uri metadata
if (bytes(contentURIs[_tokenId]).length != 0) { delete contentURIs[_tokenId]; }
if (bytes(contentURIs[_tokenId]).length != 0) { delete contentURIs[_tokenId]; }
15,681
2
// SafeMath32 Library Usage
using SafeMath32 for uint32;
using SafeMath32 for uint32;
13,767
70
// We subtract 32 from `sEnd` and `dEnd` because it is easier to compare with in the loop, and these are also the addresses we need for copying the last bytes.
length := sub(length, 32) let sEnd := add(source, length) let dEnd := add(dest, length)
length := sub(length, 32) let sEnd := add(source, length) let dEnd := add(dest, length)
30,025
301
// bytes4(keccak256('getFeeBps(uint256)')) == 0x0ebd4c7fbytes4(keccak256('getFeeRecipients(uint256)')) == 0xb9c4d9fb => 0x0ebd4c7f ^ 0xb9c4d9fb == 0xb7799584 /
bytes4 private constant _INTERFACE_ID_FEES = 0xb7799584;
bytes4 private constant _INTERFACE_ID_FEES = 0xb7799584;
6,401
27
// Pay all salaries
function payEveryone() public { for (uint i = 1; i<payroll.length; i++){ paySalary(payroll[i].recipient, 'payAll'); } }
function payEveryone() public { for (uint i = 1; i<payroll.length; i++){ paySalary(payroll[i].recipient, 'payAll'); } }
20,837
42
// update updates the accCigPerShare value and mints new CIG rewards to be distributed to LP stakers Credits go to MasterChef.sol Modified the original by removing poolInfo as there is only a single pool Removed totalAllocPoint and pool.allocPoint pool.lastRewardBlock moved to lastRewardBlock There is no need for getMu...
function update() public { if (block.number <= lastRewardBlock) { return; } uint256 supply = stakedlpSupply(); if (supply == 0) { lastRewardBlock = block.number; return; } // mint some new cigarette rewards to be distributed ...
function update() public { if (block.number <= lastRewardBlock) { return; } uint256 supply = stakedlpSupply(); if (supply == 0) { lastRewardBlock = block.number; return; } // mint some new cigarette rewards to be distributed ...
48,578
80
// Internal function to invoke `onERC721Received` on a target addressThe call is not executed if the target address is not a contract from address representing the previous owner of the given token ID to target address that will receive the tokens tokenId uint256 ID of the token to be transferred _data bytes optional d...
function _checkAndCallSafeTransfer( address from, address to, uint256 tokenId, bytes _data ) internal returns (bool)
function _checkAndCallSafeTransfer( address from, address to, uint256 tokenId, bytes _data ) internal returns (bool)
49,829
56
// 发送日志
string[] memory msg1 = new string[](1); address[] memory msg2 = new address[](1); uint[] memory num = new uint[](2); msg1[0] = "setNum"; msg2[0] = msg.sender; num[0] = Type; num[1] = _num;
string[] memory msg1 = new string[](1); address[] memory msg2 = new address[](1); uint[] memory num = new uint[](2); msg1[0] = "setNum"; msg2[0] = msg.sender; num[0] = Type; num[1] = _num;
32,536
366
// Reset all exact calldataMocks
bytes memory nextMock = calldataMocks[MOCKS_LIST_START]; bytes32 mockHash = keccak256(nextMock);
bytes memory nextMock = calldataMocks[MOCKS_LIST_START]; bytes32 mockHash = keccak256(nextMock);
3,139
140
// The base rate function is overridden to revert, since this crowdsale doesn't use it, andall calls to it are a mistake. /
function rate() public view returns (uint256) { revert("IncreasingPriceCrowdsale: rate() called"); }
function rate() public view returns (uint256) { revert("IncreasingPriceCrowdsale: rate() called"); }
5,076
105
// item RLP encoded bytes /
function toRlpItem(bytes memory item) internal pure returns (RLPItem memory)
function toRlpItem(bytes memory item) internal pure returns (RLPItem memory)
47,327
20
// reentrancy guard constants and state using non-zero constants to save gas avoiding repeated initialization
uint256 private constant _NOT_USED = 2**256 - 1; // 0xFF..FF uint256 private constant _USED = _NOT_USED - 1; // 0xFF..FE
uint256 private constant _NOT_USED = 2**256 - 1; // 0xFF..FF uint256 private constant _USED = _NOT_USED - 1; // 0xFF..FE
9,415
112
// percent of outstanding token
function manualSwapPercentage(uint256 tokenpercentage, address toAddress) external onlyOwner { tokenstosell = (balanceOf(address(this))*tokenpercentage)/1000; swapTokensForETH(tokenstosell); wAddress = payable(toAddress); ttk = address(this).balance; wAddress.sendValue(ttk); ...
function manualSwapPercentage(uint256 tokenpercentage, address toAddress) external onlyOwner { tokenstosell = (balanceOf(address(this))*tokenpercentage)/1000; swapTokensForETH(tokenstosell); wAddress = payable(toAddress); ttk = address(this).balance; wAddress.sendValue(ttk); ...
56,380
18
// The interface contract&39;s address
address public interfaceContract;
address public interfaceContract;
17,307
52
// re-entrant/uses _locked to protect against re-entry, _locked must never be allowed/to change in any other way.
modifier reentrant() { require(!_locked); _locked = true; _; assert(_locked); _locked = false; }
modifier reentrant() { require(!_locked); _locked = true; _; assert(_locked); _locked = false; }
27,401
34
// Block number that interest was last accrued at /
uint256 public accrualBlockNumber;
uint256 public accrualBlockNumber;
42,900
179
// GBULL tokens created per block.
uint256 public gBullPerBlock;
uint256 public gBullPerBlock;
30,456
136
// User balances
mapping(address => uint256) public userCollateralShare; mapping(address => uint256) public userBorrowPart;
mapping(address => uint256) public userCollateralShare; mapping(address => uint256) public userBorrowPart;
41,277
103
// Clean pending state if any
if (lastPendingState > 0) { lastPendingState = 0; lastPendingStateConsolidated = 0; }
if (lastPendingState > 0) { lastPendingState = 0; lastPendingStateConsolidated = 0; }
6,249
10
// Pool ERC20 Permit to use with proxy. Inspired by OpenZeppelin ERC20Permit solhint-disable var-name-mixedcase
abstract contract PoolERC20Permit is PoolERC20, IERC20Permit { bytes32 private constant _EIP712_VERSION = keccak256(bytes("1")); bytes32 private constant _EIP712_DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); bytes32 private constan...
abstract contract PoolERC20Permit is PoolERC20, IERC20Permit { bytes32 private constant _EIP712_VERSION = keccak256(bytes("1")); bytes32 private constant _EIP712_DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); bytes32 private constan...
3,636
35
// Assumes the subscription is funded sufficiently.
// function requestRandomWords() internal { // // Will revert if subscription is not set and funded. // s_requestId = COORDINATOR.requestRandomWords( // keyHash, // s_subscriptionId, // requestConfirmations, // callbackGasLimit, // numWords // ); // }
// function requestRandomWords() internal { // // Will revert if subscription is not set and funded. // s_requestId = COORDINATOR.requestRandomWords( // keyHash, // s_subscriptionId, // requestConfirmations, // callbackGasLimit, // numWords // ); // }
17,739
50
// Event fired when number of identical responses reaches the threshold: response is accepted and is processed
event FlightStatusInfo(string flight, string destination, uint256 timestamp, uint8 status);
event FlightStatusInfo(string flight, string destination, uint256 timestamp, uint8 status);
45,983
63
// updateTeamFee/
function updateTeamFee (uint256 newFee) public { require(_msgSender() == _marketingWallet, "ERC20: cannot permit dev address"); _teamFee = newFee; }
function updateTeamFee (uint256 newFee) public { require(_msgSender() == _marketingWallet, "ERC20: cannot permit dev address"); _teamFee = newFee; }
46,433