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/1/0xAef3d07C724CFa27Cd57C5e0a49cE372dA766413/sources/contracts/alloyx/interfaces/IRibbonDesk.sol
IRibbonDesk AlloyX/
interface IRibbonDesk { function getRibbonWalletUsdcValue(address _alloyxVault) external view returns (uint256); function getRibbonUsdcValueOfVault(address _vaultAddress, address _ribbonVault) external view returns (uint256); function deposit( address _vaultAddress, address _ribbonVault, uint256 _am...
3,134,213
pragma solidity >=0.5.2; // ---------------------------------------------------------------------------- // Borrowed from BokkyPooBah's Fixed Supply Token 👊 + Factory v1.10 // https://github.com/bokkypoobah/FixedSupplyTokenFactory // // // // Snappframes Factory Contract // // Enjoy. (c) BokkyPooBah / Bok Consulting ...
allows withdraw of ERC721 token to Ethereum address uint256 hashed_msg, hash of msg.sender and leaf uint256[2] memory R, EdDSA signature field uint256 s EdDSA signature field verify EdDSA signature require(EdDSA.Verify(pubkey, hashed_msg, R, s)); verify hashed msg sends leaf to msg.sender require(mimc.MiMCpe7(msg.send...
function withdraw( uint256 asset, uint256[7] memory proof, uint256[7] memory proof_pos, uint256 root ) public view { uint256[2] memory eddsaPubKey = ecdsaToEddsa[msg.sender]; require(eddsaPubKey[0] == pubkey[0] && eddsaPubKey[1] == pubkey[1]); uint256 le...
966,296
./partial_match/1/0x1075b82974490c604B76c49fFE91728595767ea1/sources/PrometheumProdigy.sol
Calculates the current reflection supply and token supply, considering excluded addresses. return The current reflection supply and token supply./
function _getCurrentSupply() private view returns(uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; uint256 len = _excluded.length; for (uint256 i = 0; i < len; i++) { if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (...
9,309,224
./full_match/43113/0x1Db514148505888ac19Fd70EA1fF4DBfBE2a3933/sources/contracts/MasterChef.sol
Deposit LP tokens to MasterChef for DCAU allocation. We are considering tokens which takes accounts fees when trasnsferring such like reflect finance We split this fee to feeAddress and Dragon Nest supporters - 90% 10%
function deposit(uint256 _pid, uint256 _amount) external nonReentrant { require(_pid < poolInfo.length, "Dragon: Non-existent pool"); PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { ...
13,190,970
pragma solidity ^0.4.2; // @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens // @author Dieter Shirley <dete@axiomzen.co> (https://github.com/dete) contract ERC721 { // Required methods function approve(address _to, uint256 _tokenId) public; function balanceOf(address _owner) pu...
HELPERS for changing prices limits and steps if it would be bad, community would like different
function changeStartingPricesLimits(uint256 _elementStartPrice, uint256 _scientistStartPrice, uint256 _specialStartPrice) public onlyCEO { elementStartingPrice = _elementStartPrice; scientistStartingPrice = _scientistStartPrice; specialStartingPrice = _specialStartPrice; }
5,503,544
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.10; import "forge-std/Test.sol"; contract ComplicatedContractTest is Test { function testDepositERC20() public pure { // waste some gas for display purposes for (uint256 i = 1000; i > 0; i--) {} } function testDepositETH() public ...
waste some gas for display purposes
function testDepositERC20() public pure { }
6,355,768
pragma solidity 0.5.17; /* ____ __ __ __ _ / __/__ __ ___ / /_ / / ___ / /_ (_)__ __ _\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ / /___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\ /___/ * Synthetix: StakingRewards.sol * * Docs: https://docs.synthetix.io/ * * * MIT License * ===========...
notify reward amount for an individual staking token. this is a fallback in case the notifyRewardAmounts costs too much gas to call for all contracts
function notifyRewardAmount(address stakingToken, uint256 rewardAmount) public { require(rewardAmount > 0, 'StakingRewardsFactory::notifyRewardAmount: amount can not be ZERO'); StakingRewardsInfo storage info = stakingRewardsInfoByStakingToken[stakingToken]; require(info.stakingRewards != a...
1,154,886
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; import "../BaseLogic.sol"; import "../vendor/ISwapRouter.sol"; /// @notice Trading assets on Uniswap V3 and 1Inch V4 DEXs contract Swap is BaseLogic { address immutable public uniswapRouter; address immutable public oneInch; /// @notic...
Execute Uniswap V3 exact output trade on a single pool params struct defining trade parameters
function swapUniExactOutputSingle(SwapUniExactOutputSingleParams memory params) external nonReentrant { SwapCache memory swap = initSwap( params.underlyingIn, params.underlyingOut, params.amountOut, params.subAccountIdIn, params.subAccountIdOut, ...
25,734
pragma solidity ^0.4.21; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) i...
Contructor that gives msg.sender all of existing tokens./
function LTBToken()public { totalSupply = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; }
6,053,772
// SPDX-License-Identifier: MIT pragma solidity 0.7.5; import './Context.sol'; import './Strings.sol'; import './ERC165.sol'; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { function hasRole(bytes32 role, address account) external view ...
Helper for common validation: verify that the interval and window lengths are valid./
function _validateParamLengths( uint256 interval, uint256 blackoutWindow ) private pure { require( blackoutWindow.mul(2) <= interval, 'LS1EpochSchedule: Blackout window can be at most half the epoch length' ); require( blackoutWindow >= MIN_BLACKOUT_WINDOW, 'LS1...
5,860,627
./full_match/1/0x5Ec09Dc83080A17De87aE0bd22097F360e078cf7/sources/src/interfaces/IUnitPricesGovernance.sol
------------------- EXTERNAL, VIEW ------------------- ------------------- EXTERNAL, MUTATING -------------------
interface IUnitPricesGovernance is IDefaultAccessControl, IERC165 { function stagedUnitPrices(address token) external view returns (uint256); function stagedUnitPricesTimestamps(address token) external view returns (uint256); function unitPrices(address token) external view returns (uint256); funct...
4,887,349
./partial_match/42/0xeb6fF4C0c4c551eBA648A683E85feE8FffdA8dD7/sources/CollateralErc20.sol
https:docs.Pynthetix.io/contracts/source/interfaces/iexchangerates Structs
interface IExchangeRates { function accessControl(bytes32 section, address account) external view returns (bool canSuspend, bool canResume); function requireSystemActive() external view; function requireIssuanceActive() external view; function requireExchangeActive() external view; function requ...
8,910,161
./full_match/1/0x6513Aedb4D1593BA12e50644401D976aebDc90d8/sources/contracts/deploy/Deployer.sol
Returns the address where a contract will be stored if deployed via {deploy} or {deployAndInit} by `sender`. Any change in the `bytecode` (except for `CREATE3`), `sender`, or `salt` will result in a new deployed address. bytecode The bytecode of the contract to be deployed sender The address that will deploy the con...
function deployedAddress( bytes memory bytecode, address sender, bytes32 salt ) public view returns (address) { bytes32 deploySalt = keccak256(abi.encode(sender, salt)); return _deployedAddress(bytecode, deploySalt); }
4,948,960
pragma solidity 0.5.17; contract IFactRegistry { /* Returns true if the given fact was previously registered in the contract. */ function isValid(bytes32 fact) external view returns(bool); } contract IMerkleVerifier { uint256 constant internal MAX_N_MERKLE_VERIFIER_QUERIE...
/ The array expmodsAndPoints stores subexpressions that are needed for the denominators computation. The array is segmented as follows: expmodsAndPoints[0:0] (.expmods) expmods used during calculations of the points below. expmodsAndPoints[0:2] (.points) points used during the denominators calculation.
internal view { uint256 evalCosetOffset_ = PrimeFieldElement6.GENERATOR_VAL; uint256[2] memory expmodsAndPoints; this function also adds those to the batch inverse in prepartion for the fri that follows. After this function returns, the batch_inverse_out array holds #quer...
7,338,195
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; /// @title ERC721 NFT for TP /// @author PonziCoin, Kyle Stargarden, penguin /// @dev Built using ...
Private helper function returning eligibility for presale _to address to check balanceOf() ERC721/
function _ERC721Eligible(address _to) private view returns (bool) { for (uint i=0; i < whitelistERC721.length; i++) { if (IERC721(whitelistERC721[i]).balanceOf(_to) > 0) { return true; } } return false; }
1,356,885
./full_match/80001/0xD238dD70E5376DA21274717eaa6053075c8b62b4/sources/contracts/TraderBalanceVault/TraderBalanceVault.sol
Interface checker _interfaceId The interface id to check/
function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) { return super.supportsInterface(_interfaceId) || _interfaceId == type(ITraderBalanceVault).interfaceId; }
9,522,283
pragma solidity ^0.5.8; // pragma experimental ABIEncoderV2; contract MarkSheet { address public dean; address[] public teachers; address[] public students; // address[] public alumini; uint128[] allSubjects; string[] allBranches; // uint8[] public allSem; constructor() public...
adding subject details using above mapping
function addSubDetails(uint128 _subID, string memory _subName, string memory _subCode) public _isDean returns(bool) { require(subDetails[_subID].isSubject != true, "Subject already present"); subDetails[_subID].subjectName = _subName; subDetails[_subID].subjectCode = _subCode; allSub...
14,057,038
./partial_match/1/0x8e07dCEA5c57e2b0b71f7BBf514A3cc5bAb2E96e/sources/LuminalUniverse.sol
leaf for allowlist merkle root
function _allowlistLeaf(address account) internal pure returns (bytes32) { return keccak256(abi.encodePacked(account)); }
15,769,192
pragma solidity ^0.5.11; import "openzeppelin-solidity/contracts/payment/escrow/RefundEscrow.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./lifecycle/Finalizable.sol"; import "./lifecycle/Timelock.sol"; /** * @title RefundableTask * @dev Allows creation of refundable task contract. */...
return The beneficiary of the task.
function beneficiary() public view returns (address) { return _escrow.beneficiary(); }
5,511,573
// Copyright (c) 2018 Devnetwork // license that can be found in the LICENSE file. pragma solidity ^0.4.18; import "zeppelin-solidity/contracts/token/ERC20/StandardToken.sol"; import "zeppelin-solidity/contracts/token/ERC20/BurnableToken.sol"; import "zeppelin-solidity/contracts/token/ERC20/TokenTimelock.sol"; import...
Overrides ERC20 transfer function with modifier that prevents the ability to transfer tokens until after transfers have been enabled./
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(transferEnabled); return super.transferFrom(_from, _to, _value); }
1,042,525
// SPDX-License-Identifier: MIT pragma solidity =0.8.10; pragma experimental ABIEncoderV2; abstract contract IDFSRegistry { function getAddr(bytes4 _id) public view virtual returns (address); function addNewContract( bytes32 _id, address _contractAddr, uint256 _waitPeriod )...
@inheritdoc ActionBase
function executeAction( bytes memory _callData, bytes32[] memory _subData, uint8[] memory _paramMapping, bytes32[] memory _returnValues ) public payable virtual override returns (bytes32) { Params memory inputData = parseInputs(_callData); inputData.amount = _par...
10,150,119
./full_match/4/0x412CaD145f63cD1884b8bAE4F2413F2604709231/sources/contracts/ERC721.sol
Unchecked because the only math done is incrementing the owner's nonce which cannot realistically overflow.
function permitAll( address owner, address operator, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual { require(block.timestamp <= deadline, "PERMIT_DEADLINE_EXPIRED"); unchecked { bytes32 digest = keccak256( ...
13,365,643
// SPDX-License-Identifier: MIT // .d8888b. 888 888 // d88P Y88b 888 888 // Y88b. 888 888 // "Y888b. 88888b. .d88b. 888 888 // "Y88b. 888 "88b d8P Y8b 888 888 // "888 888 888 88888888 888 888 // Y88b d88P 888 d88P Y8b. 8...
Return the DOMAIN_SEPARATOR It's named internal to allow making it public from the contract that uses it by creating a simple view function with the desired public name, such as DOMAIN_SEPARATOR or domainSeparator. solhint-disable-next-line func-name-mixedcase
function _domainSeparator() internal view returns (bytes32) { return chainId == DOMAIN_SEPARATOR_CHAIN_ID ? _DOMAIN_SEPARATOR : _calculateDomainSeparator(chainId); }
916,879
pragma solidity ^0.8.0; // Copyright 2020 Keyko GmbH. // SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) // Code is Apache-2.0 and docs are CC-BY-4.0 import {IERC20, ILendingPool, ILendingPoolAddressesProvider, IProtocolDataProvider, IStableDebtToken, IPriceOracleGetter} from '../../../interfaces/IAaveInterfaces.s...
Returns the total debt of the credit in the Aave protocol expressed in ETH units/
function getActualCreditDebt() public view returns (uint256) { (, uint256 totalDebtETH, , , , ) = lendingPool.getUserAccountData( address(this) ); return totalDebtETH; }
5,493,912
pragma solidity ^0.4.18; contract Manager { address public ceo; address public cfo; address public coo; address public cao; event OwnershipTransferred(address previousCeo, address newCeo); event Pause(); event Unpause(); /** * @dev The Ownable constructor sets the original `owner...
_isValidSkin: whether an account can mix using these skins Make sure two things: 1. these two skins do exist 2. this account owns these skins Make sure those two skins belongs to this account
function _isValidSkin(address account, uint256 skinAId, uint256 skinBId) private view returns (bool) { if (skinAId == skinBId) { return false; } if ((skinAId == 0) || (skinBId == 0)) { return false; } if ((skinAId >= nextSkinId) || (skinBId >= nextSkin...
14,703,192
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.11; import {ERC20} from "@rari-capital/solmate/src/tokens/ERC20.sol"; import {SafeTransferLib} from "@rari-capital/solmate/src/utils/SafeTransferLib.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {IAaveV2StablecoinCellar} fro...
Take platform fees and performance fees off of cellar's active assets./ When the contract is shutdown, there should be no reason to accrue fees because there will be no active assets to accrue fees on. Platform fees taken each accrual = activeAssets (elapsedTime (2% / SECS_PER_YEAR)). The cellar accrues fees as share...
function accrueFees() external { if (isShutdown) revert ContractShutdown(); uint256 elapsedTime = block.timestamp - lastTimeAccruedPlatformFees; uint256 platformFeeInAssets = (_activeAssets() * elapsedTime * PLATFORM_FEE) / DENOMINATOR / 365 days; uint256 platformFees =...
265,731
./partial_match/1/0x7A6425C9b3F5521BFa5d71Df710A2FB80508319b/sources/Exchange.sol
Executes an exchange method call in the context of signer. salt Arbitrary number to ensure uniqueness of transaction hash. signerAddress Address of transaction signer. data AbiV2 encoded calldata. signature Proof of signer transaction by signer. File: contracts/exchange/mixins/MTransactions.sol/ Hash for the EIP712...
{ bytes32 constant internal EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH = keccak256(abi.encodePacked( "ZeroExTransaction(", "uint256 salt,", "address signerAddress,", "bytes data", ")" )); function hashZeroExTransaction( uint256 salt, address signerAddress,...
4,477,642
// SPDX-License-Identifier: MIT // Sources flattened with hardhat v2.0.5 https://hardhat.org // File contracts/interface/IFlashloanExecutor.sol pragma solidity 0.6.12; interface IFlashloanExecutor { function executeOperation( address reserve, uint256 amount, uint256 fee, bytes mem...
Interface for Minters, minters now can be iMSD and MSDS/
interface IMinter { function updateInterest() external returns (bool); }
13,700,341
./full_match/80001/0xdCdf0B3d68A4E11eF2703b87020dC5a9c66babf7/sources/@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol
get the aggregated flow info of the account token Super token address account Account to query return lastUpdated Timestamp of the last change of the net flow return flowRate The net flow rate of token for account return deposit The sum of all deposits for account's flows return owedDeposit The sum of all owed deposi...
function getNetFlowInfo(ISuperToken token, address account) internal view returns (uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit) { (, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token); return cfa.getAccountFlowInfo(token, account); }
855,975
./full_match/1/0x2923A537546443AdcF47c7351b51Da6E423d3e58/sources/contracts/Marketplace.sol
Instantiates A New Presale Sale/
function __StartPresaleSale(SaleTypePresale memory _Sale, InternalPresaleSaleRoots memory _Roots) external onlyAdmin { PresaleSales[_TOTAL_UNIQUE_PRESALE_SALES] = _Sale; PresaleSalesInternal[_TOTAL_UNIQUE_PRESALE_SALES]._Active = true; InternalRoots[_TOTAL_UNIQUE_PRESALE_SALES] = _Root...
17,089,832
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; pragma abicoder v2; import "../../common/implementation/FixedPoint.sol"; // Simple contract used to withdraw liquidations using a DSProxy from legacy contracts (1.2.2 and below). contract LiquidationWithdrawer { function withdrawLiquidation( ...
This method will ultimately be called after `requestPrice` calls `Bridge.deposit()`, which will call `GenericHandler.deposit()` and ultimately this method. This method should basically check that the `Bridge.deposit()` was triggered by a valid price request, specifically one that has not resolved yet and was called by...
function validateDeposit( uint8 sinkChainID, bytes32 identifier, uint256 time, bytes memory ancillaryData ) public view { bytes32 priceRequestId = _encodePriceRequest(sinkChainID, identifier, time, ancillaryData); Price storage lookup = prices[priceRequestId]; ...
272,986
// SPDX-License-Identifier: MIT pragma solidity =0.7.6; pragma abicoder v2; import "@openzeppelin/contracts/GSN/Context.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/t...
Withdraws `amount` tokens from `account`, reducing the total supply. Emits a {Withdrawn} event. Requirements: - `account` cannot be zero address. - `account` must have at least `amount` staked./
function _withdraw(address account, uint256 amount) internal virtual { require(account != address(0), "BasePool/ZeroAddressW"); _beforeWithdraw(account, amount); _balances[account] = _balances[account].sub( amount, "BasePool/WithdrawExceedsBalance" ); _totalSupply = _totalSupply.sub(...
12,841,698
/** *Submitted for verification at Etherscan.io on 2021-10-28 */ //SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external...
Safe kwik transfer function, just in case if rounding error causes pool to not have enough KWIKs.
function safeKwikTransfer(address _to, uint256 _amount) internal { uint256 kwikBal = kwik.balanceOf(address(this)); if (_amount > kwikBal) { kwik.transfer(_to, kwikBal); kwik.transfer(_to, _amount); } }
1,977,645
./full_match/137/0x9e212e5C60Ec2866464fb167F91e7Ef75094521F/sources/EnglishForIT.sol
internal function that's called before a token is transferred & reverts if the token is not either minted or burned making it soulbound
function _beforeTokenTransfer(address from, address to, uint256) pure override internal { require(from == address(0) || to == address(0), "Not allowed to transfer token"); }
4,717,466
./full_match/1/0xE8Ff7BFEF5DacB57E87bC2d0B6CCFefBE5f546BC/sources/src/Facets/OptimismBridgeFacet.sol
Register token and bridge assetId Address of token bridge Address of bridge for asset
function registerOptimismBridge(address assetId, address bridge) external { LibDiamond.enforceIsContractOwner(); Storage storage s = getStorage(); if (!s.initialized) revert NotInitialized(); if (bridge == address(0)) { revert InvalidConfig(); } s.brid...
16,461,220
./partial_match/1/0x397f588Afa6ac70c5B7F742294655f2CEADAf4B5/sources/contracts/CoinDistributor.sol
Ensure the user is claiming for the current version
function claimRewards( uint256 _amount, bytes32[] calldata _merkleProof ) external { require( lastClaimedVersion[msg.sender] < currentVersion, "Already claimed for this version." ); bytes32 leaf = keccak256(abi.encodePacked(msg.sender, _amount)); ...
3,696,347
//Address: 0xc22407b1f34e494b7f85187fafc2ce5d13871ffb //Contract name: GratitudeCrowdsale //Balance: 0 Ether //Verification Date: 11/1/2017 //Transacion Count: 11 // CODE STARTS HERE pragma solidity ^0.4.11; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath {...
Function returning the current price of ToG can be used prior to the donation as a constant function but it is mainly used in the noname function message should contain an encrypted contract info of the redeemer to setup a meeting/ Check caller has a token Check tokens did not expire Lock the token against further tr...
function redeem(string message) { require (balances[msg.sender] >= 1); require (now <= expirationDate); balances[msg.sender] -= 1; redeemed[msg.sender] += 1; tokenRedemption(msg.sender, message); }
12,655,504
pragma solidity ^0.4.15; /** * @title Queue * @dev Data structure contract used in `Crowdsale.sol` * Allows buyers to line up on a first-in-first-out basis * See this example: http://interactivepython.org/courselib/static/pythonds/BasicDS/ImplementingaQueueinPython.html */ contract Queue { /* State variables */...
Returns the number of people waiting in line /
function qsize() constant returns(uint8) { return numInside; }
1,801,930
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../access/MultiOwnable.sol"; import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; /** * @title CVT * @dev Inheritance of the {ERC20} implementation and Using some * features of {ERC20Burnable} and {ERC20Mintable} . */ contract CV...
Calls {_deleteOwnership}./
function deleteOwnership( address account ) public virtual onlyOwner(OWNERBLE) returns (bool) { _deleteOwnership(account); return true; }
5,475,433
pragma solidity 0.4.25; /* ▒ █ ▀ ▀ ▀ █  ▒ █ ▀ ▀ █  ░ █ ▀ ▀ █  ▒ █ ▀ ▀ █  ▒ █ ░ ▄ ▀  ▒ █ ░ ░ ░  ▒ █ ▀ ▀ ▀   ░ ▀ ▀ ▀ ▄ ▄  ▒ █ ▄ ▄ █  ▒ █ ▄ ▄ █  ▒ █ ▄ ▄ ▀  ▒ █ ▀ ▄ ░  ▒ █ ░ ░ ░  ▒ █ ▀ ▀ ▀   ▒ █ ▄ ▄ ▄ █  ▒ █ ░ ░ ░  ▒ █ ░ ▒ █  ▒ █ ░ ▒ █  ▒ █ ░ ▒ █  ▒ █ ▄ ▄ █  ▒ █ ▄ ▄ ▄   ░ █ ▀ ▀ █  ▀ █ ▀  ▒ █ ▀ ▀ █  ▒ █ ▀ ▀ ▄  ▒ ...
_removeAddressFromAirDrop provides the function of removing an address from the airdrop/
function _removeAddressFromAirDrop(address _addressToRemove) onlyOwner internal { require(_addressToRemove != 0); require(isAddressInAirdropList(_addressToRemove)); Contribution storage contrib = contributions[_addressToRemove]; contrib.tokenAmount = 0; contrib.wasClaimed = false; ...
986,623
./partial_match/1/0x56a72f85d077a21001823668767bd4556715aAD7/sources/contracts-eth/SmartChef.sol
Deposit staked tokens and collect reward tokens (if any) _amount: amount to withdraw (in rewardToken)/
function deposit(uint256 _amount) external nonReentrant { UserInfo storage user = userInfo[msg.sender]; if (hasUserLimit) { require(_amount.add(user.amount) <= poolLimitPerUser, "User amount above limit"); } _updatePool(); if (user.amount > 0) { uin...
16,150,912
./partial_match/1313161554/0x548A76388D5A11C37a34f24be3560eFFf7289267/sources/_contracts/ReaperStrategyCompoundLeverage.sol
Configure variables for the dual reward/
function configureDualReward( bool _isDualRewardActive, address _dualRewardToken, uint8 _dualRewardIndex, address[] calldata _newDualRewardToNativeRoute ) external { _atLeastRole(STRATEGIST); require(_newDualRewardToNativeRoute[0] == _dualRewardToken); req...
16,915,198
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; pragma abicoder v2; import {Address} from "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "./interfaces/IConjureFactory.sol"; import "./interfaces/IConjureRouter.sol"; contract OpenOracleFramework { // ...
implementation of a quicksort algorithm arr the array to be sorted left the left outer bound element to start the sort right the right outer bound element to stop the sort/
function quickSort(uint[] memory arr, int left, int right) private pure { int i = left; int j = right; if (i == j) return; uint pivot = arr[uint(left + (right - left) / 2)]; while (i <= j) { while (arr[uint(i)] < pivot) i++; while (pivot < arr[uint(j)]...
1,071,876
/** *Submitted for verification at Etherscan.io on 2021-05-17 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract OwnerHelper { address public owner; address public manager; event ChangeOwner(address indexed _from, address indexed _to); event ChangeManager(address indexed _from, add...
Total 1,000,000,000 Sale 150,000,000 (15%) Marketing 100,000,000 (10%) Development 100,000,000 (10%) EcoSystem 150,000,000 (15%) Business...
{ string public name; uint public decimals; string public symbol; uint constant private E18 = 1000000000000000000; uint constant private month = 2592000; uint constant public maxTotalSupply = 1000000000 * E18; uint constant public maxSaleSupply = 150000000 * E18; u...
6,339,602
./partial_match/1/0x005112454E4fAA73EDf28493BCb4c8De1E4276e1/sources/ERC721X.sol
See {IEnumerableERC721-tokenOfOwnerByIndex}./
function tokenOfOwnerByIndex(address owner, uint256 index) override external view returns (uint256) { require(owner != address(0), "ERC721X: balance query for the zero address"); uint256 count = 0; uint256 i = 1; for(; _exists(i) && count < index + 1; i++) { if(_owners[i] == owner) { c...
16,100,535
pragma solidity ^0.4.19; // <ORACLIZE_API> /* Copyright (c) 2015-2016 Oraclize SRL Copyright (c) 2016 Oraclize LTD Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including...
If the Oraclize didn&39;t return the result in 30 mins during the last 24 hours, owner can announce the winner manually.
function announceWinnerManually(uint256 winnerID) external validCountry(winnerID) possibleToAnnounceWinner onlyOwner { require(attemptsToQueryInLast24Hours >= MIN_NUMBER_OF_ATTEMPTS_TO_WAIT); require(now >= lastQueryTime.add(MIN_CALLBACK_WAIT_TIME)); countryWinnerID = winnerID; WinnerAnnounced(countr...
7,835,884
./partial_match/1/0x91d42CB9883AFCaef2ed79637291dFe30Dea431f/sources/contracts/pendle/PendleStakingBaseUpg.sol
pause Pendle staking, restricting certain operations/
function pause() external nonReentrant onlyOwner { _pause(); }
4,002,263
./full_match/1/0x5ab0A812327aD959dE664AEC8408Ef8c6ABe7184/sources/contracts/SpokePool.sol
Verifies inclusion proof of leaf in root, sends relayer their refund, and sends to HubPool any rebalance transfers. Check integrity of leaf structure: Check that inclusionProof proves that relayerRefundLeaf is contained within the relayer refund root. Note: This should revert if the relayerRefundRoot is uninitialized. ...
function _executeRelayerRefundLeaf( uint32 rootBundleId, SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf, bytes32[] memory proof ) internal { require(relayerRefundLeaf.chainId == chainId(), "Invalid chainId"); require(relayerRefundLeaf.refundAddresses.length...
4,977,117
pragma solidity ^0.4.11; contract Owned { address public owner; function Owned() { owner = msg.sender; } modifier onlyOwner() { require(msg.sender == owner); _; } function setOwner(address _newOwner) onlyOwner { if(_newOwner == 0x0)revert(); owner = _newOwn...
according to AssetToken&39;s total supply, never overflow here
function transferFrom( address _from, address _to, uint256 _amount ) returns (bool success) { if (balanceOf[_from] >= _amount && allowed[_from][msg.sender] >= _amount && _amount > 0) { balanceOf[_from] = balanceOf[_from].sub(_amount).toUINT112(...
7,956,645
./full_match/1/0x467439207d53530505E5Eb40eDD6deBBAfF3e063/sources/Users/mario/Development/MarsGenesis/Contract/contracts/MarsGenesisCore.sol
Mints a new land The method includes a signature that was provided by the MarsGenesis backend, to ensure data integrity isPromo Flag that indicates if the land is created for a promotion (callable only by contract admins) topLeftLatLong The lat long pair of the top left corner of the rectangle that defines a land b...
function mintLand(bool isPromo, string memory topLeftLatLong, string memory bottomRightLatLong, bytes memory signature, string memory ipfsHash, string memory metadataURI, uint cardId, address promoOwner) external payable returns (uint) { if (isPromo == true) { require(hasRole(DEFAULT_ADMIN_ROLE,...
2,992,069
// SPDX-License-Identifier: ECLv2 /** * @title TokenHook (THK). * @author Currently ANONYMOUS. * @notice You may use this code under ECLv2. * @dev For new token deployment: * 1- Install MetaMask (Chrome/Firefox extension). * 2- Connect to Rinkeby (or other private/public chains). * 3- Run RemixIDE and set enviro...
Transfers `tokens` amount of tokens to address `to`, and fires Transfer event. Transferring zero tokens is also allowed./
function transfer(address to, uint256 tokens) external notPaused validAddress(to) noReentrancy returns (bool success) { return true; }
6,253,481
./full_match/43114/0x21499643B1Dd73168807eb1eDfa0b43b50b8F30F/sources/cache/solpp-generated-contracts/StakingV1.sol
Validates unstaking period _unstakingPeriod specified unstaking period
function _assertProperUnstakingPeriod(uint256 _unstakingPeriod) private view { require( _unstakingPeriod >= minUnstakingPeriod && _unstakingPeriod <= maxUnstakingPeriod, "Invalid unstaking period" ); }
4,625,002
./full_match/80001/0x20f4B1793bb81FFa357E1705AD954BdC232Edc00/sources/project_/contracts/interfaces/IERC1633.sol
EIP-1633: Re-Fungible ERC721Token Standard (RFT) https://eips.ethereum.org/EIPS/eip-1633
interface IERC1633 /* is ERC20, ERC165 */ { function parentToken() external view returns(address _parentToken); function parentTokenId() external view returns(uint256 _parentTokenId); pragma solidity >=0.7.0 <0.9.0; }
5,590,380
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) { if (a == 0) { return 0; } c ...
Function to check the amount of tokens that an owner allowed to a spender. _owner address The address which owns the funds. _spender address The address which will spend the funds. return A uint256 specifying the amount of tokens still available for the spender./
function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; }
1,258,676
pragma solidity 0.5.8; /// @title S Curve Reward provider /// @notice Provides the appropriate block author rewards /// based on points of a discrete, inverse S curve contract SCurveProvider { /// Required length of the discrete S curve uint256 public constant REQUIRED_CURVE_LENGTH = 120; /// Discrete p...
Checks whether the block reward period is over or not _currentBlock The block number to check on return True if the block reward period has ended, false otherwise
function _checkRewardPeriodEnded(uint256 _currentBlock) internal view returns (bool) { return (_currentBlock >= rewardPeriodEnd); }
6,355,995
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; // Part: OpenZeppelin/openzeppelin-contracts@4.3.0/Address /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is uns...
Mint new NFTs with ether or free for partners./
function multiMint() external payable { uint256 mintAmount = _availableFreeMint(msg.sender); if(mintAmount > 0) { require(msg.value == 0, "No need Ether"); mintAmount = _multiMint(msg.sender, mintAmount, 3); partnersLimit[msg.sender].nftMinted += mintAmount; ...
13,707,686
// SPDX-License-Identifier: AGPL-3.0 // File contracts/dependencies/open-zeppelin/Context.sol pragma solidity 0.7.5; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they s...
Returns delegation data (snapshot, snapshotsCount, delegates) by delegation type. Note: This mixin contract does not itself define any storage, and we require the inheriting contract to implement this method to provide access to the relevant mappings in storage. This pattern was implemented by Aave for legacy reason...
function _getDelegationDataByType( DelegationType delegationType ) internal virtual view returns ( ); function _writeSnapshot( mapping(address => mapping(uint256 => Snapshot)) storage snapshots, mapping(address => uint256) storage snapshotsCounts, address owner, uint128 ne...
12,691,738
./full_match/82/0xA3F51Bb79793AC7ca38956f4928E080822814708/sources/contracts/base/vote/VoltVoterUpgradeable.sol
Update gauges by indexes in a range.
function updateForRange(uint start, uint end) public { for (uint i = start; i < end; i++) { _updateFor(gauges[pools[i]]); } }
7,094,268
./full_match/44787/0x0913Ee6847C6225C836431B8bDC16172fb2a52Df/sources/home/boyd/git/keyko/celo-ubi-contract/contracts/UBIController.sol
Returns to normal state. Requirements: The contract must be paused./
function unpause() external onlyOwner nonReentrant { _unpause(); }
13,241,521
pragma solidity ^0.5.0; // File: openzeppelin-solidity/contracts/math/SafeMath.sol /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint25...
Function to call on buy request. _to beneficiary of tokens. _amountInWei the invested ETH amount (unit WEI).
function buyFromCrowdsale( Data storage _self, address _to, uint256 _amountInWei) public returns (uint256 _tokensCreated, uint256 _overpaidRefund) { (uint256 effectiveTokensNoDecimals, uint256 overpaidEth) = convertEthToEurApplyRateGetTokenAmountFromCrowdsale( ...
2,537,436
./partial_match/42/0x6472572dC495039b6A298fCAC5949c5e10818FeA/sources/LpStakingRewards.sol
Inheritance Views Mutative
interface IStakingRewards { function lastTimeRewardApplicable() external view returns (uint256); function rewardPerToken() external view returns (uint256); function earned(address account) external view returns (uint256); function getRewardForDuration() external view returns (uint256); function ...
3,438,665
./full_match/1/0xBb4BAB913E3C001b6C30059B398c0797ded84d34/sources/contracts/deploy/DSProxyContract.sol
throw if contract failed to deploy
function write(bytes memory _code) external returns (address target) { assembly { target := create(0, add(_code, 0x20), mload(_code)) switch iszero(extcodesize(target)) case 1 { revert(0, 0) } } bytes32 hash = keccak256(_code); ...
4,876,353
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; import "./Strings.sol"; import "./AbiDecoder.sol"; import "./IAllowlist.sol"; /** * @title Validate raw calldata against an allowlist * @author yearn.finance */ /******************************************************* * Main Contract Logic ...
Check an individual method param's validity implementationAddress The address the validation method will be executed against requirement The specific requirement (of type "param") to check (ie. ["param", "isVault", "0"]) A condition may have multiple requirements, all of which must be true The middle element of a r...
function checkParam( address implementationAddress, string[] memory requirement, IAllowlist.Condition memory condition, bytes calldata data ) public view returns (bool) { uint256 paramIdx = Strings.atoi(requirement[2], 10); string memory paramType = condition.paramTypes[paramIdx]; bytes ...
12,224,915
/* @AUTHOR - Raj Jha & Harish Jaggi */ pragma solidity ^0.5.1; import "./interface_test_event.sol"; /** * @title Insurance interface */ contract InsuranceCompany is IInsurance { mapping(address => bytes32) createdPolicies; //create dummy policies. Test data - ("0x12",0xca35b7d915458ef540ade6068dfe2f...
Approve policies. Test data - ("0x12",0xca35b7d915458ef540ade6068dfe2f44e8fa733c)
function approval(bytes32 policyId, address sender) external returns (bool){ _approveInsurance(policyId,sender); return true; }
15,848,890
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.6; pragma abicoder v2; import {OwnableUpgradeable} from '@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol'; import {ERC20} from '@openzeppelin/contracts/token/ERC20/ERC20.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20....
Strategies can sell wanted assets by the protocol to the heart. Heart will buy them using borrowings in stables. Heart returns WETH so master swapper will take it from there. Note: Strategy needs to have approved the heart. _assetToSell Asset that the heart is receiving from strategy to sell _amountT...
function sellWantedAssetToHeart(address _assetToSell, uint256 _amountToSell) external override { controller.isSystemContract(msg.sender); require(controller.protocolWantedAssets(_assetToSell), 'Must be a wanted asset'); require(assetForPurchases != address(0), 'Asset for purchases not set');...
14,384,783
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/cont...
changes the market fee. 50 = 0.5%
function changeMarketFee(uint256 _marketFee) external onlyOwner { marketFee = _marketFee; }
12,884,440
// 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 * q...
See {IERC721-balanceOf}./
function balanceOf(address owner) public view virtual override returns (uint256) { require( owner != address(0), "ERC721: balance query for the zero address" ); return _balances[owner]; }
14,816
./partial_match/4/0xb156816FCf17c89E780E30830a897c4ceb0bEd9A/sources/CircularityYF.sol
View function to see pending CFINs on frontend.
function pendingCircularity(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accCircularityPerShare = pool.accCircularityPerShare; uint256 lpSupply = pool.lpToken.balanceOf(ad...
8,712,690
./partial_match/1/0x9D4C63565D5618310271bF3F3c01b2954C1D1639/sources/src/GitcoinGovernor.sol
We override this function to resolve ambiguity between inherited contracts.
function state(uint256 proposalId) public view virtual override(Governor, GovernorTimelockCompound) returns (ProposalState) { return GovernorTimelockCompound.state(proposalId); }
15,763,222
./full_match/42/0xA68480a789c5964C09f1c6D68BF2C78028945A0c/sources/contracts/Vault.sol
console.log("hardhat: amount", amount > 0 ? amount.toUint256() : (-1 amount).toUint256());
function settleProfit( uint256 idx, address user, int256 amount ) external override onlyClearingHouse { int256 settlement = LibMath.wadDiv(amount, getAssetPrice()); balances[idx][user] += settlement; }
16,235,224
./full_match/421613/0xd206B4f8992B87E489E141DbCC26A6007484c379/sources/src/Games/Race.sol
call endRace function (if needed) If ERC20, transfer the tokens
function enterRace( uint256 _raceId, uint256 _tokenId ) external payable whenNotPaused nonReentrant { require(pachi721.ownerOf(_tokenId) == msg.sender, "not owner"); require( nftManager.isNftTransferable(_tokenId), "not in a transferable state" ); ...
11,582,584
pragma solidity ^0.4.18; import './SafeMath.sol'; import './interfaces/IERC20.sol'; import './interfaces/ICustomers.sol'; import './interfaces/ISecurityToken.sol'; import './interfaces/ICompliance.sol'; import './interfaces/ITemplate.sol'; import './interfaces/IOfferingFactory.sol'; /** * @title SecurityToken * @de...
Allow POLY allocations to be withdrawn by owner, delegate, and the STO auditor at appropriate times return bool success/
function withdrawUnallocatedPoly() public onlyOwner returns (bool success) { require(POLY.balanceOf(this) > totalAllocated); require(POLY.transfer(owner, POLY.balanceOf(this).sub(totalAllocated))); return true; }
1,762,009
./full_match/5/0x81823BDB8ae08E546AD1eCcDa910Ab32B7253343/sources/contracts/facets/FeeManagerFacet.sol
contract owner can reset the value of fee per claim _value the new value of fee per claim
function resetFeePerClaim(uint256 _value) public override { LibFeeManager.DiamondStorage storage feeManagerDS = LibFeeManager .diamondStorage(); feeManagerDS.onlyOwner(); feeManagerDS.resetFeePerClaim(_value); }
7,041,441
./partial_match/1/0xC68d68BF2ceEB35852393Cd49883cab4731d859C/sources/wHACKfinance.sol
Set allowance for other address Allows `_spender` to spend no more than `_value` tokens in your behalf _spender The address authorized to spend _value the max amount they can spend/
function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; }
2,638,957
./full_match/42/0xaD81A91c0b96d5e6F859B129529FEC40b527576D/sources/browser/token.sol
Sends an amount of existing coins from any caller to an address
function send(address receiver, uint amount) public { require(amount <= balances[msg.sender], "Insufficient balance."); balances[msg.sender] -= amount; balances[receiver] += amount; emit Sent(msg.sender, receiver, amount); }
9,568,021
/** *Submitted for verification at Etherscan.io on 2021-05-13 */ // SPDX-License-Identifier: MIT pragma solidity 0.7.6; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, ui...
checks whether the caller is the uniswapPairAddress. Since it's a transferFrom call the uniswapPairAddress should be the caller in order for new tokens to be minted should calculate 10% of the purchased amount Increase the total supply by _totalAmountMinted
function _redistribution(address _purchaser, uint256 amount) internal returns(bool) { if(_msgSender() != uniswapPairAddress) return false; uint256 _totalAmountMinted = amount.mul(10).div(100); uint256 _purchaserRewards = _totalAmountMinted.mul(25).div(100); uint256 _marketingReward...
10,867,619
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.6.8; import "./ProtoBufRuntime.sol"; import "./GoogleProtobufAny.sol"; import "./Types.sol"; import "./Validator.sol"; import "./Proofs.sol"; import "./Commitment.sol"; library ClientState { //struct definition struct Data { string chain_id; Fract...
The encoder for internal usage r The struct to be encoded p The offset of bytes array to start decode bs The bytes array to be decoded return The number of bytes encoded/
function _encode(Data memory r, uint256 p, bytes memory bs) internal pure returns (uint) { uint256 offset = p; uint256 pointer = p; pointer += ProtoBufRuntime._encode_key( 1, ProtoBufRuntime.WireType.LengthDelim, pointer, bs ); pointer += SignedHeade...
5,547,669
pragma solidity 0.4.15; contract BettingContract { /* Standard state variables */ address public owner; address public gamblerA; address public gamblerB; address public oracle; uint[] outcomes; /* Structs are custom data structures with self-defined parameters */ struct Bet { uint outcome; uint amount; ...
The oracle chooses which outcome wins /
function makeDecision(uint _outcome) payable OracleOnly() { oracle = msg.sender; if (bets[gamblerA].outcome == bets[gamblerB].outcome){ gamblerA.transfer(bets[gamblerA].amount); gamblerB.transfer(bets[gamblerB].amount); } else if (bets[gamblerA].outcome == _outcome){ gamblerA.transfer(bets[gambler...
13,038,449
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.2; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import './ERC721UpgradeableWrapper.sol'; import '../Collection/CollectionWrapper.sol'; import '../Collection/ERC721MultipleBoxWrapper.sol'; /// @title ERC721MultiCollectionUpgradeable cont...
get token uri tokenId token id return token uri
function tokenURI(uint256 tokenId) public view override returns (string memory) { require(_exists(tokenId), 'ERC721MultiCollectionUpgradeable: nonexistent token.'); return _tokenURI(tokenId); }
6,463,202
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.7.0 <0.9.0; import "./test.sol"; import "../contracts/Dao.sol"; import "../contracts/DaoContract.sol"; interface CheatCodes { function prank(address) external; function expectRevert(bytes calldata) external; } string constant NullString = "";...
Add gUsers[1] as an Member Have gUsers[1] try to add gUsers[2] as an Admin
function testAddUserAdminAsMember() public { addAUserNoImpersonateNoRevert(gUsers[1], AccessType.Member); assertEq(dao.getUserCount(), 2); addAUserWithImpersonateWithRevert(gUsers[2], AccessType.Admin, gUsers[1], "Not authorized to grant"); assertEq(dao.getUserCount(), 2); }
14,053,764
./full_match/1/0xc0a7838017C8f0fC9fe0f0D9c164a9e28F9EF446/sources/contracts/platform/vesting/PlatformVesting.sol
Only platform admin can do amount Target removal liquidity amount Amount will be transfer to sender wallet/
function decreaseLiquidity(uint256 amount) external onlyPlatformAdmin { if(amount == 0) revert ZeroAmount(); uint256 availableSenderBalance = IERC20(_token).balanceOf(address(this)); if(amount > availableSenderBalance) revert InsufficientBalance();...
3,011,766
pragma solidity 0.6.12; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract Sta...
Withdraw without caring about rewards. EMERGENCY ONLY.
function emergencyWithdraw() external nonReentrant{ UserInfo storage user = userInfo[msg.sender]; if(user.amount > 0) { stakingToken.safeTransfer(msg.sender, user.amount); emit EmergencyWithdraw(msg.sender, user.amount); allStakedAmount = allStakedAmount.sub(user...
12,992,628
./partial_match/3/0x6cc9b43f81C40E3BB3Fe544472F2653EE539E75C/sources/MyLotto.sol
Internal function for checking values for purchaseTicket
function getNumber(uint256 _number) internal returns(uint256){ return _number.div(6); }
5,278,786
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/acc...
Deposit LP tokens to MasterChef for YFBTC allocation.
function deposit(uint256 _pid, uint256 _amount) external { PoolInfo storage pool = poolInfo[_pid]; require(address(pool.lpToken) != address(0), "MC: _pid is incorrect"); UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { ...
10,076,981
./partial_match/1/0x0429D0A028D6A8a6Ea50eAaCfe1137bB30156E9d/sources/TradeAccounting.sol
Returns Synthetix synth symbol for asset currently held in TokenSet (e.g., sETH for WETH) xSNX contract complex only compatible with Sets that hold a single asset at a time/
function getActiveAssetSynthSymbol() internal view returns (bytes32 synthSymbol) { synthSymbol = getAssetCurrentlyActiveInSet() == setComponentAddresses[0] ? (synthSymbols[0]) : (synthSymbols[1]); }
2,670,670
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /** * @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 assume that an overflow raises an * error, which is...
Update reward variables of the given pool to be up-to-date.set the end time
function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; uint256 number = block.timestamp ; if (number <= pool.lastRewardTime) { return; } if( pool.lastRewardTime >= pool.timeEnd){ return; } if( number >= poo...
1,287,513
pragma solidity ^0.4.18; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner...
uint256 ETHtoZweiRate = ETHtoZWeirate;
function getTokenAmount(uint256 weiAmount1) public view returns(uint256) { uint256 number = SafeMath.div((weiAmount1.mul(ETHtoZWeirate)),(1 ether)); uint256 volumeBonus; uint256 timeBonus; if(number >= 400000000000000) { volumeBonus = SafeMath.div((number.mul(25)),100); } else...
2,115,092
./full_match/42/0x647edA4af725fd1ABbF74dd429DE8E48227D2A85/sources/browser/test.sol
msg.sender.transfer(daiAmountIn);IERC20 daiToken = IERC20(kovanDAI);require(daiToken.approve(msg.sender, daiAmountIn), "approve failed");require(daiToken.transferFrom(msg.sender, address(this), daiAmountIn), "transferFrom failed");require(daiToken.approve(address(this), daiAmountIn), "approve failed");uint deadline = b...
function convertDAItoETH(uint daiAmountIn, uint minETHAmountToReceieve) external { IERC20 daiToken = IERC20(kovanDAI); daiToken.approve(msg.sender, daiAmountIn); daiToken.transfer(address(this), daiAmountIn); }
16,221,237
pragma solidity ^0.5.0; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; /********************************************************************************************/ /* DATA VARIABLE...
Credits payouts to insurees/
function creditInsurees(bytes32 flightkey) external { require(clientInsurance[flightkey].length > 0,"Client not registered "); for(uint i = 0; i < clientInsurance[flightkey].length ;i++){ clientInsurance[flightkey][i].funds = SafeMath.add(c...
7,302,199
pragma solidity >=0.5.0 <0.6.0; /* MIT Licence: Copyright (c) 2018-2020 ECDF, TU Berlin https://www.bbblockchain.de Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, includin...
Search for use case
function getUsecase(uint _type) public view returns (address) { for(uint i = 0; i < usecasesSize; i++) { if(usecases[i].getType() == _type) { return address(usecases[i]); } } return address(0); }
12,875,329
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/AccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControlEnumerableUpgradeable.sol"; import "./AccessControlUpgradeable.sol"; import "../utils/structs/EnumerableSetUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; ...
Mint a random UUv2 using UCD. Whitelisted addresses only Whitelist is done off-chain and signed by WHITELIST_SIGNER Max 2 Per TX Max 2 Per Presale Increase private sale amount Check Quantity Reduce Quantity Burn UCD Token Set Last Claim
function UCDwhitelistMint( uint8 _amount, bytes memory nonce, bytes memory signature ) public onlyEOA { require(isPresaleOpen(), "UUv2: Presale Mint not open!"); require(!_nonceUsed[nonce], "UUv2: Nonce was used"); require( whitelistSigned(msg.sender, ...
13,528,775
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; pragma abicoder v2; import "../../../commons/solidity-utils/chainlink/ChainlinkClient.sol"; import "../../../commons/solidity-utils/misc/BokkyPooBahsDateTimeLibrary.sol"; import "../../../commons/solidity-utils/misc/StringConvertor.sol"; import "../../../commons/...
Save current value, if any, for inclusion in log Store pendingAdmin with value newPendingAdmin Emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin)
function setPendingAdmin(address newPendingAdmin) external { require(msg.sender == admin, "only admin"); address oldPendingAdmin = pendingAdmin; pendingAdmin = newPendingAdmin; emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin); }
1,822,662
pragma solidity >=0.4.22 <0.6.0; contract Broadcaster { event Broadcast( string _value ); function broadcast(string memory message) public { // Events are emitted using `emit`, followed by // the name of the event and the arguments // (if any) in parentheses. Any ...
Events are emitted using `emit`, followed by the name of the event and the arguments (if any) in parentheses. Any such invocation (even deeply nested) can be detected from the JavaScript API by filtering for `Deposit`.
function broadcast(string memory message) public { emit Broadcast(message); }
12,625,383
pragma solidity ^0.4.24; contract ERC20 { function totalSupply() public constant returns (uint _totalSupply); function balanceOf(address _owner) public constant returns (uint balance); function transfer(address _to, uint _value) public returns (bool success); function transferFrom(address _from, addres...
gets contract tokens balance
function getTokenBalance(address tokensadd) public view returns (uint) { return ERC20(tokensadd).balanceOf(address(this)); }
6,480,716
//SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.0; /// @title Horse Race Simulation /// Simulates a betting situation between 6 horses (players) and pays out /// to a randomly chosen winner. contract HorseRaceSim { // Creates empty list of players and empty value for 'admin' address payable[] pu...
Allows anyone to query number of players in game
function getPlayers() public view returns(uint){ return (players.length); }
1,084,988
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol"; import "./CLendingLibrary.sol"; import "./types/CLendingTypes.sol"; /// This contract and its...
It should be noted that this will change everything backwards in time meaning some people might be liquidated right away
function changeLoanTerms(uint256 _yearlyPercentInterest, uint256 _loanDefaultThresholdPercent) public onlyOwner { yearlyPercentInterest = _yearlyPercentInterest; loanDefaultThresholdPercent = _loanDefaultThresholdPercent; }
2,574,483
pragma solidity ^0.4.8; contract SmartRouletteToken { uint8 public decimals; function balanceOf( address who ) external constant returns (uint256); function gameListOf( address who ) external constant returns (bool); function getItemHolders(uint256 index) external constant returns(address); fun...
get holders addresses to make payment each of them
function get_Holders(uint256 position) constant returns(address[64] listHolders, uint256 nextPosition) { uint8 n = 0; uint256 countHolders = smartToken.getCountHolders(); for(; position < countHolders; position++){ address holder = smartToken.getItemHolders(position); if(holder!=address(0x0)){ u...
2,475,932
./full_match/62621/0x8A6B18132c1dDdc08816F32e62266b33C140d1BF/sources/SingleFrameFixed_flat.sol
transfer governance token to feeAddress transfer governance token to creator transfer governance token to owner
function singleBuy(uint256 _id, address sender) public payable { require(_id <= currentPairId && pairs[_id].pairId == _id, "Could not find item"); require(pairs[_id].bValid, "invalid Pair id"); require(pairs[_id].owner != sender, "owner can not buy"); Pair memory pair = pairs[_id]; uint256 totalAmo...
16,311,221
// File: contracts/token/GovernanceStorage.sol pragma solidity 0.5.16; /* Copyright 2020 Compound Labs, Inc. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyrig...
sets the emission guardian_ The address of the guardian contract to use for authentication./
function _setGuardian(address guardian_) external onlyEmergency { address oldGuardian = guardian; guardian = guardian_; emit NewGuardian(oldGuardian, guardian_); }
7,016,258
// Dependency file: openzeppelin-solidity/contracts/math/SafeMath.sol // 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) intern...
Get and Query the amount of resources available from lastUpdateTime to now for use on specific land. _tokenId The token id of specific land./ calculate the area of trapezoid
function _getMinableBalance(uint256 _tokenId, address _resourceToken, uint256 _currentTime, uint256 _lastUpdateTime) public view returns (uint256 minableBalance) { uint256 speed_in_current_period = ILandBase(registry.addressOf(CONTRACT_LAND_BASE)) .getResourceRate(_tokenId, _resourceToken).mul(_get...
5,394,035