file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/5/0x38DB1BF0Fe525564B73fB0b157d969D496B7165d/sources/DividendToken.sol | Disables all transfer related functions/ | function _transfer(address sender, address recipient, uint256 amount) internal virtual override {
revert("ERC20NonTransferable: Transfer not supported");
}
| 1,937,465 |
pragma solidity 0.4.24;
contract Governable {
event Pause();
event Unpause();
address public governor;
bool public paused = false;
constructor() public {
governor = msg.sender;
}
function setGovernor(address _gov) public onlyGovernor {
governor = _gov;
}
modifi... | Adds two numbers, throws on overflow./ | function add(uint64 a, uint64 b) internal pure returns (uint64 c) {
c = a + b;
assert(c >= a);
return c;
}
| 11,760,456 |
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.4;
import {ISynthereumFinder} from './interfaces/IFinder.sol';
import {ISynthereumDeployer} from './interfaces/IDeployer.sol';
import {
ISynthereumFactoryVersioning
} from './interfaces/IFactoryVersioning.sol';
import {ISynthereumRegistry} from './regist... | Get factory versioning contract from the finder return factoryVersioning Factory versioning contract/ | function getFactoryVersioning()
internal
view
returns (ISynthereumFactoryVersioning factoryVersioning)
{
factoryVersioning = ISynthereumFactoryVersioning(
synthereumFinder.getImplementationAddress(
SynthereumInterfaces.FactoryVersioning
)
);
}
| 2,546,527 |
pragma solidity ^0.4.18;
// File: contracts-origin/AetherAccessControl.sol
/// @title A facet of AetherCore that manages special access privileges.
/// @dev See the AetherCore contract documentation to understand how the various contract facets are arranged.
contract AetherAccessControl {
// This facet controls a... | Checks if a given address currently has transferApproval for a particular Property. _claimant the address we are confirming property is approved for. _tokenId property id, only valid when > 0 | function _approvedFor(address _claimant, uint256 _tokenId) internal view returns (bool) {
return propertyIndexToApproved[_tokenId] == _claimant;
}
| 1,090,841 |
// SPDX-License-Identifier: MIT
// Copyright 2021 Primitive Finance
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// us... | Checks an option against the Primitive Registry. option The IOption token to check. return Whether or not the option was deployed from the Primitive Registry./ | function isFromPrimitiveRegistry(IOption option) internal view returns (bool) {
return (address(option) ==
_registry.getOptionAddress(
option.getUnderlyingTokenAddress(),
option.getStrikeTokenAddress(),
option.getBaseValue(),
option... | 11,694,976 |
contract MultiAccess {
address public multiAccessRecipient;
/**
* Confirmation event.
* event
* @param owner - The owner address.
* @param operation - The operation name.
* @param completed - If teh operation is completed or not.
*/
event Confirmation(address indexed owner, bytes32... | Change the requirement. external_function _newRequired - The new amount of required signatures./ | function multiAccessChangeRequirement(uint _newRequired) onlymanyowners(true) external {
if (_newRequired == 0 || _newRequired > multiAccessOwners.length-1) {
return;
}
multiAccessRequired = _newRequired;
_clearPending();
RequirementChanged(_newRequired);
}
| 2,491,706 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.12;
/**
__ __ __________ _____ _____.__ _________
/ \ / \ ____ ____\______ \_____ _/ ____\/ ____\ | ____ / _____/ ___________
\ \/\/ // __ \ / \| _/\__ \\ __\\ __\| | _/ __ \ \_____... | only owner can start the public mint | function startPublicMint() external whenNotPaused onlyOwner{
isPublicMintStarted=true;
}
| 14,836,947 |
./full_match/1/0xe5085eb63BA62eb7eDF609f63c2ce889CC122eA3/sources/browser/YieldTokenFactory.sol | withdraw lp tokens (meant to be `delegatecall`ed by `SushiYieldToken`) data encoded `pid` amount amount of lp tokens to receiver of lp tokens/ | function withdraw(bytes memory data, uint256 amount, address to) external {
(address _masterChef, uint256 pid) = abi.decode(data, (address, uint256));
(address lpToken,,,) = IMasterChef(_masterChef).poolInfo(pid);
IMasterChef(_masterChef).withdraw(pid, amount);
_transferBalance(lpTok... | 4,968,060 |
./full_match/1/0x700d6d24A55512c6AEC08820B49da4e4193105B3/sources/src/IncentivizedLocker.sol | Claims voting rewards from the Paladin Delegation address distributor Address of the contract distributing the rewards token Address of the reward token to claim index Index in the Merkle Tree account Address claiming the rewards amount Amount to claim merkleProof Merkle Proofs for the claim/ | function claimDelegationRewards(
address distributor,
address token,
uint256 index,
address account,
uint256 amount,
bytes32[] calldata merkleProof
) external nonReentrant onlyController {
IDelegationDistributor(distributor).claim(token, index, account, amount, merkleProof);
IERC20(... | 3,008,483 |
// SPDX-License-Identifier: BlueOak-1.0.0
pragma solidity 0.8.9;
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "contracts/plugins/assets/abstract/AaveOracleMixin.sol";
import "contracts/plugins/assets/abstract/Collateral.sol";
contract AavePricedFiatCollateral is AaveOracleMixin, ... | return {UoA/tok} Our best guess at the market price of 1 whole token in UoA | function price() public view virtual returns (uint192) {
return consultOracle(address(erc20));
}
| 5,503,082 |
./partial_match/1/0xd81b3000D6Cad7af85E9939AfAb1243B56618EA9/sources/VFIN.sol | Get controllers for a given partition. partition Name of the partition. return Array of controllers for partition./ | function controllersByPartition(bytes32 partition) external view returns (address[] memory) {
return _controllersByPartition[partition];
}
| 4,032,101 |
./partial_match/3/0xc64C4B475C4ee0b30A4E0D3F875A4541e6d480a1/sources/stakingContract.sol | get SWAP token address | function getSwapAddress() public constant returns (address _swapAddress) {
return address(tswap);
}
| 5,125,859 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view retu... | This is special code that says we want WETH out Simple Sushiswap route Convert to USDC | function exchange(uint256 _idIn, uint256 _idOut, uint256 _amount) internal {
CurvePool pool = CurvePool(tokenList[_idIn].curvePoolAddress);
tokenList[_idIn].token.safeApprove(address(pool), 0);
tokenList[_idIn].token.safeApprove(address(pool), _amount);
if(_idOut == tokenList.length)... | 6,170,887 |
/*
███████╗ ██████╗ ██╗ ██╗ ██████╗ █████╗ ███╗ ███╗███████╗
██╔════╝██╔═══██╗╚██╗██╔╝ ██╔════╝ ██╔══██╗████╗ ████║██╔════╝
█████╗ ██║ ██║ ╚███╔╝ ██║ ███╗███████║██╔████╔██║█████╗
██╔══╝ ██║ ██║ ██╔██╗ ██║ ██║██╔══██║██║╚██╔╝██║██╔══╝
██║ ╚██████╔╝██╔╝ ██╗ ╚██████╔╝██║ ██║██║ ╚═╝... | Upload trait art to blockchain! traitTypeId trait name id (0 corresponds to "fur") traitValueId trait value id (3 corresponds to "black") traits array of trait [name, png] (e.g,. [bandana, {bytes}])/ | function uploadTraits(uint8 traitTypeId, uint8[] calldata traitValueId, string[][2] calldata traits) external onlyOwner {
require(traitValueId.length == traits.length, "Mismatched inputs");
for (uint8 i = 0; i < traits.length; i++) {
traitData[traitTypeId][traitValueId[i]] = Trait(
traits[i][0],... | 1,272,976 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.7.6;
pragma abicoder v2;
import {IERC20Ext} from '@kyber.network/utils-sc/contracts/IERC20Ext.sol';
import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';
import {SafeCast} from '@openzeppelin/contracts/utils/SafeCast.sol';
import {SafeERC20} from '@o... | Allow a user to vest all ended schedules/ | function vestCompletedSchedules(IERC20Ext token) public override returns (uint256) {
VestingSchedules storage schedules = accountVestingSchedules[msg.sender][token];
uint256 schedulesLength = schedules.length;
uint256 totalVesting = 0;
for (uint256 i = 0; i < schedulesLength; i++) {
VestingSche... | 1,553,354 |
./full_match/100/0x3f7c5935e1ee6D4910A753b2B6229C8e0D53E57b/sources/contracts/utils/LiquidityTree.sol | add amount only for limited leaves in tree [first_leaf, leaf] amount value to add/ get last-updated top node push changes from last-updated node down to the leaf, if leaf is not up to date | function _addLimit(uint128 amount, uint48 leaf) internal {
(uint48 updatedNode, uint48 start, uint48 end) = _getUpdatedNode(
1,
treeNode[1].updateId,
LIQUIDITYNODES,
LIQUIDITYLASTNODE,
1,
LIQUIDITYNODES,
LIQUIDITYLASTNODE,
... | 14,285,351 |
./full_match/4/0x9ea6a8c44e839017C1C5a2977a29F1163636D458/sources/contracts/FundMe.sol | getRoundData and latestRoundData should both raise "No data present" if they do not have data to report, instead of returning unset values which could be misinterpreted as actual reported values. | interface AggregatorV3Interface {
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);
function getRoundData(uint80 _roundId)
external
view
returns (
uint80 roundId,
int256 ... | 793,910 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of... | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint2... | 11,960,099 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
import "./vlt.sol";
contract VLTICO {
address public owner;
ValuelessToken public vlt;
uint256 public minimumPurchase;
uint256 public pricePerToken;
constructor(uint256 _minimumPurchase, uint256 _pricePerToken, address tokenAddr)... | BuyToken tokenAmount in 'wei' | function buyToken() public payable minimumCheck {
require(msg.sender != owner, "Owner cannot buy");
uint tokenAmount = msg.value * 10 ** vlt.decimals() / pricePerToken;
require(vlt.balanceOf(owner) >= tokenAmount, "Out of stock");
vlt.transferFrom(owner, msg.sender... | 5,450,212 |
./partial_match/1/0xA41634a92Eb3b0E9b9974566d1Bb71191099fD45/sources/contracts/MintProxy.sol | Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}./ | function upgradeTo(address newImplementation) external onlyAdmin {
_upgradeToAndCall(newImplementation, bytes(""), false);
}
| 2,857,247 |
pragma solidity ^0.5.3;
import "./PermissionsUpgradable.sol";
/** @title Organization manager contract
* @notice This contract holds implementation logic for all org management
functionality. This can be called only by the implementation
contract only. there are few view functions exposed as public and
c... | confirms if the org exists in the network _orgId org id return true or false/ | function checkOrgExists(string memory _orgId) public view returns (bool) {
return (!(OrgIndex[keccak256(abi.encodePacked(_orgId))] == 0));
}
| 7,231,638 |
//! A Multi-signature, daily-limited account proxy/wallet library.
//!
//! Inheritable "property" contract that enables methods to be protected by
//! requiring the acquiescence of either a single, or, crucially, each of a
//! number of, designated owners.
//!
//! Usage: use modifiers onlyowner (just own owned) or only... | Gets an owner by 0-indexed position (using numOwners as the count) | function getOwner(uint ownerIndex) external constant returns (address) {
return address(m_owners[ownerIndex + 1]);
}
| 1,737,687 |
./partial_match/42/0xc0A7c706042031b8313cD1B3DE5bEc8EAef1C0Bd/sources/AnubisToken.sol | Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as... | function getPriorVotes(address account, uint256 blockNumber)
external
view
returns (uint256)
{
require(
blockNumber < block.number,
"ANUBIS::getPriorVotes: not yet determined"
);
uint32 nCheckpoints = numCheckpoints[account];
if (n... | 9,105,896 |
./full_match/1/0x46b13E7E8f1aEF156973AE3eD975E738cAFB08C8/sources/contracts/Pool.sol | Update maxLiquidable (liquidation cap)/ | function updateMaxLiquidable(uint256 newMaxLiquidable_) external override onlyGovernor {
require(newMaxLiquidable_ <= 1e18, "max-is-100%");
uint256 _currentMaxLiquidable = maxLiquidable;
require(newMaxLiquidable_ != _currentMaxLiquidable, "new-same-as-current");
emit MaxLiquidableUpd... | 3,134,078 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import {BaseUpgradableMarketplace} from "./BaseUpgradableMarketplace.sol";
import {IKODAV3} from "../core/IKODAV3.sol";
import {IKOAccessControlsLookup} from "../access/IKOAcc... | Allow an artist or admin to create a sale with 0 phases Check no existing sale in place | function createSale(uint256 _editionId) external override whenNotPaused {
address creator = koda.getCreatorOfEdition(_editionId);
require(
creator == _msgSender() || accessControls.hasContractOrAdminRole(_msgSender()),
"Caller not creator or admin"
);
require... | 1,084,192 |
/**
*Submitted for verification at Etherscan.io on 2021-11-01
*/
// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: MIT
pragma solidity >=0.6.2 <0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
... | get total accrued Comp token from all market in comptroller return comp amount accrued/ | function getTotalCompAccrued() public view onlyAdmins returns (uint256) {
return IComptrollerLensInterface(comptrollerAddress).compAccrued(address(this));
}
| 15,089,900 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Questions on this... | function setOperatingStatus (bool mode) external requireContractOwner {
require(mode != operational, "New mode must be different from existing mode");
require(airlines[msg.sender], "Caller must be registered as an Airline");
bool isDuplicate = false;
operational = mode;
}
| 15,836,761 |
./partial_match/1/0xC73Ace5e604a27b1BddD34E7fe23324A9F7BdC73/sources/DORKL.sol | require(_totalTaxIfBuying <= 5 , "Max buy fee under 5%"); | function setBuyTaxes(uint256 buyMarketingFeeNew, uint256 buyLpFeeNew) external onlyOwner(){
_buyMarketingFee = buyMarketingFeeNew;
_buyLpFee = buyLpFeeNew;
_totalTaxIfBuying = _buyMarketingFee.add(_buyLpFee);
}
| 4,270,409 |
/**
*Submitted for verification at Etherscan.io on 2021-09-19
*/
pragma solidity ^0.8.0;
// SPDX-License-Identifier: MIT
/**
* @dev ERC-721 non-fungible token standard.
* See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md.
*/
interface ERC721 {
/**
* @dev Emits when ownership of any NFT chang... | Optional metadata extension for ERC-721 non-fungible token standard./ | interface ERC721Metadata {
function name()
external
view
returns (string memory _name);
function symbol()
external
view
returns (string memory _symbol);
function tokenURI(uint256 _tokenId)
external
view
returns (string memory);
}
| 6,759,055 |
pragma solidity >=0.4.21 <0.6.0;
import "./common/SafeMath.sol";
import "./common/Ownable.sol";
import "./common/Destructible.sol";
import "./provableAPI_0.5.sol";
contract Access is usingProvable, Ownable, Destructible {
using SafeMath for uint256;
address public owner;
uint public balance;
event Lo... | emit Balance(address(this).balance, provable_getPrice("URL")); | function queryDB() public payable {
if (provable_getPrice("URL") > address(this).balance) {
emit LogNewProvableQuery("Provable query was NOT sent, please add some ETH to cover for the query fee");
emit LogNewProvableQuery("Provable query was sent, standing by for the answer..");
... | 12,833,647 |
/*
Bulleth - $Bulleth
https://t.me/bulletherc
www.bulleth.org
www.twitter.com/bullethnft
www.opensea.com/BULLETH
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
... | exclude from paying fees or having max transaction amount | constructor() ERC20("Bulleth", "BULLETH") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
isExcludedMaxTransactionAmount[address(_uniswapV2Router)] = true;
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IU... | 5,502,829 |
// Sources flattened with hardhat v2.3.0 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/IERC20.sol@v4.1.0
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of token... | Maker remove liquidity from pool to get ERC20 Token and ETH back (maker burn XToken) token The address of ERC20 Token to The target address receiving the Token liquidity The amount of liquidity (XToken) sent to pool, or the liquidity to remove payback As the charging fee may change, it is suggested that the caller ... | function burn(
address token,
address to,
uint liquidity,
address payback
) external payable override check returns (
uint amountETHOut,
uint amountTokenOut
) {
if(msg.value > 0) {
payable(payback).transfer(msg.value);
}
... | 7,018,566 |
/*
* This code has not been reviewed.
* Do not use or deploy this code before reviewing it personally first.
*/
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/utils/Reentranc... | [ERC777 INTERFACE (1/13)] Get the name of the token, e.g., "MyToken". return Name of the token./ | function name() external view returns(string) {
return _name;
}
| 13,131,713 |
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 c) {
// Gas optimization: t... | Mints new tokens. _owner Address to transfer new tokens to. _value Amount of tokens to be minted./ | function mintTokens(address _owner, uint256 _value) public onlyOwner {
require(_value > totalSupply.add(_value), "");
totalSupply = totalSupply.add(_value);
setBalances(_owner, _value);
}
| 6,483,494 |
pragma solidity ^0.4.15;//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNKOkOKWMMMMMM //
// MMMMWKkk0KNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNKOkOKWMMMMMM //
// MMMMXl.....,cdOXWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWXOo:,.....dNMMMM //
// MMMWd. .'cxKWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMW0d:'. ... | Allow the owner to set cost. | function setCost(uint256 _cost)
onlyOwner
public
returns (bool) {
cost = _cost;
EventLuckyNumberUpdated(cost, max, waitTime);
return true;
}
| 6,631,510 |
/**
*Submitted for verification at Etherscan.io on 2021-06-03
*/
// SPDX-License-Identifier: MIT
// Sources flattened with hardhat v2.0.5 https://hardhat.org
// File @openzeppelin/contracts-upgradeable/token/ERC20/[email protected]
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as def... | Update the account state to date Update the account state to date | function _updateReward(
address _iToken,
address _account,
bool _isBorrow
) internal {
require(_account != address(0), "Invalid account address!");
require(controller.hasiToken(_iToken), "Token has not been listed");
uint256 _iTokenIndex;
uint256 _account... | 2,030,359 |
pragma solidity ^0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed p... | Burns a specific amount of tokens. _value The amount of token to be burned./ | function burn(uint256 _value) public {
require(_value > 0);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(burner, _value);
}
| 971,858 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than r... | Transfer token for a specified address to The address to transfer to. value The amount to be transferred./ | function transfer(address to, uint256 value) public returns (bool) {
require(value <= balances[msg.sender]);
require(to != address(0));
balances[msg.sender] = balances[msg.sender].sub(value);
balances[to] = balances[to].add(value);
emit Transfer(msg.sender, to, value);
... | 502,286 |
pragma solidity ^0.6.0;
import "../utils/GasBurner.sol";
import "../interfaces/IAToken.sol";
import "../interfaces/ILendingPool.sol";
import "../interfaces/ILendingPoolAddressesProvider.sol";
import "../utils/SafeERC20.sol";
/// @title Basic compound interactions through the DSProxy
contract AaveBasicProxy is GasBur... | Fetches Aave collateral factors for tokens _tokens Arr. of tokens for which to get the coll. factors return collFactors Array of coll. factors | function getCollFactors(address[] memory _tokens) public view returns (uint256[] memory collFactors) {
address lendingPoolCoreAddress = ILendingPoolAddressesProvider(AAVE_LENDING_POOL_ADDRESSES).getLendingPoolCore();
collFactors = new uint256[](_tokens.length);
for (uint256 i = 0; i < _tokens.... | 381,409 |
// SPDX-License-Identifier: GPL-3.0
/*
This file is part of the Enzyme Protocol.
(c) Enzyme Council <[email protected]>
For the full license information, please view the LICENSE
file that was distributed with this source code.
*/
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/E... | Helper to process incoming asset balance changes. See __reconcileCoISpendAssets() for explanation on "increasedSpendAssets". Incoming assets = expected incoming assets + spend assets with increased balances Calculate and validate incoming asset amounts Even if the asset's previous balance was >0, it might not have been... | function __reconcileCoIIncomingAssets(
address _vaultProxy,
address[] memory _expectedIncomingAssets,
uint256[] memory _preCallIncomingAssetBalances,
uint256[] memory _minIncomingAssetAmounts,
address[] memory _increasedSpendAssets,
uint256[] memory _increasedSpendAss... | 1,697,467 |
pragma solidity 0.4.24;
/*|======================To-do list======================|*\
|*| |*|
|*| (-) Implement self-destruct function |*|
|*| (-) Add timers for various phases |*|
|*| (-) Add error trapping for issues such as ... | Withdraws all of users money deposited in contract If player, game must be done Adds shifts bet to pool - Might not need Sets possible loss accordingly - Might be incorrect Withdraws appropriate amount | function withdraw (uint256 _amount) public {
require (
!(msg.sender == house ||
msg.sender == playerNums[1] ||
msg.sender == playerNums[2] ||
msg.sender == playerNums[3] ||
msg.sender == playerNums[4]) ||
state == GameState.Finished ||
... | 13,072,452 |
./full_match/1/0x0A3771D2358820D67Eaa3Dd3c834fFC788c55A71/sources/project_/contracts/UnicornPresale.sol | pause the presale (only for MANAGER_ROLE, only if the presale is active)/ | function pause() external virtual onlyRole(MANAGER_ROLE) activePresale {
_paused = true;
emit PresaleFinished(msg.sender);
}
| 3,130,340 |
/***************************************************************************************************
* *
* (c) 2018, 2019 Quantstamp, Inc. This content and its use are governed by the license terms at *
* <https://raw.gi... | Removes the staker's stake poolIndex - the index of the pool where the funds are transferred to staker - the staker/ this loop is needed, because the computePayout function uses the stakes array | ) external onlyWhitelisted {
uint totalQspWeiTransfer = totalStakes[poolIndex][staker];
balanceQspWei = balanceQspWei.sub(totalQspWeiTransfer);
totalStakes[poolIndex][staker] = 0;
pools[poolIndex].totalStakeQspWei = pools[poolIndex].totalStakeQspWei.sub(totalQspWei... | 12,894,434 |
pragma solidity ^0.4.23;
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 c;
}
/**
* @dev Integer division of two ... | withdraw tokens, send tokens to target _token the token address that will be withdraw _params the limitation parameters for withdraw _time the timstamp of the withdraw time _to is where the tokens will be sent to _value is the number of the token _fee is the amount of the transferring costs _to... | function withdrawToken(address _token, address _params, uint256 _time, address _to, uint256 _value, uint256 _fee, address _tokenReturn) public onlyOwner returns (bool) {
require(_to != address(0));
require(_token != address(0));
require(_value > _fee);
DRCWalletMgrParams params = DR... | 9,845,223 |
// SPDX-License-Identifier: Unlicense
pragma solidity 0.6.12;
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./ForesightTokens.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
im... | Deploys Vision vault, Foresight tokens, and RealityMarket. _bondingCurveAddress Address of the bonding curve functions. | function initialize(address _visionAddress, address _bondingCurveAddress) public onlyOwner {
require(!initialized, "Contract can only be initialized once.");
initialized = true;
foresightTokens = new ForesightTokens();
bondingCurve = IBancorBondingCurve(_bondingCurveAddress);
... | 1,055,582 |
./full_match/42/0x17e8f719BaE3081B289C225e05a19d252425BC58/sources/AerariumSanctiusV1.sol | - This function allows the owner to add tokens to this contract that can be distributed at the end of the farming program _token - The address of the ERC20 token that will be deposited in the contract _amount - The amount of ERC20 tokens that will be transferred from the owner to this contract/ | function addTokens(IERC20 _token, uint256 _amount) external onlyOwner {
require(
block.number <= endBlock,
'The end time of the program is reached!'
);
_token.safeTransferFrom(msg.sender, address(this), _amount);
(bool check, uint256 index) = checkTokenAvailability(_token);
if (check =... | 9,576,254 |
//https://solidity.readthedocs.io/en/v0.5.11/index.html
///@dev: this version requires conversion of string to string memory
pragma solidity ^0.5.11;
///@dev: The ABI v2 encoder allows structs, nested and dynamic variables to be passed/returned into/from functions/events
///@dev: do not use ABIEncoderV2 on live/relea... | Internal Helper function | function existsEPC(address ownerAddress_, uint96 EPC_) internal view returns (bool ret){
if(ownerProducts[ownerAddress_].myOwnedEPCS[getEPCPointer(ownerAddress_,EPC_)] == EPC_) return true;
else return false;
}
| 7,237,312 |
pragma solidity >=0.5.0 <0.7.0;
import "./Account.sol";
import "./ERC725.sol";
import "../cryptography/ECDSA.sol";
import "../common/Controlled.sol";
/**
* @author Ricardo Guilherme Schmidt (Status Research & Development GmbH)
* @notice Defines an account which can be setup by a owner address (multisig contract), r... | Add public data to account. Can only be called by management. ERC725 interface. _key identifier _value data/ | function setData(bytes32 _key, bytes calldata _value)
external
onlyController
{
store[_key] = _value;
emit DataChanged(_key, _value);
}
| 12,908,186 |
./full_match/1/0xA8121B153c77cA4dd1da3a9D7cDC4729129c8c6D/sources/NFT.sol | Core ERC721 creator interface/ | interface IERC721CreatorCore is ICreatorCore {
function mintBase(address to) external returns (uint256);
function mintBase(address to, string calldata uri) external returns (uint256);
function mintBaseBatch(address to, uint16 count) external returns (uint256[] memory);
function mintBaseBatch(address... | 3,000,326 |
./partial_match/4/0x4e7d503cbcD94519F62730061F4Cd5F7bC23813e/sources/Controller.sol | Transfer PIE to the user, if they are above the threshold Note: If there is not enough PIE, we do not perform the transfer all. user The address of the user to transfer PIE to userAccrued The amount of PIE to (possibly) transfer return The amount of PIE which was NOT transferred to the user/ | function transferPie(address user, uint userAccrued, uint threshold) internal returns (uint) {
if (userAccrued >= threshold && userAccrued > 0) {
Pie pie = Pie(getPieAddress());
uint pieRemaining = pie.balanceOf(address(this));
if (userAccrued <= pieRemaining) {
... | 8,620,168 |
//Address: 0x6aedbf8dff31437220df351950ba2a3362168d1b
//Contract name: DGS
//Balance: 0 Ether
//Verification Date: 2/16/2018
//Transacion Count: 4291
// CODE STARTS HERE
pragma solidity ^0.4.13;
contract ERC20Interface {
// Get total token supply
function totalSupply()
public constant returns (uint256 ... | Get available for mining supply | function getMineableSupply()
public constant returns (uint256 _mineableSupply){
_mineableSupply = mineableSupply;
}
| 15,859,136 |
/**
*Submitted for verification at Etherscan.io on 2020-08-11
*/
pragma solidity ^0.4.24;
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);
... | ------------------------------------------------------------------------ Decrease the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) _spe... | function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
require(_spender != address(0));
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
allowed[msg.sender][_spend... | 1,603,728 |
./partial_match/1/0x6D4A206Eae1C9F8af819a5a8227266155ADDA63D/sources/LPMining.sol | 从合约发送奖励代币 如果合约账户代币不足,则直接 return | function safeTokenTransfer(address _to, uint256 _amount) internal {
uint256 stsTokenBal = stsToken.balanceOf(address(this));
if (_amount == 0 || stsTokenBal == 0) {
return;
}
if (_amount > stsTokenBal) {
stsToken.transfer(_to, stsTokenBal);
stsToke... | 2,651,682 |
pragma solidity ^0.5.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high l... | Returns unsold tokens to owner - mainly for development and testing _from : crowdsale address/ owner can not move tokens from participants | function crownfundTokenBalanceToOwner(address payable _from) public onlyOwner returns (bool success) {
CrowdSale c = CrowdSale(_from);
address crowdsaleOwner = c.getOwner();
if (crowdsaleOwner == owner ) {
uint256 _value = balanceOf[_from];
balanceOf[_from] = 0;
balanceOf[o... | 12,709,955 |
./full_match/3/0xC3aB449CADc4a2c57319504f7e058D36E7FBc093/sources/uuuuu.sol | remove time restriction flag if ended (saves gas in transfer checks and makes more trustless) | function updateGovernance(address _governance, bool _whiteListRestricted) external onlyGovernance {
governance = _governance;
whiteListRestricted = _whiteListRestricted;
if (block.timestamp >= timeRestrictionEnds) {timeRestricted = false;}
}
| 14,144,403 |
./partial_match/1/0x11b2164DDf1C3c0a420cEaD050d422B26530d11C/sources/contracts/facets/FakeERC173/FakeERC173FacetAccessControl.sol | @inheritdoc IFakeERC173Facet | function owner() view external returns(address) {
return FakeERC173Storage.layout().owner;
}
| 9,188,900 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import './SwapERC20.sol';
import '../libraries/Math.sol';
import '../libraries/UQ112x112.sol';
import '../interfaces/IERC20.sol';
import '../interfaces/ISwapFactory.sol';
import '../interfaces/ISwapCallee.sol';
interface IMigrator {
// Return the desired amo... | this low-level function should be called from a contract which performs important safety checks | function mint(address to) external lock returns (uint liquidity) {
uint balance0 = IERC20(token0).balanceOf(address(this));
uint balance1 = IERC20(token1).balanceOf(address(this));
uint amount0 = balance0.sub(_reserve0);
uint amount1 = balance1.sub(_reserve1);
bool feeOn = _... | 11,749,560 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.12;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/interfaces/IERC165.sol";
import "@openzeppelin/contracts/interfaces/IERC721.sol";
import "./interfaces/IMintableERC721.sol";
/**
* @title Mintable Sale
*
* @notice Mintable ... | Number of tokens available on sale Takes into account if sale is active or not, doesn't throw, returns zero if sale is inactive return number of tokens available on sale/ delegate to itemsOnSale() if sale is active, return zero otherwise | function itemsAvailable() public view returns(uint256) {
return isActive()? itemsOnSale(): 0;
}
| 191,359 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.9;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "./interfaces/IBuffe... | Safe dish transfer function, just in case if rounding error causes pool to not have enough DISHs. | function transferDishAtMost(address to, uint256 amount) internal {
portion.transferDishAtMost(to, amount);
}
| 2,520,885 |
pragma solidity ^0.5.0;
import "./IERC20.sol";
import "./IERC1155.sol";
import "./IERC1155TokenReceiver.sol";
import "./IConditionalTokens.sol";
contract DeFiProjGnosis is IERC1155TokenReceiver {
// Vatiables
IERC20 dai;
IConditionalTokens conditionalTokens;
address public oracle;
mapping(byt... | Functions setting up 3 outcome slots | function createBet(bytes32 questionId, uint256 amount) external {
conditionalTokens.prepareCondition(
oracle,
questionId,
3
);
bytes32 conditionId = conditionalTokens.getConditionId(
oracle,
questionId,
3
);... | 1,806,536 |
./partial_match/42/0xe1A624523C6e5C7F5575E9ace8B6D57b0Be342Fb/sources/FixedSwap.sol | Retrieve Minumum Amount / | function redeemGivenMinimumGoalNotAchieved(uint256 purchase_id) external isSaleFinalized isNotAtomicSwap {
require(hasMinimumRaise(), "Minimum raise has to exist");
require((purchases[purchase_id].amount != 0) && !purchases[purchase_id].wasFinalized, "Purchase is either 0 or finalized");
req... | 8,982,344 |
pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint2... | remove an address from the whitelist beneficiary address return true if the address was removed from the whitelist, false if the address wasn&39;t already in the whitelist/ | function removeAddressFromWhitelist(address beneficiary) public onlyCapper returns (bool) {
require(beneficiary != address(0));
_caps[beneficiary] = 0;
return isWhitelisted(beneficiary);
}
| 6,710,113 |
./partial_match/80001/0xd228399010C9F9f04eDE070FE154B607844F541a/sources/project_/contracts/MentaportStamps.sol | MINTER_ROLE of contract mints 1 token for address `_receiver`, with `_tokenURI` - Emits a {MintForAddress} event./ | function mintForAddress(string memory _tokenURI, address _receiver)
virtual
external
nonReentrant
mintCompliance(_receiver)
onlyMinter {
_mintNFT(msg.sender, _tokenURI);
emit MintForAddress(msg.sender, 1, _receiver);
}
| 8,802,699 |
pragma solidity 0.6.12;
//----------------------------------------------------------------------------------
// I n s t a n t
//
// .:mmm. .:mmm:. .ii. .:SSSSSSSSSSSSS. .oOOOOOOOOOOOo.
// .mMM'':Mm. .:MM'':Mm:. .II: :SSs.......... .oOO'''''''''''OOo.
// .:Mm' ':Mm.... | 0xa9059cbb = bytes4(keccak256("transfer(address,uint256)")) | function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(0xa9059cbb, to, value));
}
| 42,688 |
pragma solidity ^0.4.24;
/** @title PEpsilon
* @author Daniel Babbev
*
* This contract implements a p + epsilon attack against the Kleros court.
* The attack is described by VitaliK Buterin here: https://blog.ethereum.org/2015/01/28/p-epsilon-attack/
*/
contract PEpsilon {
Pinakion public pinakion... | Contribute to the reward of a random number. _block Block the random number is linked to./ Request a random number. _block Block linked to the request./ | function requestRN(uint _block) public payable {
contribute(_block);
}
| 1,073,692 |
// SPDX-License-Identifier: MIT
pragma solidity = 0.7.6;
pragma abicoder v2;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mu... | require payedPrice >= salePrice pay the seller | function buy(uint256 indexId) external payable {
AuctionItem memory item = itemsForSale[indexId];
address buyer = msg.sender;
uint payedPrice = msg.value;
require(_exists(item.tokenId));
require(getApproved(item.tokenId) == address(this));
require(forSale[item.tokenId] == true, "Not f... | 14,551,321 |
./partial_match/1/0x25C7C475934f40908523a36d5d7ea810D890b50F/sources/contracts/universal/MultiSigWallet.sol | @inheritdoc IMultiSigWallet/ find & delete item | function removeOwner(address _owner) external onlyGovernor ownerExists(_owner) {
isOwner[_owner] = false;
for (uint256 i = 0; i < owners.length - 1; ) {
if (owners[i] == _owner) {
owners[i] = owners[owners.length - 1];
owners.pop();
break;
... | 16,186,998 |
./full_match/421613/0x1DC91d1dF5c8Aa915256D1d9eA09e54ace41f387/sources/project_/contracts/mercenaries/StatManager.sol | Restore characters health with an item tokenID Characters ID itemSet item Set itemID item ID total number of items to use Return the Item Modifiers values Increase the health (5 = health item) Burn the health item(s) | function restoreHealth(uint256 tokenID, uint256 itemSet, uint256 itemID, uint256 total)
external
nonReentrant
onlyOwnerOfToken(tokenID)
onlyInactive(tokenID)
{
require(itemsContract.balanceOf(msg.sender, itemID) >= total, "You don't have that item in your wallet");
... | 11,584,982 |
// 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... | Allows a user to claim any rewards to an EOA pools The pools to claim rewards for/ | function getReward(IERC20[] calldata pools) external nonReentrant {
_getReward(pools, msg.sender, false);
}
| 11,883,774 |
./full_match/1/0xC5190E7FEC4d97a3a3b1aB42dfedac608e2d0793/sources/contracts/FXISportsToken.sol | This function allows the contract owner to update the fee rates for buy operations _marketingBuyFeeRate New marketing fee rate for buy operations _liquidityBuyFeeRate New liquidity fee rate for buy operations/ | function updateBuyFeeRate(
uint16 _marketingBuyFeeRate,
uint16 _liquidityBuyFeeRate
) external override onlyOwner {
require(
_marketingBuyFeeRate + _liquidityBuyFeeRate <= MAX_FEE,
"Max Rate exceeded, please lower value"
);
buyfeeRate.marketingFeeR... | 8,473,095 |
pragma solidity ^0.5.10;
/** @title ValidateSPV*/
/** @author Summa (https://summa.one) */
import {BytesLib} from "./BytesLib.sol";
import {SafeMath} from "./SafeMath.sol";
import {BTCUtils} from "./BTCUtils.sol";
library ValidateSPV {
using BTCUtils for bytes;
using BTCUtils for uint256;
using BytesLib ... | Parses a block header struct from a bytestring Block headers are always 80 bytes, see Bitcoin docs return Header digest, version, previous block header hash, merkle root, timestamp, target, nonce If header has an invalid length, bubble up error | function parseHeader(bytes memory _header)
internal
pure
returns (
bytes32 _digest,
uint32 _version,
bytes32 _prevHash,
bytes32 _merkleRoot,
uint32 _timestamp,
uint256 _target,
uint32 _nonce
)
{
... | 12,914,200 |
./full_match/1/0xa45020CE66ACED18380b2C6911ABB378554535c7/sources/browser/KoalaMaster.sol | Withdraw LP tokens from KoalaMaster. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accKoalaPerSha... | 4,923,385 |
// File: @openzeppelin\contracts\token\ERC20\IERC20.sol
pragma solidity ^0.5.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
... | Throws if msg.sender is not the beneficiary./ | modifier onlyBeneficiary() {
require(msg.sender == beneficiary, 'only the beneficiary can perform this function');
_;
}
| 12,175,455 |
./partial_match/1/0xD09F64dbbCAa076Fde30Ddd2e23194f5F786665E/sources/contracts/erc721/ERC721MinimizedBase.sol | Sets default royalty if royalty manager allows it _royalty New default royalty/ | function setDefaultRoyalty(
IRoyaltyManager.Royalty calldata _royalty
) external nonReentrant royaltyValid(_royalty.royaltyPercentageBPS) {
address msgSender = _msgSender();
address _royaltyManager = royaltyManager;
if (_royaltyManager == address(0)) {
if (msgSender ... | 9,391,625 |
./full_match/1/0x6f9140097Ab6278B41Cf9597a597030207b8D75d/sources/lib/seaport-core/src/lib/ConsiderationDecoder.sol | Takes a calldata pointer to an Order struct and copies the decoded struct to memory. cdPtr A calldata pointer for the Order struct. return mPtr A memory pointer to the Order struct head./ Allocate required memory for the Order head (OrderParameters and signature are allocated independently). Resolve OrderParamete... | function _decodeOrder(CalldataPointer cdPtr) internal pure returns (MemoryPointer mPtr) {
mPtr = malloc(Order_head_size);
mPtr.write(_decodeOrderParameters(cdPtr.pptr()));
mPtr.offset(Order_signature_offset).write(_decodeBytes(cdPtr.pptr(Order_signature_offset)));
}
| 9,676,111 |
./full_match/288/0xD64c3186A9C6ae6c1E92A110F76ab86F4C6295F9/sources/contracts/Ola/Core/LendingNetwork/versions/0.04/ComptrollerV0_04.sol | Sets the 'limit borrowing' flag to the given value (if they are different) Admin function to set value for 'limitBorrowing' return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ Check caller is admin | function _setLimitBorrowing(bool flagValue) external returns (uint) {
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_LIMIT_BORROWING_OWNER_CHECK);
}
if (limitBorrowing != flagValue) {
limitBorrowing = flagValue;
emit LimitBorro... | 7,106,067 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
library SafeMath {
function ADD718(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING... | inject NONSTANDARD NAMING | function EARNCALC843(uint LPTime) public view returns(uint){ | 15,883,871 |
./partial_match/1/0x99373AE646ed89b9A466c4256b09b10dbCC07B40/sources/contracts/concentrator/AladdinConvexVault.sol | Add new Convex pool. _convexPid - The Convex pool id. _rewardTokens - The list of addresses of reward tokens. _withdrawFeePercentage - The withdraw fee percentage of the pool. _platformFeePercentage - The platform fee percentage of the pool. _harvestBountyPercentage - The harvest bounty percentage of the pool. | function addPool(
uint256 _convexPid,
address[] memory _rewardTokens,
uint256 _withdrawFeePercentage,
uint256 _platformFeePercentage,
uint256 _harvestBountyPercentage
) external onlyOwner {
for (uint256 i = 0; i < poolInfo.length; i++) {
require(poolInfo[i].convexPoolId != _convexPid, ... | 9,294,079 |
/*
* SPDX-License-Identitifer: GPL-3.0-or-later
*
* This file requires contract dependencies which are licensed as
* GPL-3.0-or-later, forcing it to also be licensed as such.
*
* This is the only file in your project that requires this license and
* you are free to choose a different license for the rest of t... | Clean up permissions | function newInstance() public {
Kernel dao = fac.newDAO(this);
ACL acl = ACL(dao.acl());
acl.createPermission(this, dao, dao.APP_MANAGER_ROLE(), this);
address root = msg.sender;
(MiniMeToken token, TokenManager tokenManager) = _setupTokenManager(dao, acl, root);
(V... | 6,440,471 |
pragma solidity ^0.4.11;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
address public ethAddress;
/**
* @dev... | Marks an address as being approved for transferFrom(), overwriting any previous approval. Setting _approved to address(0) clears all transfer approval. NOTE: _approve() does NOT send the Approval event. This is intentional because _approve() and transferFrom() are used together for putting Kitties on auction, and t... | function _approve(address _tokenAddress, address _approved, uint256 _tokenQuantity) internal {
StandardToken tokenContract = StandardToken(_tokenAddress);
tokenContract.approve(_approved, _tokenQuantity);
}
| 5,493,974 |
./full_match/4/0xF758321A83c7d38B2fE2Ba436C89D65C32b4d51e/sources/VotingMstable.sol | Calculates total supply of votingWeight at a given time _t _point Most recent point before time _t _t Time at which to calculate supply return totalSupply at given point in time/ Floor the timestamp to weekly interval Iterate through all weeks between _point & _t to account for slope changes If week end is after time... | function _supplyAt(Point memory _point, uint256 _t)
internal
view
returns (uint256)
{
Point memory lastPoint = _point;
uint256 iterativeTime = _floorToWeek(lastPoint.ts);
for (uint256 i = 0; i < 255; i++) {
iterativeTime = iterativeTime + WEEK;
int128 dSlope = 0;
if (iterat... | 12,304,968 |
/*
_____ _ _ _
| __ \ (_) | | |
| | | |_ ___| |_| |_ ___ _ __
| | | \ \ /\ / / | __| __/ _ \ '__|
| |__| |\ V V /| | |_| || __/ |
|_____/ \_/\_/ |_|\__|\__\___|_|
*/
// SPDX-License-Identifier: GPL-3.0
pr... | Get list of dweets done by a user _commentid Id of comments _comment New content of comment | function editComment(uint _commentid, string memory _comment) public stopInEmergency onlyAllowedUser(msg.sender) onlyActiveComment(_commentid) onlyCommentAuthor(_commentid){
comments[_commentid].content=_comment;
}
| 7,226,646 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "./interfaces/IPWPegger.sol";
import "./interfaces/ICalibratorProxy.sol";
import "./interfaces/IEACAggregatorProxy.sol";
import "./interfaces/IERC20.sol";
import "./interfaces/IUniswapV2Pair.sol";
import "./libraries/PWLibrary.sol";
import "./librari... | _currPrice and _pwPrice must be same decimals | function _checkThConditionsOrRaiseException(uint _currPrice, uint _pwPrice) view internal {
uint n = 10**pwconfig.decimals;
uint priceDiff = _currPrice > _pwPrice ? n*(_currPrice - _pwPrice)/_currPrice : n*(_pwPrice - _currPrice)/_currPrice;
require(priceDiff < pwconfig.emergencyth,
... | 12,902,988 |
pragma solidity ^0.4.23;
// File: node_modules/zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
... | Checks if target address is a contract. _address The address to check./ Retrieve the size of the code on target address | function isContract(address _address) internal returns (bool) {
uint256 codeLength;
assembly {
codeLength := extcodesize(_address)
}
return codeLength > 0;
}
| 12,824,632 |
./full_match/8453/0x25f8fA4917180FF308883e37Ea27CEaEB68c1f19/sources/contracts/bridge/router/LocalBridgeConfig.sol | Updates the fee structure for an already added bridge token. Will revert if token was not added before. token "End" token, supported by SynapseBridge. This is the token user is receiving/sending. bridgeFee Fee % for bridging a token to this chain, multiplied by `FEE_DENOMINATOR` minFee Minimum fe... | function setTokenFee(
address token,
uint256 bridgeFee,
uint256 minFee,
uint256 maxFee
) external onlyOwner {
require(config[token].bridgeToken != address(0), "Unknown token");
_setTokenFee(token, bridgeFee, minFee, maxFee);
}
| 11,554,530 |
pragma solidity ^0.4.24;
// File: node_modules/openzeppelin-solidity/contracts/introspection/IERC165.sol
/**
* @title IERC165
* @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
*/
interface IERC165 {
/**
* @notice Query if a contract implements an interface
* @param interfaceId The interf... | Internal function to add a token ID to the list of a given address to address representing the new owner of the given token ID tokenId uint256 ID of the token to be added to the tokens list of the given address/ | function _addTokenTo(address to, uint256 tokenId) internal {
require(_tokenOwner[tokenId] == address(0));
_tokenOwner[tokenId] = to;
_ownedTokensCount[to] = _ownedTokensCount[to].add(1);
}
| 538,531 |
pragma solidity ^0.4.17;
contract PetAdoption {
// define variable: address type array of length 16
// public variable have automatic getter methods
address[16] public adopters;
// adopting a pet
function adopt(uint petId) public returns (uint) {
require(petId >= 0 && petId <= 15);
... | Retrieving the adopters | function getAdopters() public view returns (address[16]) {
return adopters;
}
| 12,802,293 |
./full_match/5/0xcc7478017d1BEF1c19B141A1D48E565d87ce9aaf/sources/contracts/CreateraGenesisLand.sol | For marketing etc. | function reserveMint(uint256 quantity) external onlyOwner {
require(
mintedDevSupply + quantity <= RESERVE_MAX_SUPPLY,
"too many already minted before reserve mint"
);
mintedDevSupply += quantity;
_safeMint(msg.sender, quantity);
}
| 11,628,204 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import "./utils/Context.sol";
import "./interfaces/IERC721.sol";
import "./interfaces/IERC721Metadata.sol";
import "./interfaces/IERC721Enumerable.sol";
import "./interfaces/IERC721Receiver.sol";
import "./utils/ERC165.sol";
import "./utils/SafeMath.sol";
import... | 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 {
require(to != address(0), "Anoncats: mint to the zero address");
require(!_exists(tokenId), "Anoncats: token already minted");
_beforeTokenTransfer();
_holderTokens[to].add(tokenId);
_tokenOwners.set(tokenId, to);
... | 10,180,138 |
./partial_match/1/0x86Aa49bf28d03B1A4aBEb83872cFC13c89eB4beD/sources/Strategy.sol | Add your own name here, suggestion e.g. "StrategyCreamYFI" | function name() external override view returns (string memory) {
return string(abi.encodePacked("StrategyAH2Earn", crToken.symbol()));
}
| 3,643,562 |
./partial_match/1/0x13bC172D8008629d71fd54369f796b4a51d57d9F/sources/PickleStrategy3PoolMainnet.sol | Withdraws the yCRV tokens to the pool in the specified amount./ | function withdrawToVault(uint256 amountUnderlying) external restricted {
uint256 balanceBefore = IERC20(underlying).balanceOf(address(this));
if(amountUnderlying <= balanceBefore) {
IERC20(underlying).safeTransfer(vault, amountUnderlying);
return;
}
withdrawFromPickle(amountUnderlying);
... | 2,714,022 |
pragma solidity ^0.4.25;
contract DAPP {
// User struct
struct User {
uint id; //user ID
uint bal; //users's balance, not important
string name; //username
uint[] neighbours; //neighbours in PCN
mapping (uint => uint) account; //balances in accounts
}
//State... | to send amount throught the PCNBFS algorithmwhile the queue is not empty, visit the next node in Queuepath foundpath not foundfinally transfer the amount through the path found | function sendAmount(uint from , uint to) public {
uint id = 0;
for(id = 0; id < userIds.length; ++id){
visited[userIds[id]] = false;
}
visited[from] = true;
Q[data[2]++] = from;
P[data[2]-1] = -1;
while(data[1] < data[2]) {
if(explore... | 5,493,468 |
pragma solidity ^0.5.16;
interface IERC20 {
function TOTALSUPPLY53() external view returns (uint256); //inject NONSTANDARD NAMING
function BALANCEOF768(address account) external view returns (uint256); //inject NONSTANDARD NAMING
function T... | inject NONSTANDARD NAMING | function SAFEAPPROVE667(IERC20 token, address spender, uint256 value) internal { | 1,054,373 |
/**
*Submitted for verification at Etherscan.io on 2022-03-01
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
// ▄████████ ▄████████ ▄████████ ▄█ ▄████████ ▄████████ ▄████████ ▄████████ ▄████████ ▄████████
// ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ... | Mints batch of n number of NFTs/ | function mintBatchOfGenesisNFT(uint256 numToMint) external onlyOwner {
for (uint i=0; i < numToMint; i++) {
mintSingleGenesisNFT(genesisMetadata);
}
}
| 10,902,605 |
pragma solidity 0.5.10;
contract Context {
constructor () internal { }
function _MSGSENDER793() internal view returns (address payable) { //inject NONSTANDARD NAMING
return msg.sender;
}
function _MSGDATA330() ... | inject NONSTANDARD NAMING | function EXTRACTSCRIPTSIGLEN905(bytes memory _input) internal pure returns (uint8, uint256) { | 1,784,066 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.8.0;
pragma experimental ABIEncoderV2;
// ====================================================================
// | ______ _______ |
// | / _____________ __ __ / ____(_____ ____ _____ ________ |... | Add additional LPs to an existing locked stake Make sure to do the 2 token approvals to the NFT Position Manager first on the UI NOTE: If use_balof_override is true, make sure your calling transaction is atomic with the token transfers in to prevent front running! Get the stake and its index Handle the tokens Get the t... | function lockAdditional(
uint256 token_id,
uint256 token0_amt,
uint256 token1_amt,
uint256 token0_min_in,
uint256 token1_min_in,
) updateRewardAndBalance(msg.sender, true) public {
(LockedNFT memory thisNFT, uint256 theArrayIndex) = _getStake(msg.sender, token_... | 5,456,940 |
/**
*Submitted for verification at Etherscan.io on 2021-04-03
*/
// SPDX-License-Identifier: BUSL-1.1
// File: @uniswap/lib/contracts/libraries/TransferHelper.sol
pragma solidity >=0.6.0;
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferH... | given an output amount of an asset and pool reserves, returns a required input amount of the other asset amountIn = floor(amountIN PRECISION / (PRECISION - feeInPrecision)); | function getAmountIn(
uint256 amountOut,
uint256 reserveIn,
uint256 reserveOut,
uint256 vReserveIn,
uint256 vReserveOut,
uint256 feeInPrecision
) internal pure returns (uint256 amountIn) {
require(amountOut > 0, "DMMLibrary: INSUFFICIENT_OUTPUT_AMOUNT");
... | 2,097,383 |
./partial_match/1/0x67391801E7564994bdAa80544Ff916A7bCBFCB60/sources/MacroverseUniversalRegistry.sol | Set whether homesteading is allowed under a token. The token must be owned by you, and must not be land./ Find the token's config The value is actually changing Set the homesteading flag Make an event so clients can find homesteading areas | function setHomesteading(uint256 token, bool value) external {
require(backend.ownerOf(token) == msg.sender, "Token owner mismatch");
require(!token.tokenIsLand());
TokenConfig storage config = tokenConfigs[token];
if (config.homesteading != value) {
config.hom... | 9,237,107 |
// SPDX-License-Identifier: Apache-2.0
/*
* Copyright 2020, Offchain Labs, Inc.
*
* 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
*
*... | TODO: Now we use RLP encoding in `ecall`, it'd be better using `abi.encode` to save gas | function _call_eigen_call(
bytes memory arg1,
bytes memory arg2,
bytes memory arg3,
bytes memory arg4
) private pure returns (bytes memory) {
bytes[] memory list;
list = new bytes[](4);
list[0] = RLPEncode.encodeBytes(arg1);
list[1] = RLPEncode.e... | 12,601,097 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Context.sol
pragma solidity >=0.6.0 <0.8.0;
/*
* @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 sho... | generates random traits for a Dog id ID of the dog to generate charitable whether or not the owner made a donation nonce create entropy in case of duplicates/ generate entropy using block values, sender, serial number, and nonce | function generateDog(uint256 id, bool charitable, uint256 nonce) internal view returns (Dog memory) {
bytes32 hash = generator.generate(_msgSender(), id, nonce);
Dog memory dog;
dog.id = uint16(id);
dog.level = 1;
dog.breed = uint8(hash[31]) % 5;
dog.backgrou... | 11,788,489 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.