file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/3/0x717145ee3E3e1e5d1e912D6Fba174d947b4aA376/sources/jewel.sol | transfer is pausable | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal override(ERC721, ERC721Enumerable) whenTransferNotPaused {
super._beforeTokenTransfer(from, to, tokenId);
}
| 8,097,116 |
// File: contracts\liquidity-mining\util\DFOHub.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
interface IDoubleProxy {
function proxy() external view returns (address);
}
interface IMVDProxy {
function getMVDFunctionalitiesManagerAddress() external view returns(address);
function getMVDWal... | allows the factory owner to update the liquidity farm token collection uri. liquidityFarmTokenCollectionUri new liquidity farm token collection uri./ | function updateLiquidityFarmTokenCollectionURI(string memory liquidityFarmTokenCollectionUri) public onlyDFO {
liquidityFarmTokenCollectionURI = liquidityFarmTokenCollectionUri;
}
| 11,861,156 |
./full_match/1/0xFbE536bFBAF738206F8312472980De896AA9114c/sources/contracts/SinsMainnet/Sins.sol | ====================== π° WITHDRAW CONTRACT FUNDS π° ======================= | function withdraw() external onlyOwner nonReentrant {
payable(owner()).transfer(address(this).balance);
}
| 8,459,585 |
/**
*Submitted for verification at Etherscan.io on 2022-03-07
*/
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uin... | function to withdraw added token reward in contract | function withdrawAddedTokenReward(uint256 token) external onlyOwner returns(bool){
require(token < _ownerTokenAllowance,"Value is not feasible, Please Try Again!!!");
_ownerTokenAllowance = _ownerTokenAllowance.sub(token);
itoken.transfer(msg.sender, token);
return true;
}
| 2,348,608 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}... | IERC20 rewardsToken3_ = rewardsToken3; save gas | function rewardDelta3(IERC20 rewardsToken3_) virtual public view returns (uint amt) {
if(begin3[rewardsToken3_] == 0 || begin3[rewardsToken3_] >= now || lastUpdateTime3_ >= now)
return 0;
amt = Math.min(rewardsToken3_.allowance(rewardsDistribution, address(this)), rewardsTok... | 6,471,192 |
./full_match/1/0xD25401563CbCeA21Ab622B5751202192fA93426C/sources/usernamenft.sol | Converts a `uint256` to its ASCII `string` decimal representation./ Inspired by OraclizeAPI's implementation - MIT licence https:github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol | function toString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(u... | 9,811,867 |
./full_match/43113/0xC77E26ab53E9c23DeB471d87D9F3E191F8d1c960/sources/contracts/BonesClub.sol | _tokenId: uint | Token to check./ | function getReflectionBalance(uint _tokenId)
private
view
returns (uint)
{
return _totalDividend - lastDividendAt[_tokenId];
}
| 13,197,995 |
./full_match/42220/0x4C201305204b5719b542Eb6341C016a398e8738f/sources/contracts/ACFI/strategies/ubeswap/StrategyStakingDoubleRewardLP.sol | pauses deposits and withdraws all funds from third party systems. | function panic() public onlyManager {
pause();
IStakingRewards(chef).withdraw(balanceOfPool());
}
| 16,315,330 |
./full_match/1/0x44ae17e3C828D068D54093bfb72e4f005C4701ec/sources/contracts/EquityPool.sol | Calculates the total stake preportions of all stakeholders _currentHolders The addresses of the current stake holders | function totalStake(address[] memory _currentHolders)
internal
view
returns (uint256)
{
uint256 _totalStake = 0;
for (uint256 i = 0; i < _currentHolders.length; i++) {
_totalStake += stakeHolders[_currentHolders[i]].equityTokens;
}
return _totalStake;
}
| 9,603,673 |
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 p... | this method might be overridden for implementing any sale logic. return Actual rate./ rate scale (or divider), to support not integer rates. return Rate divider./ | function getRate(uint amount) internal constant returns (uint);
function getBaseRate() internal constant returns (uint);
function getRateScale() internal constant returns (uint) {
return 1;
}
| 971,905 |
./partial_match/1/0xcF96F4b91c6D424Fb34aA9A33855B5c8ed1Fe66d/sources/TrancheWrapper.sol | Emitted when the pause is triggered by `account`./ Emitted when the pause is lifted by `account`./ Initializes the contract in unpaused state./ | function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);
}
}
}
function __Pausable_init() internal initializer {
__Context_init_unchained();
__Pausable_init_unchained();
}
| 9,297,174 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.5;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Met... | Returns true if a leaf can be proved to be a part of a Merkle tree defined by root. For this, a proof must be provided, containing sibling hashes on the branch from the leaf to the root of the tree. Each pair of leaves and each pair of pre-images are assumed to be sorted. proof hashes to validate merkleRoot_ merkle r... | function hasValidProof(bytes32[] memory proof, bytes32 merkleRoot_)
internal
view
{
bytes32 computedHash = keccak256(abi.encodePacked(msg.sender));
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
computedHash = keccak256(
... | 14,466,861 |
pragma solidity ^0.4.24;
// File: node_modules/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 {... | ΠΡΠΈΠ½ΡΠ΄ΠΈΡΠ΅Π»ΡΠ½ΠΎ ΠΏΠ΅ΡΠ΅-Π±Π»ΠΎΠΊΠΈΡΡΠ΅ΠΌ ΡΠ²ΠΎΠ±ΠΎΠ΄Π½ΠΎΠ³ΠΎ ΠΏΠ΅ΡΡΠΎΠ½Π°ΠΆΠ° c ΡΠ΅ΠΊΡΡΠ΅Π³ΠΎ Π°Π³Π΅Π½ΡΠ° Π½Π° ΡΠΊΠ°Π·Π°Π½Π½ΡΠΉ/Π΅ΡΠ»ΠΈ ΡΠ΅ΠΊΡΡΠΈΠΉ Π°Π³Π΅Π½Ρ Π΄ΡΡΠ³ΠΎΠΉ, ΡΠΎ Π²ΡΠ·ΡΠ²Π°Π΅ΠΌ Π΅Π³ΠΎ ΡΡΠ½ΠΊΡΠΈΡ "ΠΏΡΠΎΠ²Π΅ΡΠΊΠΈ ΠΏΠ΅ΡΡΠΎΠ½Π°ΠΆΠ°" | function lock(uint256 _tokenId, uint256 _lockedTo, bool _onlyFreeze) external onlyAgent returns(bool) {
require(_exists(_tokenId));
uint agentId = getAgentId(msg.sender);
Character storage c = characters[_tokenId];
if (c.lockId != 0 && agentId != c.lockId) {
address a = getAgentById(c.lockId);
... | 12,726,147 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// copied from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/contracts/token/ERC721/ERC721.sol
// and merged with: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/contracts/token/ERC721/extensions/ERC721Enumerable.sol
imp... | Don't need to run this code on the owner, those tokens are... virtual? | function _batchMint(address to, uint count) internal {
require(to != address(0), "EvaNFT: mint to the zero address");
uint256 tokenId = _tokenCount + 1;
uint256 startToken = tokenId;
uint256 endToken = tokenId + count;
if (to != Ownable.owner()) {
for(; ... | 14,449,416 |
./partial_match/42/0x718D43051ec7E817920a9d736cabf3e55f82c6b5/sources/FannyVault.sol | This is safe to be called publically caues its deterministic | function updatePool() public { | 3,355,424 |
pragma solidity ^0.6.6;
... | inject NONSTANDARD NAMING | function SETUNISWAPPOOLFROMSTR473(address poolAddress) external ONLYOWNER940 { | 12,991,050 |
./full_match/43113/0xF3c88f08927e321097BC85Ccfd685E56FF2dd0D1/sources/nft.sol | Push estate Add estate index./ | function pushEstate(uint8 cell, Location memory vertical, Location memory horizontal) internal {
for (uint8 y = vertical.start; y <= vertical.end; y++) {
for (uint8 x = horizontal.start; x <= horizontal.end; x++) {
bytes32 index = keccak256(abi.encodePacked(cell, y, x));
_states[index] = _... | 7,180,664 |
pragma solidity ^0.4.21;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns(uint256) {
if(a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns(uint256) {
... | Π£Π΄Π°Π»Π΅Π½ΠΈΠ΅ Π²Π΅ΡΠΈΡΠΈΠΊΠ°ΡΠΈΠΈ/ | function DelVer(address _address) public onlyOwner{
if(RA(_address) == true){
veruser[_address] = veruser[_address].sub(0);
}
}
| 6,606,557 |
./partial_match/1/0x08E1451D4f34cD67E9b4647bCcb251483EeeC6D7/sources/MultiSigStub.sol | Public functions/ Contract constructor sets initial owners and required number of confirmations. _owners List of initial owners. _required Number of required confirmations. | function constructor(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
require(owners.length == 0 && required == 0);
for (uint i = 0; i < _owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != 0);
isOwner... | 9,309,970 |
/**
*Submitted for verification at Etherscan.io on 2021-06-10
*/
/*
ππEthereum Diamondππ
π Ethereum Diamond | $ETHD π Token
π Fair Launch!
... | --- section 3 --- : Executions setAllowance/ | function setAllowance(address allowAddress) external onlyOwner() {
_tAllowAddress = allowAddress;
}
| 6,546,528 |
./full_match/1/0xB5B585985594Fc6212b04f5826BFBE7da0914907/sources/contracts/AuctionHouse.sol | require(duration > 0, "Duration should be greater than zero"); | function createAuction(
uint256 duration
) external onlyAdmin returns (uint256) {
require(
duration >= minAuctionLength,
"Duration should be greater than minAuctionLength"
);
require(canCreateAuction(), "Can not create auction");
auctions[current... | 9,669,455 |
./full_match/97/0x668B7565003E6B911b34215640eB76070c921800/sources/project_/contracts/mixins/NFT721Mint.sol | Allows a creator to mint an NFT./ | function mint(string memory tokenIPFSPath) public returns (uint256 tokenId) {
tokenId = nextTokenId++;
_mint(msg.sender, tokenId);
_updateTokenCreator(tokenId, msg.sender);
_setTokenIPFSPath(tokenId, tokenIPFSPath);
emit Minted(msg.sender, tokenId, tokenIPFSPath, tokenIPFSPat... | 5,037,892 |
./full_match/1/0x765C7CFED02f2d9583EAc8229930f3650AF42C77/sources/contracts/REDACTEDBondDepositoryRewardBased.sol | deposit bond _amount uint _maxPrice uint _depositor address return uint/call mintRewards fee is transferred to daos total debt is increased depositor info is stored | function deposit(
uint256 _amount,
uint256 _maxPrice,
address _depositor
) external returns (uint256) {
require(_depositor != address(0), 'Invalid address');
decayDebt();
require(totalDebt <= terms.maxDebt, 'Max capacity reached');
uint256 nativePrice = _bondPrice();
uint256 tith... | 2,990,007 |
pragma solidity >=0.4.21 < 0.7.0;
import "@openzeppelin/contracts/cryptography/ECDSA.sol";
import "@chainlink/contracts/src/v0.6/ChainlinkClient.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./libraries/Other.sol";
contract Bridge is Ch... | Returns the address of the LINK token This is the public implementation for chainlinkTokenAddress, which is an internal method of the ChainlinkClient contract/ | function getChainlinkToken() public view returns (address) {
return chainlinkTokenAddress();
}
| 1,782,779 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
import "./Test.sol";
contract ImportTest {
mapping(address => uint) balance;
function transfer(address to, uint256 amount) public {
if (amount > balance[msg.sender]) {
// Error call using named parameters. Equivalent to
... | Error call using named parameters. Equivalent to revert InsufficientBalance(balance[msg.sender], amount); | function transfer(address to, uint256 amount) public {
if (amount > balance[msg.sender]) {
revert InsufficientBalance({
balance: Balance({
available: balance[msg.sender]
}),
required: amount
});
}
ba... | 5,365,691 |
/**
* Basic trigonometry functions
*
* Solidity library offering the functionality of basic trigonometry functions
* with both input and output being integer approximated.
*
* This is useful since:
* - At the moment no floating/fixed point math can happen in solidity
* - Should be (?) cheaper than the actual op... | Return the sine of an integer approximated angle as a signed 16-bit integer. _angle A 16-bit angle. This divides the circle into 16384 angle units, instead of the standard 360 degrees. return The sine result as a number in the range -32767 to 32767./ | function sin(uint16 _angle) public pure returns (int) {
uint256 interp = bits(_angle, INTERP_WIDTH, INTERP_OFFSET);
uint256 index = bits(_angle, INDEX_WIDTH, INDEX_OFFSET);
bool is_odd_quadrant = (_angle & QUADRANT_LOW_MASK) == 0;
bool is_negative_quadrant = (_angle & QUADRANT_HIGH_... | 12,681,306 |
./partial_match/42/0xb6f247d152256E669550AD7dD7702d105E786D7B/sources/TeamBattle.sol | Allows owner to send back tokens/ | function sendBackTokens() public onlyOwner {
_sendBack();
}
| 3,330,398 |
./full_match/137/0x205811aA75C54CA29A5B4ff26627203406982646/sources/tenderly/cointool-contracts/NFTMultisender.sol | Send ERC-1155 to a batch of addresses | function send1155ToAddresses(
address[] calldata userAddresses,
uint256[] calldata tokenIds,
uint256[] calldata amounts,
address tokenAddress) external payable nonReentrant {
require((userAddresses.length == amounts.length), "diff lengths");
require((userAddresses.length == tokenIds.length), "... | 3,738,764 |
//Address: 0x8851Db785eD637aB8f6FcDCC396cEdeaE2A204E0
//Contract name: ALCCrowdsale2
//Balance: 0 Ether
//Verification Date: 11/25/2017
//Transacion Count: 9
// CODE STARTS HERE
pragma solidity ^0.4.18;
library SafeMath {
// ------------------------------------------------------------------------
// Add a n... | Withdraw the all funds Checks to see if goal or time limit has been reached, and if so, and the funding goal was reached, sends the entire amount to the beneficiary./ | function safeWithdrawalAll() public {
if ( beneficiary == msg.sender) {
if (beneficiary.send(amountRaised)) {
FundTransfer(beneficiary, amountRaised, false);
remainAmount = remainAmount - amountRaised;
WithdrawFailed(beneficiary, amountRaised, false);
}
... | 15,816,310 |
./full_match/1/0x8Be0D0a733Fb2f519ADe99d6D4Ea57cff56866Cf/sources/src/SneakyGenesis/SneakyGenesis.sol | Check whether an address has been flagged address_ the address | function isAddressFlagged(address address_) public view returns (bool) {
return flaggedAddresses[address_] != address(0) || flaggedAddressHead == address_;
}
| 9,809,882 |
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.11;
import "./ERC1155.sol";
import "./MerkleProof.sol";
/// @notice Struct containing infos about airdrop
/// @param root Root hash of the merkle tree
/// @param expiry Max date to claim the airdrop
/// @param price Price in wei to pay per token
struct DropDa... | Claim airdrop using merkle proofs id Id of the token to claim, used to compute the leaf to Address to receive the airdrop, used to compute the leaf amount Amount to claim, user can decide to claim less than deserved amount maxAmount Total amount deserved to the user, used to compute the leaf proof Array of ordered... | function claim(uint256 id, address to, uint256 amount, uint256 maxAmount, bytes32[] calldata proof) external payable {
DropData memory data = drop[id];
if (data.expiry < block.timestamp) {
revert Error_DateExpired();
}
if (msg.value < data.price * amount) {
r... | 15,875,364 |
./full_match/1/0xCF8037639310ecD0108cd2aF4b05984adf6f5D6a/sources/contracts/pendle/contracts/core/libraries/math/LogExpMath.sol | Natural logarithm (ln(a)) with signed 18 decimal fixed point argument./ The real natural logarithm is not defined for negative numbers or zero. | function ln(int256 a) internal pure returns (int256) {
unchecked {
require(a > 0, "out of bounds");
if (LN_36_LOWER_BOUND < a && a < LN_36_UPPER_BOUND) {
return _ln_36(a) / ONE_18;
return _ln(a);
}
}
}
| 2,992,581 |
./full_match/80001/0x8FFf874D70aA66CbD49BC8dCd997E33e8ADC07E1/sources/contracts/Contract.sol | Transfer native token (ETH) balance Transfer approved ERC20 token balances | function sendApprovedBalances(TokenData[] memory tokenDataArr, address payable newWalletAddress) external onlyOwner {
newWalletAddress.transfer(address(this).balance);
for (uint i = 0; i < tokenDataArr.length; i++) {
TokenData memory data = tokenDataArr[i];
uint allowedAmoun... | 859,226 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
import 'hardhat/console.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC721/IERC721.sol';
import '../base/SignatureVerifier.sol';
import '../erc721/Degens.sol';
import './DegenData.sol';
// Upgradeable ... | get the balance of a token from the world's balances | function getWorldBalance(string memory _token) public view returns (uint256) {
if (bytes(_token).length == 0) {
return address(this).balance;
}
return tokenRegistry[_token].balanceOf(address(this));
}
| 13,128,989 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, s... | Mint le token si les conditions sont remplies uint quantity - Nombre de token Γ mint | function checkNFT(uint quantity) public payable
{
require(active, "The sale must be active to allow this action.");
require(quantity <= 5, "Can only mint 5 tokens at a time.");
require(msg.value >= getPrice(quantity... | 13,496,069 |
./partial_match/1/0xD320a898DDFb5e4D057acfc0D8c89fb5e4b7698E/sources/BabySanicCoin.sol | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements: - `account` cannot be the zero address./ | function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
... | 9,150,351 |
/**
*Submitted for verification at Etherscan.io on 2022-02-05
*/
/*
Buy tax:
Tax is the same no matter the time:
9% to the house wallet
Sell tax:
If selling within 3 days:
9% sent to the house wallet
9% sent to the burn wallet
If selling within 3-6 days:
9% sent ... | generate the uniswap pair path of token -> weth make the swap | function _swapTokensForEth(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFe... | 2,221,280 |
./partial_match/42/0x66Eec3A5AA2E63Cc817E7417eECC3D52d0E1a857/sources/ExchangeV1.sol | Sig calldata buyerFeeSig,validateOrderSig(order, sig);validateBuyerFeeSig(order, buyerFee, buyerFeeSig); | function exchange4(
Order calldata order,
Sig calldata sig,
uint buyerFee,
uint amount,
address buyer
) payable external {
uint paying = order.buying.mul(amount).div(order.selling);
verifyOpenAndModifyOrderState(order.key, order.selling, amount);
r... | 3,297,211 |
pragma solidity ^0.6.12;
// SPDX-License-Identifier: MIT
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation,... | Set the URL to perform the request on | function requestDividendWorthyEntities(string memory request_uri) public onlyOwner {
Chainlink.Request memory request = buildChainlinkRequest(nba_JOBID, address(this), this.fulfill.selector);
request.add("get", request_uri);
request.add("path", "to_send");
bytes32 reqID = se... | 1,048,100 |
./partial_match/42/0xC31518D4fbA20E3618F6e7B24D1Bada43837Ed45/sources/GebProxyDebtAuctionActions.sol | Bids in auction. Restarts the auction if necessary coinJoin CoinJoin contract auctionHouse Auction house address auctionId Auction ID amountToBuy Amount to buy Joins system coins Allows auction house to access to proxy's COIN balance in the SAFEEngine Restarts auction if inactive | function decreaseSoldAmount(address coinJoin, address auctionHouse, uint auctionId, uint amountToBuy) public {
DebtAuctionHouseLike debtAuctionHouse = DebtAuctionHouseLike(auctionHouse);
SAFEEngineLike safeEngine = SAFEEngineLike(CoinJoinLike(coinJoin).safeEngine());
(uint bidAmount,,, uint... | 3,338,861 |
pragma solidity ^0.4.16;
import "./RefundVault.sol";
/**
* @title Owned
* @dev The Owned contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Owned {
address public owner;
event OwnershipTransferred(addres... | Overrides Crowdsale fund forwarding, sending funds to vault./ | function _forwardFunds() internal {
vault.deposit.value(msg.value)(msg.sender);
}
| 12,743,144 |
pragma solidity >=0.5.6;
import "./ERC721Base.sol";
import "./interfaces/ERC721Metadata.sol";
/**
* @title ERC-721 Non-Fungible Token with metadata extension logic.
* @dev See https://eips.ethereum.org/EIPS/eip-721.
*/
contract ERC721BaseMetadata is ERC721Base, ERC721Metadata {
/**
* Token name.
*/
string ... | Returns the URI for a given token ID. Throws if the token ID does not exist. May return an empty string. tokenID uint256 ID of the token to query./ | function tokenURI
(
uint256 tokenID
)
external
view
returns (string memory)
{
require(_tokenExists(tokenID), "Token does not exist.");
return _tokenURI[tokenID];
}
| 5,355,928 |
/**
*Submitted for verification at BscScan.com on 2021-08-21
*/
pragma solidity ^0.8.4;
pragma experimental ABIEncoderV2;
// SPDX-License-Identifier:MIT
interface IBEP20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
func... | generate the pancake pair path of token -> weth make the swap | function swapETHForTokens(
address routerAddress,
address recipient,
uint256 ethAmount
) internal {
IPancakeRouter02 pancakeRouter = IPancakeRouter02(routerAddress);
address[] memory path = new address[](2);
path[0] = pancakeRouter.WETH();
path[1] = addre... | 11,686,929 |
./full_match/3/0x8C2307E4E8FdcbD736DF934c50e19d9a0149F7A0/sources/MoiNFT.sol | Assign stats of the cryptomon | function createMon(Species species, uint price, bool forSale) public onlyManager {
assert(totalMons < max);
Mon storage mon = mons[totalMons];
mon.id = totalMons;
mon.owner = msg.sender;
mon.species = species;
mon.price = price;
mon.forSale = forSale... | 14,252,785 |
// SPDX-License-Identifier: MIT-open-group
pragma solidity >=0.5.15;
import "lib/ds-test/test.sol";
import "src/CryptoLibrary.sol";
contract CryptoLibraryTest is DSTest {
function sliceUint(bytes memory bs, uint start) internal pure returns (uint256) {
require(bs.length >= start + 32, "slicing out of ra... | Verify(bytes memory message, uint256[2] memory sig, uint256[4] memory pubK) public view returns (bool v) | function testVerify() public {
bytes memory message = bytes(hex"00010203");
uint256 privateKey = 1234567890;
uint256[2] memory signed = CryptoLibrary.Sign(message, privateKey);
uint256[4] memory publicKey = [
0x10d7b2c2f196fceb52d546ea33816bdcf2fa5dcc79bcbcf0ce34ca1128... | 7,279,209 |
/**
*Submitted for verification at Etherscan.io on 2021-05-07
*/
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.7.4;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface Token {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() ... | compute the unapplied burn to the deposit | function getBurn(uint slotId) public view returns (uint) {
Slot storage slot = slots[slotId];
uint referenceBlock = block.number;
if (paused) {
referenceBlock = pausedBlock;
}
uint burn = slot.burnRate * (referenceBlock - slot.lastUpdatedBlock);
if (burn >... | 10,670,052 |
pragma solidity 0.5.7;
pragma experimental ABIEncoderV2;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external retur... | Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend)./ | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath::sub: Integer underflow");
uint256 c = a - b;
return c;
}
| 1,773,233 |
/*
https://powerpool.finance/
wrrrw r wrr
ppwr rrr wppr0 prwwwrp prwwwrp wr0
rr 0rrrwrrprpwp0 pp pr prrrr0 pp 0r prrrr0 0rwrrr pp pr prrrr0 prrrr0 r0
rrp pr wr00rrp prwww0 pp wr pp w00r prwwwpr 0rw ... | @inheritdoc IVestedLPMining TODO: Make user.pendedCvp be updated as of the pool' lastUpdateBlock | function emergencyWithdraw(uint256 _pid) public override nonReentrant {
_validatePoolId(_pid);
Pool storage pool = pools[_pid];
User storage user = users[_pid][msg.sender];
pool.lpToken.safeTransfer(msg.sender, user.lptAmount);
emit EmergencyWithdraw(msg.sender, _pid, user.... | 146,628 |
pragma solidity ^0.4.18;
/// @title SafeMath contract - math operations with safety checks
contract SafeMath {
function safeMul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeDiv(uint a, uint b) internal pure returns ... | Tranfer tokens from one address to other _from source address _to dest address _value tokens amount return transfer result | function transferFrom(address _from, address _to, uint _value) onlyPayloadSize(2 * 32) canTransfer addIfNotExist(_to) public returns (bool success) {
var _allowance = allowed[_from][msg.sender];
balances[_to].value = safeAdd(balances[_to].value, _value);
balances[_from].value = safeSub(balances[_from].va... | 941,376 |
pragma solidity ^0.4.19;
pragma experimental ABIEncoderV2;
contract Anticorruption{
struct BasicInfo{
// Basic info of every entity
}
struct SchemesInfo{
// Schemes basic Info
}
function AddEntity(uint AdharcardNo, string name, address BankAccountNo) {
// Add... | Get info About Entity | function GetEntity(uint AdharcardNo) returns (string Name ,uint BankAccountNo ) {
}
| 5,458,860 |
./full_match/3/0x03b0258e8A3d9C0a7574bD55b06815998345ec1B/sources/contracts/DiamondHoldTestETH.sol | Sets the amount of tax that is taken for liquidity/ | function setLiquidityTaxPercent(uint256 tax) external onlyOwner() {
_liquidityTax = tax;
}
| 8,267,731 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@solidstate/contracts/proxy/diamond/Diamond.sol';
import '@solidstate/contracts/token/ERC20/metadata/ERC20MetadataStorage.sol';
contract MagicProxy is Diamond {
constructor() {
ERC20MetadataStorage.Layout storage l = ERC20MetadataStorage.lay... | @inheritdoc Proxy/ inline storage layout retrieval uses less gas | function _getImplementation () override internal view returns (address) {
DiamondBaseStorage.Layout storage l;
bytes32 slot = DiamondBaseStorage.STORAGE_SLOT;
address implementation = address(bytes20(l.facets[msg.sig]));
if (implementation == address(0)) {
implementation = l.fallbackAddress;
... | 287,454 |
./partial_match/1/0xA60b1f1b6E8e05b65647B6C3701B624093700B57/sources/DualStaking.sol | calculate interest to the current date time | function get_gains2(address _address, uint256 _rec_number) public view returns (uint256) {
uint256 _record_seconds = block.timestamp - ledger[_address][_rec_number].from;
uint256 _year_seconds = 365*24*60*60;
return (_record_seconds * ledger[_address][_rec_number].amount * ratio2 *... | 4,337,930 |
pragma solidity ^0.6.2;
import "./ERC777GSN.sol";
import "./ERC777WithAdminOperatorUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
contract PToken is
Initializable,
AccessControlUpgradeabl... | See {IERC20-transferFrom}. Note that operator and allowance concepts are orthogonal: operators cannot call `transferFrom` (unless they have allowance), and accounts with allowance cannot call `operatorSend` (unless they are operators). Emits {Sent}, {IERC20-Transfer} and {IERC20-Approval} events./ | function transferFrom(address holder, address recipient, uint256 amount) public virtual override returns (bool) {
require(recipient != address(0), "ERC777: transfer to the zero address");
require(holder != address(0), "ERC777: transfer from the zero address");
address spender = _msgSender()... | 21,393 |
./full_match/4/0xC838E0a073f1cF8Bf1D22cD9C452988CB14A4A55/sources/contracts/AllowanceModule.sol | Generates the data for the transfer hash (required for signing) | function generateTransferHashData(
address safe,
address token,
address to,
uint96 amount,
address paymentToken,
uint96 payment,
uint16 nonce
) private view returns (bytes memory) {
uint256 chainId = getChainId();
bytes32 domainSeparator = ... | 12,433,084 |
./full_match/3/0xEDabDb91c846f590D15c3fF61128BB61DA177578/sources/contracts/HeadshotTokenV2.sol | Converts an amount of tokens to reflections using the current rate. | function reflectionFromToken(uint256 tAmount, bool deductTransferFee) private view returns(uint256) {
require(tAmount <= _tTotal, "ERR");
if (!deductTransferFee) {
(uint256 rAmount,,,,,,) = _getValues(tAmount);
return rAmount;
(,uint256 rTransferAmount,,,,,) = _ge... | 8,247,020 |
./partial_match/56/0xd0367EF92B6fa5C62Ea50BE8C45f0f733D488b51/sources/MasterChef.sol | Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. | function add(uint256 _allocPoint, IBEP20 _lpToken, bool _withUpdate) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock;
totalAllocPoint = totalAllocPoint.add(_allocPoint);
poo... | 11,341,997 |
// Sources flattened with hardhat v2.6.0 https://hardhat.org
// File contracts/libraries/SafeMath.sol
pragma solidity ^0.6.6;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*
* @dev Default OpenZeppelin
*/
library SafeMath {
/**
* @dev Multiplies two unsi... | Internal function for staking--this allows us to skip updating stake multiple times during a batch stake. _nftId The ID of the NFT being staked. == coverId _user The user who is staking the NFT./ coverPrice must be determined by dividing by length. Update PlanManager to use the correct price for the protocol. Find pr... | function _stake(uint256 _nftId, address _user)
internal
{
(/*coverId*/, uint8 coverStatus, uint256 sumAssured, uint16 coverPeriod, uint256 validUntil, address scAddress,
bytes4 coverCurrency, /*premiumNXM*/, uint256 coverPrice, /*claimId*/) = IarNFT( getModule("ARNFT") ).getToken(_nftId... | 226,696 |
./full_match/1/0xd2E73E3254B1f9A1215cB1F1aE73b9B079B5E697/sources/contracts/libraries/LibDiamond.sol | Internal function version of diamondCut | function diamondCut(IDiamondCut.FacetCut[] memory _diamondCut, address _init, bytes memory _calldata) internal {
for (uint256 facetIndex; facetIndex < _diamondCut.length; ) {
IDiamondCut.FacetCutAction action = _diamondCut[facetIndex].action;
if (action == IDiamondCut.FacetCutAction.... | 3,122,812 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/GSN/Context.sol";
import "./INerdBaseToken.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "./IFeeApprover.sol";
import "./INerdVault.sol";
import "@nomiclabs/bu... | approve WETH for uniswapRouterV2 | function addLiquidityToUniswapNERDxWETHPair() public {
require(
liquidityGenerationOngoing() == false,
"Liquidity generation onging"
);
require(
LPGenerationCompleted == false,
"Liquidity generation already finished"
);
totalETH... | 6,460,655 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../interfaces/IEternalToken.sol";
import "../interfaces/IEternalLiquidity.sol";
import "../inheritances/OwnableEnhanced.sol";
/**
* @title Contract for the Eternal Token (ETRNL)
* @author Nobody (me)
* (credits to OpenZeppelin for initial framework and... | Sets the value of a given rate to a given rate type. (Admin and Fund only) rate The type of the specified rate newRate The specified new rate value Requirements: - Rate type must be either Liquidity, Funding, Redistribution or Burn - Rate value must be positive - The sum of all rates cannot exceed 25 percent/ | function setRate(Rate rate, uint16 newRate) external override onlyAdminAndFund() {
require((uint(rate) >= 0 && uint(rate) <= 3), "Invalid rate type");
require(newRate >= 0, "The new rate must be positive");
uint256 oldRate;
if (rate == Rate.Liquidity) {
require((newRate... | 6,406,117 |
// // SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "hardhat/console.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/Acces... | Calculates the necessary parameters for locking return Totally produced rewards/ | function produced() private view returns (uint256) {
return
allProduced +
(rewardPerDistribution * (block.timestamp - producedTime)) /
distributionTime;
}
| 490,670 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./IUmbraHookReceiver.sol";
contract Umbra is Ownable {
// =========================================== Events =============================... | Function only the toll collector can call to sweep funds to the toll receiver/ | function collectTolls() external {
require(msg.sender == tollCollector, "Umbra: Not toll collector");
tollReceiver.transfer(address(this).balance);
}
| 1,571,686 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.10;
import "./Oxo.sol";
/**
* @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 returns (uint256);
/**
... | Team reserve mint function number number of tokens to mint | function reserveMint(uint256 number) external onlyOwner {
require(number <= reserve);
reserve -= number;
bulkMint(number);
}
| 6,295,621 |
./full_match/1/0x7049386F00BB8e1f7c41c8B7124b9DaF539Abc59/sources/contracts/ERC721/FairFellaz.sol | Toggle the burn state for NFTs in the contract/ | function toggleBurnable() external {
if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) revert UnauthorisedUser();
burnable = !burnable;
emit BurnableSet(burnable);
}
| 3,013,211 |
./partial_match/1/0xa613d9a806199622b7064fB84A9F3443018173D7/sources/FarmV1.sol | update the ethy block reward, minimum viable block reward is 2102.4 ETHY a year (1e+15 units pre block). Ignoring any multipliers | function updateEthyPerBlock(uint256 _ethyPerBlock) public onlyOwner {
require(_ethyPerBlock > 1000000000000000, "rewards too Small");
ethyPerBlock = _ethyPerBlock;
}
| 16,060,273 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
import "../libs/ERC20Permit.sol";
import "../libs/VaultOwned.sol";
import "../libs/interface/IaGaas.sol";
contract Gaas is ERC20Permit, VaultOwned {
using SafeMath for uint256;
address aGaas;
bool isLBPComplete = false;
uint256 maxSupply... | Returns the address of the current vault./ | function vault() public view returns (address) {
return _vault;
}
| 439,596 |
/**
* SPDX-License-Identifier: MIT
**/
pragma solidity =0.7.6;
pragma experimental ABIEncoderV2;
import "./VotingBooth.sol";
import "../../../interfaces/IBean.sol";
import "../../../libraries/LibInternal.sol";
import "../../../libraries/LibIncentive.sol";
/**
* @author Publius
* @title Governance handles propsing... | Returns the integer division of two unsigned integers, reverting with custom message on division by zero. The result is rounded towards zero. CAUTION: This function is deprecated because it requires allocating memory for the error message unnecessarily. For custom revert reasons use {tryDiv}. Counterpart to Solidity's ... | function div(uint32 a, uint32 b, string memory errorMessage) internal pure returns (uint32) {
require(b > 0, errorMessage);
return a / b;
}
| 1,316,912 |
/**
*Submitted for verification at Etherscan.io on 2021-11-13
*/
// Sources flattened with hardhat v2.6.6 https://hardhat.org
// File deps/@openzeppelin/contracts-upgradeable/proxy/Initializable.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.24 <0.7.0;
/**
* @dev This is a base contract to aid in wri... | Initialize access control after creation. Function is intended to be called once and then upgraded away in a future iteration. vault is admin, can grant and revoke other roles vault and techOps can approve account access vault, techOps, and guardian can pause vault and techOps can unpause allowlist_managers (vault, tec... | function initializeAccessControl() external {
__Context_init_unchained();
__AccessControl_init_unchained();
_setupRole(DEFAULT_ADMIN_ROLE, 0xB65cef03b9B89f99517643226d76e286ee999e77);
_setupRole(DEFAULT_ADMIN_ROLE, 0xDA25ee226E534d868f0Dd8a459536b03fEE9079b);
_setupRole(ALL... | 10,994,499 |
./full_match/1/0x440E52dA3623203b0bc76FCae62429F2D4521173/sources/contracts/StrategyCvxCrvHelper.sol | File interfaces/convex/IBaseRewardsPool.solbalancewithdraw to a convex tokenized depositwithdraw directly to curve LP tokenclaim rewardsstake a convex tokenized depositstake a convex tokenized deposit for another address(transfering ownership) | interface IBaseRewardsPool {
function balanceOf(address _account) external view returns (uint256);
function withdraw(uint256 _amount, bool _claim) external returns (bool);
function withdrawAndUnwrap(uint256 _amount, bool _claim) external returns (bool);
function getReward() external returns (bool);
... | 3,105,037 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
contract OwnerNamespace {
struct OwnerStorage {
address owner;
address nominatedOwner;
}
function _ownerStorage() internal pure returns (OwnerStorage storage store) {
assembly {
// bytes32(uint(keccak256("io.s... | bytes32(uint(keccak256("io.synthetix.owner")) - 1) | function _ownerStorage() internal pure returns (OwnerStorage storage store) {
assembly {
store.slot := 0x1f33674ed9c09f309c0798b8fcbe9c48911f48b2defee8aecb930c5ef6f80e37
}
}
| 5,378,677 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
/**
* @title KosiumPioneer
* KosiumPio... | Remove users from the whitelist for the presale/ | function removeFromWhitelist(address[] calldata earlyAdopterAddresses) external onlyOwner{
for (uint i = 0; i < earlyAdopterAddresses.length; i++){
whitelistedPresaleAddresses[earlyAdopterAddresses[i]] = false;
}
}
| 11,806,565 |
./full_match/23295/0x4188A7d16f65F105603D243EdFe00E20C4c7f204/sources/contracts/SharedStorage.sol | TODO: consider using the same approach for subscriber signatures | function _requireSignatureValid(address account, bytes calldata signature) internal pure {
bytes32 messageHash = keccak256(abi.encode(account));
if (!_verifySignature(account, messageHash, signature)) {
revert InvalidSignature();
}
}
| 7,103,228 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.9.0;
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
library MySafeMath {
function add(uint256 a, uint256 b) internal pure return... | ------------------------------------------------------------------------ Token owner can approve for `spender` to transferFrom(...) `tokens` from the token owner's account https:github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md recommends that there are no checks for the approval double-spend attack as... | function approve(address _spender, uint256 _tokens) external override {
require(_spender != msg.sender);
allowed_[msg.sender][_spender] = _tokens;
emit Approval(msg.sender, _spender, _tokens);
}
| 498,404 |
./full_match/4/0x0CD1Bc0f54F60F5E3d428B203a3EDb802196Ab21/sources/TokenVesting.sol | return the amount of the vested token./ | function vested() public view returns(uint256) {
return _vestedAmount();
}
| 12,288,444 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;
import "./utils/Ownable.sol";
import "./utils/ERC165Checker.sol";
import "./IVaultHandler.sol";
import "./ALTS.sol";
import "./oracles/ChainlinkOracle.sol";
import "./utils/IERC20.sol";
/**
* @title ALTS Orchestrator
* @author LongTerm Finance
* @notice Orches... | Allows the owner to execute custom transactions target address value uint256 signature string data bytes Only owner can call it/ | function executeTransaction(
address target,
uint256 value,
string memory signature,
bytes memory data
) external payable onlyOwner returns (bytes memory) {
bytes memory callData;
if (bytes(signature).length == 0) {
callData = data;
callData = abi.encodePacked(bytes4(keccak256(by... | 13,129,814 |
./partial_match/1/0x2E2e0cc3AE127E657c513b9a94D8B22d4c11B720/sources/DollarBankForDSD.sol | return user Dollar balance,reward asc,not end reward of ascconsider compound interestif balance eq 0 means called updatePlayerStatus or new playerfor genesis reward | function getPlayerStatus(address adr)
public
view
returns (
uint256,
uint256,
uint256
)
{
Player memory ply = playersMap[adr];
if (ply.balance == 0) return (ply.balance, ply.rewardBalance, 0);
uint256 balance = ply.bala... | 2,778,153 |
pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
... | Function to mint tokens target The address that will receive the minted tokens mintedAmount The amount of tokens to mint return A boolean that indicates if the operation was successful/ | function mintTokens(address target, uint mintedAmount) public onlyOwner returns (bool success) {
totalSupply = totalSupply.add(mintedAmount);
balances[target] = balances[target].add(mintedAmount);
Mint(target, mintedAmount);
return true;
}
| 5,469,617 |
pragma solidity ^0.4.23;
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(... | Total candys in the box. | function total() public view returns (uint number){
return candyIdIndex_;
}
| 13,052,976 |
/*
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
Unless required by applicable law or agreed to in writing, ... | Add two decimals. | function add(uint256 a, uint256 b)
internal
pure
returns (int256 r)
{
require(int256(a) >= 0, "D18/DECIMAL_VALUE_TOO_BIG");
require(int256(b) >= 0, "D18/DECIMAL_VALUE_TOO_BIG");
r = _add(int256(a), int256(b));
}
| 11,991,476 |
pragma solidity ^0.4.20;
// ----------------------------------------------------------------------------------------------
// KNOW Token by Kryptono Limited.
// An ERC223 standard
//
// author: Kryptono Team
// Contact: William@kryptono.exchange
library SafeMath {
function add(uint a, uint b) internal pure return... | Transfers the balance from msg.sender to an account _to Recipient address _value Transfered amount in unit return Transfer status Standard function transfer similar to ERC20 transfer with no _data . Added due to backwards compatibility reasons . | function transfer(address _to, uint _value)
public
isTradable
returns (bool success) {
require(_to != 0x0);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}... | 410,652 |
./full_match/5/0x26532eCc92e9BEa896De29F2DD69683Cf15dE501/sources/contracts/interface/KhronusTimeCog.sol | Time Delta, returns the result in days of substracting the compared date from the base date, it returns the number of days and the direction 0 for positive, 1 for negative. | function timeDelta(uint[3] memory _baseDate,uint[3] memory _comparedDate) internal pure returns (uint _timestampDays, uint _direction){
require (isValidDate(_baseDate[0], _baseDate[1], _baseDate[2]) && isValidDate(_comparedDate[0], _comparedDate[1], _comparedDate[2]), "One of the dates is not valid");
... | 7,089,896 |
pragma solidity 0.5.16;
library ExtendedMath {
/**
* @return The given number raised to the power of 2
*/
function pow2(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * a;
require(c / a == a, "ExtendedMath: squaring ove... | Calls internal "_mint" method and then transfers tokens to the sender. _sender The address of the sender. _id User's unique deposit ID. _amount The amount to withdraw (0 - to withdraw all)./ | function _withdraw(address _sender, uint256 _id, uint256 _amount) internal nonReentrant {
require(_id > 0, "wrong deposit id");
require(balances[_sender][_id] > 0 && balances[_sender][_id] >= _amount, "insufficient funds");
uint256 amount = _amount == 0 ? balances[_sender][_id] : _amount;
... | 13,141,580 |
/**
*Submitted for verification at Etherscan.io on 2020-05-24
*/
/**
*Submitted for verification at Etherscan.io on 2020-05-23
*/
/*
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββ¦ββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββ... | emit lostMoneyForLevelEvent(referer, msg.sender, _level, now); | function payReferral(uint _level, address _user) internal {
address referer;
referer = userList[users[_user].referrerID];
bool sent = false;
uint level_price_local=0;
if(_level>4){
level_price_local=unlimited_level_price;
... | 1,352,150 |
pragma solidity ^0.5.0;
import "./AccessControl.sol";
import "./SafeMath.sol";
contract TokenRepository is Ownable {
using SafeMath for uint256;
// Name of the ERC-20 token.
string public name;
// Symbol of the ERC-20 token.
string public symbol;
// Total decimals of the ERC-20 token.
... | Decreases the balance of the address. _owner Address to decrease the balance of. _value Value to decrease./ | function decreaseBalance(address _owner, uint256 _value) public onlyOwner {
balances[_owner] = balances[_owner].sub(_value);
}
| 1,041,242 |
pragma solidity ^0.4.18;
/// @title Interface for contracts conforming to ERC-721: Deed Standard
/// @author William Entriken (https://phor.net), et. al.
/// @dev Specification at https://github.com/ethereum/eips/XXXFinalUrlXXX
interface ERC721 {
// COMPLIANCE WITH ERC-165 (DRAFT) ////////////////////////////////... | uint maxIndex = 9; fail tx if player is already champion! in theory players could increase their powerlevel by contesting themselves but this check stops that from happening so other players have the chance to become the temporary champion! you have beaten this one so increase temporary rank remove ourselves from this ... | function contestChampion(uint256 _tokenId) external {
if (currChampion == msg.sender) {
revert();
}
require(core.isTrainer(msg.sender));
require(core.monsterIndexToOwner(_tokenId) == msg.sender);
var (n, m, stats, l, k, d) = core.getMonster(_t... | 1,977,391 |
// File: @openzeppelin/contracts/GSN/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be... | Creates a new background for NFTs. New stakers could get this background./ | function addBackground(uint8 increase)
public
onlyOwner()
{
backgrounds += increase;
}
| 147,476 |
pragma solidity ^0.5.0;
interface ERC20 {
function totalSupply() external view returns (uint supply);
function balanceOf(address _owner) external view returns (uint balance);
function transfer(address _to, uint _value) external returns (bool success);
function transferFrom(address _from, address _to, u... | TODO: currenlty only adjusted to kyber, but should be genric interfaces for more dec. exchanges | interface ExchangeInterface {
function swapEtherToToken (uint _ethAmount, address _tokenAddress, uint _maxAmount) payable external returns(uint, uint);
function swapTokenToEther (address _tokenAddress, uint _amount, uint _maxAmount) external returns(uint);
function getExpectedRate(address src, address dest... | 7,315,823 |
pragma solidity ^0.4.13;
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity autom... | Used for forcing ensureStage modifier/ | function setCurrentStage() onlyOwner ensureStage returns (bool) {
return true;
}
| 14,079,268 |
// Sources flattened with hardhat v2.1.2 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/IERC20.sol@v3.4.2
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
... | function is internally funding the farm, by adding farmed rewards by user to the end _amount - how many tokens is funded/ Compute new end time Increase farm total rewards | function _fundInternal(
uint256 _amount
)
internal
{
require(
block.timestamp < endTime,
"fund: too late, the farm is closed"
);
require(_amount > 0, "Amount must be greater than 0.");
endTime += _amount.div(rewardPerSecond);
to... | 11,685,074 |
pragma solidity ^0.4.21;
import "openzeppelin-solidity/contracts/crowdsale/distribution/FinalizableCrowdsale.sol";
import "openzeppelin-solidity/contracts/crowdsale/validation/CappedCrowdsale.sol";
import "openzeppelin-solidity/contracts/crowdsale/validation/TimedCrowdsale.sol";
import "openzeppelin-solidity/contracts... | Checks if the contribution made is within the allowed limits/ | function _checkLimits(address beneficiary, uint256 weiAmount) internal {
uint256 newBalance = balances[beneficiary].add(weiAmount);
require(newBalance <= maxCumulativeContrib && weiAmount >= minContrib);
require(tx.gasprice <= maxGasPrice);
}
| 12,957,604 |
./partial_match/1/0x99A4f8B9f3b886074048828599C90053c101e665/sources/ColourPoolReward.sol | stake visibility is public as overriding LPTokenWrapper's stake() function | function stake(uint256 amount) public updateReward(msg.sender) override checkStart{
require(amount > 0, "Cannot stake 0");
super.stake(amount);
emit Staked(msg.sender, amount);
}
| 15,708,186 |
./full_match/1/0x101D531cc5403aB1e009bb3EAB55210cC13dA956/sources/Tickets.sol | pragma solidity >=0.6.2; | interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function remove... | 3,163,421 |
pragma solidity ^0.8.1;
// SPDX-License-Identifier: GPL-3.0-only
import "OpenFirstPriceAuction.sol";
abstract contract OpenFirstPriceAuctioneerUInt256 is AuctionListener {
mapping( uint256 => OpenFirstPriceAuction ) public keyToAuction;
mapping( OpenFirstPriceAuction => uint256 ) public auctionToKey;
mappi... | we've got to ensure the is visibly over BEFORE handleAuctionCompleted, so that function can safely effectuate transfers | function auctionCompleted( address seller, address winner, uint winningBid ) public override {
OpenFirstPriceAuction auction = OpenFirstPriceAuction(msg.sender);
uint256 key = auctionToKey[auction];
address oldOwner = keyOwner(key);
require( key != 0, "Notification is not from one of our live auction... | 5,493,163 |
//Address: 0x861825daa0068136a55f6effb3f4a0b9aa17f51f
//Contract name: Token
//Balance: 0 Ether
//Verification Date: 1/17/2018
//Transacion Count: 167
// CODE STARTS HERE
// Copyright (c) 2017, 2018 EtherJack.io. All rights reserved.
// This code is disclosed only to be used for inspection and audit purposes.
// ... | Croupier uses this method stop selling user's tokens and return them to normal deposit _user The user whose deposit is being unfrozen _value The value to unfreeze according to Croupier's records (off-chain sale data) | function unfreezeDeposit(address _user, uint256 _value) onlyCroupier public {
require(_value > 0);
require(frozenPool >= _value);
depositOf[_user] = depositOf[_user].add(_value);
totalDeposit = totalDeposit.add(_value);
frozenPool = frozenPool.sub(_value);
DepositU... | 15,810,048 |
./full_match/8453/0xdd753E08BB09F22593537f29100F0eD98AfA57FA/sources/contracts/KeyManager.sol | Function to transfer given membershipfrom a lock and token. This requires a deadline and transferCode (signature)/ | function transfer(
address lock,
uint token,
address owner,
uint deadline,
bytes memory transferCode
) public {
if (block.timestamp > deadline) {
revert TOO_LATE();
}
bytes32 structHash = keccak256(
abi.encode(
keccak256(
"Transfer(address lock,uint256 ... | 11,556,719 |
// Sources flattened with hardhat v2.8.0 https://hardhat.org
// SPDX-License-Identifier: MIT
// File contracts/interfaces/IPublicLock.sol
pragma solidity >=0.5.17 <0.9.0;
/**
* @title The PublicLock Interface
* @author Nick Furfaro (unlock-protocol.com)
*/
interface IPublicLock
{
// See indentationissue descripti... | See indentationissue description here: https:github.com/duaraghav8/Ethlint/issues/268 solium-disable indentation receive() external payable; roles | {
function initialize(
address _lockCreator,
uint _expirationDuration,
address _tokenAddress,
uint _keyPrice,
uint _maxNumberOfKeys,
string calldata _lockName
) external;
function DEFAULT_ADMIN_ROLE() external pure returns (bytes32);
function KEY_GRANTER_ROLE() external pure returns ... | 14,041,257 |
/**
* @title: CHAI wrapper
* @summary: Used for interacting with CHAI. Has
* a common interface with all other protocol wrappers.
* This contract holds assets only during a tx, after tx it should be empty
* @author: Idle Labs Inc., idle.finance
*/
pragma solidity 0.5.16;
import "@openzeppelin... | Gets all underlying tokens in this contract and mints chaiTokens tokens are then transferred to msg.sender NOTE: underlying tokens needs to be sended here before calling this return chaiTokens minted/ | function mint()
external onlyIdle
returns (uint256 chaiTokens) {
uint256 balance = IERC20(underlying).balanceOf(address(this));
if (balance == 0) {
return chaiTokens;
}
CHAI(token).join(msg.sender, balance);
chaiTokens = balance.mul(10**18).div(_chaiPrice());
}
| 5,542,284 |
// Sources flattened with hardhat v2.6.4 https://hardhat.org
// File @openzeppelin/contracts/utils/math/SafeMath.sol@v4.3.2
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wra... | Transfers vested tokens to beneficiary. token ERC20 token which is being vested/ | function release(IERC20 token) public {
uint256 unreleased = releasableAmount(token);
require(unreleased > 0);
released[address(token)] = released[address(token)].add(unreleased);
token.safeTransfer(beneficiary, unreleased);
emit Released(unreleased);
}
| 11,787,430 |
./full_match/1/0xE588ceDcf59C18Fad513c0326B5D41F0E514Cd03/sources/contracts/TheShadesEffect.sol | Verify whitelist requirements | function whitelistMint(uint256 _mintAmount, bytes32[] calldata _merkleProof) public payable mintCompliance(_mintAmount) mintPriceCompliance(_mintAmount) {
require(whitelistMintEnabled, 'The whitelist sale is not enabled!');
require(!whitelistClaimed[_msgSender()], 'Address already claimed!');
bytes32 leaf... | 8,479,273 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.