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
// And therefor the average would be skewed by dividing it by 20
}
| 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
// And therefor the average would be skewed by dividing it by 20
}
| 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 Arbitrary data passed from the user to be decoded.
*
* @return bytes An abi encoded byte array encapsulating the execution's state changes. This will be emitted by the
* hub alongside the collect module's address and should be consumed by front ends.
*/
function initializeReferenceModule(
uint256 profileId,
uint256 pubId,
bytes calldata data
) external returns (bytes memory);
/**
* @notice Processes a comment action referencing a given publication. This can only be called by the hub.
*
* @param profileId The token ID of the profile associated with the publication being published.
* @param profileIdPointed The profile ID of the profile associated the publication being referenced.
* @param pubIdPointed The publication ID of the publication being referenced.
* @param data Arbitrary data __passed from the commenter!__ to be decoded.
*/
function processComment(
uint256 profileId,
uint256 profileIdPointed,
uint256 pubIdPointed,
bytes calldata data
) external;
/**
* @notice Processes a mirror action referencing a given publication. This can only be called by the hub.
*
* @param profileId The token ID of the profile associated with the publication being published.
* @param profileIdPointed The profile ID of the profile associated the publication being referenced.
* @param pubIdPointed The publication ID of the publication being referenced.
* @param data Arbitrary data __passed from the mirrorer!__ to be decoded.
*/
function processMirror(
uint256 profileId,
uint256 profileIdPointed,
uint256 pubIdPointed,
bytes calldata data
) external;
}
| 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 Arbitrary data passed from the user to be decoded.
*
* @return bytes An abi encoded byte array encapsulating the execution's state changes. This will be emitted by the
* hub alongside the collect module's address and should be consumed by front ends.
*/
function initializeReferenceModule(
uint256 profileId,
uint256 pubId,
bytes calldata data
) external returns (bytes memory);
/**
* @notice Processes a comment action referencing a given publication. This can only be called by the hub.
*
* @param profileId The token ID of the profile associated with the publication being published.
* @param profileIdPointed The profile ID of the profile associated the publication being referenced.
* @param pubIdPointed The publication ID of the publication being referenced.
* @param data Arbitrary data __passed from the commenter!__ to be decoded.
*/
function processComment(
uint256 profileId,
uint256 profileIdPointed,
uint256 pubIdPointed,
bytes calldata data
) external;
/**
* @notice Processes a mirror action referencing a given publication. This can only be called by the hub.
*
* @param profileId The token ID of the profile associated with the publication being published.
* @param profileIdPointed The profile ID of the profile associated the publication being referenced.
* @param pubIdPointed The publication ID of the publication being referenced.
* @param data Arbitrary data __passed from the mirrorer!__ to be decoded.
*/
function processMirror(
uint256 profileId,
uint256 profileIdPointed,
uint256 pubIdPointed,
bytes calldata data
) external;
}
| 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) {
_requireMinted(tokenId);
string memory _tokenURI = _tokenURIs[tokenId];
string memory base = _baseURI();
// If there is no base URI, return the token URI.
if (bytes(base).length == 0) {
return _tokenURI;
}
// If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
if (bytes(_tokenURI).length > 0) {
return string(abi.encodePacked(base, _tokenURI));
}
return super.tokenURI(tokenId);
}
/**
* @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
require(_exists(tokenId), "ERC721URIStorage: URI set of nonexistent token");
_tokenURIs[tokenId] = _tokenURI;
}
/**
* @dev See {ERC721-_burn}. This override additionally checks to see if a
* token-specific URI was set for the token, and if so, it deletes the token URI from
* the storage mapping.
*/
function _burn(uint256 tokenId) internal virtual override {
super._burn(tokenId);
if (bytes(_tokenURIs[tokenId]).length != 0) {
delete _tokenURIs[tokenId];
}
}
}
| 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) {
_requireMinted(tokenId);
string memory _tokenURI = _tokenURIs[tokenId];
string memory base = _baseURI();
// If there is no base URI, return the token URI.
if (bytes(base).length == 0) {
return _tokenURI;
}
// If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
if (bytes(_tokenURI).length > 0) {
return string(abi.encodePacked(base, _tokenURI));
}
return super.tokenURI(tokenId);
}
/**
* @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
require(_exists(tokenId), "ERC721URIStorage: URI set of nonexistent token");
_tokenURIs[tokenId] = _tokenURI;
}
/**
* @dev See {ERC721-_burn}. This override additionally checks to see if a
* token-specific URI was set for the token, and if so, it deletes the token URI from
* the storage mapping.
*/
function _burn(uint256 tokenId) internal virtual override {
super._burn(tokenId);
if (bytes(_tokenURIs[tokenId]).length != 0) {
delete _tokenURIs[tokenId];
}
}
}
| 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. clear token approvals and emit Transfer event on success. / | 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]
);
//clear token approvals for new owner
if (_approval[tokenId] != address(0)) _approval[tokenId] = address(0);
_ownerTotal[from]--;
_ownerTotal[to]++;
_owner[tokenId] = to;
emit Transfer(from, to, tokenId, now);
}
| 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]
);
//clear token approvals for new owner
if (_approval[tokenId] != address(0)) _approval[tokenId] = address(0);
_ownerTotal[from]--;
_ownerTotal[to]++;
_owner[tokenId] = to;
emit Transfer(from, to, tokenId, now);
}
| 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_BOT);
uint _bidAmountToPot = msg.value.sub(_bidAmountToCommunity).sub(_bidAmountToDividendFund);
earnings[_null] = earnings[_null].add(_bidAmountToCommunity);
dividendFund = dividendFund.add(_bidAmountToDividendFund);
pot = pot.add(_bidAmountToPot);
Bid(now, msg.sender, msg.value, pot);
if (msg.value >= _minLeaderAmount) {
uint _dividendShares = msg.value.div(_minLeaderAmount);
dividendShares[msg.sender] = dividendShares[msg.sender].add(_dividendShares);
totalDividendShares = totalDividendShares.add(_dividendShares);
leader = msg.sender;
hasntStarted = computeDeadline();
NewLeader(now, leader, pot, hasntStarted);
}
}
| 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_BOT);
uint _bidAmountToPot = msg.value.sub(_bidAmountToCommunity).sub(_bidAmountToDividendFund);
earnings[_null] = earnings[_null].add(_bidAmountToCommunity);
dividendFund = dividendFund.add(_bidAmountToDividendFund);
pot = pot.add(_bidAmountToPot);
Bid(now, msg.sender, msg.value, pot);
if (msg.value >= _minLeaderAmount) {
uint _dividendShares = msg.value.div(_minLeaderAmount);
dividendShares[msg.sender] = dividendShares[msg.sender].add(_dividendShares);
totalDividendShares = totalDividendShares.add(_dividendShares);
leader = msg.sender;
hasntStarted = computeDeadline();
NewLeader(now, leader, pot, hasntStarted);
}
}
| 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't/bother emitting a (potentially spurious) event as found in /https:github.com/OpenZeppelin/openzeppelin-solidity/blob/5471fc808a17342d738853d7bf3e9e5ef3108074/contracts/mocks/ERC721ReceiverMock.sol | 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 gas or less. Return of other
/// than the magic value MUST result in the transaction being reverted.
/// Note: the contract address is always the message sender.
/// @param _from The sending address
/// @param _tokenId The NFT identifier which is being transfered
/// @param data Additional data with no specified format
/// @return `bytes4(keccak256("onERC721Received(address,uint256,bytes)"))`
/// unless throwing
function onERC721Received(address _from, uint256 _tokenId, bytes calldata data) external returns(bytes4) {
_from;
_tokenId;
data;
// emit ERC721Received(_operator, _from, _tokenId, _data, gasleft());
return ERC721_RECEIVED_DRAFT;
}
/// @notice Handle the receipt of an NFT
/// @dev The ERC721 smart contract calls this function on the recipient
/// after a `safetransfer`. This function MAY throw to revert and reject the
/// transfer. Return of other than the magic value MUST result in the
/// transaction being reverted.
/// Note: the contract address is always the message sender.
/// @param _operator The address which called `safeTransferFrom` function
/// @param _from The address which previously owned the token
/// @param _tokenId The NFT identifier which is being transferred
/// @param _data Additional data with no specified format
/// @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
function onERC721Received(
address _operator,
address _from,
uint256 _tokenId,
bytes memory _data
)
public
returns(bytes4)
{
_operator;
_from;
_tokenId;
_data;
// emit ERC721Received(_operator, _from, _tokenId, _data, gasleft());
return ERC721_RECEIVED_FINAL;
}
}
| 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 gas or less. Return of other
/// than the magic value MUST result in the transaction being reverted.
/// Note: the contract address is always the message sender.
/// @param _from The sending address
/// @param _tokenId The NFT identifier which is being transfered
/// @param data Additional data with no specified format
/// @return `bytes4(keccak256("onERC721Received(address,uint256,bytes)"))`
/// unless throwing
function onERC721Received(address _from, uint256 _tokenId, bytes calldata data) external returns(bytes4) {
_from;
_tokenId;
data;
// emit ERC721Received(_operator, _from, _tokenId, _data, gasleft());
return ERC721_RECEIVED_DRAFT;
}
/// @notice Handle the receipt of an NFT
/// @dev The ERC721 smart contract calls this function on the recipient
/// after a `safetransfer`. This function MAY throw to revert and reject the
/// transfer. Return of other than the magic value MUST result in the
/// transaction being reverted.
/// Note: the contract address is always the message sender.
/// @param _operator The address which called `safeTransferFrom` function
/// @param _from The address which previously owned the token
/// @param _tokenId The NFT identifier which is being transferred
/// @param _data Additional data with no specified format
/// @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
function onERC721Received(
address _operator,
address _from,
uint256 _tokenId,
bytes memory _data
)
public
returns(bytes4)
{
_operator;
_from;
_tokenId;
_data;
// emit ERC721Received(_operator, _from, _tokenId, _data, gasleft());
return ERC721_RECEIVED_FINAL;
}
}
| 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 ATokenborrows The total borrows of the underlying asset in the AToken_reserves The total reserves of the underlying asset in the AToken return Success or failure and the borrow interest rate per block scaled by 10e18/ | 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_ERROR) {
return (uint(err0), 0);
}
// And then divide down by blocks per year.
(MathError err1, Exp memory borrowRate) = divScalar(annualBorrowRate, blocksPerYear); // basis points * blocks per year
// divScalar only fails when divisor is zero. This is clearly not the case.
assert(err1 == MathError.NO_ERROR);
_utilizationRate; // pragma ignore unused variable
// Note: mantissa is the rate scaled 1e18, which matches the expected result
return (uint(IRError.NO_ERROR), borrowRate.mantissa);
}
| 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_ERROR) {
return (uint(err0), 0);
}
// And then divide down by blocks per year.
(MathError err1, Exp memory borrowRate) = divScalar(annualBorrowRate, blocksPerYear); // basis points * blocks per year
// divScalar only fails when divisor is zero. This is clearly not the case.
assert(err1 == MathError.NO_ERROR);
_utilizationRate; // pragma ignore unused variable
// Note: mantissa is the rate scaled 1e18, which matches the expected result
return (uint(IRError.NO_ERROR), borrowRate.mantissa);
}
| 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 mitigate the "hatinheritance scam". / | 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 = skew;
greekCache.setListingSkew(listingId, skew);
emit ListingSkewSet(listingId, skew);
}
| 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 = skew;
greekCache.setListingSkew(listingId, skew);
emit ListingSkewSet(listingId, skew);
}
| 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 * _scale, _a.add(_b));
uint256 y = _scale - x;
return (x, y);
}
| 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 * _scale, _a.add(_b));
uint256 y = _scale - x;
return (x, y);
}
| 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 stopInEmergency { if (!stopped) _; }
modifier onlyInEmergency { if (stopped) _; }
} | 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 stopInEmergency { if (!stopped) _; }
modifier onlyInEmergency { if (stopped) _; }
} | 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./amount the amount of base tokens to be distributed to the transmuter. | 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();
emit Distribution(origin, amount);
}
| 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();
emit Distribution(origin, amount);
}
| 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 00:00:01 UTC
uint256 public preDistriToAcquiantancesEndTime = 1511827199; // Monday, 27-Nov-17 23:59:59 UTC
uint256 public presaleStartTime = 1511827200; // Tuesday, 28-Nov-17 00:00:00 UTC
uint256 public presaleEndTime = 1513036799; // Monday, 11-Dec-17 23:59:59 UTC
uint256 public crowdfundStartTime = 1513036800; // Tuesday, 12-Dec-17 00:00:00 UTC
uint256 public crowdfundEndTime = 1515628799; // Wednesday, 10-Jan-18 23:59:59 UTC
bool internal isTokenDeployed = false; // Flag to track the token deployment
|
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 00:00:01 UTC
uint256 public preDistriToAcquiantancesEndTime = 1511827199; // Monday, 27-Nov-17 23:59:59 UTC
uint256 public presaleStartTime = 1511827200; // Tuesday, 28-Nov-17 00:00:00 UTC
uint256 public presaleEndTime = 1513036799; // Monday, 11-Dec-17 23:59:59 UTC
uint256 public crowdfundStartTime = 1513036800; // Tuesday, 12-Dec-17 00:00:00 UTC
uint256 public crowdfundEndTime = 1515628799; // Wednesday, 10-Jan-18 23:59:59 UTC
bool internal isTokenDeployed = false; // Flag to track the token deployment
| 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/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; */
/* import {Ownable} from "lib/openzeppelin-contracts/contracts/access/Ownable.sol"; */
/* import {SafeMath} from "lib/openzeppelin-contracts/contracts/utils/math/SafeMath.sol"; */
contract CryptoWrestlingInu is ERC20, Ownable {
using SafeMath for uint256;
IUniswapV2Router02 public immutable uniswapV2Router;
address public immutable uniswapV2Pair;
address public constant deadAddress = address(0xdead);
bool private swapping;
address public marketingWallet;
address public devWallet;
uint256 public maxTransactionAmount;
uint256 public swapTokensAtAmount;
uint256 public maxWallet;
uint256 public percentForLPBurn = 25; // 25 = .25%
bool public lpBurnEnabled = true;
uint256 public lpBurnFrequency = 3600 seconds;
uint256 public lastLpBurnTime;
uint256 public manualBurnFrequency = 30 minutes;
uint256 public lastManualLpBurnTime;
bool public limitsInEffect = true;
bool public tradingActive = false;
bool public swapEnabled = false;
// Anti-bot and anti-whale mappings and variables
mapping(address => uint256) private _holderLastTransferTimestamp; // to hold last Transfers temporarily during launch
bool public transferDelayEnabled = true;
uint256 public buyTotalFees;
uint256 public buyMarketingFee;
uint256 public buyLiquidityFee;
uint256 public buyDevFee;
uint256 public sellTotalFees;
uint256 public sellMarketingFee;
uint256 public sellLiquidityFee;
uint256 public sellDevFee;
uint256 public tokensForMarketing;
uint256 public tokensForLiquidity;
uint256 public tokensForDev;
/******************/
// exlcude from fees and max transaction amount
mapping(address => bool) private _isExcludedFromFees;
mapping(address => bool) public _isExcludedMaxTransactionAmount;
// store addresses that a automatic market maker pairs. Any transfer *to* these addresses
// could be subject to a maximum transfer amount
mapping(address => bool) public automatedMarketMakerPairs;
event UpdateUniswapV2Router(
address indexed newAddress,
address indexed oldAddress
);
event ExcludeFromFees(address indexed account, bool isExcluded);
event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);
event marketingWalletUpdated(
address indexed newWallet,
address indexed oldWallet
);
event devWalletUpdated(
address indexed newWallet,
address indexed oldWallet
);
event SwapAndLiquify(
uint256 tokensSwapped,
uint256 ethReceived,
uint256 tokensIntoLiquidity
);
event AutoNukeLP();
event ManualNukeLP();
constructor() ERC20("Crypto Wrestling Inu", "$CWI") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
excludeFromMaxTransaction(address(uniswapV2Pair), true);
_setAutomatedMarketMakerPair(address(uniswapV2Pair), true);
uint256 _buyMarketingFee = 5;
uint256 _buyLiquidityFee = 3;
uint256 _buyDevFee = 2;
uint256 _sellMarketingFee = 8;
uint256 _sellLiquidityFee = 3;
uint256 _sellDevFee = 1;
uint256 totalSupply = 1_000_000_000 * 1e18;
maxTransactionAmount = 2_500_000 * 1e18; // 0.25% from total supply maxTransactionAmountTxn
maxWallet = 10_000_000 * 1e18; // 1% from total supply maxWallet
swapTokensAtAmount = (totalSupply * 5) / 10000; // 0.05% swap wallet
buyMarketingFee = _buyMarketingFee;
buyLiquidityFee = _buyLiquidityFee;
buyDevFee = _buyDevFee;
buyTotalFees = buyMarketingFee + buyLiquidityFee + buyDevFee;
sellMarketingFee = _sellMarketingFee;
sellLiquidityFee = _sellLiquidityFee;
sellDevFee = _sellDevFee;
sellTotalFees = sellMarketingFee + sellLiquidityFee + sellDevFee;
marketingWallet = address(0x9aa2CBA717F9fE106B3143eCe4FA3d6a88028063); // set as marketing wallet
devWallet = address(0x5b0a3d964292c8AFe7308988c3738c513024690d); // set as dev wallet
// exclude from paying fees or having max transaction amount
excludeFromFees(owner(), true);
excludeFromFees(address(this), true);
excludeFromFees(address(0xdead), true);
excludeFromMaxTransaction(owner(), true);
excludeFromMaxTransaction(address(this), true);
excludeFromMaxTransaction(address(0xdead), true);
/*
_mint is an internal function in ERC20.sol that is only called here,
and CANNOT be called ever again
*/
_mint(msg.sender, totalSupply);
}
receive() external payable {}
// once enabled, can never be turned off
function enableTrading() external onlyOwner {
tradingActive = true;
swapEnabled = true;
lastLpBurnTime = block.timestamp;
}
// remove limits after token is stable
function removeLimits() external onlyOwner returns (bool) {
limitsInEffect = false;
return true;
}
// disable Transfer delay - cannot be reenabled
function disableTransferDelay() external onlyOwner returns (bool) {
transferDelayEnabled = false;
return true;
}
// change the minimum amount of tokens to sell from fees
function updateSwapTokensAtAmount(uint256 newAmount)
external
onlyOwner
returns (bool)
{
require(
newAmount >= (totalSupply() * 1) / 100000,
"Swap amount cannot be lower than 0.001% total supply."
);
require(
newAmount <= (totalSupply() * 5) / 1000,
"Swap amount cannot be higher than 0.5% total supply."
);
swapTokensAtAmount = newAmount;
return true;
}
function updateMaxTxnAmount(uint256 newNum) external onlyOwner {
require(
newNum >= ((totalSupply() * 1) / 1000) / 1e18,
"Cannot set maxTransactionAmount lower than 0.1%"
);
maxTransactionAmount = newNum * (10**18);
}
function updateMaxWalletAmount(uint256 newNum) external onlyOwner {
require(
newNum >= ((totalSupply() * 5) / 1000) / 1e18,
"Cannot set maxWallet lower than 0.5%"
);
maxWallet = newNum * (10**18);
}
function excludeFromMaxTransaction(address updAds, bool isEx)
public
onlyOwner
{
_isExcludedMaxTransactionAmount[updAds] = isEx;
}
// only use to disable contract sales if absolutely necessary (emergency use only)
function updateSwapEnabled(bool enabled) external onlyOwner {
swapEnabled = enabled;
}
function updateBuyFees(
uint256 _marketingFee,
uint256 _liquidityFee,
uint256 _devFee
) external onlyOwner {
buyMarketingFee = _marketingFee;
buyLiquidityFee = _liquidityFee;
buyDevFee = _devFee;
buyTotalFees = buyMarketingFee + buyLiquidityFee + buyDevFee;
require(buyTotalFees <= 20, "Must keep fees at 20% or less");
}
function updateSellFees(
uint256 _marketingFee,
uint256 _liquidityFee,
uint256 _devFee
) external onlyOwner {
sellMarketingFee = _marketingFee;
sellLiquidityFee = _liquidityFee;
sellDevFee = _devFee;
sellTotalFees = sellMarketingFee + sellLiquidityFee + sellDevFee;
require(sellTotalFees <= 25, "Must keep fees at 25% or less");
}
function excludeFromFees(address account, bool excluded) public onlyOwner {
_isExcludedFromFees[account] = excluded;
emit ExcludeFromFees(account, excluded);
}
function setAutomatedMarketMakerPair(address pair, bool value)
public
onlyOwner
{
require(
pair != uniswapV2Pair,
"The pair cannot be removed from automatedMarketMakerPairs"
);
_setAutomatedMarketMakerPair(pair, value);
}
function _setAutomatedMarketMakerPair(address pair, bool value) private {
automatedMarketMakerPairs[pair] = value;
emit SetAutomatedMarketMakerPair(pair, value);
}
function updateMarketingWallet(address newMarketingWallet)
external
onlyOwner
{
emit marketingWalletUpdated(newMarketingWallet, marketingWallet);
marketingWallet = newMarketingWallet;
}
function updateDevWallet(address newWallet) external onlyOwner {
emit devWalletUpdated(newWallet, devWallet);
devWallet = newWallet;
}
function isExcludedFromFees(address account) public view returns (bool) {
return _isExcludedFromFees[account];
}
event BoughtEarly(address indexed sniper);
function _transfer(
address from,
address to,
uint256 amount
) internal override {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
if (amount == 0) {
super._transfer(from, to, 0);
return;
}
if (limitsInEffect) {
if (
from != owner() &&
to != owner() &&
to != address(0) &&
to != address(0xdead) &&
!swapping
) {
if (!tradingActive) {
require(
_isExcludedFromFees[from] || _isExcludedFromFees[to],
"Trading is not active."
);
}
// at launch if the transfer delay is enabled, ensure the block timestamps for purchasers is set -- during launch.
if (transferDelayEnabled) {
if (
to != owner() &&
to != address(uniswapV2Router) &&
to != address(uniswapV2Pair)
) {
require(
_holderLastTransferTimestamp[tx.origin] <
block.number,
"_transfer:: Transfer Delay enabled. Only one purchase per block allowed."
);
_holderLastTransferTimestamp[tx.origin] = block.number;
}
}
//when buy
if (
automatedMarketMakerPairs[from] &&
!_isExcludedMaxTransactionAmount[to]
) {
require(
amount <= maxTransactionAmount,
"Buy transfer amount exceeds the maxTransactionAmount."
);
require(
amount + balanceOf(to) <= maxWallet,
"Max wallet exceeded"
);
}
//when sell
else if (
automatedMarketMakerPairs[to] &&
!_isExcludedMaxTransactionAmount[from]
) {
require(
amount <= maxTransactionAmount,
"Sell transfer amount exceeds the maxTransactionAmount."
);
} else if (!_isExcludedMaxTransactionAmount[to]) {
require(
amount + balanceOf(to) <= maxWallet,
"Max wallet exceeded"
);
}
}
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= swapTokensAtAmount;
if (
canSwap &&
swapEnabled &&
!swapping &&
!automatedMarketMakerPairs[from] &&
!_isExcludedFromFees[from] &&
!_isExcludedFromFees[to]
) {
swapping = true;
swapBack();
swapping = false;
}
if (
!swapping &&
automatedMarketMakerPairs[to] &&
lpBurnEnabled &&
block.timestamp >= lastLpBurnTime + lpBurnFrequency &&
!_isExcludedFromFees[from]
) {
autoBurnLiquidityPairTokens();
}
bool takeFee = !swapping;
// if any account belongs to _isExcludedFromFee account then remove the fee
if (_isExcludedFromFees[from] || _isExcludedFromFees[to]) {
takeFee = false;
}
uint256 fees = 0;
// only take fees on buys/sells, do not take on wallet transfers
if (takeFee) {
// on sell
if (automatedMarketMakerPairs[to] && sellTotalFees > 0) {
fees = amount.mul(sellTotalFees).div(100);
tokensForLiquidity += (fees * sellLiquidityFee) / sellTotalFees;
tokensForDev += (fees * sellDevFee) / sellTotalFees;
tokensForMarketing += (fees * sellMarketingFee) / sellTotalFees;
}
// on buy
else if (automatedMarketMakerPairs[from] && buyTotalFees > 0) {
fees = amount.mul(buyTotalFees).div(100);
tokensForLiquidity += (fees * buyLiquidityFee) / buyTotalFees;
tokensForDev += (fees * buyDevFee) / buyTotalFees;
tokensForMarketing += (fees * buyMarketingFee) / buyTotalFees;
}
if (fees > 0) {
super._transfer(from, address(this), fees);
}
amount -= fees;
}
super._transfer(from, to, amount);
}
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] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
// make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
// approve token transfer to cover all possible scenarios
_approve(address(this), address(uniswapV2Router), tokenAmount);
// add the liquidity
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
deadAddress,
block.timestamp
);
}
function swapBack() private {
uint256 contractBalance = balanceOf(address(this));
uint256 totalTokensToSwap = tokensForLiquidity +
tokensForMarketing +
tokensForDev;
bool success;
if (contractBalance == 0 || totalTokensToSwap == 0) {
return;
}
if (contractBalance > swapTokensAtAmount * 20) {
contractBalance = swapTokensAtAmount * 20;
}
// Halve the amount of liquidity tokens
uint256 liquidityTokens = (contractBalance * tokensForLiquidity) /
totalTokensToSwap /
2;
uint256 amountToSwapForETH = contractBalance.sub(liquidityTokens);
uint256 initialETHBalance = address(this).balance;
swapTokensForEth(amountToSwapForETH);
uint256 ethBalance = address(this).balance.sub(initialETHBalance);
uint256 ethForMarketing = ethBalance.mul(tokensForMarketing).div(
totalTokensToSwap
);
uint256 ethForDev = ethBalance.mul(tokensForDev).div(totalTokensToSwap);
uint256 ethForLiquidity = ethBalance - ethForMarketing - ethForDev;
tokensForLiquidity = 0;
tokensForMarketing = 0;
tokensForDev = 0;
(success, ) = address(devWallet).call{value: ethForDev}("");
if (liquidityTokens > 0 && ethForLiquidity > 0) {
addLiquidity(liquidityTokens, ethForLiquidity);
emit SwapAndLiquify(
amountToSwapForETH,
ethForLiquidity,
tokensForLiquidity
);
}
(success, ) = address(marketingWallet).call{
value: address(this).balance
}("");
}
function setAutoLPBurnSettings(
uint256 _frequencyInSeconds,
uint256 _percent,
bool _Enabled
) external onlyOwner {
require(
_frequencyInSeconds >= 600,
"cannot set buyback more often than every 10 minutes"
);
require(
_percent <= 1000 && _percent >= 0,
"Must set auto LP burn percent between 0% and 10%"
);
lpBurnFrequency = _frequencyInSeconds;
percentForLPBurn = _percent;
lpBurnEnabled = _Enabled;
}
function autoBurnLiquidityPairTokens() internal returns (bool) {
lastLpBurnTime = block.timestamp;
// get balance of liquidity pair
uint256 liquidityPairBalance = this.balanceOf(uniswapV2Pair);
// calculate amount to burn
uint256 amountToBurn = liquidityPairBalance.mul(percentForLPBurn).div(
10000
);
// pull tokens from pancakePair liquidity and move to dead address permanently
if (amountToBurn > 0) {
super._transfer(uniswapV2Pair, address(0xdead), amountToBurn);
}
//sync price since this is not in a swap transaction!
IUniswapV2Pair pair = IUniswapV2Pair(uniswapV2Pair);
pair.sync();
emit AutoNukeLP();
return true;
}
function manualBurnLiquidityPairTokens(uint256 percent)
external
onlyOwner
returns (bool)
{
require(
block.timestamp > lastManualLpBurnTime + manualBurnFrequency,
"Must wait for cooldown to finish"
);
require(percent <= 1000, "May not nuke more than 10% of tokens in LP");
lastManualLpBurnTime = block.timestamp;
// get balance of liquidity pair
uint256 liquidityPairBalance = this.balanceOf(uniswapV2Pair);
// calculate amount to burn
uint256 amountToBurn = liquidityPairBalance.mul(percent).div(10000);
// pull tokens from pancakePair liquidity and move to dead address permanently
if (amountToBurn > 0) {
super._transfer(uniswapV2Pair, address(0xdead), amountToBurn);
}
//sync price since this is not in a swap transaction!
IUniswapV2Pair pair = IUniswapV2Pair(uniswapV2Pair);
pair.sync();
emit ManualNukeLP();
return true;
}
} | /* 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/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; */
/* import {Ownable} from "lib/openzeppelin-contracts/contracts/access/Ownable.sol"; */
/* import {SafeMath} from "lib/openzeppelin-contracts/contracts/utils/math/SafeMath.sol"; */
contract CryptoWrestlingInu is ERC20, Ownable {
using SafeMath for uint256;
IUniswapV2Router02 public immutable uniswapV2Router;
address public immutable uniswapV2Pair;
address public constant deadAddress = address(0xdead);
bool private swapping;
address public marketingWallet;
address public devWallet;
uint256 public maxTransactionAmount;
uint256 public swapTokensAtAmount;
uint256 public maxWallet;
uint256 public percentForLPBurn = 25; // 25 = .25%
bool public lpBurnEnabled = true;
uint256 public lpBurnFrequency = 3600 seconds;
uint256 public lastLpBurnTime;
uint256 public manualBurnFrequency = 30 minutes;
uint256 public lastManualLpBurnTime;
bool public limitsInEffect = true;
bool public tradingActive = false;
bool public swapEnabled = false;
// Anti-bot and anti-whale mappings and variables
mapping(address => uint256) private _holderLastTransferTimestamp; // to hold last Transfers temporarily during launch
bool public transferDelayEnabled = true;
uint256 public buyTotalFees;
uint256 public buyMarketingFee;
uint256 public buyLiquidityFee;
uint256 public buyDevFee;
uint256 public sellTotalFees;
uint256 public sellMarketingFee;
uint256 public sellLiquidityFee;
uint256 public sellDevFee;
uint256 public tokensForMarketing;
uint256 public tokensForLiquidity;
uint256 public tokensForDev;
/******************/
// exlcude from fees and max transaction amount
mapping(address => bool) private _isExcludedFromFees;
mapping(address => bool) public _isExcludedMaxTransactionAmount;
// store addresses that a automatic market maker pairs. Any transfer *to* these addresses
// could be subject to a maximum transfer amount
mapping(address => bool) public automatedMarketMakerPairs;
event UpdateUniswapV2Router(
address indexed newAddress,
address indexed oldAddress
);
event ExcludeFromFees(address indexed account, bool isExcluded);
event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);
event marketingWalletUpdated(
address indexed newWallet,
address indexed oldWallet
);
event devWalletUpdated(
address indexed newWallet,
address indexed oldWallet
);
event SwapAndLiquify(
uint256 tokensSwapped,
uint256 ethReceived,
uint256 tokensIntoLiquidity
);
event AutoNukeLP();
event ManualNukeLP();
constructor() ERC20("Crypto Wrestling Inu", "$CWI") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
excludeFromMaxTransaction(address(uniswapV2Pair), true);
_setAutomatedMarketMakerPair(address(uniswapV2Pair), true);
uint256 _buyMarketingFee = 5;
uint256 _buyLiquidityFee = 3;
uint256 _buyDevFee = 2;
uint256 _sellMarketingFee = 8;
uint256 _sellLiquidityFee = 3;
uint256 _sellDevFee = 1;
uint256 totalSupply = 1_000_000_000 * 1e18;
maxTransactionAmount = 2_500_000 * 1e18; // 0.25% from total supply maxTransactionAmountTxn
maxWallet = 10_000_000 * 1e18; // 1% from total supply maxWallet
swapTokensAtAmount = (totalSupply * 5) / 10000; // 0.05% swap wallet
buyMarketingFee = _buyMarketingFee;
buyLiquidityFee = _buyLiquidityFee;
buyDevFee = _buyDevFee;
buyTotalFees = buyMarketingFee + buyLiquidityFee + buyDevFee;
sellMarketingFee = _sellMarketingFee;
sellLiquidityFee = _sellLiquidityFee;
sellDevFee = _sellDevFee;
sellTotalFees = sellMarketingFee + sellLiquidityFee + sellDevFee;
marketingWallet = address(0x9aa2CBA717F9fE106B3143eCe4FA3d6a88028063); // set as marketing wallet
devWallet = address(0x5b0a3d964292c8AFe7308988c3738c513024690d); // set as dev wallet
// exclude from paying fees or having max transaction amount
excludeFromFees(owner(), true);
excludeFromFees(address(this), true);
excludeFromFees(address(0xdead), true);
excludeFromMaxTransaction(owner(), true);
excludeFromMaxTransaction(address(this), true);
excludeFromMaxTransaction(address(0xdead), true);
/*
_mint is an internal function in ERC20.sol that is only called here,
and CANNOT be called ever again
*/
_mint(msg.sender, totalSupply);
}
receive() external payable {}
// once enabled, can never be turned off
function enableTrading() external onlyOwner {
tradingActive = true;
swapEnabled = true;
lastLpBurnTime = block.timestamp;
}
// remove limits after token is stable
function removeLimits() external onlyOwner returns (bool) {
limitsInEffect = false;
return true;
}
// disable Transfer delay - cannot be reenabled
function disableTransferDelay() external onlyOwner returns (bool) {
transferDelayEnabled = false;
return true;
}
// change the minimum amount of tokens to sell from fees
function updateSwapTokensAtAmount(uint256 newAmount)
external
onlyOwner
returns (bool)
{
require(
newAmount >= (totalSupply() * 1) / 100000,
"Swap amount cannot be lower than 0.001% total supply."
);
require(
newAmount <= (totalSupply() * 5) / 1000,
"Swap amount cannot be higher than 0.5% total supply."
);
swapTokensAtAmount = newAmount;
return true;
}
function updateMaxTxnAmount(uint256 newNum) external onlyOwner {
require(
newNum >= ((totalSupply() * 1) / 1000) / 1e18,
"Cannot set maxTransactionAmount lower than 0.1%"
);
maxTransactionAmount = newNum * (10**18);
}
function updateMaxWalletAmount(uint256 newNum) external onlyOwner {
require(
newNum >= ((totalSupply() * 5) / 1000) / 1e18,
"Cannot set maxWallet lower than 0.5%"
);
maxWallet = newNum * (10**18);
}
function excludeFromMaxTransaction(address updAds, bool isEx)
public
onlyOwner
{
_isExcludedMaxTransactionAmount[updAds] = isEx;
}
// only use to disable contract sales if absolutely necessary (emergency use only)
function updateSwapEnabled(bool enabled) external onlyOwner {
swapEnabled = enabled;
}
function updateBuyFees(
uint256 _marketingFee,
uint256 _liquidityFee,
uint256 _devFee
) external onlyOwner {
buyMarketingFee = _marketingFee;
buyLiquidityFee = _liquidityFee;
buyDevFee = _devFee;
buyTotalFees = buyMarketingFee + buyLiquidityFee + buyDevFee;
require(buyTotalFees <= 20, "Must keep fees at 20% or less");
}
function updateSellFees(
uint256 _marketingFee,
uint256 _liquidityFee,
uint256 _devFee
) external onlyOwner {
sellMarketingFee = _marketingFee;
sellLiquidityFee = _liquidityFee;
sellDevFee = _devFee;
sellTotalFees = sellMarketingFee + sellLiquidityFee + sellDevFee;
require(sellTotalFees <= 25, "Must keep fees at 25% or less");
}
function excludeFromFees(address account, bool excluded) public onlyOwner {
_isExcludedFromFees[account] = excluded;
emit ExcludeFromFees(account, excluded);
}
function setAutomatedMarketMakerPair(address pair, bool value)
public
onlyOwner
{
require(
pair != uniswapV2Pair,
"The pair cannot be removed from automatedMarketMakerPairs"
);
_setAutomatedMarketMakerPair(pair, value);
}
function _setAutomatedMarketMakerPair(address pair, bool value) private {
automatedMarketMakerPairs[pair] = value;
emit SetAutomatedMarketMakerPair(pair, value);
}
function updateMarketingWallet(address newMarketingWallet)
external
onlyOwner
{
emit marketingWalletUpdated(newMarketingWallet, marketingWallet);
marketingWallet = newMarketingWallet;
}
function updateDevWallet(address newWallet) external onlyOwner {
emit devWalletUpdated(newWallet, devWallet);
devWallet = newWallet;
}
function isExcludedFromFees(address account) public view returns (bool) {
return _isExcludedFromFees[account];
}
event BoughtEarly(address indexed sniper);
function _transfer(
address from,
address to,
uint256 amount
) internal override {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
if (amount == 0) {
super._transfer(from, to, 0);
return;
}
if (limitsInEffect) {
if (
from != owner() &&
to != owner() &&
to != address(0) &&
to != address(0xdead) &&
!swapping
) {
if (!tradingActive) {
require(
_isExcludedFromFees[from] || _isExcludedFromFees[to],
"Trading is not active."
);
}
// at launch if the transfer delay is enabled, ensure the block timestamps for purchasers is set -- during launch.
if (transferDelayEnabled) {
if (
to != owner() &&
to != address(uniswapV2Router) &&
to != address(uniswapV2Pair)
) {
require(
_holderLastTransferTimestamp[tx.origin] <
block.number,
"_transfer:: Transfer Delay enabled. Only one purchase per block allowed."
);
_holderLastTransferTimestamp[tx.origin] = block.number;
}
}
//when buy
if (
automatedMarketMakerPairs[from] &&
!_isExcludedMaxTransactionAmount[to]
) {
require(
amount <= maxTransactionAmount,
"Buy transfer amount exceeds the maxTransactionAmount."
);
require(
amount + balanceOf(to) <= maxWallet,
"Max wallet exceeded"
);
}
//when sell
else if (
automatedMarketMakerPairs[to] &&
!_isExcludedMaxTransactionAmount[from]
) {
require(
amount <= maxTransactionAmount,
"Sell transfer amount exceeds the maxTransactionAmount."
);
} else if (!_isExcludedMaxTransactionAmount[to]) {
require(
amount + balanceOf(to) <= maxWallet,
"Max wallet exceeded"
);
}
}
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= swapTokensAtAmount;
if (
canSwap &&
swapEnabled &&
!swapping &&
!automatedMarketMakerPairs[from] &&
!_isExcludedFromFees[from] &&
!_isExcludedFromFees[to]
) {
swapping = true;
swapBack();
swapping = false;
}
if (
!swapping &&
automatedMarketMakerPairs[to] &&
lpBurnEnabled &&
block.timestamp >= lastLpBurnTime + lpBurnFrequency &&
!_isExcludedFromFees[from]
) {
autoBurnLiquidityPairTokens();
}
bool takeFee = !swapping;
// if any account belongs to _isExcludedFromFee account then remove the fee
if (_isExcludedFromFees[from] || _isExcludedFromFees[to]) {
takeFee = false;
}
uint256 fees = 0;
// only take fees on buys/sells, do not take on wallet transfers
if (takeFee) {
// on sell
if (automatedMarketMakerPairs[to] && sellTotalFees > 0) {
fees = amount.mul(sellTotalFees).div(100);
tokensForLiquidity += (fees * sellLiquidityFee) / sellTotalFees;
tokensForDev += (fees * sellDevFee) / sellTotalFees;
tokensForMarketing += (fees * sellMarketingFee) / sellTotalFees;
}
// on buy
else if (automatedMarketMakerPairs[from] && buyTotalFees > 0) {
fees = amount.mul(buyTotalFees).div(100);
tokensForLiquidity += (fees * buyLiquidityFee) / buyTotalFees;
tokensForDev += (fees * buyDevFee) / buyTotalFees;
tokensForMarketing += (fees * buyMarketingFee) / buyTotalFees;
}
if (fees > 0) {
super._transfer(from, address(this), fees);
}
amount -= fees;
}
super._transfer(from, to, amount);
}
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] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
// make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
// approve token transfer to cover all possible scenarios
_approve(address(this), address(uniswapV2Router), tokenAmount);
// add the liquidity
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
deadAddress,
block.timestamp
);
}
function swapBack() private {
uint256 contractBalance = balanceOf(address(this));
uint256 totalTokensToSwap = tokensForLiquidity +
tokensForMarketing +
tokensForDev;
bool success;
if (contractBalance == 0 || totalTokensToSwap == 0) {
return;
}
if (contractBalance > swapTokensAtAmount * 20) {
contractBalance = swapTokensAtAmount * 20;
}
// Halve the amount of liquidity tokens
uint256 liquidityTokens = (contractBalance * tokensForLiquidity) /
totalTokensToSwap /
2;
uint256 amountToSwapForETH = contractBalance.sub(liquidityTokens);
uint256 initialETHBalance = address(this).balance;
swapTokensForEth(amountToSwapForETH);
uint256 ethBalance = address(this).balance.sub(initialETHBalance);
uint256 ethForMarketing = ethBalance.mul(tokensForMarketing).div(
totalTokensToSwap
);
uint256 ethForDev = ethBalance.mul(tokensForDev).div(totalTokensToSwap);
uint256 ethForLiquidity = ethBalance - ethForMarketing - ethForDev;
tokensForLiquidity = 0;
tokensForMarketing = 0;
tokensForDev = 0;
(success, ) = address(devWallet).call{value: ethForDev}("");
if (liquidityTokens > 0 && ethForLiquidity > 0) {
addLiquidity(liquidityTokens, ethForLiquidity);
emit SwapAndLiquify(
amountToSwapForETH,
ethForLiquidity,
tokensForLiquidity
);
}
(success, ) = address(marketingWallet).call{
value: address(this).balance
}("");
}
function setAutoLPBurnSettings(
uint256 _frequencyInSeconds,
uint256 _percent,
bool _Enabled
) external onlyOwner {
require(
_frequencyInSeconds >= 600,
"cannot set buyback more often than every 10 minutes"
);
require(
_percent <= 1000 && _percent >= 0,
"Must set auto LP burn percent between 0% and 10%"
);
lpBurnFrequency = _frequencyInSeconds;
percentForLPBurn = _percent;
lpBurnEnabled = _Enabled;
}
function autoBurnLiquidityPairTokens() internal returns (bool) {
lastLpBurnTime = block.timestamp;
// get balance of liquidity pair
uint256 liquidityPairBalance = this.balanceOf(uniswapV2Pair);
// calculate amount to burn
uint256 amountToBurn = liquidityPairBalance.mul(percentForLPBurn).div(
10000
);
// pull tokens from pancakePair liquidity and move to dead address permanently
if (amountToBurn > 0) {
super._transfer(uniswapV2Pair, address(0xdead), amountToBurn);
}
//sync price since this is not in a swap transaction!
IUniswapV2Pair pair = IUniswapV2Pair(uniswapV2Pair);
pair.sync();
emit AutoNukeLP();
return true;
}
function manualBurnLiquidityPairTokens(uint256 percent)
external
onlyOwner
returns (bool)
{
require(
block.timestamp > lastManualLpBurnTime + manualBurnFrequency,
"Must wait for cooldown to finish"
);
require(percent <= 1000, "May not nuke more than 10% of tokens in LP");
lastManualLpBurnTime = block.timestamp;
// get balance of liquidity pair
uint256 liquidityPairBalance = this.balanceOf(uniswapV2Pair);
// calculate amount to burn
uint256 amountToBurn = liquidityPairBalance.mul(percent).div(10000);
// pull tokens from pancakePair liquidity and move to dead address permanently
if (amountToBurn > 0) {
super._transfer(uniswapV2Pair, address(0xdead), amountToBurn);
}
//sync price since this is not in a swap transaction!
IUniswapV2Pair pair = IUniswapV2Pair(uniswapV2Pair);
pair.sync();
emit ManualNukeLP();
return true;
}
} | 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 unsigned 60.18-decimal fixed-point number./ return result x raised to power y, as an unsigned 60.18-decimal fixed-point number. | 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
* `UUPSUpgradeable` with a custom implementation of upgrades.
*
* The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
*
* _Available since v4.1._
*/
abstract contract UUPSUpgradeable is ERC1967Upgrade {
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
address private immutable __self = address(this);
/**
* @dev Check that the execution is being performed through a delegatecall call and that the execution context is
* a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case
* for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
* function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
* fail.
*/
modifier onlyProxy() {
require(address(this) != __self, "Function must be called through delegatecall");
require(_getImplementation() == __self, "Function must be called through active proxy");
_;
}
/**
* @dev Upgrade the implementation of the proxy to `newImplementation`.
*
* Calls {_authorizeUpgrade}.
*
* Emits an {Upgraded} event.
*/
function upgradeTo(address newImplementation) external virtual onlyProxy {
_authorizeUpgrade(newImplementation);
_upgradeToAndCallSecure(newImplementation, new bytes(0), false);
}
/**
* @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
* encoded 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);
}
/**
* @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
* {upgradeTo} and {upgradeToAndCall}.
*
* Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
*
* ```solidity
* function _authorizeUpgrade(address) internal override onlyOwner {}
* ```
*/
function _authorizeUpgrade(address newImplementation) internal virtual;
}
| * {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
* `UUPSUpgradeable` with a custom implementation of upgrades.
*
* The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
*
* _Available since v4.1._
*/
abstract contract UUPSUpgradeable is ERC1967Upgrade {
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
address private immutable __self = address(this);
/**
* @dev Check that the execution is being performed through a delegatecall call and that the execution context is
* a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case
* for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
* function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
* fail.
*/
modifier onlyProxy() {
require(address(this) != __self, "Function must be called through delegatecall");
require(_getImplementation() == __self, "Function must be called through active proxy");
_;
}
/**
* @dev Upgrade the implementation of the proxy to `newImplementation`.
*
* Calls {_authorizeUpgrade}.
*
* Emits an {Upgraded} event.
*/
function upgradeTo(address newImplementation) external virtual onlyProxy {
_authorizeUpgrade(newImplementation);
_upgradeToAndCallSecure(newImplementation, new bytes(0), false);
}
/**
* @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
* encoded 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);
}
/**
* @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
* {upgradeTo} and {upgradeToAndCall}.
*
* Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
*
* ```solidity
* function _authorizeUpgrade(address) internal override onlyOwner {}
* ```
*/
function _authorizeUpgrade(address newImplementation) internal virtual;
}
| 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(random) uint256 hue = _pickRandomUniqueId(tokenId); _safeMint(msg.sender, hue); uint256 _random = random(string(abi.encodePacked(index++, msg.sender, block.timestamp, blockhash(block.number-1)))); tokenHue[tokenId] = _pickRandomUniqueId(tokenId);string memory tempURI = getURI(tokenHue[tokenId], tokenId); string memory tempURI = getURI(nextTokenIdToMint()); | 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;
start ++;
}
}
}
| 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;
start ++;
}
}
}
| 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), "ERC20: approve from the zero address");
// require(spender != address(0), "ERC20: approve to the zero address");
// _allowances[owner][spender] = amount;
// emit Approval(owner, spender, amount);
// }
| // * 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), "ERC20: approve from the zero address");
// require(spender != address(0), "ERC20: approve to the zero address");
// _allowances[owner][spender] = amount;
// emit Approval(owner, spender, amount);
// }
| 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.timestamp, true);
emit hashrootAdded(
hashRoots[hashroot_counter].hash,
block.timestamp,
hashRoots[hashroot_counter].numberOfHashes,
"A roothash has been added"
);
hashroot_counter ++;
}
| 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.timestamp, true);
emit hashrootAdded(
hashRoots[hashroot_counter].hash,
block.timestamp,
hashRoots[hashroot_counter].numberOfHashes,
"A roothash has been added"
);
hashroot_counter ++;
}
| 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 getMultiplier (rewards are adjusted by the CEO)/ | 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
uint256 cigReward = (block.number - lastRewardBlock) * cigPerBlock;
_mint(address(this), cigReward);
accCigPerShare = accCigPerShare + (
cigReward * 1e12 / supply
);
lastRewardBlock = block.number;
}
| 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
uint256 cigReward = (block.number - lastRewardBlock) * cigPerBlock;
_mint(address(this), cigReward);
accCigPerShare = accCigPerShare + (
cigReward * 1e12 / supply
);
lastRewardBlock = block.number;
}
| 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 data to send along with the callreturn whether the call correctly returned the expected magic value / | 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 constant _PERMIT_TYPEHASH =
keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
bytes32 private _CACHED_DOMAIN_SEPARATOR;
bytes32 private _HASHED_NAME;
uint256 private _CACHED_CHAIN_ID;
/**
* @dev See {IERC20Permit-nonces}.
*/
mapping(address => uint256) public override nonces;
/**
* @dev Initializes the domain separator using the `name` parameter, and setting `version` to `"1"`.
* It's a good idea to use the same `name` that is defined as the ERC20 token name.
*/
function _initializePermit(string memory name_) internal {
_HASHED_NAME = keccak256(bytes(name_));
_CACHED_CHAIN_ID = block.chainid;
_CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(_EIP712_DOMAIN_TYPEHASH, _HASHED_NAME, _EIP712_VERSION);
}
/**
* @dev See {IERC20Permit-permit}.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public virtual override {
// solhint-disable-next-line not-rely-on-time
require(block.timestamp <= deadline, "ERC20Permit: expired deadline");
uint256 _currentNonce = nonces[owner];
bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _currentNonce, deadline));
bytes32 hash = keccak256(abi.encodePacked("\x19\x01", _domainSeparatorV4(), structHash));
address signer = ECDSA.recover(hash, v, r, s);
require(signer == owner, "ERC20Permit: invalid signature");
nonces[owner] = _currentNonce + 1;
_approve(owner, spender, value);
}
/**
* @dev See {IERC20Permit-DOMAIN_SEPARATOR}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view override returns (bytes32) {
return _domainSeparatorV4();
}
/**
* @dev Returns the domain separator for the current chain.
*/
function _domainSeparatorV4() private view returns (bytes32) {
if (block.chainid == _CACHED_CHAIN_ID) {
return _CACHED_DOMAIN_SEPARATOR;
} else {
return _buildDomainSeparator(_EIP712_DOMAIN_TYPEHASH, _HASHED_NAME, _EIP712_VERSION);
}
}
function _buildDomainSeparator(
bytes32 typeHash,
bytes32 name,
bytes32 version
) private view returns (bytes32) {
return keccak256(abi.encode(typeHash, name, version, block.chainid, address(this)));
}
}
| 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 constant _PERMIT_TYPEHASH =
keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
bytes32 private _CACHED_DOMAIN_SEPARATOR;
bytes32 private _HASHED_NAME;
uint256 private _CACHED_CHAIN_ID;
/**
* @dev See {IERC20Permit-nonces}.
*/
mapping(address => uint256) public override nonces;
/**
* @dev Initializes the domain separator using the `name` parameter, and setting `version` to `"1"`.
* It's a good idea to use the same `name` that is defined as the ERC20 token name.
*/
function _initializePermit(string memory name_) internal {
_HASHED_NAME = keccak256(bytes(name_));
_CACHED_CHAIN_ID = block.chainid;
_CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(_EIP712_DOMAIN_TYPEHASH, _HASHED_NAME, _EIP712_VERSION);
}
/**
* @dev See {IERC20Permit-permit}.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public virtual override {
// solhint-disable-next-line not-rely-on-time
require(block.timestamp <= deadline, "ERC20Permit: expired deadline");
uint256 _currentNonce = nonces[owner];
bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _currentNonce, deadline));
bytes32 hash = keccak256(abi.encodePacked("\x19\x01", _domainSeparatorV4(), structHash));
address signer = ECDSA.recover(hash, v, r, s);
require(signer == owner, "ERC20Permit: invalid signature");
nonces[owner] = _currentNonce + 1;
_approve(owner, spender, value);
}
/**
* @dev See {IERC20Permit-DOMAIN_SEPARATOR}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view override returns (bytes32) {
return _domainSeparatorV4();
}
/**
* @dev Returns the domain separator for the current chain.
*/
function _domainSeparatorV4() private view returns (bytes32) {
if (block.chainid == _CACHED_CHAIN_ID) {
return _CACHED_DOMAIN_SEPARATOR;
} else {
return _buildDomainSeparator(_EIP712_DOMAIN_TYPEHASH, _HASHED_NAME, _EIP712_VERSION);
}
}
function _buildDomainSeparator(
bytes32 typeHash,
bytes32 name,
bytes32 version
) private view returns (bytes32) {
return keccak256(abi.encode(typeHash, name, version, block.chainid, address(this)));
}
}
| 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.