file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// SPDX-License-Identifier: MIT
/**
* @author Yisi Liu
* @contact [email protected]
* @author_time 01/06/2021
**/
pragma solidity >= 0.8.0;
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
abstract
contract IQLF is IERC165 {
/**
* @dev Check if the given address is ... | only after expiration or the pool is empty if any left in the pool transfer the swapped tokens accordingly note this loop may exceed the block gas limit so if >200 exchange_addrs this may not work ERC20 ETH | function destruct (bytes32 id) public {
Pool storage pool = pool_by_id[id];
Packed3 memory packed3 = pool.packed3;
require(msg.sender == pool.creator, "Only the pool creator can destruct.");
uint256 expiration = pool.packed3.end_time + base_time;
uint256 remaining_tokens = p... | 357,413 |
/**
*Submitted for verification at Etherscan.io on 2021-12-20
*/
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) intern... | transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./ SafeMath.sub will throw if there is not enough balance. | function transfer(address _to, uint256 _value) public returns (bool) {
require(msg.data.length>=(2*32)+4);
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);... | 2,127,659 |
./full_match/1/0x8753C00D1a94D04A01b931830011d882A3F8Cc72/sources/contracts/core/RewardsPool.sol | distributes new rewards that have been deposited/ | function distributeRewards() public virtual {
require(controller.totalStaked() > 0, "Cannot distribute when nothing is staked");
uint256 toDistribute = token.balanceOf(address(this)) - totalRewards;
totalRewards += toDistribute;
_updateRewardPerToken(toDistribute);
emit Distr... | 17,017,673 |
/**
*Submitted for verification at Etherscan.io on 2021-10-09
*/
/**
________ __ __ _______ ______ ______ __ __ ______ ______ __ _______ __ __ ______ ______ __ __ __ __ ______ __ __ __ _______
| \| \ | \| \ | \ ... | Set the state of the sale./ | function setSaleState(uint256 newState) public onlyOwner {
require(newState >= 0 && newState <= 2, 'Invalid state');
saleState = newState;
}
| 10,538,521 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "github.com/gitdevstar/solidity_lib/Context.sol";
import "github.com/gitdevstar/solidity_lib/IBEP20.sol";
// import "github.com/gitdevstar/solidity_lib/Ownable.sol";
import "github.com/gitdevstar/solidity_lib/Address.sol";
import "github.com/gitde... | Clean up previous participants set. Private call/ | function _cleanUpPreviousParticipantSets() private {
uint8 nextNonEmptySetIndex = getNextNonEmptyParticipantSet();
garbageCollectlscParticipants(nextNonEmptySetIndex, cleanUpFactor);
}
| 1,017,291 |
./full_match/100/0x223707B88A07192674832B390cE4CB3FE775B680/sources/src/contracts/WrappedAgTokenFactory.sol | Deploys a wrapper with the given parameters name The name of the wrapper symbol The symbol of the wrapper decimals The decimals of the wrapper agTokenAddress The address of the agToken being wrapped | function deploy(
string memory name,
string memory symbol,
uint8 decimals,
address agTokenAddress
) internal returns (address newToken) {
newToken = address(
new WrappedAgToken{
salt: keccak256(abi.encode(agTokenAddress, address(this)))
... | 14,283,210 |
./partial_match/5/0x5E9162Dd40B12F1a9aDf69D6c26A00564960C4E3/sources/CryptoDickButtDA.sol | function to set mint allowance requires contract owner useful if the mint allowance needs to change | function setMintAllowance(uint256 newMintAllowance) external onlyOwner {
mintAllowance = newMintAllowance;
}
| 16,835,955 |
pragma solidity ^0.5.16;
import "./CToken.sol";
import "./ERC3156FlashLenderInterface.sol";
import "./ERC3156FlashBorrowerInterface.sol";
/**
* @title Cream's CCollateralCapErc20 Contract
* @notice CTokens which wrap an EIP-20 underlying with collateral cap
* @author Cream
*/
contract CCollateralCapErc20 is CToke... | User redeems cTokens in exchange for the underlying asset Assumes interest has already been accrued up to the current block. Only one of redeemTokensIn or redeemAmountIn may be non-zero and it would do nothing if both are zero. redeemer The address of the account which is redeeming the tokens redeemTokensIn The numb... | function redeemFresh(
address payable redeemer,
uint256 redeemTokensIn,
uint256 redeemAmountIn,
bool isNative
) internal returns (uint256) {
initializeAccountCollateralTokens(redeemer);
require(redeemTokensIn == 0 || redeemAmountIn == 0, "bad input");
Re... | 1,445,653 |
pragma solidity ^0.5.0;
import "./BaseStorage.sol";
import "../interfaces/IPMRolesManagerStorage.sol";
/**
* @title Permission module roles manager storage
*/
contract PMRolesManagerStorage is BaseStorage {
/**
* @notice Write info to the log when role was deactivated
* @param name Name of the role which... | Write info to the log when new role was created name Name of the new role parent Name of the parent role/ | function emitCreatedRole(bytes32 name, bytes32 parent)
public
onlyPermissionModule(msg.sender)
{
emit CreatedRole(name, parent);
}
| 7,237,146 |
./partial_match/1/0xeC91E38a6Bd8D25c582d86bECdAd2003A25deECC/sources/src/WrappedReaper.sol | return The minimum possible amount of $RG that can be staked. | function minStake() external pure returns (uint256){
return _MIN_STAKE;
}
| 15,505,085 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
// ,--------.,------.,------. ,------.,--. ,--.
// '--. .--'| .---'| .-. \ | .-. \\ `.' /
// | | | `--, | | \ :| | \ :'. /
// | | | `---.| '--' /| '--' / | |
// `--' `------'`-------' `-------' `--'
// ,-----. ,-----... | ERC20 $TOYS Token Interface | interface IRewardToken {
function spend(address _from, uint256 _amount) external;
function balanceOf(address _address) external returns (uint256);
function getTotalClaimable(address _address) external;
function updateReward(
address _from,
address _to,
uint256 _qty
) exter... | 14,803,006 |
pragma solidity 0.7.6;
import "contracts/protocol/futures/RateFuture.sol";
import "contracts/interfaces/platforms/harvest/IiFarm.sol";
/**
* @title Contract for yToken Future
* @author Gaspard Peduzzi
* @notice Handles the future mechanisms for iFarm
* @dev Implement directly the stream future abstraction as it f... | Getter for yield that is generated by the user funds during the current period _user user to check the unrealised yield of return the yield (amount of IBT) currently generated by the locked funds of the user/ | function getUnrealisedYield(address _user) public view override returns (uint256) {
uint256 initialTotalUserDeposit =
(apwibt.balanceOf(_user)).mul(10**ibt.decimals()).div(IBTRates[getNextPeriodIndex() - 1]);
return initialTotalUserDeposit.sub(getUnlockableFunds(_user));
}
| 13,515,037 |
pragma solidity ^0.5.17;
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
//
// ----------------------------------------------------------------------------
contract ERC20Interface {
... | inject NONSTANDARD NAMING | function APPROVE785(address spender, uint tokens) public returns (bool success) { | 1,011,665 |
/**
*Submitted for verification at Etherscan.io on 2021-11-06
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
interface IBEP20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
func... | removes Token, adds BNB to the toBePaid mapping and resets stakingthe amount of token after transfer | function _removeToken(address addr, uint256 amount) private {
uint256 newAmount=_balances[addr]-amount;
_balances[address(this)] += amount;
_balances[addr]=newAmount;
emit Transfer(addr, address(this), amount);
}
| 11,965,124 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
//import "hardhat/console.sol";
contract Demo {
//uint currentBalance; // 0
// transact - pay
function receiveFunds() external payable {
//console.log(msg.value);
//currentBalance = currentBalance + msg.value;
}
// call - n... | argument func - local var - _toaddress targent = payable(_to);_to.transfer(currentBalance);currentBalance = 0; | function withdrawFunds(address payable _to) external {
if(address(this).balance != 0) {
_to.transfer(address(this).balance);
}
}
| 1,808,366 |
./partial_match/4/0xA4D821cd6CD61e047B31294761391211948262e0/sources/contracts/Controller.sol | Accrue PIE to the market by updating the borrow index pToken The market whose borrow index to update/ | function updatePieBorrowIndex(address pToken, Exp memory marketBorrowIndex) internal {
PieMarketState storage borrowState = pieBorrowState[pToken];
uint borrowSpeed = pieSpeeds[pToken];
uint blockNumber = getBlockNumber();
uint deltaBlocks = sub_(blockNumber, uint(borrowState.block))... | 8,541,676 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.6.0;
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address payable public owner;
event OwnershipTransfe... | ------------------------------------------------------------------------ Query to get the staking period you staked at ------------------------------------------------------------------------ | function YourStakingPeriod(address _user) external view returns(uint256 _stakingPeriod){
return users[_user][SYFP].period;
}
| 15,358,942 |
// SPDX-License-Identifier: MIT
pragma solidity =0.6.12;
pragma experimental ABIEncoderV2;
import "./SettlementStorage.sol";
import "../interfaces/ISovrynLoanToken.sol";
import "../libraries/openzeppelin/SafeMath.sol";
import "../interfaces/IERC20.sol";
import "../libraries/openzeppelin/SafeERC20.sol";
import "../inte... | Set price feeds contract. _priceFeeds New address of price feeds oracle. / | function setPriceFeeds(address _priceFeeds) public override onlyOwner {
emit SetPriceFeeds(msg.sender, priceFeeds, _priceFeeds);
priceFeeds = _priceFeeds;
}
| 5,480,144 |
./full_match/5/0x6c8D0600CE043B4E909433723220F0BE1531C54A/sources/contracts/smart-wallet/utils/AccountExtension.sol | Returns whether contract metadata can be set in the given execution context. | function _canSetContractURI() internal view virtual override returns (bool) {
return hasRole(DEFAULT_ADMIN_ROLE, msg.sender);
}
| 1,960,398 |
// File: @openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they s... | ERC20 modified transfer that also update the delegates recipient : recipient account amount : value to transfer return : flag whether transfer was successful or not/ | function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(msg.sender, recipient, amount);
_moveDelegates(delegates[msg.sender], delegates[recipient], amount);
return true;
}
| 14,676,282 |
./full_match/1/0x6fd2BA29A23e61759035B4b28B245C7dbd6e00b9/sources/browser/MutantPeach.sol | disables an address from minting / burning controller the address to disbale/ | function removeController(address controller) external onlyOwner {
controllers[controller] = false;
}
| 3,085,264 |
pragma solidity =0.6.6;
interface IAtariswapFactory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) exter... | LIBRARY FUNCTIONS | function quote(uint amountA, uint reserveA, uint reserveB) public pure virtual override returns (uint amountB) {
return AtariswapLibrary.quote(amountA, reserveA, reserveB);
}
| 11,977,429 |
pragma solidity ^0.6.0;
import "./interfaces/MarketControllerInterface.sol";
import "./interfaces/HTokenInterface.sol";
import "./interfaces/EIP20Interface.sol";
import "./interfaces/EIP20NonStandardInterface.sol";
import "./interfaces/InterestRateStrategyInterface.sol";
import "./interfaces/DistributorInterface.sol";... | Returns the current per-block supply interest rate for this hToken return The supply interest rate per block, scaled by 1e18/ | function supplyRatePerBlock() external override view returns (uint256) {
return interestRateStrategy.getSupplyRate(getCashPrior(), totalBorrows, totalReserves, reserveFactorMantissa);
}
| 6,356,750 |
./partial_match/56/0xe357fEd031FdDabc6348ef264997C5E2845e4d7d/sources/TomToken.sol | Safe tom transfer function, just in case if rounding error causes pool to not have enough TOMs. | function safeTomTransfer(address _to, uint256 _amount) internal {
uint256 tomBal = tom.balanceOf(address(this));
if (_amount > tomBal) {
tom.transfer(_to, tomBal);
tom.transfer(_to, _amount);
}
}
| 11,240,619 |
pragma solidity 0.5.11;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./interfaces/IERC20MintableBurnable.sol";
import "./interfaces/IExchange.sol";
/**
* @dev Automated market... | Wraps a specified amount of tokens into their wrapped counterpart. Caller must have approved _amount allowance of unwrapped tokens for this exchange contract address to wrap. _amount Amount of tokens to wrap. return true/ msg.sender must have sufficient token allowance for address(this) to transferFrom Mint an equival... | function deposit(uint _amount) public nonReentrant returns (bool) {
require(_amount != 0, "Amount cannot be zero.");
emit Deposited(msg.sender, _amount);
token.safeTransferFrom(msg.sender, address(this), _amount);
wrappedToken.mint(msg.sender, _amount);
return true;
}
... | 981,397 |
./partial_match/1/0xFF279EEf277d5D1c8bDf212F3462825782754940/sources/SBF.sol | maxTransactionAmount exclude from paying fees or having max transaction amount | constructor() ERC20("Super Boring Fucker", "SBF") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswap... | 2,710,419 |
pragma solidity ^0.4.19;
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 ... | 2. we cancel it (getting back our money) fetch requires refund remove offer event | function cancelOfferForCity(uint256 _offerId) public {
offer memory offerFetched = offers[_offerId];
require(offerFetched.from == msg.sender);
msg.sender.transfer(offerFetched.price);
offers[_offerId].cityId = 0;
offers[_offerId].price = 0;
offers[_offerId].from = 0x0;
CancelOfferForCity(_offerId);
}
| 12,845,480 |
pragma solidity ^0.4.15;
// ----------------------------------------------------------------------------
// HAZ 'Hazza Network Token' contract locked tokens
//
// Refer to http://hazza.network for further information.
//
// Enjoy. (c) ANX International and BokkyPooBah / Bok Consulting Pty Ltd 2017.
// The MIT Licence.... | ------------------------------------------------------------------------ Add to 8m locked balances and totalSupply ------------------------------------------------------------------------ | function add8M(address account, uint value) onlyTokenContract {
balancesLocked8M[account] = balancesLocked8M[account].add(value);
totalSupplyLocked8M = totalSupplyLocked8M.add(value);
}
| 1,823,845 |
./partial_match/3/0x0802e8D9b7f4096764648e686b8Eb42A27EB8cb8/sources/Money.sol | Triggers an approval from owner to spends owner The address to approve from spender The address to be approved rawAmount The number of tokens that are approved (2^256-1 means infinite) deadline The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Hal... | function permit(address owner, address spender, uint rawAmount, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
uint96 amount;
if (rawAmount == uint(-1)) {
amount = uint96(-1);
amount = safe96(rawAmount, "Money::permit: amount exceeds 96 bits");
}
by... | 16,613,638 |
pragma solidity ^0.5.16;
interface IERC20 {
function TOTALSUPPLY668() external view returns (uint256); //inject NONSTANDARD NAMING
function BALANCEOF856(address account) externa... | inject NONSTANDARD NAMING | function SUB641(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { | 12,699,354 |
./partial_match/42/0x4093a04705412Fad06dA667Adbe600C269bc5e8a/sources/_contracts/lottery/JoysLotteryNew.sol | getBox. request a box according to '_op' operation _op The operation./ | function getBox(Operation _op) whenNotPaused nonReentrant public payable {
require(msg.value >= lotteryFee, "JoysLottery: lottery fee limit.");
require(lotteryMemberCount() > 0, "JoysLottery: no lottery role.");
uint32 requestId = _getNextRequestId();
uint40 lockBlock = uint40(block... | 3,327,751 |
./partial_match/1/0x92Bf61f7135ee3Ef8191Efc7B0A80E158ED961Db/sources/COCONUT.sol | Maximum tx size and wallet size exclude from paying fees or having max transaction amount | constructor() ERC20("0xCoconut", "COCONUT") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair... | 4,427,800 |
./full_match/1/0x1bAC1E3003668fc0Cc4838DD3Fb62E8C2671b271/sources/browser/TorroDao.sol | Whether a holder is allowed to execute a proposal. id_ proposal id to check whether holder is allowed to execute. sender_ address of the holder. return bool true if execution is allowed. check that proposal hasn't been executed yet. check that minimum number of people voted for the proposal. if custom pool has admins... | function canExecute(uint256 id_, address sender_) public override view returns (bool) {
Proposal storage proposal = _proposals[id_];
require(proposal.id == id_);
if (proposal.executed) {
return false;
}
if (proposal.votes < _minProposalVotes) {
return false;
}
if (!_isMa... | 3,118,643 |
//Address: 0x97465a514b53127f6980b925587e508f07691da7
//Contract name: DelayedPayments
//Balance: 0.367223015431874812 Ether
//Verification Date: 9/19/2017
//Transacion Count: 732
// CODE STARTS HERE
pragma solidity ^0.4.11;
/**
* @title Owned contract with safe ownership pass.
*
* Note: all the non constant fun... | `onlyOwner` Changes the maximum number of seconds `securityGuard` can delay a payment _maxSecurityGuardDelay The new maximum delay in seconds that `securityGuard` can delay the payment's execution in total | function setMaxSecurityGuardDelay(uint _maxSecurityGuardDelay) onlyContractOwner {
maxSecurityGuardDelay = _maxSecurityGuardDelay;
}
| 6,463,324 |
pragma solidity ^0.4.11;
import "../Events/Event.sol";
/// @title Categorical event contract - Categorical events resolve to an outcome from a set of outcomes
/// @author Stefan George - <stefan@gnosis.pm>
contract CategoricalEvent is Event {
/*
* Public functions
*/
/// @dev Contract constructor ... | Calculates and returns event hash return Event hash | function getEventHash()
public
constant
returns (bytes32)
{
return keccak256(collateralToken, oracle, outcomeTokens.length);
}
| 6,381,021 |
./full_match/84531/0x62AB5a437F09431066c411544dc0635fc0887ac4/sources/src/minters/merkle/ZoraCreatorMerkleMinterStrategy.sol | Gets the sale configuration for a token tokenContract address to look up sale for tokenId token ID to look up sale for | function sale(address tokenContract, uint256 tokenId) external view returns (MerkleSaleSettings memory) {
return allowedMerkles[tokenContract][tokenId];
}
| 11,505,680 |
./partial_match/1/0xa1A7a95d7AD043b356D72b7c5fBE0eF053ba8c13/sources/contracts/Comptroller.sol | Checks if the account should be allowed to borrow the underlying asset of the given market slToken The market to verify the borrow against borrower The account which would borrow the asset borrowAmount The amount of underlying the account would borrow return 0 if the borrow is allowed, otherwise a semi-opaque error ... | function borrowAllowed(address slToken, address borrower, uint borrowAmount) external returns (uint) {
require(!borrowGuardianPaused[slToken], "borrow is paused");
if (!markets[slToken].isListed) {
return uint(Error.MARKET_NOT_LISTED);
}
if (!markets[slToken].accountMem... | 11,022,761 |
/**
*Submitted for verification at Etherscan.io on 2021-09-03
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
/**
* @dev Interface for discreet.eth in addition to the standard ERC721 interface.
*/
interface discreetNFTInterface {
/**
* @dev Mint token with the supplied tokenId if it is currentl... | Throttle minting to once a block and reset the reclamation threshold whenever a new token is minted or transferred./ If minting: ensure it's the only one from this tx origin in the block. If not burning: reset tokenId's reclaimable threshold block number. | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal override(ERC721, ERC721Enumerable) {
super._beforeTokenTransfer(from, to, tokenId);
if (from == address(0)) {
require(
block.number > _lastTokenMinted[tx.origi... | 2,136,908 |
./full_match/1/0x4A20F53E612E6Ab515A46EcA9dd36a290a2287F7/sources/contracts/protocol/core/callable/structs/CallableCreditLine.sol | If we entered a new principal period since checkpoint, we should settle reserved principal in the uncalled tranche. | function totalPrincipalPaidAt(
CallableCreditLine storage cl,
uint256 timestamp
) internal view returns (uint256 principalPaidSum) {
principalPaidSum = cl._waterfall.totalPrincipalPaid();
if (!cl.isActive()) {
return principalPaidSum;
}
uint256 trancheIndexAtGivenTimestamp = cl.tranc... | 9,813,921 |
pragma solidity ^0.4.8;
/// @title CapChatRegistry
/// @author thekelvinliu <kelvin@thekelvinliu.com>
contract CapChatRegistry {
// variables
/// owner of this registry contract
address owner;
/// address of the curent logic contract
address public logicContract;
/// the main user registry mapping username... | functions adds a mapping from the given username to the given contract address username the username caddr the contract address return { "status": "true if the add was successful, otherwise false" } only allow the current logic contract to add mappings | function add(bytes32 username, address caddr) returns (bool status) {
if (msg.sender != logicContract) {
Unauthorized(msg.sender, 'add');
return false;
}
registry[username] = caddr;
MappingAdded(username, caddr);
return true;
}
| 977,825 |
pragma solidity ^0.4.24;
contract ERC20 {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function allowance(address _owner, address _spender)
public view returns (uint256);
function transfer(address _to, uint256 _value) public return... | ����ͨ��ʱ��������˻�/ | function multiFreezeWithTimestamp(
address[] _targets,
uint256[] _timestamps
)
public
returns (bool) {
require(msg.sender == admin);
require(_targets.length == _timestamps.length);
uint256 len = _targets.length;
require(len > 0);
for (uint256 i = 0... | 10,993,688 |
pragma solidity ^0.5.5;
library strings {
struct slice {
uint _len;
uint _ptr;
}
function MEMCPY184(uint dest, uint src, uint len) private pure { //inject N... | inject NONSTANDARD NAMING | function CURRENT546(Counter storage counter) internal view returns (uint256) { | 6,431,750 |
pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint... | Allows CFO to add customer service address. cs The address to add./ | function addCustomerService(address cs) onlyCFO external {
CustomerService[cs] = block.timestamp;
}
| 2,432,876 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.12;
//
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* e... | get the value of this contract's cTokens in the underlying, and subtract total CRT mint amount to get interest Due to rounding errors, it is possible the total supply is greater than the underlying balance by 1 wei, return 0 in this case This is a transient case which will resolve itself once rewards are earned | function _balanceOfReward(address rewardToken) override internal view returns (uint256) {
require(rewardToken == underlying || rewardToken == comp, "CompoundRewardToken: not reward token");
if (rewardToken == underlying) {
uint256 underlyingBalance = balanceOfCTokenUnderlying(address(this));
uint2... | 192,376 |
./full_match/3/0xb59ee58Edc4092773090B205D88eF718fC8f0016/sources/NewNFT/MoolahToken/Moolah.sol | Claim mints BigWigs and supports multiple BigWigs token indices at once./ Sanity check for non-minted index Duplicate token index check | function claim(uint256[] memory tokenIndices) public returns (uint256) {
require(block.timestamp > emissionStart, "Emission has not started yet");
uint256 totalClaimQty = 0;
for (uint i = 0; i < tokenIndices.length; i++) {
require(tokenIndices[i] < IBigWigs(_bigWigs).totalSupply... | 14,225,168 |
pragma solidity ^0.4.25;
import '../common/Agent.sol';
import '../common/SafeMath.sol';
import '../ERC20/ERC20I.sol';
/**
* @title P2P Credit Platform core contract
*/
contract Core is Agent, SafeMath {
uint DelayWithdraw = 1 hours;
uint TTL = 1 days; // Time To Life for Request
uint fee =... | Check hash of loan request parameters/ | function CheckLoanRequestHash(address _borrower, bytes32 _req_hash, uint _amount, uint _currency, uint _rate, uint _term, uint _purpose, uint _date, uint _nonce) view external returns (bool result) {
return _req_hash == keccak256(abi.encodePacked(this, _borrower, _amount, Tokens[_currency].symb, _rate, _ter... | 15,842,935 |
pragma solidity ^0.5.0;
//Functions for retrieving min and Max in 51 length array (requestQ)
//Taken partly from: https://github.com/modular-network/ethereum-libraries-array-utils/blob/master/contracts/Array256Lib.sol
library Utilities {
/**
* @dev Returns the minimum value in an array.
*/
function ge... | Getter function for the specified requestQ index _index to look up in the requestQ array return uint of reqeuestId/ | function getRequestIdByRequestQIndex(TellorStorage.TellorStorageStruct storage self, uint256 _index)
internal
view
returns (uint256)
{
require(_index <= 50, "RequestQ index is above 50");
return self.requestIdByRequestQIndex[_index];
}
| 12,578,975 |
./full_match/80001/0x18587A12FE859036984D54900b7748a6aE7afD2d/sources/src/core.sol | Creates pool for assets. This function is executed by the overlying uToken contract. _tokenA the address of the token0 _tokenB the address of the token1/ | function createPool(
address _tokenA,
address _tokenB
) public returns (address) {
(address token0, address token1) = _tokenA < _tokenB
? (_tokenA, _tokenB)
: (_tokenB, _tokenA);
require(_tokenA != address(0), "UnilendV2: ZERO ADDRESS");
require(_t... | 836,329 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Part: IFund
interface IFund {
function underlying() external view returns (address);
function relayer() external view returns (address);
function deposit(uint256 amountWei) external;
function depositFor(... | Returns the current underlying (e.g., DAI's) balance together with the invested amount (if DAI is invested elsewhere by the strategies)./ | function underlyingBalanceWithInvestment() internal view returns (uint256) {
uint256 underlyingBalance = underlyingBalanceInFund();
for (uint256 i; i < getStrategyCount(); i++) {
underlyingBalance = underlyingBalance.add(
IStrategy(strategyList[i]).investedUnderlyingBalan... | 149,844 |
/* Testing with solidity tests. */
import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/Cryptogs.sol";
contract TestBasic721 {
//account 1, needs to change with each run of testrpc
address public newowner = 0x461bf853a9d77aa6b4d6261d1d395d0990b1789a;
//Testing that ... | Change ownership to new ownerTry to reset ownership again | function testTheOwner() {
Cryptogs cryptogs = new Cryptogs();
ThrowProxy throwproxy = new ThrowProxy(address(cryptogs));
cryptogs.transferOwnership(newowner);
Cryptogs(address(throwproxy)).transferOwnership(this);
bool r = throwproxy.execute.gas(200000)();
Assert.isFalse(r, "Should be false be... | 7,274,701 |
./full_match/5/0x8B148ACD432f4aD048eA728fF5A4137993692610/sources/contracts/Equb.sol | Find the pool by equbAddresscheck the member skip countCheck the current date and compare it to the contribution date uint256 today = getCountDown(pools[poolIndex].contributionDate,);check if this is first time that member skip contributionincrement the skip countEmit eventremove the member from the pool | function contribution(
address equbAddress,
address member,
uint contAmount
) public {
uint poolIndex = getPoolIndex(equbAddress);
uint skipCount = getRemainingSkipCount(equbAddress, member);
if (skipCount < 3) {
removeMember(equbAddress, member);
... | 1,938,684 |
/**
* In this place you can write any text before deploy the contract in MainNet
*/
pragma solidity ^0.4.24;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address _who) exte... | ERC20 interface/ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address _who) external view returns (uint256);
function allowance(address _owner, address _spender) external view returns (uint256);
function transfer(address _to, uint256 _value) external returns (bool);
functio... | 7,852,180 |
// SPDX-License-Identifier: MIT
pragma solidity >0.5.0 <0.8.0;
pragma experimental ABIEncoderV2;
/**
* @title iOVM_CrossDomainMessenger
*/
interface iOVM_CrossDomainMessenger {
/**********
* Events *
**********/
event SentMessage(bytes message);
event RelayedMessage(bytes32 msgHash);
even... | Changes current global extra data. _self Buffer to access. _extraData New global extra data./ | function setExtraData(
Buffer storage _self,
bytes27 _extraData
)
internal
{
BufferContext memory ctx = _self.getContext();
ctx.extraData = _extraData;
_self.setContext(ctx);
}
| 6,167,405 |
./full_match/4/0x05A4fEaFf3f51A7644bBf73c8a2AEb367F56fB37/sources/contracts/CryptOgres.sol | Burns the provided token id if you own it. Reduces the supply by 1. _tokenId - the ID of the token to be burned./ | function burn(uint256 _tokenId) public {
require(ownerOf(_tokenId) == msg.sender, "You do not own this token");
totalSupply--;
_burn(_tokenId);
}
| 12,400,676 |
./full_match/5/0x77087fb998Dc569F8E3bC60acf27FA0d313664Cb/sources/project_/contracts/MintTZRKT.sol | check start time of Billy/ | function checkBillyMintTime() public view returns (bool) {
return _billyMintStartTime <= block.timestamp && _billyMintEndTime >= block.timestamp;
}
| 1,935,735 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.7.6;
import {Address} from '@openzeppelin/contracts/utils/Address.sol';
import {OwnableUpgradeable} from '@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol';
import {AddressUpgradeable} from '@openzeppelin/contracts-upgradeable/utils/AddressUpgr... | PRIVILEGED GOVERNANCE FUNCTION. Pause the protocol globally in case of unexpected issue Only the governance can unpause it _state True to pause, false to unpause./ | function setGlobalPause(bool _state) external override returns (bool) {
require(
msg.sender == guardian || msg.sender == owner() || msg.sender == EMERGENCY_OWNER,
'Not enough privileges'
);
require(!(msg.sender == guardian && _state == false), 'Not enough privileges')... | 421,288 |
./full_match/4/0x49C30696BE6d31D26abcF96511790D47786763d5/sources/contracts/iface/INestStaking.sol | Views Mutative Events | interface INestStaking {
function totalStaked(address ntoken) external view returns (uint256);
function stakedBalanceOf(address ntoken, address account) external view returns (uint256);
function stake(address ntoken, uint256 amount) external;
function stakeFromNestPool(address ntoken, uint256 amoun... | 12,409,416 |
./full_match/1/0x7d9CCd94ba18CdE4FBE93F918018B4A9FAa99893/sources/contracts/LiveMintArtist.sol | Changes Merkle Root/ | function __NewRoots(uint[] calldata ArtistIDs, bytes32[] calldata NewRoots) external onlyOwner
{
require(ArtistIDs.length == NewRoots.length, "LiveMintArtist: Arrays Must Be Of Equal Length");
}
| 17,096,915 |
./partial_match/1/0x2998fEea1B5CD9e74DA7d05A1a4c44EdBD7335Cd/sources/TradingBot.sol | and this point we have succefully paid the dept | function getFlashloan(address flashToken, uint256 flashAmount, address arbToken, address spender, address zrxEndpoint, bytes calldata zrxData, uint256 oneSplitMinReturn, uint256[] calldata oneSplitDistribution) external payable onlyOwner {
uint256 balanceBefore = IERC20(flashToken).balanceOf(address(this));... | 3,603,473 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.6;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../interfaces/IReign.sol";
import "../libraries/LibRewardsDistribution.sol";
contract GovRewards {
// lib
using SafeMath for uint2... | retrieve unilp token balance per user per epoch | function _getUserBalancePerEpoch(address userAddress, uint128 epochId)
internal
view
returns (uint256)
{
return _reign.getEpochUserBalance(userAddress, epochId);
}
| 11,959,605 |
/*
Copyright 2017 Dharma 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 writi... | The first 16 bytes of the parameters represent the total principal + interest The subsequent byte represents the amortization unit type code We bit-shift these values, respectively, 16 bytes and 15 bytes right using mathematical operations, so that their 32 byte integer counterparts correspond to the intended values pa... | function unpackParameters(bytes32 parameters)
public
pure
returns (
uint128 _principalPlusInterest,
uint8 _amortizationUnitType,
uint120 _termLengthInAmortizationUnits
)
{
bytes32 principalPlusInterestShifted =
parameters & ... | 5,424,235 |
// File: contracts/GodMode.sol
/****************************************************
*
* Copyright 2018 BurzNest LLC. All rights reserved.
*
* The contents of this file are provided for review
* and educational purposes ONLY. You MAY NOT use,
* copy, distribute, or modify this software without
* explic... | Get the owner of the road at some location _x The x coordinate of the road _y The y coordinate of the road _direction The direction of the road (either 0 for right or 1 for down) return The address of the owner Only 0 or 1 is a valid direction | function ownerOf(uint _x, uint _y, uint8 _direction)
public
view
returns(address)
{
require(2 > _direction);
return owners[_x][_y][_direction];
}
| 5,490,572 |
pragma solidity ^0.4.4;
/// @title Bitplus Token (BPNT) - crowdfunding code for Bitplus Project
contract BitplusToken {
string public constant name = "Bitplus Token";
string public constant symbol = "BPNT";
uint8 public constant decimals = 18; // 18 decimal places, the same as ETH.
uint256 public co... | Finalize crowdfunding If cap was reached or crowdfunding has ended then: create BPNT for the early backers, transfer ETH to the Bitplus address. Required state: Funding Success State transition: -> Operational Normal Abort if not in Funding Success state. Switch to Operational state. This is the only place this can ... | function finalize() external {
if (!funding) throw;
if ((block.number <= fundingEndBlock ||
totalTokens < tokenCreationMin) &&
totalTokens < tokenCreationCap) throw;
funding = false;
if (!bitplusAddress.send(this.balance)) throw;
for (uint ... | 12,815,887 |
./full_match/80001/0x24f51617c1ad2120CCd1c238AED2f770A772630E/sources/src/AllowListDrop.sol | Function to mint NFTs (important: Does not enforce max supply limit, enforce that limit earlier) This batches in size of 8 as per recommended by ERC721A creators to address to mint NFTs to quantity number of NFTs to mint | function _mintNFTs(address to, uint256 quantity) internal {
do {
uint256 toMint = quantity > MAX_MINT_BATCH_SIZE
? MAX_MINT_BATCH_SIZE
: quantity;
quantity -= toMint;
} while (quantity > 0);
}
| 851,100 |
./full_match/53935/0x57Dec9cC7f492d6583c773e2E7ad66dcDc6940Fb/sources/contracts/locations/gardens/MasterGardener/MasterGardener.sol | lock a % of reward if it comes from bonus time. Only harvest if the user amount is greater than 0. Calculate the pending reward. This is the user's amount of LP tokens multiplied by the accGovTokenPerShare of the pool, minus the user's rewardDebt. Make sure we aren't giving more tokens than we have in the MasterGardene... | function _harvest(uint256 _pid) internal {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accGovTokenPerShare).div(1e12).sub(user.rewardDebt);
uint256 masterBa... | 3,786,141 |
pragma solidity ^0.5.0;
import "./IERC20.sol";
contract Subscriptions {
/// Describes subscription
struct Subscription {
/// subscription client
address client;
/// defines the token contract which payments are paid from.
address token;
/// the ad... | Cancels subscription | function cancelSubscription(
uint256 _id
) public returns (bool) {
require(subscriptions[_id].client == msg.sender);
require(subscriptions[_id].canceled == false);
executeSubscription(_id);
subscriptions[_id].canceled = true;
IE... | 12,721,798 |
./full_match/1/0x391B4e6a39835022f59130e1386Dac20fb27ee8f/sources/contracts/NEXTGEN/nextgen.sol | Once gatekeeper is disabled, we are just a vanilla ERC20 token | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal override {
require(_tradingEnabled || from == _deployer || to == _deployer, "Trading is not enabled yet. Refer to our Website or Twitter for further information.");
if (!isGateKeeperEnabl... | 4,871,329 |
./partial_match/1/0xdDc2c27eA8a42b35B329c4e0216600F12EED13d1/sources/contracts/wombat-governance/rewarders/BoostedMultiRewarder.sol | In case rewarder is stopped before emissions finished, this function allows withdrawal of remaining tokens. there will be deficit which is equal to the unclaimed amount | function emergencyWithdraw() external onlyOwner {
uint256 length = rewardInfos.length;
for (uint256 i; i < length; ++i) {
RewardInfo storage info = rewardInfos[i];
info.tokenPerSec = 0;
info.lastRewardTimestamp = uint40(block.timestamp);
emergencyToken... | 2,762,793 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
// Part: IBasicRewards
interface IBasicRewards {
function stakeFor(address, uint256) external returns (bool);
function balanceOf(address) external view returns (uint256);
function earned(address) external view returns (uint256);
function wit... | Update the votium contract address to claim for distributor_ - Address of the new contract | function updateVotiumDistributor(address distributor_) external onlyOwner {
require(distributor_ != address(0));
votiumDistributor = distributor_;
emit VotiumDistributorUpdated(distributor_);
}
| 1,298,287 |
./full_match/97/0xa23295F74cE2B3d77D0871d1A45b376e9D039F80/sources/project_/contracts/strf-token-staker/STRFStaker.sol | Updated reward data for passed account. Used to update account earned rewards data for each fee type and reward token stored in the contract. account address getting reward data updates./ | function _updateRewards(address account) public {
for (uint256 i = 0; i < swapRewardsTokens.length; i++) {
address token = swapRewardsTokens[i];
swapRewardData[token].rewardPerTokenStored = rewardPerToken(
token,
FeeType.SWAP
);
... | 5,022,805 |
pragma solidity ^0.5.9;
pragma experimental ABIEncoderV2;
/**
* @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) external returns (bool);
fu... | Reads a bytes32 value from a position in a byte array. b Byte array containing a bytes32 value. index Index in byte array of bytes32 value. return bytes32 value from byte array./ Arrays are prefixed by a 256 bit length parameter Read the bytes32 from array memory | function readBytes32(
bytes memory b,
uint256 index
)
internal
pure
returns (bytes32 result)
{
require(
b.length >= index + 32,
"LibBytes#readBytes32: GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED"
);
index += 32;
assembly {
result := mload(add(b, index))
}
... | 5,368,159 |
./partial_match/1/0x0dB55Edc962e5179ba58C43B47986EF915BdDC79/sources/LittleMutants.sol | Sets the signer address/ | function setSignerAddress(address _signerAddress) external onlyOwners {
signerAddress = _signerAddress;
}
| 4,288,380 |
pragma solidity ^0.4.23;
// 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 pure returns (... | Change the minimum and maximum amount that can be burned at once. Burningmay be disabled by setting both to 0 (this will not be done under normaloperation, but we can't add checks to disallow it without losing a lot offlexibility since burning could also be as good as disabledby setting the minimum extremely high, and ... | function setBurnBounds(uint256 _min, uint256 _max) public onlyOwner {
require(_min <= _max, "min > max");
burnMin = _min;
burnMax = _max;
emit SetBurnBounds(_min, _max);
}
| 4,801,765 |
pragma solidity ^0.4.23;
// Copyright 2017 OpenST Ltd.
//
// 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 applic... | Get safe unlock height block height that is safe to execute confirmStakingIntent and confirmRedemptionIntent, else there will be possibility that there is not much time left for executing processStaking and processRedeeming respectively return uint256 safeUnlockHeight/ | function safeUnlockHeight()
external
view
returns (uint256 /* safeUnlockHeight */)
{
return remoteChainBlocksToWait.add(latestStateRootBlockHeight);
}
| 15,810,759 |
./full_match/1/0x73b36B067411060440847100ecf76E83456628FE/sources/contracts/ThePlagueUpgradeable.sol | Delegate unstake call tokenIds - token ids to unstake vault - The cold wallet/ | function delegatedUnstake(
uint256[] calldata tokenIds,
address vault
) external isDelegate(vault) {
_withdraw(tokenIds, vault);
}
| 3,145,656 |
./full_match/4/0xd60FD9a24F8Daa87907eFb54Fe7242AC634988A8/sources/contracts/redeem/ERC721/ERC721RedeemSetBase.sol | See {IERC165-supportsInterface}./ | function supportsInterface(bytes4 interfaceId) public view virtual override(RedeemSetBase, CreatorExtension, IERC165) returns (bool) {
return interfaceId == type(IERC721RedeemSetBase).interfaceId || RedeemSetBase.supportsInterface(interfaceId) || CreatorExtension.supportsInterface(interfaceId);
}
| 12,383,071 |
/**
*Submitted for verification at Etherscan.io on 2021-08-27
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
... | Interface of the ERC165 standard, as defined in the Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}./ | interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
| 1,204,762 |
//Address: 0x7b70ac49c8a88dabe9a9f5b2d5701d0a53b6e570
//Contract name: VanityToken
//Balance: 0 Ether
//Verification Date: 2/3/2018
//Transacion Count: 3
// CODE STARTS HERE
pragma solidity ^0.4.18;
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modi... | Transfer tokens Send `_value` tokens to `_to` from your account _to The address of the recipient _value the amount to send/ | function transfer(address _to, uint256 _value) public returns (bool success) {
return _transfer(msg.sender, _to, _value, 0);
}
| 12,992,568 |
pragma solidity >=0.7.5;
/***
*@title Token Converter V1-2
*@author InsureDAO
* SPDX-License-Identifier: MIT
*@notice InsureDAO util contract using UniswapV3
*@dev test for this code is done on mainnet fork
*/
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/u... | token exchange from USDC to INSURE. _token address of token to be used for exchange _amountIn amount of USDC for exchange of INSURE _to address of INSURE token recipient/ | function swap_exact_to_insure(
address _token,
uint256 _amountIn,
address _to
) external override returns (bool) {
uint256 deadline;
unchecked {
}
address tokenIn = address(_token);
address tokenOut = address(insure_token);
uint24 fee = 300... | 5,496,770 |
./full_match/1/0x402993515350c973f1D44FC8762644E3806cB9bC/sources/contracts/error/ErrorUtils.sol | referenced from https:ethereum.stackexchange.com/a/123588 | function revertWithCustomError(bytes memory result) internal pure {
uint256 length = result.length;
assembly {
revert(add(result, 0x20), length)
}
}
| 16,543,045 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
library ArrayUtils {
/**
* @notice get minimum value in given array
* @param array array to search
* @return minimum value
*/
function min(bytes32[] memory array) internal pure returns (bytes32) {
bytes32 minValue = bytes32(ty... | get maximum value in given array array array to search return maximum value/ | function max(address[] memory array) internal pure returns (address) {
address maxValue = address(0);
unchecked {
for (uint256 i; i < array.length; i++) {
if (array[i] > maxValue) {
maxValue = array[i];
}
}
}
... | 1,036,453 |
./full_match/1/0x8B66d70953Ad233976812f4B5B92bBAfeBA90A75/sources/solidity/contracts/core/AMPHClaimer.sol | Used by governance to change the fee taken from the CVX reward _newFee The new reward fee | function changeCvxRewardFee(uint256 _newFee) external override onlyOwner {
cvxRewardFee = _newFee;
emit ChangedCvxRewardFee(_newFee);
}
| 8,415,643 |
./partial_match/1/0xe35aC90D3BD1009977c989F3eb0c0d3E9F171817/sources/contracts/core/DaoRegistry.sol | Sets a flag of a proposal Reverts if the proposal is already processed proposalId The ID of the proposal to be changed flag The flag that will be set on the proposal/ | function _setProposalFlag(bytes32 proposalId, ProposalFlag flag)
internal
returns (Proposal storage)
{
Proposal storage proposal = proposals[proposalId];
uint256 flags = proposal.flags;
require(
DaoHelper.getFlag(flags, uint8(ProposalFlag.EXISTS)),
... | 15,956,515 |
pragma solidity ^0.4.23;
import 'openzeppelin-solidity/contracts/math/SafeMath.sol';
import 'openzeppelin-solidity/contracts/ownership/NoOwner.sol';
import 'openzeppelin-solidity/contracts/token/ERC721/ERC721.sol';
import './manager/IndexableNFTManager.sol';
/**
* @title Non-Fungible Token Indexer
* @dev NFTIndexer... | Makes the contract type verifiable. Function to prove the contract is NFTIndexer./ | function isNFTIndexer() external pure returns (bool) {
return true;
}
| 15,849,031 |
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.10;
interface IERC20 {
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Move... | Claim leftover ETH from contract address (swapAndLiquify leftovers) | function rescueETH(uint256 weiAmount) external {
require(msg.sender == _devwallet, "Not dev");
require(address(this).balance >= weiAmount, "insufficient ETH balance");
payable(owner()).transfer(weiAmount);
}
| 6,316,397 |
pragma solidity 0.5.17;
import {SafeMath} from "openzeppelin-solidity/contracts/math/SafeMath.sol";
import {TBTCDepositToken} from "./TBTCDepositToken.sol";
import {FeeRebateToken} from "./FeeRebateToken.sol";
import {TBTCToken} from "./TBTCToken.sol";
import {TBTCConstants} from "./TBTCConstants.sol";
import "../dep... | Mints an amount of the token and assigns it to an account. Uses the internal _mint function. _account The account that will receive the created tokens. _amount The amount of tokens that will be created. NOTE: this is a public function with unchecked minting. | function mint(address _account, uint256 _amount) public onlyVendingMachine returns (bool) {
_mint(_account, _amount);
return true;
}
| 7,283,501 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.8;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/S... | overrides the supportsInterface function. | function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC1155, AccessControl)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
| 1,528,398 |
// File: @openzeppelin/contracts/GSN/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be... | shfit to the correct location if neccesary | function toUint(RLPItem memory item) internal pure returns (uint) {
require(item.len > 0 && item.len <= 33);
uint offset = _payloadOffset(item.memPtr);
uint len = item.len - offset;
uint result;
uint memPtr = item.memPtr + offset;
assembly {
result := ml... | 38,139 |
pragma solidity ^0.4.25;
pragma experimental "ABIEncoderV2";
import "./lib/Signatures.sol";
import "./lib/StaticCall.sol";
import "./lib/Transfer.sol";
/// @title AppInstance - A contract that defines a state channel application
/// @author Liam Horne - <liam@l4v.io>
/// @notice Supports the adjudication and timeout... | Compute a unique hash for a state of this state channel and application stateHash The hash of a state to be signed nonce The nonce corresponding to the version of the state timeout A dynamic timeout value representing the timeout for this state return A bytes32 hash of the arguments encoded with the signing keys for... | function computeStateHash(bytes32 stateHash, uint256 nonce, uint256 timeout)
internal
view
returns (bytes32)
{
return keccak256(
abi.encodePacked(
byte(0x19),
auth.signingKeys,
nonce,
timeout,
stateHash
)
);
}
| 7,218,132 |
./full_match/8453/0xB89c125b433b854390Fddb22E8a1bDA4281e2946/sources/contracts/farms/BasetasticStaking.sol | Stake tokens to receive rewards Locked tokens cannot be withdrawn for lockDuration and are eligible to receive stakingReward rewards | function stake(uint256 amount, bool lock) external nonReentrant updateReward(msg.sender) {
require(amount > 0, "MultiFeeDistribution::stake: Cannot stake 0");
totalSupply = totalSupply.add(amount);
Balances storage bal = balances[msg.sender];
bal.total = bal.total.add(amount);
... | 11,553,873 |
/*
Copyright 2018 bZeroX, LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, s... | returns bool isProfit, uint profitOrLoss the position's profit/loss denominated in positionToken | {
uint loanToPositionAmount;
function shouldLiquidate(
bytes32 /* loanOrderHash */,
address /* trader */,
address loanTokenAddress,
address positionTokenAddress,
address collateralTokenAddress,
uint loanTokenAmount,
uint positionTokenAmount,
... | 6,990,910 |
./full_match/1/0x2b265B8336456158D2Ed4aD03B8d611079714F23/sources/src/Magai/Magai.sol | once enabled, can never be turned off setup the approvals add the liquidity set the params and emit | function enableTrading() external payable onlyOwner {
require(!tradingActive, "Trading is already enabled, cannot relaunch.");
require(msg.value > 0, "Send liquidity eth");
require(liquidityTokens > 0, "No tokens!");
IERC20Metadata weth = IERC20Metadata(uniswapV2Router.WETH());
weth.approve(address(uniswapV2... | 16,488,877 |
./full_match/1/0xa599E942e5A031400f51D13091F5A991056203Ee/sources/contracts/DemonArmy.sol | Custom Transfer Hook override ERC721 and update yield reward. | function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public override {
DemonYield.updateReward(from, to);
ERC721.safeTransferFrom(from, to, tokenId, data);
}
| 8,291,084 |
pragma solidity >=0.4.21 <0.6.0;
contract Oracle {
Request[] requests; //list of requests made to the contract
uint currentId = 0; //increasing request id
// defines a general api request
struct Request {
uint id; //request id
string urlToQuery; ... | Convert string to address | function _stringToAddress(string memory _a) internal pure returns (address){
bytes memory tmp = bytes(_a);
uint iaddress = 0;
uint b1;
uint b2;
for (uint i=2; i<2+2*20; i+=2){
iaddress *= 256;
b1 = uint(uint8(tmp[i]));
b2 = uint(uint8(tmp... | 13,048,005 |
/**
*Submitted for verification at Etherscan.io on 2021-05-02
*/
// SPDX-License-Identifier: GNU AGPLv3
pragma solidity ^0.8.0;
interface ILookRevTree {
function addLeafToOpenBranch(uint256 genesisBranch, uint256 tokenID) external returns (uint256);
function addLeavesToOpenBranches(uint256[] calldata tokenI... | Add or remove operator for a genesis branch | function updateOperator(uint256[] calldata branch, address operator, bool approved) public {
require(msg.sender == admin, "LookRevTree: Not authorized");
require(operator != address(0), "LookRevTree: operator needs valid address");
for (uint256 i = 0; i < branch.length; i++) {
op... | 10,912,947 |
// SPDX-License-Identifier: LGPL-3.0-or-later
pragma solidity ^0.7.1;
import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol";
import { ABDKMath64x64 } from "abdk-libraries-solidity/ABDKMath64x64.sol";
import { ERC1155WithTotals } from "./ERC1155/ERC1155WithTotals.sol";
import { ERC1155Holder } from "@open... | Start with 1, not 0, to avoid glitch with `conditionalTokens` variable. TODO: Use uint64 variables instead? | function _doCreateCondition(address _customer) internal virtual returns (uint256) {
uint64 _condition = ++maxConditionId;
conditionOwners[_condition] = _customer;
emit ConditionCreated(msg.sender, _customer, _condition);
return _condition;
}
| 6,370,872 |
./partial_match/42/0xBAa2B747Dd4E9aCe0cebC8EbCF21F35663006298/sources/Transmutation.sol | --- Constructor --- Constructor _moloch The molochDao to propose token swaps with _distributionToken The token to use as Moloch proposal tributeToken _capitalToken The token to use as Moloch proposal paymentToken _owner Address approved to transfer this contract's _distributionToken/ approve moloch and owner to tr... | function init(
address _moloch,
address _distributionToken,
address _capitalToken,
address _owner
) public {
moloch = IMOLOCH(_moloch);
emit Deploy(_moloch, _distributionToken, _capitalToken, _owner);
require(
IERC20(_distributionToken).appro... | 3,492,135 |
./full_match/44787/0x3B9EDfC6eB4B29341ca232350EcC65BC070f8574/sources/Contracts/Dcolab.sol | ? this function returns an array of all projects | function getAllProjects() external view returns (Project[] memory) {
Project[] memory allProject = new Project[](allProjects.length);
for (uint256 i = 0; i < allProjects.length; i++) {
allProject[i] = allProjects[i];
}
return allProject;
}
| 13,284,719 |
pragma solidity ^0.4.15;
/**
* @title TokenLib
* @author Majoolr.io
*
* version 1.1.0
* Copyright (c) 2017 Majoolr, LLC
* The MIT License (MIT)
* https://github.com/Majoolr/ethereum-libraries/blob/master/LICENSE
*
* The Token Library provides functionality to create a variety of ERC20 tokens.
* See https://g... | Transfer tokens from caller&39;s account to another account. self Stored token from token contract _to Address to send tokens _value Number of tokens to send return True if completedIt&39;s not possible to overflow token supply | function transfer(TokenStorage storage self, address _to, uint256 _value) returns (bool) {
bool err;
uint256 balance;
(err,balance) = self.balances[msg.sender].minus(_value);
require(!err);
self.balances[msg.sender] = balance;
self.balances[_to] = self.balances[_to] + _value;
Transfer(msg... | 7,668,800 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
import "../interfaces/AccessControlledInterface.sol";
import "../vendor/AccessControllerInterface.sol";
import "../vendor/ConfirmedOwner.sol";
contract AccessControlled is AccessControlledInterface, ConfirmedOwner(msg.sender) {
AccessControllerInterface intern... | Used if an aggregator contract has been proposed. asset asset address denomination denomination address roundId the round ID to retrieve the round data for return id is the round ID for which data was retrieved return answer is the answer for the given round return startedAt is the timestamp when the round was start... | function proposedGetRoundData(
address asset,
address denomination,
uint80 roundId
)
external
view
virtual
override
hasProposal(asset, denomination)
returns (
uint80 id,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
... | 14,647,455 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.