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 pragma solidity ^0.8.0; import "./libs/maths/SafeMath.sol"; import "./libs/string.sol"; import "./interfaces/IERC20.sol"; import "./libs/sort.sol"; struct GlqStaker { address wallet; uint256 block_number; uint256 amount; uint256 index_at; bool alread...
Copy word-length chunks while possible
function memcpy(uint dest, uint src, uint len_cpy) private pure { for(; len_cpy >= 32; len_cpy -= 32) { assembly { mstore(dest, mload(src)) } dest += 32; src += 32; } assembly { let srcpart := and(mload(src), not(ma...
1,061,472
./full_match/3/0xe3E78C43980456568eE5902C155079e725dcBB99/sources/browser/ERC1400ERC20.sol
Add a certificate signer for the token. operator Address to set as a certificate signer. authorized 'true' if operator shall be accepted as certificate signer, 'false' if not./
function setCertificateSigner(address operator, bool authorized) external onlyOwner { _setCertificateSigner(operator, authorized); }
14,141,627
// SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts...
Returns the total amount of rewards that can be claimed by user until block.timestamp. It can be seen as minimum amount of reward tokens should be buffered in the gauge controller./
function claimable() external view returns (uint256) { return totalReward() - totalClaimed; }
958,278
./full_match/5/0x631CadF9267a7784D690AFa0Bd9128760CF555Cf/sources/contracts/libraries/Token.sol
Returns readable string./
function toString(Info memory _info) internal pure returns (string memory) { return string( abi.encodePacked( "TokenInfo(", Strings.toHexString(uint160(_info.erc), 1), ",", Strings.toHexString(_info.id), ",", Strings.toHexString(_info.quant...
1,908,479
pragma solidity ^0.4.0; // Example Contract that contributors can give birthday gifts to wallet(s) // Gifter can send money to all pool // Gifter can send to specifc address // Birthdayee can see funds // Birthdayee will not be transfered until birthday contract BirthdayGift { uint private giftAllBalance = 0; ...
TODO : for now, return true - need to work on dates
function isItTheirBirthday(address birthdayeeAddress) private pure returns(bool) { return true; }
12,843,550
./partial_match/56/0x5AE8e454d3558102305Fa8487D3c6b59305B36b4/sources/project_/contracts/Airdrop.sol
Claims entire user airdrop in one transfer based on parameters. Requirements: - tokens are not claimed yet for `phrAddr` address - `amount` must be bigger than zero. merkleProofs - List of claim proofs for particular PHR addresses. phrAddresses - List of Phore addresses able to receive airdrop. amounts - List of GFN...
function claimAllGFN(address sender, bytes32[][] memory merkleProofs, string[] memory phrAddresses, uint256[] memory amounts, bytes[] memory signatures) public { require(merkleProofs.length == phrAddresses.length, ARRAY_LEN_ERR); require(merkleProofs.length == amounts.length, ARRAY_LEN_ERR);...
11,231,424
pragma solidity >=0.4.25 <0.8.0; import "./interfaces/IERC20.sol"; import "./interfaces/IWETH.sol"; import "./interfaces/IControl.sol"; import "./interfaces/IExchange.sol"; import "./uniswapv2/libraries/TransferHelper.sol"; pragma experimental ABIEncoderV2; contract CCTPool { struct Follower { // address ...
require(IERC20(acceptToken).approve(address(this), amountIn), 'approve failed.');
function investToPool(uint256 amountIn) external payable lock() inPreparation() { if ( poolInfo.acceptToken == address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) ) { amountIn = msg.value; } require(amountIn > 0,...
12,666,183
// File: @openzeppelin/contracts/utils/Counters.sol // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elem...
Max per wallet checkPrice check
function presaleMint( uint256 amount, bytes calldata signature ) external payable { require( workflow == WorkflowStatus.Presale, "NaftyDolls: Presale is not currently active." ); require( validateSignature( pre...
14,692,373
// https://etherscan.io/address/0x594a198048501a304267e63b3bad0f0638da7628#code // SPDX-License-Identifier: MIT pragma solidity ^0.6.2; import "../../lib/erc20.sol"; import "../../lib/safe-math.sol"; import "./scrv-voter.sol"; import "./crv-locker.sol"; import "../../interfaces/jar.sol"; import "../../interfaces/cu...
Anyone can harvest it at any given time. I understand the possibility of being frontrun / sandwiched But ETH is a dark forest, and I wanna see how this plays out i.e. will be be heavily frontrunned/sandwiched? if so, a new strategy will be deployed. stablecoin we want to convert to Collects crv tokens Don't bother...
function harvest() public override onlyBenevolent { (address to, uint256 toIndex) = getMostPremium(); SCRVVoter(scrvVoter).harvest(gauge); uint256 _crv = IERC20(crv).balanceOf(address(this)); if (_crv > 0) { uint256 _keepCRV = _crv.mul(keepCRV).div(keepCRVMax); ...
1,774,374
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.6.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "./interfaces/IEmiswap.sol"; import "./libraries/EmiswapLib.sol"; import "./libraries/TransferHelper.sol"; import "./interfaces/IWETH.sol";...
REMOVE LIQUIDITY tokenA address of first token in pair tokenB address of second token in pair liquidity LP token amountAMin minimum amount of first token amountBMin minimum amount of second token/
function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin ) public { IEmiswap pairContract = IEmiswapRegistry(factory).pools(IERC20(tokenA), IERC20(tokenB)); uint256[] memory minReturns; minReturns = new uint256[](2); if (to...
13,132,283
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.2.0-solc-0.7/contracts/utils/EnumerableSet.sol // SPDX-License-Identifier: MIT pragma solidity ^0.7.0; ...
inject NONSTANDARD NAMING
function _SETROLEADMIN697(bytes32 role, bytes32 adminRole) internal virtual {
5,351,538
/** * Golden Union - Blockchain platform for direct investment in gold mining * https://goldenunion.org * ---------------------------- * telegram @golden_union * developed by Inout Corp */ pragma solidity ^0.4.23; contract ERC20Basic { function totalSupply() public view returns (uint256); func...
_amount in tokens. 1 = 1 token
function mintTokens(uint256 _amount) public onlyOwner returns (bool){ uint256 amount = _amount; require (amount <= 1000000); amount = amount.mul(1 ether); token.mint(amount); return true; }
10,591,273
./full_match/4/0x03cf51714ace856f8b80d3855Ac46c70E5e90963/sources/contracts/PaymentSplitter.sol
Getter for the amount of shares held by an account./
function shares(address account) public view returns (uint256) { return record(account).shares; }
12,386,912
./full_match/3/0x6165744662Ec03C05cA19aCb6a398Ec4309e1258/sources/Kyc.sol
Add new bank {bytes32} bankName The name of the bank {address} bankAddress The address of the bankAddress {bytes32} regNumber THe unique registration number of the bank modifier isAdmin validate if only admin is able to make a request returns {bool} Returns true if success, false otherwise/
function addBank( bytes32 bankName, address bankAddress, bytes32 regNumber ) public isAdmin returns (bool) { require( banks[bankAddress].bank != bankAddress, "Bank with same address already exists" ); banks[bankAddress].name = bankName; ...
8,244,810
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import "../ERC20.sol"; import "./ERC721.sol"; import "../interfaces/Interfaces.sol"; contract EtherOrcsAllies is ERC721 { uint256 constant startId = 5050; mapping(uint256 => Ally) public allies; mapping(address => bool) public auth; uint16 shS...
This is safe because the sum of all user balances can't exceed type(uint256).max!
function _mint(address to, uint256 tokenId) internal { require(ownerOf[tokenId] == address(0), "ALREADY_MINTED"); totalSupply++; unchecked { balanceOf[to]++; } ownerOf[tokenId] = to; emit Transfer(address(0), to, tokenI...
617,317
./full_match/43114/0x37A83906a69d6236DBcB4d8257D8f62d1f3BBcD5/sources/contracts/BambooStrategyForLP.sol
Withdraws deposit tokens from Staking Contract Reward tokens are automatically collected Reward tokens are not automatically reinvested amount deposit tokens to remove/
function _withdrawDepositTokens(uint amount) internal { require(amount > 0, "amount too low"); stakingContract.withdraw(PID, amount); }
4,536,116
pragma solidity ^0.4.24; import "./ITransferManager.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "../../libraries/BokkyPooBahsDateTimeLibrary.sol"; import "../../libraries/VolumeRestrictionLib.sol"; contract VolumeRestrictionTM is VolumeRestrictionTMStorage, ITransferManager { using S...
This function returns the signature of configure function/
function getInitFunction() public view returns(bytes4) { return bytes4(0); }
12,616,650
pragma solidity ^0.5.0; import "../interfaces/ClientPhoenixAuthenticationInterface.sol"; import "../interfaces/PhoenixInterface.sol"; import "../interfaces/IdentityRegistryInterface.sol"; import "../zeppelin/math/SafeMath.sol"; import "../zeppelin/ownership/Ownable.sol"; import "./interfaces/PhoenixIdentityResolverIn...
permission removeResolverFor by signature
function removeResolverFor( address approvingAddress, address resolver, bool isPhoenixIdentity, bytes memory extraData, uint8 v, bytes32 r, bytes32 s, uint timestamp ) public ensureSignatureTimeValid(timestamp) { uint ein = identityRegistry.getEIN(approvingAddress); ...
13,045,012
// File: contracts/utils/Strings.sol pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) inter...
Required interface of an ERC721 compliant contract./
interface IERC721 is IERC165 { event Transfer( address indexed from, address indexed to, uint256 indexed tokenId ); event Approval( address indexed owner, address indexed approved, uint256 indexed tokenId ); event ApprovalForAll( address inde...
69,013
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import '@openzeppelin/contracts/token/ERC1155/ERC1155.sol'; import "@openzeppelin/contracts/utils/Counters.sol"; import './Utils.sol'; /** * @title HappyRobotWhitelistToken * HappyRobotWhitelistToken - ERC1...
burn token _from address to burn _quantity token quantity/
function burn(address _from, uint8 _quantity) public onlyOwner { _burn(_from, TOKEN_ID, _quantity); unchecked { totalBurns += _quantity; tokenSupply -= _quantity; } }
14,513,379
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; // dependencies import {AggregatorV3Interface} from "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol"; import {Context} from "@openzeppelin/contracts/utils/Context.sol"; ...
Withdraw tokens from the vault. Note that a vault can support multiple collateral tokens.
function withdraw(uint256 amount, IERC20 token) external override { require(getUserPosition(_msgSender()).notional == 0, "Has open position"); IVault vault = vaultUsed[_msgSender()]; vault.withdraw(_msgSender(), amount, token); emit Withdraw(_msgSender(), address(token), amount); ...
994,499
./full_match/1/0xccccB27BB46ffE01479248EDDFb75E300DE06879/sources/contracts/bridgeToken/adapters/ccip/CCIPBridgeAdapter.sol
Lock BIFI in lockbox and burn minted tokens.
function _bridge(address _user, uint256 _dstChainId, uint256 _amount, address _to) private { if (!whitelistedChains[chainIdToCcipId[_dstChainId]]) revert InvalidChain(); if (address(lockbox) != address(0)) { BIFI.safeTransferFrom(_user, address(this), _amount); lockb...
4,843,225
/** @title ERC-20 Fungible Token Standard basic implementation Implementation of OpenZeppelin used. Changes made by Chaitanya-Konda The MIT License (MIT) Copyright (c) 2016-2019 zOS Global Limited Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documenta...
Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amount of tokens to be transferred/
function transferFromAt(address _from, address _to, uint256 _value) public returns (bool) { require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(_to != address(0)); require(block.timestamp > timeLock[_from][msg.sender]); balances[_from] = balances[_from].su...
7,322,464
// SPDX-License-Identifier: MIT pragma solidity 0.8.2; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "./GovernorBravoInterfaces.sol"; contract GovernorBravoDelegate is I...
Treasury function for funding the new Investee/
function _fundInvestee() external returns(address){ require(msg.sender == treasury, "GovernorBravo::_fundInvestee: treasury only"); require(nextInvesteeFund <= nextInvestee, "GovernorBravo::_fundInvestee: No new investee"); nextInvesteeFund =add256(nextInvesteeFund,1); emit Investee...
13,651,924
./partial_match/1/0x43833f0C2025dFA80b5556574FAA11CBf7F3f4eB/sources/WUSDA.sol
Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}./
function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) { if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) { return toString(value); return store; } }
2,589,416
// SPDX-License-Identifier: None // HungryBunz Implementation V1 pragma solidity ^0.8.0; import "./Ownable.sol"; import "./PaymentSplitter.sol"; import "./ERC721.sol"; import "./ECDSA.sol"; import "./Strings.sol"; import "./Initializable.sol"; contract OwnableDelegateProxy { } contract ProxyRegistry { mapping(ad...
Nom contract performs owner of check to prevent malicious unlockingEvent with ownerOf override restores token in marketplace accounts
function unlock (uint16 tokenId, uint248 newTime) external { require(msg.sender == _nomContractAddress, "Unauthorized"); require(lockedForStaking(tokenId), "Not locked!"); _lockedTokens[tokenId] = bytes32(abi.encodePacked(uint8(0), newTime)); emit Tra...
12,149,234
pragma solidity >=0.4.22 <0.7.0; // pragma experimental ABIEncoderV2; enable experimental features (required for returning structs) contract Lease { uint public rent; uint public deposit; // uint public showingfee; uint public showingfeepercent; uint servicefeepercent; /* Combination of zip co...
required so that the next contract can pay this contract
function () payable external {}
1,046,389
pragma solidity ^0.4.4; contract Meetup { /** * NOTES * * "organizer" is the person creating meetup. */ /** * Meetup Events */ event _MeetupCreated(uint indexed id); event _MeetupUpdated(uint indexed id); struct MeetupPost { uint id; address organizer; ...
Edit ipfs hash of a post/
function editMeetup( uint id, string ipfsHash ) external { address organizer = msg.sender; MeetupPost storage meetup = meetups[id]; require(meetup.organizer == organizer); meetups[id].ipfsHash = ipfsHash; _MeetupUpdated(id); }
1,759,462
./full_match/43114/0xDFa3bCda5f954A1E6CEF247bDfA89F15702a7473/sources/contracts/strategies/MiniChefStrategy.sol
Harvest from Masterchef
function harvestPartially(address token) external override nonReentrant { uint256 pid = viewPid(token); chef.harvest(pid, address(this)); tallyReward(token); }
4,542,749
pragma solidity ^0.5.1; // PokerHandUtils // // // Library for handling of poker hands consisting of cards numbered 0-51 // Ace = 0, King = 12 in the suits Clubs, Diamonds, Hearts, Spades // // Function: evaluateHand takes a list of 5 cards (0-51) // Returns: enum of Hand type and up to 5 values of the cards sorted...
Helper to get the value for a card 1,12 plus Ace high can be 13. Used for judging relative strength Ace values as High Ace in ranking
function getCardOrderValue(CardValue cardVal) public pure returns (int8) { if (int8(cardVal) == 0) { return int8(CardValue.Ace_High); } return int8(cardVal); }
12,990,233
/* MIT License Copyright (c) 2021 Reflexer Labs Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, ...
Function that returns the target ticks based on the redemption price return targetTick The target tick that represents the redemption price/ 1. Get prices from the oracle relayer 2. Calculate the price ratio
function getTargetTick() public returns(int24 targetTick){ (uint256 redemptionPrice, uint256 ethUsdPrice) = getPrices(); uint160 sqrtPriceX96; if (systemCoinIsT0) { sqrtPriceX96 = toUint160(sqrt((redemptionPrice.mul(PRICE_RATIO_SCALE).div(ethUsdPrice) << SHIFT_AMOUNT) / PRICE_RATI...
14,064,078
./full_match/1/0xf1409a2f1F5f53e46BbAfd334311c80e675a410D/sources/contracts/moneymarkets/aave/imports/ILendingPool.sol
Aave lending pool interface
interface ILendingPool { function deposit(address _reserve, uint256 _amount, uint16 _referralCode) external; function getReserveData(address _reserve) external view returns ( uint256 totalLiquidity, uint256 availableLiquidity, uint256 totalBorr...
8,435,106
./full_match/1/0x489dC359F9f1799FBf388abf91cFe7cb37736D6a/sources/contracts/PPIE.sol
Sender redeems pTokens in exchange for the underlying asset Accrues interest whether or not the operation succeeds, unless reverted redeemTokens The number of pTokens to redeem into underlying return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/
function redeem(uint redeemTokens) external override returns (uint) { (uint err, uint amount) = redeemInternal(redeemTokens); if (err == 0) { _moveDelegates(delegates[msg.sender], address(0), uint96(amount)); } return err; }
8,387,359
/** *Submitted for verification at Etherscan.io on 2021-03-08 */ // SPDX-License-Identifier: MIT pragma solidity 0.8.0; // File: BusStation.sol contract BusStation { /* ==== Variables ===== */ mapping(address => uint256) public _seats; bool public _hasBusLeft; uint256 public _ticketTotalValue; ...
If bus is eligible, anybody can trigger the bus ride
function triggerBusRide() external isReadyToRide { uint256 amount = _ticketTotalValue; _ticketTotalValue = 0; _hasBusLeft = true; _destination.transfer(amount);
2,128,617
// SPDX-License-Identifier: MIT pragma solidity >=0.8.3 <0.9.0; //assertions check for things like equality, inequality or emptiness // in order to return a pass/fail for the test import "truffle/Assert.sol"; // helps deploy a fresh instance of the contract to the blockchain for testing import "truffle/DeployedAddress...
test escrow and transaction procedure will use the last added book from earlier so that the price is 0 will need to be partly done in javscript to test actual eth transfer temporary variables to test escrow ganache account run escrow transaction Assert.isTrue((uint(buyer.balance) + priceGwei) <= (balance), "correct bal...
function testEscrowCreate() public { uint count = store.getCount(); address buyer = 0xC6bae7b84BE3916F298dB197fc7011a78fc6065C; emit VariablesCreated(block.timestamp); store.createTxn(count - 1, buyer); emit TransactionCompleted(block.timestamp); address addr = sto...
12,912,579
./full_match/42/0xac3656770C6053A28faF0842D7447A6A616D7944/sources/UnitTest/PreachersCompFiLqdtKyberSwapKovanAM.sol
KyberSwap functions/ Swap from srcToken to destToken (including ether) If the source token is not ETH (ie. an ERC20 token), the user is required to first call the ERC20 approve function to give an allowance to the smart contract executing the transferFrom function. mitigate ERC20 Approve front-running attack, by initia...
function executeKyberSwap( address SrcToken, uint256 srcQty, address DestToken, address payable destAddress ) public returns ( uint256 ) { ISimpleKyberProxy cSimpleKyberProxy = ISimpleKyberProxy( kKyberNetworkProxy ); IKyberNetworkProxy cKyberProxy = IKyberNetworkProxy( ...
16,230,000
./full_match/1/0x95D2e9aced656f4dE01f9f54B4A2a1B2787A074C/sources/src/Token.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 {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 requestedDecrease) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); if (currentAllowance < requestedDecrease) { revert("ERC20: decreased allowance below zero"); ...
3,122,728
./full_match/1/0x6cE532764F3c7700cdA0967a6aC5B4f636201491/sources/contracts/PreSaleDop.sol
Creates a new Round startTime The startTime of the round endTime The endTime of the round price The dopToken price in the round
function createNewRound( uint256 startTime, uint256 endTime, uint256 price ) external onlyOwner { RoundData memory roundData = rounds[_roundIndex]; uint8 newRound = ++_roundIndex; if (price < roundData.price) { revert PriceLessThanOldRound(); }...
2,940,971
./partial_match/42220/0x553a2a1B70725C1042A0D76e16f4f5a683648dEB/sources/src/shared/UsesCore.sol
Contract is already init, and cannot be initialized again. Selector 0xef34ca5c. Attempting to set Core address to zero. Selector 0xf71b2b01. The slot at which the core contract address is stored. 0xc6a342a8a7e6992aa2a41ce922cb4520fcb72f46fb4f9e41cdd65930adc9ca4c. Read the core contract address. return _core The W...
function core() public view returns (IWormhole _core) { uint256 slot = uint256(CORE_SLOT); assembly ("memory-safe") { _core := sload(slot) } }
3,498,031
// SPDX-License-Identifier: MIT pragma solidity ^0.6.2; import "../strategy-qi-farm-base.sol"; contract StrategyBenqiWavax is StrategyQiFarmBase { address public constant qiavax = 0x5C0401e81Bc07Ca70fAD469b451682c0d747Ef1c; //lending receipt token constructor( address _governance, ad...
get the value of Native Avax in the contract unwrap wavax to avax for benqi confirm that msg.sender received avax mint qiTokens external payable confirm that qiTokens is received in exchangecheck if there is a balance of Native Avax Outstanding confirm that msg.sender received avax mint qiTokens external payable confir...
function deposit() public override { uint256 _want = IERC20(want).balanceOf(address(this)); uint256 _avax = address(this).balance; if (_want > 0) { WAVAX(want).withdraw(_want); require(address(this).balance >= _want, "!unwrap unsuccessful"); require( ...
12,872,452
./full_match/84531/0x9eb38079e6AA48C3A5F4896DBAFd78F9Dd3D0822/sources/Payable.sol
Function to transfer Ether from this contract to address from input
function transfer(address payable _to, uint _amount) view external { }
11,499,557
/** *Submitted for verification at Etherscan.io on 2019-06-06 */ /** * Source Code first verified at https://etherscan.io on Wednesday, April 24, 2019 (UTC) */ pragma solidity ^0.4.25; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address who) ...
the challenge was completed successfully, or the delegate failed to respond on time. The challenger will collect the stake. collectSlot Collect slot config Various parameters accounts a reference to the main accounts array/
function challenge_success( Data.CollectSlot storage collectSlot, Data.Config storage config, Data.Account[] storage accounts ) public { require((collectSlot.status == 2 || collectSlot.status == 4), "Wrong Collect Slot status"); require(challengeHa...
5,496,449
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0 <0.9.0; import "./OwnableStorage.sol"; contract Ownable{ OwnableStorage _storage; function initialize( address storage_ ) public { _storage = OwnableStorage(storage_); } modifier OnlyAdmin(){ require( _storage.isAdmin(msg.sende...
Hard Work Now! For Punkers by 0xViktor...
function getAllocation( address forge ) public view returns( uint ){ return getAllocation( ).mul( weights[ forge ] ).div( weightSum ); }
1,144,748
./full_match/1/0x1e1FddCf2Df356F05E0fF1842e60f47F4B573659/sources/OxSniper.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("0xSniper", "0XS") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUnis...
8,302,983
/** *Submitted for verification at Etherscan.io on 2021-02-26 */ // SPDX-License-Identifier: MIT pragma solidity ^0.6.6; pragma experimental ABIEncoderV2; interface IPairXCore { // 向池子中存入资产 function deposit( address token , address to , uint amount ) external ; // 取回指定的Token资产及奖励 function claim( a...
rewardTotal = RewardTotal[sender] ;
function depositInfo( address sender , address token ) external view returns ( uint depositBalance ,uint depositTotal , uint leftDays , uint lockedReward , uint freeReward , uint gottedReward ) { depositBalance = UserBalance[sender][token] ; if( token == Token0 ) { depositTo...
6,834,310
//SPDX-License-Identifier: Unlicense pragma solidity ^0.6.6; import '@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol'; import '@openzeppelin/contracts/math/SafeMath.sol'; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; // import 'hardhat/console.sol'; contract AutoBuy { using SafeMath fo...
console.log(haremLPToken.balanceOf(address(this))); console.log(IERC20(haremToken).balanceOf(address(this))); console.log(haremLPToken.balanceOf(address(this))); console.log(haremLPToken.balanceOf(address(this))); console.log(haremLPToken.balanceOf(msg.sender));
function swapAndAddLiquidity(uint256 amount) public payable{ require(msg.value == amount.mul(2), 'Message value incorrect.'); address[] memory path = new address[](2); path[0] = uniswapRouterV2.WETH(); path[1] = haremToken; uniswapRouterV2.swapExactETHForTokens.value(amount)(0, path, address(thi...
12,086,327
./full_match/1/0x70832E3e9a3268Fe9A5a47803e945fC34280B976/sources/src/Registry.sol
Helper function to unpause some target./
function _unpauseTarget(address target) internal { if (!isCallerPaused[target]) revert Registry__TargetNotPaused(target); isCallerPaused[target] = false; emit TargetUnpaused(target); }
3,224,015
./full_match/314/0x7b7f1f85F599b63432F5D782041c25Dad354f999/sources/node_modules/@openzeppelin/contracts/utils/ReentrancyGuard.sol
By storing the original value once again, a refund is triggered (see https:eips.ethereum.org/EIPS/eip-2200)
function _nonReentrantAfter() private { _status = NOT_ENTERED; }
8,082,965
./full_match/5/0xBB4a18773C5F036Ad821059dd3574320934b567F/sources/contracts/MonoLiquidity.sol
0x swap this function is used to execute a swap on 0x it takes the parameters from the API response and executes the swap it also gives an infinite allowance to the 0x contract to spend the `sellToken` the amount to swap is determined in `sellAmount` field when fetching the quote from the API, it's encoded in the `data...
function zeroxSwap( address sellToken, address buyToken, address spender, address payable swapTarget, bytes calldata swapCallData, uint amountIn, uint amountOut ) external payable { require(swapTarget == exchangeProxy, "Target not ExchangeProxy"); require( IERC20(sellToke...
7,061,691
./full_match/5/0x443B523d2994762FDC76043EDD194314f60641cC/sources/contracts/RedistributionChef.sol
Rescue ETH force-sent to contract
function rescueETH() external onlyOwner { require(sent); }
7,063,460
./full_match/1/0x5537f945D8c3FCFDc1b8DECEEBD220FAD26aFdA8/sources/contracts/ComposableStablePool.sol
Translate parameters to avoid stack-too-deep issues in the constructor
function _extractStorageParams(NewPoolParams memory params) private view returns (ComposableStablePoolStorage.StorageParams memory) { return ComposableStablePoolStorage.StorageParams({ registeredTokens: _insertSorted(params.tokens, IERC20(this)), ...
4,901,416
pragma solidity 0.6.12; pragma experimental ABIEncoderV2; /// SPDX-License-Identifier: MIT import "@openzeppelin-3.4.0/token/ERC20/IERC20.sol"; import "@openzeppelin-3.4.0/token/ERC20/SafeERC20.sol"; import "./interfaces/Upgradeable.sol"; import "./GovToken.sol"; import "./MintCoordinator_Polygon.sol"; import "./inte...
Anyone can contribute GOV to a given pool
function addExternalReward(uint256 _amount) public checkNoPause { IMasterChef.PoolInfo storage pool = poolInfo[GOV_POOL_ID]; require(block.number > pool.lastRewardBlock, "rewards not started"); uint256 lpSupply = balanceOf[GOV_POOL_ID]; require(lpSupply != 0, "no deposits"); ...
15,815,778
pragma solidity 0.5.17; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "../../utils/BytesLib.sol"; /// @title Group Selection /// @notice The group selection protocol is an interactive method of selecting /// candidate group from the set of all stakers given a pseudorandom seed value. /// /// The ...
Performs full verification of the ticket. use first 8 bytes to compare ticket values solium-disable-next-line /
function isTicketValid( uint64 ticketValue, uint256 stakerValue, uint256 virtualStakerIndex, uint256 stakingWeight, uint256 groupSelectionSeed ) internal view returns(bool) { uint64 ticketValueExpected; bytes memory ticketBytes = abi.encodePacked( ...
7,324,562
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functi...
Generates the correct cross domain calldata for a message. _target Target contract address. _sender Message sender address. _message Message to send to the target. _messageNonce Nonce for the provided message. return ABI encoded cross domain calldata./
function batches() external view returns ( iOVM_ChainStorageContainer ); function queue() external view returns ( iOVM_ChainStorageContainer ); function getTotalElements() external view returns ...
5,909,510
./full_match/1/0x2B81d60dc40f6Ca230be5Abf5641D4c2E38dba01/sources/src/vaults/VaultGovernance.sol
Set Delayed Protocol Params params New params
function _stageDelayedProtocolParams(bytes memory params) internal { _requireProtocolAdmin(); uint256 delayFactor = _delayedProtocolParams.length == 0 ? 0 : 1; _stagedDelayedProtocolParams = params; _delayedProtocolParamsTimestamp = block.timestamp + _internal...
8,327,319
./full_match/1/0x59B7E328F655B82E617E20446B393be472E8cBa5/sources/browser/MoneyPrinter.sol
This is the function that will be called postLoan i.e. Encode the logic to handle your flashloaned funds here
function callFunction( address sender, Account.Info memory account, bytes memory data ) external override { (address tokenIn, uint amountIn, address[] memory path) = abi.decode(data, (address, uint256, address[])); IERC20(tokenIn).approve(uni_addr, amountIn); ...
17,040,700
./full_match/1/0x363E9489a4ccE10Ee3F86Bc049E08290D1731957/sources/contracts/oz/access/Ownable.sol
Throws if the sender is not the owner./
function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OnlyOwner(); } }
8,341,061
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.7; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable...
IStableMasterFront Angle Core Team Front interface, meaning only user-facing functions
interface IStableMasterFront { function mint( uint256 amount, address user, IPoolManager poolManager, uint256 minStableAmount ) external; function burn( uint256 amount, address burner, address dest, IPoolManager poolManager, uint256 mi...
6,009,188
./partial_match/1/0x7582C2b3319150C087F3816cAe655FfD255eFd1F/sources/EdFiStakePool.sol
Stake EdFi tokens to EdFiStakePool
function stake(uint256 _amount) external nonReentrant whenNotPaused { UserInfo storage user = userInfo[_msgSender()]; updatePool(); if (user.amount > 0) { uint256 pending = user .amount .mul(poolInfo.accEdFiPerShare) ...
16,172,701
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import "../ERC20.sol"; import "./ERC721.sol"; import "../interfaces/Interfaces.sol"; contract EtherOrcsAllies is ERC721 { uint256 constant startId = 5050; mapping(uint256 => Ally) public allies; mapping(address => bool) public auth; uint16 shS...
selector = `onERC721Received(address,address,uint,bytes)`
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public { transferFrom(from, to, tokenId); if (to.code.length != 0) { (, bytes memory returned) = to.staticcall(abi.encodeWithSelector(0x150b7a02, msg.sender, address(0), toke...
617,314
./partial_match/1/0xc93Cf2560DCA1DB02D2a4fCCde43e8a34F626d53/sources/contracts/Allowlist.sol
Determines if an address exists in the allowlist. _address The address to check. return Whether the address is allowed at this time.
function isAllowed(address _address) public view returns(bool) { return allowed[_address] > block.timestamp; }
2,735,322
./full_match/42/0x7d57CEbd42C5b08FF769A61BaA709a7a5cFb7446/sources/localhost/IspitniRok.sol
if (address(prijave[rBrPrijave].ispit.profesor)==msg.sender){
function zavediOcenu(uint rBrPrijave, uint ocena) public returns (bool){ if (!arhiviran) { if (prijave[rBrPrijave].izasaoNaIspit==true) { prijave[rBrPrijave].ocena=ocena; prijave[rBrPrijave].student.zavediOcenu(rBrPrijave,ocena); ...
9,574,530
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to a...
Returns the set of traits given a token id tokenId the id of the token return traits array/
function _getTraits(uint256 tokenId) internal view returns (uint256[8] memory traits) { Combination memory c = _idToCombination[tokenId]; traits[0] = c.base; traits[1] = c.necklace; traits[2] = c.facial; traits[3] = c.earring; traits[4] = c.head; traits[5] = c.glasses; traits[6] = c.li...
12,005,994
./full_match/80001/0x38a043BAd4F996fB5d2c13b725502524A68BBb24/sources/contracts/OverridableDrop.sol
Checks a request to claim NFTs against the active claim condition's criteria. At any given moment, returns the uid for the active claim condition.
function verifyClaim( uint256 _conditionId, address _claimer, uint256 _category, uint256 _quantity, address _currency, uint256 _pricePerToken, AllowlistProofWithCategory calldata _allowlistProof ) public virtual returns (bool isOverride); function get...
9,521,247
pragma solidity ^0.5.5; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high l...
View pool token info _pool Token address. return Pool info/
function poolTokenInfo(address _pool) public view returns ( uint256 rate, uint256 adapter, uint256 totalStaked ) { Pool storage pool = pools[_pool]; return (pool.rate, pool.adapter, pool.totalStaked); }
6,159,413
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "./events.sol"; import "../../../../infiniteProxy/IProxy.sol"; contract RebalancerModule is Events { using SafeERC20 for IERC20; /** * @dev Only rebalancer gaurd. */ modifier onlyRebalancer() { require( _isR...
Helper function to validate the safety of aave position after rebalancing./ TODO: add a fallback oracle fetching price from chainlink in case Aave changes oracle in future or in Aave v3?
function validateFinalPosition() internal view returns ( bool criticalIsOk_, bool criticalGapIsOk_, bool minIsOk_, bool minGapIsOk_ ) { ( uint256 tokenColAmt_, uint256 stethColAmt_, uint25...
6,184,202
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.4; pragma experimental ABIEncoderV2; import "../../libraries/SafeMathExt.sol"; import "../../interface/IOracle.sol"; // An oracle router calculates the asset price with a given path. // A path is [(oracle, isInverse)]. The OracleRouter never verifies whether th...
Index price./
function priceTWAPShort() external returns (int256 newPrice, uint256 newTimestamp) { newPrice = Constant.SIGNED_ONE; for (uint256 i = 0; i < _path.length; i++) { (int256 p, uint256 t) = IOracle(_path[i].oracle).priceTWAPShort(); if (_path[i].isInverse && p != 0) { ...
12,599,359
./full_match/11155111/0x5Faed70fF0851310dEaF48B09934e830433B8385/sources/project_/contracts/ERC20Crowdsale.sol
calculate token amount to be created
function sellTokens(address _swapTokenAddr, address _beneficiary, uint256 _tokenAmount) public nonReentrant { _preValidateSell(_swapTokenAddr, _beneficiary, _tokenAmount); uint256 swapTokenAmount = _getSwapTokenAmount(_swapTokenAddr, _tokenAmount); IERC20 swapToken = IERC20(_swapTokenAddr)...
3,834,654
/** *Submitted for verification at Etherscan.io on 2020-09-18 */ pragma solidity 0.5.15; // YAM v3 Token Proxy /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers u...
Increase the amount of tokens that an owner has allowed to a spender. This method should be used instead of approve() to avoid the double approval vulnerability described above. spender The address which will spend the funds. addedValue The amount of tokens to increase the allowance by./
function increaseAllowance( address spender, uint256 addedValue ) returns (bool) { delegateAndReturn(); }
5,539,292
./full_match/1/0xcE9b49b0d4FE456aD6E4a1b7e4bBdD0699400Ef9/sources/src/vaults/VaultPermissions.sol
@inheritdoc IVaultPermissions
function decreaseBorrowAllowance( address operator, address receiver, uint256 byAmount ) public virtual override returns (bool) { address owner = msg.sender; uint256 currentAllowance = _borrowAllowance[owner][operator][receiver]; if (byAmount > currentAllowance) { rev...
2,939,852
./full_match/1/0x4838099e16FC56bFdD8a76B7Fb9f338513Dd1575/sources/contracts/CrashTrading.sol
See {IERC721Enumerable-tokenOfOwnerByIndex}./
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), 'ERC721Enumerable: owner index out of bounds'); return _ownedTokens[owner][index]; }
3,103,487
/** *Submitted for verification at Etherscan.io on 2020-12-08 */ pragma solidity ^0.6.0; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes m...
See {IERC20-balanceOf}./
function balanceOf(address account) public view override returns (uint256) { return _balances[account]; }
2,215,124
./full_match/100/0x8C7A2C496279d29732bacAF1550468b56d110968/sources/contracts/official/SB03/SB03Token.sol
Returns how many days there are between _startDate and _endDate, considering that a year has 360 days. Retorna quantos dias há entre StartDate e EndDate em um ano de 360 dias. Função utilizada na inicialização, pública para referência./ get date from timestamp if start date is the last day of the month, it is treated ...
function days360( uint256 _startDate, uint256 _endDate, bool _method ) public pure returns (uint256) { require(!_method, "Method true not implemented"); ( uint256 nStartYear, uint256 nStartMonth, uint256 nStartDay ) = BokkyPooBahsDateTimeLibrary.timestampToDate(_star...
14,271,653
./full_match/1/0xeBB8e2374D6535bD89cC362715c02fDD902B64c8/sources/contracts/NFTSwapAgent.sol
try forward swap. At this moment only do forward bridge
function swapProcess( address tokenAddr, address recipient, uint256 tokenId, uint256 dstChainId ) private { if (registeredToken[dstChainId][tokenAddr]) { IERC721 token = IERC721(tokenAddr); token.safeTransferFrom(msg.sender, address(this), tokenId); emit SwapStarted( to...
3,850,073
./full_match/84531/0x352526ec35BAFb288d2A1c302f6625e1ce85aaEa/sources/contracts/WeightedPoolProtocolFees.sol
Returns the all time high value for the weighted product of the Pool's tokens' rates. Yield protocol fees are only charged when this value is exceeded./
function getATHRateProduct() public view returns (uint256) { return _athRateProduct; }
14,299,083
./full_match/1/0x72EBDC2DB5c0A8ec1f76EEb0146C897DcC03a79B/sources/contracts/TorusPool.sol
underlying token is always WETH
function addCurvePool(address _pool) external override onlyOwner { require(!_curvePools.contains(_pool), "pool already added"); ICurveRegistryCache curveRegistryCache_ = controller.curveRegistryCache(); curveRegistryCache_.initPool(_pool); bool supported_ = curveRegistryCache_.hasCoi...
8,333,362
pragma solidity ^0.5.0; library Address { function isContract(address account) internal view returns (bool) { uint256 size; assembly { size := extcodesize(account) } return size > 0; } function toPayable(address account) internal pure returns (address payable) { return addre...
Function that is called when a user or another contract wants to transfer funds .
function transfer(address recipient, uint256 amount) public whenNotPaused returns (bool success) { _transfer(msg.sender, recipient, amount); return true; }
249,079
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.6.8; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../../lib/data/Transfers.sol"; import "../../lib/protobuf/IssuanceData.sol"; import "../../lib/protobuf/LendingData.sol"; import "../../lib/priceoracle/PriceOracle...
Returns the issuance-specific data about the engagement./
function _getEngagementCustomProperty(uint256 /** engagementId */) internal override view returns (bytes memory) { return LendingEngagementProperty.encode(_lep); }
5,478,468
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.7; /* ██████ ██████ ██ ██ ███ ██ ██████ ██ ██ ██ ██ ██ ████ ██ ██ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██████ ██████ ██ ████ ██████ */ import {IERC2981Upgr...
Informs other contracts which interfaces this contract supports https://eips.ethereum.org/EIPS/eip-165
function supportsInterface(bytes4 _interfaceId) public view override(ERC721Upgradeable, IERC165Upgradeable) returns (bool) { return type(IERC2981Upgradeable).interfaceId == _interfaceId || ERC721Upgradeable.supportsInterface(_interfaceId); }
5,724,113
pragma solidity 0.4.23; import "./Ownable.sol"; /** @title User * @dev User is the base class for all'the users: Student, Professor and Admin */ contract User is Ownable { bytes private name; bytes private surname; bytes private socialNumber; uint private serial; /** @dev Constructor of User ...
get for user surname return bytes the string of the surname/
function getSurname() public view returns(bytes) { return surname; }
6,343,171
./partial_match/1/0xa482246fFFBf92659A22525820C665D4aFfCF97B/sources/ETFloft.sol
Overload of {ECDSA-recover-bytes32-bytes-} that receives the `v`, `r` and `s` signature fields separately./ EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature unique. Appendix F in the Ethereum Yellow paper (https:ethereum.github.io/yellowpaper/paper.pdf), defines ...
function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { require(uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, "ECDSA: invalid signature 's' value"); require(v == 27 || v == 28, "ECDSA: invalid signature 'v' value"); ...
16,175,545
/** *Submitted for verification at Etherscan.io on 2021-10-02 */ // ┏━━━┓━━━━━┏┓━━━━━━━━━┏━━━┓━━━━━━━━━━━━━━━━━━━━━━━ // ┃┏━┓┃━━━━┏┛┗┓━━━━━━━━┃┏━━┛━━━━━━━━━━━━━━━━━━━━━━━ // ┃┗━┛┃┏━┓━┗┓┏┛┏━━┓━━━━┃┗━━┓┏┓┏━┓━┏━━┓━┏━┓━┏━━┓┏━━┓ // ┃┏━┓┃┃┏┓┓━┃┃━┃┏┓┃━━━━┃┏━━┛┣┫┃┏┓┓┗━┓┃━┃┏┓┓┃┏━┛┃┏┓┃ // ┃┃ ┃┃┃┃┃┃━┃┗┓┃┃━┫━┏┓━┃┃━━━┃┃┃┃┃┃┃┗┛┗┓┃...
override the auto-generated getter for testAuthor as a public var override the auto-generated getter for protocolName as a public var override the auto-generated getter for testedContracts [] as a public var override the auto-generated getter for testName as a public var single bool function that inspects the invariant...
interface IAnteTest { function testAuthor() external view returns (address); function protocolName() external view returns (string memory); function testedContracts(uint i) external view returns (address); function testName() external view returns (string memory); function checkTestPasses() exte...
10,696,004
./full_match/80001/0x2b2666C612a7790aE79ba0D6F10fd0E4ADfd2775/sources/contracts/NYW/NYW_Factory.sol
only use cutoffs for string attributes, that's why the loop is until lenght -5 Here we will give each yacht different stats based on their type:
function decodeTokenId(uint256 randomValue, uint256 _tokenId) public view returns (uint256[] memory) { require(randomValue != 0, "Tokens have not been revealed yet"); uint256 tokenCode = uint256( keccak256(abi.encode(randomValue, _tokenId)) ); ...
9,458,624
pragma solidity 0.6.12; import "openzeppelin-solidity-pixura/contracts/token/ERC721/ERC721.sol"; import "openzeppelin-solidity-pixura/contracts/access/Ownable.sol"; import "openzeppelin-solidity-pixura/contracts/math/SafeMath.sol"; import "./ISupeRare.sol"; import "./IERC721Creator.sol"; /** * @title SuperRare Legac...
/ tokenCreator/ Refreshes the pre-upgrade token owner. Useful in the event of a non-upgraded token transferring ownership. Throws if token has upgraded or if there is nothing to refresh. _tokenId uint256 token id to refresh the pre-upgrade token owner. return address of the token pre-upgrade owner./
function tokenCreator(uint256 _tokenId) external override view returns (address payable) { return oldSuperRare.creatorOfToken(_tokenId); }
5,374,594
library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a ...
make sure token owner is not sending to selfsafely check to prevent against an unexpected 0x0 defaultmake sure sent amount is greater than or equal to the sellPricePay previous tokenOwner if owner is not contract
function purchase(uint256 _tokenId) public payable { address sellOwner = athleteIndexToOwner[_tokenId]; address buyOwner = msg.sender; uint256 sellPrice = msg.value; require(sellOwner != buyOwner); require(_addressNotNull(buyOwner)); require(msg.value >= sellPrice); ...
4,809,384
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; contract Adoption is Ownable { address[16] public animalAdopters; string private nickname; event AdoptedAnimal(uint256 animalId); function adoptAnimal(uint256 animalId) public returns (uint25...
If the animal has been adopted by msg.sender, the animal can be returned "Return" an animal by setting the address of it's adopter back to 0
function returnAnimal(uint256 animalId) public returns (uint256) { require(animalId >= 0 && animalId <= 15); if (animalAdopters[animalId] == msg.sender) { animalAdopters[animalId] = address(0); } emit ReturnedAnimal(animalId); return animalId; } event ...
7,274,795
./partial_match/1/0x539832de226d3Cd50c8a01D3037c73A5Ef093E2A/sources/MasterChef.sol
Safe connectx transfer function, just in case if rounding error causes pool to not have enough CONNECTXs.
function safeCONNECTxTransfer(address _to, uint256 _amount) internal { uint256 connectxBal = connectx.balanceOf(address(this)); if (_amount > connectxBal) { connectx.transfer(_to, connectxBal); connectx.transfer(_to, _amount); } }
4,303,623
./partial_match/1/0xa1C375777da0644299DFbeE62d4eaa894A682195/sources/XINGYUNBET.sol
exclude from paying fees or having max transaction amount
constructor() ERC20(unicode"幸运的赌注", unicode"幸运") { marketingWallet = address(msg.sender); devWallet = address(0x3d8A651178AC6aE641fA2892b1FDedCdf27C119E); uint256 _buyMarketingFee = 0; uint256 _buyLiquidityFee = 0; uint256 _buyDevFee = 0; uint256 _sellMarketingFee ...
15,636,316
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.7.5; pragma abicoder v2; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; /** * @dev This contract allows for non-custodial Gitcoin Grants match payouts. It works as follows: * 1. During a matching round, deploy a new instance of this contract...
Called by the owner to enable withdrawals of match payouts Once called, this cannot be reversed!/
function enablePayouts() external onlyOwner requireState(State.Finalized) { state = State.Funded; emit Funded(); }
97,583
//Address: 0x7fC0382722c8dDcA9B6CE920C4e95fa9ca229799 //Contract name: RestartEnergyCrowdsale //Balance: 0 Ether //Verification Date: 1/13/2018 //Transacion Count: 9 // CODE STARTS HERE pragma solidity ^0.4.18; // ----------------- //begin Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owne...
calculate token amount to be created update state mint the tokens update purchasereventforward funds to our wallet
function buyTokens(address beneficiary) public whenNotPaused payable { require(!isFinalized); require(beneficiary != address(0)); require(validPresalePurchase() || validPurchase()); uint256 weiAmount = msg.value; uint256 tokens = weiAmount.mul(getRate()); require(v...
5,511,925
// SPDX-License-Identifier: MIT pragma solidity ^0.7.4; pragma experimental ABIEncoderV2; uint256 constant SECONDS_IN_THE_YEAR = 365 * 24 * 60 * 60; // 365 days * 24 hours * 60 minutes * 60 seconds uint256 constant DAYS_IN_THE_YEAR = 365; uint256 constant MAX_INT = type(uint256).max; uint256 constant DECIMALS18 = 10*...
updates cumulative sum for a particular PB or for all of them if policyBookAddress is zero
function _updateCumulativeSum(address policyBookAddress) internal { uint256 toAddSum = block.number.sub(lastUpdateBlock).mul(toUpdateRatio); uint256 totalStaked = totalPoolStaked; uint256 newCumulativeSum = cumulativeSum.add(toAddSum); totalStaked > 0 ? toUpdateRatio = ...
5,815,142
pragma solidity 0.4.18; /** * @title RLPReader * @dev RLPReader is used to read and parse RLP encoded data in memory. * @author Andreas Olofsson (androlo1980@gmail.com) */ library PlasmaRLP { uint constant DATA_SHORT_START = 0x80; uint constant DATA_LONG_START = 0xB8; uint constant LIST_SHORT_START = ...
Decode an RLPItem into an address. This will not work if the RLPItem is a list. self The RLPItem. return The decoded string.
function toAddress(RLPItem memory self) private view returns (address data) { var (rStartPos, len) = _decode(self); assembly { data := div(mload(rStartPos), exp(256, 12)) } }
12,912,980
pragma solidity ^0.4.11; /** * @title SafeMath * @dev Math operations with safety checks that revert() on error */ library SafeMath { function mul(uint a, uint b) internal returns (uint) { uint c = a * b; asserts(a == 0 || c / a == b); return c; } function safeSub(uint a, uint b) int...
Set to finney for ease of testing on ropsten: 1e15 (or smaller) || Ether for main net 1e18
function toWei(uint _amount) constant returns (uint256 result){ result = _amount.mul(1e18); return result; }
5,376,854
/** * Copyright 2017-2022, OokiDao. All Rights Reserved. * Licensed under the Apache License, Version 2.0. */ pragma solidity 0.5.17; pragma experimental ABIEncoderV2; import "LoanClosingsBase.sol"; contract LoanClosings is LoanClosingsBase { function initialize( address target) external ...
Repays principal to lender
function _closeWithSwap( bytes32 loanId, address receiver, uint256 swapAmount, bool returnTokenIsCollateral, bytes memory loanDataBytes) internal pausable returns ( uint256 loanCloseAmount, uint256 withdrawAmount, ad...
6,959,434
./full_match/1/0xA90b7861B734784E5eAF87bCD079b1EDfEd24555/sources/contracts/ERC721M.sol
Implementation of minting./ Check stage supply if applicable Check global wallet limit if applicable Check wallet limit for stage if applicable, limit == 0 means no limit enforced Check merkle proof if applicable, merkleRoot == 0x00...00 means no proof required
function _mintInternal( uint32 qty, address to, bytes32[] calldata proof, uint64 timestamp, bytes calldata signature ) internal canMint hasSupply(qty) { uint64 stageTimestamp = uint64(block.timestamp); MintStageInfo memory stage; if (_cosigner != ...
17,182,152
./full_match/1/0x8787ca6A0aFffd8F634D09d7c2eE8D15b326e3f6/sources/src/FeeDistributor.sol
It is required that both the global, token and user state have been properly checkpointed before calling this function./ The first week which cannot be correctly claimed is the earliest of: - A) The global or user time cursor (whichever is earliest), rounded up to the end of the week. - B) The token time cursor, rounde...
function _claimToken(address user, ERC20 token) internal returns (uint256) { TokenState storage tokenState = _tokenState[token]; uint256 nextUserTokenWeekToClaim = _getUserTokenTimeCursor(user, token); uint256 firstUnclaimableWeek = Math.min( _roundUpTimestamp( M...
2,980,009
// File: @openzeppelin/contracts/security/ReentrancyGuard.sol pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no ...
Initializes the contract setting the `tokenName` and `symbol` of the nft, `cost` of each mint call, and maximum `supply` of the nft. Note: `cost` is in wei./
function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity } pragma solidity ^0.8.7; constructor(string...
1,200,647
/** *Submitted for verification at Etherscan.io on 2020-03-29 */ /** *Submitted for verification at Etherscan.io on 2019-10-18 */ pragma solidity ^0.5.5; library strings { struct slice { uint _len; uint _ptr; } function memcpy(uint dest, uint src, uint len) private pure { // Co...
Returns true if the two slices contain the same text. self The first slice to compare. self The second slice to compare. return True if the slices are equal, false otherwise./
function equals(slice memory self, slice memory other) internal pure returns (bool) { return compare(self, other) == 0; }
13,059,143
./partial_match/570/0x2b76AaE10952527b8b34Ead1C1703F53fCfC8B27/sources/contracts/L2/L2ToL1MessagePasser.sol
Sends a message from L2 to L1. _target Address to call on L1 execution. _gasLimit Minimum gas limit for executing the message on L1. _data Data to forward to L1 target.
function initiateWithdrawal( address _target, uint256 _gasLimit, bytes memory _data ) public payable { bytes32 withdrawalHash = Hashing.hashWithdrawal( Types.WithdrawalTransaction({ nonce: messageNonce(), sender: msg.sender, ...
3,504,322
./partial_match/1/0x19B8328F54017a6fA3A277209B7b6C5d2B50A4A2/sources/ACEOwner.sol
Fallback function allows to deposit ether.
function() external payable { if (msg.value > 0) emit Deposit(msg.sender, msg.value); } public validRequirement(_owners.length, _required)
2,601,935