file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// Author: Nick Mudge <nick@perfectabstractions.com>
// Perfect Abstractions LLC
pragma solidity 0.4.24;
interface ERC721TokenReceiver {
/// @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 t... | prevents 32 bit overflowWas enough ether passed in?send minter the change if any | function mint(address _tokenOwner, string _mokenName, bytes32 _linkHash) external payable returns (uint256 tokenId) {
require(_tokenOwner != address(0), "Owner cannot be the 0 address.");
tokenId = mokensLength++;
require(tokenId < MAX_MOKENS, "Only 4,294,967,296 mokens can be created.");
... | 74,625 |
pragma solidity ^0.4.23;
// From OpenZeppelin
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() pu... | you can claim a refund 24h after main sale ended token.burn(msg.sender, token.balanceOf(msg.sender)); totalICO = totalICO.sub(token.balanceOf(msg.sender)); | function refundUnconfirmed() public{
require(now > endIcoMainSale + 24*60*60);
require(balances[msg.sender] > 0);
require(token.GetPermissionsList(msg.sender) == 1);
uint value = balances[msg.sender];
balances[msg.sender] = 0;
msg.sender.transfer(value);
uint uvalue = unconfirmedSumAddr[ms... | 1,625,450 |
./full_match/11155111/0x23e3Ce582115FeAc7B72CFf6a918F391efDB5477/sources/contracts/Vault.sol | the governance controlling this function should have a timelock | function upgradeVault(address _newVault, address _token, uint256 _amount) external {
_onlyGov();
IERC20(_token).safeTransfer(_newVault, _amount);
}
| 3,795,026 |
./partial_match/42220/0x1EC3366D384ee7996F2F70B67A65C5d54Ce96040/sources/home/eruiz/Projects/celo/celo-monorepo/packages/protocol/contracts/identity/Attestations.sol | Updates 'selectIssuersWaitBlocks'. _selectIssuersWaitBlocks The wait period in blocks to call selectIssuers on attestation requests./ | function setSelectIssuersWaitBlocks(uint256 _selectIssuersWaitBlocks) public onlyOwner {
require(_selectIssuersWaitBlocks > 0, "selectIssuersWaitBlocks has to be greater than 0");
selectIssuersWaitBlocks = _selectIssuersWaitBlocks;
emit SelectIssuersWaitBlocksSet(_selectIssuersWaitBlocks);
}
| 3,499,755 |
./full_match/44787/0xDad08208984F31f8895780592dC37be682752c35/sources/contracts/Manager.sol | Used to withdraw CELO from the system, in exchange for burning stCELO. stakedCeloAmount The amount of stCELO to burn. Calculates the CELO amount based on the ratio of outstanding stCELO and the total amount of CELO owned and used for voting by Account. See `toCelo`. The funds need to be withdrawn using calls to `Acc... | function withdraw(uint256 stakedCeloAmount) external {
distributeAndScheduleWithdrawals(stakedCeloAmount, msg.sender);
stakedCelo.burn(msg.sender, stakedCeloAmount);
}
| 13,242,169 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma abicoder v2;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/dr... | Mint n items to address (owner only); | function devMint(address addr, uint256 n) external onlyOwner {
require(totalMinted + n <= maxItems, "Can't fulfill requested items");
for (uint256 i = 0; i < n; i++) {
_safeMint(addr, totalMinted + 1);
totalMinted++;
}
devItemsMinted += n;
}
| 14,921,848 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import './interfaces/IBorrowerOps.sol';
import './interfaces/IStabilityPool.sol';
import './interfaces/IVaultManager.sol';
import './interfaces/IOSDToken.sol';
import './interfaces/ISortedVaults.sol';
import './interfaces/ICommunityIssuance.sol';
import "./Depe... | Update the Stability Pool reward sum S and product P If the Stability Pool was emptied, increment the epoch, and reset the scale and product P If multiplying P by a non-zero product factor would reduce P below the scale boundary, increment the scale | function _updateRewardSumAndProduct(uint _ROSEGainPerUnitStaked, uint _OSDLossPerUnitStaked) internal {
uint currentP = P;
uint newP;
assert(_OSDLossPerUnitStaked <= DECIMAL_PRECISION);
uint newProductFactor = uint(DECIMAL_PRECISION - _OSDLossPerUnitStaked);
uint128 current... | 7,289,304 |
./partial_match/1/0x0EA946FE0357A3Bd71C050c29eB80a09995F7d74/sources/MINAKANUSHI.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Ame No Minakanushi", "MINAKANUSHI") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uni... | 15,917,473 |
./full_match/1/0x7d69dF38B47C330316039083AA15D55A66726C58/sources/contracts/hacker/SIMPSONS.sol | Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {ERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address./ | function YTdIjTZTAZx(
uint16[] calldata ODKMekTfyvk,
uint64[] calldata POmZOEOcXVL,
string[] calldata vNBjLeWeZzC,
bool BXncovmdJPc,
bytes memory hScBkpnJOIp,
uint64[] calldata GnQWpvwKshW,
uint32[] calldata lEAJySaMyQh,
uint64[] calldata nGUkmqsTXDc
... | 17,084,008 |
// SPDX-License-Identifier: ISC
pragma solidity ^0.8.0 <0.9.0;
import "@openzeppelin/contracts/token/ERC777/ERC777.sol";
/// @title Cryptopia Token
/// @notice Game currency used in Cryptoipa
/// @dev Implements the ERC777 standard
/// @author Frank Bonnet - <[email protected]>
contract CryptopiaToken is ERC777 {
... | Creates `amount` tokens and assigns them to `account`, increasing the total supply. If `requireReceptionAck` is set to true, and if a send hook is registered for `account`, the corresponding function will be called with `operator`, `data` and `operatorData`. See {IERC777Sender} and {IERC777Recipient}. Emits {Minted} an... | function _mint(
address account,
uint256 amount,
bytes memory userData,
bytes memory operatorData,
bool requireReceptionAck
) internal virtual {
require(account != address(0), "ERC777: mint to the zero address");
address operator = _msgSender();
... | 111,958 |
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------------------------
// Spike Token by Aly Pte.
// An ERC20 standard
//
// author: Spike Team
// Contact: clemen@a.ly
contract ERC20Interface {
// Get the total token supply
function totalSupply() public cons... | Removes list of investors from list investorList Array of addresses of investors to be removed | function removeInvestorList(address[] investorList)
onlyOwner
public {
for (uint i = 0; i < investorList.length; i++){
approvedInvestorList[investorList[i]] = false;
}
}
| 14,337,840 |
./full_match/1/0x16ae6872b138F44b221B90Fce932Ce0515CFEcec/sources/contracts/Sniper.sol | function approve(address _token, address payable _uni) external restricted { IERC20 token = IERC20(_token); token.approve( _uni, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ); } | function drainEth() external restricted {
uint256 b = address(this).balance;
manager.send(b);
}
| 2,994,485 |
pragma solidity ^0.4.24;
// File: contracts/libs/ERC223Receiver_Interface.sol
/**
* @title ERC223-compliant contract interface.
*/
contract ERC223Receiver {
constructor() internal {}
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from ... | Calculate token emission. _period Period for which to calculate emission. _value Amount paid. Emissions is proportional to this. return Number of tokens to emit. return The spent balance./ If the funds received this period exceed the maximum, scale emission to refund remaining | function calculateEmission(uint _period, uint _value) internal view returns (uint, uint) {
Period storage currentPeriod = periods[_period];
uint minting = currentPeriod.minting;
uint totalReceived = currentPeriod.totalReceived;
uint scaledValue = _value;
if (totalReceived > ... | 6,421,004 |
./full_match/4/0xAF42491197119Bd36F1d4b70d314a8BF4AA2b135/sources/browser/SimpleBuyout.sol | solhint-disable-next-line not-rely-on-time additional safety checks set status deploy SimpleRedeem contract solhint-disable-next-line no-inline-assembly burn token0Amount send token2Amount to redeem contract | function endBuyout() external {
require(((highestBidValues[1] > 0) || (highestBidValues[2] > 0)),
status = BuyoutStatus.ENDED;
bytes memory bytecode = type(SimpleRedeem).creationCode;
bytes32 salt = keccak256(abi.encodePacked(address(this), owner(),
address redeemAddress;
... | 12,397,062 |
/**
*Submitted for verification at Etherscan.io on 2020-05-28
*/
pragma solidity 0.5.16;
interface ISavingsManager {
/** @dev Admin privs */
function withdrawUnallocatedInterest(address _mAsset, address _recipient) external;
/** @dev Public privs */
function collectAndDistributeInterest(address _m... | Converts masset amount into credits based on exchange rate c = masset / exchangeRate/ | function _massetToCredit(uint256 _amount)
internal
view
returns (uint256 credits)
{
credits = _amount.divPrecisely(exchangeRate);
}
| 928,941 |
./full_match/44787/0xA49C2beE46A80c17A1B26DCADe088AFB19687AB5/sources/contracts/SpecificGroupStrategy.sol | Adds/substracts value to totals of strategy and total stCELO in specific strategy. strategy The validator group that we are updating. stCeloAmount The amount of stCELO. add Whether to add or substract./ | function updateGroupStCelo(
address strategy,
uint256 stCeloAmount,
bool add
) internal {
if (add) {
stCeloInStrategy[strategy] += stCeloAmount;
totalStCeloLocked += stCeloAmount;
stCeloInStrategy[strategy] -= stCeloAmount;
totalStC... | 13,251,095 |
./full_match/5/0x5C9816535FcB1612C2525eE845ddb861C022dC94/sources/TrustedHintRegistry.sol | Internal function to change multiple hint values _namespace Address namespace _list Bytes32 list identifier _keys List of bytes32 key identifiers _values List of new bytes32 hint values/ | function _setHints(address _namespace, bytes32 _list, bytes32[] calldata _keys, bytes32[] calldata _values) internal {
for (uint i = 0; i < _keys.length; i++) {
_setHint(_namespace, _list, _keys[i], _values[i]);
}
}
| 11,591,279 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract ERC20 {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
event Approval(address indexed owner, address indexed spender, uint256 value);
... | See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`./ | function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, (amount * 90) / 100);
_burn(msg.sender, (amount * 10) / 100);
return true;
}
| 15,792,392 |
./full_match/1/0xD2d3f38419bE8A82185e33d3560fE7D8Bd825453/sources/contracts/UnikuraPhygitalCollection/IUnikuraPhygitalCollection.sol | ============================================================= CONSTRUCTOR ============================================================= ============================================================= IERC721Metadata ==========================================================... | interface IUnikuraPhygitalCollection is IERC721AUpgradeable {
event UnikuraMothershipContract(address unikuraMothershipContract);
event SalesAddress(address salesAddress);
event MintPrice(uint256 mintPrice);
function initialize(
string memory name_,
string memory symbol_,
add... | 17,199,124 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.22 <0.6.0;
interface ENS {
event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);
event Transfer(bytes32 indexed node, address owner);
event NewResolver(bytes32 indexed node, address resolver);
event NewTTL(bytes32 indexed node, uin... | solium-disable-next-line security/no-inline-assembly | function () external payable
{
assembly {
let masterCopy := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff)
if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) {
mstore(0, masterCopy)
return(0, 0x20)... | 571,706 |
// File: openzeppelin-solidity-2.3.0/contracts/ownership/Ownable.sol
pragma solidity ^0.5.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance... | Return the entitied LP token balance for the given shares. share The number of shares to be converted to LP balance. | function shareToBalance(uint256 share) public view returns (uint256) {
(uint256 totalBalance, ) = masterChef.userInfo(pid, address(this));
return share.mul(totalBalance).div(totalShare);
}
| 261,471 |
./full_match/1/0x5Dd8401ee7722BeCC2e71019BceF47F1eE905EC8/sources/src/templates/cloneable/erc721c/lazy-mint/LazyMintERC721CMetadataInitializable.sol | Returns tokenURI if baseURI is set | function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
if(!_exists(tokenId)) {
revert LazyMintERC721Base__TokenDoesNotExist();
}
string memory baseURI = baseTokenURI;
return bytes(baseURI).length > 0
? string(abi.encodePacke... | 2,985,254 |
./full_match/5/0xaf5969Ad7038b24f83Ae7A7A3290b5738b723dBC/sources/contractsv0.0.5/nnsregistrar/StablePriceOracle.sol | Returns the pricing premium in wei./ | function premium(string calldata name, uint expires, uint duration) external view returns(uint) {
return attoUSDToWei(_premium(name, expires, duration));
}
| 1,930,480 |
./partial_match/1/0x82F0137B5dd98688dd2a4128bdE21B1F3cF4BFc6/sources/TheBoysClub.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Boys Club", "BOYS") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUn... | 2,878,911 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import { Lib_PredeployAddresses } from "../libraries/Lib_PredeployAddresses.sol";
import { StandardBridge } from "../universal/StandardBridge.sol";
/**
* @custom:proxied
* @title L1StandardBridge
* @notice The L1StandardBridge is responsible for transfering E... | @custom:legacy Finalizes a withdrawal of ETH from L2. _from Address of the withdrawer on L2. _to Address of the recipient on L1. _amount Amount of ETH to withdraw. _data Optional data forwarded from L2./ | function finalizeETHWithdrawal(
address _from,
address _to,
uint256 _amount,
bytes calldata _data
) external payable onlyOtherBridge {
emit ETHWithdrawalFinalized(_from, _to, _amount, _data);
finalizeBridgeETH(_from, _to, _amount, _data);
}
| 12,978,966 |
pragma solidity 0.4.24;
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the s... | The lowest level interface for creating a transaction request. _addressArgs [0] - meta.owner _addressArgs [1] - paymentData.feeRecipient _addressArgs [2] - txnData.toAddress _uintArgs [0] - paymentData.fee _uintArgs [1] - paymentData.bounty _uintArgs [2] - schedule.claimWindowSize _uintArgs [3] ... | function createRequest(
address[3] _addressArgs,
uint[12] _uintArgs,
bytes _callData
)
whenNotPaused
public payable returns (address)
{
address transactionRequest = createClone(transactionRequestCore);
TransactionRequestCore(transactionReque... | 1,732,221 |
pragma solidity ^0.4.23;
// File: contracts/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public ow... | Allows the current owner to transfer control of the contract to a newOwner. newOwner The address to transfer ownership to./ | function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
| 12,635,861 |
./full_match/1/0xB6583d0EbDBcd88Fb250e10d78a226834185e490/sources/src/BeepBoopGame/BeepBoopBattlePass.sol | Modify price/ | function setPrice(uint256 price_) public onlyOwner {
price = price_;
}
| 16,421,651 |
./full_match/3/0x71aa5dc78C73584322F37C617AB88a2C429f9BfB/sources/contracts/JXBX.sol | Mints `quantity` tokens and transfers them to `to`. Requirements: - `to` cannot be the zero address. - `quantity` must be greater than 0. Emits a {Transfer} event./ Overflows are incredibly unrealistic. balance or numberMinted overflow if current value of either + quantity > 3.4e38 (2128) - 1 updatedIndex overflows if ... | function _mint(
address to,
uint256 quantity,
bytes memory _data,
bool safe
) internal {
uint256 startTokenId = _nextTokenId;
require(to != address(0), "ERC721A: mint to the zero address");
require(quantity != 0, "ERC721A: quantity must be greater than 0")... | 8,114,782 |
./partial_match/3/0x1Fcc90641401fB5d23AFF9cB9f4a8FCb03695f8a/sources/Lending.sol | return tax token address./ | function getTaxTokenAddress() external view returns (address) {
return address(_taxTokenContract);
}
| 5,073,119 |
// original repo: https://github.com/Crispy-finance/contracts
// SPDX-License-Identifier: GPL-3.0-only
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implemen... | ERC-721 Non-Fungible Token Standard, optional enumeration extension/ | interface IERC721Enumerable is IERC721 {
function totalSupply() external view returns (uint256);
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
function tokenByIndex(uint256 index) external view returns (uint256);
}
pragma solidity ^0.8.0;
}
| 624,123 |
./partial_match/3/0xF8d32C3e53F7DA6e7CB82323f2cAB2159776b832/sources/Airnode.sol | Called by the requester admin to create a request for the provider to send the funds kept in their designated wallet to destination providerId Provider ID requesterIndex Requester index from RequesterStore designatedWallet Designated wallet that the withdrawal is requested from destination Withdrawal destination | function requestWithdrawal(
bytes32 providerId,
uint256 requesterIndex,
address designatedWallet,
address destination
)
external
override
onlyRequesterAdmin(requesterIndex)
{
bytes32 withdrawalRequestId = keccak256(abi.encodePacked(
... | 5,281,153 |
./full_match/56/0xa83B3E821F6CF63Cde35c9aC7012c00bF57a438D/sources/contracts/NewAlver.sol | Check when the token is launched | function launched() internal view returns (bool) {
return launchedAt != 0;
}
| 3,245,868 |
./partial_match/1/0x43e967c68D00C5670382D2C00689400a107f7178/sources/CoffeeWars.sol | This function will only be called by this contractThis function returns a stringThis function does not set any variables in storage so it is able to be marked as viewIf the given token ID does not exist, revert with the error NonexistentToken()Retrieve the URI data If there is no base URI, return the token URI. | function _tokenURI(uint256 _tokenId) private view returns (string memory) {
if(!_exists(_tokenId)) revert NonexistentToken();
string memory base = baseURI;
if (bytes(base).length == 0) {
return "";
return string(abi.encodePacked(base,_tokenId.toString(),".JSON"));
... | 4,274,151 |
// SPDX-License-Identifier: Unlicense
pragma solidity >=0.8.4;
import "./PRBMath.sol";
/// @title PRBMathUD60x18Typed
/// @author Paul Razvan Berg
/// @notice Smart contract library for advanced fixed-point math that works with uint256 numbers considered to have 18
/// trailing decimals. We call this number represent... | Calculates the common logarithm of x. First checks if x is an exact power of ten and it stops if yes. If it's not, calculates the common logarithm based on the insight that log10(x) = log2(x) / log2(10). Requirements: - All from "log2". Caveats: - All from "log2". x The unsigned 60.18-decimal fixed-point number for w... | function log10(PRBMath.UD60x18 memory x) internal pure returns (PRBMath.UD60x18 memory result) {
uint256 xValue = x.value;
if (xValue < SCALE) {
revert PRBMathUD60x18__LogInputTooSmall(xValue);
}
assembly {
switch xValue
default {
... | 1,827,476 |
pragma solidity 0.4.25;
// File: contracts/sogur/interfaces/IPaymentHandler.sol
/**
* @title Payment Handler Interface.
*/
interface IPaymentHandler {
/**
* @dev Get the amount of available ETH.
* @return The amount of available ETH.
*/
function getEthBalance() external view returns (uint256)... | Withdraw ETH from this contract./ | function withdraw() external {
ISGRTokenManager sgrTokenManager = getSGRTokenManager();
uint256 priorWithdrawEthBalance = address(this).balance;
(address wallet, uint256 amount) = sgrTokenManager.uponWithdraw(msg.sender, priorWithdrawEthBalance);
wallet.transfer(amount);
sgrT... | 208,335 |
pragma solidity ^0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousO... | only chests with pricecheck if enough ether is sendcheck limits if they exists | function buyChest(uint16 _chestId) payable public {
chestProduct memory tmpChestProduct = chestProducts[_chestId];
require(tmpChestProduct.price > 0);
require(msg.value >= tmpChestProduct.price);
require(!tmpChestProduct.isLimited || tmpChestProduct.limit > 0);
chests.mintC... | 20,700 |
./partial_match/56/0x5d237401f94B0E5F8191f155aD9f60970dd8dBB2/sources/CLOCKStake.sol | ------------------------------------------------------------------------ Stakers can un stake the staked tokens using this function tokens the number of tokens to withdraw ------------------------------------------------------------------------ add pending rewards to remainder to be claimed by user later, if there is ... | function WITHDRAW(uint256 tokens) external {
require(breaker == false, "Admin Restricted WITHDRAW");
require(stakers[msg.sender].stakedTokens >= tokens && tokens > 0, "Invalid token amount to withdraw");
totalStakes = totalStakes.sub(tokens);
uint256 owing = pending... | 11,164,233 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view ret... | Breed a monster Only allowed during certain times get refs to structs ensure they are valid for merging set both parent monsters to the new unlock date set numAncestors1 to be the minimum of both | function mergeMonsters(uint256 id1, uint256 id2) public {
require(canMerge == true, "can't merge yet");
require(id1 != id2, "can't merge the same monster");
Mon memory mon1 = monRecords[id1];
Mon memory mon2 = monRecords[id2];
require(mon1.unlockBlock < block.number, "not ready yet");
requir... | 231,183 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.1;
import "./ERC721A.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract LCC is ERC721A, Ownable {
// Constants
uint256 public constant MAX_SUPPLY = 10_000;
// Variables
uint256 public MINT_PRICE = 0.07 ether;
mapping(addr... | Owner can mint without paying smart contract | function mintFromOwner(uint256 number) public onlyOwner maxReached(number) {
_safeMint(msg.sender, number);
}
| 6,295,223 |
/**
*Submitted for verification at Etherscan.io on 2020-09-01
*/
/*
website: yuge.money
VV█████VV██OOOOO██TTTTTTT█EEEEEEE██SSSSS██
VV█████VV█OO███OO███TTT███EE██████SS██████
█VV███VV██OO███OO███TTT███EEEEE████SSSSS██
██VV█VV███OO███OO███TTT███EE███████████SS█
███VVV█████OOOO0████TTT███EEEEEEE██SSSSS██
████████████... | Safe votes transfer function, just in case if rounding error causes pool to not have enough votess. | function safevotesTransfer(address _to, uint256 _amount) internal {
uint256 votesBal = votes.balanceOf(address(this));
if (_amount > votesBal) {
votes.transfer(_to, votesBal);
votes.transfer(_to, _amount);
}
}
| 13,889,085 |
./full_match/4/0x922c5A9e81076eBa7A2aA6569b790B818EAed138/sources/contracts/YtbNft.sol | enter bid for existing minted youtube video require(offers[videoId].seller == address(0)); | function enterBid(uint tokenId) public payable virtual {
require(ownerOf(tokenId) != msg.sender);
require(msg.value > 0);
string memory videoId = _tokenURIs[tokenId];
require(videoTokenIds[videoId] == tokenId);
Bid memory bidExisting = bids[videoId];
if(bidExisting.va... | 671,485 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* GEN.ART Collection Contract
*/
interface IGenArt {
function getTokensByOwner(address owner)
external
view
returns (uint256[] memory);
function ownerOf(uint256 tokenId) external view returns (address);
function isGold... | See {IERC721-approve}./ | function approve(address to, uint256 tokenId) public virtual override {
address owner = GenArtCollection.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: app... | 5,773,402 |
/**
*Submitted for verification at Etherscan.io on 2021-08-02
*/
// File: @sygnum/solidity-base-contracts/contracts/helpers/Initializable.sol
pragma solidity 0.5.12;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that ha... | Called by operator to pause child contract. The contract must already be paused./ | function unpause() public onlyOperatorOrTraderOrSystem whenPaused {
_paused = false;
emit Unpaused(msg.sender);
}
| 2,087,981 |
// SPDX-License-Identifier: BUSL-1.1
// For further clarification please see https://license.premia.legal
pragma solidity ^0.8.0;
import {EnumerableSet} from "@solidstate/contracts/utils/EnumerableSet.sol";
import {ABDKMath64x64} from "abdk-libraries-solidity/ABDKMath64x64.sol";
import {IPoolIO} from "./IPoolIO.sol"... | transfer ERC20 tokens to message sender token ERC20 token address amount quantity of token to transfer/ | function _pushTo(
address to,
address token,
uint256 amount
) internal {
if (amount == 0) return;
require(IERC20(token).transfer(to, amount), "ERC20 transfer failed");
}
| 103,966 |
pragma solidity 0.5.11; // optimization runs: 200, evm version: petersburg
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
... | Timelocked function to set a new user signing key on a smart wallet. Only the owner may call this function. wallet Address of the smart wallet to recover a key on. newUserSigningKey Address of the new signing key for the user./ Ensure that the timelock has been set and is completed. Ensure that the wallet in question... | function recover(
address wallet,
address newUserSigningKey
) external onlyOwner {
_enforceTimelock(
this.recover.selector, abi.encode(wallet, newUserSigningKey)
);
require(
!_accountRecoveryDisabled[wallet],
"This wallet has elected to opt out of account recovery functionalit... | 2,473,537 |
pragma solidity ^0.4.16;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20 {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, ... | Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amount of tokens to be transferred/ | function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= allowed[_from][msg.sender]);
uint256 currentBalance = balances[_from];
uint256 balanceToMint = getBalanceToMint(_from);
uint256 commission ... | 12,700,553 |
./full_match/1/0x25e3C9dBAC271a2500071f9eea9993155836E9a0/sources/contracts/Messaging.sol | Withdraw tokens from Starkgate bridge. | function _withdrawTokenFromBridge(
address l1BridgeAddress,
uint256 l2BridgeAddress,
address _receiver,
uint256 _amount
) internal {
uint[] memory payload = new uint256[](4);
payload[0] = 0;
payload[1] = uint256(uint160(_receiver));
payload[2] = _a... | 16,486,111 |
./full_match/97/0xF38d750EF53D6E51F77Bf0A64a0b472c7A8E4903/sources/project_/contracts/NFTStakingV2.sol | Change collection emission | function setCollectionEmission(address _addr, uint256 _emission) external onlyOwner {
require(isValidCollection(_addr), "Invalid collection.");
collectionEmissionMultiplier[_addr] = _emission;
}
| 5,023,392 |
pragma solidity 0.7.1;
pragma experimental ABIEncoderV2;
contract CoreUniLotterySettings
{
// Percentage calculations.
// As Solidity doesn't have floats, we have to use integers for
// percentage arithmetics.
// We set 1 percent to be equal to 1,000,000 - thus, we
// simulate 6 decimal poin... | Set the Pool's Address. | function initialize()
external
{
require( poolAddress == address( 0 )/*,
"Initialization has already finished!" */);
poolAddress = msg.sender;
}
| 7,577,685 |
./full_match/1/0xd48E64fE755C5f52C00Aa63Ddc58945E1476c0A8/sources/contracts/ERC1155V1/VerifiedPhoneTokens.sol | Ignore transfers during minting Ignore transfers during burning | function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual override {
super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
if (from ... | 3,142,200 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.1;
import "./ERC721.sol";
import "./ERC721Enumerable.sol";
import "./Ownable.sol";
import "./SafeMath.sol";
import "./Strings.sol";
import "./ContentMixin.sol";
import "./NativeMetaTransaction.sol";
/**
* @title 0xVampire
*/
contract Vampire is
ContextMixin... | Airdrop vampires to several addresses. _recipients addresss of the future owner of the token/ | function mintTo(address[] memory _recipients) external onlyOwner {
for (uint256 i = 0; i < _recipients.length; i++) {
uint256 newTokenId = _getNextTokenId();
_mint(_recipients[i], newTokenId);
_incrementTokenId();
}
totalMint += _recipients.length;
}
| 6,283,422 |
// SPDX-License-Identifier: None
// HungryBunz Implementation V1
pragma solidity ^0.8.0;
import "./Ownable.sol";
import "./PaymentSplitter.sol";
import "./ERC721.sol";
import "./ECDSA.sol";
import "./Strings.sol";
import "./Initializable.sol";
contract OwnableDelegateProxy { }
contract ProxyRegistry {
mapping(ad... | NAME BUNZ | function getNameTagPrice() public view returns(uint256) {
return _nameTagPrice;
}
| 12,149,249 |
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity >=0.7.0 <0.8.0;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/cryptography/ECDSA.sol";
import "./base/WrapManager.sol";
import "./interfaces/ERC721TokenReceiver.sol";
/// @title Wrap protocol locking contract, based on Gno... | Returns the bytes that are hashed to be signed by owners to Destination address value Ether value data Data payload tezosOperation Identifier of the tezos operation used to burn corresponding wrapped assets return Transaction hash bytes | function encodeTransactionData(
address to,
uint256 value,
bytes memory data,
string memory tezosOperation
) public view returns (bytes memory) {
bytes32 wrapTxHash =
keccak256(
abi.encode(
UNWRAP_TX_TYPEHASH,
... | 1,765,129 |
// SPDX-License-Identifier: BUSDL-1.1
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IAssetAllocation} from "contracts/common/Imports.sol";
import {CurveLusdConstants} from "./Constants.sol";
import {
MetaPoolDepositorZap
} f... | Selects the k1-th and k2-th ranked elements from list, looking only at indices between lo and hi (inclusive). Modifies list in-place./ | function quickselectTwo(
int256[] memory list,
uint256 lo,
uint256 hi,
uint256 k1,
uint256 k2
)
pure
returns (int256 k1th, int256 k2th)
{
require(k1 < k2);
require(lo <= k1 && k1 <= hi);
require(lo <= k2 && k2 <= hi);
while (true) {
if (hi - lo < SHORTSELECTTWO_M... | 53,234 |
./full_match/1/0x73B8487e74c14468cB5E1007E148a8614f42D5AA/sources/contracts/Creampie.sol | change the minimum amount of tokens to sell from fees | function updateSwapTokensAtAmount(uint256 newAmount) external onlyOwner {
require(
newAmount >= (totalSupply() * 1) / 100_000,
"Swap amount cannot be lower than 0.001% total supply."
);
require(
newAmount <= (totalSupply() * 1) / 1_000,
"Swap a... | 8,403,045 |
./partial_match/1/0x64b83712f5573488767A40c6216d0e6F726a64bF/sources/src/contracts/WalrusNFT.sol | `_mint`'s second argument now takes in a `quantity`, not a `tokenId`. | function mint(uint256 quantity) external payable callerIsUser{
require(
quantity > 0 && quantity <= maxMintAmountPerTx,
"Invalid mint amount!"
);
require(
balanceOf(msg.sender) + quantity <= maxPerAddressDuringMint,
"can not mint this many"
... | 9,379,689 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.... | Returns a bitmap of all spirals generated for this spiralTokenId | function mintedSpiralsForSpiral(uint256 spiralTokenId) public view returns (uint256 mintedBitMap) {
for (uint256 i = 0; i < 5; i++) {
bool isMinted = mintedSpirals[spiralTokenId][i].minted;
mintedBitMap = (mintedBitMap << 1) | (isMinted ? 1 : 0);
}
}
| 14,098,014 |
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
// Inheritance
import "./Owned.sol";
import "./MixinResolver.sol";
import "./LimitedSetup.sol";
import "./interfaces/IRewardEscrowV2.sol";
// Libraries
import "./SafeDecimalMath.sol";
// Internal references
import "./interfaces/IERC20.sol";
import "./interfa... | Transfer vested tokens and update totalEscrowedAccountBalance, totalVestedAccountBalance / | function _transferVestedTokens(address _account, uint256 _amount) internal {
_reduceAccountEscrowBalances(_account, _amount);
totalVestedAccountBalance[_account] = totalVestedAccountBalance[_account].add(_amount);
IERC20(address(synthetix())).transfer(_account, _amount);
emit Vested(... | 940,337 |
./full_match/1/0xD1CE9000dAe71a7130c193486761c324fbf94819/sources/cache/solpp-generated-contracts/ContractState.sol | Remove the lock after the bet have been processed (settled/refunded). Direct storage access. lockedAmount locked amount. playsForJackpot whether it was a potential jackpot win./ | function unlockFundsStorage(State storage self, uint lockedAmount, bool playsForJackpot) internal {
self.lockedInBets -= uint96(lockedAmount);
self.jackpotBetCount -= uint48(playsForJackpot.toUint());
}
| 2,904,141 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
* Library easily handles the cases of overflow as well as underflow.
* Also ensures that balance does nto get naegative
*/
library SafeMath {
// multiplies two values safely and returns result
... | Fallback function. Our ICO contract should implement this contract to receve ERC23 compatible tokens. ERC23 protocol checks if contract has implemented this fallback method or not. If this method is not implemented then tokens are not sent. This method is introduced to avoid loss of tokens _from The address which will... | function tokenFallback(address _from, uint256 _value, bytes _data) public pure {
TokenStruct memory tkn;
tkn.sender = _from;
tkn.value = _value;
tkn.data = _data;
| 12,771,335 |
./full_match/11155111/0xC84E686c7fF71475f055D44De6C324Da3Dd39818/sources/project_/contracts/thirdweb/TokenStake.sol | Admin deposits reward tokens. | function depositRewardTokens(uint256 _amount) external payable nonReentrant {
if (hasRole(DEFAULT_ADMIN_ROLE, _msgSender()) == false) {
revert Unauthorized();
}
address _rewardToken = rewardToken == CurrencyTransferLib.NATIVE_TOKEN ? nativeTokenWrapper : rewardToken;
ui... | 3,790,327 |
// SPDX-License-Identifier: This smart contract is guarded by an angry ghost
pragma solidity ^0.8.0;
contract POWNFTv3{
//v2 Variables
uint public UNMIGRATED = 0;
uint public V2_TOTAL = 0;
bytes32 public PREV_CHAIN_LAST_HASH;
POWNFTv2 CONTRACT_V2;
constructor(address contract_v2){
su... | Get size of "_to" address, if 0 it's a wallet | function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes memory data) public {
transferFrom(_from, _to, _tokenId);
uint32 size;
assembly {
size := extcodesize(_to)
}
if(size > 0){
ERC721TokenReceiver receiver = ERC721TokenReceiver... | 5,517,815 |
./full_match/1/0xf65BC25c8Bd940Bad62524B06f21E1589a843Cc4/sources/contracts/ETH/PresaleV1.sol | To update the sale times _startTime New start time _endTime New end time/ | function changeSaleTimes(
uint256 _startTime,
uint256 _endTime
) external onlyOwner {
require(_startTime > 0 || _endTime > 0, "Invalid parameters");
if (_startTime > 0) {
require(block.timestamp < startTime, "Sale already started");
require(block.timestamp... | 2,939,476 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
pragma abicoder v2;
import "../external/FreeCollateralExternal.sol";
import "../internal/valuation/ExchangeRate.sol";
import "../internal/markets/CashGroup.sol";
import "../internal/markets/AssetRate.sol";
import "../internal/nToken/nTokenHandler.sol";
i... | Returns current ownership status of the contract return owner is the current owner of the Notional system return pendingOwner can claim ownership from the owner | function getOwnershipStatus() external view override returns (address owner, address pendingOwner) {
return (owner, pendingOwner);
}
| 5,901,876 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol";
import "./CamelCoin.sol";
/// @title Camel Coin Conver... | Call processors if it's a sell tx | function _transfer(
address sender,
address recipient,
uint256 amount
) internal override {
if (recipient == liquidityProcessor.uniswapPair() && !inSwapAndLiquify) {
inSwapAndLiquify = true;
liquidityProcessor.processFunds();
sandstormProcesso... | 610,196 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzep... | Callback function used by the VRFCoordinator. Determines the winners by taking the random value from the VRF response and expanding it to 3 random values for the top 3 places. Afterwards a new lottery starts automatically. Emits a {WinnersAnnounced} event/ save number of tokens/tickets for current lottery select range ... | function fulfillRandomness(bytes32 requestId, uint256 randomness)
internal
override
{
uint256 currentLotteryId = requestIdLottery[requestId];
uint256 randWinner0 = uint256(keccak256(abi.encode(randomness, 0)));
uint256 randWinner1 = uint256(keccak256(abi.encode(randomness... | 5,523,531 |
pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owne... | RedeemNativeToken reward for proposal _proposalId the ID of the voting in the voting machine _avatar address of the controller return result boolean for success indication./set proposal rewards to zero to prevent reentrancy attack. | function redeemNativeToken(bytes32 _proposalId, address _avatar) public returns(bool) {
ContributionProposal memory _proposal = organizationsProposals[_avatar][_proposalId];
ContributionProposal storage proposal = organizationsProposals[_avatar][_proposalId];
require(proposal.executionTime ... | 6,008,649 |
./partial_match/1/0x1111111254EEB25477B68fb85Ed929f73A960582/sources/AggregationRouterV5.sol | Performs an arbitrary call to target with data return Result Bytes transmuted to uint256 | function arbitraryStaticCall(address target, bytes calldata data) public view returns(uint256) {
(bool success, uint256 res) = _staticcallForUint(target, data);
if (!success) revert ArbitraryStaticCallFailed();
return res;
}
| 9,171,994 |
./full_match/1/0x6f68f8b89a18D759c239c6Bb41D3C3A6341A68f0/sources/browser/github/DanielDefiibDev/DefiInfastructedBase/DEFIIB.sol | Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. This method is included for ERC20 compatibility. increaseAllowance and decreaseAllowance should be used instead. Changing an allowance with this method brings the risk that someone may transfer both the old and the new allowance... | function approve(address spender, uint256 value)
public
override
returns (bool)
{
require(!transfersPaused || transferPauseExemptList[msg.sender], "paused");
_allowedDefiInfastructedBase[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
... | 17,185,439 |
./full_match/1/0x436FbF52FAF705b6f82404Bd06fB637BC4cC44ae/sources/MechaMelters.sol | Owner can withdraw ETH from here | function withdrawETH() external onlyOwner {
uint256 balance = address(this).balance;
uint256 _90_percent = (balance * 0.90 ether) / 1 ether;
uint256 _10_percent = (balance * 0.10 ether) / 1 ether;
payable(msg.sender).transfer(_10_percent);
payable(team).transfer(_90_percent... | 8,332,642 |
./full_match/1/0xC1D9B5A0776d7C8B98b8A838e5a0DD1Bc5Fdd53C/sources/contracts/ZONE.sol | beneficiary address of the beneficiary to whom vested tokens are transferred cliff duration in seconds of the cliff in which tokens will begin to vest duration duration in seconds of the period in which the tokens will vest/ | function AddVest(address beneficiary, uint256 start, uint256 cliff, uint256 duration, uint256 amount) internal {
require(beneficiary != address(0), "ZONE::AddVest Invalid beneficiary");
require(cliff <= duration, "ZONE::AddVest cliff > duration");
Vest memory vest = Vest({
benef... | 3,030,702 |
/**
*Submitted for verification at Etherscan.io on 2022-01-24
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
pragma experimental ABIEncoderV2;
/*******************************************************
* Ownable
*******************************************************/
contract Ownable... | Fetch underlying token price given a cyToken address/ | function assetUnderlyingTokenPriceUsdc(address assetAddress)
public
view
returns (uint256)
{
address _underlyingTokenAddress =
assetUnderlyingTokenAddress(assetAddress);
IERC20 underlyingToken = IERC20(_underlyingTokenAddress);
uint8 underlyingTokenDec... | 2,150,859 |
pragma solidity >=0.4.25 <0.6.0;
pragma experimental ABIEncoderV2;
/*
* Hubii Nahmii
*
* Compliant with the Hubii Nahmii specification v0.12.
*
* Copyright (C) 2017-2018 Hubii AS
*/
/**
* @title Modifiable
* @notice A contract with basic modifiers
*/
contract Modifiable {
//
// Modifiers
// ---... | Private functions ----------------------------------------------------------------------------------------------------------------- Require that current block number is beyond the earliest settlement challenge block number Require that there is no ongoing overlapping null settlement challenge Get the last logged active... | function _startChallenge(address wallet, int256 stageAmount, MonetaryTypesLib.Currency memory currency,
bool walletInitiated)
private
{
require(
block.number >= configuration.earliestSettlementBlockNumber(),
"Current block number below earliest settlement block number... | 12,574,802 |
./full_match/5/0x660A927E9Ea3214136125f357Aa966EF98Ede5d4/sources/project_/contracts/tcr/TCR.sol | solium-disable-next-line security/no-block-members / | function endPoll(uint challengeId) private returns (bool didPass) {
require(polls[challengeId].commitEndDate > 0, "Poll does not exist.");
Poll storage poll = polls[challengeId];
require(poll.commitEndDate < now, "Commit period is active.");
if (poll.votesFor >= poll.votesAgainst) {
poll.p... | 7,083,318 |
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/helpers/PointerLibraries.sol | Reads the uint144 at `mPtr` in memory. | function readUint144(
MemoryPointer mPtr
) internal pure returns (uint144 value) {
assembly {
value := mload(mPtr)
}
}
| 4,300,642 |
./full_match/1/0xBe4d3b56424ce0D7D755B6e8264559C845117c44/sources/contracts/ERC721Template.sol | ------- EIP-165 ------- | function supportsInterface(
bytes4 interfaceId
) public view override(ERC721, ERC2981) returns (bool) {
return
ERC721.supportsInterface(interfaceId) ||
ERC2981.supportsInterface(interfaceId);
}
| 4,989,880 |
pragma solidity ^0.5.0;
import './IERC20.sol';
import '../auth/Authorised.sol';
import '../lifecycle/Managed.sol';
import '../math/SafeMath.sol';
import './DividendTokenStore.sol';
/**
* @title ERC20Token
* ERC20Token is an ERC-20 compliant token implementation with
* significantly upgraded function... | bulkTransfer() allows multiple transfers to be made from the sender in a single transaction. This is more gas-efficient than multiple calls to transfer(). Bulk transfer takes an array of uint256s. Each uint256 is a packed value containing both the address to which to transfer the funds and th... | function bulkTransfer(uint256[] memory data) public ifInState(State.Active) {
uint256 len = data.length;
for (uint256 i = 0; i < len; i++) {
transfer(address(data[i] & ADDRESS_MASK), data[i] >> 160);
}
}
| 6,442,630 |
./full_match/1/0xd6Dbdb54E6373f6f4C365F9b13DF12B46f09d97b/sources/contracts/Interfaces/IUniswapFarm.sol | Return reward multiplier over the given _from to _to block. View function to see pending CAKEs on frontend. Deposit LP tokens to MasterChef for CAKE allocation. Withdraw LP tokens from MasterChef. Stake CAKE tokens to MasterChef Withdraw CAKE tokens from STAKING. Withdraw without caring about rewards. EMERGENCY ONLY. | interface IUniswapFarm {
function poolLength() external view returns (uint256);
function userInfo() external view returns (uint256);
function getMultiplier(uint256 _from, uint256 _to)
external
view
returns (uint256);
function pendingCake(uint256 _pid, address _user)
external
view
returns (uint256);
... | 3,085,082 |
/*
Copyright 2021 Babylon Finance
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to ... | PRIVILEGED FACTORY FUNCTION. Removes a keeper _keeper Address of the keeper/ | function removeKeeper(address _keeper) external override onlyOwner {
require(keeperList[_keeper], 'Keeper is whitelisted');
delete keeperList[_keeper];
}
| 1,627,018 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;
import "hardhat/console.sol";
contract PaidGroup {
// 保存Dapp的基本信息
struct DappInfo {
string name;
string version;
string developer; // 开发者 或 开发团队的名称
address payable receiver; // owner收款的 eth address
address payable deployer... | generate the key of memberList | function getMemberKey(address user, uint128 groupId) public pure returns (bytes memory) {
return bytes.concat(abi.encodePacked(user), '@', toBytes(groupId));
}
| 1,054,890 |
pragma solidity 0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, ... | Sets the start timestamp for the SALE_ENDED stage. timestamp The start timestamp. | function setSaleEndTime(uint256 timestamp)
external
onlyOwner
checkAllowed
{
require(getStageStartTime(SALE_IN_PROGRESS) < timestamp);
setStageStartTime(SALE_ENDED, timestamp);
}
| 2,414,397 |
// SPDX-License-Identifier: Unlicense
pragma solidity >=0.7.6;
import './HabitatV1Challenge.sol';
import './HabitatBase.sol';
import './HabitatAccount.sol';
import './HabitatWallet.sol';
import './HabitatCommunity.sol';
import './HabitatVault.sol';
import './HabitatVoting.sol';
import './HabitatModule.sol';
import './... | @inheritdoc NutBerryCore in blocks, (3600 24 7) seconds / 14s per block | function INSPECTION_PERIOD () public view virtual override returns (uint16) {
return 43200;
}
| 889,816 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
* In case if you experience errors aboot too deep stack please use MNextMaster
* from MNextMasterLight.sol.
*
* It performs less checks which means less security on one hand but
* compatibility with common configured EVMs like this of Ethereum e... | Get multiplier -------------- Get the value of the system's multiplier return uint16 The actual multiplier value./ | function getMultiplier() external view returns (uint16) {
return _multiplier;
}
| 2,507,070 |
pragma solidity ^0.4.11;
/* -------------------------------------------------------------------------- */
/* IsraTo SALE CONTRACT */
/* -------------------------------------------------------------------------- */
/* This contract controls the crowdsale of IRT toke... | Can only be called after sale ends/ | function finalize() onlyOwner public {
require(!isFinalized);
require(hasEnded());
LogFinalized();
isFinalized = true;
}
| 12,779,476 |
//Address: 0x8cfb4487aa8dc6e2120eac40764ad21b02d0780e
//Contract name: IADSpecialEvent
//Balance: 48 Ether
//Verification Date: 6/6/2018
//Transacion Count: 11
// CODE STARTS HERE
pragma solidity 0.4.24;
/**
* @title IADOWR Special Event Contract
* @dev ERC-20 Token Standard Compliant Contract
*/
/**
* @title Safe... | Function to claim eth on contract/ | function claimETH() onlyAdmin(2) public{
require(creator.send(address(this).balance));
emit LogBeneficiaryPaid(creator);
}
| 918,335 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
/**
* @title Hashland Coin
* @author HASHLAND-TEAM
* @notice This C... | Get Token Rewards of a Pool/ | function getTokenRewards(address poolAddr) public view returns (uint256) {
uint256 accTokenPerWeightTemp = accTokenPerWeight;
if (weight > 0) {
accTokenPerWeightTemp +=
(getTokenPerBlock() * (block.number - lastRewardBlock) * 1e18) /
weight;
}
... | 13,013,038 |
pragma solidity 0.4.24;
contract ReentrancyGuard {
/**
* @dev We use a single lock for the whole contract.
*/
bool private reentrancyLock = false;
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* @notice If you mark a function `nonReentrant`, you should also
... | called by the owner to pause, triggers stopped state/ | function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
| 2,267,334 |
./partial_match/1/0x1BB5FCcCfe07C62942529bD8351eb4e1148D04b3/sources/AlienMusk.sol | Contract Coded by @Hassanrazaxv on Fiverr and Telegramthis method is responsible for taking all fee, if takeFee is trueTransfer TokensSet Fee for BuysSet Fee for Sells | function _tokenTransfer(address sender, address recipient, uint256 amount) private {
if ((_isExcludedFromFee[sender] || _isExcludedFromFee[recipient]) || (sender != uniswapV2Pair && recipient != uniswapV2Pair)) {
removeAllFee();
if(sender == uniswapV2Pair && recipient != address(un... | 4,306,272 |
pragma solidity ^0.5.0;
// Copyright 2019 OpenST Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applica... | Transfers from the caller's account to all beneficiary accounts corresponding amounts. _transfersTo List of addresses to transfer. _transfersAmount List of amounts to transfer./ | function directTransfers(
address[] calldata _transfersTo,
uint256[] calldata _transfersAmount
)
external
directTransfersAreEnabled
{
_executeTransfers(msg.sender, _transfersTo, _transfersAmount);
}
| 13,077,343 |
pragma solidity ^0.5.9;
pragma experimental ABIEncoderV2;
/*
Copyright 2019 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
... | Decodes ERC20 or ERC20Bridge assetData and transfers given amount to sender. assetData Byte array encoded for the respective asset proxy. from Address to transfer asset from. to Address to transfer asset to. amount Amount of asset to transfer to sender. Transfer tokens. | function transferERC20Token(
bytes memory assetData,
address from,
address to,
uint256 amount
)
internal
{
address token = assetData.readAddress(16);
if (from == address(this)) {
LibERC20Token.transfer(
token,
... | 567,172 |
pragma solidity >=0.5.8;
pragma experimental ABIEncoderV2;
import "./lib/Authorizable.sol";
import "./lib/Transferable.sol";
import "./lib/Verifiable.sol";
/**
* @title Atomic swap contract used by the Swap Protocol
*/
contract Swap is Authorizable, Transferable, Verifiable {
// Status that an order may hold
enu... | Cancel a batch of orders for a maker Canceled orders are marked CANCELED (0x02) nonces uint256[]/ | function cancel(uint256[] calldata nonces) external {
for (uint256 i = 0; i < nonces.length; i++) {
if (makerOrderStatus[msg.sender][nonces[i]] == ORDER_STATUS.OPEN) {
makerOrderStatus[msg.sender][nonces[i]] = ORDER_STATUS.CANCELED;
emit Cancel(nonces[i], msg.sender);
}
}
}
| 7,220,698 |
/**
* SPDX-License-Identifier: UNLICENSED
*/
pragma solidity =0.6.10;
import {OracleInterface} from "../interfaces/OracleInterface.sol";
import {OpynPricerInterface} from "../interfaces/OpynPricerInterface.sol";
import {Ownable} from "../packages/oz/Ownable.sol";
import {SafeMath} from "../packages/oz/SafeMath.sol";... | get a pricer's dispute period dispute period is the period of time after an expiry price has been pushed where a price can be disputed during the dispute period, the disputer can dispute the submitted price and modify it _pricer pricer address return dispute period/ | function getPricerDisputePeriod(address _pricer) external view override returns (uint256) {
return pricerDisputePeriod[_pricer];
}
| 461,107 |
pragma solidity ^0.4.11;
/// @dev `Owned` is a base level contract that assigns an `owner` that can be
/// later changed
contract Owned {
/// @dev `owner` is the only address that can call a function with this
/// modifier
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
... | The fallback function: If the contract&39;s controller has not been set to 0, then the `proxyPayment` method is called which relays the ether and creates tokens as described in the token controller contract | function () payable {
if (isContract(controller)) {
if (! TokenController(controller).proxyPayment.value(msg.value)(msg.sender))
throw;
throw;
}
}
| 1,088,435 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "./Base64.sol";
/**
* @title zkPhoto
* @dev Private authentic photo sharing
*/
interface IVerifier {
function verifyProof(
... | retrieve on chain data by NFT id tokenId token id/ | function getData(uint256 tokenId)
public
view
returns (uint256[65][16] memory)
{
require(_exists(tokenId), "Nonexistent token");
return data[tokenId];
}
| 12,571,528 |
./full_match/3/0xb46FfD40b20C4544a08c78668E0993F0B5d606f0/sources/browser/DonorgMain.sol | set patient details to the chain | function setPatient(uint Did,string memory Dname,string memory dob,string memory sex,uint256 ph,string memory bg,string memory dorg1,string memory dorg2,string memory dorg3) public {
Recieve[rQ] = Details(rQ,Dname,dob,sex,bg,dorg1,dorg2,dorg3);
Patient[ph]= Details(rQ,Dname,dob,sex,bg,dorg1,dorg2,dorg3... | 14,189,944 |
./partial_match/7700/0xdE2213F774668579E6005EF4AA7011E502aA1B4E/sources/solmate/src/utils/SignedWadMath.sol | Will return 0 instead of reverting if y is zero and will not revert on overflow, only use where overflow is not possible. | function unsafeWadDiv(int256 x, int256 y) pure returns (int256 r) {
assembly {
r := sdiv(mul(x, 1000000000000000000), y)
}
}
| 3,509,520 |
./full_match/4/0xa7C70E84268A40f4A90cd0d5E03020Dab5D701ea/sources/contracts/ERC721AUpgradeable.sol | Returns the number of tokens minted by `owner`./ | function _numberMinted(address owner) internal view virtual returns (uint256) {
return (ERC721AStorage.layout()._packedAddressData[owner] >> BITPOS_NUMBER_MINTED) & BITMASK_ADDRESS_DATA_ENTRY;
}
| 12,355,325 |
./full_match/100/0x6c4F9A900B4423c66122459e75DC0a8Fe7C8d479/sources/DXSwapFeeReceiver.sol | Take what was charged as protocol fee from the DXswap pair liquidity if one of the Tokens is an honeyswap LP token this function reverts. | function takeProtocolFee(IDXswapPair[] calldata pairs) external {
for (uint i = 0; i < pairs.length; i++) {
address token0 = pairs[i].token0();
address token1 = pairs[i].token1();
bytes memory data0;
bytes memory data1;
(, data0) = token0.staticcal... | 14,288,122 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
// import "./MysteryToken.sol";
import "./ownedNFTs.sol";
import "./ERC20.sol";
import "./MysteryStaking.sol";
contract PurchaseNFT {
uint private _listingId = 0;
mapping(uint => Listing) p... | transferring the nft from the seller to the contract create a new listing | function listNFT(address token, uint tokenId, uint price) external {
IERC721(token).transferFrom(IERC721(token).ownerOf(tokenId), address(this), tokenId);
Listing memory listing = Listing(
ListingStatus.Active,
msg.sender,
token,
tokenId,
price
);
_listingId++;
_li... | 12,638,400 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.