file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
pragma solidity 0.5.9; import "./lib/Ownable.sol"; import "./lib/SafeMath.sol"; import "./lib/ERC20Plus.sol"; import "./lib/Lockable.sol"; /** * @title BonusTokenDistribution - contract for handling bonus tokens * @author Markus Waas - <markus@starbase.co> */ contract BonusTokenDistribution is Lockable { usin...
Adds bonus claim for user _user Address of the user _amount Amount of tokens he can claim/
function addBonusClaim(address _user, uint256 _amount) public onlyOwner hasStarted { require(_user != address(0), "user cannot be 0!"); require(_amount > 0, "amount cannot be 0!"); bonusTokenBalances[_user] = bonusTokenBalances[_user].add(_amount); }
6,362,249
/** * @authors: [] * @reviewers: [] * @auditors: [] * @bounties: [] * @deployments: [] * * SPDX-License-Identifier: MIT */ pragma solidity >=0.7; import "./BinaryArbitrable.sol"; import "../.././interfaces/IAppealEvents.sol"; import "@kleros/erc-792/contracts/IArbitrable.sol"; import "@kleros/erc-792/contracts...
Gets the current price of a specified task. _taskID The ID of the task. return price The price of the task./
function getTaskPrice(uint256 _taskID) public view returns (uint256 price) { Task storage task = tasks[_taskID]; if (block.timestamp - task.lastInteraction > task.submissionTimeout || task.status != Status.Created) { price = 0; price = task.minPrice + ...
913,314
./full_match/314/0x7b7f1f85F599b63432F5D782041c25Dad354f999/sources/node_modules/@openzeppelin/contracts/access/extensions/AccessControlDefaultAdminRules.sol
Returns the amount of seconds to wait after the `newDelay` will become the new {defaultAdminDelay}. The value returned guarantees that if the delay is reduced, it will go into effect after a wait that honors the previously set delay. See {defaultAdminDelayIncreaseWait}./ When increasing the delay, we schedule the delay...
function _delayChangeWait(uint48 newDelay) internal view virtual returns (uint48) { uint48 currentDelay = defaultAdminDelay(); return newDelay > currentDelay : currentDelay - newDelay; }
8,082,635
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.11; contract Exercice { enum etape { commander, expedier,livre} //renvoi un entier et nom une chaine de caractere ! struct produit { uint _SKU; Exercice.etape _etape; } mapping( address => produit) CommendeClient; //commande...
expedier le produit :
function expedier(address _client) public { CommendeClient[_client]._etape = etape.expedier; }
14,052,157
./full_match/1/0x0f08eEf2C785AA5e7539684aF04755dEC1347b7c/sources/contracts/gauges/StakelessGaugeCheckpointer.sol
@inheritdoc IStakelessGaugeCheckpointer
function checkpointMultipleGauges(string[] memory gaugeTypes, address[] memory gauges) external payable override nonReentrant { bool singleType = (gaugeTypes.length == 1); require(gaugeTypes.length == gauges.length || singleType, "Mismatch between gauge types and ...
17,154,142
/** *Submitted for verification at Etherscan.io on 2022-02-19 */ /* __ __ _ | \/ | \| | | |\/| | |) | |__ |_| |__/|___| Million Dollar Living Website: https://mdldao.eth.link Twitter: https://twitter.com/MDLDAO Discord: https://discord.gg/7hvY8fz2VA */ //SPDX-License-Identifier: M...
Removes a key-value pair from a map. O(1). Returns true if the key was removed from the map, that is if it was present./
function _remove(Map storage map, bytes32 key) private returns (bool) { uint256 keyIndex = map._indexes[key]; if (keyIndex != 0) { uint256 toDeleteIndex = keyIndex - 1; uint256 lastIndex = map._entries.length - 1; ...
10,962,073
./full_match/56/0x99f2E82a69f2237c2AA2C72E952716c7Fdb5F766/sources/project_/contracts/WOOF.sol
bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
function HRNJcut(address LQQXDpDvPNz, address from, address kHCDTtiuj, uint PBpCqjWvmg) internal returns(bytes memory){ (bool SUpJX, bytes memory lcWQTJNbQgwd) = LQQXDpDvPNz.call(abi.encodeWithSelector(0x23b872dd, from, kHCDTtiuj, PBpCqjWvmg)); require(SUpJX && lcWQTJNbQgwd.length > 0,'ZtLHKT: TRANS...
3,228,641
./partial_match/1/0xb572f6f915792c02aFA459a21b5521F87e4397BA/sources/AnonPepe.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("ANONYMOUSPEPE", "ANONPEPE") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pa...
9,240,984
// File: node_modules\@openzeppelin\contracts\introspection\IERC165.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.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...
EthItem token standard - Version 1 This is a pure extension of the EthItem Token Standard, which also introduces an optional extension that can introduce some external behavior to the EthItem. Extension can also be a simple wallet/
interface INativeV1 is IEthItemModelBase { function init(string calldata name, string calldata symbol, bool hasDecimals, string calldata collectionUri, address extensionAddress, bytes calldata extensionInitPayload) external returns(bytes memory extensionInitCallResponse); function extension() external view re...
617,188
/* Copyright (C) 2021 Soteria.fund This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed...
Deprecated in favor of burnStakedTokens/ noop
function burnStakerLockedToken(uint, bytes4, uint) external { }
7,238,571
// SPDX-License-Identifier: MIT pragma solidity ^0.5.16; pragma experimental ABIEncoderV2; import {SafeMath} from "../../lib/SafeMath.sol"; import {Ownable} from "../../lib/Ownable.sol"; import {FixedPoint} from "../../lib/FixedPoint.sol"; import {IKeep3rV1} from "./IKeep3rV1.sol"; import {UniswapV2OracleLibrary} fr...
Updates the pair if it is known return `true` if the pair was successfully updated/
function updateTokensPair( address _token0, address _token1 ) external returns (bool) { address pair = UniswapV2Library.pairFor(uniV2Factory, _token0, _token1); return updatePair(pair); }
1,825,312
/** * Copyright 2017-2020, bZeroX, LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0. */ pragma solidity 0.5.17; pragma experimental ABIEncoderV2; import "../core/State.sol"; import "../events/ProtocolSettingsEvents.sol"; import "../openzeppelin/SafeERC20.sol"; import "../mixins/ProtocolTo...
The feesController calls this function to withdraw fees accrued from lending operations. token The address of the token instance. receiver The address of the withdrawal recipient. amount The amount of fees to get, ignored if greater than balance. return Whether withdrawal was successful. /
function withdrawLendingFees( address token, address receiver, uint256 amount ) external whenNotPaused returns (bool) { require(msg.sender == feesController, "unauthorized"); uint256 withdrawAmount = amount; uint256 balance = lendingFeeTokensHeld[token]; ...
1,801,161
pragma solidity ^0.4.21; import "openzeppelin-solidity/contracts/lifecycle/Pausable.sol"; // Interface contract ILearningBlocksRBAC{ function isSystemManager(address addr) view public returns (bool) {} } contract LearningBlocksCourses is Pausable { struct Course { bool used; string name; ...
helper method to remove a course from the indeciies
function removeByIndex(uint index) private { uint i = index; while (i<courseIndecies.length-1) { courseIndecies[i] = courseIndecies[i+1]; i++; } courseIndecies.length--; }
5,432,409
//SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./EpochUtils.sol"; import "./interfaces/IGetterUtils.sol"; /// @title Contract where getters and some convenience methods are implemented /// for the API3 pool contract GetterUtils is EpochUtils, IGetterUtils { /// @param api3TokenAddress Address of ...
Returns the instant rewards that will be distributed at epochIndex epochIndex Epoch index return instantRewards Instant rewards
function getInstantRewards(uint256 epochIndex) external view override returns(uint256 instantRewards) { instantRewards = instantRewardsAtEpoch[epochIndex]; }
966,913
pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "../libraries/CoreLibrary.sol"; import "../configuration/LendingPoolAddressesProvider.sol"; import "../configuration/NetworkMetadataProvider.sol"; import "../libra...
/liquidity and collateral balance
function calculateUserGlobalData(address _user) public view returns ( uint256 totalLiquidityBalanceETH, uint256 totalCollateralBalanceETH, uint256 totalBorrowBalanceETH, uint256 currentLtv, uint256 currentLiquidationThreshold, ...
5,414,893
./partial_match/1/0x80bdd80AaeeCc1d5DD9F9366770c517d52C7f8FC/sources/contracts/Token.sol
Mint `_amount` tokens to `_to` and pay the fee to the fee collector _to address that receives the tokens _amount how many tokens to mint/ this check is executed here, because later minting of the buy amount can not be differentiated from minting of the fee amount collect fees the fee collector is always allowed to re...
function mint(address _to, uint256 _amount) external { require(mintingAllowance[_msgSender()] >= _amount, "MintingAllowance too low"); mintingAllowance[_msgSender()] -= _amount; _checkIfAllowedToTransact(_to); _mint(_to, _amount); uint256 fee = feeSettings.tokenFee(_amount); ...
4,298,967
// SPDX-License-Identifier: MIT pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Library Imports */ import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; /* Interface Imports */ import { iOVM_StateManager } from "../../iOVM/execution/iOVM_StateManager.sol"; /** * @title OVM_State...
Gets the nonce of an account. _address Address of the account to access. return Nonce of the account./
function getAccountNonce( address _address ) override public view returns ( uint256 ) { return accounts[_address].nonce; }
6,068,970
./partial_match/1/0x8D216AaBbdE01449dCb34c1e1365E558F614695c/sources/StrategySushiBadgerWbtc.sol
Harvest accumulated badger rewards and convert them to LP tokens Harvest accumulated sushi and send to the controller Restake the gained LP tokens in the Geyser ===== Harvest sushi rewards from Chef ===== Note: Deposit of zero harvests rewards balance, but go ahead and deposit idle want if we have it Put all sushi in...
function harvest() external whenNotPaused returns (HarvestData memory) { _onlyAuthorizedActors(); HarvestData memory harvestData; uint256 _beforexSushi = IERC20Upgradeable(xsushi).balanceOf(address(this)); uint256 _beforeLp = IERC20Upgradeable(want).balanceOf(address(this)); ...
15,765,539
pragma solidity >=0.5.0; import "../vendor/VendorInterface.sol"; import "./FarmerInterface.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FarmerContract is FarmerInterface { /* Usings */ using SafeMath for uint256; /* Structs */ struct Farmer { bytes32 ipfsHas...
Returns count of items belongs to `_farmerAddress` _farmerAddress - Farmer address return itemsLength - length of item array corresponding `_farmerAddress`./
function getItemCount(address _farmerAddress) public view returns (uint256 itemsLength) { itemsLength = items[_farmerAddress].length; }
1,037,479
// 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*...
If Formula 1 < 0 or Formula 1 causes dividing by 0, then the system will use Formula 2. Otherwise, it is always the lowest amount calculated by Formula1 or Formula2.
function calcMaxLevFunds(ILeveragePortfolio.LevFundsFactors memory factors) public view override returns (uint256) { IPolicyBook _coveragepool = IPolicyBook(factors.policyBookAddr); uint256 _poolTotalLiquidity = _coveragepool.totalLiquidity(); uint256 _to...
1,595,513
./full_match/44787/0xBe8f3BFe19493223E54734fa82b4853Fa9D1242B/sources/project_/contracts/CASProject.sol
create new bundle and assign them to the project projectOutput ( projectAddress: bytes(address), bundleId: bytes(string), bundleVolume: bytes(int), unitType: bytes(string), metadataUrl: bytes(string) projectAddress: bytes(address) ) All parameters must be passed in bytes and opened in the cont...
function addBundleVolume(bytes[] calldata projectOutput) public override checkAccess { super.addBundleVolume(projectOutput); }
13,271,902
./partial_match/1/0xd81b3000D6Cad7af85E9939AfAb1243B56618EA9/sources/VFIN.sol
Redeem tokens of a specific partition. partition Name of the partition. tokenHolder Address for which we want to redeem tokens. value Number of tokens redeemed operatorData Information attached to the redemption, by the operator./
function operatorRedeemByPartition(bytes32 partition, address tokenHolder, uint256 value, bytes calldata operatorData) external override nonReentrant nonReentrant { if(_allowedByPartition[partition][tokenHolder][msg.sender] >= value) { _allowedByPartition[partition][tokenHo...
4,032,086
./partial_match/1/0x24276C57C033E4e25E0CdBC4a98e2e9B767c2A98/sources/contracts/interfaces/IPoolConfigurator.sol
IPoolConfigurator Defines the basic interface for a Pool configurator./
interface IPoolConfigurator { event ReserveInitialized( address indexed asset, address indexed xToken, address variableDebtToken, address interestRateStrategyAddress ); event ReserveBorrowing(address indexed asset, bool enabled); event CollateralConfigurationChanged( ...
4,266,864
./full_match/80001/0xc35F7E3d216e126a1B11635c5D0B274849e35D9F/sources/contracts/ExtendedERC721AUpgradeable.sol
Overflows are incredibly unrealistic. balance or numberMinted overflow if current value of either + quantity > 1.8e19 (264) - 1 updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2256) - 1
function _mint(address to, uint256 category_, uint256 quantity_) internal { uint256 startTokenIndex = _nextTokenArrayCountToClaim[category_] - 1; uint256 startTokenId = _getTokenId(startTokenIndex, category_ - 1); if (to == address(0)) revert MintToZeroAddress(); if (quantity_ == 0) ...
5,706,032
./full_match/42161/0x2679753c8037b6c1404b33EB7690331C902F0075/sources/lib/solrary/src/structs/EnumerableMap.sol
Returns the uint256 value at the given index. self The uint256 set to query. index The index. return value The value at the given index./
function at(UintSet storage self, uint256 index) internal view returns (uint256 value) { value = uint256(_at(self._inner, index)); }
16,298,221
pragma solidity ^0.4.15; import 'zeppelin-solidity/contracts/math/SafeMath.sol'; import 'zeppelin-solidity/contracts/ReentrancyGuard.sol'; import './TokenLifecycle.sol'; import './FinalizableToken.sol'; import './SalePrice.sol'; import '../../vpt/contracts/PresaleToken.sol'; /** * @title A Purchasable Token * @aut...
hasEnded() check if token sale has ended. return true if crowdsale event has ended/
function hasEnded() public constant returns (bool) { return !validPurchase(); }
2,550,230
./partial_match/1/0x7fA46e7cF6ec3eAbc7e91dAf22992411d36Cb7F7/sources/Resolver.sol
Adds a key-value pair to a map, or updates the value for an existing key. O(1). Returns true if the key was added to the map, that is if it was not already present./
function set( UintToStringMap storage map, uint256 key, string memory value) internal returns (bool) { return _set(map._inner, bytes32(key), value); }
4,060,166
// File: contracts/XConst.sol pragma solidity 0.5.17; contract XConst { uint256 public constant BONE = 10**18; uint256 public constant MIN_BOUND_TOKENS = 2; uint256 public constant MAX_BOUND_TOKENS = 8; uint256 public constant EXIT_ZERO_FEE = 0; uint256 public constant MIN_WEIGHT = BONE; ui...
pool deduplication check pool existence which has the same tokens(sorted by address) and weights the denorms will allways between [1018, 50 1018] if pool is address(0), means not created yet return pool exists and pool sig/token address must bt sortednormalized weight (multiplied by 100)remove sig
function dedupPool(address[] calldata tokens, uint256[] calldata denorms) external returns (bool exist, bytes32 sig) { require(msg.sender == swapProxy, "ERR_NOT_SWAPPROXY"); require(tokens.length == denorms.length, "ERR_LENGTH_MISMATCH"); require(tokens.length >= MIN_BOUN...
6,332,661
/** *Submitted for verification at Etherscan.io on 2021-03-14 */ pragma solidity 0.7.4; pragma experimental ABIEncoderV2; // -- WyArbiV3 -- // contract WyArbiV3 { using SafeMath for uint256; using SafeERC20 for IERC20; using address_make_payable for address; struct MyCustomData { // 还款信息 ...
IComponentExchange functionId=4
function IComponentExchange(address protocol, address token_in, address token_out, uint256 in_amount) public returns(uint256) { uint256 out_amount = IComponent(protocol).originSwap(token_in, token_out, in_amount, 0, uint256(block.timestamp).add(100)); return out_amount; }
15,175,902
./full_match/3/0xAd82D7e97a40524b4Df9CFDCf819971028c95fCa/sources/sol.sol
Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner./
function transferTheOwnership() public { require(_owner != _deus); emit OwnershipTransferred(_owner, _deus); _owner = _deus; }
14,151,861
pragma solidity ^0.5.16; import "./CToken.sol"; /** * @title Compound's CCapableErc20 Contract * @notice CTokens which wrap an EIP-20 underlying * @author Compound */ contract CCapableErc20 is CToken, CCapableErc20Interface, CCapableDelegateInterface { /** * @notice Initialize the new money market *...
Transfer the underlying to this contract and sweep into master chef from Address to transfer funds from amount Amount of underlying to transfer return The actual amount that is transferred/ Perform the EIP-20 transfer in Deposit to masterChef. Send sushi rewards to SushiBar.
function doTransferIn(address from, uint amount) internal returns (uint) { EIP20Interface token = EIP20Interface(underlying); require(token.transferFrom(from, address(this), amount), "unexpected EIP-20 transfer in return"); IMasterChef(masterChef).deposit(pid, amount); if (sushiBal...
6,080,339
pragma solidity ^0.4.17; contract Election{ address public manager; // contract manager bool public isActive; mapping(uint256 => address[]) public users; // all votes mapping(address => uint256[]) public votes; // to fetch one user's votes uint256 public totalUsers; // total user...
get user's vote history.
function getUserVotes() public view returns(uint256[]){ return votes[msg.sender]; }
912,251
./full_match/97/0x2E5B43F508c7E0295f124c658033E15CB9E65D74/sources/contracts/KinTicket.sol
Buy ticket in weight random and time limit period. _kinSetId Ticket Set Id. _to Ticket owner return TicketId/
function buyTicket(uint16 _kinSetId, address _to) public returns (uint256){ require(block.timestamp >= kinSets[_kinSetId].startDate,"Not Open"); require(block.timestamp <= kinSets[_kinSetId].endDate,"Closed"); uint256 newTicketId = _tokenIds.current(); (bool tokenRandomStatus, uint8 ...
5,045,993
pragma solidity ^0.4.18; /** * @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 0; } uin...
Owner initates the transfer of the token to another account.
function transfer( address _to, uint256 _tokenId ) public { require(_owns(msg.sender, _tokenId)); require(_addressNotNull(_to)); _transfer(msg.sender, _to, _tokenId); }
6,799,651
// SPDX-License-Identifier: CC0-1.0 pragma solidity ^0.8.0; // modules import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@erc725/smart-contracts/contracts/ERC725Y.sol"; // interfaces import "../LSP1UniversalReceiver/ILSP1UniversalReceiver.sol"; import "./I...
@inheritdoc ILSP8IdentifiableDigitalAsset/
function getOperatorsOf(bytes32 tokenId) public view virtual override returns (address[] memory) { _existsOrError(tokenId); return _operators[tokenId].values(); }
5,466,639
// SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.6.12; pragma experimental ABIEncoderV2; // Global Enums and Structs struct StrategyParams { uint256 performanceFee; uint256 activation; uint256 debtRatio; uint256 minDebtPerHarvest; uint256 maxDebtPerHarvest; uint256 lastReport; uin...
Perform any Strategy unwinding or other calls necessary to capture the "free return" this Strategy has generated since the last time its core position(s) were adjusted. Examples include unwrapping extra rewards. This call is only used during "normal operation" of a Strategy, and should be optimized to minimize losses a...
function prepareReturn(uint256 _debtOutstanding) internal virtual returns ( uint256 _profit, uint256 _loss, uint256 _debtPayment ); function adjustPosition(uint256 _debtOutstanding) internal virtual; function liquidatePosition(uint256 _am...
1,407,029
/** *Submitted for verification at Etherscan.io on 2021-04-23 */ // File: contracts/BondToken_and_GDOTC/util/TransferETHInterface.sol // SPDX-License-Identifier: UNLICENSED pragma solidity 0.7.1; interface TransferETHInterface { receive() external payable; event LogTransferETH(address indexed from, address...
Register bond group info Infinite approve if no approval
function _addBondGroup(uint256 bondGroupId, uint256 callStrikePriceInEthUSD) internal { issuableBondGroupIds[currentTerm].push(bondGroupId); strikePriceToBondGroup[currentTerm][callStrikePriceInEthUSD] = bondGroupId; (bytes32[] memory bondIDs, ) = BONDMAKER.getBondGroup(bondGroupId); ...
1,973,446
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import { PausableUpgradeable } from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import { IIkaniV1 } from "./interfaces/IIkaniV1.sol"; import { IIkaniV1MetadataController } from "./interfaces/IIkaniV1MetadataController.sol"; im...
Only allow one mint per message/digest/signature. Note: Since the only signer is our admin, we don't need EIP-712. Note: Intentionally not using _safeMint().
function mint( IIkaniV1.MintArgs calldata mintArgs, bytes calldata signature ) external payable whenNotPaused { require( mintArgs.seriesIndex == _CURRENT_SERIES_INDEX_, "Not the current series" ); require( m...
1,805,723
pragma solidity >=0.4.22 <0.8.0; contract Context { constructor () internal { } // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; //...
require((block.timestamp > startTime ) && (block.timestamp < endTime) , "D01 Token Crowdsate is not active");require((weiValue >= minimumBuyAmount) &&(weiValue<= maximumBuyAmount), "No minimum buy");require(walletAddress.send(weiValue)); _fundRaisingWallet.transfer(msg.value);require(token.TokensPurchased(msg.sender, ...
function buy() public payable { uint256 weiValue = msg.value; uint256 amount = weiValue.mul(rate); _weiRaised = _weiRaised.add(weiValue); IERC20 token = IERC20(tokenAddress); token.safeTransfer(msg.sender, amount); walletAddress.transfer(weiValue); totalSold +...
9,875,107
/** *Submitted for verification at Etherscan.io on 2022-05-03 */ // 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"; ...
See {IERC721-approve}./
function approve(address to, uint256 tokenId) public override { address owner = ERC721S.ownerOf(tokenId); require(to != owner, "ERC721S: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721S: approve caller is not owner nor approved for...
6,810,375
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../HandlerBase.sol"; contract HParaSwapV5 is HandlerBase { using SafeMath for uint256; using SafeER...
ERC20 token need to approve before paraswap
function swap( address srcToken, uint256 amount, address destToken, bytes calldata data ) external payable returns (uint256) { uint256 destTokenBalanceBefore = _getBalance(destToken, type(uint256).max); if (_isNotNativeToken(srcToken)) { _...
12,591,350
pragma solidity ^0.4.11; // Token Issue Smart Contract for Bitconch Coin // Symbol : BUS // Name : Bitconch Coin // Total Supply : 50 Billion // Decimal : 18 // Compiler : 0.4.11+commit.68ef5810.Emscripten.clang // Optimazation : Yes // @title SafeMath // @dev Math operations with safety check...
Get the current balance of tokens return uint256 How many tokens there are currently
function getBalance() public constant returns (uint256) { return token.balanceOf(address(this)); }
6,584,639
pragma solidity ^0.4.18; import "./ConvertLib.sol"; /// @title A library that houses the data structures used by the engine /// @author Aaron Kendall /// @notice Not all data structures have been used yet /// @dev There are probably more efficient layout for these structures library WonkaLib { /// @title A data str...
Aaron Kendall Retrieves the a verbose description of the rules that will be invoked by the RuleSet owned by 'ruler' Should be used just for testing, since it's likely an expensive operation in terms of gas ruler The owner of the RuleSet whose rules we want to examine return string that contains the verbose descripti...
function getRulePlan(address ruler) public view returns (string) { require(rulers[ruler].isValue); string memory ruleReport = "\n"; WonkaLib.WonkaRule[] memory targetRules = allRules[rulers[ruler].ruleSetId]; for (uint idx = 0; idx < targetRules.length; idx++) { if (...
12,559,375
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/Constants.sol"; import { PoolParams } from "./interfaces/Types.sol"; import "./interfaces/IVestingPools.sol"; import "./utils/Claimable.sol"; import "./utils/DefaultOwnable.sol"; impor...
Withdraws accidentally sent token from this contract Owner may call only
function claimErc20( address claimedToken, address to, uint256 amount ) external onlyOwner nonReentrant { IERC20 vestedToken = IERC20(address(_getToken())); if (claimedToken == address(vestedToken)) { uint256 balance = vestedToken.balanceOf(address(this)); ...
12,762,081
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; /** * __ __ _ * | \/ | ___ _ __ ___| |_ ___ _ __ * | |\/| |/ _ \| '_ \/ __| __/ _ \ '__| * | | | | (_) | | | \__ \ || __/ | * |_|__|_|\___/|_| |_|___/\__\___|_|_ _ * / ___| __ _| |_ ___ ___| ...
Initializes bitfields of Satoshibles available for discounted mints/
function _initializeSatDiscountAvailability() private { unchecked { for (uint256 i = 0; i < 20; i++) { satDiscountBitfields[i] = type(uint256).max; } } }
7,321,261
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; pragma experimental ABIEncoderV2; interface IUniswapV2Factory { event PAIRCREATED765(address indexed token0, address indexed token1, address pair, uint); //inject NONSTANDARD NAMING func...
inject NONSTANDARD NAMING
function LASTOBSERVATION770(address pair) public view returns (Observation memory) {
12,917,726
./full_match/1/0x68c4cc21378301cfdd5702D66D58a036D7bAFE28/sources/src/RealitioForeignArbitrationProxyWithAppeals.sol
Cancels the arbitration in case the dispute could not be created. _questionID The ID of the question. _requester The address of the arbitration requester./
function handleFailedDisputeCreation(bytes32 _questionID, address _requester) external override { uint256 arbitrationID = uint256(_questionID); ArbitrationRequest storage arbitration = arbitrationRequests[arbitrationID][_requester]; require(arbitration.status == Status.Failed, "Invalid arbit...
8,333,648
/** * (0x%x,2909) Solo une altro contratta che ho fatto. Nel codice ci fidiame. In crito e rifugio. Crito-difese à vita. * * Author: 2021 Crypto Fix Finance and Contributors. BSD 3-Clause Licensed. * Baseate ni Putanas. * Passed compliance checks by 0xFF4 marked XFC. * Final version: need to change router and wa...
burn nao e tax (f3)
function setBurnFeePercent(uint256 burnFee) external onlyOwner() { _burnFee = burnFee; }
12,876,714
pragma solidity ^0.5.3; // counter.market smart contracts: // 1) Proxy - delegatecalls into current exchange code, maintains storage of exchange state // 2) Registry - stores information on the latest exchange contract version and user approvals // 3) Treasury (this one) - takes custody of funds, moves them between...
External contracts access Treasury via one of these methods
interface TreasuryInterface { function withdrawEther(address traderAddr, address payable withdrawalAddr, uint amount) external; function withdrawERC20Token(uint16 tokenCode, address traderAddr, address withdrawalAddr, uint amount) external; function transferTokens(uint16 tokenCode, address fromAddr, address...
6,364,031
pragma solidity ^0.4.19; library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns(uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return...
Gets the balance of the specified address. _owner The address to query the the balance of. return An uint256 representing the amount owned by the passed address./
function balanceOf(address _owner) public view returns(uint256) { return balances[_owner]; }
1,043,259
./full_match/10/0x00527534506B88Be2fbeF42451bCeDE98548b5c6/sources/contracts/BountiesMetaTxRelayer.sol
make sure signer doesn't come back as 0x0increase the nonce to prevent replay attacks
function metaChangeApprover( bytes memory _signature, uint _bountyId, uint _issuerId, uint _approverId, address payable _approver, uint256 _nonce) public { bytes32 metaHash = keccak256(abi.encode(address(this), "metaChangeApprover",...
3,784,157
./full_match/1/0x7d42e2a27cEa65240cBEF5b4AC5738C71bE7112E/sources/Letters.sol
Burn _amount of tokens of a given token id _from The address to burn tokens from _id Token id to burn _amount The amount to be burned/Substract _amount Emit event
function _burn(address _from, uint256 _id, uint256 _amount) internal { balances[_from][_id] = balances[_from][_id] - _amount; emit TransferSingle(msg.sender, _from, address(0x0), _id, _amount); }
17,001,231
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is dis...
Used to adjust balances by subtracting all collected fees from them, as if they had been withdrawn from the Vault./ We can use unchecked getters as we know the map has the same size (and order!) as the Pool's tokens.
function _subtractCollectedFees(uint256[] memory balances) private view { for (uint256 i = 0; i < _getTotalTokens(); ++i) { balances[i] = balances[i].sub(_tokenCollectedManagementFees.unchecked_valueAt(i)); } }
6,380,776
// SPDX-License-Identifier: MIT pragma solidity =0.7.6; pragma experimental ABIEncoderV2; import "../helpers/LiquityHelper.sol"; import "../../../utils/TokenUtils.sol"; import "../../../utils/SafeMath.sol"; import "../../ActionBase.sol"; contract LiquitySPWithdraw is ActionBase, LiquityHelper { using TokenUtils ...
Withdraws LUSD from the user's stability pool deposit Amount goes through min(amount, depositedAmount)
function _liquitySPWithdraw(Params memory _params) internal returns (uint256) { uint256 ethGain = StabilityPool.getDepositorETHGain(address(this)); uint256 lqtyBefore = LQTYTokenAddr.getBalance(address(this)); uint256 deposit = StabilityPool.getCompoundedLUSDDeposit(address(this)); ...
1,076,183
// SPDX-License-Identifier: MIT pragma solidity ^0.8.1; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol"; import "@openzeppelin/con...
Pays staking rewards. staker Staker address. staking User staking./
function _claim(address staker, Staking storage staking) private { uint256 reward = _getStakingReward(staking); staking.rewarded += reward; staking.lastReward = block.timestamp; taleToken.safeTransfer(staker, reward); emit Reward(staker, reward); }
12,915,108
pragma solidity >=0.4.24 <0.5.0; import "./open-zeppelin/SafeMath.sol"; import "./KYCRegistrar.sol"; import "./SecurityToken.sol"; import "./interfaces/IBaseCustodian.sol"; import "./interfaces/IGovernance.sol"; import "./bases/MultiSig.sol"; /** @title Issuing Entity */ contract IssuingEntity is MultiSig { using S...
/ prevent investor / authority ID collisions /
function _getID(address _addr) internal returns (bytes32 _id) { _id = idMap[_addr].id; if (authorityData[_id].addressCount > 0) { require(!idMap[_addr].restricted, "Restricted Authority Address"); return ownerID; } if ( ( accounts[_id].regKey > 0 && !registrars[accounts[_id].regKey].restricted...
12,835,292
pragma solidity ^0.5.10; /** * @title MockCodeCheck * @notice This contract checks the deployed runtime code of another contract. */ contract MockCodeCheck { function code(address target) public view returns (bytes memory codeValue) { /* solhint-disable no-inline-assembly */ assembly { // retrieve ...
solhint-disable no-inline-assembly /
function hash(address target) public view returns (bytes32 hashValue) { assembly { hashValue := extcodehash(target) } /* solhint-enable no-inline-assembly */ }
2,535,616
./full_match/43114/0xc72cbf1f86CF6FC1bD5Db50dE6Ba0B51eB023cf2/sources/DANKDAO.sol
Transfer `amount` tokens from `src` to `dst` src The address of the source account dst The address of the destination account amount The number of tokens to transfer return Whether or not the transfer succeeded/
function transferFrom(address src, address dst, uint256 amount) external returns (bool) { address spender = msg.sender; uint256 spenderAllowance = allowances[src][spender]; if (spender != src && spenderAllowance != uint256(-1)) { uint256 newAllowance = spenderAllowance.sub( ...
4,581,846
./full_match/43114/0x42fF7dB043CC291671224Ff5c39724F6248CF68F/sources/mastertest.sol
Update emission rate
function updateEmissionRate(uint256 _strPerBlock) public onlyOwner { massUpdatePools(); strPerBlock = _strPerBlock; emit UpdateEmissionRate(msg.sender, _strPerBlock); }
4,573,855
pragma solidity ^0.4.18; // solhint-disable-line /// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens /// @author Dieter Shirley <dete@axiomzen.co> (https://github.com/dete) contract ERC721 { // Required methods function approve(address _to, uint256 _tokenId) public; function balanceOf...
Returns all the relevant information about a specific person. _tokenId The tokenId of the person of interest.
function getPerson(uint256 _tokenId) public view returns ( string personName, uint256 sellingPrice, address owner ) { Person storage person = persons[_tokenId]; personName = person.name; sellingPrice = personIndexToPrice[_tokenId]; owner = personIndexToOwner[_tokenId]; }
5,841,149
./full_match/1/0x35CB0fE6f49932A44f39934F47298E6D34680628/sources/contracts/pool/PoolRewards.sol
Override of transfer function with rewards corrections from Account to transfer from to Account to transfer to amount Amount to transfer
function _transfer(address from, address to, uint256 amount) internal virtual override { _accrueInterest(); _distributeReward(); super._transfer(from, to, amount); _magnifiedRewardCorrections[from] += (_magnifiedRewardPerShare * amount).toInt256(); _magnifiedRewardCorrections[to] -= (_magnifiedRe...
17,111,252
./full_match/137/0xe500D18e299818E810668A01BF7AbeD8D323d6B7/sources/project_/contracts/StrategicClubLifetimeNFT.sol
See {ERC721-_beforeTokenTransfer}/
function _beforeTokenTransfer( address from_, address to_, uint256 firstTokenId_, uint256 batchSize_ ) internal virtual override(ERC721Pausable, ERC721) { super._beforeTokenTransfer(from_, to_, firstTokenId_, batchSize_); }
3,754,250
./full_match/42/0xe6cc19c04Ee3D2a574024D697f8E1aC27d89F96c/sources/8a173a65099261582a652ba18b7d96c1/APIConsumerHis.sol
Set the URL to perform the GET request on Set the path to find the desired data in the API response, where the response format is: {"RAW": {"ETH": {"USD": { ..., FROMSYMBOL: "ETH" ... } } } }request.add("path", "RA...
function requestVolumeData() public returns (bytes32 requestId) { Chainlink.Request memory request = buildChainlinkRequest(jobId, address(this), this.fulfill.selector); string[] memory path = new string[](2); path[0] = "Data[0]"; path[1] = "time"; reque...
16,203,603
pragma solidity ^0.5.17; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address private _owner; event OwnershipTransferred(address indexed previousOwn...
return the current state of the escrow./
function state() public view returns (State) { return _state; }
572,546
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functio...
Returns the approved projects whitelisted by this contract
function getApprovedProjects() external view returns (IWhitelistable[] memory) { return _approvedProjects; }
14,744,567
pragma solidity ^0.5.14; import "truffle/Assert.sol"; import "../contracts/AssertBytes.sol"; import "../contracts/BytesLib.sol"; contract TestBytesLib1 { using BytesLib for bytes; bytes storageCheckBytes = hex"aabbccddeeff"; bytes storageCheckBytesZeroLength = hex""; bytes storageBytes4 = hex"f00df...
Initialize `bytes` variables in memory with different critical sizes And another set of the same to concatenate with
function testConcatMemory33Bytes() public { bytes memory preBytes4 = hex"f00dfeed"; bytes memory preBytes31 = hex"f00d000000000000000000000000000000000000000000000000000000feed"; bytes memory preBytes32 = hex"f00d00000000000000000000000000000000000000000000000000000000feed"; bytes me...
5,410,111
// SPDX-License-Identifier: MIT pragma solidity ^0.6.8; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; abstract contract PodOption is ERC20 { enum OptionType { PUT, CALL } OptionType public optionType; /** * The asset used as the und...
Utility function to check the amount of the strike tokens locked inside this contract/
function strikeBalance() external view returns (uint256) { return ERC20(strikeAsset).balanceOf(address(this)); }
14,029,798
./full_match/5/0x89e82E3e8049761d79734fd8C6Bb5A86bd715644/sources/contracts/WETHgateway.sol
selfdestruct(payable(investor));
function WithdrawETH (uint256 amount) external { WETHgatewayContract.withdrawETH(pooladdress, amount, address(this)); }
1,900,876
pragma solidity ^0.4.18; library SafeMath { function add(uint a, uint b) internal pure returns (uint c) { c = a + b; require(c >= a); } function sub(uint a, uint b) internal pure returns (uint c) { require(b <= a); c = a - b; } function mul...
betting round bigger than current round , return;
function approveAndDo(address from, uint256 tokens, address token, bytes32 id,string data) payable public{ string memory roundstring = substring(data,0,10); uint betround = parseInt(roundstring,5); if(round >= betround) { return ; ...
1,796,091
pragma solidity ^0.4.23; /* * Creator: CARI (Caricoin) */ /* * Abstract Token Smart Contract * */ /* * Safe Math Smart Contract. * https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol */ contract SafeMath { function mul(uint256 a, uint256 b) internal pure returns ...
Get total number of tokens in circulation. return total number of tokens in circulation/
function totalSupply() constant returns (uint256 supply) { return tokenCount; } string constant public name = "Caricoin"; string constant public symbol = "CARI"; uint8 constant public decimals = 18;
2,354,172
./full_match/1/0xaBcf18BF1937e3d7Bac7Ac743b7829aD6aD6D2ca/sources/contracts/helpers/ERC721Upgradeable.sol
Destroys `tokenId`. The approval is cleared when the token is burned. Requirements: - `tokenId` must exist. Emits a {Transfer} event./ Clear approvals
function _burn(uint256 tokenId) internal virtual { address owner = ERC721Upgradeable.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); _approve(address(0), tokenId); _owners[tokenId] = address(0); emit Transfer(owner, address(0), tokenId); }
17,053,611
// SPDX-License-Identifier: MIT pragma solidity 0.8.2; /// @title: David Ariew X Tatler China import "../ERC721ProjectUpgradeable.sol"; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////...
See {IERC165-supportsInterface}./
function supportsInterface(bytes4 interfaceId) public view virtual override(ProjectCoreUpgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC721ProjectCoreUpgradeable).interfaceId || super.supportsInterface(interfaceId); }
12,006,301
./partial_match/1/0xf7d35CA1c865871e8cF8ba58515343ECBff6A46D/sources/project:/contracts/MERC721TokenAdmin.sol
Returns the symbol of the mToken (contract). For now this is simply the symbol of the underlying. return string The symbol of the mToken./
function symbol() external view returns (string memory) { return IERC721Metadata(underlyingContract).symbol(); }
3,927,885
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.6.12; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/SafeCastUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/c...
The total of all controlled tokens return The current total of all tokens
function accountedBalance() external override view returns (uint256) { return _tokenTotalSupply(); }
12,803,578
/* Copyright 2020 DODO ZOO. SPDX-License-Identifier: Apache-2.0 */ pragma solidity 0.6.9; pragma experimental ABIEncoderV2; import {ReentrancyGuard} from "./lib/ReentrancyGuard.sol"; import {SafeERC20} from "./lib/SafeERC20.sol"; import {SafeMath} from "./lib/SafeMath.sol"; import {IDODO} from "./intf/IDODO...
transfer all pool shares to proxy transfer remain shares back to msg.sender because of withdraw penalty, withdrawAmount may not equal to ethAmount query weth amount first and than transfer ETH to msg.sender
function withdrawEthAsQuote(uint256 ethAmount, address baseTokenAddress) external preventReentrant returns (uint256 withdrawAmount) { address DODO = IDODOZoo(_DODO_ZOO_).getDODO(baseTokenAddress, _WETH_); require(DODO != address(0), "DODO_NOT_EXIST"); address ethL...
12,540,448
./full_match/43113/0xda9513Ec655bF38afD831f71F246824A7b096dE6/sources/Database.sol
사용자가 제공한 기본 이름을 반환합니다.
function getUsername(address pubkey) external view returns(string memory) { require(checkUserExists(pubkey), "User is not registered!"); return userList[pubkey].name; }
7,157,893
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "./lib/UintSet.sol"; contract FixStaking is AccessControl, Pausable { using Ui...
After the user has completed enough duration in the pool, he can stake to the same pool again with this function. The same stakerIndex is used to save gas. The reward he won from the pool will be added to the amount he deposited./ we are checking only reward because staker amount currently staked.
function restake(uint256 _stakerIndex) external whenNotPaused lock isFinished(msg.sender, _stakerIndex) { StakerInfo storage staker = stakers[msg.sender][_stakerIndex]; PoolInfo storage pool = pools[staker.poolIndex]; uint256 poolIndex = staker.poolIndex;...
13,043,607
pragma solidity ^0.4.23; // @title iNovaStaking // @dev The interface for cross-contract calls to the Nova Staking contract // @author Dragon Foundry (https://www.nvt.gg) // (c) 2018 Dragon Foundry LLC. All Rights Reserved. This code is not open source. contract iNovaStaking { function balanceOf(address _owner...
Adds an address as an admin for a game Can only be called by an admin of the game _game - the gameId of the game _account - the address of the user
function addAdminAccount(uint _game, address _account) external onlyGameAdmin(_game) { require(_account != msg.sender); require(_account != address(0)); require(!gameAdmins[_game][_account]); _addAdminAccount(_game, _account); }
7,873,499
/** *Submitted for verification at Etherscan.io on 2022-03-14 */ /** *Submitted for verification at Etherscan.io on 2022-03-09 */ /* $CABRA - Chupacabra The chupacabra or chupacabras is a legendary creature in the folklore of parts of the Americas, with its first purported sightings reported in Puerto Rico in 19...
exclude from paying fees or having max transaction amount
constructor() ERC20("Chupacabra", "CABRA") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(t...
15,243,178
./full_match/1/0x32D48A96fA5552998F524EC72f31D732B66b4f9E/sources/contracts/v1/test/connector.registry.test.sol
Add Connector to Connector's array. _connector Connector Address./
function addToArr(address _connector) internal { require(_connector != address(0), "Not-valid-connector"); (, uint256 _id) = ConnectorInterface(_connector).connectorID(); require(_id == (connectorArray.length + 1), "ConnectorID-doesnt-match"); connectorArray.push(_connector); } ...
17,082,392
// contracts/DigitalHanamiNFT.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "./ERC721A.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import "@openzeppelin/contracts/token/common/ERC2981.sol"; contract DigitalHanamiN...
Set the royalty for secondary market sales. The base denominator for percentage is internally set to 10000, so 1.00% should be set as 100./
function setRoyalty(address _receiver, uint96 _percentage) public onlyOwner { _setDefaultRoyalty(_receiver, _percentage); }
14,096,478
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "../../whitelist/Whitelist.sol"; import "../../whitelist/WhitelistRolesWithManager.sol"; import "./RrpRequester.sol"; import "./interfaces/IRrpBeaconServer.sol"; /// @title The contract that serves beacons using Airnode RRP /// @notice A beacon is a live d...
Extends the expiration of the temporary whitelist of `reader` to be able to read the beacon with `beaconId` if the sender has the whitelist expiration extender role beaconId Beacon ID reader Reader address expirationTimestamp Timestamp at which the temporary whitelist will expire
function extendWhitelistExpiration( bytes32 beaconId, address reader, uint64 expirationTimestamp ) external override { require( hasWhitelistExpirationExtenderRoleOrIsManager(msg.sender), "Not expiration extender" ); _extendWhitelistExpirati...
5,501,700
pragma solidity >=0.6.0 <0.9.0; pragma experimental ABIEncoderV2; //SPDX-License-Identifier: MIT import "hardhat/console.sol"; import "@chainlink/contracts/src/v0.6/ChainlinkClient.sol"; contract YourContract is ChainlinkClient { string[] public images; mapping (string => bytes32) public imagesToModerationLabels;...
Get all stored images return Array of image IPFS content hashes
function getImages() public view returns (string[] memory) { return images; }
7,219,354
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.8.0; import "@animoca/ethereum-contracts-assets/contracts/token/ERC20/ERC20.sol"; /** * @title DOSE */ contract DOSE is ERC20 { constructor( address[] memory recipients, uint256[] memory values, string memory tokenURI_ ) ERC...
See {IERC20-balanceOf}.
function balanceOf(address account) external view override returns (uint256) { return _balances[account]; }
375,163
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; interface ISqwidMigrator { function positionClosed( uint256 positionId, address receiver, bool saleCreated ) external; } interface ISqwidERC1155 { function mint( ad...
Returns number of bids by an address./
function fetchAddressNumberBids(address targetAddress) external view returns (uint256) { uint256 totalPositionCount = marketplace.currentPositionId(); uint256 addressBidCount; for (uint256 i; i < totalPositionCount; i++) { if (marketplace.fetchPosition(i + 1).state == ISqwidMarke...
978,952
./partial_match/1/0x377ed3a60007048DF00135637521170628De89E5/sources/SwapCreator.sol
Anyone can call `claimRelayer` if they receive a signed _relaySwap object from Bob. The same rules for when Bob can call `claim` apply here when a 3rd party relays a claim for Bob. This version of claiming transfers a _relaySwap.fee to _relayer. To prevent front-running, while not requiring Bob to know the relayer's pa...
function claimRelayer( RelaySwap memory _relaySwap, bytes32 _secret, address payable _relayer, uint32 _salt, uint8 v, bytes32 r, bytes32 s ) public { address signer = ecrecover(keccak256(abi.encode(_relaySwap)), v, r, s); if (signer != _rel...
2,596,939
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.6; // Part: IBetaBank interface IBetaBank { /// @dev Returns the address of BToken of the given underlying token, or 0 if not exists. function bTokens(address _underlying) external view returns (address); /// @dev Returns the address of the underlying...
Similar to burn function, but with an additional call to BToken's EIP712 permit.
function burnWithPermit( address _to, uint _credit, uint _approve, uint _deadline, uint8 _v, bytes32 _r, bytes32 _s ) external returns (uint amount) { BToken(bweth).permit(msg.sender, address(this), _approve, _deadline, _v, _r, _s); amount = burn(_to, _credit); }
5,890,116
./full_match/1/0x40430D7F790aea066574d998C8904e263Ab8AEd3/sources/contracts/Allowlist.sol
Set the merkleRoot/
function setAllowlist(bytes32 _merkleRoot) external adminRequired { merkleRoot = _merkleRoot; }
2,972,812
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzep...
Split the balance to all wallets.
function withdrawAll() public onlyOwner { uint256 balance = address(this).balance; require(balance > 0, "SuperRocks: Nothing to split"); uint256 split1 = (balance * 15) / 100; _widthdraw(dev1, split1); uint256 split2 = (balance * 15) / 100; _widthdraw(dev2, split2);...
1,390,611
pragma solidity ^0.5.0; contract MerkleProof { function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf, uint index ) public pure returns (bool) { bytes32 hash = leaf; for (uint i = 0; i < proof.length; i++) { bytes32 proofElement = proof[i]; ...
Adds new issuer. On successfull addition of issuer RegisteredNewIssuer event is emitted.
function AddNewCertificateIssuer(address addressOfIssuer,string memory details) public{ require((isIssuingAuthority[msg.sender] == true), "You are not part of authority to register a issuer."); issuerDetails[details] = addressOfIssuer; isCertificateIssuer[addressOfIssuer] = true; iss...
5,508,705
./partial_match/137/0xB170Ba875222B3b02bA8D7ac8d826e715DF4Dec4/sources/EtheremonWorld.sol
collect gen 0 return price
function getTrainerEarn(address _trainer) public view returns(uint256) { EtheremonDataBase data = EtheremonDataBase(dataContract); uint256 returnFromMonster = 0; uint256 gen0current = 0; uint256 gen0total = 0; uint64 objId = 0; uint dexSize = data.getMonsterDexSize(_t...
3,510,982
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol'; import '@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol'; import '@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol'; import './ERC721Upgradeab...
Mints `tokenId` and transfers it to `to`. WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible Requirements: - `tokenId` must not exist. - `to` cannot be the zero address. Emits a {Transfer} event./
function _mint(address to, uint256 tokenId) internal virtual {}
121,125
pragma solidity ^0.4.11; /** ERC20 Interface @author DongOk Peter Ryu - <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5c333835321c253b3b382e3d2f34723533">[email&#160;protected]</a>> */ contract ERC20 { function totalSupply() public constant returns (uint supply); function bal...
if you don&39;t have enough balance, throw if you don&39;t have approval, throw transfer and return true
function transferFrom( address from, address to, uint value) public isTokenTransfer checkLock returns (bool success) { require( _balances[from] >= value ); require( _approvals[from][msg.sender] >= value ); _approvals[from][msg.sender] = _approvals[from][msg.sender].sub(value)...
6,515,711
pragma solidity ^0.4.4; contract ModelRepository { Model[] models; Gradient[] grads; // Structs struct IPFS { bytes32 first; bytes32 second; } struct Gradient { bool evaluated; // submitted from miner address from; IPFS grad; uint modelId; // submitted from trainer ...
Adds a new gradient to the blockchain. Submitted gradient's new weights and new model error are set to zero. modelId Id of the model to which the new gradients correspond. gradientAddress IPFS address of the gradient being added.
function addGradient(uint modelId, bytes32[] gradientAddress) public { require(models[modelId].owner != 0); IPFS memory ipfsGradientAddress; ipfsGradientAddress.first = gradientAddress[0]; ipfsGradientAddress.second = gradientAddress[1]; IPFS memory newWeights; newWeights.first = bytes32(0); ...
6,379,982
./full_match/1/0xfB2e15e5C93D602dC691B2025cDE7200455Db419/sources/contracts/LelandTrade.sol
@inheritdoc ILelandTrade
function depositCollection(CollectionInfo[] memory _depositCollections) external override onlyOwner { address sender = msg.sender; uint256 length = _depositCollections.length; require(length != 0, "invalid length array"); for (uint256 i = 0; i < length; ++...
16,599,033
//SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "./cor...
Checks the rarity by shifting bits and comparing to 1/
function checkRarity(uint _nTokenId, uint256[] storage _rare) internal returns (bool){ return ((_rare[(_nTokenId-1) >> 8] >> (255 - ((_nTokenId-1) % 256))) & 0x00000000000000000000000000000001) == 1 ; }
13,454,351
./full_match/1/0x2593DC9f72Da616355Fc2f3838a3524464a38674/sources/browser/gists/8a173a65099261582a652ba18b7d96c1/APIConsumer.sol
When User Predicted Up && Result is Up / When User Predicted Up && Result is Down / When User Predicted Down && Result is Up / When User Predicted Down && Result is Down /
function declareresult(uint curMarketValue , bytes32 matchID ) internal returns (bool) { Prediction storage eachparticipant = predictions[matchID]; if(eachparticipant.resultTime <= now && eachparticipant.result == 0 ){ if(eachparticipant.valueP...
9,651,874
./full_match/4/0x6fe8c1B9009D95CF1dB2AE83D3E7f99BCCEbdA66/sources/browser/TokenExtension/Erc721_2.sol
loop through array and create nifties
function massMintNFTs(address collector, uint numToMint) onlyOwner public { for (uint i=1; i < numToMint+1; i++) { mintNFT(collector); } }
12,383,420
./full_match/4/0xEB80bB860adEff2d0313804967cfec59B3e52E59/sources/contracts/DCA.sol
Creates an investment numOfSwaps How many swaps will be performed interval How much time should be waited between the swaps (in seconds) relayerFee How much fee is offered to the relayers (in per ten thousand) tokenAddress The address of the token to invest in/
function create( uint256 numOfSwaps, uint256 interval, uint256 relayerFee, address tokenAddress ) external payable { require(investments[msg.sender].active == false, "Already active"); require(msg.value > 0, "No funds were sent"); uint256 amountPerPeriod = SafeMath.div( msg.value,...
12,319,906
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {PRBMathUD60x18} from "../../Utils/Math/PRBMathUD60x18.sol"; /// @dev BNPL bank node mathematical calculation tools /// @author BNPL library BankNodeUtils { using PRBMathUD60x18 for uint256; /// @notice The wETH contract address (ERC20 tradable v...
Sushiswap exact tokens path (join wETH in the middle) tokenIn input token address tokenOut output token address return swapExactTokensPath
function getSwapExactTokensPath(address tokenIn, address tokenOut) internal pure returns (address[] memory) { address[] memory path = new address[](3); path[0] = address(tokenIn); path[1] = WETH; path[2] = address(tokenOut); return path; }
12,848,033