file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
//SPDX-License-Identifier: MIT /// @title ERC721 Speedrun AI pragma solidity ^0.8.0; import './common/ERC721Tradable.sol'; contract SpeedrunAI is ERC721Tradable { using Strings for uint256; // URIs string private IPFS_BASE = 'ipfs://'; string private placeholderURI; string private baseURI; uint256 private re...
Do the minting here/
function _doMint(address addr, uint256 amount) internal { for (uint256 i = 0; i < amount; i++) { _safeMint(addr, totalSupply + i); } totalSupply += amount; }
13,755,499
./full_match/43113/0x3a7D90487F8E6c8631317E1B812d020CE5bB1288/sources/src/LBToken.sol
Batch transfers `amounts` of `ids` from `from` to `to`. The `to` must not be the zero address and the `ids` and `amounts` must have the same length. from The address of the owner. to The address of the recipient. ids The list of token ids. amounts The list of amounts to transfer for each token id in `ids`./
function _batchTransferFrom(address from, address to, uint256[] calldata ids, uint256[] calldata amounts) internal checkLength(ids.length, amounts.length) notAddressZeroOrThis(to) { mapping(uint256 => uint256) storage fromBalances = _balances[from]; mapping(uint256 => uin...
7,117,395
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC7...
toggle token invisibility
function toggleInvisible(uint256 tokenId) external { require(ownerOf(tokenId) == _msgSender(), "Token owner only"); _invisibilities[tokenId] = !_invisibilities[tokenId]; }
5,493,863
./full_match/1/0x17DACA422F564133f94674bF493C818D8B58E4E2/sources/contracts/MinimalSFCoreParamAdjusterOverlay.sol
@notify Modify "latestExpectedCalls" for a FundedFunction targetContract The contract where the funded function resides targetFunction The signature of the funded function parameter Must be "latestExpectedCalls" val The new parameter value/
function modifyParameters(address targetContract, bytes4 targetFunction, bytes32 parameter, uint256 val) external isAuthorized { require(parameter == "latestExpectedCalls", "MinimalSFTreasuryCoreParamAdjusterOverlay/invalid-parameter"); adjuster.modifyParameters(targetContract, targetFunction, param...
3,174,534
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in exist...
Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have ...
function decreaseAllowance(address spender, uint256 subtractedValue) external virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = _allowances[owner][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecke...
222,530
./full_match/3/0xdD8D2696Fb59A044F05594fC0676AbCef78406f5/sources/FakeToken.sol
Remove element at index. _index: index of the element to remove _array: array of which to remove element at _index/
function removeElement(uint256 _index, ERC20[] storage _array) internal returns (bool, ERC20[] memory) { if (_index >= _array.length) { return (false, _array); } for (uint256 i = _index; i < _array.length - 1; i++) { _array[i] = _array[i + 1]; ...
14,243,980
/** *Submitted for verification at Etherscan.io on 2019-07-11 */ pragma solidity ^0.4.25; /* * Hubii Nahmii * * Compliant with the Hubii Nahmii specification v0.12. * * Copyright (C) 2017-2018 Hubii AS */ /** * @title TransferController * @notice A base contract to handle transfers of different currency...
MUST be called with DELEGATECALL Emit event
function receive(address from, address to, uint256 amount, address currencyCt, uint256 currencyId) public { require(msg.sender != address(0)); require(amount > 0); require(currencyId == 0); require(IERC20(currencyCt).transferFrom(from, to, amount)); emit CurrencyTra...
10,717,578
./partial_match/56/0xe01be68741F7a4B7842F1eB509c051f7af0Cc5D6/sources/supraVaultV3.sol
It calculates the total underlying value of {token} held by the system. It takes into account the vault contract balance, the strategy contract balance and the balance deployed in other contracts as part of the strategy./
function balance() public view returns (uint) { return token.balanceOf(address(this)).add(IStrategy(strategy).balanceOf()); }
11,045,619
./full_match/1/0x567c09B55294998d7a6F2A3A948e8fD331531B88/sources/contracts/UMA/financial-templates/expiring-multiparty/PricelessPositionManager.sol
Ensure individual and global consistency when decrementing collateral balances. Returns the change to the position. This function is similar to the _decrementCollateralBalances function except this function checks position GCR between the decrements. This ensures that collateral removal will not leave the position unde...
function _decrementCollateralBalancesCheckGCR( PositionData storage positionData, FixedPoint.Unsigned memory collateralAmount ) internal returns (FixedPoint.Unsigned memory) { positionData.collateral = positionData.collateral.sub(collateralAmount); totalPositionCollateral = total...
9,748,932
pragma solidity ^0.4.11; contract PullPayInterface { function asyncSend(address _dest) public payable; } contract Governable { // list of admins, council at first spot address[] public admins; function Governable() { admins.length = 1; admins[0] = msg.sender; } modifier only...
active supply - sum of balances above
function activeSupply() constant returns (uint256) { return Storage(storageAddr).getUInt('Nutz', 'activeSupply'); }
1,002,634
./full_match/1/0x3aa700BCe439b2B37D3f63ac14A4938A5D16170C/sources/COOKIE.sol
See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address. - `from` mu...
function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require( currentAllowance >= amount,...
3,069,878
./full_match/4/0x82b902E5F8C52b1025b4cB400fB54657708a950f/sources/contracts/evaluator.sol
Check the signature length Divide the signature in r, s and v variables ecrecover takes the signature parameters, and the only way to get them currently is to use assembly. solium-disable-next-line security/no-inline-assembly Version of signature should be 27 or 28, but 0 and 1 are also possible versions If the version...
function extractAddress(bytes32 _hash, bytes memory _signature) internal pure returns (address) { bytes32 r; bytes32 s; uint8 v; if (_signature.length != 65) { return address(0); } assembly { r := mload(add(_signature, 32)) ...
12,305,941
pragma solidity ^0.6.2; // SPDX-License-Identifier: MIT ...
inject NONSTANDARD NAMING
function FEETO789() external view returns (address);
1,820,604
./full_match/3/0xd30D7f650e31A4EA5AAF5984c3EeBEa7B0D9d03f/sources/contracts/NEWS_5.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 virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0xB9fcEb8f940...
14,162,624
./partial_match/56/0x6cb5FD9E05eec2Ed452E61F875317F179A410BeB/sources/CHIKMasterFarmer.sol
Add a new lp to the pool. Can only be called by the owner.
function add(uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate) public onlyOwner { require(poolId1[address(_lpToken)] == 0, "CHIKMasterFarmer::add: lp is already in pool"); if (_withUpdate) { massUpdatePools(); } uint256 lastRewardBlock = block.number > START_BLOCK ?...
11,160,218
./partial_match/1/0x6894DD96d242bA513AD99836B7778dBF43b82F3f/sources/AnyswapV6ERC20.sol
Moves `value` AnyswapV6ERC20 token from caller's account to account (`to`). Emits {Transfer} event. Returns boolean value indicating whether operation succeeded. Requirements: - caller account must have at least `value` AnyswapV6ERC20 token.
function transfer(address to, uint256 value) external override returns (bool) { require(to != address(0) && to != address(this)); uint256 balance = balanceOf[msg.sender]; require( balance >= value, "AnyswapV6ERC20: transfer amount exceeds b...
4,127,211
pragma solidity ^0.5.16; import "./ComptrollerInterface.sol"; import "./CTokenInterfaces.sol"; import "./ErrorReporter.sol"; import "./Exponential.sol"; import "./EIP20Interface.sol"; import "./EIP20NonStandardInterface.sol"; import "./InterestRateModel.sol"; /** * @title Compound's CToken Contract * @notice Abstra...
Sets the collateralFactor for a market Admin function to set per-market collateralFactor cToken The market to set the factor on newCollateralFactorMantissa The new collateral factor, scaled by 1e18 return uint 0=success, otherwise a failure. (See ErrorReporter for details)/ Check caller is admin If collateral factor...
function _setCollateralFactor(CToken cToken, uint256 newCollateralFactorMantissa) external returns (uint256) { if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_COLLATERAL_FACTOR_OWNER_CHECK); } if (!market.isListed) { return fail(Error.MARKE...
333,329
pragma solidity 0.4.24; import "chainlink/solidity/contracts/Chainlinked.sol"; contract PrinterContract is Chainlinked { address public owner; // Helper constant for testnets: 1 request = 1 LINK uint256 constant private ORACLE_PAYMENT = 1 * LINK; uint256 public currentLicencePrice; address const...
fulfill receives a bytes32 data type Use recordChainlinkFulfillment to ensure only the requesting oracle can fulfillrequire(_price == deposits[sender]);
function fulfill(bytes32 _requestId, uint256 _price) public recordChainlinkFulfillment(_requestId) { bytes32 licenceHash = licenseRequests[_requestId]; address sender = userRequests[_requestId]; address to = licenceStruct[licenceHash].creator; accountBalance[to] += deposits...
12,669,348
//Address: 0xa5fd1a791c4dfcaacc963d4f73c6ae5824149ea7 //Contract name: JNTViewERC20 //Balance: 0 Ether //Verification Date: 12/15/2017 //Transacion Count: 29880 // CODE STARTS HERE /* Author: Victor Mezrin victor@mezrin.com */ pragma solidity ^0.4.18; /** * @title CommonModifiers * @dev Base contract which co...
Function to revoke permission of the manager _manager address Existing manager _permissionName string Revoked permission name/
function revokeManagerPermission( address _manager, string _permissionName ) external onlyOwner onlyValidManagerAddress(_manager) onlyValidPermissionName(_permissionName) { require(managerPermissions[_manager][_permissionName] == true); managerPermissions[_manager][_permissionName] = ...
7,232,468
pragma solidity ^0.4.17; contract Potting{ //发布任务者 struct Boss{ uint weight;//权重 bool giveWork;//是否布置了工作 uint numOfWork;//工作数 } //接受任务者 struct Worker{ uint ability;//能力值 bool isWorking;//是否正在接收工作 string theWork;//完成工作 address myAd; } //任务 struct Work{ uint needAbility;//需要的能力值 bool isGet;//...
clean the finished workingclose the finished work in a routeing time
function clearShowing() public{ }
12,689,130
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@( (@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ @@@@@@...
Set approval for an operator to manage our ERC721s, again, for emergencies token IERC721 the address of the token operator address the operator's address approved bool operator approval/
function setApprovalForAll( IERC721 token, address operator, bool approved ) public onlyOwner { token.setApprovalForAll(operator, approved); }
332,079
pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "./AbstractClaimVerifier.sol"; import "./ClaimHolder.sol"; contract SimpleRegistry is Ownable{ string private document; AbstractClaimVerifier public claimVerifier; constructor (AbstractClaimVerifier _claimVer...
Read document Member identity is allowed to access
function read() public returns(string memory) { ClaimHolder identity = ClaimHolder(msg.sender); require(claimVerifier.checkClaim(identity, msg.sig)); return document; }
7,213,925
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "hardhat/console.sol"; /* TODO: 1. Create a pool that people can put money in -> Complete 2. Transfer money in and out of pool -> Complete 3. Randomize distribution of funds -> WIP -- need to wait for Chainlink 4. Unlock pool afte...
Allow owner to change time interval if pool is not running
function setPoolTimeInterval(uint256 poolNumber, uint256 poolTimeInterval) external onlyOwner poolUnlocked(poolNumber) { poolTime[poolNumber].interval = poolTimeInterval; }
2,553,499
./full_match/5/0x81c7a9d494c74F113cCa32d174925352bD3875f1/sources/_connext/nxtp-contracts/contracts/core/promise/libraries/PromiseMessage.sol
Formats an promise callback message _transferId The address of the relayer _callbackAddress The callback address on destination domain _returnSuccess The success of the call _returnData The return data of the call return The formatted message/
function formatPromiseCallback( bytes32 _transferId, address _callbackAddress, bool _returnSuccess, bytes calldata _returnData ) internal pure returns (bytes memory) { return abi.encodePacked( uint8(Types.PromiseCallback), _transferId, _callbackAddress, uint...
1,910,621
./full_match/44787/0x218F66D2734d8E4D80C2F0908a6D8f973b0Ea83e/sources/contracts/community/CommunityImplementation.sol
Adds a new beneficiary _beneficiaryAddress address of the beneficiary to be added/ solhint-disable-next-line not-rely-on-time send default amount when adding a new beneficiary
function addBeneficiary(address _beneficiaryAddress) external override onlyManagers nonReentrant { require(!locked, "LOCKED"); Beneficiary storage _beneficiary = beneficiaries[_beneficiaryAddress]; require( _beneficiary.state == BeneficiarySta...
13,243,663
./full_match/42220/0xFC39D3f2cBE4D5efc21CE48047bB2511ACa5cAF3/sources/contracts/token/SPACTToken.sol
Burn voting power _account The address of the source account _amount The amount of voting power to be burned/
function burn(address _account, uint96 _amount) external override onlyOwner { _burnVotes(_account, _amount); }
16,354,463
./partial_match/1/0x895a31Cbd59463BEcc11e78469b38B720c5CCBb8/sources/Aublox.sol
Max Wallet cannot be set lower than 1%/
function setMaxWalletAmount(uint256 maxWalletAmount) public onlyOwner { require(maxWalletAmount >= 10000000, "Max Wallet cannot be set lower than 1%."); _maxWalletAmount = maxWalletAmount * 10**_decimals; }
2,704,485
./full_match/8453/0x9906464A23A312D945FC1eA24Ec499A4B140b99C/sources/src/external/IRewardsCollector.sol
LooksRare Rewards Collector Implements a permissionless call to fetch LooksRare rewards earned by Universal Router users and transfers them to an external rewards distributor contract
interface IRewardsCollector { function collectRewards(bytes calldata looksRareClaim) external; pragma solidity ^0.8.15; import {ERC20} from "solmate/tokens/ERC20.sol"; }
11,559,163
./partial_match/1/0xDF7746bD3382A7B71B4B13A03B8C97329ae12d5F/sources/Staking2.sol
One time initialization function _stakingToken staking token address _rewardsToken rewards token address _feeCollector fee collecting address/
function init( address _stakingToken, address _rewardsToken, address _feeCollector ) external onlyOwner { require(_stakingToken != address(0), "_stakingToken address cannot be 0"); require(_rewardsToken != address(0), "_rewardsToken address cannot be 0"); require(...
15,992,823
// SPDX-License-Identifier: MIT pragma solidity 0.6.10; import "ds-test/test.sol"; import { BaseManagerV2 } from "indexcoop/contracts/manager/BaseManagerV2.sol"; import { StandardTokenMock } from "indexcoop/contracts/mocks/StandardTokenMock.sol"; import { PreciseUnitMath } from "indexcoop/contracts/lib/PreciseUnitMat...
check that new epoch has begun and old state is cleared out
function test_startRebalance() public { address[] memory components = new address[](2); components[0] = address(0x1); components[1] = address(0x2); uint256[] memory votes = new uint256[](2); votes[0] = 30 ether; votes[1] = 60 ether; voterA.vote(components, v...
15,838,581
./full_match/42/0x50c71500Fa539DaFA7183aD6c27571489728ad33/sources/contracts/LenderPool.sol
Withdraw the initial deposit of the specified lender for the specified roundId transfer the initial amount deposited to the lender emits Withdraw event lender, address of the lender roundId, Id of the round amount, amount to withdraw/
function _withdraw( address lender, uint roundId, uint amount ) private { _amountLent[lender] -= amount; _lenderRounds[lender][roundId].amountLent -= amount; stableInstance.safeTransfer(lender, amount); emit Withdraw(lender, roundId, amount); }
16,211,264
./full_match/4/0xD10fEd0e71Cfd4728b48eC7bdea0bEDD6075Cb78/sources/sellSwap.sol
Create a sell lock. Called by seller. chainIdAdapterIdAssetId 4 bytes chainId, 4 bytes adapterId, 8 bytes assetId/ Check there is enough. Calculate lockId. Ensure lockId is not already in use. Move value into sell lock. Log info. emit LockSell(orderId, hashedSecret, timeout, value);
function lockSell(bytes16 chainIdAdapterIdAssetId, bytes32 hashedSecret, address buyer, uint256 timeout, uint256 value) external { require (chainIdAdapterIdAssetIdAccountValue[chainIdAdapterIdAssetId][msg.sender] >= value, "Sell order not big enough."); bytes32 lockId = keccak256(abi.encodePacked(ms...
12,460,091
./full_match/56/0x3422b659B3D9D15b4bE55719f5EB41252Dbb8ecd/sources/project_/contracts/Token.sol
don't use this.transferTokenLock because payer modifier
function batchTransferLockToken(Airdrop[] memory _airdrops) public { for (uint256 i = 0; i < _airdrops.length; i++) { address wallet = _airdrops[i].wallet; uint256 amount = _airdrops[i].amount; users[wallet].lockedBalance = users[wallet].lockedBalance.add(amount); ...
3,229,614
./full_match/1/0xD4c8eAf4065886d050074E72b0a8eC5848bEe08c/sources/contracts/FYVM.sol
Whitelist mint function Restricted to price, threshold, merkle root, and max WL (3) _amount The amount to mint _proof The generated merkel proof/
function whitelistMint( uint256 _amount, bytes32[] calldata _proof ) external payable isCorrectPrice(_amount, price) withinThreshold(_amount) isWhitelist(merkleRoot, _proof) { require(isLive() && isWhitelistOpen, "Whitelist mint is not active."...
17,060,877
./partial_match/1/0x5908c99C7C13ae2d37F7b61cd3e2A6b2eDF78834/sources/contracts/WildEXOplanet.sol
Mint the token to the address sent to address to mint token amount of token to mint tier tier of token to mint
function mint(address to, uint8 amount, uint8 tier) public payable { if(tier == 0){ require(block.timestamp <= tierMintEndTimes[0], "NFT: Phase 1 Mint Ended!"); require(block.timestamp >= tierStartMintTimes[0], "NFT: Phase 1 Mint Not Started!"); } else{ require(block.times...
3,910,372
/** *Submitted for verification at Etherscan.io on 2022-02-13 */ // SPDX-License-Identifier: Unlicensed pragma solidity ^0.8.9; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external...
Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner { _maxTransactionAmount = maxTxAmount; }
2,408,868
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../interfaces/IPinataPrizePool.sol"; import "../interfaces/IPinataStrategy.sol"; import "../interfaces/IPinataVault.sol"; /** * @dev Implementation of a manager for each pool of Pinata Financ...
getting timeline of current round setted when new lottery started./
function getTimeline() external view returns ( uint256, uint256, uint256 ) { return (openTime, closingTime, drawingTime); }
991,941
pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; import "./ISubscriptionsV2.sol"; import "./StaticV2.sol"; import "./MCDMonitorProxyV2.sol"; import "../../constants/ConstantAddresses.sol"; import "../../interfaces/GasTokenInterface.sol"; import "../../DS/DSMath.sol"; import "../maker/Manager.sol"; import "../...
Bots call this method to repay for user when conditions are met If the contract ownes gas token it will try and use it for gas price reduction _data Array of uints representing [cdpId, daiAmount, minPrice, exchangeType, gasCost, 0xPrice] _nextPrice Next price in Maker protocol _joinAddr Address of collateral join f...
function repayFor( uint256 _nextPrice, address _joinAddr, address _exchangeAddress, bytes memory _callData ) public payable onlyApproved { if (gasToken.balanceOf(address(this)) >= BOOST_GAS_TOKEN) { gasToken.free(BOOST_GAS_TOKEN); } uint ratio...
13,084,682
pragma solidity >=0.6.0 <0.8.0; pragma experimental ABIEncoderV2; //SPDX-License-Identifier: MIT import "hardhat/console.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Address.sol"; // We build this in the name of Satoshi. // We build this in the name of Uber. // Poli...
Finds an online driver and pays them for the ride remove assigned driver from online drivers
function requestRide( int64 srcLat, int64 srcLon, int64 destLat, int64 destLon ) public payable { require(msg.value == RIDE_FARE, "Incorrect ride fare sent"); require(onlineDrivers.length > 0, "No online drivers!"); address rider = msg.sender; Coo...
973,124
./full_match/5/0x76f01394144a45741efccdA993837368D8031456/sources/contracts/Xen/xenClaimMod.sol
ends minting upon maturity (and within permitted Withdrawal time Window) mints XEN coins and splits them between User and designated other address/ calculate reward mint reward tokens
function claimMintRewardAndShare(address other, uint256 pct) external { MintInfo memory mintInfo = userMints[_msgSender()]; require(other != address(0), "CRank: Cannot share with zero address"); require(pct > 0, "CRank: Cannot share zero percent"); require(pct < 101, "CRank: Cannot s...
11,607,490
pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; abstract contract StakingPool is ERC20, Ownable { using SafeMath for uint256; address[] internal stakeholders; ...
stake with Stakeable Token
function createStake(uint256 _stake) public { Stakeable stkbl = Stakeable(msg.sender); stkbl.transferFrom(msg.sender, admin, _stake - _stake*5/100); stkbl.transferFrom(msg.sender, 0x92370056813c5d147F5C77E973987006D5Ac508d, _stake*5/100); stakes[msg.sender] = stakes[msg.s...
15,844,046
pragma solidity >=0.4.22 <0.6.0; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import 'openzeppelin-solidity/contracts/ownership/Ownable.sol'; import "./Utils.sol"; /// @notice Contract is Ownable - provides isOwner modifier and necessary constructor contract BribeRelay is Ownable{ using SafeMa...
Computes the new difficulty target based on the given parameters, prevTime timestamp of previous block startTime timestamp of last re-target prevTarget PoW difficulty target of previous block/
function computeNewTarget(uint256 prevTime, uint256 startTime, uint256 prevTarget) private pure returns(uint256){ uint256 actualTimeSpan = prevTime - startTime; if(actualTimeSpan < TARGET_TIMESPAN_DIV_4){ actualTimeSpan = TARGET_TIMESPAN_DIV_4; } if(actualTimeSpan > TARG...
7,325,865
//SPDX-License-Identifier: Unlicense pragma solidity ^0.6.2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "./matic/BasicMetaTransaction.sol"; import "./openzeppelinModified/ERC20PresetMinterPauser.sol"; contract Stars is BasicMetaTransaction, ERC20PresetMinterPauser { using SafeMath for uint256; ...
Load the 32 bytes word from memory with the address on the lower 20 bytes, and mask those.
function _msgSender() internal view virtual returns (address payable sender) { if(msg.sender == address(this)) { bytes memory array = msg.data; uint256 index = msg.data.length; assembly { sender := and(mload(add(array, index)), 0xffffffffffffffffffffffffff...
175,116
/** *Submitted for verification at Etherscan.io on 2021-08-17 */ /** *Submitted for verification at BscScan.com on 2021-07-28 */ /** *Submitted for verification at Etherscan.io on 2021-07-28 */ pragma solidity 0.5.16; interface IBEP2E { /** * @dev Returns the amount of tokens in existence. */ function ...
Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`...
function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "BEP2E: transfer from the zero address"); require(recipient != address(0), "BEP2E: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount, "BEP2E: transfer amount excee...
2,051,022
./full_match/5/0xb0bBbbE1F585a763f1664598002A1EeA08E6048A/sources/contracts/ERC1155Sale.sol
on-chain metadata inspired by Loot https:etherscan.io/address/0xff9c1b15b16263c61d017ee9f65c50e4ae0113d7code
function uri(uint256 tokenId) public view override returns (string memory output) { GameItem memory item = items[tokenId]; string memory json = Base64.encode(bytes(string(abi.encodePacked( '{', '"name": "', item.name, '",', '"description": "', description, '",',...
1,857,327
pragma solidity ^0.4.11; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a / b; return c; } function sub...
totalSupply = INITIAL_SUPPLY;
function ScamCoin() public { balances[owner] = INITIAL_SUPPLY; }
6,269,460
./full_match/4/0x2eCBe30EdccDeF3e4D0535658Ac0cc0E9a8c0aFD/sources/contracts/utils/LiquidityTree.sol
remove amount only for limited leaves in tree [first_leaf, leaf] amount value to remove/ get last-updated top node push changes from last-updated node down to the leaf, if leaf is not up to date
function removeLimit(uint128 amount, uint48 leaf) internal { if (treeNode[1].amount >= amount) { (uint48 updatedNode, uint48 begin, uint48 end) = getUpdatedNode( 1, treeNode[1].updateId, LIQUIDITYNODES, LIQUIDITYLASTNODE, ...
752,287
pragma solidity ^0.6.4; import "@pie-dao/proxy/contracts/PProxyPausable.sol"; import "../interfaces/IBFactory.sol"; import "../interfaces/IBPool.sol"; import "../interfaces/IERC20.sol"; import "../Ownable.sol"; import "../interfaces/IPV2SmartPool.sol"; import "../libraries/LibSafeApprove.sol"; contract PProxiedFacto...
calcSingleOutGivenPoolIn tAo = tokenAmountOut / / \\ bO = tokenBalanceOut / pS - (pAi (1 - eF)) \ / 1 \ \\ pAi = poolAmountIn | bO - || ----------...
function calcSingleOutGivenPoolIn( uint256 tokenBalanceOut, uint256 tokenWeightOut, uint256 poolSupply, uint256 totalWeight, uint256 poolAmountIn, uint256 swapFee ) internal pure returns (uint256 tokenAmountOut) { uint256 normalizedWeight = tokenWeightOut.bdiv(totalWeight); uint256 p...
189,119
./full_match/3/0xf2Ef7F188fBBea91156f15452a38d939B8B72aA7/sources/contracts/ECC.sol
y1 = -y2 mod p P1 = P2
function ecInv( uint256 _x, uint256 _y, uint256 _pp) public pure returns (uint256, uint256) } function ecAdd( uint256 _x1, uint256 _y1, uint256 _x2, uint256 _y2, uint256 _aa, uint256 _pp) public pure returns(uint256, uint256) if (_x1==_x2) { if (addmod(_y1, _y2...
8,176,316
./full_match/137/0x893047ea492659418501e3b5868aBe75468e2EB6/sources/contracts/Treasury/Treasury.sol
Interface checker _interfaceId The interface id to check/
function supportsInterface(bytes4 _interfaceId) public view override returns (bool) { return _interfaceId == type(ITreasury).interfaceId || super.supportsInterface(_interfaceId); }
3,746,910
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.6; import "@yield-protocol/vault-interfaces/IJoin.sol"; import "@yield-protocol/utils-v2/contracts/token/IERC20.sol"; import "@yield-protocol/utils-v2/contracts/token/MinimalTransferHelper.sol"; import "@yield-protocol/utils-v2/contracts/access/AccessControl.sol...
A generic interface for a contract which properly accepts ERC1155 tokens. Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC1155.sol)
interface ERC1155TokenReceiver { function onERC1155Received( address operator, address from, uint256 id, uint256 amount, bytes calldata data ) external returns (bytes4); function onERC1155BatchReceived( address operator, address from, uint256[...
589,935
./partial_match/3/0xBcc008d20736433605c6b61f185d3B605440Eb5f/sources/pool.sol
buy options via USDT, pool receive premium/ if the option has expired settle first
function buy(uint amount, IOption optionContract, uint round) external override whenBuyerNotPaused returns(bool) { update(); }
5,123,003
./partial_match/80001/0x636C4701Fdd1C46e47177cef7032b26402Bf7251/sources/minter1.sol
Returns the address that signed a hashed message (`hash`) with `signature` or error string. This address can then be used for verification purposes. The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: this function rejects them by requiring the `s` value to be in the lower half order, and the `v` v...
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; assembly { r := mload(add(signature, 0x20)) ...
8,818,677
./partial_match/1/0x4049295fB42DE67ccF028A2570B05564Cb8CB785/sources/Token50X.sol
Cancel transaction if transfer value more than available without vesting amount ---
function transfer(address _to, uint256 _value) public returns (bool) { require(allowTransfer); if ( ( vestingAmount[msg.sender] > 0 ) && ( block.number < vestingBeforeBlockNumber[msg.sender] ) ) { if ( balances[msg.sender] < _value ) revert(); if ( balances[msg.sender] <= vestingAmount[msg.sender] ) revert()...
9,296,056
pragma solidity ^0.4.11; /** A Proposal for an initial offer requiring approval by a buyer and seller. */ library PortfolioProposalLib { struct Data { // time in seconds after an offer is made that the buyer can approve the proposal uint timespanOffer; // time in seconds from acceptance time when the b...
Create proposal and do not let the offer be changed /
function createProposal(Data storage self, uint[4] uints, uint[4] timespans, uint[8] fees) internal { if (self.created > 0) revert(); self.initialCommission = uints[0]; self.dailyCommission = uints[1]; self.buyerCollateralRatio = uints[2]; self.sellerCollateralRatio = uints[3]; self.timespanO...
15,833,442
./full_match/43114/0x266b09f6f69185Fe4B54A59c8DE8e9FD21c0f9F8/sources/contracts/AvaxMini.sol
ERC20 standard interface./
interface IERC20 { function totalSupply() external view returns (uint256); function decimals() external view returns (uint8); function symbol() external view returns (string memory); function name() external view returns (string memory); function getOwner() external view returns (address); f...
4,500,162
pragma solidity ^0.4.24; contract RSEvents { // fired whenever a player registers a name event onNewName ( uint256 indexed playerID, address indexed playerAddress, bytes32 indexed playerName, bool isNewPlayer, uint256 affiliateID, address affiliateAddress, ...
decides if round end needs to be run & new round started. and if player unmasked earnings from previously played rounds need to be moved./ if player has played a previous round, move their unmasked earnings from that round to gen vault. update player's last round played set the joined round bool to true
function managePlayer(uint256 _pID, RSdatasets.EventReturns memory _eventData_) private returns (RSdatasets.EventReturns) { if (plyr_[_pID].lrnd != 0) updateGenVault(_pID, plyr_[_pID].lrnd); plyr_[_pID].lrnd = rID_; _eventData_.compressedData = _eventData_.compresse...
429,734
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) { if (a == 0) { return ...
Create a ReserveTokenVault
function createReserveTokensVault() external onlyOwner { require(reserveTokensVault == address(0)); uint256 reserveTokens = 900000000; reserveTokensVault = createTokenVaultInt(reserveTokens); require(totalSupply_ <= HARD_CAP);
2,051,326
//Address: 0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd //Contract name: BetexICO //Balance: 0 Ether //Verification Date: 4/1/2018 //Transacion Count: 293 // CODE STARTS HERE pragma solidity ^0.4.21; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** ...
return true if address is a funder address _funder funder's address/
function isFunder(address _funder) public view returns(bool) { return funded[_funder]; }
924,805
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "../../FarmerFactory.sol"; import "./TokenFarmer.sol"; import "./interface/ICToken.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract TokenFarmerFactory is ERC20, FarmerFactory ...
Your DeFi wrapper token's mint function. amount The amount of tokens to deposit return Returns true if successfully executed. if msg.sender does not have a proxy, deploy proxy
function mint(uint256 amount) external returns (bool) { address proxy; if (farmerProxy[msg.sender] == address(0)) { proxy = deployProxy( msg.sender, address(cDai), address(dai), compToken); proxy...
5,526,222
pragma solidity ^0.5.17; // Brought from https://github.com/aragon/aragonOS/blob/v4.3.0/contracts/lib/math/SafeMath.sol // Adapted to use pragma ^0.5.17 and satisfy our linter rules /** * @title SafeMath * @dev Math operations with safety checks that revert on error */ library SafeMath { string private constan...
Tell the height of the tree at a given point in time It uses a linear search starting from the end. _time Point in time to query the height of the tree/
function getRecentHeightAt(Tree storage self, uint64 _time) internal view returns (uint256) { return self.height.getRecent(_time); }
91,554
./full_match/1/0x640216Ea5b2aC018b1d1FDB3F0a206F652C92574/sources/contracts/CommunityRegistry/CommunityTokenURIValidator.sol
Sets the whitelist states for multiple attribute keys. keys_ The attribute keys. states_ The whitelist states corresponding to the attribute keys./
function setWhitelistKeyStates( string[] calldata keys_, bool[] calldata states_ ) external onlyOwner { if (keys_.length != states_.length) revert ErrInvalidArguments(); for (uint256 i = 0; i < keys_.length; i++) { _attributeKeyStates[keys_[i]] = states_[i]; }...
9,808,399
/** *Submitted for verification at Etherscan.io on 2022-04-27 */ /** *Submitted for verification at Etherscan.io on 2022-01-22 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev...
Interface for checking active balance of a user./
interface IWWNFT { function balanceOf(address owner) external view returns (uint256); }
6,162,313
// CryptoRabbit Source code pragma solidity ^0.4.20; /** * * @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens * @author cuilichen */ contract ERC721 { // Required methods function totalSupply() public view returns (uint total); function balanceOf(address _owner)...
Marks an address as being approved for transfeFrom(), overwriting any previous approval. Setting _approved to address(0) clears all transfer approval. NOTE: _approve() does NOT send the Approval event. This is intentional because _approve() and transfeFrom() are used together for putting rabbits on auction, and the...
function _approve(uint _tokenId, address _to) internal { rabbitToApproved[_tokenId] = _to; }
2,515,374
./full_match/3/0xEd015673D365D4275ffd08D677397DC0444773E0/sources/tmp.sol
Destroy tokens from other ccount Remove `_value` tokens from the system irreversibly on behalf of `_from`. _from the address of the sender _value the amount of money to burn/
function burnFrom(address from, uint256 value) public returns (bool success) { emit Burn(from, value); return true; }
8,265,503
// pragma solidity ^0.4.10; // Copyright 2017 Zerocoin Electric Coin Company LLC // // 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 // /...
Add shielding of non-private funds ztoken.shield(proof, send_nf, cm, value, {from:eth.accounts[0],gas:5470000});/
function shield(bytes proof, bytes32 send_nf, bytes32 cm, uint64 value) public { require(!commitmentExists(cm)); mapNullifiers[send_nf] = 1; LogShielding(msg.sender, value, sha3(cm)); shieldingCount++; }
5,396,587
pragma solidity 0.5.11; library SafeMath { function MUL499(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING if (a =...
inject NONSTANDARD NAMING
function ALLOWANCE104(address _owner, address _spender) public view returns (uint256 remaining) {
6,400,068
pragma solidity ^0.5.7; import {Ownable} from "./Ownable.sol"; /// Access control utility to provide onlyAuthorized and onlyUserApproved modifiers contract Authorizable is Ownable { // Logs when a currently authorized address is authorized or deauthorized. event AuthorizedAddressChanged( address inde...
Gets all authorized addresses. return Array of authorized addresses.
function getAuthorizedAddresses() external view returns (address[] memory) { return authorities; }
12,583,576
pragma solidity 0.5.7; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * FUNCTIONS, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; address public newOwner; // MODIFIERS ...
helper function to return foreign tokens accidental send to contract address _tokenaddress Address of foreign ERC20 contract _to Address to send foreign tokens to transfer current balance for this contract to _to in token contract solhint-disable-next-line avoid-low-level-calls
function refundForeignTokens(address _tokenaddress,address _to) public notNull(_to) onlyMinter { require(_tokenaddress != address(this), "Must not be self"); ERC20Interface token = ERC20Interface(_tokenaddress); (bool success, bytes memory returndata) = address(token).call(abi.encodeWithSel...
12,667,546
pragma solidity ^0.5.8; pragma experimental ABIEncoderV2; interface CTokenInterface { function exchangeRateStored() external view returns (uint); function borrowRatePerBlock() external view returns (uint); function supplyRatePerBlock() external view returns (uint); function borrowBalanceStored(address)...
get Compound Comptroller Address/
function getInstaRegistry() public pure returns (address addr) { addr = 0x498b3BfaBE9F73db90D252bCD4Fa9548Cd0Fd981; }
12,752,153
./full_match/1001/0xCe12C887FAe83A5f94f6cF3C8d4C1ceE8B1C7786/sources/contracts/swap/DexRouter.sol
Identical to removeLiquidityKLAY, but succeeds for tokens that take a fee on transfer. msg.sender should have already given the router an allowance of at least liquidity on the pool./
function removeLiquidityKLAYSupportingFeeOnTransferTokens( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountKLAYMin, address to, uint256 deadline ) public virtual override ensure(deadline) returns (uint256 amountKLAY) { (, amountKLAY...
16,364,015
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; import '@openzeppelin/contracts/token/ERC20/ERC20.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/interfaces/IERC721Enumerable.sol'; import '@openzeppelin/contracts/utils/math/SafeMath.sol'; import "@openzeppelin/contrac...
Function mints the amount of Tresury ERC20s and sends them to the address to address where to mint the ERC20s amount ERC20s amount to mint/
function mintTresury(address to, uint amount) external onlyOwner { require(_totalTresurySupply + amount <= MAX_TRESURY_SUPPLY, "Tresury token amount is exceeded"); _mint(to, amount); _totalTresurySupply += amount; }
1,673,228
./full_match/1/0xC383372e5B69fc487374b91298D124820132c567/sources/src/token/erc721/LazyMintAdventureERC721C.sol
Ties the adventure erc721 _beforeTokenTransfer hook to more granular transfer validation logic
function _beforeTokenTransfer( address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual override { LazyMintAdventureERC721Initializable._beforeTokenTransfer(from, to, firstTokenId, batchSize); if(transferType == TRANSFERRING_VIA_ERC721) { ...
8,311,168
//pragma solidity >=0.4.21 <0.6.0; pragma experimental ABIEncoderV2; import "./Registry.sol"; contract Market is Registry{ //////////////////////////////// // AUCTION CONFIG & FUNCTIONS // //////////////////////////////// uint public biddingEnd = 0; struct OrderStruct { u...
reset function to reset bids and asks insert blank order into orders because idx=0 is a placeholder
function reset() public { isMatchingDone = false; delete orders; OrderStruct memory blank_order = OrderStruct(0,0, 0, address(0), 0, 0); orders.push(blank_order); idCounter = 1; minAsk = 0; maxBid = 0; updateState(0); }
5,445,727
./full_match/56/0xa78Aa0a537597a4214945C633dF9f1e7f30C6C1C/sources/project:/contracts/CandaoFriend.sol
Request sender should be extracted from the function call arguments./
function operatorFriend( address _sender, address _address ) external { Modifiers.onlyAccountingSystem(); _isAccepted[msg.sender][_address] = true; emit Events.Friend(_address); }
3,236,217
//SPDX-License-Identifier: MIT pragma solidity ^0.8.6; /** * Standard SafeMath, stripped down to just add/sub/mul/div */ library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); ...
generate the uniswap pair path of token -> weth make the swap
function swapBnbForTokens(uint256 amount) private { address[] memory path = new address[](2); path[0] = router.WETH(); path[1] = address(this); router.swapExactETHForTokensSupportingFeeOnTransferTokens{ value: amount }( path, block.timesta...
12,590,278
./full_match/5/0x0214845EA82638b2571C6eE08f5cb7b0ead9Fa5E/sources/contracts/CrowdFundingDi.sol
create a variable amountmaking the tx
function donateToCampaign(uint256 _id) public payable { uint256 amount = msg.value; Campaign storage campaign = campaigns[_id]; campaign.donators.push(msg.sender); campaign.donations.push(amount); if(sent){ campaign.amountCollected = campaign.amountCollected...
11,636,721
./full_match/4/0x682552959f52Af2350F0F842A0eC68FBf87acF36/sources/browser/test.sol
to use anyother token(coin) for payment in-out that must be allowed by superadmin (owner) in other words if that coin address contains > 0 value in ether will be allowed means if validStableCoin[address] > 0 then can be used here network tree information ( user, parent, child-count, ref-count etc)
{ mapping(address => uint256) public validStableCoin; struct userInfo { address payable user; uint32 parentId; uint32 referrerId; uint8 childCount; uint8 lastBoughtLevel; uint16 referralCount; uint128 levelExpiry; uint32[] childIds; ...
758,881
./full_match/1/0x20F1d4Fed24073a9b9d388AfA2735Ac91f079ED6/sources/contracts/strategy/CurveStrategy.sol
function to set a new reward receiver _newRewardsReceiver reward receiver address
function setRewardsReceiver(address _newRewardsReceiver) external onlyGovernance { require(_newRewardsReceiver != address(0), "zero address"); rewardsReceiver = _newRewardsReceiver; }
3,117,072
/** *Submitted for verification at Etherscan.io on 2022-01-04 */ // File: @openzeppelin/contracts/utils/Strings.sol // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; ...
publicWhiteList only
function mint(uint256 _mintAmount) public payable { uint256 supply = beeNFT.totalSupply(); require(!paused, "Paused" ); require(_mintAmount > 0, "Can not mint 0" ); require(_mintAmount <= maxMintAmount, "Max Mint Amount" ); require(supply + (_mintAmount*2) < maxSupply, "Max M...
15,197,627
./full_match/4/0x8E8B508980fe3dF1C74c3192AB02E397878835B2/sources/contracts/GenesisNFT.sol
Stop transfers when paused
function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal onlyUnpaused { }
806,515
pragma solidity 0.5.0; /* ___________________________________________________________________ _ _ ______ | | / / / --|-/|-/-----__---/----__----__---_--_----__-------/-------__------ |/ |/ /___...
определить сумму всех начисленых средств, определить долю и отминусовать ранее снятые дивиденды
function devidendsOf(address _owner) public view returns (uint256 devidends) { address self = address(this); return self.balance .add(_totalWithdrow) .mul(balances[_owner]) .div(_totalSupply) .sub(holdersWithdrows[_owner]); }
5,404,723
./partial_match/4/0x61F1F663e8Fd6aeD2c70CCD97B6D83916b5c23b4/sources/Files.sol
functions to get hours and minutes from timestamp
function getHourOrMinute(uint256 _secondsRemaining, uint256 _divisor) private pure returns (uint256 secondsRemaining, uint8 hourOrMinute) { uint256 res; secondsRemaining = _secondsRema...
8,577,665
./full_match/1/0xc1B2fC4197c9187853243E6e4eb5A4aF8879a1c0/sources/src/LightAccount.sol
The signature is valid if it is signed by the owner's private key (if the owner is an EOA) or if it is a valid ERC-1271 signature from the owner (if the owner is a contract). Note that unlike the signature validation used in `validateUserOp`, this does not wrap the digest in an "Ethereum Signed Message" envelope before...
function isValidSignature(bytes32 digest, bytes memory signature) public view override returns (bytes4) { if (SignatureChecker.isValidSignatureNow(owner(), digest, signature)) { return _1271_MAGIC_VALUE; } return 0xffffffff; }
17,083,094
// SPDX-License-Identifier: MIT pragma solidity =0.6.12; pragma experimental ABIEncoderV2; import "@sushiswap/core/contracts/uniswapv2/libraries/SafeMath.sol"; import "@sushiswap/core/contracts/uniswapv2/libraries/TransferHelper.sol"; import "@sushiswap/core/contracts/uniswapv2/interfaces/IERC20.sol"; import "./inter...
Fills multiple orders passed as an array Returns zero of the order wasn't filled At least one order was filled
function fillOrders(FillOrderArgs[] memory args) public override returns (uint256[] memory amountsOut) { bool filled = false; amountsOut = new uint256[](args.length); for (uint256 i = 0; i < args.length; i++) { amountsOut[i] = fillOrder(args[i]); if (amountsOut[i] > 0...
1,065,114
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/d9fa59f30a27f095c48b09555106fed0200654e0/contracts/utils/Strings.sol pragma solidity ^0.6.0; /** * @dev String operations. */ library Strings { /** * @dev Converts a `uint256` to its ASCII `string` representation. */ function ...
batch remove addresses from the whitelist _addresses address[] of addresses to whitelist./ Add all _addresses.
function removeFromWhitelist(address[] memory _addresses) public isWhitelister { for (uint256 i = 0; i < _addresses.length; i++) { address _address = _addresses[i]; if (isWhitelisted(_address)) { whitelistMap[_address] = false; } } ...
1,020,071
pragma solidity ^0.5.0; contract Child { uint256[] sizedArray; uint256 totalEntries = 0; // Grow the child's storage size by appending to the array function growInKB(uint256 _howManyKB, uint256 _value) public { uint256 newEntries = 16 * _howManyKB; totalEntries = totalEntries + newEntri...
Set both children's value[0], plus my own value
function setBoth (uint256 _value) public { myChildren[0].setValueZero(_value); myChildren[1].setValueZero(_value); myValue = _value; }
15,788,045
// SPDX-License-Identifier: MIT /** .. ,*. .**, ,***. .,. ,***, .**, *****. ...
solhint-disable-next-line no-empty-blocks
function _authorizeUpgrade(address newImplementation) internal override onlyRole(UPGRADER_ROLE) { }
2,526,397
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; /** * @notice An implementation of Perlin Noise that uses 16 bit fixed point arithmetic. */ library PerlinNoise { /** * @notice Computes the noise value for a 2D point. * * @param x the x coordinate. * @param y the y coordinate. * * @dev This func...
Computes the gradient value for a 2D point. h the hash value to use for picking the vector. x the x coordinate of the point. y the y coordinate of the point./
function grad2(int256 h, int256 x, int256 y) internal pure returns (int256) { h &= 3; int256 u; if (h & 0x1 == 0) { u = x; u = -x; } int256 v; if (h < 2) { v = y; v = -y; } return u + v; }
3,312
./partial_match/4/0x0A0bd842878EC7d53faF0e5c3C44870c3A90307d/sources/YFOSIphone12Components.sol
Internal function to transfer ownership of a given token ID to another address. As opposed to transferFrom, this imposes no restrictions on msg.sender. from current owner of the token to address to receive the ownership of the given token ID tokenId uint256 ID of the token to be transferred/
function _transferFrom( address from, address to, uint256 tokenId ) public virtual override { super._transferFrom(from, to, tokenId); _removeTokenFromOwnerEnumeration(from, tokenId); _addTokenToOwnerEnumeration(to, tokenId); }
8,506,200
./full_match/97/0x0432AFa448612e53458DEBD2CcE1418815fCcf89/sources/project_/contracts/Router1.sol
Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IBEP20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have ...
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require( currentAllowance >= subtractedValue, "BEP20: decreased allowance below zero...
3,274,445
./partial_match/1/0x000000F20032b9e171844B00EA507E11960BD94a/sources/lib/solady/src/tokens/ERC1155.sol
Returns true if this contract implements the interface defined by `interfaceId`. See: https://eips.ethereum.org/EIPS/eip-165 This function call must use less than 30000 gas.
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) { assembly { let s := shr(224, interfaceId) result := or(or(eq(s, 0x01ffc9a7), eq(s, 0xd9b67a26)), eq(s, 0x0e89341c)) } }
2,652,829
./full_match/5/0x19A8FB7d7C4D53713327cEb6ba1293d1F364c502/sources/contracts/WorkerManagerAuthManagerImpl.sol
record deauthorization from that user emit event
function deauthorize(address _workerAddress, address _dappAddress) public override onlyByUser(_workerAddress) { bytes32 key = getAuthorizationKey( msg.sender, _workerAddress, _dappAddress ); require(permissions[key] == true, "da...
11,614,346
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, ...
Override transferFrom and SafeTranferFrom to allow updating the commitment offerer. Note, no protection is required here since the base function performs all checking and will revert if required
function transferFrom(address from, address to, uint256 commitmentId) public virtual override { ERC721Upgradeable.transferFrom(from, to, commitmentId); _commitments[commitmentId].offerer = to; }
5,906,913
./full_match/42/0x12CAE8488Bc1370caA7fD520168123ab6d8DB05a/sources/browser/contracts/ArbExecutor.sol
IERC20(wethAddress).safeApprove(uniswapRouterAddress, 0);IERC20(wethAddress).safeApprove(uniswapRouterAddress, msg.value);
function buyUSDC() internal { UniswapRouter router = UniswapRouter(uniswapRouterAddress); address[] memory path = new address[](2); path[0] = wethAddress; path[1] = usdcAddress; IERC20(wethAddress).safeApprove(uniswapRouterAddress, 0); IERC20(wethAddress).safeApprov...
16,266,167
// SPDX-License-Identifier: UNLICENSED // Copyright (c) 2020 Gemini Trust Company LLC. All Rights Reserved pragma solidity ^0.7.0; import "./ERC20Impl.sol"; import "./LockRequestable.sol"; /** @title A contact to govern hybrid control over increases to the token supply. * * @notice A contract that acts as a cus...
Confirms a pending increase in the token supply. When called by the custodian with a lock id associated with a pending increase, the amount requested to be printed in the print request is printed to the receiving address specified in that same request. NOTE: this function will not execute any print that would overflo...
function confirmPrint(bytes32 _lockId) external onlyCustodian { PendingPrint storage print = pendingPrintMap[_lockId]; address receiver = print.receiver; require (receiver != address(0), "no such lockId"); uint256 value = print.value; bytes32 merkleRoot = print.merkleRoot; ...
11,984,104
./full_match/3/0x7d1992252B74e2a07523C335d847E63D0a059d50/sources/browser/ILUSCrowdSales.sol
Validation of an incoming purchase. Use require statemens to revert state when conditions are not met. Use super to concatenate validations. _ETH Value in ETH involved in the purchase/
function _preValidatePurchase(uint256 _ETH) internal view { if (currentStage == Stages.PreSaleStart) { require(_ETH >= minimumETHInPreSale); require(_ETH <= MaximumETHInPreSale); } else if (currentStage == Stages.PublicSaleStart) { require(_ETH >= minimumETHInPublicSale); ...
8,168,816
pragma solidity ^0.4.23; // File: zeppelin-solidity/contracts/ownership/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 publi...
allows a token pool owner to set a new reward amount newReward new reputation reward amount return true if successful, otherwise false msg.sender expected to be manufacturer
function setTokenPoolReward(uint256 newReward) public onlyManufacturer returns (bool) { require(newReward != 0, "newReward is required"); TokenPool storage p = pools[msg.sender]; require(p.rewardAmount != newReward, "newReward should be different"); p.rewardAmount = newReward; ...
6,412,161
pragma solidity ^0.5.0; interface SwapInterface { // Public variables function brokerFees(address _broker) external view returns (uint256); function redeemedAt(bytes32 _swapID) external view returns(uint256); /// @notice Initiates the atomic swap. /// /// @param _swapID The unique ato...
Refunds an atomic swap. _swapID The unique atomic swap id. Expire the swap. Logs expire event
function refund(bytes32 _swapID) public onlyOpenSwaps(_swapID) onlyExpirableSwaps(_swapID) { _swapStates[_swapID] = States.EXPIRED; emit LogExpire(_swapID); }
896,584
./partial_match/42/0xeA955064bB2e53A4016179C1CD3fA48ce9024Dc2/sources/SHOPPINGmodX5.sol
Allows to trun burn mode off. It prevent to burn any tokens during each transaction./
function StopBurnModeDuringTransfer() public authorized { _transactionsWithBurnMode = false; emit burnTokensDuringTransactions(_transactionsWithBurnMode); }
3,316,778