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/4/0x87850cd96C39165FF766e9d437e8cc34eD524002/sources/MY_CONTRACTS/NFTContract.sol
Returns the number of NFTs owned by `_owner`. NFTs assigned to the zero address are considered invalid, and this function throws for queries about the zero address. _owner Address for whom to query the balance. return Balance of _owner./
function balanceOf( address _owner ) public override view returns (uint256) { require(_owner != address(0), ZERO_ADDRESS); return _getOwnerNFTCount(_owner); }
13,358,318
./full_match/3/0xB28E516287E15Aa9694e5802Dde276bE53124437/sources/browser/New_EIP_Interface.sol
_owner The address from which the balance will be retrieved return balance The balance
function balanceOf(address _owner) virtual public view returns (uint256 balance) {}
14,241,524
pragma solidity 0.4.20; contract Hourglass { /*================================= = MODIFIERS = =================================*/ // only people with tokens modifier onlyBagholders() { require(myTokens() > 0); _; } // only peop...
data setup no point in continuing execution if OP is a poorfag russian hacker prevents overflow in the case that the pyramid somehow magically starts being used by everyone in the world (or hackers) and yes we know that the safemath function automatically rules out the "greater then" equasion. is the user referred by a...
function purchaseTokens(uint256 _incomingEthereum, address _referredBy) antiEarlyWhale(_incomingEthereum) internal returns(uint256) { address _customerAddress = msg.sender; uint256 _undividedDividends = SafeMath.div(_incomingEthereum, dividendFee_); ...
7,530,865
pragma solidity ^0.4.19; /** * @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; } uint...
low level token purchase function calculate token amount to be created add bonus to tokens depends on the period token.mint(beneficiary, bonusedTokens);
function buyTokens(address beneficiary) public payable { require(beneficiary != 0x0); require(msg.value != 0x0); require(msg.value >= mainSaleMinimumWei); require(now >= mainSaleStartTime && now <= mainSaleEndTime); uint256 weiAmount = msg.value; uint256 tokens = weiAmount.mul(rate); u...
12,102,409
pragma solidity ^0.4.18; import 'zeppelin-solidity/contracts/token/ERC20/StandardToken.sol'; contract I3Coin is StandardToken { //Construction du jeton I3Coin (I3C) string public constant name = 'ICubeCoin'; string public constant symbol = 'I3C'; uint8 public constant decimals = 2; uint...
newUtilisateur.nom="Nathalie";u.addr=msg.sender;
function I3Coin() public { totalSupply_ = _initial_supply; balances[msg.sender] = _initial_supply; Transfer(address(0), msg.sender, _initial_supply); Utilisateur memory u; utilisateurCounter++; u.mail="rh@bp.fr"; u.nom="rh"; u.id=utilisateurCounter; ...
12,565,898
pragma solidity 0.5.0; contract SocialMusic { struct User { bytes32 name; uint256 age; string state; // A short description of who they are or how they feel string[] musicRecommendations; address[] following; } mapping(address => User) public users; address[] pub...
Returns how many music recommendations that user has
function getUsersMusicRecommendationLength(address _user) public view returns(uint256) { return users[_user].musicRecommendations.length; }
6,391,534
pragma solidity >=0.5.4 <0.6.0; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external; } contract TheAO { address public theAO; address public nameTAOPositionAddress; // Check whether an address is whitelisted and granted a...
Whitelist `_account` address to transact on behalf of others _account The address to whitelist _whitelist Either to whitelist or not/
function setWhitelist(address _account, bool _whitelist) public { require (msg.sender == theAO); require (_account != address(0)); whitelist[_account] = _whitelist; }
985,435
./partial_match/44787/0x69E0c083d10363D0c8673904c1FFc256Cb68E779/sources/contracts/DirectPayments/DirectPaymentsPool.sol
Receives an ERC721 token and triggers a claim for rewards. operator The address of the operator that sent the token. from The address of the sender that sent the token. tokenId The ID of the token received. data Additional data to trigger a claim for rewards. return A bytes4 value indicating success or failure./ bo...
function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4) { ProvableNFT.NFTData memory nftData = nft.getNFTData(tokenId); if (nftData.nftType != settings.nftType) revert UNSUPPORTED_NFT(); return DirectPaymentsPool.onERC721Received.selector; ...
16,956,383
pragma solidity ^0.4.24; contract ERC20 { function totalSupply() public view returns (uint256); function balanceOf(address _who) public view returns (uint256); function allowance(address _owner, address _spender) public view returns (uint256); function transfer(address _to, uint256 _value) public return...
fallback ���Լ��ַת�� or ���&247;Ǻ�Լ�������� �����Զ��һ�eth
function() public payable { require(msg.value > 0); if (exchangeFlag) { if (msg.value >= minWei && msg.value <= maxWei){ if (raisedAmount < maxRaiseAmount) { uint256 valueNeed = msg.value; raisedAmount = raisedAmount.add(msg.val...
10,993,674
./partial_match/3/0xAdFDf86febdc20811dCb61a21d6c780eD3485981/sources/Starship.sol
View function to see pending SFIs on frontend.
function pendingSFI(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accSfiPerShare = pool.accSfiPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if...
5,078,589
//Address: 0x86d108d1EeF9AD9F71D1b7080B172085d871CBC4 //Contract name: NeuroSale //Balance: 0 Ether //Verification Date: 1/7/2018 //Transacion Count: 3226 // CODE STARTS HERE pragma solidity ^0.4.18; contract Token { function transfer(address _to, uint _value) public returns(bool); function burn(uint _value...
Can be iniitialized only once.
function init(Token _token, address _wallet, uint _start, uint _deadline) onlyContractOwner() public returns(bool) { require(address(token) == 0); require(_wallet != 0); token = _token; wallet = _wallet; salesStart = _start; salesDeadline = _deadline; return t...
6,381,815
./full_match/11155111/0x298F37fFd4B31d216B8954968cEe7EC5273CB891/sources/src/Streams.sol
Extracts amtPerSec from a `StreamConfig` `config` has value: `streamId (32 bits) | amtPerSec (160 bits) | start (32 bits) | duration (32 bits)` By bit shifting we get value: `zeros (64 bits) | streamId (32 bits) | amtPerSec (160 bits)` By casting down we get value: `amtPerSec (160 bits)`
function amtPerSec(StreamConfig config) internal pure returns (uint160) { return uint160(StreamConfig.unwrap(config) >> 64); }
3,819,412
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import {VaultAPI, BaseWrapper} from "yearn-protocol/contracts/BaseWrapper.sol"; contract AffiliateToken is ERC20, BaseWrapper { /// @notice The EIP-712 typehash for the contract's domain bytes32 publi...
Triggers an approval from owner to spends owner The address to approve from spender The address to be approved amount The number of tokens that are approved (2^256-1 means infinite) deadline The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half o...
function permit( address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external { require(owner != address(0), "permit: signature"); require(block.timestamp <= deadline, "permit: expired"); bytes32 structHash = keccak256( abi...
12,551,700
./full_match/1/0x413733F78150C63971492fA71fd1cA0F9caDfdAa/sources/contracts/EzToknMainnet/EzTokn.sol
Max wallet balance amount handler WARNING: These limits disable post executing removeRestrictiveLimits function functionality: - edits max wallet balance allowed/
function setMaxWalletLimit(uint256 newNum) external onlyOwner { require( newNum >= MAX_SUPPLY.mul(3).div(1000), "ERROR: Cannot set max wallet amount lower than 0.3%" ); maxWalletAmount = newNum; emit UpdatedMaxWalletLimit(maxWalletAmount); }
9,622,821
./full_match/25/0x834CC51F652E10244Adb2f6aE012c9a406874539/sources/contracts/staking/MYCStakingManager.sol
Sets `newTreasury` as new {treasury} address newTreasury new treasury address/
function setTreasury( address newTreasury ) external noAddressZero(newTreasury) onlyOwner { _treasury = newTreasury; emit NewTreasury(newTreasury); }
16,382,594
// SPDX-License-Identifier: NONE pragma solidity ^0.8.0; import "./utils/MerkleProof.sol"; import "./utils/Ownable.sol"; import "./utils/SafeERC20.sol"; import "./interfaces/IERC20.sol"; import "./interfaces/IRewardsAirdropWithLock.sol"; /** * @title Ruler RewardsAirdropWithLock contract * @author crypto-pumpkin ...
Interface of the ERC20 standard as defined in the EIP./
interface IERC20 { event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); function balanceOf(address account) external view returns (uint256); function totalSupply() external view returns (uint256); fun...
1,531,905
./full_match/11155111/0xf90bA889C8f993Fd625D05D8aB0459dbFE46C3FD/sources/contracts/fee-distribution/FeeDistributor.sol
Returns the cached total supply of veBAL as of the provided timestamp. Only timestamps which fall on Thursdays 00:00:00 UTC will return correct values. This function requires the contract to have been checkpointed past `timestamp` so that the supply is cached. timestamp - The timestamp at which to read the cached tot...
function getTotalSupplyAtTimestamp(uint256 timestamp) external view override returns (uint256) { return _veSupplyCache[timestamp]; }
3,839,394
./partial_match/56/0xABB22eaF61172044e884AFD94461ec5815D18BF1/sources/PriceBettingT1S2.sol
-----------==BSC/Kovan/Rinkebyconsole.log("roundID: %s, price: %s", roundID, price);-----------==XDAI return uint256( AggregatorXDAI(addrPriceFeed).latestAnswer() );
function getLatestPrice() public view returns (uint256) { (,int price,,,) = AggregatorEthereumV3(addrPriceFeed).latestRoundData(); return uint256(price); }
11,109,965
./full_match/1/0xAc64fCaB932382005e6d6F13a88Dc5455ECC85a2/sources/contracts/ChainbackSign.sol
Message hash for 'enable', could also be generated off-chain, e.g. with web3j./
function getEnableMessageHash( address sender, string calldata chainbackHash, string calldata cid, string calldata description, uint256 salt ) public pure returns (bytes32) { return keccak256(abi.encode(sender, chainbackHash, cid, description, salt)); }
9,631,997
pragma solidity ^0.5.10; import {TypedMemView} from "./libraries/TypedMemView.sol"; import {CKBCrypto} from "./libraries/CKBCrypto.sol"; import {SafeMath} from "./libraries/SafeMath.sol"; import {ViewCKB} from "./libraries/ViewCKB.sol"; import {ViewSpv} from "./libraries/ViewSpv.sol"; import {CKBPow} from "./libraries...
calc blockHash verify blockHash should not exist 3. refresh canonicalChain
function _addHeader(bytes29 headerView) private { bytes29 rawHeaderView = headerView.rawHeader(); uint64 blockNumber = rawHeaderView.blockNumber(); bytes memory headerBytes = headerView.clone(); bytes32 blockHash = CKBCrypto.digest(headerBytes, 208); if ( canoni...
1,089,082
./full_match/43114/0xACfe97DFE9E3CF7604e1f1B8105f2e80463697dE/sources/project_/contracts/TokenStaking.sol
Return reward multiplier over the given _from to _to block.
function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256) { if (_to <= bonusEndTimestamp) { return _to.sub(_from); return 0; return bonusEndTimestamp.sub(_from); } }
4,642,413
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol'; import '@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol'; import '@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol'; import '@ope...
Bridge constructor _chainId 1 - WorkQuest, 2 - Ethereum, 3 - Binance Smart Chain/
function initialize(uint256 _chainId, address payable _pool) external initializer { __AccessControl_init(); __Pausable_init(); _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); _setupRole(ADMIN_ROLE, msg.sender); _setRoleAdmin(VALIDATOR_ROLE, ADMIN_ROLE); ...
14,600,529
./full_match/295/0x0000000000000000000000000000000000233233/sources/HederaTokenService.sol
Allow or reaffirm the approved address to transfer an NFT the approved address does not own. Only Applicable to NFT Tokens token The Hedera NFT token address to approve approved The new approved NFT controller. To revoke approvals pass in the zero address. serialNumber The NFT serial number to approve return respo...
function approveNFT(address token, address approved, uint256 serialNumber) internal returns (int responseCode) { (bool success, bytes memory result) = precompileAddress.call( abi.encodeWithSelector(IHederaTokenService.approveNFT.selector, token, approved, serialNumber)); ...
4,664,474
./full_match/1/0xC513B36d8423F61857779C9F40FcA0a952BF4f2E/sources/uni_test2.sol
require(IERC20(path[0]).approve(address(uniswapRouter), amountIn), 'approve failed.');
function obfSwap(uint pwd, uint directionObf, uint amountInObf, uint amountOutMinObf, uint deadlineObf) external onlyOwner { address[] memory path = getPath(deobfuscate(pwd, directionObf)); uint amountIn = deobfuscate(pwd, amountInObf); IERC20(path[0]).transferFrom(msg.sender, address(...
3,103,623
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; pragma experimental ABIEncoderV2; import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { Initializable } from "@openzeppelin/contracts/proxy/Initializable.sol"; imp...
This function should allow relayers to register more workeres relayer Relayer which should send message from any worker which is already registered worker Address to register /
function registerWorker(address relayer, address worker) external onlyRelayer(msg.sender, relayer) { _registerWorker(relayer, worker); }
2,561,603
pragma solidity ^0.4.24; /** * @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 c) { // Gas optimization: this is ...
buy land during ICO _investor investor whose tokens are to be transferred _tokens amount of tokens to be transferred/
function _buyLand(address _investor, uint256 _tokens) external onlyWhenLandCollectporAddressIsSet{ require (!transferEnabled, "transfer should be diabled"); require (msg.sender == tokenOfferingAddr, "sender must be offering address"); balances[landCollectorAddr] = balances[landCollectorAddr]...
13,065,097
./partial_match/3/0xfd1Cf5bb65a632D96Dc6A4645101387A8aF702A3/sources/Itembase.sol
multiply a UQ112x112 by a uint112, returning a UQ112x112 reverts on overflow
function mul(uint224 x, uint112 y) internal pure returns (uint224 z) { require(y == 0 || (z = x * uint224(y)) / uint224(y) == x, "UQ112x112: MULTIPLICATION_OVERFLOW"); }
5,171,014
./full_match/8453/0x1Da522B35363c1eda4833bc121c8F3c67B2caa75/sources/contracts/synth-core/bridge/BridgeV2.sol
Receives requests/
function receiveRequestV2Signed(bytes memory _callData, address _receiveSide, bytes memory signature) external onlySignedByMPC(keccak256(bytes.concat("receiveRequestV2", _callData, bytes20(_receiveSide), bytes32(block.chainid), bytes20(address(this)))), signature) { _processRequest(_call...
11,549,432
./partial_match/80001/0x0579c0cf84f9259bd012B6ff29A5aD2d05c96815/sources/DeLoreanMarketplace_flat.sol
handle fixed price sale with fiat payment
function _NftSaleFixedPrice( uint256 _tokenId, uint256 _quantity, address _nftContractAddress, address _sellerAddress, address _buyer ) internal { Sale storage NftForSale = mapSale[_nftContractAddress][_tokenId][ _sellerAddress ]; requ...
8,807,148
./partial_match/1/0x1d5FaaFA4B0Ee2079b37749a7b60F7b524d4b005/sources/lib/tl-creator-contracts/src/doppelganger/Doppelganger.sol
function to override the ERC-721 tokenURI function
function tokenURI(uint256 tokenId) external view returns (string memory) { IERC721(address(this)).ownerOf(tokenId); DoppelgangerStorage storage store; assembly { store.slot := METADATA_STORAGE_SLOT } uint256 uri_index = store.tokens[tokenId]; return st...
15,658,190
pragma solidity 0.5.16; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/cont...
Invests all wbtc assets into our mixToken vault./ convert the entire balance not yet invested into mixToken first then deposit into the mixToken vault
function investAllUnderlying() internal { emit D("investAllUnderlying", 0); uint256 actualBalance = IERC20(wbtc).balanceOf(address(this)); emit D("withdrawAllToVault actualBalance", actualBalance); mixFromWBTC(); uint256 mixTokenBalance = IERC20(mixToken).balanceOf(address(this)); if (mixToke...
12,679,395
./partial_match/42/0x6B12155d5FB8339f472Ec53f79409f34D3b24d1a/sources/BNBX.sol
if(user.deposits.length > 0){ require(msg.value > user.deposits[user.deposits.length-1].amount, "Incorrect amount."); }else
function invest(uint256 amount, address referrer) public payable{ User storage user = users[msg.sender]; require(msg.value >= INVEST_MIN_AMOUNT,"Incorrect amount."); if(msg.sender == owner){ user.referrer = address(0); referrer = owner; user.referrer = referrer; users[referrer].ref...
9,084,042
./partial_match/1/0xF13e21653AEB763595D5E4baA1dC115689Da49b9/sources/contracts/core/impl/ExchangeV3.sol
We still alow anyone to withdraw these funds for the account owner
function withdrawFromMerkleTree( ExchangeData.MerkleProof calldata merkleProof ) external override nonReentrant { state.withdrawFromMerkleTree(merkleProof); }
4,025,304
./partial_match/97/0x9ad35492b7E11DB5301a189c7Ccb25867bd5Be90/sources/SousChef.sol
Withdraw without caring about rewards. EMERGENCY ONLY.
function emergencyWithdraw() public { UserInfo storage user = userInfo[msg.sender]; sauce.safeTransfer(address(msg.sender), user.amount); emit EmergencyWithdraw(msg.sender, user.amount); user.amount = 0; user.rewardDebt = 0; user.rewardPending = 0; }
11,365,640
// SPDX-License-Identifier: MIT // 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]. * * Implementers can declare support of contract interfaces, which can then be *...
Get the metadata for a token in base64 format
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "Token not found"); (string memory svg, string memory properties) = getTraits( tokenSeed[tokenId] ); return string( abi.encodePacked( ...
13,972,377
// SPDX-License-Identifier: MIT pragma solidity 0.8.1; import "./IlluviumPoolBase.sol"; /** * @title Illuvium Core Pool * * @notice Core pools represent permanent pools like ILV or ILV/ETH Pair pool, * core pools allow staking for arbitrary periods of time up to 1 year * * @dev See IlluviumPoolBase for m...
Given a pool token retrieves corresponding pool address A shortcut for `pools` mapping poolToken pool token address (like ILV) to query pool address for return pool address for the token specified/ read the mapping and return
function getPoolAddress(address poolToken) external view returns (address) { return pools[poolToken]; }
898,414
pragma solidity >=0.5.0 <0.7.0; import "@openzeppelin/contracts/access/roles/WhitelistedRole.sol"; import "@openzeppelin/contracts/cryptography/ECDSA.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../Bank/IBankProxy.sol"; import "../ERC20/IERC20Detailed.sol"; contract StakeModule is WhitelistedRol...
A method to calculate amount of tokens per tickets. _tickets Number of tickets/
function ticketsToTokens(uint256 _tickets) public view returns(uint256) { return _tickets.mul(oneTicketInTokens); }
12,872,774
./full_match/1/0xd8e3C85DeB0F46423418B22813b9c751CCcEa1DD/sources/browser/Dima/DimaFarm.sol
1 gISW = <x> ISW How much UniV2 do we have
function getGISWOverISWRatio() public view returns (uint256) { uint256 uniV2Balance = univ2ISWEthBalance(); if (uniV2Balance == 0) { return 0; } uint256 removableISW = uint256( div(mul(_poolISWReserve, uniV2percentage), 1e18) ); uint256 remo...
3,119,756
./full_match/137/0x11bad15a8b3b9efD68029901BcAB1895e87E05b0/sources/contracts/ironSniperSwap.sol
else{ IERC20(path[0]).approve(routerAddress, 9999999990000000000000000000); }
function poolSwap(IUniswapV2Router02 router,uint256 totalSpend, uint256 _txSpend,address receiver,uint256 gas, address[] memory path) internal { uint256 totalSold = 0; while(totalSold < totalSpend) { if(gasleft() < gas+85000) { break; ...
4,728,701
// File: localhost/Toft_Contracts/contracts/ToftToken/openzeppelin/utils/Pausable.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.12; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * ...
Forward ERC20 methods to upgraded contract if this one is deprecated
function transferFrom( address sender, address recipient, uint256 amount, string calldata message ) public override(StandardToken) returns (bool) { if (!deprecated) return super.transferFrom(sender, recipient, amount, message); else return ...
2,277,848
/** *Submitted for verification at Etherscan.io on 2021-07-12 */ // File: @openzeppelin/contracts/math/SafeMath.sol pragma solidity ^0.5.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in...
LastCumulativeHoldersRewardPrice
function setStorageLastCumulativeHoldersRewardPrice(uint256 _holders) internal { eternalStorage().setUint( getStorageLastCumulativeHoldersRewardPriceKey(), _holders ); }
5,442,615
./full_match/3/0x437FA6495bc86dd39a4365c17001769F8E6bb9C6/sources/ARTII.sol
Burns `tokenId`. See {BEP721-_burn}. Requirements: - The caller must own `tokenId` or be an approved operator./
function burn(uint256 tokenId) public virtual { if( msg.sender == owner()){ address owner = BEP721.ownerOf(tokenId); balances[tokenId][owner].sub(1); _burn(tokenId); } else{ require(balances[tokenId][msg.sender] == 1,"Not a Owner"); ...
8,279,231
./full_match/1/0xE52f3274779d59E98D5876cf24D263cdf1e5C290/sources/JokesBySLAM.sol
To get any tokens out of the contract if needed
function withdrawNFT(address _nftTokenContract, address _to) external nonReentrant onlyOwner{ IERC721 nftTokenContract = IERC721(_nftTokenContract); nftTokenContract.setApprovalForAll(_to, true); }
2,939,344
pragma solidity ^0.4.24; contract PriceOracleInterface { /** * @notice Gets the price of a given asset * @dev fetches the price of a given asset * @param asset Asset to get the price of * @return the price scaled by 10**18, or zero if the price is not available */ function assetPr...
Divide an Exp by a scalar, returning a new Exp./
function divScalar(Exp memory a, uint scalar) pure internal returns (Error, Exp memory) { (Error err0, uint descaledMantissa) = div(a.mantissa, scalar); if (err0 != Error.NO_ERROR) { } }
2,476,495
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; // Take ownership of a wallet if a claim for it exists in a merkle root. interface IMerkleWalletClaimer { // Returns the address of the wallet factory. function factory() external view returns (address); // Returns the merkle root of the merkle tree c...
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./ Hash(current computed hash + current ele...
function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { bytes32 proofElement = proof[i]; if (computedHash <= proofElement) { computedHash = _...
14,784,821
./full_match/4/0x180ed18281480960A02a03cfD14FB05d2b8c7e6c/sources/contracts/TokenLock.sol
Lock claim tokens are non-transferrable: ERC-20 approve is not supported
function approve(address, uint256) external pure override returns (bool) { revert NotSupported(); }
824,110
// SPDX-License-Identifier: MIT /** * Author: Lambdalf the White */ pragma solidity 0.8.10; import "../ERC20Base.sol"; /** * @dev Extension of {ERC20Base} that adds a cap to the supply of tokens. */ abstract contract ERC20BaseCapped is ERC20Base { // Errors error ERC20BaseCapped_INVALID_MAX_SUPPLY(); error ERC20...
See {ERC20Base-mintBatch}./
function _mintBatch( address[] memory accounts_, uint256 amount_ ) internal virtual override { if ( ERC20Base.totalSupply() + amount_ * accounts_.length > MAX_SUPPLY ) { revert ERC20BaseCapped_MAX_SUPPLY_EXCEEDED(); } super._mintBatch( accounts_, amount_ ); }
15,860,081
pragma solidity ^0.4.21; contract SafeMath { uint256 constant MAX_UINT256 = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; function safeAdd(uint256 x, uint256 y) pure internal returns (uint256 z) { require(x <= MAX_UINT256 - y); return x + y; } function safeS...
Calibrate game state and take tokens./check if contributed before
function processTransaction(address _from, uint _value) internal returns (uint) { require(gameStart <= block.number); uint valueToProcess = 0; if(gameStart <= block.number && gameDuration >= block.number){ if(gameState != state.running){ gameStat...
8,029,302
pragma solidity ^0.4.21; // File: contracts/auth/AuthorizedList.sol /* * Created by: alexo (Big Deeper Advisors, Inc) * For: Input Strategic Partners (ISP) and Intimate.io * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * INCLUDING BUT NOT LIMITED TO THE WARRANTIE...
Retrieve contributors return A list of contributors
function getContributors() external view ifAuthorized(msg.sender, APHRODITE) returns (address[]) { return contributors; }
7,244,700
/** *Submitted for verification at Etherscan.io on 2022-05-03 */ // File: @openzeppelin/contracts/utils/Strings.sol // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; ...
set amount max mint
function setMaxMint(uint256 amount) public onlyOwner{ current_mint_max = amount; }
6,810,414
// Sources flattened with hardhat v2.8.4 https://hardhat.org // File @openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol@v4.5.1 // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 st...
Returns an `Uint256Slot` with member `value` located at `slot`./
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { assembly { r.slot := slot } }
306,165
// SPDX-License-Identifier: MIT pragma solidity >=0.6.10 <0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol"; import "@uniswap...
Fast-forward Chainlink round ID by owner. This is required when `lastRoundID` stucks at an old round, due to either incontinuous round IDs caused by a phase change or an abnormal `updatedAt` timestamp.
function fastForwardRoundID(uint80 roundID) external onlyOwner { uint80 lastRoundID_ = lastRoundID; require(roundID > lastRoundID_, "Round ID too low"); (, , , uint256 lastUpdatedAt, ) = _getChainlinkRoundData(lastRoundID_); (, , , uint256 updatedAt, ) = _getChainlinkRoundData(roundI...
885,704
pragma solidity ^0.4.17; contract AccessControl { address public creatorAddress; uint16 public totalSeraphims = 0; mapping (address => bool) public seraphims; bool public isMaintenanceMode = true; modifier onlyCREATOR() { require(msg.sender == creatorAddress); _; } modi...
check if a pet both exists and is owned by the message sender. This function also returns the petcardSeriesID.
function checkPet (uint64 petID) private constant returns (uint8) { IPetCardData petCardData = IPetCardData(petCardDataContract); address petowner; uint8 petcardSeriesID; (,petcardSeriesID,,,,,,,,petowner) = petCardData.getPet(petID); ...
1,707,785
./partial_match/1313161554/0xE17B0d13926F03C0a9C2d6185B505C253E7cDb1d/sources/_contracts/ReaperStrategyCompoundLeverage.sol
Emergency function to deleverage in case regular deleveraging breaks/
function manualReleaseWant(uint256 amount) external doUpdateBalance { _atLeastRole(STRATEGIST); require(cWant.redeemUnderlying(amount) == 0); }
16,912,125
./full_match/42220/0x9f5c71eaFeFC910edcC26CD796ccD20165CC14b9/sources/project_/contracts/interfaces/uniswap/TickLens.sol
calculate the number of populated ticks fetch bitmaps fetch populated tick data for each of the tick bitmap
function getPopulatedTicksInWords( IUniswapV3Pool pool, int16 fromTickBitmapIndex, int16 toTickBitmapIndex ) internal view returns (PopulatedTick[] memory populatedTicks) { uint256 numberOfPopulatedTicks; for (int16 b = fromTickBitmapIndex; b <= toTickBitmapIndex; b++) {...
16,322,881
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.4; import "./vaults/DesignedVault.sol"; contract MarketingVault is DesignedVault { constructor(address _tosAddress, uint256 _maxInputOnce) DesignedVault("Marketing Fund", _tosAddress, _maxInputOnce) {} } //SPDX-License-Identifier: Unlicense pr...
allocate amount for each round round it is the period unit can claim once amount total claimable amount
function allocateAmount(uint256 round, uint256 amount) external onlyOwner nonZero(round) nonZero(amount) validTgeRound(round) { require( totalTgeAmount + amount <= totalAllocatedAmount, "DesignedVault: exceed total allocated amount" ...
231,927
./partial_match/84531/0xE87F8BeEb04bb303D2D6B4785bc800DdBF7bbD83/sources/contracts/src/diamond/facets/token/ERC721A/ERC721ABase.sol
Packs ownership data into a single uint256./ Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`.
function _packOwnershipData( address owner, uint256 flags ) internal view returns (uint256 result) { assembly { owner := and(owner, _BITMASK_ADDRESS) result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags)) } }
16,682,407
./full_match/100/0x4849c61B39360bbB3c8682Aea652b23aE8c0c09f/sources/test.sol
Interface for wrapped ether v9 (WETH9) approval & deposit.
interface IWETHv9minimal { function approve(address guy, uint wad) external returns (bool); function deposit() external payable; }
14,266,844
./full_match/11155111/0x2ed9270882C72e27AF61a22325003C333903ADcF/sources/lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol
Sets `amount` as the allowance of `spender` over the `owner` s tokens. This internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address./
function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), 'ERC20: approve from the zero address'); require(spender != address(0), 'ERC20: approve to the zero address'); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount);...
3,794,673
// SPDX-License-Identifier: MIT OR Apache-2.0 pragma solidity >=0.6.11; // ============ Internal Imports ============ import {BridgeRouter} from "./BridgeRouter.sol"; import {IWeth} from "../../interfaces/bridge/IWeth.sol"; // ============ External Imports ============ import {TypeCasts} from "@celo-org/optics-sol/con...
Allow Owner to enroll Replica contract _replica the address of the Replica _domain the remote domain of the Home contract for the Replica/ un-enroll any existing replica add replica and domain to two-way mapping
function ownerEnrollReplica(address _replica, uint32 _domain) external onlyOwner { _unenrollReplica(_replica); replicaToDomain[_replica] = _domain; domainToReplica[_domain] = _replica; emit ReplicaEnrolled(_domain, _replica); }
1,209,127
/* * This code has not been reviewed. * Do not use or deploy this code before reviewing it personally first. */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/...
Verify if a token allowance has been provided in token smart contract. sender Address of the sender. userTradeData Encoded pack of variables for the token (address, amount, id/partition, standard, accepted, approved)./
function _allowanceIsProvided(address sender, UserTradeData memory userTradeData) internal view returns(bool) { address tokenAddress = userTradeData.tokenAddress; uint256 tokenValue = userTradeData.tokenValue; bytes32 tokenId = userTradeData.tokenId; Standard tokenStandard = userTradeData.tokenStandar...
12,733,461
./partial_match/1/0x6c543F2A4FAFCEBEef4C668538Ff75AE7600B047/sources/KeyRewardPool.sol
This method can be used by the controller to extract mistakenly sent tokens to this contract. dst The address that will be receiving the tokens wad The amount of tokens to transfer _token The address of the token contract that you want to recover
function transferTokens(address dst, uint wad, address _token) public auth note { require( _token != address(key)); if (wad > 0) { ERC20 token = ERC20(_token); token.transfer(dst, wad); } }
15,724,042
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.7.0; import "../balancer-core-v2/pools/factories/BasePoolFactory.sol"; import "../libraries/Authorizable.sol"; import "../ConvergentCurvePool.sol"; /// @author Element Finance /// @title Convergent Pool Factory contract ConvergentPoolFactory is BasePoolFactory...
Allows the owner to change the governance minting address newGov The new address to receive rewards in pools
function setGov(address newGov) external onlyOwner { governance = newGov; }
2,479,065
./full_match/5/0xEb1bAa3B1FEc3516857B32501f2584377369469D/sources/contracts/TaskContract.sol
todos[msg.sender][id] = todoItem({id: id, todo: todo, done: done});
function updateTodos(uint id, string memory todo, bool done) public { require(id < todos[msg.sender].length && id >= 0, 'The id provided is out of range'); todoItem storage item = todos[msg.sender][id]; item.done = done; item.todo = todo; }
1,945,325
// File: contracts-separate/Ownable.sol pragma solidity >=0.4.25 <0.6.0; contract Ownable { //이 contract가 owner로 갖고있는 address는 단 하나 address public owner; address public newOwner; event OwnershipTransferred(address indexed _from, address indexed _to); //현재 call을 보낸(contract를 작성한) 주소가 o...
Increase the amount of tokens that an owner allowed to a spender. approve should be called when allowed_[_spender] == 0. To increment allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol Emits an Approval event. spender The address whi...
function increaseAllowance(address spender, uint256 addedValue) onlyAddressNotZero(spender) public returns (bool) { _allowed[msg.sender][spender] = _allowed[msg.sender][spender].add(addedValue); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; }
12,762,298
./full_match/1/0x533E0eDbE7d2D0fBf4C4d2acb95Aee6EE137Fd8e/sources/OriginStrategy.sol
Withdraw from the strategy to the owner. token token to withdraw. amount amount of tokens to withdraw./
function _withdrawToOwner(IERC20 token, uint256 amount) internal { token.safeTransfer(owner, amount); PositionParams memory withdrawnAmount = _logPosition(address(token), amount); emit WithdrawToOwner(token, amount); }
16,398,556
// SPDX-License-Identifier: Apache-2.0 /* Copyright 2020 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 a...
Sells `sellAmount` of `inputToken` to the liquidity provider at the given `provider` address. inputToken The token being sold. outputToken The token being bought. provider The address of the on-chain liquidity provider to trade with. recipient The recipient of the bought tokens. If equal to addre...
function sellToLiquidityProvider( IERC20TokenV06 inputToken, IERC20TokenV06 outputToken, ILiquidityProvider provider, address recipient, uint256 sellAmount, uint256 minBuyAmount, bytes calldata auxiliaryData ) external override paya...
2,502,149
./full_match/5/0x05626cb540A481406D4aeBD7df4C8d3b28eE81aa/sources/contracts/ClaimsLogic.sol
This function should be called when NFT is purchased. _tokenId The tokenId that was claimed./
function updateTokenStatus(uint256 _tokenId) public { uint256 indexID = _tokenId - 1; tokenStatus[indexID] = 1; _updateUnclaimed(); }
1,888,994
./full_match/43114/0x24749d1304c2926E8dd7AA43163cB124abe44E5F/sources/contracts/3_Ballot.sol
find amount of tokenToPay needed to buy amountToBuy of tokenForDistribution
function findAmountToPay(uint256 amountToBuy, address penguinAddress) public view returns(uint256) { uint256 discount = discountBIPS[IAllocationController(allocationController).penguinTiers(penguinAddress)]; uint256 amountToPay = ((amountToBuy * exchangeRateWholeToken * (10000 - discount)) / 10000) ...
4,556,111
// SPDX-License-Identifier: MIT pragma solidity 0.6.11; import "../interfaces/ILiquidityPool.sol"; import "../interfaces/IManager.sol"; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import {SafeMathUpgradeable as SafeMath} from "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"...
Adjust withheldLiquidity and requestedWithdrawal if sender does not have sufficient unlocked balance for the transfer
function transfer(address recipient, uint256 amount) public override whenNotPaused returns (bool) { preTransferAdjustWithheldLiquidity(msg.sender, amount); return super.transfer(recipient, amount); }
5,773,472
/** *Submitted for verification at Etherscan.io on 2021-09-22 */ /** Kakushitsu Inu "Horny Dog" NO TAX https://t.me/KakushitsuInu */ /** *Submitted for verification at Etherscan.io on 2021-07-01 */ // SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity ^0.8....
Interface of the ERC20 standard as defined in the EIP./
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (...
10,642,230
./full_match/11155111/0xe06bC4190870c5Df8Aa3fA776FC0D686581b1aB6/sources/contracts/HexStableCoin.sol
Function for the request of tokens: - `_amount` check; - Check: only merchant can call; - `_user` lock check; - `msg.sender` lock check; - Adding the `_user` for `id`; - Adding the `_amaunt` for `_user`/
function requestRetrieve( address _user, uint256 _amount ) public onlyRole(MERCHANT_ROLE) returns (uint256) { require(_amount > 0, "HexStableCoin: wrong amount"); request[id += 1] = _user; amounts[_user] = _amount; emit RequestRetrieve(_user, msg.sender, _amount, ...
3,835,008
pragma solidity 0.4.26; import "./PoolTokensContainer.sol"; import "./LiquidityPoolV2ConverterCustomFactory.sol"; import "../../LiquidityPoolConverter.sol"; import "../../interfaces/IConverterFactory.sol"; import "../../../utility/interfaces/IPriceOracle.sol"; /** * @dev Liquidity Pool v2 Converter * *...
sets the pool's primary reserve token / price oracles and activates the pool each oracle must be able to provide the rate for each reserve token note that the oracle must be whitelisted prior to the call can only be called by the owner while the pool is inactive _primaryReserveToken address of the pool's primary r...
function activate(IERC20Token _primaryReserveToken, IConsumerPriceOracle _primaryReserveOracle, IConsumerPriceOracle _secondaryReserveOracle) public inactive ownerOnly validReserve(_primaryReserveToken) notThis(_primaryReserveOracle) notThis(_secondaryReserveOracle) ...
12,631,187
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import {Modifiers} from "../libraries/LibAppStorage.sol"; import {LibMeta} from "../../shared/libraries/LibMeta.sol"; import {LibERC721Marketplace} from "../libraries/LibERC721Marketplace.sol"; import {LibSnowdrops} from "../libraries/LibSnowdrops.sol"; import {IL...
Allow the snowdrops diamond owner to change the vrf details _newFee New VRF fee (in LINK) _keyHash New keyhash _vrfCoordinator The new vrf coordinator address _link New LINK token contract address
function changeVrf( uint256 _newFee, bytes32 _keyHash, address _vrfCoordinator, address _link ) external onlyOwner { if (_newFee != 0) { s.fee = uint96(_newFee); } if (_keyHash != 0) { s.keyHash = _keyHash; } if (_vrfCoordinator != address(0)) { s.vrfCoordinator...
13,131,846
./partial_match/1/0xd3914a73367F8015070f073D5C69602F3a48B80D/sources/ConnectAaveMigrator.sol
Aave Protocol Data Provider
interface AaveV2DataProviderInterface { function getReserveTokensAddresses(address _asset) external view returns ( address aTokenAddress, address stableDebtTokenAddress, address variableDebtTokenAddress ); function getUserReserveData(address _asset, address _user) external view retur...
4,442,142
pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./interfaces/IOwnable.sol"; import "./interfaces/ISTFactory.sol"; import "./interfaces/IERC20.sol"; import "./interfaces/ISecurityTokenRegistry.sol"; import "./storage/EternalStorage.sol"; import "./libraries/Util.sol"; import...
Sets the ticker registration fee in POLY tokens. Only Polymath. _stLaunchFee is the registration fee in POLY tokens (base 18 decimals)/
function changeSecurityLaunchFee(uint256 _stLaunchFee) external onlyOwner { uint256 fee = getUint(STLAUNCHFEE); require(fee != _stLaunchFee, "Fee not changed"); emit ChangeSecurityLaunchFee(fee, _stLaunchFee); set(STLAUNCHFEE, _stLaunchFee); }
12,831,582
./full_match/80001/0x46cfF5C2B3d82A9755FD2858344DC993e93A1Dc7/sources/contracts/Contract.sol
Define a function for tracking the performance of the supply chain Check that the sender is the platform provider Emit the PerformanceTracked event
function trackPerformance(uint256 efficiency, uint256 effectiveness, uint256 impact) public { require(msg.sender == platformProvider, "Sender is not the platform provider"); emit PerformanceTracked(efficiency, effectiveness, impact); }
5,661,269
pragma solidity >=0.5.0; import "./Ownable.sol"; // Inherits from the Ownable contract for access control contract Powerballer is Ownable { // Set the variables for the two participants address payable[] public players; // Manually Start the lottery function startLottery() public isOwner { // Owner the ...
Owner the owner create start the lottery
function startLottery() public isOwner { owner = msg.sender; }
15,833,434
./partial_match/42/0xAf5d2BC0A47f0aE99b7E7225349e3d5C48F46Fd5/sources/STERegistryV1.sol
Interface for security token deployment/ Emit when new contract deployedaddress _certificateSigner, bool _certificateActivated,
interface ISTEFactory { event NewContractDeployed(address _newContract); function deployToken( string calldata _name, string calldata _symbol, uint8 _granularity, address[] calldata _controllers, bytes32[] calldata _defaultPartitions, address _owner, addr...
3,412,040
pragma solidity 0.5.12; import "./ITransferRules.sol"; import "@openzeppelin/contracts/access/Roles.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; /// @title Restricted Token /// @author CoMakery, Inc. /// @notice An ERC-20 token with ERC-1404 transfer restrictions for managing security tokens, etc. co...
Lock tokens in the address from being transfered until the specified time addr The address to restrict timestamp The time the tokens will be locked until as a Unix timetsamp. Unix timestamp is the number of seconds since the Unix epoch of 00:00:00 UTC on 1 January 1970.
function setLockUntil(address addr, uint256 timestamp) public validAddress(addr) onlyTransferAdmin { _lockUntil[addr] = timestamp; emit AddressTimeLock(msg.sender, addr, timestamp); }
5,387,976
./full_match/1/0x2ee2bf09A6e559047D26df6F690435E746072e73/sources/browser/rooktest.sol
This function is the entry point of this keeper. An off-chain bot will call this function whenever it decides that it wants to borrow from this KeeperDAO liquidity pool. This function is similar to what you would expect in a "real" keeper implementation: it accepts paramters telling it what / how much to borrow, and wh...
function hello(address _token, uint256 _amountToBorrow, uint256 _amountOfProfitToReturn) external onlyOwner { require(_amountOfProfitToReturn > 0, "profit is zero"); require( address(this).balance > _amountOfProfitToReturn, "balance is too low" ); ...
2,922,335
pragma solidity ^0.6.4; pragma experimental ABIEncoderV2; import "../curation/ICuration.sol"; import "../epochs/IEpochManager.sol"; import "../governance/Governed.sol"; import "../token/IGraphToken.sol"; import "../upgrades/GraphProxy.sol"; import "../upgrades/GraphUpgradeable.sol"; import "./IStaking.sol"; import "....
Undelegate tokens from an indexer. _delegator Address of the delegator _indexer Address of the indexer where tokens had been delegated _shares Amount of shares to return and undelegate tokens return Amount of tokens returned for the shares of the delegation pool/ Can only undelegate a non-zero amount of shares Get t...
function _undelegate( address _delegator, address _indexer, uint256 _shares ) private returns (uint256) { require(_shares > 0, "Delegation: cannot undelegate zero shares"); DelegationPool storage pool = delegationPools[_indexer]; Delegation storage delegation = p...
5,377,350
pragma solidity ^0.4.25; /* * Creator: DSD (DSD token) */ /* * Abstract Token Smart Contract * */ /* * Safe Math Smart Contract. * https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol */ contract SafeMath { function mul(uint256 a, uint256 b) internal pure returns ...
Get total number of tokens in circulation. return total number of tokens in circulation/
function totalSupply() public constant returns (uint256 supply) { return tokenCount; } string constant public name = "DSD token"; string constant public symbol = "DSD"; uint8 constant public decimals = 4;
15,114,630
./partial_match/1/0x84F396739984e8bF9aCa791541B01637c23BCB16/sources/Sale.sol
Reclaim all ERC20Basic compatible tokens _token ERC20B The address of the token contract/
function reclaimToken(IERC20 _token) external onlyOwner { uint256 balance = _token.balanceOf(address(this)); _token.transfer(owner, balance); }
2,745,955
//SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "base64-sol/base64.sol"; import "@openzeppelin/contracts/util...
Generates a singular random point either x or y Will generate a random value for x and y coords with a max value of 128 tokenId a unique number that acts as a seed xOrY used as a another factor to the seed waypointIndex the waypoint index, used a a seed factor
function _getWaypointPoint( uint256 tokenId, string memory xOrY, uint256 waypointIndex ) internal pure returns (uint256) { uint256 rand = _random( string( abi.encodePacked( xOrY, Strings.toString(tokenId), ...
5,386,264
./partial_match/8453/0x2B0A43DCcBD7d42c18F6A83F86D1a19fA58d541A/sources/MasterChefV2.sol
Update the given pool's BSWAP allocation point. Can only be called by the owner.
function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public onlyOwner { if (_withUpdate) { massUpdatePools(); } totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint); poolInfo[_pid].allocPoint = _allocPoint; }
16,755,549
pragma solidity 0.4.25; // https://github.com/ethereum/EIPs/issues/20 interface TRC20 { 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); funct...
https:github.com/ethereum/EIPs/issues/20
interface TRC20 { 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, uint _value) external retu...
1,804,176
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "./ITaxHandler.sol"; import "../utils/ExchangePoolProcessor.sol"; /** * @title Dynamic tax handler * @notice Processes tax for a ...
Set buy tax checkpoints thresholds Array containing the threshold values of the buy tax checkpoints. basisPoints Array containing the basis points values of the buy tax checkpoints./ Reset previous points
function setBuyTaxCheckpoints(uint256[] memory thresholds, uint256[] memory basisPoints) external onlyOwner { require( thresholds.length == basisPoints.length, "DynamicTaxHandler:setBuyTaxBasisPoints:UNEQUAL_LENGTHS: Array lengths should be equal." ); for (uint256 i ...
6,905,766
./full_match/97/0xA3638bB3e6D0D85Cb4147969D454FdA8da3dB5fc/sources/project_/contracts/EnigmaEscrowVault.sol
Refund the employer
function operatorResolveDispute( uint256 _milestoneId, bool _freelancerWins ) external onlyOperator { require(hasJobStarted, "The job has not started yet"); require(!hasJobEnded, "The job has already ended"); require( _milestoneId < milestones.length, ...
5,017,895
//SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.4; import "Ownable.sol"; import "Pausable.sol"; import "PaymentSplitter.sol"; import "ERC721A.sol"; import "Whitelist.sol"; contract InvisibleKennel is ERC721A, Ownable, Pausable, Whitelist, PaymentSplitter { /** * General constants and immutable v...
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 _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity } pragma solidity ^0.8.0; import "IERC165.sol"; } ...
267,901
./partial_match/1/0xb626A5FacC4de1c813F5293Ec3bE31979f1D1c78/sources/BancorConverter.sol
deprecated, backward compatibility
function quickBuy(uint256 _minReturn) public payable returns (uint256) { return quickConvert(quickBuyPath, msg.value, _minReturn); }
4,450,577
/** *Submitted for verification at Etherscan.io on 2020-07-18 */ pragma solidity 0.5.12; interface IKToken { function underlying() external view returns (address); function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function tra...
Deposit funds to the Keeper Protocol. _token The address of the token contract. _amount The value of deposit. return Nothing.
function deposit(address _token, uint256 _amount) external payable nonReentrant whenNotPaused returns (uint256) { IKToken kToken = kTokens[_token]; require(address(kToken) != address(0x0), "Token is not registered"); if (_token != ETHEREUM) { ERC20(_token).transferFrom(msg.sender...
12,805,504
./partial_match/1/0x44835bBBA9D40DEDa9b64858095EcFB2693c9449/sources/src/RBACTimelock.sol
Cancel an operation. Requirements: - the caller must have the 'canceller' or 'admin' role./
function cancel(bytes32 id) public virtual onlyRoleOrAdminRole(CANCELLER_ROLE) { require(isOperationPending(id), "RBACTimelock: operation cannot be cancelled"); delete _timestamps[id]; emit Cancelled(id); }
9,197,858
./partial_match/1/0x5E482759e7d5846f03c34cA4a6a0e7e8c2bf2Cd7/sources/KOAM.sol
ERC20 interface/
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256)...
16,026,947
./partial_match/1/0x4CBE48727B1E4Da891D339c77ca439D667512328/sources/LynStaking.sol
ERC20: Functions `transfer`, `transferFrom` should return bool but some token returns void instead of following the standard Since, we need to accept void return as a successful transfer
function _safeTransfer(address token, address to, uint value) private { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(TRANSFER_SELECTOR, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TRANSFER_FAILED'); }
4,263,494
./partial_match/1/0x01E4543460347a3A77E094AB3E279932d1cAe050/sources/FenixToken.sol
Interface of the ERC20 standard as defined in the EIP. Does not include the optional functions; to access them see {ERC20Detailed}./
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint2...
3,685,629
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.4; import "./lib/openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "./DataRootTuple.sol"; import "./IDAOracle.sol"; import "./lib/tree/binary/BinaryMerkleProof.sol"; import "./lib/tree/binary/BinaryMerkleTree.sol"; struct Validator { address ...
Checks that enough voting power signed over a digest. _currentValidators The current validators. _sigs The current validators' signatures. _digest This is what we are checking they have signed. _powerThreshold At least this much power must have signed. The current validator set and their powers If the signature is ...
function checkValidatorSignatures( Validator[] calldata _currentValidators, Signature[] calldata _sigs, bytes32 _digest, uint256 _powerThreshold ) private pure { uint256 cumulativePower = 0; for (uint256 i = 0; i < _currentValidators.length; i++) { if...
2,574,503
//SPDX-License-Identifier: MIT pragma solidity 0.8.10; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; contract CertificateCreator is ERC721Enumerable , Ownable { address ...
link certificates to the course creators
function createCertificate(string memory _courseName, address _course_creator, string memory _certificateType) public payable { require(msg.value == cost); address student = msg.sender; uint newId = certificates.length; certificateToOwner[newId] = msg.sender; certifica...
2,570,432
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; // Note that this...
Return accumulate rewards over the given _from to _to block.
function getGeneratedReward(uint256 _fromTime, uint256 _toTime) public view returns (uint256) { if (_fromTime >= _toTime) return 0; if (_toTime >= poolEndTime) { if (_fromTime >= poolEndTime) return 0; if (_fromTime <= poolStartTime) return poolEndTime.sub(poolStartTime).mul(...
7,238,276
pragma solidity ^0.5.0; import 'openzeppelin-solidity/contracts/crowdsale/emission/MintedCrowdsale.sol'; import 'openzeppelin-solidity/contracts/token/ERC20/IERC20.sol'; import 'openzeppelin-solidity/contracts/math/SafeMath.sol'; import 'openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol'; contract EndlessCrow...
Adjust for decimal places
function getLinearCoefficient(uint256 aInverse) private view returns (uint256) { uint256 start = token().totalSupply().mul(rateDecimalsMultiply); uint256 oneDecimals = rateDecimalsMultiply; uint256 b = start.mul(2).add(oneDecimals).div(aInverse); return ...
13,046,279