file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./ShackledStructs.sol"; import "./ShackledRenderer.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; contract ShackledIcons is ERC721Enumerable, Ownable { string...
generate a perspective camera matrix / Z settings (near and far) Get the perspective transform matrix as a numerator and denominator parameter = 1 / tan(fov in degrees / 2) 0.1763 = 1 / tan(160 / 2) 1.428 = 1 / tan(70 / 2) 1.732 = 1 / tan(60 / 2) 2.145 = 1 / tan(50 / 2)
function getCameraMatrixPersp() internal pure returns (int256[4][4][2] memory) { int256 n = 500; int256 f = 501; int256[4][4] memory cameraMatrixNum = [ [int256(2145), 0, 0, 0], [int256(0), 2145, 0, 0], [int256(0), 0, f, -f *...
278,662
./partial_match/1/0x6894DD96d242bA513AD99836B7778dBF43b82F3f/sources/AnyswapV6ERC20.sol
Moves `value` AnyswapV6ERC20 token from account (`from`) to account (`to`) using allowance mechanism. `value` is then deducted from caller account's allowance, unless set to `type(uint256).max`. Emits {Approval} event to reflect reduced allowance `value` for caller account to spend from account (`from`), unless allowan...
function transferFrom( address from, address to, uint256 value ) external override returns (bool) { require(to != address(0) && to != address(this)); if (from != msg.sender) { uint256 allowed = allowance[from][msg.sender]; if (allowed != type(uint2...
4,127,212
// SPDX-License-Identifier: MIT pragma solidity ^0.6.11; import "deps/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "deps/@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; import "deps/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol"; import "deps/@op...
Set the Vault (aka Sett) for a given want The vault can only be set once
function setVault(address _token, address _vault) public { _onlyGovernanceOrStrategist(); require(vaults[_token] == address(0), "vault"); vaults[_token] = _vault; }
5,465,334
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "@gif-interface/contracts/Product.sol"; import "./FireOracle.sol"; contract FireInsurance is Product { // constants bytes32 public constant VERSION = "0.0.1"; bytes32 public constant POLICY_FLOW = "PolicyFlowDefault"; uint256 pub...
small fires considered below deductible, no payout
function _calculatePayoutAmount(uint256 premium, bytes1 fireCategory) internal pure returns(uint256 payoutAmount) { if (fireCategory == 'M') { payoutAmount = PAYOUT_FACTOR_MEDIUM * premium; payoutAmount = PAYOUT_FACTOR_LARGE * premium; payo...
12,760,569
./full_match/1/0x8c0792Bfee67c80f0E7D4A2c5808edBC9af85e6F/sources/contracts/lib/ExitPausable.sol
Returns to normal state. Requirements: - The contract must be exitPaused./
function _exitUnpause() internal virtual whenExitPaused { _exitPaused = false; emit ExitUnpaused(_msgSender()); }
16,587,209
./partial_match/3/0x1B0E0eCa53FB8EbFcBc6071d081961A37628Ca83/sources/Betting.sol
Cancel a bet, only by one of the admins. _id the bet id./Bet storage _bet = bets[_id]; refund betters
function cancelBet(uint256 _id) public onlyAdmins { require(_id < betsCount, 'Wrong bet id'); uint256 length = betters[_id].length; for (uint256 bind = 0; bind < length; bind++){ if(betters[_id][bind].bet_id == _id){ uint256 _amount = betters[_id][bind].amount; ...
5,189,670
//SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "hardhat/console.sol"; import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "./BullsToTheMoonInterface.sol"; /** * @notice ENS registry to get ch...
See ../BullsToTheMoonInterface.sol/
function propose(string memory proposedBaseURI) override external { }
926,547
// File: @openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol pragma solidity ^0.6.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assu...
price is $Y / USD (10 8 decimals)
function getCollateralUsd(address collateral_) public view returns (uint256) { ( , int price, , uint timeStamp, ) = usdcPrice.latestRoundData(); require(timeStamp > 0, "Rounds not complete"); return uint256(price).mul(10 ** 10).div((TwapOracle(collateralOracle[collateral_]).consult(usdcAddr...
336,666
./full_match/1/0x02444a8fEeaD1a2E78da0e2a157f4C7B848aB021/sources/browser/BaoMasterFarmer_flat.sol
Deposit LP tokens to BaoMasterFarmer for $BAO allocation.
function deposit(uint256 _pid, uint256 _amount, address _ref) public { require(_amount > 0, "BaoMasterFarmer::deposit: amount must be greater than 0"); PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; UserInfo storage devr = userInfo[_pid][...
3,133,876
/* * Havven Contract * * The collateral token of the Havven stablecoin system. * * version: nUSDa.1 * date: 29 Jun 2018 * url: https://github.com/Havven/havven/releases/tag/nUSDa.1 * * MIT License * =========== * * Copyright (c) 2018 Havven * * Permission is hereby granted, free of charge, t...
Override ERC20 transfer function in order to check whether the recipient account is frozen. Note that there is no need to check whether the sender has a frozen account, since their funds have already been confiscated, and no new funds can be transferred to it./
function transfer(address to, uint value) public optionalProxy returns (bool) { require(!frozen[to]); return _transfer_byProxy(messageSender, to, value); }
6,482,257
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; // Part: IBasicRewards interface IBasicRewards { function stakeFor(address, uint256) external returns (bool); function balanceOf(address) external view returns (uint256); function withdrawAll(bool) external; function getReward() external ret...
Swap native ETH for CRV on Curve amount - amount to swap return amount of CRV obtained after the swap
function _swapEthToCrv(uint256 amount) internal returns (uint256) { return CRVETH_ETH_INDEX, CRVETH_CRV_INDEX, amount, 0 ); }
5,713,440
/* The Phunky Fungi Collection */ //SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./MultisigOwnable.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import "./ERC721A.so...
override base uri. It will be combined with token ID
function _baseURI() internal view override returns (string memory) { return _baseURI; }
2,507,304
/* ____ _ _ _ ___ _ _ / ___|| |_ _ __ __ _| |_| |_ ___ _ __ / _ \ __ _| | ___ __ ___ ___ _ __ | |_ \___ \| __| '__/ _` | __| __/ _ \| '_ \ | | | |/ _` | |/ / '_ ` _ \ / _ \| '_ \| __| ___) | |_| | | (_| | |_| || (_) | | | | | |_| | (_| ...
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, IERC20 _lpToken, bool _withUpdate) public onlyOwner { if (_withUpdate) { massUpdatePools(); } uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock; totalAllocPoint = totalAllocPoint.add(_allocPoint); poo...
1,146,336
// produced by the Solididy File Flattener (c) David Appleton 2018 // contact : dave@akomba.com // released under Apache 2.0 licence library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimizati...
GTA contract interface/
interface GTAInterface { function transferFrom(address _from, address _to, uint256 _value) external returns (bool); function transfer(address to, uint256 value) external returns (bool); function balanceOf(address _owner) external view returns (uint256); }
13,002,850
./full_match/3/0x2AeeF31f57F5cB7BB851de56ea8f199500bB9e9F/sources/nf-token.sol
Mints a new NFT. _to The address that will own the minted NFT. _tokenId of the NFT to be minted by the msg.sender. _uri String representing RFC 3986 URI./onlyOwner
function mint( address _to, uint256 _tokenId, string calldata _uri ) external { super._mint(_to, _tokenId); super._setTokenUri(_tokenId, _uri); }
8,143,283
./partial_match/8453/0x2B0A43DCcBD7d42c18F6A83F86D1a19fA58d541A/sources/MasterChefV2.sol
View function to see pending BSWAP on frontend.
function pendingReward(uint256 _pid, address _user) public view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accPerShare = pool.accPerShare; uint256 lpSupply = pool.totalDeposit; if (block.timestamp > pool...
16,755,553
./full_match/42220/0xfB1945943f752B2828d5DC2Ed3e00bd6513C6Fc1/sources/contracts/spaceswap-ubeswap/Factory.sol
this low-level function should be called from a contract which performs important safety checks
function mint(address to) external lock returns (uint liquidity) { uint balance0 = IERC20Uniswap(token0).balanceOf(address(this)); uint balance1 = IERC20Uniswap(token1).balanceOf(address(this)); uint amount0 = balance0.sub(_reserve0); uint amount1 = balance1.sub(_reserve1); b...
16,334,168
./partial_match/1/0x6B0B234fB2f380309D47A7E9391E29E9a179395a/sources/src/v0.8/llo-feeds/Verifier.sol
Generates the config digest from config data feedId Feed ID to set config for sourceChainId Chain ID of source config sourceAddress Address of source config Verifier configCount ordinal number of this config setting among all config settings over the life of this contract signers ith element is address ith oracle ...
function _configDigestFromConfigData( bytes32 feedId, uint256 sourceChainId, address sourceAddress, uint64 configCount, address[] memory signers, bytes32[] memory offchainTransmitters, uint8 f, bytes memory onchainConfig, uint64 offchainConfigVersion, bytes memory offchainConfi...
3,963,457
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol) pragma solidity ^0.8.0; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a p...
solhint-disable-next-line function-max-lines
function disperseProtocolFees( uint256 amount, address router, bytes memory swapPayload ) external override onlyAdmins { _checkTwap(); IArrakisVaultV1 _lpToken = lpToken; IERC20 token0 = _lpToken.token0(); IERC20 token1 = _lpToken.token1(); uint256...
1,667,888
pragma solidity ^0.5.16; import "./CToken.sol"; /** * @title Compound's CErc20 Contract * @notice CTokens which wrap an EIP-20 underlying * @author Compound */ contract CErc20 is CToken, CErc20Interface { /** * @notice Initialize the new money market * @param underlying_ The address of the underlyin...
User supplies assets into the market and receives cTokens in exchange Assumes interest has already been accrued up to the current block minter The address of the account which is supplying the assets mintAmount The amount of the underlying asset to supply return (uint, uint) An error code (0=success, otherwise a fai...
function mintFresh(address minter, uint mintAmount) internal returns (uint, uint) { uint allowed = comptroller.mintAllowed(address(this), minter, mintAmount); if (allowed != 0) { return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.MINT_COMPTROLLER_REJECTION, allowed), 0); ...
6,267,679
./full_match/5/0xBB2A7A26094c456637E9CcB67BEfEff700C1ba4a/sources/src/Blacklist.sol
add address to blacklist
function _addBlacklist(address account) internal virtual { _blacklist[account] = true; emit Blacklisted(account); }
1,914,052
// SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view retu...
This view will return the expected profit in wei units that a trading activity will have on the pool It will also return the highest profit token ID to sell for the lowest token that that will be bought for that profit Now find our target token to sell into Now sell all the other tokens into this tokenuint256 _normaliz...
function expectedProfit(bool inWETHForExecutor) external view returns (uint256, uint256, uint256) { uint256 length = tokenList.length; uint256 sellID = 0; uint256 largestGain = 0; for(uint256 i = 0; i < length; i++){ if(i != targetID){ u...
6,170,923
// SPDX-License-Identifier: UNLICENSE pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; impo...
max number of free mints we can give to the community for promotions/marketing
function giveFreeRoll(address receiver) public onlyOwner { require(_numFreeRollsGiven < 200, "already given max number of free rolls"); uint256 freeRolls = freeRollPhunks[receiver]; freeRollPhunks[receiver] = freeRolls + 1; _numFreeRollsGiven = _numFreeRollsGiven + 1; }
1,156,512
./full_match/84531/0xd7149865d07cCfdfB10f858AFAb297A8251882Cc/sources/contracts/stores/FundingStore.sol
updates `fundingTracker` mapping Only callable by other protocol contracts Invoked by Funding.updateFundingTracker asset Asset address, e.g. address(0) for ETH market Market, e.g. "ETH-USD" fundingIncrement Accrued funding of given asset and market
function updateFundingTracker( address asset, string calldata market, int256 fundingIncrement ) external onlyContract { fundingTrackers[asset][market] += fundingIncrement; }
11,525,415
./full_match/1/0xc94E3Fd7270be44da019c8c3dB1D2e4d0064063A/sources/contracts/adapters/alchemix/alEthAdapter.sol
Since harvest deposits all assets, that would include the users' deposit
function afterDeposit(uint256, uint256) internal virtual override { harvest(); }
3,007,944
./full_match/43113/0x0fE2b51D3B543C6F359480BffBf8C4E6964aE40E/sources/src/lib/LibMath.sol
Checks if rounding error >= 0.1% when rounding down. numerator Numerator. denominator Denominator. target Value to multiply with numerator/denominator. return isError Rounding error is present. The absolute rounding error is the difference between the rounded value and the ideal value. The relative rounding error is...
function isRoundingErrorFloor( uint256 numerator, uint256 denominator, uint256 target ) internal pure returns (bool isError) { if (denominator == 0) { revert("division by zero"); } if (target == 0 || numerator == 0) { return false; ...
13,147,975
./partial_match/3/0xb2da1FA1f7EB50713738b6FBcf6b5467f1fE2d65/sources/Invitation.sol
Transfers `tokenId` from `from` to `to`. As opposed to {transferFrom}, this imposes no restrictions on msg.sender. Requirements: - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. Emits a {Transfer} event./ Clear approvals from the previous owner
function _transfer(address from, address to, uint256 tokenId) internal virtual { require(tokenOfFreeze[tokenId] == false); require(ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenT...
5,111,639
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @author 1001.digital /// @title A helper to distinguish external and contract addresses library CheckAddress { /// Check whether an address is a smart contract. /// @param account the address to check /// @dev checks if the `extcodesize` of `addr...
Get the size of the code of an address account the address to check gets the `extcodesize` of `address` return the size of the address
function getSize(address account) internal view returns (uint256) { uint256 size; assembly { size := extcodesize(account) } return size; }
937,564
./full_match/1/0x2af3948308797e259023835faBc56e2e9ba0963e/sources/contracts/YoloToken.sol
0x36372b07 is IERC20 id
function supportsInterface( bytes4 interfaceId ) public view override returns (bool) { return interfaceId == type(IERC20).interfaceId || super.supportsInterface(interfaceId); }
16,595,540
contract SoccerBet { enum Team { A, B } struct BettingParty { Team bettedTeam; uint amount; address account; } BettingParty A; BettingParty B; address oracle; uint spareAmount; function SoccerBet(address bettingPartyA, address bettingPartyB) { ...
We are going to allow setting of the outcome as long as one party has deposited money. It is upon the Oracle to not set the outcome of the contract before both parties have gotten a chance to deposit money. /We just need to calculate the losing party's earningsSend money logic hereWinner gets money of the losing party ...
function setOutcome(Team t, uint8 posession) { uint loserEarnings = 0; if (A.bettedTeam == t) { loserEarnings = B.amount - (B.amount * posession/100); B.account.send(loserEarnings); suicide(A.account); loserEarnings = A.amount - (A.amount * posession/...
2,488,348
// SPDX-License-Identifier: GPL-3.0 // Author: Pagzi Tech Inc. | 2022 // DeadTownZeds | 2022 pragma solidity >=0.8.0 <0.9.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "./ERC721Enumerable.sol"; contract DeadTownZeds is ERC721Enumerable, Ownable { string public baseURI; uint256 public cost = 0....
Returns whether `tokenId` exists. Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. Tokens start existing when they are minted (`_mint`), and stop existing when they are burned (`_burn`)./
function _exists(uint256 tokenId) internal view virtual returns (bool) { return tokenId < (_owners.length + 1) && _owners[tokenId - 1] != address(0); }
5,711,316
./partial_match/84531/0xA39039AF66e9c7bd3CE53aa56B95F46D0b6BB364/sources/contracts/src/diamond/facets/governance/votes/VotesBase.sol
Returns the amount of votes that `account` had at a specific moment in the past. If the `clock()` is configured to use block numbers, this will return the value at the end of the corresponding block. Requirements: - `timepoint` must be in the past. If operating using block numbers, the block must be already mined./
function getPastVotes( address account, uint256 timepoint ) public view virtual override returns (uint256) { require(timepoint < clock(), "Votes: future lookup"); return VotesStorage.layout()._delegateCheckpoints[account].upperLookupRecent( SafeCast.toUint32(timepoint) ); }
16,687,980
// Copyright (C) 2015 Forecast Foundation OU, full GPL notice in LICENSE pragma solidity >=0.5.10; import 'ROOT/reporting/IDisputeWindow.sol'; import 'ROOT/libraries/Initializable.sol'; import 'ROOT/reporting/IUniverse.sol'; import 'ROOT/reporting/IReputationToken.sol'; import 'ROOT/reporting/IMarket.sol'; import 'R...
Redeem tokens for reporting fees _account The account to redeem tokens for return bool True/ Pay out fees
function redeem(address _account) public returns (bool) { require(isOver() || universe.isForking(), "DisputeWindow.redeem: window is not over"); uint256 _attoParticipationTokens = balances[_account]; if (_attoParticipationTokens == 0) { return true; } uint256 _...
6,453,355
pragma solidity ^0.5.17; // Brought from https://github.com/aragon/aragonOS/blob/v4.3.0/contracts/lib/math/SafeMath.sol // Adapted to use pragma ^0.5.17 and satisfy our linter rules /** * @title SafeMath * @dev Math operations with safety checks that revert on error */ library SafeMath { string private constan...
Tell if a delegates represents another voter _voter Address of the principal being queried _delegate Address of the delegate being queried return True if the given delegate currently represents the voter/
function _isDelegateOf(address _voter, address _delegate) internal view returns (bool) { return _voter == _delegate || delegates[_voter] == _delegate; }
6,846,826
pragma solidity ^0.4.25; /******************************************************************************* * * Copyright (c) 2019 Decentralization Authority MDAO. * Released under the MIT License. * * Minado - Crypto Token Mining & Forging Community * * Minado has been optimized for mining ERC918-compa...
Supports Interface (EIP-165) NOTE: Must support the following conditions: 1. (true) when interfaceID is 0x01ffc9a7 (EIP165 interface) 2. (false) when interfaceID is 0xffffffff 3. (true) for any other interfaceID this contract implements 4. (false) for any other interfaceID/ Initialize constants....
function supportsInterface( bytes4 _interfaceID ) external pure returns (bool) { bytes4 InvalidId = 0xffffffff; bytes4 ERC165Id = 0x01ffc9a7; if (_interfaceID == InvalidId) { return false; } if (_interfaceID == ERC165Id) { return true; ...
902,663
./full_match/8453/0x33d34437238A91c18242715a523c2F0A4d74C904/sources/contracts/CorePair.sol
this low-level function should be called from a contract which performs important safety checks gas savings gas savings, must be defined here since totalSupply can update in _mintFee permanently lock the first MINIMUM_LIQUIDITY tokens
function mint(address to) external lock returns (uint liquidity) { (uint112 _reserve0, uint112 _reserve1,,) = getReserves(); uint balance0 = IERC20(token0).balanceOf(address(this)); uint balance1 = IERC20(token1).balanceOf(address(this)); uint amount0 = balance0.sub(_reserve0); uint amount1 = bala...
11,558,413
./full_match/44787/0x59916829f0d01d8F05a2389928CaC6FecBAd4937/sources/contracts/governor/ubiCommittee/UBICommitteeImplementation.sol
Executes a queued proposal if eta has passed _proposalId The id of the proposal to execute/
function execute(uint256 _proposalId) external onlyMember payable { require( state(_proposalId) == ProposalState.Succeeded, "PACT::execute: proposal can only be executed if it is succeeded" ); Proposal storage _proposal = proposals[_proposalId]; _proposal.exec...
13,275,485
./full_match/1/0x5682dC851C33adb48F6958a963A5d3Aa31F6f184/sources/contracts/router/quoter/SwapQuoterV2.sol
Returns the data for the given pool: pool address, LP token address (if applicable), and tokens. Populate LP token field only for default pools
function _getPoolData(PoolType poolType, address pool) internal view returns (Pool memory poolData) { poolData.pool = pool; if (poolType == PoolType.Default) poolData.lpToken = _lpToken(pool); poolData.tokens = _getPoolTokens(pool); }
4,844,618
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "./ERC721Min.sol"; co...
- NFT Types -
function addNftType(uint16 _maxMint, uint16 _maxPerMint, uint256 _price, uint16 _maxPerAddress, bool _saleActive, string calldata _uri) external onlyOwner { nftTypeCount++; NftTypes[nftTypeCount].maxMint = _maxMint+1; NftTypes[nftTypeCount].maxMintForOne = _maxMint; NftT...
451,923
// SPDX-License-Identifier: MIT pragma solidity 0.8.10; import "./IEIP20.sol"; // Implementation of eip20 standard. // https://eips.ethereum.org/EIPS/eip-20. contract EIP20 is IEIP20 { mapping(address => uint256) private _balanceOf; mapping(address => mapping(address => uint256)) private _allowances; string pri...
Transfers _value amount of tokens from address _from to address _to, and MUST fire the Transfer event. The transferFrom method is used for a withdraw workflow, allowing contracts to transfer tokens on your behalf. This can be used for example to allow a contract to transfer tokens on your behalf and/or to charge fees i...
function transferFrom(address _from, address _to, uint256 _value) public virtual override returns (bool) { return _safeTransfer(_from, _to, _value); }
6,388,419
pragma solidity 0.6.8; pragma experimental ABIEncoderV2; contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private initializing; /...
Sanity check the new address;
function setPoolAddress(address newPoolAddress) public onlyOwner whenNotPaused returns (address) { Pool(newPoolAddress).totalShares(); emit PoolAddressUpdated(poolAddress, newPoolAddress); return poolAddress = newPoolAddress; }
7,330,733
pragma solidity ^0.5.10; import "./Ownable.sol"; import "./ERC20Interface.sol"; import "./SafeMath.sol"; contract ERC20Token is Ownable, ERC20Interface { using SafeMath for uint256; mapping(address => uint256) internal balances; mapping (address => mapping (address => uint256)) internal allowed; //...
send `_value` token to `_to` from `msg.sender` _to The address of the recipient _value The amount of token to be transferred return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) public returns (bool success) { return transferInternal(msg.sender, _to, _value); }
6,465,778
...
inject NONSTANDARD NAMING
function ADDMINTER824(address _minter) public {
12,602,604
./full_match/82/0xC6658Cee7C586BA9820f78E61b6b0E91542F111B/sources/src/backend/contracts/TokenFT.sol
require(false, "Staking not available");
function getReward() external updateReward(msg.sender) { uint _reward = rewards[msg.sender]; rewards[msg.sender] = 0; IERC20Upgradeable(address(this)).transfer(msg.sender, _reward); }
7,094,492
pragma solidity ^0.5.0; import "../node_modules/@openzeppelin/contracts/ownership/Ownable.sol"; // A generic contract for computing the timestamp contract Timestamp is Ownable { uint256 secondsPerBlock = 13; //---Setter--- function setSecondsPerBlock(uint256 _seconds) public onlyOwner { secondsP...
Withdraw returns the user's current balance that is not timelocked Prepares the balance to be withdrawn Protect against reentrancy
function _withdraw() internal returns (uint256) { uint256 totalBalance; LockedBalance[] storage wrappedBalance = accountBalance[msg.sender]; for (uint i = 0; i < wrappedBalance.length; i++) { if (block.timestamp > wrappedBalance[i].timestamp) { totalBalan...
6,411,603
// File: @openzeppelin\contracts\token\ERC20\IERC20.sol 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 totalSupply() external view returns (uint256); /** ...
user must approve this contract to add rewards
function addRewards(uint256 _amount) public onlyOwner { require(_amount > 0, "Invalid amount"); IERC20(sheesha).safeTransferFrom(address(msg.sender), address(this), _amount); tokenRewards = tokenRewards.add(_amount); }
413,073
./full_match/421613/0x31DfCC1168601537b2BAB3d11065cAfd7E38a3D5/sources/project_/contracts/marketplace/DinoMarketplaceUpgradeable.sol
Escrows the NFT, assigning ownership to this contract. Throws if the escrow fails. _nftAddress - The address of the NFT. _owner - Current owner address of token to escrow. _tokenId - ID of token whose approval to verify. It will throw if transfer fails
function _escrow( address _nftAddress, address _owner, uint256 _tokenId ) internal { IERC721 _nftContract = IERC721(_nftAddress); _nftContract.transferFrom(_owner, address(this), _tokenId); }
11,572,758
./full_match/43113/0xc371e397d3aD848696f1F0c6E27Bb641840D4b89/sources/project:/contracts/superfluid/Superfluid.sol
context.agreementSelector =; back to old msg.sender
function callAgreementWithContext( ISuperAgreement agreementClass, bytes calldata callData, bytes calldata userData, bytes calldata ctx ) external override requireValidCtx(ctx) isAgreement(agreementClass) returns (bytes memory newCtx, bytes memory ...
13,146,873
./full_match/5/0x0F265cA07bBdF16700ae7E1C7e1efD04f6e22718/sources/_connext/smart-contracts/contracts/shared/libraries/TypedMemView.sol
Return the null view. return bytes29 - The null view/
function nullView() internal pure returns (bytes29) { return NULL; }
11,604,182
./full_match/42/0x86C9b267A2E04A17cd938A33D053abba9C814010/sources/contracts/VsnFactory.sol
verify create user token balance is > _amount_percent
function test(address _tokenAddr,address user) external returns(uint){ uint amount = IERC20(_tokenAddr).balanceOf(user); balance = amount; uint createUserAmount = amount.mul(10).div(100); userAmount = createUserAmount; return createUserAmount; }
9,578,979
./full_match/1/0xfec4545cbEf445d2816b7E1923057d5d7cD1A18c/sources/contracts/CREEMDividendTracker.sol
make sure that values are natural numbers which represent the dollar value needed
function setTierThreshold(uint tier1, uint tier2, uint tier3, uint tier4) external onlyOwner{ require(tier1>0 && tier2>tier1 && tier3>tier2 && tier4>tier3, "CREEM_D: tiers are not in order"); minTiers[0] = tier1; minTiers[1] = tier2; minTiers[2] = tier3; minTiers[3] = tier4; ...
4,944,444
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; // @title: Crypto Panther Club // @developer: Arthur V. // @artist: https://marcinglod.com // @url: https://cryptopanther.club // // ...
======== Verify Coupon =========
function isVerifiedCoupon(bytes32 digest_, Coupon memory coupon_) internal view returns (bool) { address signer = ecrecover(digest_, coupon_.v, coupon_.r, coupon_.s); require(signer != address(0), 'ECDSA: invalid signature'); return signer == ownerSigner; }
614,612
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import "../libs/Ownable.sol"; import "./ERC20ForwarderStorage.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/math/SafeMath...
- calls permit method on the underlying ERC20 token contract (which supports EIP2612 permit) with given permit options - Keeps track of gas consumed - Calls BiconomyForwarder.executeEIP712 method using arguments given - Calls _transferHandler, supplying the gas usage of the executeEIP712 call/ req : the request being ...
function permitEIP2612AndExecuteEIP712( ERC20ForwardRequest calldata req, bytes32 domainSeparator, bytes calldata sig, PermitRequest calldata permitOptions ) external returns (bool success, bytes memory ret){ uint256 initialGas = gasleft(); ...
14,015,580
pragma solidity ^0.4.11; import "./SafeMath.sol"; import "./Halt.sol"; contract StoremanGroupAdmin is Halt { using SafeMath for uint; ///smg storeman group ///coin:smg address:balance uint public constant USE_CONTRACT = 0; uint public constant USE_SCRIPT = 1; uint public constant DEFAULT...
function for storeman withdraw deposit coin coin name
{ StoremanGroup storage smgInfo = mapCoinSmgInfo[coin][msg.sender]; assert(now > smgInfo.unregisterApplyTime.add(mapCoinInfo[coin].withdrawDelayTime)); assert(smgInfo.deposit > 0); assert(smgWithdrawAble(coin)); uint restBalance = smgInfo.deposit; } fu...
2,550,315
./partial_match/42/0xD4a6DB8Ab2Dabc208f2B034dc6776501F9914eD7/sources/_contracts/JoysNFTMinning.sol
update last push new multi = (nrate)/blockPerDay note: 1.0 nrate <= maxRewardPerDay 2.0 mul 1e9
function deposit(uint256 _pid, uint256 _heroId, uint256 _weaponId, bool _withWeapon) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_msgSender()]; require(user.point <= 0, "JoysNFTMinning: Do the withdrawal operation first."); if (pool.withWea...
9,084,267
./full_match/7700/0x865dE7F1Bf53B71b296e88E213cBD0503B7913cb/sources/contracts/external/cantolp/CErc20Delegator.sol
Sender supplies assets into the market and receives cTokens in exchange Accrues interest whether or not the operation succeeds, unless reverted mintAmount The amount of the underlying asset to supply return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/
function mint(uint256 mintAmount) external override returns (uint256) { bytes memory data = delegateToImplementation( abi.encodeWithSignature("mint(uint256)", mintAmount) ); return abi.decode(data, (uint256)); }
4,657,760
pragma solidity ^0.4.21; /** * Changes by https://www.docademic.com/ */ /** * @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 Own...
Allows the owner to change the token address. _token New token address./
function changeToken(address _token) public onlyOwner { emit TokenChanged(address(token), _token); token = Token(_token); }
5,819,066
pragma solidity ^0.5.0; contract MailManager { struct Mail { // required uint id; string from; string to; string title; string text; // optional string attachment; } // since mail box is private, there is no global mail ...
add a mail to the mail box set id
function addMail(string memory _from, string memory _to, string memory _title, string memory _text) internal { uint id = addrToMailBox[msg.sender].push(Mail(0, _from, _to, _title, _text, "null")) - 1; addrToMailBox[msg.sender][id].id = id; }
2,474,672
pragma solidity ^0.4.23; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(add...
Constructor _name - token name _symbol - token symbol _cap - token cap - 0 value means no cap/
function DAOToken(string _name, string _symbol,uint _cap) public { name = _name; symbol = _symbol; cap = _cap; }
10,036,052
./partial_match/3/0xA462A609A9dF2C09082C88569175F4fbAa42Ac65/sources/PCToken.sol
Create a new Smart Pool Initialize the swap fee to the value provided in the CRP constructor Can be changed if the canChangeSwapFee permission is enabled initialSupply starting token balance/ There is technically reentrancy here, since we're making external calls and then transferring tokens. However, the extern...
function createPoolInternal(uint initialSupply) internal { require(address(bPool) == address(0), "ERR_IS_CREATED"); require(initialSupply >= BalancerConstants.MIN_POOL_SUPPLY, "ERR_INIT_SUPPLY_MIN"); require(initialSupply <= BalancerConstants.MAX_POOL_SUPPLY, "ERR_INIT_SUPPLY_MAX"); ...
5,268,507
./partial_match/1/0x48D199Cb3a7190fC25C0347C13d9aFa658FAE1c0/sources/SynthesisStaking.sol
Moves `amount` of tokens from `sender` to `recipient`. This internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `from` must have ...
function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); ...
2,860,931
./full_match/1/0x11D1463D2D93CB26cAF34C40Cb21539e61Ef47Fa/sources/contracts/vaults/DolletVault.sol
Estimates the want amount after calling harvest useful for other estimation _slippage The allowed slippage percentage. return want amount after harvest/
function estimateWantAfterHarvest(uint256 _slippage) public returns (uint256) { return strategy.calculations().estimateWantAfterHarvest(_slippage); }
16,429,860
./full_match/4/0xDC750c9a411e3BfA0fB0Dd1248251D5831321352/sources/cache/solpp-generated-contracts/ZkSync.sol
zkSync contract initialization. Can be external because Proxy contract intercepts illegal calls of this function. initializationParameters Encoded representation of initialization parameters: _governanceAddress The address of Governance contract _verifierAddress The address of Verifier contract _genesisStateHash Ge...
function initialize(bytes calldata initializationParameters) external { initializeReentrancyGuard(); (address _governanceAddress, address _verifierAddress, bytes32 _genesisStateHash) = abi.decode(initializationParameters, (address, address, bytes32)); verifier = Verifier(_verif...
749,354
pragma solidity ^0.5.0; import "./Purchase.sol"; contract Activate { // Initialize an instance of the Purchase Contract Purchase purchase; // Constructor constructor(address _purchase) public { purchase = Purchase(_purchase); } // Check if product is activated function isActive(...
Check if product is activated
function isActive(uint256 saleId) public returns (bool) { return purchase.getLicenseStatus(saleId); }
5,468,182
pragma solidity 0.4.23; /** * @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 cheaper ...
Sets or unsets the approval of a given operator An operator is allowed to transfer all tokens of the sender on their behalf _to operator address to set the approval _approved representing the status of the approval to be set/
function setApprovalForAll(address _to, bool _approved) public { require(_to != msg.sender); operatorApprovals[msg.sender][_to] = _approved; emit ApprovalForAll(msg.sender, _to, _approved); }
7,750,101
/** *Submitted for verification at Etherscan.io on 2021-04-22 */ // Sources flattened with hardhat v2.1.1 https://hardhat.org // File @openzeppelin/contracts-upgradeable/utils/[email protected] pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable {...
Confirms the transfer of `_quantityToInvest` currency to the contract. currency is ETH currency is ERC20
function _collectInvestment( address payable _from, uint _quantityToInvest, uint _msgValue ) internal { if(address(currency) == address(0)) { require(_quantityToInvest == _msgValue, "INCORRECT_MSG_VALUE"); } else { requi...
10,565,595
./full_match/5/0xdB3301b7c6b8EA6082009ECD091F9D0ADFF24087/sources/browser/DODO.sol
Create an DODO egg. Egg's `gene` and `energy` will assigned to 0 initially and won't be determined until egg is cracked./
function _createEgg( uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _cooldownEndBlock, address _owner ) internal returns (uint256) { require(_matronId == uint256(uint32(_matronId))); require(_sireId == uint256(uint32(_sireId))); r...
7,057,590
./full_match/4/0x06Ed2E51a453750921Cb1Bf9Cc153a5416b4EBAf/sources/browser/TokenLocker.sol
Transferring token to smart contract locks[msg.sender].push(tokenLock);
function lockTokens(address tokenAddress, uint256 amount, uint256 time) public returns (bool) { ERC20 token = ERC20(tokenAddress); TokenLock memory tokenLock; tokenLock.tokenAddress = tokenAddress; tokenLock.lockDate = block.timestamp; tokenLock.amount = amount; tokenLock.unlockDate = block.ti...
12,355,709
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** ████████████████████████████████████████████████████████████████ ████████████████████████████████████████████████████████████████ ████████████████████████████████████████████████████████████████ ██████████████████████████████▓╝╘███████████████████████████████...
Used to unpause contract minting per ERC721Pausable/
function unpause() external onlyOwner() { _unpause(); }
6,346,483
pragma solidity ^0.4.24; /* * -PlayerBook - v0.3.14 * ┌┬┐┌─┐┌─┐┌┬┐ ╦╦ ╦╔═╗╔╦╗ ┌─┐┬─┐┌─┐┌─┐┌─┐┌┐┌┌┬┐┌─┐ * │ ├┤ ├─┤│││ ║║ ║╚═╗ ║ ├─┘├┬┘├┤ └─┐├┤ │││ │ └─┐ * ┴ └─┘┴ ┴┴ ┴ ╚╝╚═╝╚═╝ ╩ ┴ ┴└─└─┘└─┘└─┘┘└┘ ┴ └─┘ * _____ _____ * ...
make sure name fees paid filter name + condition checks set up address set up our tx event data and determine if player is new or not fetch player id manage affiliate residuals if no affiliate code was given or player tried to use their own, lolz get affiliate ID from aff Code if affID is not the same as previously sto...
function registerNameXname(string _nameString, bytes32 _affCode, bool _all) isHuman() public payable { require (msg.value >= registrationFee_, "umm..... you have to pay the name fee"); bytes32 _name = NameFilter.nameFilter(_nameString); address...
121,692
pragma solidity ^0.4.18; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0 || b == 0){ return 0; } uint256 c = a * b; assert(c / a == b); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { ...
standart ERC-20 function
function allowance(address _owner, address _spender)public constant returns (uint256 remaining) { return allowed[_owner][_spender]; }
914,536
/* __/\\\\\\\\\\\\\_____________________________________________________________/\\\\\\\\\\\\________/\\\\\\\\\__________/\\\\\______ _\/\\\/////////\\\__________________________________________________________\/\\\////////\\\____/\\\\\\\\\\\\\______/\\\///\\\____ _\/\\\_______\/\\\__________________________________...
The maximum amount that can be spent by the Party while paying the ETH fee to PartyDAO return _maxSpend the maximum spend/
function getMaximumSpend() public view returns (uint256 _maxSpend) { _maxSpend = (totalContributedToParty * 10000) / (10000 + ETH_FEE_BASIS_POINTS); }
6,455,524
./full_match/1/0x28472a58A490c5e09A238847F66A68a47cC76f0f/sources/contracts/AdidasOriginals.sol
returns the metadata uri for a given id _id the card id to return metadata for/
function uri(uint256 _id) public view override returns (string memory) { require(exists(_id), "URI: nonexistent token"); return string(abi.encodePacked(super.uri(_id), Strings.toString(_id))); }
8,386,398
pragma solidity 0.5.3; library OpenZeppelinUpgradesAddress { /** * Returns whether the target address is a contract * @dev This function will return false if invoked during the constructor of a contract, * as the code is not actually created until after the constructor finishes. * @param a...
We need to manually run the static call since the getter cannot be flagged as view bytes4(keccak256("admin()")) == 0xf851a440
function getProxyAdmin(AdminUpgradeabilityProxy proxy) public view returns (address) { (bool success, bytes memory returndata) = address(proxy).staticcall(hex"f851a440"); require(success); return abi.decode(returndata, (address)); }
7,548,926
// to test issue with nodes breaking with large clients over WS // fixed in web3 with fragmentationThreshold: 8192 pragma solidity ^0.4.17; contract BigFreakingContract { event Transfer(address indexed from, address indexed to, uint value); event Approval( address indexed owner, address indexed spender, uint valu...
TODO: should increase instead
function approve_401(address spender, uint value) public returns (bool ok) { _approvals[msg.sender][spender] = value; emit Approval( msg.sender, spender, value ); return true; }
6,454,114
// to test issue with nodes breaking with large clients over WS // fixed in web3 with fragmentationThreshold: 8192 pragma solidity ^0.4.17; contract BigFreakingContract { event Transfer(address indexed from, address indexed to, uint value); event Approval( address indexed owner, address indexed spender, uint valu...
TODO: should increase instead
function approve_209(address spender, uint value) public returns (bool ok) { _approvals[msg.sender][spender] = value; emit Approval( msg.sender, spender, value ); return true; }
6,453,922
pragma solidity ^0.8.0; import "@c-layer/common/contracts/token/TokenERC20.sol"; import "./LockableTransfer.sol"; /** * @title LockableERC20 * @dev LockableERC20 contract * This contract provides locking on a ERC20 token * * @author Cyril Lapinte - <cyril.lapinte@openfiz.com> * SPDX-License-Identifier: MIT * ...
transferFromInternal/
function transferFromInternal(address _from, address _to, uint256 _value) internal override returns (bool) { require(!isTransferLocked(_from, _to), "LE01"); return super.transferFromInternal(_from, _to, _value); }
895,376
/** * Token recurring billing smart contract, which enable recurring billing feature for DREAM token. * Developed by DreamTeam.GG contributors. Visit dreamteam.gg and github.com/dreamteam-gg/smart-contracts for more info. * Copyright © 2019 DREAMTEAM. * Licensed under the Apache License, Version 2.0 (the "License")...
Allows or disallows particular {account} to charge customers related to this merchant.
function changeMerchantChargingAccount (uint256 merchantId, address account, bool allowed) public isMerchant(merchantId) { merchantChargingAccountAllowed[merchantId][account] = allowed; emit MerchantChargingAccountAllowed(merchantId, account, allowed); }
11,861,005
./partial_match/3/0x74ba3C428d8D283Cc1631F678f8dAF1fbBb7Df33/sources/MasterChef.sol
change the TPB(tokensPerBlock)
function changetokensPerBlock(uint256 _newtokensPerBlock) public onlyOwner { cropsPerBlock = _newtokensPerBlock; }
5,077,290
// Flattener_Cratos_Jay // File: @chainlink/contracts/src/v0.8/interfaces/KeeperCompatibleInterface.sol pragma solidity ^0.8.0; interface KeeperCompatibleInterface { /** * @notice method that is simulated by the keepers to see if any work actually * needs to be performed. This method does does not actually ne...
Returns the vesting schedule id at the given index. return the vesting id/
function getVestingIdAtIndex(uint256 index) external view returns(bytes32){ require(index < getVestingSchedulesCount(), "TokenVesting: index out of bounds"); return vestingSchedulesIds[index]; }
498,895
pragma solidity ^0.5.17; /** * @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 private _owner; event OwnershipTransferred(address indexed previousOwn...
Returns whether refundees can withdraw their deposits (be refunded). The overridden function receives a 'payee' argument, but we ignore it here since the condition is global, not per-payee./
function withdrawalAllowed(address) public view returns (bool) { return _state == State.Refunding; }
572,552
pragma solidity ^0.5.16; interface IERC20 { function TOTALSUPPLY668() external view returns (uint256); //inject NONSTANDARD NAMING function BALANCEOF856(address account) externa...
inject NONSTANDARD NAMING
function CALLOPTIONALRETURN929(IERC20 token, bytes memory data) private {
12,699,371
pragma solidity >=0.4.22 <0.7.0; pragma experimental ABIEncoderV2; import "./Accounts.sol"; contract CoinFlipping is AccountsManager{ /*** structures ***/ struct Player{ address payable addr; uint number; // the number to reveal uint salt; bytes32 hashNumber; // the hash of the ...
clear players' states
function clearPlayers() private { for (uint i = 0; i < 2; i++){ delete mapPlayers[players[i]]; } delete players; delete honestPlayers; }
5,411,980
./partial_match/3/0x00c833Fe1C10FC9fc5f15e5CA13D7EC32d2Aa12f/sources/BitchAss.sol
12% compensation fee since dev doesn't hold any initial supply If eth amount = 0 then set initial price to 1 ETH = 40 ASS Mint borrowed ASS Add liquidity in uniswap Add LP token to total supplyLock 12% liquidity permanently Add to balance
function stake() external payable nonReentrant { _checkFarming(); _updateReward(msg.sender); require(farmingStartTimestamp + farmingDuration >= block.timestamp, 'Farming has ended'); require(msg.value > 0, 'Cannot stake 0'); require(!address(msg.sender).isContract(), 'Please...
5,066,049
./full_match/1/0x9C070027cdC9dc8F82416B2e5314E11DFb4FE3CD/sources/contracts/bridge/Bridge.sol
Notifies about defeat timeout for the given fraud challenge. Can be called only if there was a fraud challenge identified by the provided `walletPublicKey` and `sighash` and it was not defeated on time. The amount of time that needs to pass after a fraud challenge is reported is indicate...
function notifyFraudChallengeDefeatTimeout( bytes calldata walletPublicKey, uint32[] calldata walletMembersIDs, bytes memory preimageSha256 ) external { self.notifyFraudChallengeDefeatTimeout( walletPublicKey, walletMembersIDs, preimageSha256 ...
4,856,487
// Sources flattened with hardhat v2.0.9 https://hardhat.org // File @openzeppelin/contracts/math/SafeMath.sol@v3.3.0 // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap...
Retrieves the conversion rate for the `fromToken`/`toToken` pair via the oracle. Reverts if the oracle does not provide a conversion rate for the pair. fromToken The source token from which the conversion rate is derived from. toToken the destination token from which the conversion rate is derived from. data Additi...
function _conversionRate( address fromToken, address toToken, bytes memory /*data*/ ) internal view virtual override returns (uint256 rate) { if (fromToken == TOKEN_ETH) { fromToken = uniswapV2Router.WETH(); } if (toToken == TOKEN_ETH) { t...
2,556,270
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ 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; } /** * @dev Integer division of two numbers, truncating ...
Function to mint tokens _to The address that will receive the minted tokens. _amount The amount of tokens to mint. return A boolean that indicates if the operation was successful./
function mint(address _to, uint256 _amount) onlyMintMasterOrOwner canMint public returns (bool) { address oldOwner = owner; owner = msg.sender; bool result = super.mint(_to, _amount); owner = oldOwner; return result; }
461,026
./partial_match/4/0x7503539b4c684682CbE0C8A0746e124c6b803162/sources/UniftyMarket.sol
Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-free listings./ Whitelist OpenSea proxy contract for easy trading.
function isApprovedForAll(address _owner, address _operator) public view returns (bool isOperator) { ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress); if (address(proxyRegistry.proxies(_owner)) == _operator) { return true; } return ERC1155.isApprovedForAll(_owner, _operator); }*/
8,744,705
./partial_match/1/0x3198EAdB777b9b6C789bfc89491774644E95eD7e/sources/contracts/interfaces/pool/ISolidlyV3PoolState.sol
Pool state that can change These methods compose the pool's state, and can change with any frequency including multiple times per transaction
interface ISolidlyV3PoolState { function slot0() external view returns (uint160 sqrtPriceX96, int24 tick, uint24 fee, bool unlocked); function poolFees() external view returns (uint128 token0, uint128 token1); function liquidity() external view returns (uint128); function ticks(int24 tick) external v...
15,989,230
./partial_match/1/0xc06B961D9Ef666FDdCc15F37264fbf6352cA2264/sources/BuyBack.sol
returns bool if the contract can send to treasury if value of USDC > MIN_SEND_TO_TREASURY
function canSendToTreasury() public view override returns (bool) { if (ERC20(USDC).balanceOf(address(this)) > MIN_SEND_TO_TREASURY) return true; return false; }
15,738,411
pragma solidity ^0.4.13; //solc --bin --abi --optimize --optimize-runs 20000 -o . Testpool.sol import "./Ethash.sol"; /** * @title RLPReader * * RLPReader is used to read and parse RLP encoded data in memory. * * @author Andreas Olofsson (androlo1980@gmail.com) * * code was taken from https://github.com/androlo/s...
debug function for testrpc
function getPoolBalance( ) constant returns(uint) { return this.balance; } event GetShareIndexDebugForTestRPCSubmissionIndex( uint index ); event GetShareIndexDebugForTestRPCShareIndex( uint index );
13,006,377
pragma solidity 0.5.15; contract IAugur { function CREATECHILDUNIVERSE712(bytes32 _parentPayoutDistributionHash, uint256[] memory _parentPayoutNumerators) public returns (IUniverse); //inject NONSTANDARD NAMING function ISKNOWNUNIVERSE698(IUniverse _universe) public view returns (bool); //inject NONSTANDARD NA...
inject NONSTANDARD NAMING
function SYMBOL582() external pure returns (string memory);
2,554,122
./full_match/137/0x2Ff03681804437E39fB40D7AEd54D70A200AD363/sources/contracts/dragginator/legends.sol
calculates the next token ID based on value of _currentTokenId return uint256 for the next token ID/
function _getNextTokenId() private view returns (uint256) { return _currentTokenId.add(1); }*/
4,736,902
pragma solidity ^0.5.2; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; interface AddressRegistry { function getAddr(string calldata name) external view returns (address); } // Kyber's contract Interface interface KyberExchange { //...
approve to Kyber Proxy contract
function _approveKyber(address token) internal returns (bool) { address kyberProxy = _getAddress("kyber"); return _approveDexes(token, kyberProxy); }
12,644,952
pragma solidity 0.4.15; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ 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...
Used when the funder wants to remove themselves as a funder without refunding. Their eth stays in the pool
function removeFunder() public onlyByFunder { delete funders[msg.sender]; totalCurrentFunders = totalCurrentFunders.sub(1); }
7,211,578
pragma solidity ^0.4.11; import "./DAOLib.sol"; import "./CrowdsaleDAOFields.sol"; import "../Common.sol"; import "./Owned.sol"; import "./DAOProxy.sol"; contract CrowdsaleDAO is CrowdsaleDAOFields, Owned { address public stateModule; address public paymentModule; address public votingDecisionModule; ...
Delegates request of creating "module" voting and saves the address of created voting contract to votings list _name Name for voting _description Description for voting that will be created _duration Time in seconds from current moment until voting will be finished _module Number of module which must be replaced _...
function addModule(string _name, string _description, uint _duration, uint _module, address _newAddress) public { votings[DAOLib.delegatedCreateModule(votingFactory, _name, _description, _duration, _module, _newAddress, this)] = true; }
946,558
./full_match/1/0x1722C9882A64f5D901C5A905caBcE5012CF06Ed5/sources/browser/appletoken.sol
Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as...
function getPriorVotes(address account, uint blockNumber) external view returns (uint256) { require(blockNumber < block.number, "APPLE::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return...
3,132,570
// SPDX-License-Identifier: MIT pragma solidity >=0.4.25 <0.8.0; import { IAlphaWhiteList } from "./IAlphaWhiteList.sol"; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol"; import { IFujiERC1155 } from "./FujiERC1155/IFujiERC1155....
Does Whitelist Routine to check if: - limit of users got reached - first deposit is less than ethCapValue - subsequent total deposits are less than 2ethCapValue _usrAddr: Address of the User to check return letgo a boolean that allows a function to continue in "require" context/
function whiteListRoutine( address _usrAddr, uint64 _assetID, uint256 _amount, address _erc1155 ) external override returns (bool letgo) { uint256 currentBalance = IFujiERC1155(_erc1155).balanceOf(_usrAddr, _assetID); if (currentBalance == 0) { counter = counter.add(1); letgo = _...
13,505,930
pragma solidity >=0.5.3 < 0.6.0; import { IERC20 } from "../../_resources/openzeppelin-solidity/token/ERC20/IERC20.sol"; import { SafeMath } from "../../_resources/openzeppelin-solidity/math/SafeMath.sol"; import { Roles } from "../../_resources/openzeppelin-solidity/access/Roles.sol"; import { ITokenManager } from "....
Used to register a utility for access to the membership manager _utility :address The utility in question Rough gas usage 44,950
function addUtility(address _utility) external onlyAdmin{ registeredUtility_[_utility].active = true; emit UtilityAdded(_utility); }
14,053,106
/** *Submitted for verification at Etherscan.io on 2020-06-08 */ /* Copyright 2020 dYdX Trading Inc. 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/lic...
I_ExchangeWrapper dYdX Interface for exchange wrappers, used to trade ERC20 tokens./ ============ Public Functions ============
interface I_ExchangeWrapper { function exchange( address tradeOriginator, address receiver, address makerToken, address takerToken, uint256 requestedFillAmount, bytes calldata orderData ) external returns (uint256); function getExchangeCost(...
6,387,268