file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./partial_match/1/0xc9268c7F59850B26567b0f5d3Dcc317cEDC43490/sources/src/contracts/SlippageAuction.sol
Gets a struct instead of a tuple for auctions() _auctionNumber Auction ID return _auctionStruct The struct of the auction
function getAuctionStruct(uint256 _auctionNumber) external view returns (Auction memory) { return auctions[_auctionNumber]; }
15,952,496
./full_match/1/0xfcD1CEC3Ec7154858Cab4E930F565Db528b1f9f1/sources/contracts/multisig/MultiSigWallet.sol
Submit a transaction to set the number of owner confirmations required to execute transactions
function submitSetOwnerConfirmationsRequired(uint256 _ownerConfirmationsRequired) external { bytes memory data = abi.encodeWithSignature( "_setOwnerConfirmationsRequired(uint256)", _ownerConfirmationsRequired ); submitTransaction(address(this), 0, data); }
9,612,784
./full_match/5/0x9e69dD0ab3C6564822F4A6B3BB273529C5456a22/sources/contracts/RandomNumberConsumerV2.sol
Requests randomness Assumes the subscription is funded sufficiently; "Words" refers to unit of data in Computer Science/ Will revert if subscription is not set and funded.
function requestRandomWords() external onlyOwner { s_requestId = COORDINATOR.requestRandomWords( s_keyHash, s_subscriptionId, REQUEST_CONFIRMATIONS, CALLBACK_GAS_LIMIT, NUM_WORDS ); }
11,586,866
./partial_match/1/0x95aDB68504fd5D51139B7E30Aa4e96d8badEDeb6/sources/ReFoMoMe.sol
this is the core logic for any buy/reload that happens while a round is live./ if player is new to round early round eth limiter mint the new keys if they bought at least 1 whole key set new leaders set the new leader bool to true gib muni calculate prize and give it to winner adjust airDropPot let event know a tier 3 ...
function core(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_) private { if (plyrRnds_[_pID][_rID].keys == 0) _eventData_ = managePlayer(_pID, _eventData_); if (round_[_rID].eth < 100000000000000000000 && p...
15,985,358
./partial_match/42220/0xfa532d5a8EEfE8cff823d1Dc86660a7EBBf3Ced0/sources/contracts/CarbonCreditRakeback.sol
Emitted after bundle swap account - The account that triggered the swap sourceBundleAddress - the source bundle address targetBundleAddress - the target bundle address tokenAddress - the address of the token that was swapped swapAmount - the amount swapped in terms of source bundle receivedAmount - the amount rec...
function initialize(CarbonCreditBundleToken bundle_, address owner_) external initializer { require(address(bundle_) != address(0), 'bundle is required'); bundle = bundle_; __Ownable_init(); transferOwnership(owner_); }
3,495,336
./full_match/80001/0xF48082Ef8C643E91A7E1183e16ba3b8b479C08bF/sources/lib/AddressList.sol
@inheritdoc IAddressList/
function adds(address[] calldata addresses) external onlyOwner returns (bool[] memory results) { uint256 _length = addresses.length; results = new bool[](_length); for (uint256 i = 0; i < _length; i++) { results[i] = _add(addresses[i]); } return results; }
5,551,049
pragma solidity >=0.5.0 <0.6.0; /// @title ERC165Interface /// @dev https://eips.ethereum.org/EIPS/eip-165 interface ERC165Interface { /// @notice Query if a contract implements an interface /// @param interfaceId The interface identifier, as specified in ERC-165 /// @dev Interface identification is speci...
A finger printing function to capture the important state data about a Wizard into a secure hash. This is especially useful during sales and trading to be sure that the Wizard's state hasn't changed materially between the time the trade/purchase decision was made and when the actual transfer is ...
function wizardFingerprint(uint256 wizardId) external view returns (bytes32) { (uint256 affinity, uint256 power, uint256 maxPower, uint256 nonce, bytes32 currentDuel, bool ascending, uint256 ascensionOpponent, bool molded, ) = getWizard(wizardI...
12,784,545
./partial_match/3/0xbC23997d4e1ff51752476761c0dD0551Ac3c0760/sources/ControlledLuniverseGluwacoin.sol
Hook that is called before any transfer of tokens. This includes minting and burning. Calling conditions: - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens will be to transferred to `to`. - when `from` is zero, `amount` tokens will be minted for `to`. - when `to` is zero, `amount` of ``from``'s to...
function _beforeTokenTransfer(address from, address to, uint256 amount) internal pure { require(amount > 0, "ERC20WithSafeTransfer: invalid amount"); require(from != to, "ERC20WithSafeTransfer: sender and recipient must be different"); }
5,322,924
pragma solidity ^0.8.0; // SPDX-License-Identifier: MIT import "../../core/DaoRegistry.sol"; import "../../guards/AdapterGuard.sol"; import "../IExtension.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/I...
Updates internally the ownership of the NFT. The caller must have the ACL Flag: INTERNAL_TRANSFER Reverts if the NFT is not already internally owned in the extension. nftAddr The NFT address. nftTokenId The NFT token id. newOwner The address of the new owner./
function internalTransfer( address nftAddr, uint256 nftTokenId, address newOwner ) external hasExtensionAccess(this, AclFlag.INTERNAL_TRANSFER) { require(newOwner != address(0x0), "erc721::new owner is 0"); address currentOwner = _ownership[getNFTId(nftAddr, nftTokenId)];...
5,521,332
/* * Copyright (c) The Force Protocol Development Team * Submitted for verification at Etherscan.io on 2019-09-17 */ pragma solidity 0.5.13; // pragma experimental ABIEncoderV2; import "./ReentrancyGuard.sol"; /** * Utility library of inline functions on addresses */ library Address { /** * Returns whe...
Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend)./
function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "uint sub overflow"); uint256 c = a - b; return c; }
13,067,262
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol";...
Verify the merkle proof.
function purchaseWhileList(uint256 index, uint256 numberOfTokens, bytes32[] calldata merkleProof) external payable { require( numberOfTokens <= PURCHASE_LIMIT, "Can only mint up to 2 token" ); require(isWhileListActive, "While List is not active"); ...
605,926
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./IERC165Upgradeable.sol"; import "../proxy/Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts may inherit from this and call {_registerInterface} to declare * their support of an interface. */ abstract ...
Query the released amount of the underlying assets. tokenId_ Id of the Voucher to query/
function claimableAmount(uint256 tokenId_) public view virtual override returns (uint256) { return vestingPool.claimableAmount(tokenId_); }
437,215
// SPDX-License-Identifier: GPL-3.0 pragma solidity =0.6.12; /* BEGIN KEYBASE SALTPACK SIGNED MESSAGE. kXR7VktZdyH7rvq v5weRa0zkYfegFM 5cM6gB7cyPatQvp 6KyygX8PsvQVo4n Ugo6Il5bm5f3Wc6 6TBmPpX0GwuU4n1 jj5f1QNCcPGgXgB 2CnpFgQ3gOEvVg6 XP8CXBnyC9E1gRc gI54di8USKNHywe 5kNeA6zdEcwdKsZ 3Ydod13RrV78Qap G7mca59khDyl2mo iCT5Tur...
refund dust eth, if any
function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external virtual override payable ensure(deadline) returns (uint amountToken, uint amountETH, uint liquidity) { (amountTok...
10,132,498
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC1271 standard signature validation method for * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271]. * * _Available since v4.1._ */ interface IERC1271 { /** * @dev Should return whether the signa...
set a new tokenURI contract, that generate the metadata including the wav file, Can only be set by the `tokenURIAdmin`. newTokenURIContract The address of the new tokenURI contract.
function setTokenURIContract(ITokenURI newTokenURIContract) external { require(msg.sender == tokenURIAdmin, "NOT_AUTHORIZED"); tokenURIContract = newTokenURIContract; emit TokenURIContractSet(newTokenURIContract); }
6,180,846
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // import ERC721 and Ownable interfaces import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; /// @title Contract for manipulate NFT /// @author Tulio Valentim /// @notice Allows a ...
require caller of the function is not an empty address require that token should exist get the token's owner check that token's owner should be equal to the caller of the function get that token from all crypto NFT mapping and create a memory of it defined as (struct => Staking) check that the token is not staked_burn(...
function createStake(uint256 _tokenId) external { require(msg.sender != address(0)); require(_exists(_tokenId)); address tokenOwner = ownerOf(_tokenId); require(tokenOwner == msg.sender); Staking memory staking = allNFTStaking[_tokenId]; require(staking.stak...
12,910,044
//Address: 0xc45865b235a7c6693b9db5fed46ea8a3022d9b07 //Contract name: KATXDcorpMemberProxy //Balance: 0 Ether //Verification Date: 11/26/2017 //Transacion Count: 4 // CODE STARTS HERE pragma solidity ^0.4.18; /** * IOwnership * * Perminent ownership * * #created 01/10/2017 * #author Frank Bonnet */ interfac...
Deploy a contract that serves as a proxy to the crowdsale Contributions through this address will be made for `_beneficiary` _beneficiary The owner of the proxy return The address of the deposit address/
function createPersonalDepositAddressFor(address _beneficiary) public returns (address) { address proxy = new DcorpPersonalCrowdsaleProxy(_beneficiary, this); DcorpProxyCreated(proxy, _beneficiary); return proxy; }
5,547,282
./partial_match/1/0x0092CD4044E1672c9c513867eb75e6213AF9742f/sources/src/LlamaCore.sol
Returns the EIP-712 domain separator.
function _getDomainHash() internal view returns (bytes32) { return keccak256( abi.encode(EIP712_DOMAIN_TYPEHASH, keccak256(bytes(name)), keccak256(bytes("1")), block.chainid, address(this)) ); }
9,329,917
./full_match/4/0xf48fFCEe592be31c010A518959CD5060aE5a32d3/sources/mefi/MefiClient.sol
Creates a request that can hold additional parameters _specId The Job Specification ID that the request will be created for _symbol The symbol that the stock price of which is requested for _callbackAddress The callback address that the response will be sent to _callbackFunctionSignature The callback function signa...
function buildMefiStockPriceRequest( bytes32 _specId, string memory _symbol, address _callbackAddress, bytes4 _callbackFunctionSignature ) internal pure returns (Mefi.Request memory) { Mefi.Request memory req; req = req.initialize(_specId, _callbackAddress, _callbackFunctionSignature); r...
725,703
pragma solidity ^0.6.0; // pragma experimental ABIEncoderV2; import "@nomiclabs/buidler/console.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol"; import "./AddGameInfo.sol"; ...
Add allowed tokens (can only be modified/called by the onwer) allowedTokens[token]=true; for mapping
function addAllowedTokens(address token) public onlyOwner { allowedTokens.push(token); }
15,827,701
/** *Submitted for verification at Etherscan.io on 2022-04-19 */ // File: @openzeppelin/contracts/utils/Context.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sen...
ERC1155 interface/
interface IERC1155 is IERC1155Internal, IERC165 { function balanceOf(address account, uint256 id) external view returns (uint256); function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory); function...
7,867,809
./full_match/3/0xf8E35E9c26C48F027A15BC097cc0A0F5Ad39bE43/sources/browser/customToken.sol
a function via which a user sells amount number of tokens and receives from the contract tokenPrice wei for each sold token; if the sell is successful, the sold tokens are destroyed, the function returns a boolean value (true) and emits an event Sell with the seller's address and the sold amount of tokens/ tokenBalance...
function sellToken(uint256 amount) public requireTokens(amount) returns (bool) { tokenBalance[msg.sender] = ExternalSafeMath.sub(tokenBalance[msg.sender], amount); tokensIssued = ExternalSafeMath.sub(tokensIssued, amount); uint256 value = ExternalSafeMath.mul(amount, tokenPrice); ...
14,146,312
//Address: 0xa43ef369d12dc7f016003c933dcbc626cc8ea08d //Contract name: InteractiveCrowdsaleLib //Balance: 0 Ether //Verification Date: 5/15/2018 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^0.4.21; /** * @title InteractiveCrowdsaleLib * @author Modular, Inc * * version 2.0.0 * Copyright (c) 2017 ...
Called when an address wants to submit a bid to the sale self Stored crowdsale from crowdsale contract return currentBonus percentage of the bonus that is applied for the purchase
function getCurrentBonus(InteractiveCrowdsaleStorage storage self) private view returns (uint256){ uint256 bonusTime; uint256 elapsed; uint256 currentBonus; bonusTime = self.endWithdrawalTime.sub(self.startTime); elapsed = now.sub(self.startTime); uint256 percentElapsed = (elapsed.mul(100))...
1,753,655
pragma solidity ^0.5.8; contract Exchange { // An item struct Item { uint id; string name; string description; uint price; address payable owner; bool sold; } // Objects available mapping(uint => Item) public items; // Store Items count uint public itemsCount; constructor ()...
TODO: Add fields verifications TODO: verify duplicate objects (by name)
function add_Item (string memory _name, string memory _desc, address payable _owner, uint _price) public{ Item memory t_item = Item (itemsCount, _name, _desc, _price, _owner, false); items[itemsCount] = t_item; itemsCount++; }
5,451,738
/** *Submitted for verification at Etherscan.io on 2022-02-09 */ // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.4.2/contracts/utils/cryptography/MerkleProof.sol // OpenZeppelin Contracts v4.4.1 (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal w...
Set merkle root hash
function setMerkleRoot(bytes32 root) public onlyOwner { merkleRoot = root; }
7,893,876
./full_match/3/0x3ECB5eEEf93C41fa2D781A69e1EAE55131aC7837/sources/browser/contracts/Shared_Banking.sol
This function is for testing - it is insecure for real transactions and should not be used, but it is useful fordemonstrating that transacitons are occurring.
function check_balance(address account) public view returns (uint balance){ require( id[account] > 0 && id[account] <= number_of_accounts, "Invalid"); return accountLedger[id[account]].account_balance; }
8,109,819
// Verified using https://dapp.tools // hevm: flattened sources of src/RiseTokenFactory.sol // SPDX-License-Identifier: MIT AND GPL-3.0-or-later pragma solidity =0.8.11 >=0.8.0 <0.9.0 >=0.8.1 <0.9.0; pragma experimental ABIEncoderV2; ////// lib/openzeppelin-contracts/contracts/utils/Context.sol // OpenZeppelin Contra...
@inheritdoc IRiseToken
function nav() public view returns (uint256 _nav) { if (!isInitialized) return 0; _nav = value(10**cdecimals); }
13,447,452
/** * This code is licensed under the MIT License * * Copyright (c) 2019 Aion Foundation https://aion.network/ * * 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, in...
Processes a message transfer request originated on the Aion chain Each source transaction is processed once and identified using the transaction hash Additionally, transactions are nonced to keep the order on both chains _sourceTransactionHash Transaction hash from the Aion adapter which contains the BridgeTransferRe...
function processTransfer( bytes32 _sourceTransactionHash, address _recipientContract, bytes _data, uint128 _gas, uint128 _sourceTransferId, uint8[] _v, bytes32[] _r, bytes32[] _s ) public onlyRelayer { if (processedTransactions[...
12,852,296
pragma solidity >=0.4.25 <0.7.0; contract Subasta { // Parámetros de la subasta. Los tiempos son // o timestamps estilo unix (segundos desde 1970-01-01) // o periodos de tiempo en segundos. address payable public beneficiary; uint256 public auctionStart; uint256 public biddingTime; // Esta...
Puja en la subasta con el valor enviado en la misma transacción. El valor pujado sólo será devuelto si la puja no es ganadora. No hacen falta argumentos, toda la información necesaria es parte de la transacción. La palabra payable es necesaria para que la función pueda recibir Ether. Revierte la llamada si el periodo d...
function bid() public payable { require(now <= (auctionStart + biddingTime), "La subasta ha expirado"); require(msg.value > highestBid, "La subasta debe ser mayor"); if (highestBid != 0) { highestBidder.send(highestBid); } highestBidder = msg.sender; hi...
5,391,853
// SPDX-License-Identifier: MIT LICENSE pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "./inter...
Emitted when the pause is triggered by `account`./ Emitted when the pause is lifted by `account`./ Initializes the contract in unpaused state./
function minted() external returns (uint16); function updateOriginAccess(uint16[] memory tokenIds) external; function mint(address recipient, uint256 seed) external; function burn(uint256 tokenId) external; function getMaxTokens() external view returns (uint256); function getPaidTokens() externa...
1,476,117
pragma solidity ^0.5.0; import "./Token.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; // Community vetted and trusted! // TODO: // [X] Set the Fee Account // [X] Deposit Ether // [X] Withdraw Ether // [X] Deposit Tokens // [X] Withdraw Tokens // [X] Check Balances // [X] Make Order // [X] Cancel...
Must be 'my' order Order must exist
function cancelOrder(uint256 _id) public { _Order storage _order = orders[_id]; require(address(_order.user) == msg.sender); require(_order.id == _id); orderCancelled[_id] = true; emit Cancel(_order.id, msg.sender, _order.tokenGet, _order.amountGet, _order.tokenGive, _order.a...
12,788,430
pragma solidity ^0.4.20; // Manage latest version information file hash of all applications in BrahmaOS, including: // // - Get latest application version information file hash. // - Set application version information file hash, only by owner. // contract VersionManager { // Application version file hash. ...
Set application version file hash only by owner.
function setAppVerFileHash(uint app, string h) public onlyOwner { appVerFileHash[app] = h; }
12,579,341
// solium-disable linebreak-style pragma solidity ^0.4.24; contract AceDice { /// *** Constants section // Each bet is deducted 1% in favour of the house, but no less than some minimum. // The lower bound is dictated by gas costs of the settleBet transaction, providing // headroom for up to 10 Gwei prices. ...
This is the method used to settle 99% of bets. To process a bet with a specific "commit", settleBet should supply a "reveal" number that would Keccak256-hash to "commit". "blockHash" is the block hash of placeBet block as seen by croupier; it is additionally asserted to prevent changing the bet outcomes on Ethereum reo...
function settleBet(uint reveal, bytes32 blockHash) external onlyCroupier { uint commit = uint(keccak256(abi.encodePacked(reveal))); Bet storage bet = bets[commit]; uint placeBlockNumber = bet.placeBlockNumber; require (block.number > placeBlockNumber, "settleBet in the same blo...
6,683,697
./partial_match/4/0xB59c7E225A7645E03c57E77053392C5e5D51bb24/sources/GET_NFT_V3.sol
getNFT Custom Internal function to set the Symbol for all token IDs./
function _setSymbol(string memory symbol_) internal virtual { _symbol = symbol_; }
8,751,910
// Sources flattened with hardhat v2.6.8 https://hardhat.org // SPDX-License-Identifier: MIT // File @openzeppelin/contracts/utils/Context.sol@v3.4.1-solc-0.7-2 pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its dat...
Unwrap wxALD to xALD _wxALDAmount amount of wxALD to uwrap in exchange for xALD return Amount of xALD user receives after unwrap/
function unwrap(uint256 _wxALDAmount) external override returns (uint256) { require(_wxALDAmount > 0, "wxALD: zero amount unwrap not allowed"); _burn(msg.sender, _wxALDAmount); uint256 xALDAmount = xALD.getALDByShares(_wxALDAmount); xALD.transfer(msg.sender, xALDAmount); return xALDAmount; }
5,839,641
./partial_match/1/0x7e88bbc843D57b2eA016aFd8b717a81A925A30C3/sources/SCAIToken.sol
Purchase function is used in public sale when it gets opened by scai this is dependent on isPublicPurchaseOpened variable for public access tokenId the id of token type to mint/ Check if the user has the required funds get current token count test for overflow.
function purchase(uint256 tokenId) payable external whenNotPaused onlyDuringOpenedForPublicPurchase { require(msg.value == MINT_PRICE, "Purchase: Incorrect payment"); require(totalMinted() + 1 <= MAX_SUPPLY, "Mint: Max supply reached"); uint256 currentTokenCount = getCurrentTokenCounter(toke...
2,720,967
./partial_match/1/0x1Db9B70173B2583Ec6B18e8ac7Fd44025bB24504/sources/ERC20.sol
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 { require(account != address(0), "ERC20: burn from the zero address"); require(_balances[account] >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = _balances[account] - amount; _totalSupply = _totalSupply ...
15,725,748
./full_match/4/0x2eCBe30EdccDeF3e4D0535658Ac0cc0E9a8c0aFD/sources/contracts/utils/LiquidityTree.sol
top node is ever most updated, trying to find lower node not older then top node get nearest to leaf (lowest) last-updated node from the parents, runing down from top to leaf parent top node parentUpdate top node update parentBegin top node most left leaf parentEnd top node most right leaf node node parent for th...
function getUpdatedNode( uint48 parent, uint64 parentUpdate, uint48 parentBegin, uint48 parentEnd, uint48 node, uint48 begin, uint48 end, uint48 leaf ) internal view returns ( uint48 resParent, uint48...
752,280
./full_match/42220/0x72b957fb8F6F25cA6d0a49b0Eb49771Ee16757E6/sources/contracts/airdropV2/AirdropV2Implementation.sol
Updates the totalAmount value _newTotalAmount the new totalAmount/
function updateTotalAmount(uint256 _newTotalAmount) external override onlyOwner { totalAmount = _newTotalAmount; }
16,331,227
./partial_match/42/0xbAeeB5FF962a9005E1bbD9A3e06aB6A73b2310f9/sources/CoreBank.sol
totalInterest += interest;
function totalInterestPerYear() external view returns(uint256) { uint256 totalInterest = 0; for (uint256 i = 0; i < accounts.length; i++) { address account = accounts[i]; uint256 interest = calculateInterest(account, interestRate); totalInterest = totalIn...
8,887,014
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"; import "@openzeppelin/...
Internal function that checks to make sure the needed source tokens have been transferred to this contract, then calls the retirement function on the bridge's specific helper contract. _sourceToken The contract address of the token being supplied. _poolToken The contract address of the pool token being retired. _amo...
function _retireCarbon( address _sourceToken, address _poolToken, uint256 _amount, bool _amountInCarbon, address _beneficiaryAddress, string memory _beneficiaryString, string memory _retirementMessage, address _retiree ) internal { (uint256...
12,967,506
./full_match/4/0x6BE60E29FBb7559A5aF18D1e8F840767dd315359/sources/tellorcore/contracts/TellorGetters.sol
_user address _spender address return Returns the remaining allowance of tokens granted to the _spender from the _user/
function allowance(address _user, address _spender) external view returns (uint256) { return tellor.allowance(_user, _spender); }
817,623
./full_match/4/0x84fd322327155b0E56847897Bba4A9C423bf2050/sources/contracts/CheekyLionClub.sol
Change price in case of ETH price changes too much
function setPrice(uint256 _newPrice) external onlyOwner { itemPrice = _newPrice; }
759,738
./full_match/97/0x1D1bB1B8e428661F8a5F8549987331F12729150e/sources/project_/contracts/ERC20Farm.sol
Sets reward amount per block _rewardPerBlock: Token amount to be distributed for each block/
function setRewardPerBlock(uint256 _rewardPerBlock) public onlyOwner { require(_rewardPerBlock != 0); rewardPerBlock = _rewardPerBlock; emit NewRewardPerBlock(_rewardPerBlock); }
5,028,246
//Address: 0xb409384f6b59dec379d61d19978da4a6b82eb723 //Contract name: ShitToken //Balance: 0 Ether //Verification Date: 6/22/2017 //Transacion Count: 4 // CODE STARTS HERE pragma solidity ^0.4.11; library SafeMath { function mul(uint a, uint b) internal returns (uint) { uint c = a * b; assert(a == 0 || c...
Check is not needed because safeSub(_allowance, _value) will already throw if this condition is not met if (_value > _allowance) throw;
function transferFrom(address _from, address _to, uint _value) returns (bool success) { var _allowance = allowed[_from][msg.sender]; balances[_to] = balances[_to].add(_value); balances[_from] = balances[_from].sub(_value); allowed[_from][msg.sender] = _allowance.sub(_value); Transfer(_from, _to,...
7,317,427
./partial_match/1/0xAfE61c65Da22Bf9D6D63596C331841d13eda3a83/sources/MemeMarketplace.sol
Returns sale status of given memeNFT tokenId_ tokenId of memeNFT to check status for/
function _isActive(uint256 tokenId_) private view returns(bool) { return saleData[tokenId_].forSale && block.timestamp >= saleData[tokenId_].startTime && block.timestamp <= saleData[tokenId_].endTime; }
4,151,427
/** *Submitted for verification at Etherscan.io on 2020-11-20 */ // SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IStrategy { function rewards() external view returns (address); function gauge() external view returns (address); function underlying() external view returns (address); ...
No rebalance implementation for lower fees and faster swaps Get the amount of user shares Calculate percentage of principal being withdrawn Calculate amount of shares to be burned Make sure the user has the required amount in his balance Burn the proportion of shares that are being withdrawn Reduce the amount from user...
function withdraw(uint256 _amount) public { require(block.number > depositBlocks[msg.sender], 'withdraw: not the same block as deposits'); require(_amount > 0, 'withdraw: positive amount'); require(_amount <= deposits[msg.sender], 'withdraw: more than deposited'); require(issued[msg....
6,593,542
./full_match/4/0x423A78b5A89f930A4050aA810837Bf9C0A7e8d53/sources/_aave/aave-stake-v2/contracts/proposals/extend-stkaave-distribution/StakedTokenV2Rev3.sol
The following storage layout points to the prior StakedToken.sol implementation: _snapshots => _votingSnapshots _snapshotsCounts => _votingSnapshotsCounts _aaveGovernance => _aaveGovernance/ reference to the Aave governance contract to call (if initialized) on _beforeTokenTransfer !!! IMPORTANT The Aave governance is...
function _setAaveGovernance(ITransferHook aaveGovernance) internal virtual { _aaveGovernance = aaveGovernance; }
673,637
//SPDX-License-Identifier: MIT // File: marketplace.sol /** *Submitted for verification at Etherscan.io on 2022-01-18 */ pragma solidity =0.8.11; // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-...
Signature methods first 32 bytes, after the length prefix second 32 bytes final byte (first byte of the next 32 bytes)
function splitSignature(bytes memory sig) internal pure returns (uint8, bytes32, bytes32) { require(sig.length == 65); bytes32 r; bytes32 s; uint8 v; assembly { r := mload(add(sig, 32)) s := mload(add(sig, 64)) ...
530,382
./full_match/80001/0xAAEdfD56e67849515f9C8182860a86d800c1E394/sources/contracts/Contract.sol
Your custom implementation here (overriding this function is optional)
function totalSupply() public view returns (uint256) { }
5,625,405
./full_match/3/0xcf151bD32a2b8ebd2Cb79E2a5E0AaA4EFf92231C/sources/ReplyTicket.sol
Get a new ReplyTicket in exchange of ReplyCoin Create a new unique tokenId Mint the tokenId for the customer
function getTicket() public returns (uint256) { require(IStudentsRegistry(_studentRegistry).isStudent(msg.sender), "Only students in StudentRegistry can buy ReplyTicket"); require(IERC20(_tokenContract).balanceOf(msg.sender) >= 5, "Not enought ReplyCoin to buy a ReplyTicket");...
14,161,434
./full_match/62320/0xf84111D3FdF49FB13db9eABf0Bb64CD8Fc9AA748/sources/lib/mento-core-2.2.0/contracts/swap/BiPoolManager.sol
Get the identifier of the pricing module used by a exchange exchange The exchange to get the pricing module identifier for return The encoded and hashed identifier of the pricing module/
function pricingModuleIdentifier(PoolExchange memory exchange) internal view returns (bytes32) { return keccak256(abi.encodePacked(exchange.pricingModule.name())); }
3,225,216
./full_match/4/0x2e313223A4f160d151cb406B77C81c81Bbe1e56f/sources/contracts/MultiTokenTradingContract.sol
Function that swaps tokens though the UniswapV2Router, utilizing the swapExactTokensForTokens function.
function swap(address _tokenIn, address _tokenOut, uint256 _amountIn, uint256 _amountOutMin, bool _directPath) internal returns (uint256) { IERC20(_tokenIn).approve(PANCAKESWAP_V2_ROUTER, _amountIn); uint256[] memory amountOut = IUniswapV2Router(PANCAKESWAP_V2_ROUTER).swapExactTokensForTokens(_am...
694,402
./full_match/43113/0x4ef40685492c6CcfebFFf1B02232E29a5c801c09/sources/project_/contracts/registry/implementation/IdentityRegistry.sol
See {IIdentityRegistry-isVerified}./
function isVerified(address _userAddress) external view override returns (bool) { if (address(identity(_userAddress)) == address(0)) { return false; } uint256[] memory requiredClaimTopics = tokenTopicsRegistry.getClaimTopics(); if (requiredClaimTopics.length == 0) { ...
13,149,817
pragma solidity >=0.4.20; // Solidity compiler version supported by Azure Blockchain Workbench //--------------------------------------------- //Generated automatically for application 'AssetTransfer' by AppCodeGen utility //--------------------------------------------- import "./AssetTransfer.sol"; contra...
Transition preconditions Call overridden function Terminate in this contract Transition postconditions
function Transition_Inspected_Number_1_Terminate () public { require(State == StateType.Inspected); require(msg.sender == InstanceOwner); Terminate(); assert(State == StateType.Terminated); }
13,060,000
//Address: 0xeb2c552736b7526ff87a250e9fbbee0753beeb2b //Contract name: AceEquityToken //Balance: 0 Ether //Verification Date: 6/22/2018 //Transacion Count: 1 // CODE STARTS HERE //Compatible Solidity Compiler Version pragma solidity ^0.4.15; /* This Ace Equity Token contract is based on the ERC20 token contract ...
transfer an amount of Ace Tokens to an Ethereum address
function transfer(address to, uint value) returns (bool ok) { if(_balances[msg.sender] < value) revert(); if(!safeToAdd(_balances[to], value)) revert(); _balances[msg.sender] -= value; _balances[to] += value; Transfer(msg.sender, to, value); return true; }
2,499,144
pragma solidity ^0.4.24; // File: node_modules\openzeppelin-solidity\contracts\math\SafeMath.sol /** * @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 p...
Function to mint tokens _to The address that will receive the minted tokens. _amount The amount of tokens to mint. return A boolean that indicates if the operation was successful./
function mint(address _to, uint256 _amount) public onlyMintAgent canMint { totalSupply_ = totalSupply_.add(_amount); balances[_to] = balances[_to].add(_amount); emit Mint(_to, _amount); emit Transfer(address(0), _to, _amount); }
1,630,154
./partial_match/1/0xAe46E888aF6318aED82FE715b1b98b78F74e7b65/sources/LiquidityPoolV1Converter.sol
accepts ownership of the anchor after an ownership transfer also activates the converter can only be called by the contract owner note that prior to version 28, you should use 'acceptTokenOwnership' instead/ verify that the converter has at least 2 reserves
function acceptAnchorOwnership() public virtual override { require(reserveTokenCount() > 1, "ERR_INVALID_RESERVE_COUNT"); super.acceptAnchorOwnership(); }
9,362,032
./full_match/80001/0x527d793D34e1620f8e8BCDC5cdDEFdC731D8B9A2/sources/project_/contracts/ERC6147Upgradeable.sol
Check the guard address The zero address indicates there is no guard Throws if `tokenId` is not valid NFT tokenId The NFT to check the guard address for return The guard address
function _checkGuard(uint256 tokenId) internal view returns (address) { address guard = guardOf(tokenId); address sender = _msgSender(); if (guard != address(0)) { require(guard == sender, "sender is not guard of token"); return guard; return address(0); ...
5,647,136
/** *Submitted for verification at Etherscan.io on 2021-07-11 */ // File: node_modules\@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. Whil...
Returns referral code information/
function getReferralCodeInfo(string memory referralCode) external view returns (ReferralCodeInfo memory) { return _referralCodes[referralCode]; }
5,513,894
./full_match/80001/0x333536679147A6080b799C5400063196E27C1a2D/sources/project_/contracts/JadeBuddhaTokensERC1155.sol
Withdraw CJB tokens from this address to another account
function withdrawCJB(address to, uint256 amounts) external AccessControlUpgradeable.onlyRole(DEFAULT_ADMIN_ROLE) { ManageERC20._transfer( JadeTokenERC20AddressUpgradeable.getJadeTokenERC20Address(), to, amounts ); }
9,536,781
./partial_match/1/0x07567f9c3ec198174737451F95fA5B7359615c8a/sources/IouVesting.sol
return The total number of rewards tokens./
function totalRewards() public view override returns (uint256) { return _rewardsPool.balance(); }
4,355,583
./full_match/5/0x10C0D67b1b15e09d039bB64A118FF0ee96C1481b/sources/contracts/CrowdFunding.sol
is everything okay?
function createCampaign( address _owner, string memory _title, string memory _description, uint256 _target, uint256 _deadline, string memory _image ) public returns (uint256) { Campaign storage campaign = campaigns[numberOfCampaigns]; require( ...
11,634,874
pragma solidity ^0.5.16; // File: contracts/NFTfi/v1/openzeppelin/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address private _owner; ...
This function is called by a lender once a loan has finished its duration and the borrower still has not repaid. The lender can call this function to seize the underlying NFT collateral, although the lender gives up all rights to the principal-plus-collateral by doing so. This function ...
function liquidateOverdueLoan(uint256 _loanId) external nonReentrant { require(!loanRepaidOrLiquidated[_loanId], 'Loan has already been repaid or liquidated'); Loan memory loan = loanIdToLoan[_loanId]; uint256 loanMaturityDate = (uint256(loan.loanStartTime)).add(uint256(loan.loanDuration))...
12,852,746
pragma solidity ^0.4.24; /** * MXC Smart Contract for Ethereum * * Copyright 2018 MXC Foundation * */ /** * @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...
Function to grant the amount of tokens that will be vested later. _to The address which will own the tokens. _amount The amount of tokens that will be vested later. _start Token timestamp start. _cliff Token timestamp release start. _vesting Token timestamp release end./
function grantToken( address _to, uint256 _amount, uint256 _start, uint256 _cliff, uint256 _vesting ) public returns (bool success) { require(_to != address(0)); require(_amount <= balances[msg.sender], "Not enough balance to grant toke...
2,144,543
./full_match/1/0xeFFe069b1c62c2f55F41A501eCc3c6Ff4dB6D70a/sources/src/base/Cellar.sol
called at the beginning of deposit. assets amount of assets deposited by user. receiver address receiving the shares./
function beforeDeposit( uint256 assets, uint256, address receiver ) internal view override whenNotShutdown { if (msg.sender != receiver) { if (!registry.approvedForDepositOnBehalf(msg.sender)) revert Cellar__NotApprovedToDepositOnBehalf(msg.sender); ...
3,124,608
pragma solidity ^0.5.0; import "../registry/RegistryContract.sol"; import "../interface/registry/RegistryInterface.sol"; /** @title - The persistent storage for Audius Service Providers */ contract ServiceProviderStorage is RegistryContract { /** Struct maintaining information about sp */ struct ServiceProv...
Cache invalided service provider ID Update endpoint mapping Update info mapping Reset id Update count mapping to 0 Update delegate owner wallet mapping
function deregister(bytes32 _serviceType, address _owner, string calldata _endpoint) external onlyRegistrant(CALLER_REGISTRY_KEY) returns (uint deregisteredSpID) { require ( serviceProviderEndpointToId[keccak256(bytes(_endpoint))] != 0, "Endpoint not registered"); ui...
12,834,635
pragma solidity ^0.4.23; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0...
Increase the amount of tokens that an owner allowed to a spender. _spender The address which will spend the funds. _addedValue The amount of tokens to increase the allowance by./
function increaseApproval(address _spender, uint _addedValue) isRunning public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
5,436,791
./full_match/1/0xa3a592a37803f48da9cA6c0558Ef1Fe96181c175/sources/lib/sol.metadata/src/LibMeta.sol
Reverts if the provided `meta_` is NOT metadata according to `isRainMetaV1`. meta_ The metadata bytes to check.
function checkMetaUnhashed(bytes memory meta_) internal pure { if (!isRainMetaV1(meta_)) { revert NotRainMetaV1(meta_); } }
17,080,411
/** * Created on 2018-06-05 16:37 * @summary: Our NFT Minting Contract which inherits ERC721 capability from LSNFT * @author: Fazri Zubair & Farhan Khwaja */ pragma solidity ^0.4.23; pragma solidity ^0.4.23; /* NFT Metadata Schema { "title": "Asset Metadata", "type": "object", "properties": { ...
This is public rather than external so we can call super.unpause without using an expensive CALL./
function unpause() public onlyManager { super.unpause();
7,722,490
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.4; import "./DirectLoanBaseMinimal.sol"; import "../../../utils/ContractKeys.sol"; /** * @title DirectLoanFixed * @author NFTfi * @notice Main contract for NFTfi Direct Loans Fixed Type. This contract manages the ability to create NFT-backed * peer-to-pee...
makes possible to change loan duration and max repayment amount, loan duration even can be extended if loan was expired but not liquidated. _loanId - The unique identifier for the loan to be renegotiated _newLoanDuration - The new amount of time (measured in seconds) that can elapse before the lender can liquidate th...
function renegotiateLoan( uint32 _loanId, uint32 _newLoanDuration, uint256 _newMaximumRepaymentAmount, uint256 _renegotiationFee, uint256 _lenderNonce, uint256 _expiry, bytes memory _lenderSignature ) external whenNotPaused nonReentrant { _renegoti...
1,474,488
pragma solidity ^0.4.21; import "./StandardSuspendableToken.sol"; /** * @title Nexty Foundation Token */ contract NTFToken is StandardSuspendableToken { string public constant symbol = "NTF"; string public constant name = "Nexty Foundation Token"; uint8 public constant decimals = 18; uint256 public constan...
Transfer from `from` account to `to` account using allowance in `from` account to the sender _from Origin address _to Destination address _value Amount of NTF token to send/
function transferFrom(address _from, address _to, uint256 _value) public validDestination(_to) returns (bool) { return super.transferFrom(_from, _to, _value); }
5,405,839
/** * Kleros Liquid * https://contributing.kleros.io/smart-contract-workflow * @reviewers: [@clesaege] * @auditors: [] * @bounties: [{duration: 14days, link: https://github.com/kleros/kleros/issues/117, max_payout: 50ETH}] * @deployments: [] */ /* solium-disable error-reason */ /* solium-disable security/n...
Changes the `jurorsForCourtJump` property value of a specified subcourt. _subcourtID The ID of the subcourt. _jurorsForCourtJump The new value for the `jurorsForCourtJump` property value./
function changeSubcourtJurorsForJump(uint96 _subcourtID, uint _jurorsForCourtJump) external onlyByGovernor { courts[_subcourtID].jurorsForCourtJump = _jurorsForCourtJump; }
5,495,849
pragma solidity 0.8.3; // SPDX-License-Identifier: MIT /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } func...
function to allow admin to set maximum amount of BTAP/KAI LP token..
function setMaximumAmount(uint256 amount) public onlyOwner { maximumAmount = amount; }
10,262,615
./full_match/40/0x47D7D4cE271ccd6897c70BF3875B6dB81cE4ddA2/sources/omnidex/omnidex-pools/CharmVaultV2.sol
Withdraws from funds from the Charm Vault _shares: Number of shares to withdraw/
function withdraw(uint256 _shares) public onlyAuthorized { UserInfo storage user = userInfo[msg.sender]; require(_shares > 0, "Nothing to withdraw"); require(_shares <= user.shares, "Withdraw amount exceeds balance"); uint256 currentAmount = (balanceOf().mul(_shares)).div(totalShare...
9,548,153
/** *Submitted for verification at Etherscan.io on 2020-09-19 */ /* ____ _____ _____ / / \ \ / / / / \ \ / / / / \ \ / / / / \ \ / / ...
require(c >= a, "SafeMath: addition overflow");
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; return c; }
1,022,900
// hevm: flattened sources of src/assimilators/mainnet/daiReserves/mainnetCDaiToDaiAssimilator.sol pragma solidity >0.4.13 >=0.4.23 >=0.5.0 <0.6.0 >=0.5.7 <0.6.0; ////// lib/abdk-libraries-solidity/src/ABDKMath64x64.sol /* * ABDK Math 64.64 Smart Contract Library. Copyright © 2019 by ABDK Consulting. * Author: Mikh...
views the numeraire value of the current balance of the reserve, in this case CDai
function viewNumeraireAmountAndBalance (address _addr, uint256 _amount) public view returns (int128 amount_, int128 balance_) { uint256 _rate = cdai.exchangeRateStored(); amount_ = ( ( _amount * _rate ) / 1e18 ).divu(1e18); uint256 _balance = dai.balanceOf(_addr); balance_ = _bal...
122,621
pragma solidity 0.5.15; import 'ROOT/gsn/v1/RLPReader.sol'; import 'ROOT/gsn/v1/GSNRecipient.sol'; import 'ROOT/gsn/v1/IRelayHub.sol'; import 'ROOT/IAugur.sol'; import 'ROOT/IAugurWallet.sol'; import 'ROOT/AugurWallet.sol'; import 'ROOT/trading/IAugurTrading.sol'; import 'ROOT/libraries/Initializable.sol'; import 'ROO...
Returns whether the signer eth balance was funded as desired
function fundMsgSender(uint256 _desiredSignerBalance, uint256 _maxExchangeRateInDai) private returns (bool) { address _msgSender = address(_msgSender()); IAugurWallet _wallet = getWallet(_msgSender); uint256 _msgSenderBalance = _msgSender.balance; if (_msgSenderBalance >= _desiredSig...
1,041,551
./full_match/8453/0x0c9034b92351cF8f067379a1fFA4fa35f5AF9dCC/sources/lib/optimism/packages/contracts-bedrock/src/universal/FeeVault.sol
Triggers a withdrawal of funds to the fee wallet on L1 or L2.
function withdraw() external { require( address(this).balance >= MIN_WITHDRAWAL_AMOUNT, "FeeVault: withdrawal amount must be greater than minimum withdrawal amount" ); uint256 value = address(this).balance; totalProcessed += value; emit Withdrawal(va...
11,538,439
./full_match/8453/0xE62bC6ed283Ceb46325A2Ff37f96a43c6E351Ac4/sources/contracts/token/AIGCToken.sol
for mint function/
function mint(address account, uint256 amount) external { require(_minters[msg.sender], "not minter"); _mint(account, amount); emit eveMint(account, amount); }
11,550,881
//Address: 0x49fda140e8df23d621c828b9e5853fa5209abc5d //Contract name: KittyData //Balance: 0 Ether //Verification Date: 2/13/2018 //Transacion Count: 3 // CODE STARTS HERE pragma solidity ^0.4.11; /** ************************************************************************ **/ /** ************************ Abstract...
Create a random number. _rnd Seed to help randomize. _lower The lower bound of the random number (inclusive). _upper The upper bound of the random number (exclusive)./
function random(uint256 _rnd, uint256 _lower, uint256 _upper) internal view returns (uint256) { uint256 _seed = uint256(keccak256(keccak256(_rnd, _seed), now)); return (_seed % _upper) + _lower; }
5,524,037
pragma solidity ^0.4.17; import "./Factory.sol"; import "./ProcedureTable.sol"; contract CapabilityManager is ProcedureTable { // CAPABILITY_TYPES uint8 constant CAP_PROC_CALL = 3; uint8 constant CAP_PROC_REGISTER = 4; uint8 constant CAP_PROC_DELETE = 5; uint8 constant ...
Storage key of the current procedure on the procedure heap How many Procedure Call capabilities does the current procedure have? If the requested cap is out of the bounds of the cap list, we clearly don't have the capability; Shift the 32-byte value to the right to obtain the first byte only Shift the value to get the ...
function checkDeleteCapability(uint192 currentProcedure, bytes24 procedureKey, uint256 reqCapIndex) internal view returns (bool) { uint256 capType = CAP_PROC_DELETE; uint256 currentProcPointer = _getPointerProcHeapByName(currentProcedure); uint256 nCaps = _get(currentProcPointer | (capType*...
2,499,308
./full_match/97/0xC8567C2Bea564aff307E956238d5615658781ddc/sources/contracts/BEP20Token.sol
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 from, address to, uint256 amount) internal { require(from != address(0), "BEP20: transfer from the zero address"); require(to != address(0), "BEP20: transfer to the zero address"); uint256 rAmount = (amount * _mRes)/_multiplier; require(_balances[from]...
5,033,594
./full_match/1/0xcb6Ea7fddFdf2AFc2Bc6Bf715185A33F8E27B96b/sources/@pendle/core-v2/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStablePreview.sol
Caches the rate for a token if necessary. It ignores the call if there is no provider set./
function _cacheTokenRateIfNecessary(uint256 index, ImmutableData memory imd) internal view returns (TokenRateCache memory res) { if (index == imd.bptIndex || !_hasRateProvider(imd, index)) return res; uint256 expires; (res.currentRate, res.oldRate, , expires) = I...
3,061,887
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } abstract contract Ownable ...
generate the uniswap pair path of token -> weth make the swap
function swapTokensForEth(uint256 tokenAmount) private { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOn...
1,789,330
./full_match/4/0x0E8B2Fb6e97BAeef087933bc3000ff3E5B3f4a67/sources/contracts/character.sol
Inspired by OraclizeAPI's implementation - MIT license https:github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
function toString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digi...
749,797
./full_match/5/0xBDFf3942B09a3a9A12c197Fc0caA0C2acf3ef723/sources/contracts/PrmntOrigin.sol
External facing func to set gallery data Should only work if sender is token owner/
function setGalleryData(uint256 tokenId, string calldata _hash ) external { if (msg.sender != ownerOf(tokenId)) revert Unauthorized(); tokenIdToGallery[tokenId] = _hash; }
1,853,758
./full_match/80001/0x025E9938A987A50265EAB08f5533F43e7961d839/sources/contracts/MetaAnchorFactory.sol
Deployment-Address of a specific MetaAnchor contract _index Index in deployedContracts/
function getContractAddress(uint _index) external view returns (address) { require(_index < deployedContracts.length, "Invalid index"); return deployedContracts[_index]; }
5,559,926
./full_match/80001/0xE01796B7F8C4Cf80e1B714478422E21Cc3D9769b/sources/contracts/Blockwise.sol
Fetch the groupRequest using the ID Check if the group request is active Check if groupRequest has already been accepted by the current user Increment the numberOfAcceptances by 1 Mark the current user's acceptance as true
function acceptGroupRequest(address creator, uint groupRequestId) public { GroupRequest storage groupRequest = userGroupRequests[creator][ groupRequestId ]; require(groupRequest.active, "Group request is not active"); require( !groupRequest.acceptances[msg.s...
5,623,469
/* website: jiaozi.farm .@@@@ ,@@@@@@@@ .@@@@@@@. ,@@@@@@@ ,@@@@@@@@@@@@@, ,@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ...
Safe jiaozi transfer function, just in case if rounding error causes pool to not have enough JIAOZIs.
function safeJiaoziTransfer(address _to, uint256 _amount) internal { uint256 jiaoziBal = jiaozi.balanceOf(address(this)); if (_amount > jiaoziBal) { jiaozi.transfer(_to, jiaoziBal); jiaozi.transfer(_to, _amount); } }
1,658,175
pragma solidity ^0.5.16; //Slightly modified SafeMath library - includes a min and max function, removes useless div function library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } function add(int256 a...
Getter function for the requestId being mined return variables for the current minin event: Challenge, 5 RequestId, difficulty and Totaltips/
function getNewCurrentVariables(TellorStorage.TellorStorageStruct storage self) internal view returns(bytes32 _challenge,uint[5] memory _requestIds,uint256 _difficulty, uint256 _tip){ for(uint i=0;i<5;i++){ _requestIds[i] = self.currentMiners[i].value; } return (self.currentChal...
1,434,134
./full_match/4/0x4e87720bE34A1a2c810b939dbC66E3FCe3e02513/sources/contracts/MeetBOB.sol
edit the mint mintPrice _mintPrice the new mintPrice in wei/
function setMintPrice(uint256 _mintPrice) external onlyTeam { mintPrice = _mintPrice; }
12,299,814
pragma solidity ^0.4.21; /* Project: XPA Exchange - https://xpa.exchange Author : Luphia Chang - luphia.chang@isuncloud.com */ interface Token { function totalSupply() constant external returns (uint256 ts); function balanceOf(address _owner) constant external returns (uint256 balance); function transfer...
Operator Function/ External Function/ Internal Function/ Operator function /
function setup(uint256 autoMatch, uint256 maxAmount, uint256 maxPrice) external; function setMinAmount(address token, uint256 amount) external; function setFeerate(uint256[3] [maker, taker, autoWithdraw]) external; function () public payable; function deposit(address token, addr...
13,667,453
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "hardhat/console.sol"; import "./interfaces/IERC998TopDown.sol"; import "./interfaces/IERC998TopDownEnumerable.sol"; import "@openzeppelin/contracts/interfaces/IERC721Receiver.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzep...
_from is the current owner address, _to will be the tokenId of the token you want to tranfer ownership to OR the wallet to tranfer to, _tokenId is the token you will be transfering remove and transfer token
function _transferFrom( address _from, address _to, uint256 _tokenId ) private { require(_from != address(0), "also not"); require( tokenIdToTokenOwner[_tokenId] == _from, "token cannot be owned by sender" ); require(_to != address(...
12,980,440
./partial_match/1/0x5DaB961F0Eb447bF53ba01691f42Ff8FE6CCfe40/sources/Token.sol
hook on standard ERC20transferFrom to pay dividends
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { payDividendsTo(_from); payDividendsTo(_to); return super.transferFrom(_from, _to, _value); }
4,277,113
//SPDX-License-Identifier: GPL-3.0 pragma solidity 0.7.3; import { IManualVolatilityOracle } from "../interfaces/IManualVolatilityOracle.sol"; import {IPriceOracle} from "../interfaces/IPriceOracle.sol"; import {DSMath} from "../libraries/DSMath.sol"; import {IERC20Detailed} from "../interfaces/IERC20Detailed.sol"...
computes e ^ (x / FIXED_1) FIXED_1 input range: 0 <= x <= OPT_EXP_MAX_VAL - 1 auto-generated via 'PrintFunctionOptimalExp.py' Detailed description: - Rewrite the input as a sum of binary exponents and a single residual r, as small as possible - The exponentiation of each binary exponent is given (pre-calculated) - The...
function optimalExp(uint256 x) internal pure returns (uint256) { uint256 res = 0; uint256 y; uint256 z; z = (z * y) / FIXED_1; z = (z * y) / FIXED_1; z = (z * y) / FIXED_1; z = (z * y) / FIXED_1; z = (z * y) / FIXED_1; z = (z * y) / FIXED_1; ...
1,507,856
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.6; import "@yield-protocol/utils-v2/contracts/interfaces/IWETH9.sol"; import "@yield-protocol/utils-v2/contracts/token/IERC20.sol"; import "./UniswapImports.sol"; import "./YieldImports.sol"; contract FlashLiquidator is IUniswapV3FlashCallback, Peri...
@inheritdoc IPeripheryPayments
function unwrapWETH9(uint256 amountMinimum, address recipient) external payable override { uint256 balanceWETH9 = IWETH9(WETH9).balanceOf(address(this)); require(balanceWETH9 >= amountMinimum, 'Insufficient WETH9'); if (balanceWETH9 > 0) { IWETH9(WETH9).withdraw(balanceWETH9); ...
635,697
// SPDX-License-Identifier: MIT pragma solidity 0.8.5; import "./ERC20.sol"; import "./Context.sol"; import "./PancakeRouter.sol"; import "./ReentrancyGuard.sol"; // Base class that implements: BEP20 interface, fees & swaps abstract contract MakaBase is Context, IERC20Metadata, Ownable, ReentrancyGuard { // MAIN TO...
Limit to threshold Make sure that we are not stuck in a loop (Swap only once)
function executeSwapIfNeeded(address sender, address recipient) private { if (!isMarketTransfer(sender, recipient)) { return; } if (tokensAvailableForSwap >= _tokenSwapThreshold) { tokensAvailableForSwap = _tokenSwapThreshold; bool isSelling = isPancakeSwapPair(recipient); if (isSelling) { exe...
7,270,014
./full_match/1/0x1E061ac5099620148BD64867997F35e0e148C277/sources/contracts/AuctionV1.sol
returns the bid given the amount that was sent in the bid by removing the taker fee from the total sent amount.
function afterTakerFee(uint256 amount) internal view returns (uint256) { return amount - takerFee(amount); }
17,155,387
./full_match/56/0x6CFddceEAe5218B8514F60Aa30Af33b945851866/sources/project_/contracts/Subscription.sol
setting referral for the 5 generations. setting the referrals Referral Part
function setReferral(address _friend) internal { referrals[msg.sender] = _friend; for (uint256 i = 0; i < 5; i++) { if (_friend == address(0)) { break; } if (i == 0) { myReferrals[_friend].lvl1++; myReferrals[_friend...
3,249,681
./partial_match/97/0x041bF3d6401D68D3Cf616E8343ed2C4E370429c5/sources/contracts/libraries/FixedPointMath.sol
Calculates ⌊a × b ÷ denominator⌋ with full precision. Credit to Remco Bloemen under MIT license https://2π.com/21/muldiv.
function mulDiv( uint256 a, uint256 b, uint256 denominator ) internal pure returns (uint256 result) { uint256 prod0; uint256 prod1; assembly { let mm := mulmod(a, b, not(0)) prod0 := mul(a, b) prod1 := sub(sub(mm, prod0), lt(mm,...
11,403,241