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.8.6;
//SPDX-License-Identifier: MIT Licensed
//HJAELPCOIN - Pre-sale DApp
interface IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() ... | to get real time price of eth | function getLatestPriceEth() public view returns (uint256) {
(, int256 price, , , ) = priceFeedeth.latestRoundData();
return uint256(price);
}
| 6,173,135 |
//Address: 0xab37d7c4a2ae9ad4451aa796171dc8ac0fa429f4
//Contract name: IcoToken
//Balance: 0 Ether
//Verification Date: 2/2/2018
//Transacion Count: 95
// CODE STARTS HERE
//File: node_modules/zeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler v... | allows contract owner to mint tokens for ICO enablers respecting the ICO_ENABLERS_CAP (no vesting) _to address for beneficiary _tokens uint256 token amount to mint/ | function mintIcoEnablersTokens(address _to, uint256 _tokens) public onlyOwner onlyNoneZero(_to, _tokens) {
require(icoEnablersTokensMinted.add(_tokens) <= ICO_ENABLERS_CAP);
token.mint(_to, _tokens);
icoEnablersTokensMinted = icoEnablersTokensMinted.add(_tokens);
}
| 13,074,889 |
./full_match/1/0x28883d426dD2eF9EED05AdeAE1CA078D5648114E/sources/localhost/RFETHTOKEN.sol | Decrease the amount of tokens that an owner has allowed to a spender. spender The address which will spend the funds. subtractedValue The amount of tokens to decrease the allowance by./ | function decreaseAllowance(address spender, uint256 subtractedValue)
public
override
returns (bool)
{
require(!transfersPaused || transferPauseExemptList[msg.sender], "paused");
uint256 oldValue = _allowedRFETH[msg.sender][spender];
if (subtractedValue >= oldValu... | 9,605,486 |
pragma solidity 0.4.24;
import 'libraries/ContractExists.sol';
import 'libraries/IERC820Registry.sol';
interface ERC820ImplementerInterface {
/// @notice Contracts that implement an interferce in behalf of another contract must return true
/// @param addr Address that the contract woll implement the interfac... | Query the hash of an interface given a name interfaceName Name of the interfce | function interfaceHash(string interfaceName) public pure returns(bytes32) {
return keccak256(abi.encodePacked(interfaceName));
}
| 13,016,178 |
./full_match/1/0x14b5Ceaf1957df0BC55c55A865470Ddd245857b5/sources/PAYMENTS_LOT22.sol | Completely Resets Splitter and withdrawls any remaining ETH. NOTE: Any remaining ERC20 tokens will need to be manually withdrawn./remove the oldset the new | function resetSplit(address[] memory payees, uint256[] memory shares_) public onlyOwner {
require(payees.length == shares_.length, "PaymentSplitter: payees and shares length mismatch");
require(payees.length > 0, "PaymentSplitter: no payees");
for (uint256 i = 0; i < _payees.length; i++) {
... | 8,286,357 |
pragma solidity ^0.4.13;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division o... | Start Presale/ make sure we're in the private sale state move to presale | function startPreSale() public onlyOwner {
require(currentState == TokenSaleState.Private);
currentState = TokenSaleState.Pre;
}
| 5,841,250 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/security/ReentrancyGuard.sol
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {... | Change the base URI _newBaseURI The new base URI/ | function setBaseUri(string memory _newBaseURI) external onlyOwner {
baseURI = _newBaseURI;
}
| 270,073 |
//Address: 0x0a630de26e5b41eaef08741e74da4018a6c2e14c
//Contract name: dgame
//Balance: 0.00001 Ether
//Verification Date: 6/1/2017
//Transacion Count: 214
// CODE STARTS HERE
pragma solidity ^0.4.10;
/*
* This is an example gambling contract that works without any ABI interface.
* The entire game logic is invoke... | fallback function is used for entire game logic status idle: start new game and transition to status ongoing status completed: find winner and transition to status idle pay winner all Ether that we have ignore if winner rejects prize in that case Ether will be added to prize of the next game status ongoing: register pl... | function() payable {
if (endRegisterTime == 0) {
endRegisterTime = now + registerDuration;
if (msg.value == 0)
StartedGame(msg.sender, endRegisterTime, msg.value, gameNumber);
uint currentGamenumber = gameNumber;
FoundWinner(players[currentGamenumb... | 2,491,908 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./interfaces/ICozy.sol";
import "./interfaces/ICozyInvest.sol";
import "./lib/CozyInvestHelpers.sol";
import "@openzeppelin/contracts/utils/Address.sol";
interface IRibbon {
funct... | Approves the stipulated contract to spend the given allowance in the given token Errors with 'SA' if transfer fails token The contract address of the token to be approved to The target of the approval value The amount of the given token the target will be allowed to spend/ | function safeApprove(
address token,
address to,
uint256 value
) internal {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.approve.selector, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), "Approve failed");
}
| 1,482,142 |
./full_match/44787/0xbB8cAD00EAf597299c947eCD1a07af9a7Ff23e0B/sources/contracts/Celoquest.sol | _questId quest id we would get winning contribution Get present contribution having the more votes in case of equality, first contribution is winning/Quest owner vote count as 25% of total votation | function getWinningContribution(uint _questId) public view returns(uint) {
require(_questId < nbQuests, "Quest not found");
uint tmpWinning = quests[_questId].userVote[quests[_questId].owner];
uint maxVote = contributions[tmpWinning].nbVotes + (quests[_questId].nbVotes / 4);
for (... | 13,268,437 |
pragma solidity ^0.5.16;
import "./CToken.sol";
import "./ErrorReporter.sol";
import "./PriceOracle.sol";
import "./ComptrollerInterface.sol";
import "./ComptrollerStorage.sol";
import "./Unitroller.sol";
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
function totalSupp... | Claim all comp accrued by the holders holders The addresses to claim COMP for cTokens The list of markets to claim COMP in/ | function claimComp(address[] memory holders, CToken[] memory cTokens) public {
for (uint i = 0; i < cTokens.length; i++) {
CToken cToken = cTokens[i];
require(markets[address(cToken)].isListed, "market must be listed");
updateCompSupplyIndex(address(cToken));
... | 5,814,437 |
pragma solidity >=0.4.22 <0.6.0;
pragma experimental ABIEncoderV2;
contract TripLogic
{
struct offer //offer cant be reserved while its started
{
address carOwnerAddress;
uint64 startTime;
uint64 endDate; //repeat to let the client know
uint32 endTime; //hours - was added by 1000 to ensure 0000 ... | User has a rating right for each ended trip | function rateTrip(address ownerAddress, uint8 rating) public
{
require(usermap[msg.sender].hasRatingRight[ownerAddress] == true);
require(rating > 0);
require(rating < 6);
usermap[ownerAddress].rating += rating;
usermap[ownerAddress].ratingCount++;
usermap[msg.sen... | 15,820,456 |
./partial_match/1/0xa03ba2D6Dd3c4e5cD558F8ed90F4FE1BD5AFe7AC/sources/TornomyERC20Staked.sol | A method to add a stakeholder. account The account to add./ if user exists, add _val else its new user | function _addStakeholder(address account) private {
if (!_stakeHolderMap[account].status) {
_stakeHolders.push(account);
_stakeHolderMap[account].status = true;
_stakeHolderMap[account].index = _stakeHolders.length - 1;
}
}
| 4,241,197 |
pragma solidity 0.5.17;
library SafeMath {
function MUL922(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING
uint256 c... | inject NONSTANDARD NAMING | function TRANSFER247(address to, uint amount) public returns (bool) { | 964,911 |
./partial_match/1/0x84F396739984e8bF9aCa791541B01637c23BCB16/sources/Sale.sol | calculate token amount to be created | function buyTokens(address _beneficiary) public payable {
uint256 weiAmount = msg.value;
require(_beneficiary != address(0));
require(weiAmount != 0);
uint256 tokensAmount = checkTokensAmount(weiAmount);
usdRaised = usdRaised.add(weiAmount.mul(rate).div(10**18));
t... | 2,745,954 |
./full_match/1/0x162A78B8bbB2c7dbD6D7aceC507EF9625d2b34E4/sources/contracts/savings/Bank.sol | If it is the first borrow FIN rate checkpoint, set the deltaBlock value be 0 so that the first point on borrowFINRateIndex is zero. If the totalBorrow of the token is zero, no FIN token should be mined and the FINRateIndex is unchanged. | function updateBorrowFINIndex(address _token) public onlyAuthorized {
uint256 currentBlock = getBlockNumber();
uint256 deltaBlock;
deltaBlock = lastBorrowFINRateCheckpoint[_token] == 0
? 0
: currentBlock.sub(lastBorrowFINRateCheckpoint[_token]);
borrowFINRateI... | 17,083,678 |
./full_match/1/0x402993515350c973f1D44FC8762644E3806cB9bC/sources/contracts/data/Keys.sol | key for stable price value token the token to get the key for return key for stable price value | function stablePriceKey(address token) internal pure returns (bytes32) {
return keccak256(abi.encode(
STABLE_PRICE,
token
));
}
| 16,543,176 |
/**
* Copyright 2017-2020, bZeroX, LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.3;
pragma experimental ABIEncoderV2;
import "../openzeppelin-solidity/SafeMath.sol";
import "../storage/BZxStorage.sol";
import "../BZxVault.sol";
import "../oracle/OracleInterface.... | Calculates the sum of values already filled and cancelled for a given loanOrder. loanOrderHash A unique hash representing the loan order. return Sum of values already filled and cancelled. | function _getUnavailableLoanTokenAmount(
bytes32 loanOrderHash)
internal
view
returns (uint256)
{
uint256 unavailableAmount = orderFilledAmounts[loanOrderHash].add(orderCancelledAmounts[loanOrderHash]);
return (orders[loanOrderHash].loanTokenAmount >= unavailableA... | 6,434,753 |
pragma solidity >=0.4.24;
import "./DataType.sol";
import "./Ownable.sol";
/**
* @title Role (Role Access Control)
*/
contract Role is Ownable, DataType {
//(action => operator => permission), action recommend use string(business directive)
mapping(bytes32=>mapping (address => bool)) roles;
event AddR... | remove a role from an address _operator address of operator _action the name of the role/ | function removeRole(address _operator, bytes32 _action) public onlyRole("manageRole") returns (bool) {
if(_operator == msg.sender && _action == stringToBytes32("manageRole")) {
revert("can not remove it if operator there is manageRole");
}
roles[_action][_operator] = false;
... | 6,451,106 |
./full_match/1/0x07445312dB273589dcb0fd2bd57aa815A5Afb8CC/sources/contracts/SimpleStaking.sol | Allows new pairs to be added to the "watcher" code pair the address to add as the liquidity pair | function addNewLPPair(address pair) external onlyOwner {
mappedAddresses[pair].isLPPair = true;
lpPairs.push(pair);
}
| 16,503,523 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
... | inject NONSTANDARD NAMING | function ALLPAIRS303(uint256) external view returns (address pair); | 12,569,023 |
./full_match/1/0xAce00EEe06B03873A266eC798d099a74363b941c/sources/contracts/SwapCentral.sol | ---------------Uniswap V2 Starts Here----------------------get estimation output | function V2GetEstimatedOut(uint amountIn, address tokenIn, address tokenOut) external view returns (uint[] memory){
address[] memory path = createPath(tokenIn, tokenOut);
return routerV2.getAmountsOut(amountIn, path);
}
| 2,959,062 |
// SPDX-License-Identifier: MIT
// Inspired by Stable Joe Staking which in turn is derived from the SushiSwap MasterChef contract
pragma solidity 0.8.10;
import "@rari-capital/solmate/src/utils/SafeTransferLib.sol";
import "../libraries/BoringOwnable.sol";
/**
* @title Magic Spell Staking
* @author 0xMerlin
*/
con... | Withdraw without caring about rewards. EMERGENCY ONLY/ | function emergencyWithdraw() external {
UserInfo storage user = userInfo[msg.sender];
require(!toggleLockup || user.lastAdded + LOCK_TIME < block.timestamp, "mSpell: Wait for LockUp");
uint256 _amount = user.amount;
user.amount = 0;
user.rewardDebt = 0;
spell.safe... | 5,818,246 |
pragma solidity ^0.6.0;
... | inject NONSTANDARD NAMING | function __CONTEXT_INIT10() internal INITIALIZER65 { | 1,018,796 |
pragma solidity >= 0.5.17;
contract FreeportMainURI {
//string public tokenURI;
string public URISubfile;
address public superManager = 0xaA04E088eBbf63877a58F6B14D1D6F61dF9f3EE8;
address public manager;
string[] public tokenURI;
constructor() public{
manager = msg.sender;
}
modifier ... | ----------------Add URI------------------------------Manager only-- | function setURI(uint _sort, string memory _tokenURI) public onlyManager{
uint arrayAmounts = tokenURI.length;
require(_sort <= arrayAmounts, "Array amounts error.");
tokenURI[_sort] = _tokenURI;
}
| 12,592,114 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol';
import '@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol';
import '@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol';
import './ERC721Upgradeab... | Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is forwarded in {IERC721Receiver-onERC721Received} to contract recipients./ | function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
'ERC721: transfer to non ERC721Receiver implementer'
);
}
| 121,124 |
./full_match/137/0x7d561bE86eBCB1d8353f98c21Bef7232343598a8/sources/WebaverseERC721.sol | List collaborators for a token tokenId Token ID of the token to get collaborators for/ | function getSingleCollaborators(uint256 tokenId) public view returns (address[] memory) {
address[] memory collaborators = tokenIdToCollaborators[tokenId];
return collaborators;
}
| 4,669,351 |
pragma solidity ^0.5;
/* NOTE: @kleros/kleros-interraction is not compatible with this solc version */
/* NOTE: I put all the arbitration files in the same file because the dependancy between the different contracts is a real "headache" */
/* If someone takes up the challenge, a PR is welcome */
/**
* @title CappedM... | Create a dispute. Must be called by the arbitrable contract. Must be paid at least arbitrationCost(). _choices Amount of choices the arbitrator can make in this dispute. When ruling ruling<=choices. _extraData Can be used to give additional info on the dispute to be created. return disputeID ID of the dispute cre... | function createDispute(uint _choices, bytes memory _extraData) public payable returns(uint disputeID) {
super.createDispute(_choices, _extraData);
disputeID = disputes.push(DisputeStruct({
arbitrated: Arbitrable(msg.sender),
choices: _choices,
fee: msg.value,
ruling: 0,
status: ... | 12,936,868 |
pragma solidity ^0.6.0;
interface TokenInterface {
function approve(address, uint) external;
function transfer(address, uint) external;
function deposit() external payable;
function withdraw(uint) external;
function balanceOf(address) external view returns (uint);
}
interface ManagerLike {
fun... | Borrow DAI. vault Vault ID. amt token amount to borrow. getId Get token amount at this ID from `InstaMemory` Contract. setId Set token amount at this ID in `InstaMemory` Contract./ | function borrow(
uint vault,
uint amt,
uint getId,
uint setId
) external payable {
ManagerLike managerContract = ManagerLike(getMcdManager());
uint _amt = getUint(getId, amt);
uint _vault = getVault(managerContract, vault);
(bytes32 ilk, address u... | 2,430,015 |
./partial_match/1/0x7B9a3a9F8cdE5582b7639eeE88225d4D59476e45/sources/XCEO.sol | generate the uniswap pair path of token -> weth make the swap | function swapTokensForEth(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingF... | 2,630,528 |
pragma solidity ^0.4.18;
contract MyToken {
string public name = "Test";
string public symbol = "TEST";
uint8 public decimals = 8;
uint256 public initialSupply = 200000000;
uint256 public totalSupply;
mapping (address => uint256) public balanceOf;
/* Initializes contract with initial... | Initializes contract with initial supply tokens to the creator of the contract / | function MyToken() public {
totalSupply = initialSupply * 10 ** uint256(decimals);
balanceOf[msg.sender] = totalSupply;
}
| 2,396,849 |
pragma solidity 0.6.1;
import "./ownable.sol";
/**
* @dev The contract has an owner address, and provides basic authorization control which
* simplifies the implementation of user permissions. This contract upgrades Ownable contracts with
* additional claim step which makes ownership transfers less prone to errors... | Allows the current pending owner to claim the ownership of the contract. It emits OwnershipTransferred event and resets pending owner to 0./ | function claimOwnership()
public
{
require(msg.sender == pendingOwner, NOT_PENDING_OWNER);
address previousOwner = owner;
owner = pendingOwner;
pendingOwner = address(0);
emit OwnershipTransferred(previousOwner, owner);
}
| 1,012,121 |
pragma solidity 0.4.24;
import "./SafeMath.sol";
import "./Ownable.sol";
import "./PLGToken.sol";
import "./Whitelist.sol";
/// @title Pledgecamp Crowdsale
/// @author Sam Pullman
/// @notice Capped crowdsale with bonuses for the Pledgecamp platform
contract PLGCrowdsale is Ownable {
using SafeMath for uint256;
... | Check various conditions to determine whether a purchase is currently valid amount The amount of tokens to be purchased | function validPurchase(uint256 amount) public view returns (bool) {
bool nonZeroPurchase = amount != 0;
bool isMinPurchase = (amount >= minimumPurchase);
return saleActive && nonZeroPurchase && isMinPurchase;
}
| 6,427,167 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.4;
pragma experimental ABIEncoderV2;
import "../../openzeppelin/contracts-upgradeable/math/SignedSafeMathUpgradeable.sol";
import "../../openzeppelin/contracts-upgradeable/utils/SafeCastUpgradeable.sol";
import "../interface/IAccessControl.sol";
import "../inte... | A lease mechanism to check if the operator is alive as the pool manager. After OPERATOR_CHECK_IN_TIMEOUT, the operator will no longer be the operator. New operator will only be raised by voting. Transfer operator to another account will renew the expiration. liquidityPool The liquidity p... | function checkIn(LiquidityPoolStorage storage liquidityPool) public {
liquidityPool.operatorExpiration = block.timestamp.add(OPERATOR_CHECK_IN_TIMEOUT);
emit OperatorCheckIn(getOperator(liquidityPool));
}
| 5,505,386 |
pragma ton-solidity >=0.44.0;
pragma AbiHeader time;
pragma AbiHeader pubkey;
pragma AbiHeader expire;
//================================================================================
//
/// @title DexDebot
/// @author Augual.Team
/// @notice Debot for Augual.DEX (LiquiSOR) service
//===============================... | ======================================== Inline functions | function _sortSymbols(Symbol sym1, Symbol sym2) internal inline pure returns (Symbol, Symbol)
{
return (sym1.addressRTW < sym2.addressRTW ? (sym1, sym2) : (sym2, sym1));
}
| 6,478,815 |
./full_match/3/0x103E9df0BF772478b0031F57C424CD856B34EDa9/sources/demo2.sol | See {IaNFTEnumerable-tokenOfOwnerByIndex}./ | function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
require(index < aNFT.balanceOf(owner), "aNFTEnumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
| 14,157,462 |
./partial_match/1/0xDe74Bd8cE7b7e4F1418Ba235ab1b774d4717d61a/sources/FishiesToken.sol | Only the contract owner can use this function | function setExemptStatus(address account, bool _isExempt) public onlyOwner {
isExempt[account] = _isExempt;
}
| 2,638,730 |
/**
*Submitted for verification at polygonscan.com on 2021-06-23
*/
import "@Uniswap/contracts/libraries/Math.sol";
//import "@Uniswap/contracts/interfaces/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
// File: contracts/lib/SafeMath.sol
pragma solidity ^0.5.16;
/**
* @dev Wrappers ove... | This method relies in extcodesize, which returns 0 for contracts in construction, since the code is only stored at the end of the constructor execution. solhint-disable-next-line no-inline-assembly | function isContract(address account) internal view returns (bool) {
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
| 13,005,828 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.8.0;
//pragma experimental ABIEncoderV2;
//pragma solidity ^0.5.0;
import "./base/Ownable.sol";
import "./SupplychainHub.sol";
import "./registration/StandardRegisterUserHub.sol";
// Controller contract for product interaction & workflow
contract P... | Get total number of investors for a product/ | function getNumberOfInvestorsForAProduct(uint256 _universalProductCode)
public
view
returns (uint256)
{
require(_universalProductCode > 0);
return
supplychainProductStateContract.getNumberOfPayblesForProduct(
_universalProductCode
)... | 15,817,031 |
// 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 permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyrig... | Decrease the amount of tokens that an owner has allowed to a spender. spender The address which will spend the funds. subtractedValue The amount of tokens to decrease the allowance by./ | function decreaseAllowance(address spender, uint256 subtractedValue)
external
returns (bool)
{
uint256 oldValue = _allowedBalances[msg.sender][spender];
if (subtractedValue >= oldValue) {
_allowedBalances[msg.sender][spender] = 0;
_allowedBalances[msg.sender][spender] = oldValue.sub(subtract... | 7,016,254 |
// SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-version
pragma solidity ^0.8.0;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contract can't have a constructor, it's common to move con... | return The slippage denominator | function getSlippageDenominator() public pure returns (uint24) {
return SLIPPAGE_DENOMINATOR;
}
| 9,947,468 |
./full_match/5/0x393c146c8824Ab2a0A96cf2Ab949ab7Ded9D6238/sources/project_/contracts/TCR.sol | entities wanting to be on the list can apply to it via this function. They must send an amount of ether equal to the challengerStake and specify an incumbent that they wish to displace (or an empty string if there is a position on the list that is unfilled) calls initiateVote if there are no empty slots remaini... | function applyToList(string _challengerName, string _incumbentName) external payable setupRequired() atStage(Stages.PreVote) smoothSailing() {
require(msg.value == challengerStake);
require(bytes(_challengerName).length <= 20);
require(bytes(_incumbentName).length <= 20);
challenger ... | 1,919,671 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/cont... | Disabling the application controllerAddress App controller address/ | function setAppDisable(address controllerAddress) external onlyRole(OPERATOR_ROLE) {
require(appsList[controllerAddress].exists, "Application doesn't exist");
require(appsList[controllerAddress].active, "Application already disable");
appsList[controllerAddress].active = false;
emi... | 1,079,545 |
./full_match/1/0x084F0B509cb0d4dd473D84520944950E1d6FafaF/sources/contracts/BatchTransfer.sol | Requires 'setApprovalForAll' before transfer | function transferERC721(
IERC721 collection,
address recipient,
uint256[] calldata tokenIds
) external {
for (uint256 i; i < tokenIds.length; i++) {
collection.safeTransferFrom(msg.sender, recipient, tokenIds[i]);
}
}
| 2,934,294 |
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/AddressUtils.sol";
import "./CvcEscrowInterface.sol";
import "../pricing/CvcPricingInterface.sol";
import "../upgradeability/Initi... | Stores placement data against the placement ID. _placementId Unique placement identifier _amount CVC token amount in creds (CVC x 10e-8) _credentialItemIds Array of credential item IDs _blockNumber Block number at which the placement is received/ Verify current state for given placementId to ensure operation is all... | function saveNewPlacement(bytes32 _placementId, uint256 _amount, bytes32[] _credentialItemIds, uint256 _blockNumber)
internal
{
PlacementState placementState = getPlacementState(_placementId);
require(
placementState == PlacementState.Empty || placementState == PlacementState... | 6,411,412 |
pragma solidity ^0.4.23;
/*
* NamiMultiSigWallet smart contract-------------------------------
*/
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
contract NamiMultiSigWallet {
uint constant public MAX_OWNER_COUNT = 50;
event Confirmation(address indexed ... | after all investor latch fci, controller change round state withdrawable now investor can withdraw NAC from NetfRevenue funds of this round and auto switch to unpause phrase/ | function changeWithdrawableNetfRe(uint _roundIndex) onlyController public {
require(isPause == true && NetfRevenue[_roundIndex].isOpen == true);
NetfRevenue[_roundIndex].withdrawable = true;
isPause = false;
}
| 2,024,894 |
// Sources flattened with hardhat v2.6.1 https://hardhat.org
// File contracts/chainlink/interfaces/AuthorizedReceiverInterface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface AuthorizedReceiverInterface {
function isAuthorizedSender(
address sender
)
external
view
return... | Forward a call to another contract Only callable by the owner to address data to forward/ | function ownerForward(
address to,
bytes calldata data
)
external
onlyOwner()
{
_forward(to, data);
}
| 15,839,771 |
./partial_match/100/0x0881E22BeDeDf41DdAa38A1cC571b805A8406251/sources/DMEX_Trading.sol | closes position for user | function closeFuturesPositionForUser (bytes32 futuresContract, bool side, address user, address poolAddress, uint256 expirationFee) onlyAdmin
{
closeFuturesPositionInternal(futuresContract, side, user, poolAddress, expirationFee);
}
| 16,645,090 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
//import {RedirectAll, ISuperToken, IConstantFlowAgreementV1, ISuperfluid} from "./RedirectAll.sol";
import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import {IConstantFlowAgreementV1} from "@superfluid-finance/ethereum-contracts/contracts/i... | calculating the already streamed amount and set the rest of initial streaming amount to the new streamAmount for this nft _newStreamAmount as an uint256 value can never be negative | function stopFlow(uint256 _tokenId) public returns(bool) {
require(allNFTs[_tokenId].isStopped == false, "Stream is already stopped");
require(msg.sender == operator, "You are not allowed to stop the stream");
allNFTs[_tokenId].isStopped = true;
uint256 _actualTime = block.timestamp;... | 12,720,188 |
./partial_match/1/0x03BB51F2299d5301a680efb1a085fBBF7701877E/sources/GREENTEACN.sol | exclude from paying fees or having max transaction amount | constructor() ERC20(unicode"China Green Tea", unicode"绿茶") {
marketingWallet = address(0x1a7De267bbeA17cD92587EAc388aA36c043b4647);
devWallet = address(msg.sender);
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMa... | 16,113,441 |
./full_match/56/0x6f287eCBBbCE7042187d388db663b036fc67b5B0/sources/project_/contracts/StrategyCommonChefLP.sol | puts the funds to work | function deposit() public whenNotPaused {
uint256 wantBal = IERC20(want).balanceOf(address(this));
if (wantBal > 0) {
IRewardPool(rewardPool).stake(wantBal);
}
}
| 3,234,951 |
pragma solidity ^0.4.19;
// copyright contact@emontalliance.com
contract BasicAccessControl {
address public owner;
// address[] public moderators;
uint16 public totalModerators = 0;
mapping (address => bool) public moderators;
bool public isMaintaining = false;
function BasicAccessControl() ... | max: one fish per address airdrop | function AddFish() isActive payable external {
if (msg.value != addFee) revert();
if (fishMap[players[msg.sender]].weight > 0)
revert();
totalFish += 1;
Fish storage fish = fishMap[totalFish];
fish.player = msg.sender;
fish.weight = addWe... | 2,167,424 |
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import "./ReentrancyGuard.sol";
import "./SafeMath.sol";
import "./SafeMathUInt128.sol";
import "./SafeCast.sol";
import "./Utils.sol";
import "./Storage.sol";
import "./Config.sol";
import "./Events.sol";
impor... | Reverts unverified blocks | function revertBlocks(StoredBlockInfo[] memory _blocksToRevert) external nonReentrant {
governance.requireActiveValidator(msg.sender);
uint32 blocksCommitted = totalBlocksCommitted;
uint32 blocksToRevert = Utils.minU32(uint32(_blocksToRevert.length), blocksCommitted - totalBlocksExecuted);
... | 13,012,650 |
./partial_match/1/0x41C1F38A4BbFA4f14Ef235ed8901b3a0e51a2933/sources/NABC.sol | Allows updating the UniswapRouter in cases where liquidity is moved/ Create a uniswap pair for the new token | function updateUniswapRouter(address newRouterAddress) external onlyOwner {
IUniswapV2Router02 newRouter = IUniswapV2Router02(newRouterAddress);
IUniswapV2Factory newFactory = IUniswapV2Factory(newRouter.factory());
address newPair = newFactory.getPair(
address(this),
... | 2,617,113 |
pragma solidity 0.4.24;
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function bal... | Calculate the vested and unclaimed months and tokens available for `_grantId` to claim Due to rounding errors once grant duration is reached, returns the entire left grant amount Returns (0, 0) if cliff has not been reached For grants created with a future start date, that hasn't been reached, return 0, 0 If over vesti... | function calculateGrantClaim(address _recipient) public view returns (uint256, uint256) {
Grant storage tokenGrant = tokenGrants[_recipient];
if (currentTime() < tokenGrant.startTime) {
return (0, 0);
}
uint256 elapsedTime = currentTime().sub(tokenGrant.startTime);
... | 2,471,681 |
pragma solidity 0.5.11; // optimization runs: 200, evm version: petersburg
interface UpgradeBeaconControllerInterface {
function upgrade(address beacon, address implementation) external;
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(... | Internal function to ensure that a timelock is complete or expired and to clear the existing timelock if it is complete so it cannot later be reused. functionSelector function to be called. arguments The abi-encoded arguments of the function to be called./ Get timelock ID using the supplied function arguments. Get th... | function _enforceTimelock(
bytes4 functionSelector, bytes memory arguments
) internal {
bytes32 timelockID = keccak256(abi.encodePacked(arguments));
Timelock memory timelock = _timelocks[functionSelector][timelockID];
uint256 currentTimelock = uint256(timelock.complete);
uint256 expiration = u... | 12,797,105 |
./full_match/1/0x76E7BE90D0BF6bfaa2CA07381169654c6b45793F/sources/recharge.io/ropsten/token/RCG.sol | Add the value of the privilege granted through the allowance function | function upAllowance(address spender, uint256 addedValue) public returns (bool) {
require(spender != address(0), "Address cannot be 0x0");
_allowed[msg.sender][spender] = (_allowed[msg.sender][spender]+addedValue);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
| 9,688,082 |
// CryptoRabbit Source code
pragma solidity ^0.4.18;
/// @title A base contract to control ownership
/// @author cuilichen
contract OwnerBase {
// The addresses of the accounts that can execute actions within each roles.
address public ceoAddress;
address public cfoAddress;
address public cooAddress... | get fighter property | function getFighterInfo(uint32 _season, uint32 _index) external view returns (
uint outTokenID,
uint32 outStrength
) {
require(_index < 8);
uint key = _season * 1000 + _index;
Fighter storage soldier = soldiers[key];
require(soldier.strength > 0);
outToken... | 10,140,694 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-f... | Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), Reverts with custom message when dividing by zero. Counterpart to Solidity's `%` operator. This function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remain... | function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
| 193,186 |
pragma solidity ^0.4.21;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division o... | initialize a Congress contract address for this token _congress address the congress contract address/ | function initialCongress(address _congress) onlyOwner public {
require(_congress != address(0));
congress = _congress;
}
| 1,962,639 |
pragma solidity 0.6.6;
// uniswap router address = 0xcDbE04934d89e97a24BCc07c3562DC8CF17d8167;
// daiAddress = 0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa;
// cdaiAddress = 0x6D7F0754FFeb405d23C51CE938289d4835bE3b14;
// import "github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/SafeMath.sol";
//... | function deposit(uint256 daiAmount, address daiAddress, address cdaiAddress) underlying = IERC20(daiAddress); cToken = ICERC20(cdaiAddress);potsDaiBalance = potsDaiBalance.add(daiAmount); | function deposit(uint256 daiAmount)
public
checkState(States.OPEN)
whenNotPaused
nonReentrant
{
underlying = IERC20(0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa);
cToken = ICERC20(0x6D7F0754FFeb405d23C51CE938289d4835bE3b14);
require(
underlying.b... | 13,031,412 |
// 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;
/// @title IExternalPositionVault interface
/... | Allows extension to run logic during fund activation Unimplemented by default, may be overridden. | function activateForFund(bool) external virtual override {
return;
}
| 181,835 |
/**
*Submitted for verification at Etherscan.io on 2022-02-21
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/math/SafeMath.sol
// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)
pragma solidity 0.8.11;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 ... | set mutation base uri _mutationBaseUris set mutation base uri | function setmutationBaseURi(string[] memory _mutationBaseUris) external onlyOwner {
mutationBaseUri = _mutationBaseUris;
}
| 2,103,095 |
./full_match/5/0x7AbdbE7BD979D3326FD71afAe4858a58B34930C7/sources/lib/redstone-oracles-monorepo/packages/evm-connector/contracts/core/RedstoneConsumerBase.sol | This is an internal helpful function for secure extraction oracle values from the tx calldata. Security is achieved by signatures verification, timestamp validation, and aggregating values from different authorised signers into a single numeric value. If any of the required conditions (e.g. too old timestamp or insuffi... | function _securelyExtractOracleValuesFromTxMsg(bytes32[] memory dataFeedIds)
internal
view
returns (uint256[] memory)
{
uint256[] memory uniqueSignerCountForDataFeedIds = new uint256[](dataFeedIds.length);
uint256[] memory signersBitmapForDataFeedIds = new uint256[](dataFeedIds.length);
uint... | 1,950,866 |
pragma solidity 0.5.11;
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "./IErc20DepositVerifier.sol";
import {PaymentTransactionModel as DepositTx} from "../../transactions/PaymentTransactionModel.sol";
import {PaymentOutputModel as DepositOutputModel} from "../../transactions/outputs/Payment... | Overrides the function of IErc20DepositVerifier and implements the verification logic for payment transaction Vault address must be approved to transfer from the sender address before doing the deposit return Verified (owner, token, amount) of the deposit ERC20 token data/ | function verify(bytes calldata depositTx, address sender, address vault)
external
view
returns (
address owner,
address token,
uint256 amount
)
{
DepositTx.Transaction memory decodedTx = DepositTx.decode(depositTx);
require(dec... | 897,296 |
/**
*Submitted for verification at Etherscan.io on 2022-04-12
*/
// Sources flattened with hardhat v2.8.4 https://hardhat.org
// File @openzeppelin/contracts/access/[email protected]
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessContr... | Returns the amount of tokens that presale will recieve | function getPresaleCap() public view override returns (uint) {
return _presaleCap;
}
| 10,550,873 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {FxBaseChildTunnel} from "../../tunnel/FxBaseChildTunnel.sol";
import {Create2} from "../../lib/Create2.sol";
import {IFxERC20} from "../../tokens/IFxERC20.sol";
/**
* @title FxERC20ChildTunnel
*/
contract FxERC20ChildTunnel is FxBaseChildTunnel, Create... | deposit tokens call `onTokenTranfer` on `to` with limit and ignore error solium-disable-next-line security/no-inline-assembly | function _syncDeposit(bytes memory syncData) internal {
(
address rootToken,
address depositor,
address to,
uint256 amount,
bytes memory depositData
) = abi.decode(syncData, (address, address, address, uint256, bytes));
address chil... | 12,733,529 |
pragma solidity ^0.4.24;
// ----------------------------------------------------------------------------
// 'imChat' token contract
//
// Symbol : IMC
// Name : IMC
// Total supply: 1000,000,000.000000000000000000
// Decimals : 8
//
// imChat Technology Service Limited
// -----------------------... | 修改executorAddress,只有owner能够修改 _addr address 地址/ | function modifyExecutorAddr(address _addr) public onlyOwner {
executorAddress = _addr;
}
| 2,402,566 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0 <= 0.7.5;
import "./SmartDCPABEUsers.sol";
import "./Collection.sol";
/**
* @author Bruno C. P. Arruda
* @title SmartDCPABE Certifier Management Contract
* @notice This contract allow to register and find certifiers
*/
contract SmartDCPABEAuthority is Collect... | get certifier data addr the certifier's address return addr_ certifier's address return name certifier's name return email certifier's e-mail return numPublicKeys number of attributes published by the certifier/ | function getCertifier
(
address addr
)
public
view
returns
(
address addr_,
string memory name,
string memory email,
uint64 numPublicKeys
)
{
Certifier storage c = certifiers[addr];
return (c.addr, c.name, c.email, c... | 5,360,587 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC... | Specifies a new controller address. Can only be called by governance. _controller Address of the new controller. | function setController(address _controller) external governanceOnly {
controller = _controller;
}
| 5,948,779 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.0;
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./interfaces/IStaking.sol";
contract YieldFarm {
// lib
using SafeMath for uint;
using SafeMath f... | try to initialize an epoch. if it can't it fails if it fails either user either a BarnBridge account will init not init epochs exit if there is no stake on the epoch | function _harvest (uint128 epochId) internal returns (uint) {
if (lastInitializedEpoch < epochId) {
_initEpoch(epochId);
}
if (epochs[epochId] == 0) {
return 0;
}
return _totalAmountPerEpoch
.mul(_getUserBalancePerEpoch(msg.sender, epochId))
... | 1,829,783 |
/*
Copyright 2020 Set 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
Unless required by applicable law or agreed to in... | Calculate amount of tokens airdropped since last absorption, then distribute fees and update position. _setToken Address of SetToken _token Address of airdropped token/ | function _handleAirdropPosition(ISetToken _setToken, address _token) internal {
uint256 preFeeTokenBalance = ERC20(_token).balanceOf(address(_setToken));
uint256 amountAirdropped = preFeeTokenBalance.sub(_setToken.getDefaultTrackedBalance(_token));
if (amountAirdropped > 0) {
(... | 1,804,281 |
./full_match/1/0xCF810239F6266316D4Cfe2E478cD8d6be03ae1A6/sources/contracts/Comptroller.sol | Transfer COMP to the user Note: If there is not enough COMP, we do not perform the transfer all. user The address of the user to transfer COMP to amount The amount of COMP to (possibly) transfer return The amount of COMP which was NOT transferred to the user/ | function grantCompInternal(address user, uint amount) internal returns (uint) {
Dop comp = Dop(getCompAddress());
uint compRemaining = comp.balanceOf(address(this));
if (amount > 0 && amount <= compRemaining) {
comp.transfer(user, amount);
return 0;
}
... | 4,943,412 |
./full_match/3/0x8768F82F228269698f102F111b581A0B7018d688/sources/browser/DexToDexArb.sol | bytes4 c = bytes4(abc);bytes4 d = bytes4(keccak256("zzz"));bytes memory z = keccak256("zzz");bytes4 e = bytes4(b);bytes memory zz = 0x1254; LibBytes.writeAddress(a,a.length,address(this));return abi.encodePacked(a,address(this)); | function show81() public view returns (bytes memory) {
bytes memory a = bytes("1");
bytes memory abc = hex"12543466666776";
return abc;
}
| 8,194,651 |
./full_match/84531/0xce6525630B6cBC45F7DdC204a59022d8E39f560E/sources/src/utils/TransferHelperUtils.sol | Sends ETH to a recipient, making conservative estimates to not run out of gas recipient The address to send ETH to value The amount of ETH to send | function safeSendETH(address recipient, uint256 value, uint256 gasLimit) internal returns (bool success) {
}
| 11,523,143 |
//SPDX-License-Identifier:MIT
pragma solidity ^0.6.0;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure retur... | function to get Token lockstatus by id | function getTokenLockStatus(uint256 id) external view returns(bool){
require(id <= _tokenStakingCount,"Unable to reterive data on specified id, Please try again!!");
return _TokenTransactionstatus[id];
}
| 6,257,584 |
// 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 tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of... | Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements: - `account` cannot be the zero address. - `account` must have at least `amount` tokens./ | function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[acc... | 12,266,926 |
// Based on the smart contract for CryptoPunks:
// https://github.com/larvalabs/cryptopunks/blob/master/contracts/CryptoPunksMarket.sol
// Given that the CryptoPunks smart contract has performed well so far,
// I attempted to make as few changes as possible.
// Security upgrades include:
// Locked pragma to Solidit... | Circuit breaker activation | function toggleContractActive() isAdmin public {
stopped = !stopped;
}
| 7,316,648 |
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "openzeppelin-eth/contracts/token/ERC20/ERC20.sol";
import "openzeppelin-eth/contracts/token/ERC20/SafeERC20.sol";
import "openzeppelin-eth/contracts/math/SafeMath.sol";
import "openzeppelin-eth/contracts/utils/Address.sol";
/**
* @title ... | Tells the dependency associated to a given name. name String representing the dependency. return Tuple representing the elements of a Dependency struct./ | function getDependency(string name) public view returns(address, address, uint256) {
return (
_registry[name].dependencyAddress,
_registry[name].owner,
_registry[name].stake
);
}
| 7,274,006 |
./full_match/84531/0x52c853d209824Bc3aA462d5b20F810C01a870547/sources/src/utils/PublicMulticall.sol | Receives and executes a batch of function calls on this contract./ | {
results = new bytes[](data.length);
for (uint256 i = 0; i < data.length; i++) {
results[i] = Address.functionDelegateCall(address(this), data[i]);
}
}
| 11,521,204 |
pragma solidity 0.5.12;
import { Context } from "@openzeppelin/contracts/GSN/Context.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { IERC777 } from "@openzeppelin/contracts/token/ERC777/IERC777.sol";
import { IERC777Recipient } from "@openzeppelin/contracts/token/ERC777/IERC777R... | KEYDONIX: changed visibility from private to internal, we reference this function in derived contract Send tokens operator address operator requesting the transfer from address token holder address to address recipient address amount uint256 amount of tokens to transfer userData bytes extra information provided b... | function _send(address operator, address from, address to, uint256 amount, bytes memory userData, bytes memory operatorData, bool requireReceptionAck) internal {
require(from != address(0), "ERC777: send from the zero address");
require(to != address(0), "ERC777: send to the zero address");
_callTokensToSend(op... | 2,521,563 |
pragma solidity ^0.4.21;
/// @title SafeMath contract - Math operations with safety checks.
/// @author OpenZeppelin: https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
contract SafeMath {
function mulsm(uint256 a, uint256 b) internal pure returns (uint256) {
uint c =... | return in interface string encoded to bytes (max len 5 bytes) / | function stringToBytes5(string _data) public pure returns (bytes5) {
return bytes5(stringToBytes32(_data));
}
| 2,369,400 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { RolesMods } from "./RolesMods.sol";
import { RolesLib } from "./RolesLib.sol";
import { ADMIN } from "../../../shared/roles.sol";
contract RolesFacet is RolesMods {
/**
* @notice Checks if an account has a specific role.
* @param role Enco... | Removes a role from the sender. role Encoding of the role to remove./ | function renounceRole(bytes32 role) external {
RolesLib.revokeRole(role, msg.sender);
}
| 5,446,999 |
pragma solidity 0.4.21;
import "./HumanIdentityInterface.sol";
import "./zeppelin/ownership/Ownable.sol";
import "./zeppelin/math/SafeMath.sol";
/**
* @title HumanIdentityToken
* @author Adam Gall (adam@decentcrypto.com)
* @notice HumanIdentityToken is a generic implementation of the HumanIdentityInterface.
* This i... | Generates and returns a new `Verification` struct, given `oracleNonce`, `confidenceResult`, `user` (all from the offchain oracle's signed data), the contract's `identityProvider` and `confidenceThreshold, and the block's timestamp. oracleNonce Unique identifier from offchain oracle identity provider confidenceResult ... | function generateVerification
(
string oracleNonce,
uint confidenceResult,
address user
)
private
view
returns (Verification verification)
{
verification.oracleNonce = oracleNonce;
verification.confidenceResult = confidenceResult;
verification.user = user;
verification.threshol... | 12,795,435 |
./partial_match/1/0x0611d16e348D299d2265D4156B905fd17598585D/sources/src/Badges.sol | Allows an admin of the raft to mint a requested badge _to the person who is receiving the badge _uri the uri of the badge spec _signature the signature used to verify that the person receiving the badge actually requested it/ | function giveRequestedBadge(
address _to,
string calldata _uri,
bytes calldata _signature
) external virtual returns (uint256) {
uint256 raftTokenId = specDataHolder.getRaftTokenId(_uri);
require(
specDataHolder.isAuthorizedAdmin(raftTokenId, msg.sender),
"giveRequestedBadge: unauth... | 15,670,410 |
./partial_match/1313161554/0x548A76388D5A11C37a34f24be3560eFFf7289267/sources/_contracts/ReaperStrategyCompoundLeverage.sol | Deleverages one step/ redeemTokens = redeemAmountIn 1e18 / exchangeRate. must be more than 0 a rounding error means we need another small addition our borrow has been increased by no more than _releaseAmount | function _leverDownStep(uint256 _releaseAmount) internal returns (uint256 deleveragedAmount) {
uint256 supplied = cWant.balanceOfUnderlying(address(this));
uint256 borrowed = cWant.borrowBalanceStored(address(this));
(, uint256 collateralFactorMantissa, ) = comptroller.markets(address(cWant)... | 16,915,228 |
pragma solidity ^0.6.0;
// "SPDX-License-Identifier: UNLICENSED"
// import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol";
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
... | / claculate dai value of ERCI index and the next token that should be purchased number of ERCI to grant sender ! daiValue will include the current dai deposit | Call this function to purchase ERCI with DAI (must set dai allowance beforehand)
The index will buy the appropriate token from its registry and mint the sender their share of ERCI
function buyERCIWithDai(uint256 _daiAmount) public returns(bool) {
require(isActive, "Contract was shut dow... | 39,477 |
./full_match/97/0x84Dfd59e5C0d11683b2904e93c86bFF27D084EC6/sources/project_/contracts/facets/DiamondLoupeFacet.sol | Gets all facets and their selectors. return facets_ Facet create an array set to the maximum size possible create an array for counting the number of selectors for each facet total number of facets loop through function selectors find the functionSelectors array for selector and add selector to it probably will never h... | function facets() external view override returns (Facet[] memory facets_) {
LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage();
uint256 selectorCount = ds.selectors.length;
facets_ = new Facet[](selectorCount);
uint8[] memory numFacetSelectors = new uint8[](selectorCo... | 5,036,579 |
./full_match/1/0xa3F4fB87e19B60622bEA119C4469c0Df2c7c4739/sources/contracts/helpers/converter/GeneralTokenConverter.sol | Unwrap from one token to another token. _poolType The pool type. _encoding The customized encoding of the route. _amountIn The amount of input token. _recipient The address of output token receiver. return _amountOut The amount of output token. | ) internal returns (uint256 _amountOut) {
(address _tokenIn, address _tokenOut) = _getTokenPair(_poolType, 2, _encoding);
address _pool = address(_encoding & 1461501637330902918203684832716283019655932542975);
function _unwrap(
uint256 _poolType,
uint256 _encoding,
uint256 _amountIn,
addres... | 4,924,483 |
./full_match/1/0xDe45754ee61F9c487C49e45b96cC9DAf50F6d88b/sources/puff.sol | See {IERC20-transfer}. Requirements: - `to` cannot be the zero address. - the caller must have a balance of at least `amount`./ | function transfer(
address to,
uint256 amount
) public virtual override returns (bool) {
_transfer(msg.sender, to, amount);
return true;
}
| 4,969,082 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.8;
/// @dev Derived from https://github.com/OpenZeppelin/openzeppelin-contracts (MIT licence)
/// @dev See https://eips.ethereum.org/EIPS/eip-2771
library ERC2771Data {
/// @notice Returns the sender address appended at the end of the calldata, as specified in E... | Returns the sender address appended at the end of the calldata, as specified in ERC2771. | function msgSender() internal pure returns (address sender) {
assembly {
sender := shr(96, calldataload(sub(calldatasize(), 20)))
}
}
| 7,222,627 |
pragma solidity ^0.5.0;
library SafeMath
{
// Add two numbers
function add(uint256 a, uint256 b) internal pure returns (uint256)
{
// Add
uint256 c = a + b;
// Check for overflow
require(c >= a, "SafeMath: addition overflow");
// Return
return c;
... | Total supply Balance of an address Transfer Allowance Approve Transfer from address Event transfer Event aproval Event mint Event burn Event redeem | {
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 (uint256);
... | 5,489,471 |
./full_match/80001/0xf223384aD66483652974B35937A29C5586F4c375/sources/contracts/ERC20InvictusFund.sol | Set the maximum number of redemptions to be processed per dealing transaction. newDealingsPerTx The amount of dealings per dealing transaction. (redemptions and investments)/ | function setDealingsPerTx(uint24 newDealingsPerTx) external onlyOwner {
require(newDealingsPerTx > 0, "Invalid param");
maxDealingsPerTx = newDealingsPerTx;
}
| 864,442 |
./partial_match/42/0x5926aC2670d9026ABd786657E14e908389731d15/sources/LiquidityMine.sol | Emitted when the allowance of a spender for an owner is set by a call to approve. Value is the new allowance Emitted when value tokens are moved from one account (from) to another (to). Note that value may be zero Returns the amount of tokens in existence Returns the amount of tokens owned by account Returns the remain... | interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function totalSupply() external view returns (uint);
function balanceOf(address account) external view returns (uint);
function all... | 3,295,080 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.11;
pragma experimental ABIEncoderV2;
import "../StakingRewardsDualV3.sol";
contract StakingRewardsDualV3_FRAX_IQ is StakingRewardsDualV3 {
constructor(
address _owner,
address _rewardsToken0,
address _rewardsToken1,
address _st... | Two different getReward functions are needed because of delegateCall and msg.sender issues (important for migration) | function getReward() external returns (uint256, uint256) {
return _getReward(msg.sender, msg.sender);
}
| 1,275,971 |
pragma solidity ^0.4.23;
/*******************************************************************************
*
* Copyright (c) 2018 Taboo University MDAO.
* Released under the MIT License.
*
* Taboo Db - An eternal database, providing a sustainable storage solution
* for use throughout the upgrade lifecy... | _key The key for the record | function getBool(bytes32 _key) external view returns (bool) {
return boolStorage[_key];
}
| 619,614 |
./full_match/80001/0xdFf740c9C371062c11AFFa67C192c9484516d20E/sources/contracts/AddressRegistry.sol | Update ParagonsDAOToken contract address only owner _pdt ParagonsDAOToken contract address | function updatePDT(address _pdt) external onlyOwner {
if (_pdt == address(0)) revert ZeroAddress();
emit PDTUpdated(pdt, _pdt);
pdt = _pdt;
}
| 5,583,126 |
pragma solidity ^0.5.0;
import "../../STO/STO.sol";
import "../../../interfaces/IPolymathRegistry.sol";
import "../../../interfaces/IOracle.sol";
import "../../../libraries/DecimalMath.sol";
import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
... | This function returns whether or not the STO is in fundraising mode (open) return bool Whether the STO is accepting investments/ | function isOpen() public view returns(bool) {
if (isFinalized || now < startTime || now >= endTime || capReached()) return false;
return true;
| 15,808,852 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "../../BdStable/BDStable.sol";
import "../../Oracle/ICryp... | Will fail if fully collateralized or fully algorithmic > 0% and < 100% collateral-backed | function mintFractionalBdStable(
uint256 collateral_amount_in_max,
uint256 bdx_in_max,
uint256 bdStable_out_min,
bool useNativeToken
) external payable notMintPaused {
if (useNativeToken) {
require(is_collateral_wrapping_native_token, "Pool doesn't support nat... | 13,085,539 |
pragma solidity >=0.4.22 <0.6.0;
import './SafeMath.sol';
interface ERC20Interface {
function allowance(address, address) external view returns (uint);
function balanceOf(address) external view returns (uint);
function approve(address, uint) external;
function transfer(address, uint) external returns ... | get Eth address/ troller = 0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B; | function getEthAddress() public pure returns (address daiAddr) {
}
| 6,450,533 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.