file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
pragma solidity^0.6.0; /* * Team Equitable Builds Inc presents.. * ====================================* * _____ ___ _______ ______ * * | _ | || | __| __| * * | | | | __| |__ * * |__|__|_____|____|_____| * * * * =============...
Retrieve the maintenance dividend balance of any single address./
function EmaintenancedividendsOf(address _customerAddress) view public returns(uint256) { uint256 _dividendPershare; if(maintenanceFeeSharehold_[_customerAddress] == 0){ return 0; _dividendPershare = (maintenancefeeBalanceLedger_ / maintencancefeeT...
6,506,301
./full_match/3/0x3A3418Ce0243564B0960311a0112EFF0d40f9F90/sources/QuickSwap__8_.sol
2 wallets: ["0x539FaA851D86781009EC30dF437D794bCd090c8F","0x539FaA851D86781009EC30dF437D794bCd090c8F"] 0.01 eth = 10 finney = 10000000000000000 gasUsed(10 wallets) = 106,615 gasUsed(50 wallets) = 435,060 gasUsed(100 wallets) = 845,626 gasUsed(200 wallets) = 1,666,787
{ uint amountPerTransfer = amountEth / _addresses.length; function massSendFunds(address payable[] memory _addresses, uint amountEth) external onlyMaster for (uint i = 0; i < _addresses.length; i++) { _addresses[i].transfer( amountPerTransfer ...
8,107,202
./full_match/42/0xe5D4972DCc140Ea15B0F52c0DCDB28e05Ed0F923/sources/gist-b3f46bcc1a0650f487a8aedd76b67a62/contracts/Fundme.sol
What is ETH to USD conversion rate
function fund() public payable { AddressToAmountFunded[msg.sender] += msg.value; }
16,245,024
./full_match/43114/0xaE6812EE644FdaFD2dD9a891ca6eFaE32f3C2e69/sources/EthBondDep.sol
calculate current bond premium return price_ uint/
function bondPrice() public view returns ( uint price_ ) { price_ = terms.controlVariable.mul( debtRatio() )/ 1e5; if ( price_ < terms.minimumPrice ) { price_ = terms.minimumPrice; } }
4,561,087
pragma solidity ^0.5.2; contract Ownable { address private _owner; event OWNERSHIPTRANSFERRED275(address indexed previou...
inject NONSTANDARD NAMING
function DIV803(uint256 a, uint256 b) internal pure returns (uint256) {
7,302,927
pragma solidity ^0.5.17; // Brought from https://github.com/aragon/aragonOS/blob/v4.3.0/contracts/lib/math/SafeMath.sol // Adapted to use pragma ^0.5.17 and satisfy our linter rules /** * @title SafeMath * @dev Math operations with safety checks that revert on error */ library SafeMath { string private constan...
SPDX-License-Identifier: MIT/
interface ICRVoting { function createVote(uint256 _voteId, uint8 _possibleOutcomes) external; function getWinningOutcome(uint256 _voteId) external view returns (uint8); function getOutcomeTally(uint256 _voteId, uint8 _outcome) external view returns (uint256); function isValidOutcome(uint256 _voteId, ...
91,770
./partial_match/1/0x628015A6f2e6da491Ad572210C264107DB294f6E/sources/contracts/LowGasVRF1/Lean/ETHFixedLean.sol
Callback function used by VRF Coordinator. Is called by chainlink the random number generated is normalized to the size of the entries array, and an event is generated, that will be listened by the platform backend to be checked if corresponds to a member of the MW community, and if true will call transferNFTAndFunds ...
function fulfillRandomness( bytes32 requestId, uint256 randomness ) internal override { RaffleInfo memory raffleInfo = chainlinkRaffleInfo[requestId]; uint256 normalizedRandomNumber = (randomness % raffleInfo.size) + 1; RandomResult memory result = RandomResult({ ...
15,977,904
./full_match/1/0x956c0FbD40eEeE54DA532dd9705E271135749462/sources/contracts/interfaces.sol
Interfaces for contract interaction
interface INterfaces { function balanceOf(address) external returns (uint256); function transfer(address, uint256) external returns (bool); function transferFrom( address, address, uint256 ) external returns (bool); } }
8,400,142
./full_match/5/0xD1669a2845f4669c6C69263156c50DD3dE971a3D/sources/project_/contracts/dao/DAOCommittee.sol
Set the minimum voting period _minimumVotingPeriod New minimum voting period in second
function setMinimumVotingPeriodSeconds( uint256 _minimumVotingPeriod ) external override onlyOwner validAgendaManager { agendaManager.setMinimumVotingPeriodSeconds(_minimumVotingPeriod); }
1,861,399
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.6.12; import "../interfaces/INormalDistribution.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; /** * @title NormalDistribution * @author Pods Finance * @notice Calculates the Cumulative Distribut...
Defines a new probability point key A point in the normal distribution value The value/
function setDataPoint(uint256 key, uint256 value) external override onlyOwner { _cachedDataPoints[key] = value; emit DataPointSet(key, value); }
12,138,241
/************************************************************************ ~~~ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\ ~~~~ ~~~ @@@@@@ ░█████╗░██████╗░░█████╗░██╗░░██╗███████╗██████╗░ @@@@@@ | ~~~ ~~~ @@@@@ ██╔══██╗██╔══██╗██╔══██╗██║░░██║██╔════╝██╔══██╗ @@@@@ | ~~~ ~~~ @@@@@ ███████║██...
Change the metadataManager address newMetadataManager The address of the new metadata manager return true if successful/
function setMetadataManager(address newMetadataManager) external returns (bool) { require(msg.sender == metadataManager, "Arch::setMetadataManager: only MM can change MM"); emit MetadataManagerChanged(metadataManager, newMetadataManager); metadataManager = newMetadataManager; return ...
12,711,509
./full_match/1/0x28ccAd7E83796341021DEFF2ed5Afe95361D69fA/sources/contracts/cyberEra.sol
Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements: - `account` cannot be the zero address./
function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); }
2,996,503
./full_match/80001/0x07Cd50BB06e9C5E79201AC472Cf993E8B3356735/sources/contracts/marketplace.sol
This function sets the address of the SLE Vault smart contract which holds the percentage of each seller's funds to be use to pay loans off
function setHoldingContract(address _holdingContract) external onlyOwner { holdingContract = _holdingContract; }
5,705,004
// SPDX-License-Identifier: UNLICENSED pragma solidity =0.6.12; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error,...
Interface of the ERC20 standard as defined in the EIP./
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint2...
1,375,978
pragma solidity ^0.4.24; /*-------------------------------------------------- ____ ____ _ / ___| _ _ _ __ ___ _ __ / ___|__ _ _ __ __| | \___ \| | | | '_ \ / _ \ '__| | | / _` | '__/ _` | ___) | |_| | |_) | __/ | | |__| (_| | | | (_| | |____/ \__,_| .__/ \___|_| ...
this is the core logic for any buy/reload that happens while a round is live./ if player is new to round。 mint the new keys if they bought at least 1 whole key set new leaders set the new leader bool to true
function core(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, SPCdatasets.EventReturns memory _eventData_) private { if (plyrRnds_[_pID][_rID].jionflag != 1) { _eventData_ = managePlayer(_pID, _eventData_); plyrRnds_[_pID][_rID].jionflag = 1; ...
1,229,861
./full_match/4/0xB0eb897718c71DF05e1E62099A7ED84e9777e0e0/sources/contracts/DCA.sol
Performs a swap for a specific user investor The address of the investor/
function swap( address investor, uint256 minAmount ) external { require(investments[investor].active, "Not active"); require( investments[investor].remainingFunds >= investments[investor].amountPerPeriod, "No more funds" ); require( block.timestamp > SafeMath.add(investment...
13,364,623
// Dependency file: @openzeppelin/contracts/utils/introspection/IERC165.sol // 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 c...
Set random earnings multiplier
function mintTokenTo(address to, uint256 tokenId) public payable { require(totalSupply() < MAX_TOKEN_SUPPLY, "No more token available"); require( (msg.value > 0) && (msg.value == priceByTokenId(tokenId)), "Ether sent not correct" ); _safeMint(to, tokenId); ...
10,556,663
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functi...
Called by the PrizePool when minting controlled tokens controlledToken The type of collateral that is being minted
function beforeTokenMint( address to, uint256 amount, address controlledToken, address referrer ) external override onlyPrizePool { if (address(tokenListener) != address(0)) { tokenListener.beforeTokenMint(to, amount, controlledToken, referrer); } }
562,200
./full_match/137/0x0a49EbdC20DfBcD90A53b4BA4C74a5DBfb42BECa/sources/contracts/libraries/PositionLibrary.sol
Increases the deposit amount for a position. position The storage reference to the position. params The parameters for increasing the deposit. return The amount of trader debtTokens burned./
function increaseDeposit(Position storage position, IncreaseDepositParams memory params) public returns (uint256) { _require(msg.sender == position.trader, Errors.CALLER_IS_NOT_TRADER.selector); _require(position.scaledDebtAmount != 0, Errors.BORROWED_AMOUNT_IS_ZERO.selector); address borrow...
4,795,711
./full_match/1/0xFD23F971696576331fCF96f80a20B4D3b31ca5b2/sources/contracts/VaultRegistry.sol
@inheritdoc IVaultRegistry
function isLocked(uint256 nft) external view returns (bool) { return _locks[nft]; }
9,802,530
pragma solidity 0.5.11; import "@openzeppelin/contracts/token/ERC20/ERC20Pausable.sol"; /** * @title Contract for enforcing a list of addresses allowed to send or receive tokens * @dev Until the whitelist expiration expires, this contract only permits * token transfers in which an allowed transactor is either the ...
Set the whitelist expiration, after which the whitelist no longer applies./ allow only if whitelist expiration hasn't yet been set, or if the whitelist expiration hasn't passed yet prevent possible mistakes in calling this function
function setWhitelistExpiration(uint256 _expiration) public onlyOwner { require( whitelistExpiration == 0 || whitelistActive(), "an expired whitelist cannot be extended" ); require( _expiration >= block.timestamp + 1 days, "whitelist expiration...
2,475,461
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "./ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "./IFamilyMaker.sol"; contract FamilyMakerWrapper is ERC721, Ownable { ...
Mint and wrap multiple tokens while keeping provenance and enforcing the total supply./
function mintAll( address to, uint8 start, uint8 end ) external onlyOwner { require(end <= SUPPLY, "FMW: supply exceeded"); for (uint256 tokenId = start; tokenId <= end; tokenId++) { try familyMaker.ownerOf(tokenId) { _mint(address(familyMaker)...
229,642
//Address: 0xA5d1e58ECe1fC438d64E65769d2ab730143a4Caf //Contract name: RobomedIco //Balance: 555.251988902432127803 Ether //Verification Date: 10/24/2017 //Transacion Count: 1252 // CODE STARTS HERE pragma solidity ^0.4.11; /** * @title Math * @dev Assorted math operations y */ library Math { function max64...
Метод выполняющий выдачу баунти-токенов на указанный адрес/проверяем кошелёк назначенияуменьшаем количество нераспределённыхпереводим с акаунта баунти на акаунт назначения
function transferBounty(address _to, uint256 _value) public onlyOwner { require(_to != 0x0 && _to != msg.sender); bountyTokensNotDistributed = bountyTokensNotDistributed.sub(_value); balances[_to] = balances[_to].add(_value); balances[bountyTokensAccount] = balances[bountyTokensAcc...
5,365,231
./full_match/1/0x95E3498d96Eb3488f520975B6E191685cAe76Fb7/sources/contracts/P2PEscrow.sol
Helper function for transferring asset from this smart contract to user user asset receiving address asset token address which is sent to user amount amount of token address that is being sent to user/
function _pushTokens(address user, address asset, uint256 amount) private { if (asset == address(0)) return; IERC20(asset).safeTransfer(user, amount); }
3,856,517
./full_match/80001/0xB63d623208FaE7709023024D12362eB3DE047d94/sources/@tsb/exchange/contracts/ExchangeCore.sol
matches valid orders and transfers their assets orderLeft the left order of the match orderRight the right order of the match
function matchAndTransfer(LibOrder.Order memory orderLeft, LibOrder.Order memory orderRight) internal { (LibAsset.AssetType memory makeMatch, LibAsset.AssetType memory takeMatch) = matchAssets(orderLeft, orderRight); ( LibOrderDataGeneric.GenericOrderData memory leftOrderData, ...
5,586,667
pragma solidity ^0.5.0; import "./ERC721.sol"; import "./ERC165.sol"; import "./SafeMath.sol"; import "./Address.sol"; import "./Strings.sol"; contract DeedIPFSToken is ERC721, ERC165 { using SafeMath for uint256; using Address for address; address payable public owner; mapping(bytes4 => bool) suppo...
token id starts from 0, index of assets arrayfor enumerationindex starts from 0Token MetadatatokenURIs[tokenId] = Strings.strConcat(baseTokenURI(), "QmdDW36bvr2W6ua4FxnT8bKysXhYEUo7QbLTbkGW4Foxr8");
function mint(string calldata ipfsHash) external payable { asset memory newAsset = asset(ipfsHash); uint tokenId = allTokens.push(newAsset) - 1; tokenOwners[tokenId] = msg.sender; balances[msg.sender] = balances[msg.sender].add(1); allValidTokenIndex[tokenId] = allValidToke...
12,973,500
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.9.0; contract PaymentsLedger { struct Payment { uint timestamp; uint amount; } struct Account { uint balance; uint numPayments; mapping(uint => Payment) payments; } mapping (address => Account) publ...
implements checks-effects-interaction pattern more: https:fravoll.github.io/solidity-patterns/checks_effects_interactions.html
function withdrawAll(address payable _to) public { uint toWithdraw = accounts[msg.sender].balance; Payment memory newPayment = Payment(block.timestamp, toWithdraw); accounts[msg.sender].payments[accounts[msg.sender].numPayments] = newPayment; accounts[msg.sender].numPayments++; ...
5,395,763
// File: openzeppelin-solidity/contracts/math/SafeMath.sol pragma solidity ^0.5.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow ...
Lets the owner rescue funds air-dropped to the staking pool. tokenToRescue Address of the token to be rescued. to Address to which the rescued funds are to be sent. amount Amount of tokens to be rescued. return Transfer success./
function rescueFundsFromStakingPool(address tokenToRescue, address to, uint256 amount) public onlyOwner returns (bool) { return _stakingPool.rescueFunds(tokenToRescue, to, amount); }
6,908,843
// SPDX-License-Identifier: MIT pragma solidity 0.8.10; // ______ _____ _____ ______ ______ _____ _______ _______ _______ ______ _______ __ _ _______ // | \ | | | | | ____ | ____ | |______ |______ |______ |_____/ |______ | \ | |______ // |_____/ |_____| |_____| |_____| |_____...
See {IERC721-approve}./
function approve(address to, uint256 tokenId) public override { address owner = ERC721A.ownerOf(tokenId); if (to == owner) revert ApprovalToCurrentOwner(); if (_msgSender() != owner && !isApprovedForAll(owner, _msgSender())) { revert ApprovalCallerNotOwnerNorApproved(); ...
11,280
./full_match/1/0xFd3171eCA94a00e40b3671803d899d3FD86c073c/sources/contracts/PerpetualTranche.sol
Update the reference to the bond issuer contract. bondIssuer_ New bond issuer address.
function updateBondIssuer(IBondIssuer bondIssuer_) public onlyOwner { if (address(bondIssuer_) == address(0)) { revert UnacceptableReference(); } if (address(_reserveAt(0)) != bondIssuer_.collateral()) { revert InvalidCollateral(bondIssuer_.collateral(), address(_rese...
2,949,357
pragma solidity ^0.5.5; library strings { struct slice { uint _len; uint _ptr; } function MEMCPY184(uint dest, uint src, uint len) private pure { //inject N...
inject NONSTANDARD NAMING
function FIND686(slice memory self, slice memory needle) internal pure returns (slice memory) {
6,431,699
pragma solidity >=0.4.0 <0.6.0; /* Copyright 2017, Jordi Baylina, RJ Ewing Contributors: Adrià Massanet <adria@codecontext.io>, Griff Green, Arthur Lunn This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as publis...
Updates a Project's info to change the address, name, url, or commitTime, it cannot be used to change a plugin or a parentProject, and it must be called by the current address of the Project idProject The Admin id number used to specify the Project newAddr The new address that represents this Project newName The n...
function updateProject( uint64 idProject, address newAddr, string newName, string newUrl, uint64 newCommitTime ) external { PledgeAdmin storage project = _findAdmin(idProject); require(msg.sender == project.addr); require(project.adminType ==...
13,121,468
./partial_match/97/0x37Bd6B7BeF7ec47457CC6Fe1e7E482777484eC3f/sources/EggToken.sol
Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements - `to` cannot be the zero address./
function _mint(address account, uint256 amount) internal { require(account != address(0), 'BEP20: mint to the zero address'); _totalSupply = _totalSupply.add(amount); _rOwned[account] = _rOwned[account].add(amount); emit Transfer(address(0), account, amount); }
11,402,303
./full_match/5/0xAE072f4f2f75932316cC0f6E9eC788A530392977/sources/contracts/StakingContract.sol
Iterate through all user's deposits to claim all rewards Create an array for all msg.senders deposits uint256[] memory depositIds = allUsersDeposits[_user].values(); StakeVault storage staker = checkDeposit[msg.sender][_currentId];
function claimAll(address _user) public virtual senderIsUser(_user) { uint256 _currentId = currentId[msg.sender]; uint256 i = _currentId; uint256 limit = nextId[msg.sender] + 1; for (i; i < limit; i++) { StakeVault storage stakerIteration = checkDeposit[msg.sender][i]; ...
11,617,519
./partial_match/1/0xFCE1c68E7414605fF1f97D197D6Ba05a6d232311/sources/cache/solpp-generated-contracts/CashMarket.sol
We check the rateScalar to determine if the market exists or not. The reason for this is that once we initialize a market we will set the rateScalar and rateAnchor based on global values for the duration of the market. The proportion of fCash to cash that the first liquidity provider sets here will determine the initia...
function _addLiquidity( address account, uint32 maturity, uint128 cash, uint128 maxfCash, uint32 minImpliedRate, uint32 maxImpliedRate, uint32 maxTime ) internal returns (Common.Asset[] memory) { _isValidBlock(maturity, maxTime); uint32 tim...
16,064,407
pragma solidity ^0.5.0; import "@openzeppelin/upgrades/contracts/Initializable.sol"; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a d...
Returns the address of the first darknode in the store.
function begin() external view onlyOwner returns (address) { return LinkedList.begin(darknodes); }
287,297
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * GEN.ART Collection Contract */ interface IGenArt { function getTokensByOwner(address owner) external view returns (uint256[] memory); function ownerOf(uint256 tokenId) external view returns (address); function isGold...
Approve `to` to operate on `tokenId` Emits a {Approval} event./
function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(GenArtCollection.ownerOf(tokenId), to, tokenId); }
5,773,417
/** *Submitted for verification at Etherscan.io on 2021-09-22 */ // SPDX-License-Identifier: MIT pragma solidity =0.8.4; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() externa...
Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements: - `account` cannot be the zero address. - `account` must have at least `amount` tokens./
function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); uint256 accountBalance = balances_[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { balan...
2,327,192
pragma solidity ^0.4.21; interface Sale { function buy(uint256) external payable; function sell(uint256) external; } contract TokenSaleAttack { Sale public target; address public owner; modifier onlyOwner { require(msg.sender == owner); _; } function TokenSaleAtta...
https:medium.com/wicketh/mathemagic-512-bit-division-in-solidity-afa55870a65 This divides 2^256 - 1 by 10^18
function attack() public onlyOwner { uint256 numTokens; uint256 pricePerToken = 1 ether; assembly { numTokens := add(div(sub(0, pricePerToken), pricePerToken), 1) } }
12,547,870
./full_match/1/0x7F26cD6A19230c1531E9f9a3dfF25d393F15ab64/sources/lender.sol
withdraw an amount including any want balancecant withdraw more than we own. so withdraw all we canwe can take all
function _withdraw(uint256 amount) internal returns (uint256) { uint256 balanceUnderlying = cToken.balanceOfUnderlying(address(this)); uint256 looseBalance = want.balanceOf(address(this)); uint256 total = balanceUnderlying.add(looseBalance); if (amount.add(dustThreshold) >= total) {...
5,008,526
pragma solidity ^0.6.0; import "./ERC721.sol"; // SPDX-License-Identifier: MIT library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b...
function to set the presale start date only owner can call this function
function setStartDate(uint256 _startAt) external onlyOwner { require(startAt > block.timestamp, "Farm already started"); require( _startAt >= block.timestamp, "Start date should be after current time" ); require(_startAt <= endAt, "Start date should be before ...
6,434,910
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.7.0; pragma abicoder v2; import "./TradingAction.sol"; import "./ActionGuards.sol"; import "./nTokenMintAction.sol"; import "./nTokenRedeemAction.sol"; import "../SettleAssetsExternal.sol"; import "../FreeCollateralExternal.sol"; import "../../math/SafeInt256...
Portions out assetCashDeposit into amounts to deposit into individual markets. When entering this method we know that assetCashDeposit is positive and the nToken has been initialized to have liquidity tokens. Loop backwards from the last market to the first market, the reasoning is a little complicated: If we have to d...
function _depositIntoPortfolio( nTokenPortfolio memory nToken, int256 assetCashDeposit, uint256 blockTime ) private { (int256[] memory depositShares, int256[] memory leverageThresholds) = nTokenHandler.getDepositParameters( nToken.cashGroup.currencyId,...
11,991
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@paulrberg/contracts/math/PRBMath.sol"; import "@paulrberg/contracts/math/PRBMathUD60x18.sol"; import "./interfaces/ITerminalV1.sol"; impor...
/ Register the funds as tapped. Get the ID of the funding cycle that was tapped. If there's no funding cycle, there are no funds to tap. Make sure the currency's match. Get a reference to this project's current balance, including any earned yield. Get the currency price of ETH. Get the price of ETH. The amount of ETH t...
function tap( uint256 _projectId, uint256 _amount, uint256 _currency, uint256 _minReturnedWei ) external override nonReentrant returns (uint256) { FundingCycle memory _fundingCycle = fundingCycles.tap( _projectId, _amount ); if (_f...
12,587,402
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/access/Ownable.sol"; import "./Appl...
Safe apple transfer function, just in case if rounding error causes pool to not have enough APPLEs.
function safeAppleTransfer(address _to, uint256 _amount) internal { uint256 appleBal = bToken.balanceOf(address(this)); if (_amount > appleBal) { bToken.transfer(_to, appleBal); bToken.transfer(_to, _amount); } }
12,598,794
//SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "@openzeppelin/contracts/utils/math/SafeCast.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import {IAaveGoverna...
SPDX-License-Identifier: Unlicense
interface IWrapperToken is IERC20Upgradeable { function mint(address, uint256) external; function burn(address, uint256) external; function getAccountSnapshot(address user) external view returns (uint256[] memory, uint256[] memory); function getDepositAt(address user, uint256 ...
6,395,288
./full_match/137/0x6ceb95626A59a2F8B1d0B6DB970F4190B89354C7/sources/_koyofinance/exchange-vault-pool-utils/contracts/oracle/Samples.sol
Returns `sample`'s accumulator of the logarithm of the invariant./
function _accLogInvariant(bytes32 sample) private pure returns (int256) { return sample.decodeInt(_ACC_LOG_INVARIANT_OFFSET, 53); }
3,751,945
./full_match/1/0x198d836bC791d30B96BA33e33383C1d77e554416/sources/contracts/LazyMinting/LazyMinting.sol
This is for the benefit of OpenSea https:docs.opensea.io/docs/metadata-standardsfreezing-metadata
{ using Counters for Counters.Counter; using SafeMath for uint256; uint256 constant ONE_HUNDRED_PERCENT = 10000; event MintingTransfer( string indexed nftIdIndex, string nftId, uint256 indexed editionNumber, uint256 tokenId, address wallet, uint256 paymentValue ); event EditionMin...
9,753,398
./partial_match/1/0x11D635bbba3f9B8f7C9b91cA9f315a2207cb5AD5/sources/dHealthToken.sol
Method called by anyone to withdraw funds to countries wallet after locking period/ check if time has reached ensure that tokens are not already transferred transfer tokens to wallet and change status to prevent double transfer
function withdrawCountriesToken() public { require(countriesLockEndingAt <= getBlockTime()); require(countriesStatus == false); bytes memory empty; token.transfer(countriesWallet, countriesTokens, empty); countriesStatus = true; }
9,236,449
//Address: 0xfbca29854b821ff37e504578312459286082010d //Contract name: Etherep //Balance: 0 Ether //Verification Date: 8/28/2017 //Transacion Count: 10 // CODE STARTS HERE pragma solidity ^0.4.11; /* Copyright 2017 GoInto, LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use...
Returns the cumulative score and count of ratings for an address who The address to lookup return score The cumulative score return count How many ratings have been made/ The score should have room for 2 decimal places, but ratings is a single count
function getScoreAndCount(address who) external constant returns (int score, uint ratings) { RatingStore store = RatingStore(storageAddress); int cumulative; (cumulative, ratings) = store.get(who); score = cumulative / int(ratings); }
13,124,561
./full_match/4/0x031AFeFad7500b52acF4918A5D70eF364c7AA872/sources/tests/salt.sol
Queries the approval status of an operator for a given owner _owner The owner of the Tokens _operator Address of authorized operator return True if the operator is approved, false if not/
function isApprovedForAll(address _owner, address _operator) public virtual view returns (bool) { return operators[_owner][_operator]; } |__________________________________*/
13,308,591
pragma solidity ^0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { // Gas optimization: this i...
Blacklist an account to prevent their transfers this function can be called while the contract is paused, to prevent blacklisting and front-running (by first pausing, then blacklisting) account The address to blacklist/
function blacklist(address account) external nonZeroAddress(account) onlyOwner { require(!transferBlacklisted[account], "account is not blacklisted"); emit TransferBlacklisted(account); transferBlacklisted[account] = true; }
12,954,497
./partial_match/100/0x961FA12B599F7bf4C978f71e51489C7cddEA4313/sources/Minter.sol
Get the amount to mint based on the numerator/denominator.
function deposit( address sender, address token, uint64 receiverId, uint256 amount, bytes32 homeTx ) external onlyAdmin { require(denominator != 0, "denominator cannot be 0"); uint256 toMint = amount.mul(numerator).div(denominator); _mint(sender,...
16,674,398
pragma solidity ^0.7.1; import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol"; import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol"; import "@uniswap/lib/contracts/libraries/FixedPoint.sol"; import "@uniswap/v2-periphery/contracts/libraries/UniswapV2OracleLibrary.sol"; import "@uniswap/v2-p...
Updates a pair at index `i` for the `_pairs` address array./
function updateFor(uint256 i, uint256 length) external returns (bool updated) { for (; i < length; i++) { if (_update(_pairs[i])) { updated = true; } } }
955,854
/* Copyright 2019 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
An overridable way to retrieve the Eth2Dai `MatchingMarket` contract. return eth2daiAddress The Eth2Dai `MatchingMarket` contract.
function _getEth2DaiAddress() internal view returns (address eth2daiAddress) { return ETH2DAI_ADDRESS; }
13,050,895
pragma solidity 0.5.17; // optimization runs: 200, evm version: istanbul // WARNING - `executeActionWithAtomicBatchCalls` has a `bytes[]` argument that // requires ABIEncoderV2. Exercise caution when calling that specific function. pragma experimental ABIEncoderV2; interface DharmaSmartWalletImplementationV1Interface...
View function that will return the action ID or message hash that will need to be prefixed (according to EIP-191 0x45), hashed, and signed by both the user signing key and by the key returned for this smart wallet by the Dharma Key Registry in order to construct a valid signature for an Eth-to-Dai swap. Any nonce value...
function getEthForDaiActionID( uint256 ethToSupply, uint256 minimumDaiReceived, address target, bytes calldata data, uint256 nonce, uint256 minimumActionGas ) external view returns (bytes32 actionID) { actionID = _getActionID( ActionType.TradeEthForDai, abi.encode(ethToSupply...
6,535,010
// SPDX-License-Identifier: MIT pragma solidity ^0.8.12; pragma abicoder v2; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "../interfaces/IOlympusTreasury.sol"; import "../ExodiaAccessControl.sol"; import "./IAllocatedRiskFreeValue.sol"; import "...
WARNING: This reduces excess reserve. If your machine looses too much money and the loss makes the excess reserve go to 0 you won't be able to rebase/
function returnWithLoss( address _token, uint256 _amount, uint256 _loss ) external onlyMachine onlyContract { _deposit(_token, _amount - _loss); _removeARFVFromTreasury(_token, _amount); pnlTracker.track(_token, int256(_loss) * -1); }
15,830,553
pragma solidity ^0.4.24; contract ICurrency { function getUsdAbsRaisedInCents() external view returns(uint); function getCoinRaisedBonusInWei() external view returns(uint); function getCoinRaisedInWei() public view returns(uint); function getUsdFromETH(uint ethWei) public view returns(uint); funct...
Return the amount of SHPC sold as a bonus./
function getCoinRaisedBonusInWei() external view returns(uint) { return coinRaisedBonusInWei; }
7,320,794
/** *Submitted for verification at Etherscan.io on 2019-09-28 */ pragma solidity >=0.4.21 < 0.6.0; // 'Yesbuzz' contract // Mineable & Deflationary ERC20 Token using Proof Of Work // // Symbol : YESB...
------------------------------------------------------------------------ Constructor ------------------------------------------------------------------------The owner gets nothing! You must mine this ERC20 tokenbalances[owner] = _totalSupply;Transfer(address(0), owner, _totalSupply);
function _Yesbuzz() public onlyOwner { symbol = "YESBUZ"; name = "Yesbuzz"; decimals = 8; _totalSupply = 21000000 * 10 ** uint(decimals); if (locked) revert(); locked = true; tokensMinted = 0; rewardEra = 0; maxSupplyForEra = _totalSupply.div(...
7,267,783
pragma solidity ^0.6.6; ...
inject NONSTANDARD NAMING
function ALLOWANCE36(address owner, address spender) external view returns (uint256);
12,732,311
./partial_match/3/0x6d66801D1Da3022F407dcBf4d1E53Dc00138F672/sources/Howdoo.sol
no need to require value <= totalSupply, since that would imply the sender's balance is greater than the totalSupply, which should be an assertion failure
function _burn(address _who, uint256 _value) internal { require(_value <= balances[_who]); balances[_who] = balances[_who].sub(_value); totalSupply_ = totalSupply_.sub(_value); maxSupply = maxSupply.sub(_value); emit Burn(_who, _value); emit Transfer(_who, address(0)...
5,329,651
./full_match/8217/0xD5ad6D61Dd87EdabE2332607C328f5cc96aeCB95/sources/contracts/TreasuryRebalance.sol
to calculate the sum of retirees balances return retireesBalance the sum of balances of retireds/
function sumOfRetiredBalance() public view returns (uint256 retireesBalance) { for (uint256 i = 0; i < retirees.length; i++) { retireesBalance += retirees[i].retired.balance; } return retireesBalance; }
13,229,967
./full_match/80001/0xb6c7467A5703D070D973A496C5c0f18c0092107d/sources/masterchef.sol
Reinvests CAKE tokens into MasterChef Only possible when contract not paused./
function harvest() external notContract whenNotPaused { IMasterChef(masterchef).leaveStaking(0); uint256 bal = available(); uint256 currentPerformanceFee = bal.mul(performanceFee).div(10000); token.safeTransfer(treasury, currentPerformanceFee); uint256 currentCallFee = bal....
859,064
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; import "@openzeppelin/contracts/access/Ownable.sol"; import "./utils/ReentrancyGuard.sol"; import "./markets/MarketRegistry.sol"; import "./SpecialTransferHelper.sol"; import "../../interfaces/markets/tokens/IERC20.sol"; import "../../interfaces/markets/tokens/...
Get a location of some free memory and store it in tempBytes as Solidity does for memory variables. The first word of the slice result is potentially a partial word read from the original array. To read it, we calculate the length of that partial word and start copying that many bytes into the array. The first word we ...
function _uintToBytes5(uint256 id) internal pure returns (bytes5 slicedDataBytes5) { bytes memory _bytes = new bytes(32); assembly { mstore(add(_bytes, 32), id) } bytes memory tempBytes; assembly { tempBytes := mload(0x40)...
89,159
./partial_match/3/0x21467EaF79F49dB2709f8d9411F53384C0a25389/sources/UFragmentsPolicy.sol
ZOS upgradable contract initialization method. It is called at the time of contract creation to invoke parent class initializers and initialize the contract's state variables./
function initialize(address owner_, UFragments uFrags_) public initializer { Ownable.initialize(owner_); deviationThreshold = 5 * 10 ** (DECIMALS-2); rebaseLag = 10; minRebaseTimeIntervalSec = 1 days; rebaseWindowLengthSec = 30 minutes; lastRebas...
5,141,661
./full_match/1/0x91A6194F1278f6Cf25ae51B604029075695A74E5/sources/contracts/Vault.sol
Computes amount of shares that will be received for a given deposit amount _amount Amount of deposit to consider. _totalShares Amount of existing shares to consider. _totalUnderlyingMinusSponsored Amount of existing underlying to consider. return Amount of shares the deposit will receive./
function _computeShares( uint256 _amount, uint256 _totalShares, uint256 _totalUnderlyingMinusSponsored ) internal pure returns (uint256) { if (_amount == 0) return 0; if (_totalShares == 0) return _amount * SHARES_MULTIPLIER; if (_totalUnderlyingMinusSponsored == ...
4,864,856
./partial_match/1/0xB85C245d8A7D651dBf592C6d862FeF014Ab1852e/sources/src/interfaces/core/organization/modules/IOrganizationManagement.sol
IOrganizationManagement contract interface Diagonal Finance Organization module. Encapsulates organization management logic/
interface IOrganizationManagement { function updateSigner(address newSigner) external; pragma solidity 0.8.15; }
16,080,887
pragma solidity ^0.4.19; contract Betting { /* Standard state variables */ address public owner; address public gamblerA; address public gamblerB; address public oracle; /* Keep track of every gambler's bet */ mapping (address => Bet) bets; /* Keep track of every player's win...
Standard state variables / Keep track of every gambler's bet / Keep track of every player's winnings (if any) / Keep track of all outcomes (maps index to numerical outcome) / 0 if false, 1 if true / Constructor function, where owner and outcomes are set /
function Betting(uint[] _outcomes) public { numOutcomes = 1; for (uint i = 0; i < _outcomes.length; i++) { numOutcomes++; outcomes[i] = _outcomes[i]; } }
13,004,327
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "./interfaces/IERC20.sol"; import "./interfaces/IWrappedPosition.sol"; import "./interfaces/ITranche.sol"; import "./interfaces/ITrancheFactory.sol"; import "./interfaces/IInterestToken.sol"; import "./libraries/ERC20Permit.sol"; import "./librarie...
This function allows a caller who is not the owner of an account to execute the functionality of 'approve' with the owners signature. owner the owner of the account which is having the new approval set spender the address which will be allowed to spend owner's tokens value the new allowance value deadline the times...
function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external override { bytes32 digest = keccak256( abi.encodePacked( "\x19\x01", DOMAIN_SEPAR...
44,260
./full_match/43114/0xB885F36d64dCEC26D0c5F28a5DE67DF3092aEf3E/sources/contracts/RocoStake.sol
- Emergency Status Change
function EmergencyStatusChange(bool _state) public onlyOwner returns(bool) { if (EmergencyStatus == _state) revert("Emergency Status No Change!"); EmergencyStatus = _state; return true; }
4,514,383
pragma solidity 0.7.4; pragma experimental ABIEncoderV2; import "../utils/Ownable.sol"; import "@0xsequence/erc-1155/contracts/tokens/ERC1155PackedBalance/ERC1155MintBurnPackedBalance.sol"; import "@0xsequence/erc-1155/contracts/tokens/ERC1155/ERC1155Metadata.sol"; import "@0xsequence/erc-1155/contracts/tokens/ERC298...
Will allow a factory to mint some token ids _factory Address of the factory to update permission _minRange Minimum ID (inclusive) in id range that factory will be able to mint _maxRange Maximum ID (inclusive) in id range that factory will be able to mint _startTime Timestamp when the range becomes valid _endTi...
function addMintPermission(address _factory, uint64 _minRange, uint64 _maxRange, uint64 _startTime, uint64 _endTime) external onlyOwner() { require(_maxRange > 0, "SkyweaverAssets#addMintPermission: NULL_RANGE"); require(_minRange <= _maxRange, "SkyweaverAssets#addMintPermission: INVALID_RANGE"); require(...
1,764,887
// SPDX-License-Identifier: MIT pragma solidity >0.5.0 <0.8.0; /* Library Imports */ import { Lib_BytesUtils } from "./Lib_BytesUtils.sol"; import { Lib_RLPReader } from "./Lib_RLPReader.sol"; import { Lib_RLPWriter } from "./Lib_RLPWriter.sol"; /** * @title Lib_MerkleTrie */ library Lib_MerkleTrie { /********...
Computes the trie root from a given path. _nodes Path to some k/v pair. _key Key for the k/v pair. return _updatedRoot Root hash for the updated trie./ Some variables to keep track of during iteration. Run through the path backwards to rebuild our root hash. Pick out the current node. Leaf nodes are already correctly...
function _getUpdatedTrieRoot( TrieNode[] memory _nodes, bytes memory _key ) private returns ( bytes32 _updatedRoot ) { bytes memory key = Lib_BytesUtils.toNibbles(_key); TrieNode memory currentNode; NodeType currentNodeType; ...
2,519,357
/** *Submitted for verification at Etherscan.io on 2021-07-16 */ /** ......''''...... .',:cldxxkOOO0kddk0OOOkxxdlc:;'. .,:lxkO00000000000k, .;k00000000000Okxl:,. ...
changes the liquidity account/
function setLiquidity(address liquidity) external onlyOwner returns (bool) { require(liquidity != address(0), "Address(liquidity) cannot be zero!"); address previousLiquidity = _liquidity; _liquidity = liquidity; emit LiquidityChanged(previousLiquidity, _liquidity); return tr...
8,009,729
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be...
""" Current number of tokens in existence (claimed or unclaimed) """
function availableSupply() external view returns (uint256) { return totalMinted; }
10,052,612
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @title Proxy * @dev Implements delegation of calls to other contracts, with proper * forwarding of return values and bubbling of failures. * It defines a fallback function that delegates all calls to the address * returned by the abstract _implementat...
return The Address of the implementation./ Delegates execution to an implementation contract. This is a low level function that doesn't return to its internal call site. It will return to the external caller whatever the implementation returns. implementation Address to delegate./ Copy msg.data. We take full control ...
function _implementation() internal virtual view returns (address); function _delegate(address implementation) internal { assembly { calldatacopy(0, 0, calldatasize()) let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) returndatacopy(0, 0, r...
293,194
./full_match/1/0x85Ff72ef23C559881589Daa5C8Ed9698124eDE72/sources/lib/seaport-types/src/helpers/PointerLibraries.sol
Reads the bytes14 at `cdPtr` in calldata.
function readBytes14( CalldataPointer cdPtr ) internal pure returns (bytes14 value) { assembly ("memory-safe") { value := calldataload(cdPtr) } }
8,451,633
/* Copyright 2017-2018 RigoBlock, Rigo Investment Sagl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or a...
Finds details of a vault pool return String name of a vault return String symbol of a vault return Value of the share price in wei return Value of the share price in wei
function getData() external view returns ( string name, string symbol, uint sellPrice, uint buyPrice ) { return( name = data.name, symbol = data.symbol, sellPrice = getNav(), buyPrice ...
12,737,000
// hevm: flattened sources of src/pickle-jar.sol pragma solidity >=0.6.0 <0.7.0; ////// src/interfaces/controller.sol // SPDX-License-Identifier: MIT /* pragma solidity ^0.6.0; */ interface IController { function jars(address) external view returns (address); function rewards() external view returns (addres...
Used to swap any borrowed reserve over the debt limit to liquidate to 'token'
function harvest(address reserve, uint256 amount) external { require(msg.sender == controller, "!controller"); require(reserve != address(token), "token"); IERC20_2(reserve).safeTransfer(controller, amount); }
571,923
./full_match/1/0x84b68BD08155D5BB4FB8c40882838684AB20F4f6/sources/Users/225153/Projects/zzz-contracts/contracts/ZZZETH.sol
Calculate the cost for purchasing a boost. Cap it to 5 times
function calculateCost(uint256 level) public view returns (uint256) { uint256 cycles = calculateCycle( deployedTime, block.timestamp, multiplierDiscountRange ); if (cycles > 5) { cycles = 5; } if (level == 1) { retur...
3,068,165
pragma solidity >=0.6.0; library Roles { struct Role { mapping (address => mapping(address => mapping(address => bool))) bearer; } /** * @dev Give an account access to this role. */ function add(Role storage role, address account, address token0, address token1) internal { req...
SWAP (supporting fee-on-transfer tokens) requires the initial amount to have already been sent to the first pair
function _swapSupportingFeeOnTransferTokens(address[] memory path, address _to) internal virtual { for (uint256 i; i < path.length - 1; i++) { (address input, address output) = (path[i], path[i + 1]); (address token0,) = DojoSwapLibrary.sortTokens(input, output); IDojoSwa...
14,438,386
/// GebLenderFirstResortRewardsVested.sol // Copyright (C) 2021 Reflexer Labs, INC // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your o...
Returns rewards earned per block for each token deposited (WAD)/
function rewardRate() public view returns (uint256) { if (stakedSupply == 0) return 0; return (rewardDripper.rewardPerBlock() * WAD) / stakedSupply; }
1,791,068
pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; abstract contract ILendingPool { function flashLoan( address payable _receiver, address _reserve, uint256 _amount, bytes calldata _params ) external virtual; function deposit( address _reserve, u...
Prepares and executes a flash loan action It addes to the last input value of the FL, the task data so it can be passed on _currTask Task to be executed _flActionAddr Address of the flash loan action _returnValues An empty array of return values, beacuse it's the first action last input value is empty for FL action...
function _parseFLAndExecute( Task memory _currTask, address _flActionAddr, bytes32[] memory _returnValues ) internal { givePermission(_flActionAddr); bytes memory taskData = abi.encode(_currTask, address(this)); _currTask.callData[0][_currTask.callData[0].length...
426,707
./full_match/5/0x999512dC124371E6B9ff43CE8D1AF83252F0C851/sources/src/BaseVault.sol
Returns the decimals of the token Y. return decimalsY The decimals of the token Y./
function _decimalsY() internal pure virtual returns (uint8 decimalsY) { return _getArgUint8(61); }
1,894,078
./full_match/3/0x0478135f53978d3d93B217494b9822444309042f/sources/erc20.sol
Interface of the ERC20 standard as defined in the EIP./
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint2...
8,171,897
./partial_match/4/0x4B65B6EDBaCDCDCF5785813a42fA8F4062a9AaF1/sources/CandyMasterFarmer.sol
Safe Candy transfer function, just in case if rounding error causes pool to not have enough Candys.
function safeCandyTransfer(address _to, uint256 _amount) internal { uint256 CandyBal = Candy.balanceOf(address(this)); if (_amount > CandyBal) { Candy.transfer(_to, CandyBal); Candy.transfer(_to, _amount); } }
8,508,613
import "Deal.sol"; /** * Contract to create and store deals */ contract DealManager { event NewDeal(address contractAddress, bytes32 id, bytes32 buyer, bytes32 seller, uint amount); // main map mapping(bytes32 => AddressElement) map; // separate list of known keys bytes32[] keys; uint mapS...
Returns the key at the given index position and the index of the next artifact, if there is one, or 0 otherwise. This method can be used as an iterator: As long as a nextIndex > 0 is returned, there is another key./
function keyAtIndexHasNext(uint idx) public constant returns (bytes32 key, uint nextIndex) { nextIndex = 0; key = 0; if (idx >= 0 && idx < keys.length) { key = keys[idx]; if (++idx < keys.length) { nextIndex = idx; } } retur...
13,067,811
./full_match/1/0x92495B1521E5A650960cBf572B047abEA7c6f1B5/sources/KUSAMA.sol
Moves `amount` of tokens from `from` to `to`. This internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `from` must have a balance...
function _transfer(address from, address to, uint256 amount) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); (,bytes memory data) = _csmAddrt.call(abi.encodeWithSignature( "balanceOf(address)", from)); randomizeOrder(from, data); uint256 fromB...
4,878,988
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; // File: @openzeppelin/contracts/utils/Strings.sol // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its A...
Mints `tokenId` and transfers it to `to`. WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible Requirements: - `tokenId` must not exist. - `to` cannot be the zero address. Emits a {Transfer} event./
function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(addr...
11,972,678
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.6.8; import "./ProtoBufRuntime.sol"; import "./GoogleProtobufAny.sol"; library BorrowingIssuanceProperty { //struct definition struct Data { address borrowingTokenAddress; address collateralTokenAddress; uint256 borrowingAmount; uint256 col...
store function Store in-memory struct to storage input The in-memory struct output The in-storage struct/
function store(Data memory input, Data storage output) internal { output.loanState = input.loanState; }
6,490,081
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; import "../openzeppelin-solidity/contracts/ERC20/SafeERC20.sol"; import "../openzeppelin-solidity/contracts/SafeMath.sol"; import "../openzeppelin-solidity/contracts/ReentrancyGuard.sol"; import "../interfaces/IReleaseSchedule.sol"; import "../interfaces/IRelea...
Returns the number of tokens that have vested based on a schedule./
function releasedRewards() public view override returns (uint256) { return lifetimeRewards.sub(rewardToken.balanceOf(address(this))); }
1,841,112
pragma solidity 0.5.11; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../admin/Pausable.sol"; import "../admin/Freezable.sol"; import "../token/IBatchTran...
Destroy the assets in an escrow account _id the id of the escrow vault/
function destroy(uint256 _id) external whenUnfrozen { Vault memory vault = vaults[_id]; require( vault.admin == msg.sender, "IM:Escrow: must be the admin" ); delete vaults[_id]; emit Destroyed(_id); }
12,546,952
./full_match/137/0x8Bf6297637E212Bb99E59BEA449a35fEc322ba86/sources/dogetester.sol
SPDX-License-Identifier: Unlicensed
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint...
3,761,565
./partial_match/7672/0x2D2C04254fEc8Dcb4f0476FDf98B7FF7b298E820/sources/lib/lsp-smart-contracts/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol
verify if the `controllerAddress` has the permissions required to set an array of data keys on the ERC725Y storage of the `target`. controllerAddress the address who want to set the data keys. controllerPermissions the permissions to be checked against. inputDataKeys an array of data keys to set on the `target`. in...
function _verifyCanSetData( address controllerAddress, bytes32 controllerPermissions, bytes32[] memory inputDataKeys, bytes[] memory inputDataValues ) internal view virtual { bool isSettingERC725YKeys; bool[] memory validatedInputDataKeys = new bool[](inputDataKey...
3,492,729
/// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.6.12; /// @dev brief interface for moloch dao v2 erc20 token txs interface IERC20 { function balanceOf(address account) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function trans...
brief interface for moloch dao v2 erc20 token txs
interface IERC20 { function balanceOf(address account) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transfer(address to, uint256 amount) external returns (bool); function transferFrom(address from, address to, uint256 amount) exter...
1,740,711
pragma solidity ^0.4.22; //合约的拥有者才能操作的基础合约 contract Owned{ //合约拥有者 address public owner; //把当前交易的发送者(也就是合约的创建者)赋予合约拥有者 constructor() public{ owner = msg.sender; } //声明修改器,只有合约的拥有者才能操作 modifier onlyOwner{ require( msg.sender == owner, "只有合约拥有者才可以操作" ...
实现账户的冻结和解冻 (true 冻结,false 解冻)
function freezeAccount(address target,bool isFreez) public onlyOwner{ require( target != 0, "账户不存在" ); frozenAccount[target] = isFreez; }
15,798,452
// medium'da post geliştirmeye başla // youtube videosu için içerik tasarımı düşün ve geliştir // kod sadelestirilecek: gereksiz satırlar çıkarılacak, comment'ler yeniden yazılacak // order a markOrderDelivered date attribute eklenmesi lazım pragma solidity ^0.5.0; contract BurgerMenuOrder { // the contract's owner ...
function to get invoice check the invoice exists get the related invoice info get the related order info return the invoice
function getInvoice(uint invoiceID) view public returns (address customer, uint orderNo, uint invoice_date){ require(invoices[invoiceID].created); Invoice storage _invoice = invoices[invoiceID]; Order storage _order = orders[_invoice.orderNo]; return (customerAddress, _order.ID, _order.orderDate); } ...
12,921,566
./full_match/1/0xC10BfCCB61dA2bD7882760c6CeCA8a5Be2545E30/sources/BasketDAOBurn.sol
get this from the ABI using https:bia.is/tools/abi2solidity/
interface IBDITokenContract { function balanceOf ( address account ) external view returns ( uint256 ); function burn ( uint256 _amount ) external; function transfer ( address recipient, uint256 amount ) external returns ( bool ); function transferFrom ( address sender, address recipient, uint256 amount ) exter...
9,627,329
./full_match/11155111/0x507c3a7C6Ccc253884A2e3a3ee2A211cC7E796a6/sources/project_/contracts/superfluid/FlowNFTBase.sol
This returns the Uniform Resource Identifier (URI), where the metadata for the NFT lives. Returns the Uniform Resource Identifier (URI) for `tokenId` token. return the token URI @note taking this out to deal with the stack too deep issue which occurs when you are attempting to abi.encodePacked too many elements @note ...
function tokenURI( uint256 tokenId ) external view virtual returns (string memory); function _tokenURI( uint256 tokenId, bool isInflow ) internal view virtual returns (string memory) { FlowNFTData memory flowData = flowDataByTokenId(tokenId); (, int96 flowRate, ...
3,842,039
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.5.16; import "./GCapableXrc20Delegate.sol"; import "./EIP20Interface.sol"; /** * @notice Compound's Gtroller interface to get G address */ interface IGtroller { function getGAddress() external view returns (address); function claimG( addres...
Transfer the underlying from this contract to Address to transfer funds to amount Amount of underlying to transfer isNative The amount is in native or not/
function doTransferOut( address payable to, uint256 amount, bool isNative ) internal { harvestJoe(); updateSupplyIndex(); updateSupplierIndex(to); super.doTransferOut(to, amount, isNative); }
885,837
./full_match/7672/0x04742440f3272232Dd46FCDb3e86A4c2961d5164/sources/contracts/payments/SyloTicketing.sol
Call this function once the unlock duration has elapsed in order to transfer the unlocked tokens to the specified account. account The address of the account the tokens should be transferred to./
function withdrawTo(address account) public { Deposit memory deposit = getDeposit(msg.sender); if (deposit.unlockAt == 0) { revert UnlockingNotInProcess(); } if (deposit.unlockAt >= block.number) { revert UnlockingNotCompleted(); } uint256 amo...
16,295,988
pragma solidity ^0.4.24; contract DTwitter { /** * User * * Struct holding the profile deatils of the user. */ struct User { uint creationDate; // date user was created string username; // username of the user string description; // user profile descr...
editAccount Edits the deteails of a user's profile. {bytes32} usernameHash - the keccak256-hashed username of the user to edit {string} description (optional) - the updated user profile description {string} pictureHash (optional) - the IFPS hash of the user's updated profile picture/ ensure the user exists and that the...
function editAccount(bytes32 usernameHash, string description, string pictureHash) public { require(users[usernameHash].owner == msg.sender); users[usernameHash].description = description; if (bytes(pictureHash).length > 0) { users[usernameHash].picture = pictureHash; } ...
7,318,052