file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma solidity ^0.4.23;
import "./TimeLockedController.sol";
/*
This contract is the owner of TimeLockController.
This contract is responsible for calling all onlyOwner functions in
TimeLockController.
This contract has a copy of all functions in TimeLockController.
Functions with name starting with 'ms' are not in ... | Veto the current in flight action. Reverts if no current action/ | function veto() public onlyOwner returns (bool success) {
require(!voted[msg.sender], "already voted");
require(ownerAction.callData.length > 0, "no action in flight");
if (ownerAction.disappoveSigs >= 1) {
emit ActionVetoed(ownerAction.actionName);
_deleteOwnerActon(... | 12,684,552 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol... | / Directly pay developers their corresponding share of tokens and points. | function updatePool(IERC20 _token) internal {
PoolInfo storage pool = poolInfo[_token];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 poolTokenSupply = pool.token.balanceOf(address(this));
if (address(_token) == address(token)) {
poolTokenSupply = totalTokenDeposited;
... | 290,828 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.7.6;
import "@openzeppelin/contracts/access/Ownable.sol";
import "../interfaces/ICrewGenerator.sol";
/**
* @dev Contract which generates crew features based on the set they're part of
*/
contract CrewFeatures is Ownable {
// Mapping of collectionIds to co... | Defines a collection and points to the relevant contract _collId Id for the collection _generator Address of the contract adhering to the appropriate interface/ | function setGenerator(uint _collId, ICrewGenerator _generator) external onlyOwner {
_generators[_collId] = _generator;
emit CollectionCreated(_collId);
}
| 1,196,149 |
./full_match/1/0x8a1e51DFe708545D6ad080a0eBBDd18A1b6F860C/sources/contracts/Sinra.sol | Returns the Uniform Resource Identifier (URI) for `_tokenId` token./ | function tokenURI(
uint256 _tokenId
) public view virtual override(IERC721A, ERC721A) returns (string memory) {
if (!_exists(_tokenId)) revert URIQueryForNonexistentToken();
string memory _baseUri = _baseURI();
return bytes(_baseUri).length != 0
? string(abi.encode... | 2,979,640 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
import "../interfaces/AggregatorValidatorInterface.sol";
import "../interfaces/TypeAndVersionInterface.sol";
import "../interfaces/AccessControllerInterface.sol";
import "../SimpleWriteAccessController.sol";
/* dev dependencies - to be re/moved after audit */
im... | return stored GasConfiguration | function gasConfig()
external
view
virtual
returns (GasConfiguration memory)
{
return s_gasConfig;
}
| 6,451,168 |
//SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.6.0 <0.9.0;
contract Auction{
address payable public owner;
uint256 public startDate;
uint256 public endDate;
string public ipfsHashes;
string public auctionTitle;
string public auctionDescription;
enum State {Started, Running, E... | only the owner can cancel the Auction | function cancelAuction() public onlyOwner {
auctionState = State.Canceled;
emit AuctionUpdated(address(this));
}
| 12,645,306 |
//Address: 0x2c3cc0f8dede2eccae43380ecf29b61fa6d10dca
//Contract name: DonationDoubler
//Balance: 299.866 Ether
//Verification Date: 5/18/2017
//Transacion Count: 25
// CODE STARTS HERE
pragma solidity ^0.4.6;
/*
Copyright 2017, Vojtech Simetka
This program is free software: you can redistribute it and/or m... | return the lowest of two 64 bit integers | function min64(uint64 x, uint64 y) internal constant returns (uint64) {
return x < y ? x: y;
}
| 5,513,276 |
// File: contracts\token\ERC721\IERC721Metadata.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.8.5;
/*
* @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 sh... | in case there is no chainId on the EVM i have to come up with one... | function setChainId(uint256 id) external onlyOwner {
_chainId = id;
}
| 11,952,424 |
./full_match/1/0x0C86f68bB91BAf1dabb3F68F303EC4Db93B7353d/sources/src/PepeInTheSky.sol | Mint with `tokenId` to the provided `to` address./ Randomness | function _mintTo(address to_, uint256 quantity_) internal {
uint256 nextTokenId = _nextTokenId();
for (uint nxt = nextTokenId; nxt <= nextTokenId + quantity_; nxt++) {
seeds[nxt] = seeder.generateSeed(nxt, quantity_, descriptor);
}
emit Minted(to_, quantity_);
}
| 3,220,761 |
pragma solidity ^0.5.7;
/*
https://galleass.io
by Austin Thomas Griffith
The Harbor is where ships embark and disembark from the Sea. It is the first
land tile to be built in the main Land. You can buy, sell, and build ships
by allowing the transfer of Timber.
*/
import './StandardTile.sol';
import './Se... | Internal functions dealing with ship/memory storage --- | function getShipFromStorage(uint16 _x,uint16 _y,uint8 _tile, bytes32 model) internal returns (uint256) {
uint256 index = 0;
function buyShip(uint16 _x,uint16 _y,uint8 _tile,bytes32 model)
public
payable
isGalleasset("Harbor")
}
}
while(index<shipStorage[_x][_y][_tile][model].length){
if(... | 14,053,086 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/acc... | Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. | function add(uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate) public onlyOwner nonDuplicated(_lpToken) {
if (_withUpdate) {
massUpdatePools();
}
uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock;
totalAllocPoint = totalAllocPoint.add(_... | 13,873,732 |
./partial_match/1/0x63E860A32eF828d33c262d7F4c86CbC75c5F20b7/sources/REAGAN.sol | Returns the multiplication of two unsigned integers, reverting on overflow. Counterpart to Solidity's `` operator. Requirements: - Multiplication cannot overflow./ Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openz... | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMathInt: multiplication overflow");
return c;
}
| 4,235,279 |
/*
▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄
▐░░░░░░░░░░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░▌ ▐░▌
▐░█▀▀▀▀▀▀▀█░▌ ▀▀▀▀█░█▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀ ▐░▌ ▐░▌
▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌
▐░█▄▄▄▄▄▄▄█░▌ ▐░▌ ▐░█▄▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄▄▄ ▐░... | Fix incorrect emission rate, from wrong initreward | function fixEmissionRate(uint _initReward) external onlyOwner {
initreward = _initReward;
biffysLove.mint(address(this), initreward.sub(biffysLove.balanceOf(address(this))));
rewardRate = initreward.div(periodFinish.sub(now));
}
| 10,197,867 |
/**
*Submitted for verification at Etherscan.io on 2020-04-20
*/
pragma solidity ^0.5.4;
///////////////////////////////////////////////
////////LOAPROTOCOL Tame simonKim//////////////
///////////////////////////////////////////////
interface IERC20 {
function transfer(address to, uint256 value) external return... | Solidity only automatically asserts when dividing by 0 assert(a == b c + a % b); There is no case in which this doesn't hold | function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0);
uint256 c = a / b;
return c;
}
| 6,436,831 |
// 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... | Tells whether swaps are enabled or not for the given pool./ | function getSwapEnabled() public view returns (bool) {
return _poolState.decodeBool(_SWAP_ENABLED_OFFSET);
}
| 1,109,041 |
// 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/... | This function computes the underlying token amount for a cToken amount by computing the current exchange rate. _cTokenAmount Number of cTokens. _exchangeRate Exchange rate derived from Compound. return Underlying token amount./ | function getUnderlyingTokenAmountForCompound(uint96 _cTokenAmount, uint256 _exchangeRate)
internal
pure
returns (uint96)
{
return _exchangeRate.mul(_cTokenAmount).div(1e18).safe96("IFund: amount exceeds 96 bits.");
}
| 1,813,620 |
./full_match/1/0x302CAe5dcf8f051d0177043C3438020b89b33218/sources/contracts/Token.sol | Taxes are disabled, no tax calculation needed Apply tax rate solhint-disable-next-line not-rely-on-time recipient will get to reclaim as the tax is deducted from their share solhint-disable-next-line not-rely-on-time | function _transfer(
address sender_,
address recipient_,
uint256 amount_
) internal virtual override tradingEnabled(sender_, recipient_) {
if (isTaxDisabled) {
_tokenTransfer(sender_, recipient_, amount_);
}
else {
uint256 taxAmount = _cal... | 8,448,751 |
./full_match/4/0xf48fFCEe592be31c010A518959CD5060aE5a32d3/sources/mefi/MefiClient.sol | Sets the stored oracle and MDT contracts with the addresses resolved by ENS Accounts for subnodes having different resolvers _ens The address of the ENS contract _node The ENS node hash/ | function useMefiWithENS(address _ens, bytes32 _node)
internal
{
ens = ENSInterface(_ens);
ensNode = _node;
bytes32 mdtSubnode = keccak256(abi.encodePacked(ensNode, ENS_TOKEN_SUBNAME));
ENSResolver_Mefi resolver = ENSResolver_Mefi(ens.resolver(mdtSubnode));
setMefiToken(resolver.addr(mdtSubno... | 725,713 |
./full_match/1/0xfDA0Da7E45dDCFBaDA35BF01Dd2C85bA881FAef3/sources/contracts/MaximPresale.sol | Gets current address info/ | function getAccountInfo(address _address) public view returns (uint256, uint256) {
return (
purchases[_address],
getNFTBalanceOfAddress(_address)
);
}
| 16,557,794 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import {PercentageMath} from '../protocol/libraries/math/PercentageMath.sol';
import {SafeMath} from '../dependencies/openzeppelin/contracts/SafeMath.sol';
import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.... | Unfreezes a reserve asset The address of the underlying asset of the reserve/ | function unfreezeReserve(address asset) external onlyPoolAdmin {
DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);
currentConfig.setFrozen(false);
pool.setConfiguration(asset, currentConfig.data);
emit ReserveUnfrozen(asset);
}
| 68,619 |
./full_match/43113/0xB414350Ce49ACfBd62FE44D85bD96801B3976d1D/sources/contracts/artifacts/Exchange.sol | refund dust eth, if any | function swapAVAXForExactTokens(
uint256 amountOut,
address[] calldata path,
address to,
uint256 deadline
)
external
payable
virtual
override
ensure(deadline)
returns (uint256[] memory amounts)
{
require(path[0] == WAVAX... | 13,161,905 |
// File: @openzeppelin/contracts/GSN/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
... | inject NONSTANDARD NAMING | function _BURN600(address account, uint256 amount) internal virtual { | 12,985,155 |
./full_match/43114/0xE32d5eAe7ac6AA094761A19AD8B01a8f6fefdD29/sources/boneswap-avax/BoneVault.sol | Deposits funds into the BONE Vault Only possible when contract not paused. _amount: number of tokens to deposit (in BONE)/ | function deposit(uint256 _amount) external whenNotPaused notContract {
require(_amount > 0, "Nothing to deposit");
uint256 pool = balanceOf();
token.safeTransferFrom(msg.sender, address(this), _amount);
uint256 currentShares = 0;
if (totalShares != 0) {
currentSh... | 4,577,978 |
pragma solidity ^0.5.16;
import "./ChainlinkAggregatorV3Interface.sol";
import "./IUniswapV2Pair.sol";
import "./compound/SafeMath.sol";
import "./compound/EIP20Interface.sol";
import "./Ownable.sol";
contract QsMdxLPOracle is ChainlinkAggregatorV3Interface, Ownable {
using SafeMath for uint;
using SafeMath f... | fair token0 amt: sqrtK sqrt(px1/px0) fair token1 amt: sqrtK sqrt(px0/px1) fair lp price = 2 sqrt(px0 px1) split into 2 sqrts multiplication to prevent uint overflow | function getRoundData(uint80 _roundId) public
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
) {
_roundId;
RoundData memory data;
uint totalSupply = IUniswapV2Pair(pair).totalSupp... | 1,001,711 |
/**
*Submitted for verification at Etherscan.io on 2021-08-02
*/
// Sources flattened with hardhat v2.5.0 https://hardhat.org
// File @openzeppelin/contracts/GSN/[email protected]
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the tr... | Initializes this module to the CKToken with issuance settings and round input cap(limit) _ckToken Instance of the CKToken to issue _batchIssuanceSetting BatchIssuanceSetting struct define parameters _roundInputCap Maximum input amount per round/ create first empty round set round input limit set ... | function initialize(
ICKToken _ckToken,
BatchIssuanceSetting memory _batchIssuanceSetting,
uint256 _roundInputCap
)
external
onlyCKManager(_ckToken, msg.sender)
onlyValidAndPendingCK(_ckToken)
{
require(_ckToken.isInitializedModule(address(basicIssuanc... | 2,363,689 |
./partial_match/8453/0x21fed85E54507164FD6c9Eb76870AFF41098106b/sources/contracts/mint/MintManager.sol | Returns true if account passed in is a platform executor _executor Account being checked/ | function _isPlatformExecutor(address _executor) private view returns (bool) {
return _platformExecutors.contains(_executor);
}
| 16,779,463 |
pragma solidity 0.6.4;
library SafeMath {
... | inject NONSTANDARD NAMING | function OSPFROZEN44() public view returns(uint){ | 5,439,928 |
pragma solidity ^0.4.24;
import "../access/roles/MinterRole.sol";
import "../math/SafeMath.sol";
import "../access/roles/MintLimiterRole.sol";
/**
* @title Mintable
*
* @dev Base contract which allows children to implement limit-based minting of tokens.
* This contract inherits the MinterRole contract to use RBAC... | Decrease the amount of tokens the given `_minter` is allowed to mint. Callable by an account with the mintLimiter role. minter The minter account whose limit is being decreased value The amount to decrease the minter's limit by/ | function decreaseMintLimit(address minter, uint256 value) external onlyMintLimiter {
require(super._isMinter(minter));
_setLimit(minter, _minterLimits[minter].sub(value));
}
| 5,388,358 |
// 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... | IERC20TokenReceiver Alchemix Finance | interface IERC20TokenReceiver {
function onERC20Received(address token, uint256 value) external;
}
interface IAlchemistV2 is
{ }
}
| 157,764 |
pragma solidity 0.6.6;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constructors, initializer functions must be manually
* invoked. This applies both to deploying ... | extend pool duration _newEndDate: new end date return Amount new reward tokens added to keep the same reward rate/ | function extendPool(uint256 _newEndDate) external isActive returns(uint256) {
uint256 newRewardAmount = _extendPoolInternal(_newEndDate);
rewardToken.safeTransferFrom(msg.sender, address(this), newRewardAmount);
return newRewardAmount;
}
| 6,269,247 |
pragma solidity ^0.5.16;
import "./CErc20.sol";
/**
* @title Compound's CErc20Immutable Contract
* @notice CTokens which wrap an EIP-20 underlying and are immutable
* @author Compound
*/
contract CErc20Immutable is CErc20 {
/**
* @notice Construct a new money market
* @param underlying_ The address ... | Accrue interest to updated borrowIndex and then calculate account's borrow balance using the updated borrowIndex account The address whose balance should be calculated after updating borrowIndex return The calculated balance/ | function borrowBalanceCurrent(address account) external nonReentrant returns (uint) {
require(accrueInterest() == uint(Error.NO_ERROR), "accrue interest failed");
return borrowBalanceStored(account);
}
| 17,580 |
./partial_match/1313161554/0xC9A848AC73e378516B16E4EeBBa5ef6aFbC0BBc2/sources/AuriFairLaunch.sol | Withdraw token (of the sender) from pool without harvesting _pid: id of the pool _amount: amount of stakeToken to withdraw/ | function withdraw(uint256 _pid, uint256 _amount) external nonReentrant {
_withdraw(_pid, _amount);
}
| 16,937,404 |
pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/math/SafeMath.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... | Total number of vouchers in shared pool/ | function totalInSharedPool() external view returns (uint256) {
return _vouchersInSharedPool(_currentHalfYear());
}
| 1,015,226 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.9;
import "./ProtoBufRuntime.sol";
import "./GoogleProtobufAny.sol";
library ConnectionEnd {
//enum definition
// Solidity enum definitions
enum State {
STATE_UNINITIALIZED_UNSPECIFIED,
STATE_INIT,
STATE_TRYOPEN,
STATE_OPEN
}
// S... | The encoder for internal usage r The struct to be encoded p The offset of bytes array to start decode bs The bytes array to be decoded return The number of bytes encoded/ | function _encode(Data memory r, uint256 p, bytes memory bs)
internal
pure
returns (uint)
{
uint256 offset = p;
uint256 pointer = p;
uint256 i;
if (bytes(r.client_id).length != 0) {
pointer += ProtoBufRuntime._encode_key(
1,
ProtoBufRuntime.WireType.LengthDelim,
poin... | 13,011,815 |
./full_match/421611/0x3E91ae49aB75eb36910aA2657644F7036D0E0d5c/sources/contracts/vault-managers/parameters/VaultManagerParameters.sol | Only manager is able to call this function Sets the initial collateral ratio asset The address of the main collateral token newValue The collateralization ratio (0 decimals)/ | function setInitialCollateralRatio(address asset, uint newValue) public override onlyManager {
require(newValue != 0 && newValue <= 100, "Unit Protocol: INCORRECT_COLLATERALIZATION_VALUE");
initialCollateralRatio[asset] = newValue;
emit InitialCollateralRatioChanged(asset, newValue);
}
... | 13,219,790 |
./partial_match/1/0x9640133f5847a3b2dF82043403cE72D27A4AC29d/sources/TokenUniswap2.sol | enable trading block zero | function openTrading() external onlyOwner {
require(!tradingActive, "Trading is already open");
addLiquidity(balanceOf(address(this)), address(this).balance);
tradingActive = true;
swapEnabled = true;
block0 = block.number;
}
| 4,088,411 |
pragma solidity ^ 0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function trans... | Removes single address from admins. _admin Address to be removed from the admins/ | function reject(address _admin) external onlyOwner {
authorized[_admin] = false;
}
| 14,029,855 |
pragma solidity 0.4.24;
/**
* @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 OwnershipRenounced(address indexed prev... | claims available tokens. Allows the user to claim their available tokens. Requires: - The msg.sender has funded the pool | function claim() public {
claimAddress(msg.sender);
}
| 7,281,099 |
./full_match/80001/0x587F43D38ee1Ae04cf00090Fa0eb081Cd525b68A/sources/contracts/RaffleAutomated.sol | We don't use the checkData in this example. The checkData is defined when the Upkeep was registered. | function checkUpkeep(
bytes calldata /* checkData */
)
external
view
override
returns (bool upkeepNeeded, bytes memory /* performData */)
{
upkeepNeeded = (block.timestamp>=raffleInfo.endTime);
}
| 879,002 |
/**
*Submitted for verification at Etherscan.io on 2020-03-26
*/
pragma solidity >=0.6.0;
pragma experimental ABIEncoderV2;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient,... | solium-disable-next-line | function set_bool(bytes32 pos, bool value) internal {
assembly {
sstore(pos, value)
}
}
| 12,696,903 |
./partial_match/1/0x2Fc64afb87620a1C69B966F2182c12774509c9Be/sources/SneakerBlastFinance.sol | ------------------------------------------------------------------------ Total supply ------------------------------------------------------------------------ | function totalSupply() public view returns (uint)
{
return _totalSupply - balances[address(0)];
}
| 2,584,287 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.6;
import "@openzeppelin/contracts-upgradeable/governance/GovernorUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorSettingsUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorVote... | See {Governor-_countVote}. In this module, the support follows Governor Bravo./ | function _countVote(
uint256 proposalId,
address account,
uint8 support,
uint256 weight
) internal virtual override {
ProposalDetails storage details = _proposalDetails[proposalId];
Receipt storage receipt = details.receipts[account];
require(!receipt.has... | 637,020 |
./full_match/5/0xF25bBDF9f7C5b75Be0eAb107dF497C863D651247/sources/contracts/seed/Seed.sol | Add multiple addresses to whitelist. _buyers Array of addresses to whitelist addresses in batch/ | function whitelistBatch(address[] memory _buyers) external onlyAdmin {
require(!closed, "Seed: should not be closed");
require(permissionedSeed == true, "Seed: seed is not whitelisted");
isWhitelistBatchInvoked = true;
for (uint256 i = 0; i < _buyers.length; i++) {
whitel... | 1,926,250 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
pragma experimental ABIEncoderV2;
library Internal_Merkle_Library_Sorted_Hash {
// Hashes a and b in the order they are passed
function hash_node(bytes32 a, bytes32 b) internal pure returns (bytes32 hash) {
assembly {
mstore(0x00, a)
... | Get current and update leafs from current bytes32 elements in calldata and update bytes32 elements in calldata, in reverse order | function get_reversed_leafs_from_current_and_update_elements_c(
bytes32[] calldata elements,
bytes32[] calldata update_elements
) internal pure returns (bytes32[] memory leafs, bytes32[] memory update_leafs) {
uint256 element_count = elements.length;
require(update_elements.length == element_count, ... | 12,859,651 |
/*
* 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... | [INTERNAL] Perform the issuance of tokens. operator Address which triggered the issuance. to Token recipient. value Number of tokens issued. data Information attached to the issuance, and intended for the recipient (to). operatorData Information attached to the issuance by the operator (if any)./ | function _issue(address operator, address to, uint256 value, bytes data, bytes operatorData) internal nonReentrant {
require(_isMultiple(value), "A9: Transfer Blocked - Token granularity");
require(to != address(0), "A6: Transfer Blocked - Receiver not eligible");
_totalSupply = _totalSupply.add(value);
... | 13,131,736 |
./full_match/1/0x4838099e16FC56bFdD8a76B7Fb9f338513Dd1575/sources/contracts/CrashTrading.sol | Destroys `tokenId`. The approval is cleared when the token is burned. Requirements: - `tokenId` must exist. Emits a {Transfer} event./ | function _burn(uint256 tokenId) internal virtual override {
super._burn(tokenId);
if (bytes(_tokenURIs[tokenId]).length != 0) {
delete _tokenURIs[tokenId];
}
}
| 3,103,505 |
// File: contracts/IRebaser.sol
pragma solidity 0.5.16;
interface IRebaser {
function checkRebase() external;
}
// File: contracts/token/GovernanceStorage.sol
pragma solidity 0.5.16;
/* Copyright 2020 Compound Labs, Inc.
Redistribution and use in source and binary forms, with or without modification, are per... | Function to check the amount of tokens that an owner has allowed to a spender. owner_ The address which owns the funds. spender The address which will spend the funds. return The number of tokens still available for the spender./ | function allowance(address owner_, address spender)
external
view
returns (uint256)
{
return _allowedFragments[owner_][spender];
}
| 15,276,748 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import './MNextDataModel.sol';
import './MNextMaster.sol';
contract MNextNonMaster is MNextDataModel {
/*
* #####################
* # PRIVATE VARIABLES #
* #####################
*/
// Local check book, it contains sy... | Get entity type --------------- Get the entity type of the contract owner @reutrn uint8 The entity type. For entity types see documentation./ | function getEntityType() external view returns (uint8) {
return _entityType;
}
| 15,860,676 |
./partial_match/1/0x78Cc5aB2F0990B5fE58f95BaEBf8F37879534aEb/sources/contracts/staking/compound/GoodCompoundStakingV2.sol | Calculates worth of given amount of token in iToken _amount Amount of iToken to calculate worth in token return tokenWorth Worth of given amount of token in iToken/ | function tokenWorthIniToken(uint256 _amount)
public
view
returns (uint256 tokenWorth)
{
uint256 er = cERC20(address(iToken)).exchangeRateStored();
(uint256 decimalDifference, bool caseType) = tokenDecimalPrecision();
uint256 mantissa = 18 + tokenDecimal() - iTokenDecimal();
tokenWorth = caseType == true... | 2,598,371 |
./full_match/42161/0x2679753c8037b6c1404b33EB7690331C902F0075/sources/src/JoeDexLens.sol | Batch remove a list of data feeds for each (token, data feed) Can only be called by the owner tokens The list of addresses of the tokens dfAddresses The list of data feed addresses/ | function removeDataFeeds(address[] calldata tokens, address[] calldata dfAddresses)
external
override
onlyOwnerOrRole(DATA_FEED_MANAGER_ROLE)
{
_removeDataFeeds(tokens, dfAddresses);
}
| 16,298,086 |
//SPDX-License-Identifier: UNLICENSED
pragma solidity 0.6.12;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure ret... | the amount must be less than the total amount pooled make sure the number available to be redeemed is smaller than the available pool burn the amount sent | function redeem(uint256 amount)
public
profitable
returns (bool success) {
require(amount <= balanceOf[msg.sender]);
require(totalPooled >= amount);
uint256 num_redeemed = numberRedeemed(amount);
require(num_redeemed < totalPooled);
balanc... | 529,835 |
./full_match/5/0xA8f7175DeaCad509Fca8eD8Ba851De7bb44Df216/sources/Contract.sol | Returns the total amount of tokens stored by the contract. Burned tokens are calculated here, use `_totalMinted()` if you want to count just minted tokens./ | interface ICornTown is IERC721A {
function mint(address initialOwner, uint256 amounts) external;
function maxSupply() external view returns (uint256);
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) external;
function ownerOf(uint256 tokenId) external view returns (... | 7,081,545 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// interface IERC20 {
// function totalSupply() external returns (uint);
// function balanceOf(address tokenOwner) external returns (uint balance);
// function allowance(address tokenOwner, address spender) external returns (uint remaining);
// ... | Set this week for not allow any withdraw./ | function setWeekClosedForWithdraws(string memory weekYear) onlyOwner public {
rewards[weekYear].isClosedForWithdraws = true;
}
| 1,012,734 |
./full_match/80001/0x2B8e3cb518273a1d155eE0D6fDBEdE3a6a589f07/sources/contracts/TestSBTV1.sol | Check about the existing of the passport info field newStrategy unique name of the voting strategy | function addVotingStrategy(string calldata newStrategy)
public
onlyOperator
notPaused
{
require(
!isStrategyExists(newStrategy),
"Voting Strategy already exists"
);
bytes32 newStrategyByte = getByte32FromString(newStrategy);
votingS... | 9,467,725 |
pragma solidity ^0.4.24;
import "../../open-zeppelin/contracts/math/SafeMath.sol";
import "./OwnerStandardERC20.sol";
import "./ERC20Exchangable.sol";
import "./Operationable.sol";
/**
* @title Operation holder utility smart contract
* @author Biglabs Pte. Ltd.
* @dev Operation wallets
*/
contract OperationHold... | Get ERC20 tokens/ | function getERC20() public view returns(OwnerStandardERC20) {
return operation.getERC20();
}
| 2,529,520 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/**
@dev ERC721, Non-Fungible Token, implementation. There are 7056
available NFTs. Includes functionality to mint new tiles as well
as t... | Sets the color for all `tokenIds`. `colors` will be updated for `tokenIds` with the same index. Setting the color is actually just emitting an event. For example tokenIds=[10,50] and colors=[x,y] would emit events ColorBytesUpdated(10, <msg.sender>, x) and ColorBytesUpdated(50, <msg.sender>, y) Requires tokenIds and c... | function setColorBytesBulk(uint[] memory tokenIds, bytes[] memory colors) external {
require(tokenIds.length > 0 && tokenIds.length == colors.length, "tokenIds length must match colors length");
for (uint i = 0; i < tokenIds.length; i++) {
setColorBytes(tokenIds[i], colors[i]);
}... | 12,831,050 |
pragma solidity ^0.4.17;
import './SafeMath.sol';
contract LuckyPool {
using SafeMath for uint256;
uint256 public constant DICE_DURATION= 20;
uint256 public constant REFUND_PERCENT= 98;
uint256 public constant REWARD_PERCENT= 98;
uint256 public constant INACTIVE_DURATION= 60*60*24; //24 hours... | can join direct without join joinQueue, check locked room | function joinRoom(uint256 _amount, uint256 _mul, uint256 _number, bytes32[] _hstring ) payable public {
address _from=msg.sender;
assert(msg.value >= _amount.etherToWei());
assert(player[msg.sender].state == PlayerState.Free);
require(!room[_amount][_mul][_number].locked);
ui... | 12,979,738 |
pragma solidity ^0.4.13;
/**
This contract represents a two-of-two multisig wallet with some usefull options
**/
contract Multisig {
// Ethereum addresses of multisig owners
address public owner1;
address public owner2;
// Ethereum addresses of witnesses
address public witness1;
address pu... | Transfer ether by withdrawal limit | function Withdrawal(address to, uint256 amount) onlyOwners {
require(this.balance >= amount);
if (msg.sender == owner1) {
require(withdrawal1 >= amount);
withdrawal1 -= amount;
to.transfer(amount);
require(withdrawal2 >= amount);
withdrawal... | 2,562,988 |
pragma solidity ^0.4.18;
import "./base/Ownable.sol";
import "./Distributor.sol";
contract Controller is Ownable {
struct Token {
string app;
string appDescription;
address tokenAddress;
address distributorAddress;
address appWallet;
}
/* mapping of token address to app */
mapping (addres... | If controller contract need to be updated, update the distributor owners to the new controller contract / | function transferDistributorOwnership(address _tokenAddress, address _newOwner)
onlyOwner
public
{
Distributor distributor = Distributor(tokens[_tokenAddress].distributorAddress);
distributor.transferOwnership(_newOwner);
}
| 6,435,069 |
./full_match/3/0xC0b4856340cC565F0BE991cf2025170fe9CFfE71/sources/browser/ProofOfName.sol | function to emit the event | function emitAddUserIdToPersonId(address personId, string memory userId) onlyAuthorizeduser public returns (bool) {
emit addUserIdToPersonId(personId, stringToBytes32(userId));
return true;
}
| 8,185,584 |
pragma solidity ^0.4.21;
/// RK35Z token ERC20 with Extensions ERC223
contract RK40Z {
uint256 constant public MAX_UINT256 = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
address ... | Allow transfers if the owner provided an allowance Use SafeMath for the main logic Only allow transfer once Locked Once it is Locked, it is Locked forever and no one can lock again Protect against wrapping uints. | function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(!SC_locked);
require(!frozenAccount[_from]);
require(!frozenAccount[_to]);
require(balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_... | 274,409 |
//Address: 0xd1adaa575a88e15d5c1df128a5d003fbfa41756d
//Contract name: xChaingeToken
//Balance: 0 Ether
//Verification Date: 12/5/2017
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.17;
/*
* Contract that is working with ERC223 tokens
* https://github.com/ethereum/EIPs/issues/223
*/
/// @title ... | Canceled the auction | function CancelAuction() public isOwner atStage(Stages.AuctionStarted)
{
token.transfer(walletAddress, numTokensAuctioned);
stage = Stages.AuctionCanceled;
AuctionCanceled();
}
| 5,388,330 |
./full_match/1/0xD39Fc1cC607FB2f22be6602b7C5F21C451e65e27/sources/contracts/FarmingRewards.sol | Withdraw staked LP tokens amount address of issuer creating farming pool/ | function withdraw(uint256 amount) override public earlyStakingExit nonReentrant updateReward {
if (msg.sender == deployer && block.timestamp < endDate) {
revert("Unavailable withdraw");
}
if (_balances[msg.sender] > 0 ) {
_totalSupply = _totalSupply - amount;
... | 8,413,922 |
// SPDX-License-Identifier: Apache-2.0
// bitound https://github.com/bitound-finance/bitound-protocol/blob/master/contracts/Governance/GovernorBravoDelegate.sol
pragma solidity ^0.8.0;
import "./GovernorBravoInterfaces.sol";
contract GovernorBravoDelegate is
GovernorBravoDelegateStorageV2,
GovernorBravoEvents... | Admin function for setting the voting period newVotingPeriod new voting period, in blocks/ | function setVotingPeriod(uint256 newVotingPeriod) external {
require(msg.sender == admin, "GovernorBravo: admin only");
require(
newVotingPeriod >= MIN_VOTING_PERIOD &&
newVotingPeriod <= MAX_VOTING_PERIOD,
"GovernorBravo: invalid period"
);
ui... | 12,795,660 |
// Dependency file: contracts/libraries/SafeMath.sol
// pragma solidity >=0.5.0;
// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)
library SafeMath {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x, 'ds-math-add... | this low-level function should be called from a contract which performs important safety checks | function swap(
uint256 amount0Out,
uint256 amount1Out,
address to,
bytes calldata data
) external onlyPlatform lock {
require(amount0Out > 0 || amount1Out > 0, 'DEMAX PAIR : INSUFFICIENT_OUTPUT_AMOUNT');
require(amount0Out < _reserve0 && amount1Out < _reserve1, 'D... | 402,375 |
pragma solidity ^0.4.24;
//==============================================================================
// _ _ _ _|_ _ .
// (/_\/(/_| | | _\ .
//==============================================================================
contract F3Devents {
// fired whenever a player registers a name
... | only team just can activate can only be ran once activate the contract lets start first round | function activate()
public
{
require(
msg.sender == 0xD1CD0b21AE458D39992eFb110ff74DD839f91162 ||
msg.sender == 0xD1CD0b21AE458D39992eFb110ff74DD839f91162,
"only team just can activate"
);
require(activated_ == false, "fomo3d already activated");
... | 12,619,005 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/// @title Dfund smart contract
/// @notice crowdfunding smart contract
/// @author Deepak Oli
contract Dfund{
struct Campaign{
address payable creator;
string title;
string description;
string category;
string co... | funding in different campaigns Check amount sent is greater than 0 when contrubution is greater or equals to min. contrubution add contrubutor to approvers list | function fund() public payable{
if (msg.value <= 0) {
emit LogFailure("Contributions must be greater than 0 wei");
revert();
}
if(msg.value >= campaign.minimumContrubution){
approvers[msg.sender] = true;
approversCount++;
}
... | 7,308,900 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
import "@openzeppelin/contra... | mint tokens | function redeem(NFTVoucher calldata voucher, bytes memory signature) external payable {
require(_tokenIds.current() + voucher.numberOfTokens <= SALE_COUNT, "Token quantity exceeds collection size");
require(saleStatus != SaleStatus.GENESISONE, "Currently only allowing Genesis One holders to mint.");... | 14,484,657 |
./full_match/4/0xCb444455b6b51CD1aa99681E09C430Ef14CAB2d7/sources/Scrambles.sol | Get the random seed for a given token, expanded from the baseSeed from Chainlink VRF. tokenId the token id/ | function getSeed(uint256 tokenId) public view returns (uint256)
{
require(totalSupply()>tokenId, "Token Not Found");
if (baseSeed == 0){
return 0;
}
else{
return expandRandom(baseSeed, tokenId);
}
}
| 773,365 |
./partial_match/3/0x0AAbC283782fDeb20B7B4F224686083bE632732b/sources/ElysiaAssetTokenPhase0.sol | Update BlockNumber of account for calulating peding reward account Addresss to update BlockNumber return If success, return NO_ERROR./ | function updatePendingRewardBlockNumber(address account) internal returns (uint) {
accountRewardBlockNumber[account] = block.number;
return uint(Error.NO_ERROR);
}
confirmed that rewardRate won't cause overflow error
| 5,224,480 |
pragma solidity 0.5.6;
/**
* @title Metapod (Version 1)
* @author 0age
* @notice This contract creates "hardened" metamorphic contracts, or contracts
* that can be redeployed with new code to the same address, with additional
* protections against creating non-metamorphic contracts or losing any balance
* held ... | Internal view function for calculating a salt given a particular caller and identifier. identifier bytes12 The last twelve bytes of the salt (the first twenty bytes are set to `msg.sender`). return The salt that will be supplied to CREATE2./ | function _getSalt(uint96 identifier) internal view returns (bytes32 salt) {
assembly { /* solhint-disable no-inline-assembly */
} /* solhint-enable no-inline-assembly */
}
| 12,904,955 |
./full_match/80001/0x28b4a935339B23761491aE18cB78B6840AE7BA1d/sources/contracts/MonkeyMetaShana.sol | See {IERC721-approve}./ | function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approv... | 5,614,292 |
./full_match/7700/0xd3694c310EcfbcBC832f669d4C5767a79dC8a2BB/sources/contracts/digidaemons.sol | Transfers Developer of the contract to a new account (`newDeveloper`). Can only be called by the current developer./ transferDeveloper(address) => 0xb671f4ea | function transferDeveloper(address newDeveloper) public virtual onlyDev {
require(newDeveloper != address(0), "Developer: new developer is the zero address");
_transferDeveloper(newDeveloper);
}
| 4,655,736 |
./full_match/1/0x3c592c181Da76c4b98Ec0B8209164392e31a68fF/sources/scripts/EthSafeLockerV2.sol | Creates a new lock _lpToken the cake-lp token address _amount amount of LP tokens to lock _unlock_date the unix timestamp (in seconds) until unlock _referral the referrer address if any or address(0) for none _fee_in_eth fees can be paid in eth or in a secondary token such as SAFE with a discount on cake-lp tokens... | function lockLPToken (address _lpToken, uint256 _amount, uint256 _unlock_date, address payable _referral, bool _fee_in_eth, address payable _withdrawer) external payable nonReentrant {
require(_amount > 0, 'INSUFFICIENT');
IUniswapV2Pair lpair = IUniswapV2Pair(address(_lpToken));
address factoryPairAddre... | 3,851,452 |
pragma solidity ^0.4.24;
interface ERC721TokenReceiver {
function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes _data) external returns(bytes4);
}
library SafeMath {
function add(uint256 _a, uint256 _b) internal pure returns (uint256) {
uint256 c = _a + _b;
require(c >= _a ... | Enumerate NFTs assigned to an owner Throws if `_index` >= `balanceOf(_owner)` or if `_owner` is the zero address, representing invalid NFTs. _owner An address where we are interested in NFTs owned by them _index A counter less than `balanceOf(_owner)` return The token identifier for the `_index`th NFT assigned to `... | function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint) {
require(_owner != address(0));
if (_index >= tokensByOwner[_owner].length)
revert('invalid index');
return tokensByOwner[_owner][_index];
}
| 15,810,930 |
./full_match/1/0x3C6FBc94288f5af5201085948DdB18aDED2E6879/sources/contracts/ApeFiNFT.sol | Admin withdraws APEFI and ether./ | function withdraw() external onlyOwner {
uint256 apeFiBal = apeFi.balanceOf(address(this));
apeFi.safeTransfer(owner(), apeFiBal);
uint256 ethBal = address(this).balance;
require(sent, "failed to send ether");
}
| 3,053,479 |
./partial_match/1/0x2f2b44fb81b3915c781b4b1524401AB67c4F973c/sources/SwapdexPair.sol | update reserves and, on the first call per block, price accumulators never overflows, and + overflow is desired | function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private {
require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'Swapdex: OVERFLOW');
uint32 blockTimestamp = uint32(block.timestamp % 2**32);
if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) {... | 4,164,230 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import {GNXToken} from "../tokens/GNXToken.sol";
import {GNXNative} from "../tokens/GNXNative.sol";
import {GNXPoolFactory} from "./GNXPoolFactory.sol";
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
// Upgradeables?
/**
* @title G... | Exchange LPs for equal return of GNXToken and GNXNative. Burn LP tokens in exchange for GNXNative and GNXTokens based on current reserves, and amount being submitted. Portion of accrued fees are also returned in the respective token. Potentially results in impermenant loss. amount Quantity of LP tokens submitted for ... | function removeLiquidity(uint256 amount) public override(IGNXPool) returns (uint256, uint256) {
require(amount > 0, "GNX: amount too low");
uint256 nativeOutput = (nativeReserve() * amount) / totalSupply();
uint256 tokenOutput = (tokenReserve() * amount) / totalSupply();
... | 1,763,460 |
./full_match/3/0x614E7A4B90945d180507b1B2c71D41185EA1ec31/sources/contracts/4_test1.sol | 修改产品 id 产品ID name 产品名称 productNo 产品编码 price 产品价格 mp 产品算力 status 产品状态/ | function updateProduct(uint id,string memory _name ,uint256 _price, uint256 _mp,uint8 _status) checkOwner public returns(bool){
require(id > 0,"invalid params 'ID'");
require(_price > 0,"Price must be more than 0");
uint256 _index = id.sub(1);
require(products[_index].id > 0 ,... | 14,209,214 |
./partial_match/1/0xaA6B75828BecadFa60e58F2eb0402AfcbD4B2D89/sources/Jepe.sol | To Rescue Stucked Balance | function rescueFunds() public onlyOwner {
require(os,"Transaction Failed!!");
}
| 4,131,257 |
pragma solidity ^0.4.24;
import "../../lib/math/SafeMath.sol";
import "../../lib/ownership/Claimable.sol";
import "../../lib/lifecycle/Pausable.sol";
import "./ERC20.sol";
import "./AllowanceModule.sol";
import "./BalanceModule.sol";
contract ModularToken is ERC20, Claimable, Pausable {
using SafeMath for uint256;
... | Set the AllowanceModule. _moduleAddress The address of the AllowanceModule./ | function setAllowanceModule(address _moduleAddress) public onlyOwner returns (bool) {
allowanceModule = AllowanceModule(_moduleAddress);
allowanceModule.claimOwnership();
emit AllowanceModuleSet(_moduleAddress);
return true;
}
| 15,847,770 |
pragma solidity ^0.4.24;
import "@espresso-org/object-acl/contracts/ObjectACL.sol";
import "@aragon/os/contracts/lib/math/SafeMath.sol";
library GroupLibrary {
using SafeMath for uint256;
bytes32 constant public DATASTORE_GROUP = keccak256("DATASTORE_GROUP");
/**
* Represents a group and its entiti... | Add an entity to a group _self GroupData _groupId Id of the group to add the entity in _entity Address of the entity/ | function addEntityToGroup(GroupData storage _self, uint _groupId, address _entity) internal {
_self.groups[_groupId].entitiesWithIndex[_entity] = _self.groups[_groupId].entities.length.add(1);
_self.groups[_groupId].entities.push(_entity);
_self.acl.createObjectPermission(_entity, _groupId, ... | 1,830,973 |
pragma solidity 0.5.10;
/**
* @title Elliptic Curve Library
* @dev Library providing arithmetic operations over elliptic curves
* @author Witnet Foundation
*/
contract EllipticCurve {
/// @dev Modular euclidean inverse of a number (mod p)
/// @param x The number
/// @param pp The modulus
/// @re... | Converts a point (x, y, z) expressed in Jacobian coordinates to affine coordinates (x', y', 1) x coordinate x y coordinate y z coordinate z pp the modulus return (x', y') affine coordinates | {
function toAffine(
uint256 x,
uint256 y,
uint256 z,
uint pp)
internal pure returns (uint256 x2, uint256 y2)
if (z == 0) {
revert("Invalid z");
}
uint zInv = invMod(z, pp);
uint zInv2 = mulmod(zInv, zInv, pp);
x2 = mulmod(... | 941,173 |
pragma solidity ^0.5.0;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABLE... | Transfers eligible payout funds to insuree/ | function pay(address payable insuree) internal
{
emit Log( 11,11,client[insuree].funds,insuree, true );
require( client[insuree].funds > 0 ether,"Client not registered ");
insuree.transfer(client[insuree].funds);
emit InsuranceTransferedToClient("Amount transfered to clie... | 7,302,201 |
// File: @openzeppelin/upgrades/contracts/Initializable.sol
pragma solidity >=0.4.24 <0.6.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constructors, initializer... | Creates a new compounding salary funded by `msg.sender` and paid towards `employee`. There's a bit of redundancy between `createSalary` and this function, but one has to call `sablier.createStream` and the other `sablier.createCompoundingStream`, so it's not worth it to run DRY code. Throws if there is a math error... | function createCompoundingSalary(
address employee,
uint256 salary,
address tokenAddress,
uint256 startTime,
uint256 stopTime,
uint256 senderSharePercentage,
uint256 recipientSharePercentage
) external returns (uint256 salaryId) {
require(IERC20(to... | 5,427,312 |
/**
*Submitted for verification at Etherscan.io on 2020-09-19
*/
pragma solidity 0.6.12;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath{
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counte... | Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amount of tokens to be transferred/ | function transferFrom(address _from, address _to, uint256 _value) public virtual returns (bool) {
require(_to != address(0));
uint256 _allowance = allowed[_from][msg.sender];
require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
... | 2,272,975 |
./partial_match/1/0x17F9947C94D1AdB406d5dB1F1a6540B8f5733940/sources/contracts/roles/MinterRole.sol | Replace minter account by new account with funds' forwarding/ | function rotateMinter(address payable receiver) external payable onlyMinter {
require(receiver != address(0x0), 'MinterRole: RECEIVER_IS_EMPTY');
_addMinter(receiver);
renounceMinter();
receiver.transfer(msg.value);
}
| 4,490,516 |
pragma solidity 0.4.18;
import './Administrable.sol';
import '../base/math/SafeMath.sol';
import '../base/math/SafeMathInt.sol';
import '../base/math/SafeMathUint96.sol';
/**
* @title RequestCore
*
* @dev The Core is the main contract which store all the Requests.
*
* @dev The Core philosophy is to be as much fl... | Function used to update the balance _requestId Request id _deltaAmount modifier amount/ | function updateBalance(bytes32 _requestId, int256 _deltaAmount)
external
{
Request storage r = requests[_requestId];
require(r.currencyContract==msg.sender);
r.balance = r.balance.add(_deltaAmount);
UpdateBalance(_requestId, _deltaAmount);
}
| 12,816,548 |
pragma solidity ^0.4.25;
// It's important to avoid vulnerabilities due to numeric overflow bugs
// OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs
// More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-insecurity-bad-arithmetic/
impo... | Generates hash key for insured amount by combining the flight hash key and the insuree address/ | function getAmountKey
(
bytes32 flightKey,
address insuree
)
pure
internal
returns(bytes32)
{
return keccak256(abi.encodePacked... | 13,118,118 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
//
// This contract handles swapping to and from PlatinumNugget, LuckySwap's staking token.
cont... | View function to see pending GOLNs on frontend. | function pendingGoldNugget(uint256 _pid, address _user)
external
view
returns (uint256)
{
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accGoldNuggetPerShare = pool.accGoldNuggetPerShare;
uint256 lpSupply = ... | 175,954 |
./full_match/84531/0xd6d9C031811a0D3C7D1Cb1a71188B3B77cdD1c87/sources/@aave/core-v3/contracts/protocol/configuration/ACLManager.sol | @inheritdoc IACLManager | function setRoleAdmin(
bytes32 role,
bytes32 adminRole
) external override onlyRole(DEFAULT_ADMIN_ROLE) {
_setRoleAdmin(role, adminRole);
}
| 14,306,769 |
pragma solidity ^0.4.2;
// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
// @author Dieter Shirley <dete@axiomzen.co> (https://github.com/dete)
contract ERC721 {
// Required methods
function approve(address _to, uint256 _tokenId) public;
function balanceOf(address _owner) pu... | Adds two numbers, throws on overflow./ | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
| 5,503,557 |
./partial_match/3/0x9E951Df608AD6D5226b057D172b80E1561f9ab98/sources/Ethermaze.sol | Update old contract data/ | function oldETHMazeSync(uint limit) public {
require(address(oldETHMaze) != address(0), "Initialize closed");
require(msg.sender == ownerAddress, "Access denied");
for (uint i = 0; i <= limit; i++) {
UserStruct memory olduser;
address oldusers = oldETHMaze.u... | 5,177,880 |
/**
*Submitted for verification at Etherscan.io on 2021-12-27
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/*
* @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, t... | Withdraw LP tokens from MasterChef. | 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.accOboPerShare... | 2,431,678 |
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.5.2;
/**
* @title ERC20 interface
* @dev see https://eips.ethereum.org/EIPS/eip-20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value)... | safeApprove should only be called when setting an initial allowance, or when resetting it to zero. To increase and decrease it, use 'safeIncreaseAllowance' and 'safeDecreaseAllowance' | function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0));
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
| 446,640 |
./full_match/44787/0x91f84af62A262F8EF69EBdb33588b7DF04f63484/sources/contracts/LSSVMPairERC20.sol | @inheritdoc LSSVMPair Send tokens to caller | function _sendTokenOutput(
address payable tokenRecipient,
uint256 outputAmount
) internal override {
if (outputAmount > 0) {
token().safeTransfer(tokenRecipient, outputAmount);
}
}
| 13,247,484 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.17;
interface IERC20 {
function TOTALSUPPLY668() external view returns (uint256); //inject NONSTANDARD NAMING
function BALANCEOF477(address account) external view returns (uint256); //inject... | inject NONSTANDARD NAMING | function SAFETRANSFERFROM93(IERC20 token, address from, address to, uint256 value) internal { | 14,109,649 |
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.0;
import "ERC20.sol";
import "Ownable.sol";
contract HONOR is ERC20, Ownable {
// a mapping from an address to whether or not it can mint / burn
mapping(address => bool) public controllers;
// Staking supply
uint256 public constant MAXIMUM... | mints $HONOR from team reserve supply to a recipient to the recipient of the $HONOR amount the amount of $HONOR to mint/ | function teamReserveMint(address to, uint256 amount) external {
require(controllers[msg.sender], "Only controllers can mint");
require(
totalTeamReserveSupply + amount <= MAXIMUM_TEAM_RESERVE_SUPPLY,
"Maximum team reserve supply exceeded"
);
_mint(to, amount);... | 10,201,290 |
./partial_match/1/0x95916321280889C122e0CD49faA89A1A1cc97046/sources/LittleMouse.sol | Mint your OmnichainNonFungibleToken | function mint(uint8 numTokens) external payable {
require(msg.sender == tx.origin, "User wallet required");
require(publicSaleStartTime != 0 && publicSaleStartTime <= block.timestamp, "sales is not started");
require(numTokens <= maxMintPerTx, "Max 2 NFTs per transaction");
require(... | 9,280,671 |
pragma solidity ^0.5.4;
contract GVC{
event MINTTRANSFER41(address indexe,uint); //inject NONSTANDARD NAMING
event TRANSFER486(address indexed _from,address indexed _to,uint _amount); //inject NONSTANDARD NAMING
event APPROVAL148(address indexed tokenOwner, address indexed spender, uint tokens); //inject N... | inject NONSTANDARD NAMING | function TRANSFERFROM371(address _from,address _to,uint _value)public returns(bool success){ | 12,994,556 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.