file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
/** *Submitted for verification at Etherscan.io on 2021-09-12 */ // SPDX-License-Identifier: MIT pragma solidity 0.8.2; // Part: OpenZeppelin/[email protected]/Address /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract...
Setter for NFT price /
function setPublicSellStatus(bool _publicSellOn) external onlyOwner { publicSellOn = _publicSellOn; }
2,364,132
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "./lib/SafeMath.sol"; import "./lib/Context.sol"; import "./lib/Ownable.sol"; import "./lib/Address.sol"; import "./lib/IERC20.sol"; import "./lib/IXAUToken.sol"; import "./lib/IFeeApprover.sol"; import "./lib/IXAUVault.sol"; /** * @dev Implementation o...
See {IERC20-balanceOf}./ function balanceOf(address account) public override returns (uint256) { return _balances[account]; }
function balanceOf(address _owner) public override view returns (uint256) { return _fromUnderlying(_balances[_owner]); }
12,866,426
./partial_match/42/0x7Dab59e2Ca3a043316C2039453989d8519756d92/sources/DisposableGovernance.sol
to change the capacity limit val is the new value/
function _changeCapacityLimit(uint val) internal { capacityLimit = val; }
3,299,921
./full_match/43113/0xaAa9C6f9fA1df9986aacADb08470a448168Ff955/sources/contracts/TripleSlopeRateModel.sol
Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)` cash The amount of cash in the market borrows The amount of borrows in the market reserves The amount of reserves in the market (currently unused) return The utilization rate as a mantissa between [0, 1e18]/ Utilization rate is 0 ...
function utilizationRate( uint256 cash, uint256 borrows, uint256 reserves ) public view returns (uint256) { if (borrows == 0) { return 0; } uint256 util = borrows.mul(1e18).div(cash.add(borrows).sub(reserves)); if (util > roof) { u...
7,202,168
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.3; import "../interfaces/IERC20.sol"; import "../libraries/History.sol"; import "../libraries/VestingVaultStorage.sol"; import "../libraries/Storage.sol"; import "../interfaces/IVotingVault.sol"; contract VestingVault is IVotingVault { // Bring our libra...
Manager-only token withdrawal function. The manager can withdraw tokens that are not being used by a grant. This function cannot be used to recover tokens that were sent to this contract by any means other than `deposit()` _amount the amount to withdraw _recipient the address to withdraw to update unassigned value
function withdraw(uint256 _amount, address _recipient) public onlyManager { Storage.Uint256 storage unassigned = _unassigned(); require(unassigned.data >= _amount, "Insufficient balance"); unassigned.data -= _amount; token.transfer(_recipient, _amount); }
13,511,867
./full_match/1/0x2C4A29175DffF7076B41Fda0032c254d9038e7dC/sources/contracts/MarsanExchangePass.sol
Withdraw ETH from Contract
function withdraw() external onlyOwner { uint256 amount = address(this).balance; address payable receiver = payable(owner()); receiver.sendValue(amount); emit Withdraw(receiver, amount); }
16,411,061
./full_match/43114/0xcd35d77c69ce4A7f5c8c2B9E4363179ed97E2EC1/sources/comptroller/avax/TraderJoeLibrary.sol
given an output amount of an asset and pair reserves, returns a required input amount of the other asset
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) { require(amountOut > 0, 'SpiritswapLibrary: INSUFFICIENT_OUTPUT_AMOUNT'); require(reserveIn > 0 && reserveOut > 0, 'SpiritswapLibrary: INSUFFICIENT_LIQUIDITY'); uint numerator = reser...
4,575,064
/** *Submitted for verification at Etherscan.io on 2021-04-07 */ // Dependency file: @openzeppelin/contracts/utils/Context.sol // SPDX-License-Identifier: MIT // pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. Whi...
5% at TGE, 95% released daily over 300 Days, no Cliff
function withdrawTokens() external onlyAdvisor() initialized() { Advisor storage advisor = advisorsInfo[_msgSender()]; uint256 tokensAvailable = withdrawableTokens(_msgSender()); require(tokensAvailable > 0, "no tokens available for withdrawl"); advisor.withdrawnTokens = advisor.w...
2,313,302
pragma solidity ^ 0.5 .8; import './ERC1404.sol'; import './ITransferRules.sol'; contract TransferRules is ITransferRules { uint8 public constant SUCCESS = 0; uint8 public constant GREATER_THAN_RECIPIENT_MAX_BALANCE = 1; uint8 public constant SENDER_TOKENS_TIME_LOCKED = 2; uint8 public constant DO_NOT_...
ERC1404 FUNCTIONS / Detects if a transfer will be reverted and if so returns an appropriate reference code from Sending address to Receiving address value Amount of tokens being transferred return Code by which to reference message for rejection reasoning
function detectTransferRestriction(ERC1404 token, address from, address to, uint256 value) public view returns(uint8) { if (token.isPaused()) return ALL_TRANSFERS_PAUSED; if (to == address(0)) return DO_NOT_SEND_TO_EMPTY_ADDRESS; if (to == address(token)) return DO_NOT_SEND_TO_TOKEN_CONTRACT; if (val...
12,611,316
./partial_match/1/0xfdB5Dee856A2709F9D356ABb6A38c391c6eBCe6C/sources/CountdownGriefingEscrow_Factory.sol
ERC20 TotalSupply tokenID TokenManager.Tokens ID of the ERC20 token. return value uint256 amount of tokens.
function totalSupply(Tokens tokenID) internal view onlyValidTokenID(tokenID) returns (uint256 value) { return IERC20(getTokenAddress(tokenID)).totalSupply(); }
4,386,848
// SPDX-License-Identifier: MIT-open-group pragma solidity ^0.8.0; import "ds-test/test.sol"; import "./GovernanceManager.sol"; import "./GovernanceMaxLock.sol"; import "./GovernanceProposal.sol"; import "./GovernanceStorage.sol"; import "./Governance.sol"; import "./StakeNFT.sol"; import "./interfaces/INFTStake.sol"...
Initialize Base scenario setup
function setUp(address stakeToken) public virtual { registry = new Registry(); setUpEthDKG(registry); setUpMisc(registry, stakeToken); setUpValidators(registry); address stakingTokenAddress = registry.lookup(STAKING_TOKEN); stakingToken = BasicERC20(stakingTokenAddr...
12,685,185
pragma solidity >=0.4.21 <0.6.0; import "./ERC1155.sol"; contract ERC1155Detector { bytes4 constant ERC1155ID = 0xd9b67a26; bytes4 constant ERC1155TokenReceiverID = 0x4e2312e0; constructor() public {} /** * @dev Check interface ERC1155. */ function hasERC1155Interface(address _target)...
Check interface ERC1155 (TokenReceiver)./
function hasERC1155TokenReceiverInterface(address _target) public view returns (bool) { return ERC1155(_target).supportsInterface(ERC1155TokenReceiverID); }
898,726
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import './libraries/StakingPoolLogicV2.sol'; import './interface/IStakingPoolV2.sol'; import './token/StakedElyfiToken.sol'; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; /// @title Elyfi StakingPool ...
Allow a user to deposit underlying tokens and mint the corresponding number of wrapped tokens. This function is based on the openzeppelin ERC20Wrapper
function _depositFor(address account, uint256 amount) internal virtual returns (bool) { SafeERC20.safeTransferFrom(underlying, _msgSender(), address(this), amount); _mint(account, amount); return true; }
1,237,148
// SPDX-License-Identifier: Apache-2.0 // Copyright 2021 Enjinstarter pragma solidity ^0.7.6; pragma abicoder v2; // solhint-disable-line import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/Pausable.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "...
paymentToken ERC20 payment token address return rate_ how many weis one token costs for specified ERC20 payment token/
function _rate(address paymentToken) internal view virtual returns (uint256 rate_) { rate_ = _rates[paymentToken]; }
6,367,999
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "@openzeppelin/contracts/utils/math/Math.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeabl...
check locking period return block.timestamp >= SALE_START && block.timestamp <= SALE_START.add(vestingInfo.lockingDuration);
function checkLockingPeriod(address userAddr) public view returns (bool) { UserInfo memory userInfo = userList[userAddr]; VestingInfo memory vestingInfo = getUserVestingInfo(userAddr); return block.timestamp >= userInfo.firstDepositedTime && block.timestamp <= userInfo.firstDepositedTime.add...
480,074
pragma solidity ^0.4.18; /** * WorldCoin: https://worldcoin.cash */ //====== Open Zeppelin Library ===== /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { uint256 public totalSupply; function balanc...
Buy WorldCoin tokens/
function() payable public { sale(msg.sender, 0x0); }
12,947,970
./full_match/1/0x6C5c2c8776Ecc5943760C68a200eC7e3650eFC2F/sources/contracts/paymaster/TokenPaymaster.sol
Sets the token blacklist mode for the specified token token The address of the token to set the blacklist mode for mode Boolean value to set the token blacklist mode to blacklist (true) or whitelist (false)/
function setTokenBlacklistMode(address token, bool mode) public payable { _setTokenBlacklistMode(token, msg.sender, mode); emit SetTokenBlacklistMode(token, msg.sender, mode); }
16,537,832
./full_match/1/0xD02A7208809821bC465BfBA4865D544cC48a93E8/sources/contracts/NFTStandard.sol
Add 1 to the number of token minted key The sale/minting-condition Id/ assert key must exist
function _tokenTrackerIncrement(Sales storage sales, uint256 key) internal { assert(_contains(sales, key)); sales._values[key]._tokenIdTracker.increment(); }
3,037,537
// File: @openzeppelin/upgrades/contracts/Initializable.sol pragma solidity >=0.4.24 <0.7.0; /** * @title Initializable * * @dev Helper contract to support initializer functions. To use it, replace * the constructor with a function that has the `initializer` modifier. * WARNING: Unlike constructors, initializer...
enableAllTranfers = true; This is only for testing, will be false
function createConstants() internal { name = "Marlin Governance Token"; symbol = "MPOND"; decimals = 18; totalSupply = 10000e18; bridgeSupply = 7000e18; DOMAIN_TYPEHASH = keccak256( "EIP712Domain(string name,uint256 chainId,address verifyingContract)" ...
521,743
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.6.6; import "./BToken.sol"; import "./BMath.sol"; // Core contract; can't be changed. So disable solhint (reminder for v2) /* solhint-disable func-order */ /* solhint-disable event-name-camelcase */ contract BPool is BBronze, BToken, BMath { struct...
Safe unsigned integer max Returns the greater of the two input values a - first operand b - second operand return - the maximum of a and b/
function bmax(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; }
303,221
./full_match/5/0xeF08caa65280EA1cD261Ae034dAD0FBc15411B70/sources/project_/contracts/Marketplace.sol
function to get all listings WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that this function has an unbounded cost, and using it as part of a state-...
function getAllListings() public view returns (Listing[] memory) { Listing[] memory listings = new Listing[](_nftsListed.current()); uint256 listingsIndex = 0; address[] memory nftContracts = EnumerableSet.values(_nftContracts); for (uint i = 0; i < nftContracts.length; i++) { ...
7,036,116
./full_match/1/0xD835dbD135AD8a27214ecdEE79E7a41337865648/sources/src/BurnTokens.sol
============ External Functions ============ Adds a supported burn token token address of the token contract/
function addSupportedBurnToken(address token) public onlyAdmin { if (isSupportedBurnToken(token)) { revert AlreadySupportedBurnToken(); } if (token == address(0)) { revert InvalidTokenAddress(); } supportedBurnTokens[token] = true; e...
16,544,673
./partial_match/42/0x3d341f82C6B6960a828Def7B00c2ad85E1B931A2/sources/Ris3Governance.sol
mine new tokens for farm and factory
function startElection() public { require(now > govElectionStartTime, "Election time have not started"); uint256 prodAmount = prodRatesOptions[currentProdRatesType] * 2; ris3.mintByGovernance(prodAmount); stopElection = false; }
3,445,647
./full_match/77/0x2d9B44a226174c74268c1F10e729bdC2d528eD78/sources/contracts/LP.sol
Owner: Indicate if `maintainer` is active maintainer or not./
function updateMaintainer(address maintainer, bool active) external onlyOwner { maintainers[maintainer] = active; emit MaintainerUpdated(maintainer, active); }
5,050,105
//SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "../interfaces/IEternalFund.sol"; import "../interfaces/IEternalTreasury.sol"; import "../interfaces/IEternalFactory.sol"; im...
Hook called by the _transfer function in order to update vote balances after a given transaction sender The initiator of the specified transaction recipient The destination address of the specified transaction amount The amount sent from the sender to the recipient in the transaction/
function _beforeTokenTransfer(address sender, address recipient, uint256 amount) private { address senderDelegate = eternalStorage.getAddress(entity, keccak256(abi.encodePacked("delegates", sender))); address recipientDelegate = eternalStorage.getAddress(entity, keccak256(abi.encodePacked("delegates...
1,069,736
./partial_match/1/0x64Ae9640252AA9488E011a7efE55ee9D8Be885ae/sources/contracts/modules/PropsPBT.sol
first request must have been between 48 and 24 hours ago
function completeTokenUnlock( bytes calldata signatureFromChip, uint256 blockNumberUsedInSig ) external { uint256 currentTime = block.timestamp; uint256 tokenId = _getTokenDataForChipSignature(signatureFromChip, blockNumberUsedInSig).tokenId; UnlockRequest storage unlockR...
4,478,253
./full_match/97/0x41e5EBf76C2765db31Dc31f6b81336A49a8853b4/sources/project_/contracts/CrowdSale.sol
Change the base token address of the token newToken address of the token./
function changeToken( IERC20Upgradeable newToken ) external virtual onlyOwner onlyWhileOpen whenNotPaused { require( address(newToken) != address(0), "Token: Address cant be zero address" ); _changeToken(newToken); }
3,278,023
pragma solidity ^0.5.13; import "../helpers/openzeppelin-solidity/math/SafeMath.sol"; import "../helpers/openzeppelin-solidity/token/ERC20/IERC20.sol"; /// @title Deposit /// @author Stephane Gosselin (@thegostep) for Numerai Inc /// @dev Security contact: security@numer.ai /// @dev Version: 1.2.0 /// @dev State Mac...
Set the deposit of a user to zero. user address of the user. return amountRemoved uint256 amount removed from deposit. get current deposit remove deposit return
function _clearDeposit(address user) internal returns (uint256 amountRemoved) { uint256 currentDeposit = _deposit[user]; _decreaseDeposit(user, currentDeposit); return currentDeposit; }
5,364,473
./partial_match/1/0xDF7F126B7270BA17C7b9964188e9020EB410096d/sources/PepemonStake.sol
Stake cards into a staking event Save list cards staked in storage
function stakeAny(uint256 _eventId, uint256[] memory _cardIdList, uint256[] memory _cardAmountList) public { require(_cardIdList.length == _cardAmountList.length, "Arrays have different length"); StakingEvent storage _event = stakingEvents[_eventId]; UserInfo storage _userInfo = userInfo[ms...
3,633,146
./partial_match/1/0x0490d838017E69dB3fd678E2787704d599c188aD/sources/PairedInvestments.sol
Calculate investment profits and fees _value investment value _amount original investment amount _traderFeePercent trader fee percent _investorFeePercent investor fee percent _investorProfitPercent investor profit percent return array with: trader fee, investor fee, trader profit, investor profit
function calculateProfitsAndFees ( uint256 _value, uint256 _amount, uint256 _traderFeePercent, uint256 _investorFeePercent, uint256 _investorProfitPercent ) public pure returns (uint256, uint256, uint256, uint256) { if (_value > _amount) { uint256 _profit = _value - _amount; ...
15,528,834
./partial_match/1313161554/0xd6163e12342F5BFf092Bd4ee8FE9B77ac7CC85b1/sources/UspTreasury.sol
28 first epochs with 4.5% expansion Expansion ($USP Price > 1 $USDC): there is some seigniorage to be allocated saved enough to pay debt, mint as usual rate have not saved enough to pay debt, mint more
function allocateSeigniorage() external onlyOneBlock checkCondition checkEpoch checkOperator { _updateUspPrice(); previousEpochUspPrice = getUspPrice(); uint256 uspSupply = getUspCirculatingSupply().sub(seigniorageSaved); if (epoch < bootstrapEpochs) { _sendToMasonry(uspS...
16,932,457
pragma solidity ^0.8.5; // SPDX-License-Identifier: MIT interface IERC20 { /** * @dev Returns the total tokens supply */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) e...
deducteds balance from sender and add to recipient with reward for sender only/
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipi...
14,473,038
./full_match/4/0x0Ca74f4d70656E1DbC28b2FFfcc5CB16f21fE4f7/sources/SimpleStorage.sol
push is the method to add to an array we added a People object to the array of People called people
function addPerson(string memory _name, uint256 _favNum) public{ nameToFavNum[_name] = _favNum; }
793,884
./partial_match/1/0xC54698d116F40faBD5349BB7a756CFea1Cb084aD/sources/DRCHashDataCon.sol
Compares two strings and returns true iff they are equal.
function equal(string memory _a, string memory _b) internal pure returns(bool) { return compare(_a, _b) == 0; }
3,885,022
./full_match/1/0xc980E61e2b3c95F8E9797F2E012Cf0C9066fA4a2/sources/contracts/BondSwap/Exchange/CurrencyManager.sol
Add a currency in the system currency address of the currency to add/
function addCurrency(address currency) external override onlyOwner { require(!_whitelistedCurrencies.contains(currency), "Currency: Already whitelisted"); _whitelistedCurrencies.add(currency); emit CurrencyWhitelisted(currency); }
2,933,776
./partial_match/1/0x75Be69fc0859874E722D97a7f464D402e3dCff58/sources/contracts/libraries/Utilities.sol
Get the larger number
function max(uint8 one, uint8 two) internal pure returns (uint8) { return one > two ? one : two; }
3,888,309
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; pragma abicoder v2; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol"; import "@openzepp...
Migrate the current position to a new position with different ticks Migrates position tick lower and upper by same amount of ticks Tick spacing (minimum tick difference) in pool w/ 3000 fee is 60 ticks how many ticks to shift up or down up whether to move tick range up or down/
function migrateParallel(uint24 ticks, bool up) external onlyOwnerOrManager { require(ticks != 0); int24 newTickLower; int24 newTickUpper; int24 ticksToShift = int24(ticks) * 60; if (up) { newTickLower = tickLower + ticksToShift; n...
1,686,592
./full_match/8453/0x40D1243C3B84d597b60f410A36694e256B51De5c/sources/contracts/erc20/ERC20BulkSender.sol
refund failed payments' amount to contract admin address
function airdrop(address tokenAddress, address[] calldata recipients, uint256[] calldata amounts) external payable nonReentrant { require(recipients.length == amounts.length, "ERC20BulkSender: Invalid input lengths"); require(recipients.length <= limit, "ERC20BulkSender: Too many recipients"); ...
11,545,192
pragma solidity ^0.4.0; // USE SECURE MATH (https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/Math.sol) import "./helpers/Mortal.sol"; import "./helpers/CustomMath.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.s...
saves game to storage then deletes
function endCurrentGame() public gameFinished(currentGame.endTime) { gamesByStartTime[currentGame.startTime] = currentGame; delete currentGame; }
5,397,081
// File: contracts/interfaces/IMarketHandler.sol pragma solidity 0.6.12; /** * @title BiFi's market handler interface * @author BiFi(seinmyung25, Miller-kk, tlatkdgus1, dongchangYoo) */ interface IMarketHandler { function setCircuitBreaker(bool _emergency) external returns (bool); function setCircuitBreakWithOwn...
Get (total deposit liquidity limit - total borrow) of the handler return (total deposit liquidity limit - total borrow) of the handler/
function _getTokenLiquidityLimitAmount() internal view returns (uint256) { IMarketHandlerDataStorage _handlerDataStorage = handlerDataStorage; uint256 depositTotalAmount; uint256 borrowTotalAmount; (depositTotalAmount, borrowTotalAmount) = _handlerDataStorage.getHandlerAmount(); uint256 liquidityDeposit = u...
1,420,312
./full_match/1/0x9BE46EFa5E99dE9b1bA7219f90C8b77293d83255/sources/contracts/CryptoZooBaseAnimal.sol
different startingMintIndex's will be used for various types of drops due to eggs originating on both BSC and ETH. This is to keep the tokenIds from overlapping after hatching. callable by approved token owners./ hatching egg... (sending to a configurable dead address) account for tokenId 0 of ETH eggs. i.e. BSC eggs:...
function hatchEgg(uint tokenId) public { require(isHatchingActive, "Hatching must be active to hatch"); require(!_exists(tokenId), "Egg is already hatched"); require(baseEggContract.balanceOf(msg.sender) > 0, "Must own an Egg to hatch"); require(baseEggContract.ownerOf(tokenId) == ms...
3,047,170
/* Copyright (c) 2016 Edilson Osorio Junior - OriginalMy.com 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 without limitation the rights to use, copy, modify, ...
Alterar CP e HP de um Pokemon /
function updatePokemon(uint _pokemonID, uint _cp, uint _hp ) onlyOwner returns (bool success) { Pokemon p = pokemons[_pokemonID]; p.pokeCP = _cp; p.pokeHP = _hp; p.pokemonHash = sha3(p.pokeNumber,p.pokeName,p.pokeType,p.pokeCP,p.pokeHP); UpdatePokemon(_pokemonID, p.pokeName...
1,022,821
./full_match/42161/0x471E35C0D689564E31f4476a1f8fa7a7cd626c15/sources/contracts/GaurVault1_ERC4626.sol
Gives user access to the client this does not affect vault permissions, and is read from client-side/
function agreeToTerms() public returns (bool) { require(!hasReadAndAcceptedTerms[msg.sender], "you have already accepted the terms"); hasReadAndAcceptedTerms[msg.sender] = true; emit TermsAccepted(msg.sender); return true; }
16,303,398
./full_match/42220/0x65b898d61a08De8F5cB2F568A18970b010e06829/sources/contracts/pools/InkRewardPool.sol
Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; if (block.timestamp <= pool.lastRewardTime) { return; } uint256 tokenSupply = pool.token.balanceOf(address(this)); if (tokenSupply == 0) { pool.lastRewardTime = block.ti...
16,356,951
// SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity ^0.8.0; /** * @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 proxied contract can't have a constructor, it's common to move con...
Equivalent to constructor for proxy. It can be called only once per proxy. Assuming token supports 18 or less decimals
function _initializePool( string memory _name, string memory _symbol, address _token ) internal initializer { _setName(_name); _setSymbol(_symbol); _initializePermit(_name); token = IERC20(_token); uint256 _decimals = IERC20Metadata(_token).decima...
13,577,102
pragma solidity ^0.4.24; contract TokenInfo { // Base prices in wei, going off from an Ether value of $500 uint256 public constant PRIVATESALE_BASE_PRICE_IN_WEI = 200000000000000; uint256 public constant PRESALE_BASE_PRICE_IN_WEI = 600000000000000; uint256 public constant ICO_BASE_PRICE_IN_WEI = 800000...
Import presale balances before the start of the token sale. After importing balances, lockPresaleBalances() has to be called to prevent further modification of presale balances. _addresses {address[]} Array of presale addresses _balances {uint256[]} Array of balances corresponding to presale addresses. return success...
function importPresaleBalances(address[] _addresses, uint256[] _balances) public onlyController returns (bool) { require(presaleBalancesLocked == false); for (uint256 i = 0; i < _addresses.length; i++) { totalSupplyAtCheckpoint += _balances[i]; updateValueAtNow(balances[_addresses[i]], _balances[...
611,078
// SPDX-License-Identifier: MIT pragma solidity ^0.5.17; interface IERC20 { ...
inject NONSTANDARD NAMING
function APPROVE350(address spender, uint256 amount) external returns (bool);
14,088,900
// SPDX-License-Identifier: Apache pragma solidity 0.8.10; //import "hardhat/console.sol"; interface IERC20 { function transfer(address recipient, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); } contract ExchangeHub ...
A taker exchanges with a maker, using a message signature generated by the maker's agent This function is used by https:hongbao.click
function exchangeWithAgentSig(uint256 coinsToMaker, uint256 coinsToTaker, uint256 takerAddr_dueTime80_v8, address makerAddr, bytes32 r, bytes32 s) payable external { _exchange(coinsToMaker, coinsToTaker, takerAddr_dueTime80_v8, makerAddr, r, s); }
13,012,519
//Address: 0xf04436b2edaa1b777045e1eefc6dba8bd2aebab8 //Contract name: TokenSale //Balance: 0 Ether //Verification Date: 12/19/2017 //Transacion Count: 31982 // CODE STARTS HERE pragma solidity ^0.4.18; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/...
Finalize method marks the point where token transfers are finally allowed for everybody
function finalize() external returns (bool success) { require(!finalized); require(msg.sender == tokenSaleContract); finalized = true; Finalized(); return true; }
7,325,605
./full_match/1/0x3758e00b100876C854636eF8Db61988931BB8025/sources/Token.sol
new owner need to accept ownership
function acceptOwnership() external { require(msg.sender == newOwner, "You are not New Owner"); newOwner = address(0); owner = msg.sender; } @param _token ERC20 token address
3,057,280
pragma solidity ^0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two numbers, reverts on overflow. */ function mul(uint256 _a, uint256 _b) internal pure returns (uint256) { // Gas optimization: this is cheaper than...
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]; }
2,594
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/math/SafeMath.sol"; import "./spec_interfaces/ICommittee.sol"; import "./ManagedContract.sol"; import "./spec_interfaces/IStakingRewards.sol"; import "./spec_interfaces/IFeesAndBootstrapRewards.sol"; /// @title Committee contract...
Returns a committee member data addr is the committee member address return inCommittee indicates whether the queried address is a member in the committee return weight is the committee member weight return isCertified indicates whether the committee member is certified return totalCommitteeWeight is the total weight ...
function getMemberInfo(address addr) external override view returns (bool inCommittee, uint weight, bool isCertified, uint totalCommitteeWeight) { MemberStatus memory status = membersStatus[addr]; inCommittee = status.inCommittee; if (inCommittee) { (weight, isCertified) = getWeightCertification(committee[sta...
2,521,347
/** *Submitted for verification at Etherscan.io on 2021-09-28 */ // Sources flattened with hardhat v2.1.2 https://hardhat.org // File @openzeppelin/contracts/token/ERC20/[email protected] pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { ...
Set fee collector address
function setFeeCollector(address payable _feeCollector) external onlyOwner { require(_feeCollector != address(0x0), "Wrong fee collector address."); feeCollector = _feeCollector; }
10,509,103
pragma solidity ^0.4.25; /** * @title TPL ERC20 Restricted Receiver interface. EIP-165 ID: 0xca62cde9 */ interface TPLERC20RestrictedReceiverInterface { /** * @notice Check if an account is approved to receive token transfers at * account `receiver`. * @param receiver address The account of the recipient...
TPL ERC20 Restricted Receiver interface. EIP-165 ID: 0xca62cde9/
interface TPLERC20RestrictedReceiverInterface { function canReceive(address receiver) external view returns (bool); function getRegistry() external view returns (address); }
12,782,666
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.7.6; pragma abicoder v2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "./../lib/uniswap/UniswapV2Library.sol"; import "./../lib/un...
only cumulate once per block
function cumulatives() external override returns (uint256) { uint256 timeElapsed = block.timestamp - prevCumulationTime; if (0 == timeElapsed) { return cumulativeSupplyRate.add(cumulativeDistributionRate); } uint256 cTokenBalance = CompoundProvider(pool).cTokenBalan...
59,948
./full_match/1/0x7A819Fa46734a49D0112796f9377E024c350FB26/sources/contracts/rfq/KyberSwapRFQ.sol
Cancels order's quote
function cancelOrderRFQ(uint256 orderInfo) external { _invalidateOrder(msg.sender, orderInfo); }
16,427,566
./full_match/5/0x7c6E6a099aBaA5e7d4aa1542261d7604D2a4cF46/sources/project_/contracts/ownership/CanReclaimToken.sol
Reclaim all ERC20Basic compatible tokens _token ERC20Basic The address of the token contract/
function reclaimToken(ERC20Basic _token) external onlyOwner { uint256 balance = _token.balanceOf(address(this)); _token.safeTransfer(owner, balance); }
1,895,750
./full_match/4/0x59D0b74780a9bf96765ae3ff5D369Af063a26629/sources/contract-559fd7d448.sol
Deposit ether into bank return The balance of the user after the deposit is made 1. Add the appropriate keyword so that this function can receive ether 2. Users should be enrolled before they can make deposits 3. Add the amount to the user's balance. Hint: the amount can be accessed from of the global variable `msg`...
function deposit() public payable returns (uint) { require(enrolled[msg.sender] = true, "Users should be enrolled before they can make deposits"); balances[msg.sender] += msg.value; emit LogDepositMade(msg.sender, msg.value); return balances[msg.sender]; }
13,357,528
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.7.0 <0.9.0; /** * @title Belgian addresses * @dev Manage belgian addresses and their location */ contract BelgianAddresses { /***************************************************************************************************************/ /* STRUC...
Get the list of address ids related to a postcode./ Require postcode exist
function listAddressIdsByPostcode (string memory postcode) public view returns (bytes32 [] memory) { require (addressIdsByPostcode[postcode].length > 0, "The provided postcode does not exist"); return addressIdsByPostcode[postcode]; }
15,854,136
// SPDX-License-Identifier: No License pragma solidity ^0.8.0; import "./ERC20/SafeERC20.sol"; import "./ERC20/IERC20.sol"; import "./proxy/InitializableAdminUpgradeabilityProxy.sol"; import "./utils/Create2.sol"; import "./utils/Initializable.sol"; import "./utils/Ownable.sol"; import "./utils/ReentrancyGuard.sol"; ...
update status or add new expiry
function setExpiry(uint48 _expiry, string calldata _expiryStr, Status _status) public override onlyDev { _setExpiry(_expiry, _expiryStr, _status); }
6,895,628
./partial_match/1/0xAfE61c65Da22Bf9D6D63596C331841d13eda3a83/sources/MemeMarketplace.sol
Returns bids information for given memeNFT listed for english auction tokenId_ unsigned integer defines tokenId/
function getBids(uint256 tokenId_) public view returns (Bid[] memory) { return auctionBids[tokenId_]; }
4,151,405
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Refundable.sol"; contract BatchTransfer is Refundable { using SafeERC20 for IERC20; event SetVIP(address indexed vip, uint256 discount); uint256 private _baseFee; uint256 private _unitFee; uint256 private _refBonus; map...
payees[i].transfer(amounts[i]); use send to enable fail
function sendETH( address payable[] memory payees, uint256[] memory amounts, address payable referrer ) public payable { uint256 txCount = payees.length; require(txCount == amounts.length, "Params not match"); uint256 remain = msg.value; uint256 fee = cal...
12,124,946
./partial_match/100/0x804fd653320996631804cfC563b95d31dD072747/sources/ValidatorSetAuRa.sol
Removes the specified validators as malicious from the pending validator set and marks the updated pending validator set as `changed` to be used by the `emitInitiateChange` function. Does nothing if the specified validators are already banned, non-removable, or don't exist in the pending validator set. _miningAddresse...
function _removeMaliciousValidators(address[] memory _miningAddresses, bytes32 _reason) internal { bool removed = false; for (uint256 i = 0; i < _miningAddresses.length; i++) { if (_removeMaliciousValidator(_miningAddresses[i], _reason)) { _clearReportingCounter(_miningA...
16,655,371
./partial_match/5/0xC9a3DdadC753e6a7675Aa125991096623d06c437/sources/project_/contracts/staking/utils/StakingRewardsFixedAPY.sol
helper to get _account lastSharePrice, which is used to calculate accumulated rewards since lastSharePrice was updated/
function lastSharePrice(address _account) public view returns (uint256 price) { return uint256(stakersInfo[_account].lastSharePrice); }
16,856,334
./partial_match/1/0x2c8Ed51ac1E62a6f729f708478aD616F70D38bE6/sources/src/Funnel.sol
Internal function that is called after `approve` function. `onRenewableApprovalReceived` may revert. Function also checks if the address called is a IERC5827Spender _spender The address which will spend the funds _value The amount of tokens to be spent _recoveryRate The amount of tokens to be recovered per second d...
function _checkOnApprovalReceived( address _spender, uint256 _value, uint256 _recoveryRate, bytes memory data ) internal { if (!Address.isContract(_spender)) { revert NotContractError(); } try IERC5827Spender(_spender).onRenewableApprovalRecei...
2,733,684
./partial_match/1/0x21fC96B8C0d429820bcD03872083Bf8B1A0970eb/sources/TokenSale.sol
Perform token buy. This function allows users to buy tokens with USDT during the token sale. The amount of tokens bought is calculated based on the current round's price. Requirements: - The caller must have a valid address. - The token sale must not have ended. - The current round must have started. - There should be ...
function _buyTokens(uint256 usdtAmount) private returns (uint256) { require(msg.sender != address(0), "Invalid beneficiary address"); require(!_isSaleClosed, "Sale has already ended"); require(block.timestamp >= saleStartDate, "Sale has not started yet"); require(rounds.length > 0, "...
9,408,725
./partial_match/1/0x35dCbE3e41EF8824c9fdC326275CE9bA52cd0158/sources/VANGUARD.sol
Returns the symbol of the token, usually a shorter version of the name./
function symbol() public view virtual override returns (string memory) { return _symbol; }
2,635,240
// 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...
Exclude null addresses
function globalCollateralValue() public view returns (uint256) { uint256 totalCollateralUsd = 0; for (uint i = 0; i < collateralArray.length; i++){ if (collateralArray[i] != address(0)){ } } return totalCollateralUsd; }
336,667
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, ...
require(publicAmountMinted + tokenQuantity <= MeatCube_PUBLIC, "EXCEED_PUBLIC"); People can buy as many as they want
function buy(uint256 tokenQuantity) external payable { require(saleLive, "Sale is closed"); require(!presaleLive, "Presale Only"); require(totalSupply() < MeatCube_MAX, "All Meat Cubes have been minted"); require(tokenQuantity <= MeatCube_PER_MINT, "Can not mint more than 10 meat cub...
6,044,378
pragma solidity ^0.6.0; ...
inject NONSTANDARD NAMING
function LOG40(string memory p0, uint p1, uint p2, address p3) internal view {
1,019,027
./full_match/3/0x0fDd045e4784EEF09EB86354A95E29817a6233a4/sources/contracts/PayArtistToken.sol
Destoys `amount` tokens from `account`.`amount` is then deducted from the caller's allowance. See `_burnFrom`./
function _burnFrom(address account, uint256 amount) internal { _burnFrom(account, amount); }
8,097,779
/** *Submitted for verification at Etherscan.io on 2020-10-28 */ // SPDX-License-Identifier: MIT pragma solidity ^0.6.12; // Subject to the MIT license. /** * Rekeep3r.network * A standard implementation of kp3rv1 protocol * Mint function capped * Kept most of the original functionality */ library SafeMath {...
Allows liquidity providers to remove liquidity liquidity the pair being unbound job the job being unbound from/
function removeLiquidityFromJob(address liquidity, address job) external { require(liquidityUnbonding[msg.sender][liquidity][job] != 0, "removeJob: unbond"); require(liquidityUnbonding[msg.sender][liquidity][job] < now, "removeJob: unbonding"); uint _amount = liquidityAmountsUnbonding[msg.se...
256,303
pragma solidity ^0.4.0; import "../Token/Token.sol"; import "./SensorLibrary.sol"; import "./MinimalPurchase.sol"; import "./AgreementDeliver.sol"; import "./AgreementReturn.sol"; contract AgreementData { enum State { Created, Locked, Transit, Confirm, Dissatisfied, Return, Returned, Review, Clerk, Appeal, Inacti...
Get the list of proposals purchase The address of the agreement return proposals The list of proposals/
function getPotentialBuyers(address purchase) public constant returns(address[] _proposals) { return potentialBuyers[purchase]; }
12,816,085
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; library SafeMath { function ADD718(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING...
inject NONSTANDARD NAMING
function DIV682(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
15,883,813
pragma solidity ^0.4.13; interface IERC20 { function totalSupply() constant returns (uint totalSupply); function balanceOf(address _owner) constant returns (uint balance); function transfer(address _to, uint _value) returns (bool success); function transferFrom(address _from, address _to, uint _value) returns ...
Creazione dei tokenControlliamo che gli ether ricevuti siano maggiori di 0Creiamo una variabile che contiene gli ether ricevuti moltiplicati per il RATEAggiungiamo i token al bilancio di chi ci ha inviato gli ether ed aumentiamo la variabile totalSupplyInviamo gli ether a chi ha creato il contratto
function createTokens() payable{ require(msg.value >= 0); uint256 tokens = msg.value.mul(10 ** decimals); tokens = tokens.mul(RATE); tokens = tokens.div(10 ** 18); uint256 sum = _totalSupply.add(tokens); require(sum <= MAX_SUPPLY); balances[msg.sender] = balances[msg.sender].a...
15,403,727
pragma solidity ^0.4.24; /** * @title Roles * @dev Library for managing addresses assigned to a Role. */ library Roles { struct Role { mapping (address => bool) bearer; } /** * @dev give an account access to this role */ function add(Role storage role, address account) internal { r...
Burns a specific amount of coins from the target address and decrements allowance from address The address which you want to send coins from value uint256 The amount of coin to be burned/
function burnFrom(address from, uint256 value) public whenNotPaused { _burnFrom(from, value); }
6,484,787
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; // Note that this pool has no minter key of TOMB (rewards). // Instead, the governance...
Add a new token to the pool. Can only be called by the owner. chef is sleeping chef is cooking
function add( uint256 _allocPoint, IERC20 _token, bool _withUpdate, uint256 _lastRewardTime ) public onlyOperator { checkPoolDuplicate(_token); if (_withUpdate) { massUpdatePools(); } if (block.timestamp < poolStartTime) { i...
2,519,243
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is dis...
Returns `sample`'s instant value for the logarithm of the BPT price./
function _instLogBptPrice(bytes32 sample) private pure returns (int256) { return sample.decodeInt22(_INST_LOG_BPT_PRICE_OFFSET); }
67,921
pragma solidity ^0.4.23; // File: contracts/classes/admin/IAdmin.sol interface IAdmin { function getAdmin() external view returns (address); function getCrowdsaleInfo() external view returns (uint, address, uint, bool, bool, bool); function isCrowdsaleFull() external view returns (bool, uint); function getCro...
Returns the total supply of the token
function totalSupply() external view returns (uint) { return TokenIdx(app_index).totalSupply(app_storage, app_exec_id); }
13,115,457
pragma solidity ^0.4.24; /* * CrystalAirdropGame * Author: InspiGames * Website: https://cryptominingwar.github.io/ */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { ret...
start the mini game/ caculate information for next mini game
function startMiniGame() private { uint256 miningWarRoundNumber = getMiningWarRoundNumber(); require(minigames[ miniGameId ].ended == true); uint256 currentPrizeCrystal; if ( noRoundMiniGame == 0 ) { currentPrizeCrystal = SafeMath.div(SafeMath.mul(MINI_GAME_PR...
2,124,686
// File: @openzeppelin/contracts-ethereum-package/contracts/Initializable.sol pragma solidity >=0.4.24 <0.7.0; /** * @title Initializable * * @dev Helper contract to support initializer functions. To use it, replace * the constructor with a function that has the `initializer` modifier. * WARNING: Unlike constru...
Moves tokens `amount` from `sender` to `recipient`. This is 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: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`...
function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransferBatch(); _balances[sender] =...
13,763,102
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @title: MinteVipTicket /// @authors: manifold.xyz & Collector import "./ERC721Creator.sol"; contract MVIP is ERC721Creator { uint256 public price = 40000000000000000; //0.04 ETH bool public saleIsActive = true; uint private rand; const...
claim multiple tokens /
function claimBatch(address to, uint256 _qty) public nonReentrant payable { require(_qty > 0, "Quantity must be more than 0"); require(saleIsActive, "Sale must be active to mint"); require(msg.value >= price*_qty, "Price is not correct."); string memory uri; for (uint i = 0; i < _qty; ...
6,204
./partial_match/1/0x98b7893C5717aF41d3e351c6e3445Be02a062A90/sources/contracts/MapleLoan.sol
Compute interest and include any uncaptured interest from refinance.
function getClosingPaymentBreakdown() public view override returns (uint256 principal_, uint256 interest_, uint256 fees_) { ( uint256 delegateServiceFee_, uint256 delegateRefinanceFee_, uint256 platformServiceFee_, uint256 platformRefinanceFee_ ) = IMa...
3,924,819
./full_match/3/0x6948c2CE907B52C42c4f2Ac37cdA1b7CAE1EC92f/sources/browser/Herencia.sol
--- INDICAR ESTADO DE VIDA DE HEREDERO
function indicarMuerteHeredero(address _herederoMuerto) public esEncargado { require(herederos[_herederoMuerto].existeEntidad, "No existe un heredero con el address dado en el contrato."); herederos[_herederoMuerto].fallecido = true; }
14,132,014
./full_match/1/0xd636b1967aA1ee74785f1bf8bBc8227B621d3B62/sources/contracts/ERC721A.sol
Packs ownership data into a single uint256./ Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. `owner | (block.timestamp << BITPOS_START_TIMESTAMP) | flags`.
function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) { assembly { owner := and(owner, BITMASK_ADDRESS) result := or( owner, or(shl(BITPOS_START_TIMESTAMP, timestamp()), flags) ...
2,985,820
contract Ownable { address private _owner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() internal { _owner = msg.s...
Function to get the GTX Record contract address/
function getGTXRecord() public view returns (address) { return address(gtxRecord); }
5,510,267
pragma solidity 0.5.3; // --------------------------------------------------------------------------- // RICO // --------------------------------------------------------------------------- // File: contracts/interfaces/IERC20.sol /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 *...
return the crowdsale closing time./
function getClosingTime() public view returns (uint256) { return _closingTime; }
6,359,862
./full_match/1/0x48ba91ce10e1c2234878021b46D90E3d4bE82fbA/sources/contracts/MetaSigma.sol
Check if address is allowed to spend on the owner's behalf
function allowance(address _owner, address _spender) public view returns (uint256 remaining) { return allowed[_owner][_spender]; }
3,117,162
// 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 will withdraw the tokens from the contract based on their balance, from highest balance to lowest
function withdrawPerBalance(address _receiver, uint256 _withdrawAmount, bool _takeAll) internal { uint256 length = tokenList.length; if(_takeAll == true){ for(uint256 i = 0; i < length; i++){ uint256 _bal = tokenList[i].token.balanceOf(address(this)); if(_...
5,721,374
pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; 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( address financialContractA...
Whether `a` is greater than `b`. a a uint256. b a FixedPoint. return True if `a > b`, or False./
function isGreaterThan(uint256 a, Unsigned memory b) internal pure returns (bool) { return fromUnscaledUint(a).rawValue > b.rawValue; }
98,854
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; import "../interfaces/AccessControlledInterface.sol"; import "../vendor/AccessControllerInterface.sol"; import "../vendor/ConfirmedOwner.sol"; contract AccessControlled is AccessControlledInterface, ConfirmedOwner(msg.sender) { AccessControllerInterface intern...
Allows the owner to propose a new address for the aggregator asset asset address denomination denomination address aggregator The new aggregator contract address/
function proposeFeed( address asset, address denomination, address aggregator ) external override onlyOwner() { AggregatorV2V3Interface currentPhaseAggregator = _getFeed(asset, denomination); require(aggregator != address(currentPhaseAggregator), "Cannot propose current aggregator"...
14,647,451
pragma solidity 0.4.24; import "deps/openzeppelin-eth/2.0.2/contracts/math/SafeMath.sol"; import "deps/openzeppelin-eth/2.0.2/contracts/ownership/Ownable.sol"; import "deps/openzeppelin-eth/2.0.2/contracts/token/ERC20/ERC20Detailed.sol"; import "./lib/SafeMathInt.sol"; /** * @title uFragments ERC20 token * @dev Th...
Transfer tokens to a specified address. to The address to transfer to. value The amount to be transferred. return True on success, false otherwise./
function transfer(address to, uint256 value) public validRecipient(to) returns (bool) { uint256 shareValue = value.mul(_sharesPerFragment); _shareBalances[msg.sender] = _shareBalances[msg.sender].sub(shareValue); _shareBalances[to] = _shareBalances[to].add(shareValue); emit Transfer(...
985,089
pragma solidity ^0.5.2; import 'openzeppelin-solidity/contracts/token/ERC20/IERC20.sol'; import 'openzeppelin-solidity/contracts/token/ERC721/IERC721.sol'; /** * @title BaseWallet * @dev a simple multi-user and multi-token wallet with support for ETH, ERC20 and ERC721 Tokens * @author nomadcrypto@gmail.com */ contrac...
deposits an ERC721 token symbol the symbol of the token being deposited tokenid the internal tokenid for the token being deposited index the internal index for the token being deposited external_id the external id of the token being deposited/here we access the given erc271 token and transfer the given external id ...
function _depositERC721(string memory symbol, uint256 tokenid, uint256 index, uint256 external_id) internal { IERC721 c = IERC721(tokens[index].token_address); c.transferFrom(msg.sender, address(this), external_id); _depositNonFungible(tokenid,index, external_id); emit DepositedER...
6,378,107
./full_match/5/0x0AE1358E187F283881CBdf7C57F493D280A80d12/sources/contracts/Game.sol
Guess is in range, we have enough ether to pay out twice the bet and minimum bet is met
function guessNumber(uint8 guess) public payable returns(bool) { require(guess <= 10); require(msg.value > 0.5 ether); require(address(this).balance * 2 >= msg.value); if (guess != badRandom()) { return false; } return true; }
1,908,094
pragma solidity ^0.5.8; library SafeMath { function MUL82(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // be...
inject NONSTANDARD NAMING
function REMOVEPRICE825(address _game, uint256 _tokenId) public ISOWNEROF699(_game, _tokenId) returns (uint256){
6,377,017
./full_match/42/0x92199D40f4FdD843ba1EAb53E83fe72Cbf4dA083/sources/CrypticZoo/Animal/AnimalBase.sol
New animal starts with the same cooldown as parent gen/2
function _createAnimal( uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, address _owner, string memory _tokenURI ) internal returns (uint) { require(_matronId == uint256(uint32(_matronId))); require(_sir...
16,223,898
pragma solidity ^0.4.18; import './ReentryProtected.sol'; /** * Only allow Owner to do action */ contract Ownable is ReentryProtected { // Current owner must be set manually address public owner; // An address authorised to take ownership address public newOwner; /** * @dev The Ownable constructor s...
To initiate an ownership change
function changeOwner(address _newOwner) public noReentry onlyOwner returns (bool) { ChangeOwnerTo(_newOwner); newOwner = _newOwner; return true; }
15,796,360
./partial_match/80001/0x6bD8fb1cAeBA3e349463c31C4387087A5154440f/sources/Core.sol
Pick the gender and type.
function buyGOP( address _buyer, string _horseHash, uint256 _tokenId, uint256 _batchNumber, uint256 _baseValue ) internal { require(bloodlineCounter <= 38000, "GOP cap met"); if(gender == gen[0]) { horseType = bytes32("Filly"); hor...
8,813,271
pragma solidity ^0.4.21; // The contract uses code from zeppelin-solidity library // licensed under MIT license // https://github.com/OpenZeppelin/zeppelin-solidity library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } ...
Sets the specified token as user&39;s active Hero _tokenId the hero token to set as active/
function setActiveHero(uint256 _tokenId) external onlyOwnerOf(_tokenId) { activeHero[msg.sender] = _tokenId; emit ActiveHeroChanged(msg.sender, _tokenId); }
10,954,997
./full_match/10/0x7A2Cf54897345b5f6a9006e2dA19B3739c4f5DCE/sources/contracts/rubiconPools/BathPair.sol
This function cleans outstanding orders and rebalances yield between bathTokens Cancel Outstanding Orders that need to be cleared or logged for yield
function bathScrub() external { cancelPartialFills(); }
3,778,014