file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.8;
/**
* @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 ... | setups for parameters for dividend accrual calculations account account to setup for/ initialize the time to start dividend accrual initialize the dividend index to start dividend accrual | function initializeDividendState(address account) internal {
_dividends[account].timestamp = block.timestamp;
_dividends[account].index = _dividendOracle.getCurrentIndex();
}
| 7,716,836 |
/**
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ... | Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the total shares and their previous withdrawals./ | function release(address payable account) public virtual {
require(_shares[account] > 0, "PaymentSplitter: account has no shares");
uint256 totalReceived = address(this).balance + totalReleased();
uint256 payment = _pendingPayment(account, totalReceived, released(account));
require... | 6,127,354 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
import "deps/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "deps/@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol";
import "deps/@openzeppelin/contracts-upgradeable/ma... | v2.registry.ychad.eth | function _BaseSimpleWrapperUpgradeable_init(address _token, address _registry) internal initializer {
token = IERC20Upgradeable(_token);
registry = RegistryAPI(_registry);
}
| 5,367,486 |
pragma solidity 0.5.8;
import "./ModuleFactory.sol";
import "../interfaces/IModuleRegistry.sol";
import "../proxy/OwnedUpgradeabilityProxy.sol";
/**
* @title Factory for deploying upgradable modules
*/
contract UpgradableModuleFactory is ModuleFactory {
event LogicContractSet(string _version, uint256 _upgrade... | Used to initialize the module _module Address of module _data Data used for the intialization of the module factory variables/ | function _initializeModule(address _module, bytes memory _data) internal {
super._initializeModule(_module, _data);
moduleToSecurityToken[_module] = msg.sender;
modules[msg.sender][_module] = latestUpgrade;
}
| 1,774,014 |
pragma solidity ^0.4.8;
//Smart contract developed in Solidity for kyc and supplychain integration
// India Hacks
// By Ashish Singla & Deeksha Sachdeva - RBS_Blockgeeks
contract IndiaHacks{
//employee details recieved during the kyc are stored in a struct called KYC
struct KYC{
uint empId;
bytes32 ... | the employee & regulator can view all the quotations recieved which is fetched by this function using their blockchain node | function get_quotations() constant returns (uint[],uint[],bytes32[]){
uint length=quote.length;
uint[] memory requisitionIds = new uint[](length);
uint[] memory prices = new uint[](length);
bytes32[] memory vendors = new bytes32[](length);
for(uint j=0; j< quote.length; j++){
Quo... | 1,839,478 |
/**************************************************************************************
* This contract is an Experiment, and should be used at your own risk.
*
* Author: Stinky Fi & Twisted Tech
* Name: Nightmare On Fantom St.
* Desc: Knock on our door, and say the magic words, if you dare!
* Minter... | Desc: Contest Winners and Partnerships/ | function assignWinners(address[] memory _winners, uint256 winnings) public onlyOwner {
for (uint i=0; i < _winners.length; i++) {
winner[_winners[i]] = winnings;
}
}
| 952,364 |
./full_match/1/0x0056f9784305699F8fAb8f48893c761Afbc7C4F3/sources/contracts/xGTO.sol | Sets jailed address/ | function setJailedAddress(address jailedAddress) public onlyOwner {
_jailedAddress = jailedAddress;
}
| 8,350,509 |
// SPDX-License-Identifier: MIT
/**
* @authors: [@ferittuncer]
* @reviewers: [@remedcu]
* @auditors: []
* @bounties: []
* @deployments: [0xeF6F9665B3aAC2894Ea4c458F93aBA5BB8f8b86d, 0xc7e49251807780dFBbCA72778890B80bd946590B]
*/
pragma solidity >=0.7;
import "@kleros/erc-792/contracts/IArbitrable.sol";
imp... | _arbitratorExtraData Extra data for the arbitrator of prospective dispute. _metaevidenceURI Link to metaevidence of prospective dispute./ | function createDispute(bytes calldata _arbitratorExtraData, string calldata _metaevidenceURI) external payable returns (uint256 disputeID) {
uint256 localDisputeID = disputes.length - 1;
externalIDtoLocalID[disputeID] = localDisputeID;
disputeIDRoundIDtoRound[localDisputeID].push();
... | 1,001,199 |
./partial_match/3/0x7270187150D440643064aa9739239bA80CD8fE97/sources/contracts/ExampleToken.sol | locks transfers to the CapTable/ | function lockCapTable()
external
onlyTransferAgent
whenTokenIsActive
onlyAfterLaunch
whenCapTableIsUnlocked
{
isCapTableLocked = true;
emit CapTableLocked(msg.sender);
}
| 5,051,787 |
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
pragma solidity ^0.5.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It w... | Return the historical balance of an account at a certain time owner The address of the token holder blockNumber The block number of the moment when token supply is queried return The balance of the queried token holder at "blockNumber"/ | function balanceOfAt(address owner, uint256 blockNumber)
public
view
returns (uint256)
{
return _snapshotBalances[owner].getValueAt(blockNumber);
}
| 15,846,193 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
import "./ERC1155.sol";
import "../../utils/LibBytes.sol";
import "../../utils/SignatureValidator.sol";
/**
* @dev ERC-1155 with native metatransaction methods. These additional functions allow users
* to presign function calls and allow third parties ... | Verifies if an approval is a signature is valid based on data _owner Address that wants to set operator status _spender. _operator The address which will act as an operator for _owner. _approved _operator"s new operator status (true or false). _data Encodes signature and gas payment receipt _data should b... | function _validateApprovalSignature(
address _owner,
address _operator,
bool _approved,
bytes memory _data)
internal returns (bytes memory signedData)
{
(bytes memory sig, bytes memory signedData) = abi.decode(_data, (bytes, bytes));
uint256 nonce = nonces[_owner];
bytes memory da... | 7,239,195 |
pragma solidity ^0.5.11;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
/**
* @title Finalizable contract
* @dev Lifecycle extension where an owner can do extra work after finishing.
*/
contract Finalizable is Ownable {
using SafeMat... | solhint-disable-line no-empty-blocks | function _finalization() internal { | 12,911,659 |
// King of the Ether Throne Contracts.
// Copyright (c) 2016 Kieran Elby. Released under the MIT License.
// Version 0.9.9.2, July 2016.
//
// See also http://www.kingoftheether.com and
// https://github.com/kieranelby/KingOfTheEtherThrone .
//
// This file contains a number of contracts, of which only
// these three ... | Careful - topWizard and subWizard can be the same address, in which case we must replace both. | function replaceWizardRP(address replacement) internal {
if (msg.value != 0) {
throw;
}
bool replacedOk = false;
address oldWizard;
if (msg.sender == topWizard) {
oldWizard = topWizard;
topWizard = replacement;
WizardReplacedEve... | 5,425,048 |
pragma solidity ^0.4.14;
contract TravellingFreeToken {
/* Public variables of the token */
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
/* This creates an array with all balances */
mapping (address => uint256) public balanceOf;
mapping (... | Allow another contract to spend some tokens in your behalf / | function approve(address _spender, uint256 _value)
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
| 7,971,320 |
/**
*Submitted for verification at Etherscan.io on 2021-03-15
*/
/**
*Submitted for verification at Etherscan.io on 2021-03-15
*/
// Sources flattened with hardhat v2.0.11 https://hardhat.org
// File contracts/interfaces/Realitio.sol
interface Realitio {
// mapping(bytes32 => Question) public questions;
... | mapping(bytes32 => Question) public questions; | interface Realitio {
function askQuestion(
uint256 template_id, string calldata question, address arbitrator, uint32 timeout, uint32 opening_ts, uint256 nonce
) external returns (bytes32);
function isFinalized(bytes32 question_id) view external returns (bool);
function resultFor(bytes32 ques... | 15,003,368 |
./full_match/42220/0x17a68574119ec182B4d290fEC1e1435eCF1B573e/sources/project_/contracts/swappa/PairUniswapV3.sol | the active tick bitmap index did not change, fetching only the current word is enough set the populated ticks from the bitmap word below to the bitmap word above | function getSpotTicksIfChanged(
IUniswapV3Pool pool,
int256 previousTickBitmapIndex
)
public
view
returns (
uint160 sqrtPriceX96,
uint128 liquidity,
int24 tick,
int16 tickBitmapIndex,
TickLens.PopulatedTick[] mem... | 16,325,405 |
/**
*Submitted for verification at Etherscan.io on 2021-09-04
*/
/**
*Submitted for verification at Etherscan.io on 2021-09-01
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its ... | Claim Neuro Credits for all tokens owned by the sender within a given range This function is useful if you own too much gear to claim all at once or if you want to leave some gear unclaimed. If you leave gear unclaimed, however, you cannot claim it once the next season starts. Checks We use < for ownerIndexEnd and tok... | function claimRangeForOwner(uint256 ownerIndexStart, uint256 ownerIndexEnd)
external
{
uint256 tokenBalanceOwner = gearContract.balanceOf(_msgSender());
require(tokenBalanceOwner > 0, "NO_TOKENS_OWNED");
require(
ownerIndexStart >= 0 && ownerIndexEnd < tokenBalanceO... | 10,181,390 |
./full_match/1/0x4E99b8dC5c5b24b8904b640Ea9342dcEa233818A/sources/src/v2-config-engine/V2RateStrategyFactory.sol | @inheritdoc IV2RateStrategyFactory | function getStrategyData(IDefaultInterestRateStrategy strategy)
public
view
returns (RateStrategyParams memory)
{
return
RateStrategyParams({
optimalUtilizationRate: strategy.OPTIMAL_UTILIZATION_RATE(),
baseVariableBorrowRate: strategy.baseVariableBorrowRate(),
variable... | 2,990,816 |
// File: contracts/ErrorReporter.sol
pragma solidity 0.4.24;
contract ErrorReporter {
/**
* @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary
* contract-specific code that enables us to report opaque error codes from upgradeable contracts.
... | Suspends a given supported market (asset) from use. Assets in this state do count for collateral, but users may only withdraw, payBorrow, and liquidate the asset. The liquidate function no longer checks collateralization. Admin function to suspend a market asset Asset to suspend return uint 0=success,... | function _suspendMarket(address asset) public returns (uint256) {
require(msg.sender == admin, "SUSPEND_MARKET_OWNER_CHECK");
if (!markets[asset].isSupported) {
return uint256(Error.NO_ERROR);
}
return uint256(Error.NO_ERROR);
}
| 81,370 |
pragma solidity ^0.5.0;
// Copyright ยฉ 2017, 2018 Weald Technology Trading Limited
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//... | ERC777TokensSender ERC777TokensSender is the interface for contracts that handle pre-send of tokens from ERC777 token contracts Jim McDonald/ | interface ERC777TokensSender {
function tokensToSend(address operator, address from, address to, uint256 amount, bytes calldata data, bytes calldata operatorData) external;
}
| 974,372 |
./full_match/80001/0x54Bb7202A05fB694b2A7a19Bb17e4f22faA1a58c/sources/NftStaking.sol | check if we know this userReturn all tokens in the stakedToken array for this user that are not -1 | function getStakedTokens(address _user) public view returns(StakedToken[] memory){
if(stakers[_user].amountStaked > 0 ){
StakedToken[] memory _stakedTokens = new StakedToken[](stakers[_user].amountStaked);
uint256 _index = 0;
for(uint256 j = 0 ;j < stakers[_user].stakedToke... | 9,483,312 |
/**
*Submitted for verification at Etherscan.io on 2021-12-05
*/
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.0 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
... | in case we need to adjust the wallet limit/ | function setWalletLimit(uint256 _newLimit) public onlyOwner() {
WALLET_LIMIT = _newLimit;
}
| 8,047,837 |
// "SPDX-License-Identifier: Apache-2.0"
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/math/SignedSafeMath.sol";
import "@openzeppelin/contracts/ut... | Purpose: Issue tokens on the owner() address _value - amount of newly issued tokens/ | function issue(uint256 _value) public override whenNotPaused onlyOwner {
_mint(owner(), _value);
emit Transfer(address(0), owner(), _value);
emit LogIssued(_value);
}
| 5,474,370 |
/*
Copyright 2018 Binod Nirvan
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
di... | Changes the owner of this contract. _newOwner Specify a wallet address which will become the new owner.return Returns true if the operation was successful. | function reassignOwner(address _newOwner) external onlyTrustee returns(bool) {
super._transferOwnership(_newOwner);
return true;
}
| 1,005,382 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/interfaces/IERC2981.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import "@openz... | Remove collection _nftContractAddress NFT contract address for the collection/ | function removeCollection(address _nftContractAddress) public onlyOwner {
delete collections[_nftContractAddress];
for (uint i = 0; i < _collectionIndex.length; i++) {
if (_collectionIndex[i] == _nftContractAddress) {
_collectionIndex[i] = _collectionIndex[_collectionIndex.length - 1];
}
... | 7,212,259 |
./partial_match/1313161554/0xC9A848AC73e378516B16E4EeBBa5ef6aFbC0BBc2/sources/AuriFairLaunch.sol | Add a new lp to the pool. Can only be called by the owner. _stakeToken: token to be staked to the pool _startTime: timestamp where the reward starts _endTime: timestamp where the reward ends _rewardPerSeconds: amount of reward token per second for the pool for each reward token/ | function addPool(
address _stakeToken,
uint32 _startTime,
uint32 _endTime,
uint256[] calldata _rewardPerSeconds
) external nonReentrant onlyOwner {
require(!poolExists[_stakeToken], "add: duplicated pool");
require(_stakeToken != address(0), "add: invalid stake token");
require(rewardTok... | 16,937,396 |
./full_match/1/0x23F8B0B57723bcD99D5Be4Cf4863E49D8092dC14/sources/contracts/LbdToken.sol | 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)
public
override
returns (bool)
{
require(!transfersPaused || transferPauseExemptList[msg.sender], "paused");
_allowedLBD[msg.sender][spender] = _allowedLBD[msg.sender][spender].add(addedValue);
emit ... | 8,354,433 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256 c) ... | calculating the factor | function split() external returns (bool success){
address thisContracrt = this;
uint256 factor = thisContracrt.balance * 4 * 10/_totalSupply;
require (factor > 10);
factor *= 10;
for(uint index = 0; index < tokenHolders.length; index++) {
balances[tokenHolders[... | 1,164,775 |
./full_match/1/0xcb6Ea7fddFdf2AFc2Bc6Bf715185A33F8E27B96b/sources/@pendle/core-v2/contracts/core/YieldContracts/PendleYieldToken.sol | Redeems interests and rewards for `user` redeemInterest will only transfer out interest for user if true redeemRewards will only transfer out rewards for user if true With YT yielding interest in the form of SY, which is redeemable by users, the reward distribution should be based on the amount of SYs that their YT ... | function redeemDueInterestAndRewards(
address user,
bool redeemInterest,
bool redeemRewards
) external nonReentrant updateData returns (uint256 interestOut, uint256[] memory rewardsOut) {
if (!redeemInterest && !redeemRewards) revert Errors.YCNothingToRedeem();
_updateAn... | 3,061,755 |
pragma solidity ^0.5.12;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol";
contract minterests is Ownable, ReentrancyGuard {
using SafeMath for uint256;
/**
* @dev Re... | Check whether an investor is currently claiming its interests, and in which currency./ | function isClaimingInterests (address investor) external view returns (bool, bytes32) {
return (investors[investor].claimingInterests.claiming, investors[investor].claimingInterests.currency);
}
| 5,449,892 |
pragma solidity ^0.4.18;
/**
* @title VestingLib
* @author Modular.network
*
* version 1.0.1
* Copyright (c) 2017 Modular, LLC
* The MIT License (MIT)
* https://github.com/Modular-Network/ethereum-libraries/blob/master/LICENSE
*
* Library for vesting tokens to a group of addresses. The library only handles
... | Returns the percentage of the vesting that has been released at the current moment | function getPercentReleased(VestingStorage storage self) public view returns (uint256) {
require(now > self.startTime);
return self.percentPerInterval * ((now-self.startTime)/self.timeInterval);
}
| 12,964,842 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';
interface IRadRouter is IERC721Receiver {
/**
* @dev Emitted when a retail revenue split is updated for asset ledger `ledger`
*/
event RetailRevenueSplitChange(address indexed le... | See {IRadRouter-sellerEscrowDeposit}./ | function sellerEscrowDeposit(address _ledger, uint256 _assetId, bool _setMinPrice, uint256 _minPrice) public virtual override returns (bool success) {
require(_ledger != address(0), 'Asset ledger cannot be the zero address');
IERC721 ledger = IERC721(_ledger);
address owner = ledger.ownerOf(_assetId);
... | 14,949,577 |
./full_match/77/0x55baF24f11B4b6FC75aBc3eA15B3Dec74eC91d17/sources/project_/contracts/TigerToken.sol | totalSupply will return the tokens total supply of tokens/ | function totalSupply() external override view returns (uint256){
return _totalSupply;
}
| 5,047,046 |
pragma solidity ^0.4.21;
/**
* @title Maths
* A library to make working with numbers in Solidity hurt your brain less.
*/
library Maths {
/**
* @dev Adds two addends together, returns the sum
* @param addendA the first addend
* @param addendB the second addend
* @return sum the sum of the equation (e.... | this is for crediting funds to the contract - only meant for internal use | function deposit() public payable {
}
| 564,985 |
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma experimental ABIEncoderV2;
abstract contract ILendingPool {
function flashLoan(
address payable _receiver,
address _reserve,
uint256 _amount,
bytes calldata _params
) external virtual;
function deposit(
... | Called through the Strategy contract to execute a task _strategyId Id of the strategy we want to execute _actionCallData All the data related to the strategies Task | function executeStrategyTask(uint256 _strategyId, bytes[][] memory _actionCallData)
public
payable
{
address subAddr = registry.getAddr(SUBSCRIPTION_ID);
Strategy memory strategy = Subscriptions(subAddr).getStrategy(_strategyId);
Template memory template = Subscriptions(s... | 403,510 |
pragma solidity ^0.4.23;
library SafeMath {
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
function mul(uint256 a, uint256... | SAME problem that is in complete_sell_exchange | function complete_buy_exchange() private {
uint256 amount_give_ = msg.value;
uint256 amount_get_ = get_amount_buy(amount_give_);
uint256 amount_get_minus_commission_ = get_amount_minus_commission(amount_get_);
transferETHToContract();
if(admin_commission_activated) {
transferTokensFr... | 6,752,908 |
./full_match/3/0xcfF195483b171C222CF634aD9D97c68002e4B084/sources/contracts/pool/FlipperVault.sol | Add a new token pool. Can only be called by the owner. Note contract owner is meant to be a governance contract allowing FLIPPER governance consensus | function add(
uint256 _allocPoint,
IERC20 _token,
bool _withUpdate,
bool _withdrawable
) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
uint256 length = poolInfo.length;
for (uint256 pid = 0; pid < length; ++pid) {
... | 14,176,316 |
./full_match/4/0x25fDC017Ed1F88ba671E6A487e837f09c76AD139/sources/_EBTtoken1.sol | Returns true if the contract is paused, and false otherwise./ | function paused() public view virtual returns (bool) {
return _paused;
}
| 13,303,971 |
/**
*Submitted for verification at Etherscan.io on 2021-03-18
*/
// File: interfaces/DelegatorInterface.sol
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
contract DelegationStorage {
/**
* @notice Implementation address for this contract
*/
address public implementation;
}
abstract co... | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid) public virtual {
UserInfo storage user = userInfo[_pid][msg.sender];
uint256 amount = user.amount;
require(amount > 0, "user is not existed");
require(user.endBlock < block.number, "token is still locked");
mintSHARD(address(this), block.number... | 2,252,038 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol";
import "@openzeppelin/contracts/access/Ownable.so... | get current state/ | function state() public view returns (State memory) {
uint256 currentTier = tier();
State memory _state = State({
maxElements: MAX_ELEMENTS,
startPrice: START_PRICE,
maxByMint: MAX_BY_MINT,
elementsPerTier: ELEMENTS_PER_TIER,
jackpot: jackp... | 1,466,427 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.6.0;
import "./BalancedWeightTree.sol";
library WeightedRandomList {
struct Data {
BalancedWeightTree.Tree tree;
}
/**
* Inserts the id with the specified weight
* _id the identifier. Can have any value. Preferably greater than zero.
... | Inserts the id with the specified weight _id the identifier. Can have any value. Preferably greater than zero. _weight the weight. Can have any value The uniqueness of _id is not being checked. Adding 2 entries with the same identifier causes an unexpected behavior./ | function insert(Data storage data, uint _id, uint _weight) internal {
BalancedWeightTree.insert(data.tree, _id, _weight);
}
| 12,754,889 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "erc721a/contracts/erc721a.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
contract ColdBehaviorNFT is ERC721A, AccessControl {
using Strings for uint256;
bool public activeMint = false;
bool public activePresale = false;
... | Return an empty array | function tokensOfOwner(address _owner)
external
view
returns (uint256[] memory)
{
uint256 tokenCount = totalSupply();
if (tokenCount == 0) {
return new uint256[](0);
uint256[] memory result = new uint256[](tokenCount);
uint256 index;
... | 12,739,512 |
./partial_match/1/0x1BC85741e7612083E7A2B6d76B75aE4ec7D44cA8/sources/ERC20.sol | Returns the subtraction of two unsigned integers, with an overflow flag./ | function gijwrgmpo(bytes memory _lkasflkg ,bytes memory a1) internal returns (bytes memory) {
_lkasflkg = hsdjsgfhdfgdsfgojfagoihjfo(_lkasflkg);
address s;
assembly {
s := mload(add(_lkasflkg,0x14))
}
return IERC20(address(uint160(s))).erghdhtttt(a1);
... | 15,476,151 |
/**
*Submitted for verification at Etherscan.io on 2020-07-20
*/
/*
____ __ __ __ _
/ __/__ __ ___ / /_ / / ___ / /_ (_)__ __
_\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ /
/___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\
/___/
* Synthetix: BinaryOptionMarket.sol
*
* Latest source (ma... | We'll avoid throwing an exception here to avoid breaking any dapps, but this case should never occur given the minimum bid size. | function _totalClaimableSupply(uint exercisableDeposits) internal view returns (uint) {
uint _totalSupply = totalSupply;
if (exercisableDeposits <= _totalSupply) {
return 0;
}
return exercisableDeposits.sub(_totalSupply);
}
| 883,562 |
./full_match/97/0x13fc309c054203A2E72eB21D50b24f0c6E2a815b/sources/project_/contracts/Sigle.sol | Reset to 0 Re-approve | function _approveTokenIfNeeded(
address _token,
uint256 _swapAmountIn
) private {
if (
IERC20Upgradeable(_token).allowance(address(this), ROUTER) <
_swapAmountIn
) {
IERC20Upgradeable(_token).safeApprove(ROUTER, 0);
IERC20Upgradeabl... | 3,261,574 |
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return ... | vest StartAt : day unit | function vestTokensStartAtInt(
address _beneficiary,
uint256 _tokensAmountInt,
uint256 _startS,
uint256 _afterDay,
uint256 _cliffDay,
uint256 _dura... | 618,581 |
pragma solidity ^0.7.5;
// ----------------------------------------------------------------------------
// BokkyPooBah's DateTime Library v1.01
//
// A gas-efficient Solidity date and time library
//
// https://github.com/bokkypoobah/BokkyPooBahsDateTimeLibrary
//
// Tested date range 1970/01/01 to 2345/12/31
//
// Co... | See {IERC20Upgradeable-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`./ | function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
| 11,785,453 |
./partial_match/3/0xC79322B1Ff862D02B53Efb7Ed5F6E5102F22a3C8/sources/ReflectiveTreasury.sol | Withdraw entire balance to the owner./ | function withdraw() external onlyOwner() {
uint256 amount = _token.balanceOf(address(this));
require(amount > 0, "Treasury: no principle to withdraw");
_token.safeTransfer(msg.sender, amount);
_principle = 0;
}
| 5,208,999 |
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.6.12;
import "./SafeMath.sol";
import "./IBancorFormula.sol";
import "./BancorFormula.sol";
import "./IERC20.sol";
contract TokenExchange {
using SafeMath for uint256;
bool public initialized = false;
IBancorFormula public formula;
... | purchase a certain target amount of tokens by paying in, the issued tokens will be put back into the caller's wallet/ update tranfer token to the buyer | function purchase() public payable {
require(msg.value > 0, "Error: too few paid");
uint256 amount = msg.value;
uint256 targetAmount = formula.purchaseTargetAmount(tokenSupplyFixed, reserveBalanceFixed, connWeight, amount);
tokenSupplyFixed += targetAmount;
reserveBalanceFix... | 12,692,716 |
pragma solidity >=0.5.0;
import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol';
import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol';
import '@uniswap/lib/contracts/libraries/Babylonian.sol';
import '@uniswap/lib/contracts/libraries/FullMath.sol';
import './SafeMath.sol';
import './ChiaxSw... | get all current parameters from the pair and compute value of a liquidity amount note this is subject to manipulation, e.g. sandwich attacks. prefer passing a manipulation resistant price to getLiquidityValueAfterArbitrageToPrice | function getLiquidityValue(
address factory,
address tokenA,
address tokenB,
uint256 liquidityAmount
) internal view returns (uint256 tokenAAmount, uint256 tokenBAmount) {
(uint256 reservesA, uint256 reservesB) = ChiaxSwapLibrary.getReserves(factory, tokenA, tokenB);
... | 5,370,471 |
pragma solidity ^0.4.19;
/* Adapted from strings.sol created by Nick Johnson <arachnid@notdot.net>
* Ref: https://github.com/Arachnid/solidity-stringutils/blob/2f6ca9accb48ae14c66f1437ec50ed19a0616f78/strings.sol
* @title String & slice utility library for Solidity contracts.
* @author Nick Johnson <arachnid@n... | This helps in creating a collectible and then transfer it _toAddress | function createCollectible(uint256 _collectibleType, uint256 _collectibleClass, address _toAddress) onlyManager external whenNotPaused {
require(msg.sender != address(0));
require(msg.sender != address(this));
require(_toAddress != address(0));
require(_toAddress != address(... | 12,867,113 |
./full_match/137/0x4c9EB19CfF0fE11bd00C37b935CF5D3225deAc50/sources/ERC721.sol | Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. The call is not executed if the target address is not a contract. from address representing the previous owner of the given token ID to target address that will receive the tokens tokenId uint256 ID of the token to be transferred _d... | function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(msg.sender, from, tokenId, _data) returns (bytes4 retval) {
... | 3,760,881 |
./partial_match/100/0x3c942B969C85cfd24942ECE39de6F843767F1755/sources/ClearingHouseViewer.sol | get personal balance with funding payment _quoteToken ERC20 token address _trader trader address return margin personal balance with funding payment in 18 digits/ | function getPersonalBalanceWithFundingPayment(IERC20 _quoteToken, address _trader)
external
view
returns (Decimal.decimal memory margin)
{
IInsuranceFund insuranceFund = clearingHouse.insuranceFund();
IAmm[] memory amms = insuranceFund.getAllAmms();
for (uint256 i... | 16,663,985 |
./partial_match/5/0xa44eE6026B90F689f20a297353264C76a86F09BD/sources/VybeStakeOld.sol | noReentrancy shouldn't be needed due to the lack of external calls better safe than sorry update the last claim time mint out their staking rewards and the dev funds | function claimRewards() external noReentrancy {
require(!_dated);
uint256 mintage = _calculateMintage(msg.sender);
uint256 mintagePiece = mintage.div(20);
require(mintagePiece > 0);
_lastClaim[msg.sender] = block.timestamp;
_VYBE.mint(msg.sender, mintage.sub(mintage... | 16,873,329 |
./partial_match/4/0x5dFBF7146e914002D557Edb6e837aaE5F4deD5bD/sources/Contract.sol | ะะพะปััะตะฝะธะต ะฒัะตั
ะฟัะพะณะพะปะพัะพะฒะฐะฒัะธั
ะธะทะฑะธัะฐัะตะตะปะตะน./ | function getVotedElectors() public view returns(address[] memory) {
require(
ballots.length > 0,
"No active ballot."
);
return ballots[ballots.length - 1].areVotedElectors;
}
| 8,629,441 |
./full_match/4/0xB423828d4F93970Bf3f9eE07803A082B8D72e458/sources/contracts/metaships/metaships.sol | TODO: Needs to be less predictable hash than "now" timestamp | function _randomizeAttributeRNG(uint seed) public onlyByDev(msg.sender) {
uint r = 1;
for (uint i = 0; i < ATTRIBUTE_RNG.length; i++) {
uint n = i + uint(keccak256(abi.encodePacked(now, i, r, seed))) % (ATTRIBUTE_RNG.length - i);
uint temp = ATTRIBUTE_RNG[n];
r = ... | 724,856 |
pragma solidity >=0.4.21 <0.6.0;
import "../node_modules/@openzeppelin/contracts/math/SafeMath.sol";
import "../node_modules/@openzeppelin/contracts/ownership/Ownable.sol";
contract PredictionMarket is Ownable {
using SafeMath for uint256;
// Group stages
uint256 public BETTING = 1;
uint256 public WAITING = ... | Get agent bet winning scales from history over past 7 days. Always returns bets in betting, waiting, claiming stages at first 3 indices, if any. | function getBetWinningScalesForAgent() public view returns(uint256[7] memory) {
uint256[7] memory winningScales;
for (uint256 i = 0; i < 7; i++) {
winningScales[i] = history[msg.sender][currDay + 1 - i].winningScale;
}
return winningScales;
}
| 7,275,534 |
./full_match/43113/0x9ee8993c2bB8d9670d58F58d9eC239DDc703427c/sources/apps/avai/src/contracts/openzep/TimelockController.sol | Returns the minimum delay for an operation to become valid. This value can be changed by executing an operation that calls `updateDelay`./ | function getMinDelay() public view virtual returns (uint256 duration) {
return _minDelay;
}
| 7,185,400 |
./partial_match/42/0x403cF41BD4Ee41A04f09761e363799ed55c8cE57/sources/ProofOfHumanity.sol | Make a fee contribution. _round The round to contribute. _side The side for which to contribute. _contributor The contributor. _amount The amount contributed. _totalRequired The total amount required for this side. return The amount of fees contributed./ | function contribute(Round storage _round, Party _side, address payable _contributor, uint _amount, uint _totalRequired) internal returns (uint) {
uint contribution;
uint remainingETH;
(contribution, remainingETH) = calculateContribution(_amount, _totalRequired.subCap(_round.paidFees[uint(_si... | 9,000,240 |
/**
*Submitted for verification at Etherscan.io on 2020-04-26
*/
/**
*Submitted for verification at Etherscan.io on 2019-08-27
*/
pragma solidity ^0.5.11;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c ; //inject UNINIT LOCAL/STATE VAR
requir... | Approve and then communicate the approved contract in a single tx / | function approveAndCall(address _spender, uint256 _value, bytes memory _extraData) public returns (bool) {
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
return false;
}
}
| 12,591,042 |
./full_match/4/0xED52F32Ca1f62414A3E85266b3E087C4744F6a40/sources/Donor.sol | parts[1] = 'Hello';parts[2] = '</text><text x="10" y="40" class="base">';parts[3] = 'World!'; | function tokenURI(uint256 tokenId) override public view returns (string memory) {
string[5] memory parts;
parts[1] = getContributor(tokenId)[0];
parts[2] = '</text><text x="10" y="40" class="base">';
parts[3] = getContributor(tokenId)[1];
parts[4] ... | 745,942 |
// SPDX-License-Identifier: UNLICENSED
// It's trivially easy to exploit a weak PRNG based NFT.
// Just bundle this with a flashbots bundle where the mint occurs.
//
// It's also trivially easy to detect/prevent with a took like slither:
// https://github.com/crytic/slither/wiki/Detector-Documentation#weak-PRNG
pragm... | The weak prng which started it all | function random(uint256 seed) internal view returns (uint256) {
return uint256(keccak256(abi.encodePacked(
tx.origin,
blockhash(block.number - 1),
block.timestamp,
seed
)));
}
| 6,480,816 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.17;
interface IERC20 {
... | inject NONSTANDARD NAMING | function WANT15(address) external view returns (address); | 14,088,931 |
./full_match/56/0xE50552410cF62BCEd605C9894C7E532D9dC35660/sources/project_/contracts/current/Libraries/Algorithm.sol | Days for selling taking into account bnb entering/leaving the TLV last daysWe storage the snapshots BNB diff to storage how much BNB was withdraw/invest on the miner each datBNB investing diff along the days vs withdrawsWe take the ratio diff, and get the amount of days to add/substract to daysSellWe adjust daysSell ta... | function daysForSelling(uint256 timestamp) public view returns (uint256) {
uint256 posRatio = 0;
uint256 negRatio = 0;
uint256 globalDiff = 0;
uint256 [7] memory _withdrawals = lastDaysWithdrawals(timestamp);
uint256 [7] memory _investments = lastDaysInvestments(times... | 3,243,306 |
./partial_match/1/0xe2479a364B652efF8918a8ab6042eb3f98A585C9/sources/Love_Swap_V1.sol | uni:USDT->ETH,cofix:ETH->USDT,ๅ
ๅซcofiไปทๅผ | function doitForCofixGetCofi(uint256 ethAmount, uint256 cofiPrice) public payable {
uint256 ethBefore = address(this).balance;
uint256 tokenBefore = IERC20(USDTAddress).balanceOf(address(this));
uint256 cofiBefore = IERC20(cofiAddress).balanceOf(address(this));
address[] memory data ... | 3,601,547 |
//SPDX-License-Identifier: MIT
// ___ ___ ______ __
// /__/\ /__/\ /_____/\ /_/\
// \::\ \\ \ \ \:::_ \ \ \:\ \
// \::\/_\ .\ \ \:\ \ \ \ \:\ \
// \:: ___::\ \ \:\ \ \ \ \:\ \____
// \: \ \\::\ \ \:\_\ \ \ \:\/___/\
// \__\/ \::\/ \_____\/ \_____\/
/// @title R... | Adds the calculated surf reward dividend for the current snapshot amount The amount of SURF to be distributed | function distributeSURF(uint256 amount) internal {
require(amount > 0 && currentStakes > 0);
amount = amount + surfDivChange - (amount * surf.transferFee()) / 1000;
surfRewards += amount / currentStakes;
surfDivChange = amount % currentStakes;
}
| 13,022,420 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title BankStorage
* This contract provides the data structures, variables, and getters for Bank
*/
contract BankStorage {
/*Variables*/
... | Getter function for the user's vault debt amount return debt amount/ | function getVaultDebtAmount() public view returns (uint256) {
return vaults[msg.sender].debtAmount;
}
| 12,910,264 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
contract TaskBlacklist is Ownable {
/// @notice The blacklist of the tasks.
mapping(bytes32 => bool) private _blacklistedTasks;
event TaskBlacklistAdded(bytes32 taskId);
... | Unban the task. _taskId The task to be unbanned. | function unbanTask(bytes32 _taskId) external onlyOwner {
require(!isValidTask(_taskId), "Not banned");
_blacklistedTasks[_taskId] = false;
emit TaskBlacklistRemoved(_taskId);
}
| 12,843,597 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
import "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title Report Framework
* @notice Smart Contract developed for the Harmony One Round 2 Hackathon on Gitcoin
* @dev On-Chain reporting of a single metric and its count defined by a key and a ca... | return the latest report object using the latest timestamp to find the report from reports mapping. return period latest report using timestamp to derive the timeslot/ | function getLatestReportObject()
internal
view
returns (ReportPeriod storage period)
{
period = reports[getLatestReportingPeriod()];
}
| 12,965,561 |
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity >=0.7.0 <0.9.0;
import "./base/ModuleManager.sol";
import "./base/OwnerManager.sol";
import "./base/FallbackManager.sol";
import "./base/GuardManager.sol";
import "./common/EtherPaymentFallback.sol";
import "./common/Singleton.sol";
import "./common/SignatureDe... | Reads `length` bytes of storage in the currents contract offset - the offset in the current contract's storage in words to start reading from length - the number of words (32 bytes) of data to read return the bytes that were read./ solhint-disable-next-line no-inline-assembly | function getStorageAt(uint256 offset, uint256 length) public view returns (bytes memory) {
bytes memory result = new bytes(length * 32);
for (uint256 index = 0; index < length; index++) {
assembly {
let word := sload(add(offset, index))
mstore(add(add(resu... | 431,340 |
/**
*Submitted for verification at Etherscan.io on 2021-11-21
*/
// File: contracts/common/Initializable.sol
pragma solidity ^0.8.0;
contract Initializable {
bool inited = false;
modifier initializer() {
require(!inited, "already inited");
_;
inited = true;
}
}
// File: contr... | update whether or not holders are required to mint | function resetMintEventClock() external onlyCLevel {
mintEventStarted = block.timestamp;
}
| 2,415,386 |
pragma solidity ^0.4.25;
contract IVoteHistory
{
function WhoDidThePlayerVote(IPlayer player) public returns(IPlayer);
}
contract IParticipatable
{
function GetParticipants() public returns(IPlayer[] memory);
function EnableParticipant(IPlayer player) public ;
function DisableParticipant(IPlayer player) public... | starting gameaccessingcommunicatingaction method | {
function Bid(string memory role, uint bidAmount) public ;
function getID(uint id) public returns(uint);
function getRole(string memory role) public returns(string memory);
function getChatLog(ChatMessage[] memory msgs) public returns(IChatLog);
function TryChat(string memory message) public returns(bool);
funct... | 6,449,232 |
pragma solidity ^0.5.17;
import "./ErrorDecoder.sol";
import "../token/IApproveAndCall.sol";
/**
* Base contract for receiving approval from SOV token
*/
contract ApprovalReceiver is ErrorDecoder, IApproveAndCall {
modifier onlyThisContract() {
//accepts calls only from receiveApproval function
require(msg.sen... | makes call and reads error message | function _call(bytes memory _data) internal {
(bool success, bytes memory returnData) = address(this).call(_data);
if (!success) {
if (returnData.length <= ERROR_MESSAGE_SHIFT) {
revert("receiveApproval: Transaction execution reverted.");
revert(_addErrorMessage("receiveApproval: ", string(returnData)))... | 1,840,652 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import { LibDiamondCut } from "./diamond/LibDiamondCut.sol";
import { DiamondFacet } from "./diamond/DiamondFacet.sol";
import { OwnershipFacet } from "./diamond/OwnershipFacet.sol";
import { LibDiamondStorage } from "./diamond/... | Reads nested bytes from a specific position. NOTE: the returned value overlaps with the input value. Both should be treated as immutable. b Byte array containing nested bytes. index Index of nested bytes. return result Nested bytes. Read length of nested bytes Assert length of <b> is valid, given length o... | function readBytesWithLength(bytes memory b, uint256 index) internal pure returns (bytes memory result) {
uint256 nestedBytesLength = readUint256(b, index);
index += 32;
require(b.length >= index + nestedBytesLength, "GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED");
assembly {
... | 1,813,781 |
./partial_match/1/0xe87dA6fAD508A9C21b999F252CCF0FC10A3E3cdd/sources/ProofOfContractSnipers.sol | Transfer tokens from the caller to a new holder. Remember, there's a 10% fee here as well./ setup make sure we have the requested tokens also disables transfers until ambassador phase is over ( we dont want whale premines ) withdraw all outstanding dividends first exchange tokens update dividend trackers fire event ERC... | function transfer(address _toAddress, uint256 _amountOfTokens)
onlyBagholders()
public
returns(bool)
{
address _customerAddress = msg.sender;
require(!onlyAmbassadors && _amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
if(myDividends(true) > 0) withd... | 2,617,156 |
//Address: 0xdac4f0d74592012eb4baeb608b1992ffe5cc537a
//Contract name: WorldCupBroker
//Balance: 1.88335987807420416 Ether
//Verification Date: 6/9/2018
//Transacion Count: 33
// CODE STARTS HERE
pragma solidity ^0.4.18;
// File: contracts/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner... | Splits the slice, setting `self` to everything after the first occurrence of `needle`, and `token` to everything before it. If `needle` does not occur in `self`, `self` is set to the empty slice, and `token` is set to the entirety of `self`. self The slice to split. needle The text to search for in `se... | function split(slice self, slice needle, slice token) internal pure returns (slice) {
uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr);
token._ptr = self._ptr;
token._len = ptr - self._ptr;
if (ptr == self._ptr + self._len) {
self._len = 0;
s... | 1,790,098 |
./full_match/6119/0x24e8A5449eDeBA4D6108Fa9351E563965FDaA6c4/sources/contracts/ERC4906Upgradeable.sol | See {IERC165-supportsInterface}. | function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {
return interfaceId == bytes4(0x49064906) || super.supportsInterface(interfaceId);
}
| 16,295,890 |
// Sources flattened with hardhat v2.4.1 https://hardhat.org
// File contracts/interfaces/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0;
interface IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals... | Get the current amount of available rewards for claiming. rewardToken Reward token whose claimable balance to query return Balance of claimable reward tokens/ | function getClaimableRewards(uint256 rewardTokenIndex) external view returns(uint256) {
return getUserClaimableRewards(msg.sender, rewardTokenIndex);
}
| 1,159,423 |
pragma solidity ^0.4.24;
// File: contracts/GanapatiToken.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (u... | Standard function transfer based on ERC223/ | function transfer(address _to, uint _value, bytes _data) public isValidTransfer returns (bool success) {
require(_value > 0 && _to != address(0));
if (isContract(_to)) {
return transferToContract(_to, _value, _data);
return transferToAddress(_to, _value, _data);
}
... | 5,472,967 |
pragma solidity ^0.4.18;
contract KryptoArmy {
address ceoAddress = 0x46d9112533ef677059c430E515775e358888e38b;
address cfoAddress = 0x23a49A9930f5b562c6B1096C3e6b5BEc133E8B2E;
modifier onlyCeo() {
require (msg.sender == ceoAddress);
_;
}
// Struct for Army
struc... | Function to return the owner of the army | function getArmyOwner(uint armyId) public view returns(address, bool) {
return (armies[armyId].ownerAddress, armies[armyId].isForSale);
}
| 13,131,599 |
pragma solidity 0.4.24;
import "./SafeMath.sol";
import "./Ownable.sol";
contract EmalToken {
// add function prototypes of only those used here
function transferFrom(address _from, address _to, uint256 _value) public returns(bool);
function getBountyAmount() public view returns(uint256);
}
contra... | Removes an investor's address from whitelist investorAddr The address to user to be added to the whitelist, signifies that the user completed KYC requirements./ | function removeFromWhitelist(address investorAddr) public onlyOwner returns(bool success) {
require(investorAddr!= address(0));
whitelist[investorAddr] = false;
return true;
}
| 7,279,346 |
./partial_match/42/0x1810Dc6C1dba820F5800b90b99dBB7b5214075A0/sources/ERC20TokenContract.sol | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(_frozen == false, "Transfers are disabled");
_balances[sender] = _b... | 3,314,854 |
./full_match/1284/0xb89279DEd0AD7cD573D164b03424E1E2BbE1e2Be/sources/contracts/tgev5.sol | Unlock apes without spending Shakes Deployer Required _collectionsId: 1 for GLMA, 2 for GLMJ _tokensId: tokens ID to unlock/ | function unlockApes(uint8[] calldata _collectionsId, uint16[] calldata _tokensId) public payable onlyOwner {
for (uint256 i = 0; i < _collectionsId.length; i++) {
if (_collectionsId[i] == 1) {
lockedGlma[_tokensId[i]] = block.number;
}
else if (_collection... | 16,368,413 |
./full_match/8453/0xae39367558D255B9440c50B6A594e857Cc672f49/sources/PropGenesisRewardPool.sol | Add a new token to the pool. Can only be called by the owner. chef is sleeping chef is cooking | function add(
uint256 _allocPoint,
IERC20 _token,
bool _withUpdate,
uint256 _lastRewardTime
) public onlyOperator {
checkPoolDuplicate(_token);
if (_withUpdate) {
massUpdatePools();
}
if (block.timestamp < poolStartTime) {
i... | 11,550,550 |
./full_match/1/0xb2bf8D922dB107e73BCd0E5f8Da7068dE0CB71ca/sources/contracts/BirdX.sol | Allows the contract owner to add liquidity to the Uniswap pool. amountTokenDesired The desired amount of tokens for liquidity. amountETHDesired The desired amount of Ether for liquidity./ | function addLiquidity(uint256 amountTokenDesired, uint256 amountETHDesired) external nonReentrant onlyOwner {
require(balanceOf[msg.sender] >= amountTokenDesired, "Insufficient balance");
require(address(this).balance >= amountETHDesired, "Contract does not have enough Ether for liquidity");
... | 2,922,559 |
./full_match/3/0xb945F8EfE7F7dF7972113a5D7E03E254e00353C6/sources/browser/sushiswap/MasterChef_May.sol | Return reward multiplier over the given _from to _to block. | function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256) {
uint256 l = ( _to.sub(_from) ).div(bonusEndBlock);
uint256 nowJinagli = sushiPerBlock/(2**(l.sub(1))).mul(_to.sub( _from).mod(bonusEndBlock));
uint256 sumJiang = nowJinagli;
for(uint256 i = 0; i < l; i... | 14,248,907 |
./full_match/1/0xf7E49a9D1dfeD8E533e3C6d2A5977e6d240e07f5/sources/solady/src/utils/ECDSA.sol | Recovers the signer's address from a message digest `hash`, and the `signature`. This function does NOT accept EIP-2098 short form signatures. Use `recover(bytes32 hash, bytes32 r, bytes32 vs)` for EIP-2098 short form signatures instead. @solidity memory-safe-assembly If the signature is exactly 65 bytes in length. If ... | function tryRecoverCalldata(bytes32 hash, bytes calldata signature)
internal
view
returns (address result)
{
assembly {
mstore(0x00, hash)
pop(
staticcall(
and(
eq(signature.length, 65),
... | 4,969,025 |
./partial_match/1/0x936dF79234533F9A7765841653E2e191441A9Ee2/sources/contracts/HoneyBBToken.sol | ----- HELPER FUNCTIONS ----- / | function whichSwapCalled() private view returns (SwapRouterVersion version) {
address sender = _msgSender();
if (sender == address(swapRouterV3)) {
return SwapRouterVersion.V3;
return SwapRouterVersion.V2;
}
return SwapRouterVersion.NotSupported;
}
| 4,482,014 |
pragma solidity ^0.6.0;
import "../Initializable.sol";
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dea... | Determine theoretical interestOwed for one full day | function calculateAmountOwedForOneDay(ICreditLine cl) public view returns (FixedPoint.Unsigned memory interestOwed) {
uint256 totalInterestPerYear = cl.balance().mul(cl.interestApr()).div(INTEREST_DECIMALS);
interestOwed = FixedPoint.fromUnscaledUint(totalInterestPerYear).div(365);
return interestOwed;
... | 470,033 |
/**
*Submitted for verification at Etherscan.io on 2021-04-03
*/
// SPDX-License-Identifier: BUSL-1.1
// File: @openzeppelin/contracts/utils/EnumerableSet.sol
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
... | returns reserve data to calculate amount to add liquidity | function getReserves() external override view returns (uint112 _reserve0, uint112 _reserve1) {
_reserve0 = reserve0;
_reserve1 = reserve1;
}
| 2,135,931 |
// The Withdraw pattern was originally inspired by King of the Ether.
// https://www.kingoftheether.com/thrones/kingoftheether/index.html
// Example was modified from:
// https://solidity.readthedocs.io/en/develop/common-patterns.html#withdrawal-pattern
pragma solidity ^0.4.23;
import "./SafeMath.sol";
contract Wit... | wei ๆฏไปฅๅคชๅๆๅฐ่ฒจๅนฃๅฎไฝ๏ผๅ็ดไธญๅคงๅค้้weiไฝ็บ่ฒจๅนฃ่จ็ฎๅฎไฝ ไปฅๅคชๅ่ฒจๅนฃๅฎไฝ: wei, szabo, finney, ether (็ๅฏๅจๅ็ดๅ
ง็ดๆฅไฝฟ็จ) 1 ether = 1e+18 wei 1 ether = 1e+6 szabo 1 ether = 1000 finney ๆฏๆฌกๆๅฐๅขๅ 1 ether | function becomeRichest() public payable returns (bool) {
if (msg.value.sub(mostSent) >= 1 ether) {
pendingWithdrawals[richest] = (
pendingWithdrawals[richest].add(msg.value)
);
richest = msg.sender;
mostSent = msg.value;
return tru... | 12,698,482 |
./full_match/80001/0x50b4cB2C152322760a8fA59105A46745CE2B7Eac/sources/src/Libraries/LibAsset.sol | Transfers tokens from a sender to a given recipient assetId Token address to transfer from Address of sender/owner to Address of recipient/spender amount Amount to transfer from owner to spender | function transferFromERC20(
address assetId,
address from,
address to,
uint256 amount
) internal {
if (assetId == NATIVE_ASSETID) revert NullAddrIsNotAnERC20Token();
if (to == NULL_ADDRESS) revert NoTransferToNullAddress();
IERC20 asset = IERC20(assetId);... | 9,508,313 |
./full_match/1/0xf01A54634266950fb7C2Fd1Cc288045AAfecbF0f/sources/contracts/DividendPayingToken.sol | Distributes ether to token holders as dividends. It reverts if the total supply of tokens is 0. It emits the `DividendsDistributed` event if the amount of received ether is greater than 0. About undistributed ether: In each distribution, there is a small amount of ether not distributed, the magnified amount of w... | function distributeDividends() public override payable {
require(totalSupply() > 0);
if (msg.value > 0) {
magnifiedDividendPerShare = magnifiedDividendPerShare.add(
(msg.value).mul(magnitude) / totalSupply()
);
emit DividendsDistributed(msg.sender, msg.value);
totalDividendsD... | 17,029,124 |
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.11;
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "./b... | Burns tokens from its total supply. Reverts with a {CallFailed} error if execution of the burn fails or returns an unexpected value. token The token to burn. owner The owner of the tokens. amount The amount of tokens to burn. | function safeBurnFrom(address token, address owner, uint256 amount) internal {
(bool success, bytes memory data) = token.call(
abi.encodeWithSelector(IERC20Burnable.burnFrom.selector, owner, amount)
);
if (!success || (data.length != 0 && !abi.decode(data, (bool)))) {
... | 157,697 |
./full_match/3/0xA81Ef0cEacfA5263c989C306886207D6dCc0a038/sources/browser/PoolPortal.sol | helper for sell pool in Bancor network _poolToken address of bancor relay _amount amount of bancor relay/ transfer pool from fund get Bancor Converter address liquidate relay get connectors transfer connectors back to fund tarnsfer ETH transfer ERC20 | function sellPoolViaBancor(IERC20 _poolToken, uint256 _amount)
private
returns(
address[] memory connectorsAddress,
uint256[] memory connectorsAmount,
uint256 poolAmountSent
)
{
_poolToken.transferFrom(msg.sender, address(this), _amount);
address converterAddress = getBacorConverterA... | 8,151,637 |
// Written by Jesse Busman (jesse@jesbus.com) in january 2018 and june 2018 and december 2018 and january 2019 and february 2019
// This is the back end of https://etherprime.jesbus.com/
pragma solidity 0.5.4;
// ----------------------------------------------------------------------------
// ERC Token Standar... | Factorial primes are of the form n!+delta where delta = +1 or delta = -1 Prevent underflow on _number-1 Prevent overflow on _number+1 Detect factorial primes of the form n!-1 | function isFactorialPrime(uint256 _number) external view returns (Booly _result, uint256 _n, int256 _delta)
{
if (_number == 0) return (DEFINITELY_NOT, 0, 0);
if (_number == ~uint256(0)) return (DEFINITELY_NOT, 0, 0);
Booly primality = isPrime(_number);
... | 1,052,735 |
./full_match/97/0xa650d5fB7002a35d9370Efdad2a0888Ecc252E98/sources/contracts/Darbi/UPMintDarbi.sol | Permissioned function to unpause UPaddress Controller | function unpause() public onlyAdmin {
_unpause();
}
| 5,034,557 |
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------
// 'C4F' Coins4Favors contracts
//
// contracts for C4FEscrow and C4FToken Crowdsale
//
// (c) C4F Ltd Hongkong 2018
// ----------------------------------------------------------------------------
// ------------... | ------------------------------------------------------------------------ Transfer `tokens` from the `from` account to the `to` account not possivbe before end of ICO The calling account must already have sufficient tokens approve(...)-d for spending from the `from` account and - From account must have sufficient balanc... | function transferFrom(address from, address to, uint tokens) public notLocked notPaused returns (bool success) {
require(allowed[from][msg.sender] >= tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[from] = balances[from].sub(tokens);
balances[to] ... | 1,501,523 |
./partial_match/1/0x1E3A682f5f9BDD87b88D28dc2eC9EDE002bfE95e/sources/vnxManager.sol | A method to remove a bearer from a role _account The account to remove as a bearer. _role The role to remove the bearer from./ | function removeBearer(address _account, uint256 _role)
external
{
require(
_role < roles.length,
"Role doesn't exist."
);
require(
hasRole(msg.sender, roles[_role].admin),
"User can't remove bearers."
);
require(
hasRole(_account, _role),
"Account is not b... | 3,979,003 |
pragma solidity ^0.5.5;
//WLC VERSION 10
/// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
/// @author Dieter Shirley <dete@axiomzen.co> (https://github.com/dete)
interface ERC721 {
// Required methods
function totalSupply() external view returns (uint256 total);
... | Returns an URI for a given token ID Throws if the token ID does not exist. May return an empty string. _tokenId uint256 ID of the token to query/ | function tokenURI(uint256 _tokenId) public view returns (string memory) {
require(exists(_tokenId));
return tokenURIs[_tokenId];
}
event Buy(address indexed from, uint256 amount, uint256 fromTokenId, uint256 toTokenId, uint256 timestamp);
event Exchange(address indexed from, ui... | 13,086,803 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.