file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma solidity ^0.4.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... | opens the vault, allowing the Tokens to be withdrawn, only callable by the owner (crowdsale)/ | function open()
onlyOwner
external
{
open = true;
}
| 11,800,484 |
pragma solidity ^0.4.24;
// produced by the Solididy File Flattener (c) David Appleton 2018
// contact : dave@akomba.com
// released under Apache 2.0 licence
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev give an address access to this role
*/
function add(Role storage r... | remove an address from the whitelist addr address return true if the address was removed from the whitelist, false if the address wasn't in the whitelist in the first place/ | function removeAddressFromWhitelist(address addr)
onlyOwner
public
{
removeRole(addr, ROLE_WHITELISTED);
emit WhitelistedAddressRemoved(addr);
}
| 278,080 |
./partial_match/8453/0x6Dbb7C61eD0E1DE7833f21Ce7B6DBd9d03F16aAC/sources/TARDIGRADE.sol | YOU CAN SET HERE THE BUY FEES YOU CAN SET HERE THE SELL FEES SET MARKETING AND DEV ADDRESS exclude from paying fees or having max transaction amount | constructor() ERC20("TARD", "TARD") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0xfCD3842f85ed87ba2889b4D35893403796e67FF1
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswap... | 16,780,500 |
./partial_match/1/0xd99E77D485368D0365Ca124f94c7580f844d9bE5/sources/SimpleBreeding.sol | Owner or operator can cancel sales auction for kitty owned by contract/ | function cancelSaleAuction(uint256 _kittyId) external onlyOwnerOrOperator {
saleAuction.cancelAuction(_kittyId);
}
| 9,407,939 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
//
interface IERC20 {
function TOTALSUPPLY726(... | inject NONSTANDARD NAMING | function SAFETRANSFER962(IERC20 token, address to, uint256 value) internal { | 15,830,441 |
pragma solidity 0.6.12;
import "./ERC20.sol";
import "../interfaces/IMisoToken.sol";
// ---------------------------------------------------------------------
//
// From the MISO Token Factory
//
// Made for Sushi.com
//
// Enjoy. (c) Chef Gonpachi 2021
// <https://github.com/chefgonpachi/MISO/>
//
// -------------... | Miso template id for the token factory. For different token types, this must be incremented. First set the token variables. This can only be done once | function initToken(string memory _name, string memory _symbol, address _owner, uint256 _initialSupply) public {
_initERC20(_name, _symbol);
_mint(msg.sender, _initialSupply);
}
| 41,522 |
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.10;
import {IFollowNFT} from '../interfaces/IFollowNFT.sol';
import {IFollowModule} from '../interfaces/IFollowModule.sol';
import {ILensHub} from '../interfaces/ILensHub.sol';
import {Errors} from '../libraries/Errors.sol';
import {Events} from '../librar... | @inheritdoc IFollowNFT First check most recent balance Next check implicit zero balance | function getPowerByBlockNumber(address user, uint256 blockNumber)
external
view
override
returns (uint256)
{
if (blockNumber > block.number) revert Errors.BlockNumberInvalid();
uint256 snapshotCount = _snapshotCount[user];
if (snapshotCount == 0) {
... | 6,345,857 |
./full_match/1/0x154DAc76755d2A372804a9C409683F2eeFa9e5e9/sources/lib/tl-sol-tools/src/upgradeable/royalties/EIP2981TLUpgradeable.sol | Query the default royalty receiver and percentage. return Tuple containing the default royalty recipient and percentage out of 10_000 | function getDefaultRoyaltyRecipientAndPercentage() external view returns (address, uint256) {
return (_defaultRecipient, _defaultPercentage);
}
Upgradeability Gap
| 4,979,382 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.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 o... | @inheritdoc IManagerActions | function init(
address fund,
address token0,
address token1,
uint24 fee,
int24 tickLower,
int24 tickUpper,
uint amount,
uint deadline
) external override checkDeadline(deadline) onlyManager(fund) returns(uint128 liquidity){
return IHotPotV3... | 416,960 |
./partial_match/1/0xEceec31C940e49C7557C530305DA1Ac3C3556569/sources/ZUSDImplementation.sol | Gets the balance of the specified address. addr The address to query the the balance of. Returns a uint256 representing the amount owned by the passed address./ | function balanceOf(address addr) external view override returns (uint256) {
return _balances[addr];
}
| 2,809,946 |
pragma solidity ^0.5.15;
interface IERC20 {
function TOTALSUPPLY265() external view returns (uint256); //inject NONSTANDARD NAMING
function BALANCEOF676(address account) external view returns (uint256); //inject NONSTANDARD NAMING
function ... | inject NONSTANDARD NAMING | function ADD125(uint256 a, uint256 b) internal pure returns (uint256) { | 12,634,625 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.3;
import "./OracleGetter.sol";
import "./ERC20.sol";
import "./Inflation.sol";
import "hardhat/console.sol";
/**
@author Tellor Inc.
@title Chorus
@dev Chorus is a structure for issuing semi-stablecoins as community currencies
**/
// slither-disable-next-line m... | Allows the admin to withdraw collateral above the threshold _amount the amount of collateral token to deposit/ slither-disable-next-line reentrancy-events | function withdrawCollateral(uint256 _amount) external onlyAdmin {
require(
collateralToken.transfer(msg.sender, _amount),
"collateral transfer fails"
);
uint256 _cRatio = collateralRatio();
require(
_cRatio >= collateralThreshold,
"coll... | 6,418,389 |
./partial_match/1/0x235b25f9f56B39eFD8293C0d2A9Ee70719E25B85/sources/src/ButtonswapPair.sol | @inheritdoc IButtonswapPair/ | function setMovingAverageWindow(uint32 newMovingAverageWindow) external onlyFactory {
movingAverageWindow = newMovingAverageWindow;
emit MovingAverageWindowUpdated(newMovingAverageWindow);
}
| 4,108,389 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
interface IWeth {
function DEPOSIT413() external payable; //inject NONS... | inject NONSTANDARD NAMING | function SUB395(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { | 6,465,415 |
pragma solidity 0.5.17;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol";
import "./TokenStaking.sol";
import "./cryptography/BLS.sol";
import "./utils/AddressArrayUtils.sol";
import "./utils/PercentUtils.sol";
import "./libraries/operator/G... | Function used to inform about the fact the currently ongoing new relay entry generation operation timed out. As a result, the group which was supposed to produce a new relay entry is immediately terminated and a new group is selected to produce a new relay entry. All members of the group are punished by seizing minimum... | function reportRelayEntryTimeout() public {
require(hasEntryTimedOut(), "Entry did not time out");
uint256 minimumStake = stakingContract.minimumStake();
groups.reportRelayEntryTimeout(signingRequest.groupIndex, groupSize, minimumStake);
if (numberOfGroups() > 0) {
sign... | 1,840,291 |
pragma solidity 0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 val... | Release tokens as per vesting schedule, called by contributor / | function releaseMyVestedTokens() public changesToVestingFreezed(msg.sender) {
releaseVestedTokens(msg.sender);
}
| 2,251,383 |
./full_match/1/0xD7134e2265B78DFCF4e9FA4DC65b18F4D5C03220/sources/contracts/bridgeERC20/layerZero/utils/NonblockingLzAppERC20.sol | Sends a message to the LZ endpoint and process it _dstChainId L0 defined chain id to send tokens too _payload Data: recipient address and amount _refundAddress Address LayerZero refunds if too much message fee is sent _zroPaymentAddress Set to address(0x0) if not paying in ZRO (LayerZero Token) _adapterParams Flex... | function _lzSend(
uint16 _dstChainId,
bytes memory _payload,
address payable _refundAddress,
address _zroPaymentAddress,
bytes memory _adapterParams
) internal virtual {
bytes memory trustedRemote = trustedRemoteLookup[_dstChainId];
if (trustedRemote.lengt... | 3,182,986 |
./partial_match/3/0xdfcA02f5989efC6Ec7EcE748Ca1c11f0bb88aEFF/sources/VEROX_MAKER.sol | function to allow owner to transfer any ERC20 tokens from this contract | function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
if (_tokenAddr == tokenAddress) {
totalClaimedRewards = totalClaimedRewards.add(_amount);
}
require(_tokenAddr != address(tokenAddress));
Token(_tokenAddr).transfer(_to, _amo... | 16,623,919 |
pragma solidity ^0.4.0;
import 'zeppelin-solidity/contracts/ownership/Ownable.sol';
import 'zeppelin-solidity/contracts/math/SafeMath.sol';
import './Coupon.sol';
import './GetTogether.sol';
/**
* @title GetTogetherCoupon
* @dev Implementation of the Coupon interface for use with the BlockTogether contract.
*/
// ... | Require that the msg.sender has not already registered / staked a balance for the get-together Very unlikely - if someone owned the address 0x0 then they would own Keep track of the total amount staked | function stake(uint _amount, address _getTogether) internal hasLargeEnoughBalance(_amount) {
require(stakes[_getTogether][msg.sender] == 0);
require(msg.sender != address(0));
balances[msg.sender] = balances[msg.sender].sub(_amount);
stakes[_getTogether][msg.sender] = _amount;
... | 13,036,855 |
pragma solidity ^0.4.19;
//pragma experimental ABIEncoderV2;
import "./ownable.sol";
import "./safemath.sol";
contract FactualNews {
// Parameters
uint percentageAuditors = 10; // in %
uint percentageCompany = 5; // in %
struct newsRequestContractType {
string retMsg;
string _statusT... | Check the outcome of auditing - Approved, Denied, Undefined case which is tied Majority denied Majority Approved | function _checkAuditingStatus(uint _id) private view returns (string) {
uint _countApproved;
uint _countDenied;
uint tempTotalAuditors;
_countApproved = _countStatus(_id,"Approved");
_countDenied = _countStatus(_id,"Denied");
if ( ((news[_id].totalAuditors % 2) == 0... | 2,518,949 |
./full_match/5/0x4Ecdd1450710Aa7059A1BC549bB98Ab0143C568F/sources/contracts/StakingContract5.sol | Iterate through all user's deposits to withdraw all funds Create an array for all msg.senders deposits Iterate through the list and withdraw all | function withdrawAll() public virtual {
uint256[] memory depositIds = allUsersDeposits[msg.sender].values();
require(depositIds.length > 0, "No Withdrawals Avaialable");
uint256 _currentId = currentId[msg.sender];
StakeVault storage staker = checkDeposit[msg.sender][_currentId];
... | 1,880,255 |
./full_match/1/0x8eb5bD8c9Ab0F8ad28e94693F3c889F490bE2aB0/sources/contracts/POS32.sol | Change the minimum contract ACAP balance before `_swap` gets invoked _minTokenBalance The new minimum balance | function setMinTokenBalance(uint256 _minTokenBalance) external onlyOwner {
minTokenBalance = _minTokenBalance;
}
| 4,876,247 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
impo... | Perform implementation upgrade with additional setup call. Emits an {Upgraded} event./ | function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
if (data.length > 0 || forceCall) {
_functionDelegateCall(newImplementation, data);
}
}
| 1,574,415 |
./partial_match/1/0x508efB44A06a64Bd4020e8c5e8Ecf1A9236C75aE/sources/tokenWhitelistable.sol | Checks whether a token is loadable. return bool loadable or not. | function _isTokenLoadable(address _a) internal view returns (bool) {
(, , , , bool loadable, , ) = _getTokenInfo(_a);
return loadable;
}
| 3,598,122 |
./full_match/5/0xc1E942B282fcB873238aeD8126137f492d81dcFD/sources/contracts/15yrslater.sol | Removes the Offer if the owner no Longer Owns the NFTs | function _removeInvalidOffer(uint256 _tokenId, address _offeror )internal virtual {
TradeOffer memory targetTradeOffer = tradeoffers[_tokenId][_offeror];
delete tradeoffers[_tokenId][_offeror];
emit TradeOfferRemoved(_tokenId, targetTradeOffer.offeror);
}
| 11,587,897 |
// SPDX-License-Identifier: CC-BY-4.0
pragma solidity >=0.4.22 <0.9.0;
import "../common/Owned.sol";
import "../common/Version.sol";
import "./SupplierRole.sol";
import "./ManufacturerRole.sol";
import "./DistributorRole.sol";
import "./ResellerRole.sol";
import "./EndUserRole.sol";
contract SupplyChain is... | /uint placeholder; Block number place holderTxblocks memory txBlock; create new txBlock structtxBlock.STM = placeholder;txBlock.MTD = placeholder; assign placeholder valuestxBlock.DTR = placeholder;txBlock.RTC = placeholder;history[_upc] = txBlock; add txBlock to history mapping by upc Increment sku Emit the approp... | function produceProductByManufacturer(
uint _upc,
string memory _originName,
string memory _originInformation,
string memory _originLatitude,
string memory _originLongitude,
string memory _productNotes,
uint _price,
uint256 epoch)
public
payable
{
newProduce.ma... | 12,965,813 |
./full_match/1/0x8bC4CbEc17c3b8c0b4e4b7086F9293398c8AC83c/sources/Blingy.sol | 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 virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance"... | 3,206,970 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./ContractDataStorage.sol";
import "./SvgParser.sol";
contract CyberBrokersMetadata is Ownable {
using Strings for uint256;
bool private _useOn... | Base case Expand length Special case: if decimal & numTens is less than 3, need to pad by 3 since we'll left-pad zeroes Percent character The entire number If a decimal, we need to left-pad if the numTens isn't enough If negative, the last byte should be negative | function unpackNumberSetValues(uint _i, bool decimal, bool negative, bool percent) internal pure returns (bytes memory) {
if (_i == 0) {
if (percent) {
return "0%";
return "0";
}
}
uint len = (negative ? 1 : 0) + (percent ? 1 : 0) + (decimal ? 2 : 0);
while (j != 0) {
... | 1,589,740 |
./full_match/1/0x91A6194F1278f6Cf25ae51B604029075695A74E5/sources/contracts/Vault.sol | Adds a new curve swap pool from an input token to {underlying} _param Swap pool params | function addPool(SwapPoolParam memory _param) external onlyAdmin {
_addPool(_param);
}
| 4,864,825 |
pragma solidity ^0.4.24;
import "./../../TransferManager/ITransferManager.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
/**
* @title Transfer Manager for limiting volume of tokens in a single trade
*/
contract SingleTradeVolumeRestrictionTM is ITransferManager {
using SafeMath for uint256;
... | Sets transfer limits for an array of wallet _wallets array of wallet addresses _transferLimits array of transfer limits for each wallet in tokens The manager has to be configured to use tokens as limit/ | function setTransferLimitInTokensMulti(address[] _wallets, uint[] _transferLimits) public withPerm(ADMIN) {
require(_wallets.length > 0, "Wallets cannot be empty");
require(_wallets.length == _transferLimits.length, "Wallets don't match to transfer limits");
for (uint256 i = 0; i < _wallets.... | 14,036,742 |
./full_match/44787/0xE03639b06Be343BC0898FAaA8463EcF6E5c14869/sources/contracts/SpacetarContract.sol | Function to get the total point balance of all users | function getTotalPointBalance() public view onlyRole(ADMIN_ROLE) returns (uint256) {
uint256 totalBalance = 0;
for (uint256 i = 0; i < spacetarChats.length; i++) {
totalBalance += userPoints[spacetarChats[i].user];
}
return totalBalance;
}
| 13,260,752 |
/***
* ██████╗ ██╗ ██╗███╗ ██╗ █████╗ ██████╗ ██╗ ███████╗
* ██╔═══██╗██║ ██║████╗ ██║██╔══██╗██╔══██╗██║ ██╔════╝
* ██║ ██║██║ █╗ ██║██╔██╗ ██║███████║██████╔╝██║ █████╗
* ██║ ██║██║███╗██║██║╚██╗██║██╔══██║██╔══██╗██║ ██╔══╝
* ╚██████╔╝╚███╔███╔╝██║ ╚████║██║ ██║... | Transfers Owner of the contract to a new account (`newOwner`). Can only be called by the current Owner. Now push/pull./ | function transferOwner(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Owner: new Owner is the zero address");
_newOwner = newOwner;
}
| 5,371,918 |
./full_match/4/0x0199C6242d1ca20E05b88Da441C43F771498d8FB/sources/browser/Comptroller.sol | Checks if the account should be allowed to borrow the underlying asset of the given market cToken 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 c... | function borrowAllowed(address cToken, address borrower, uint borrowAmount) external returns (uint) {
require(!borrowGuardianPaused[cToken], "borrow is paused");
if (!markets[cToken].isListed) {
return uint(Error.MARKET_NOT_LISTED);
}
if (!markets[cToken].accountMembers... | 760,680 |
pragma solidity ^0.5.0;
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @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(uint25... | Check if address is Sales manager | function isSalesManager(address _manager) public view returns (bool){
if (owner() == _manager){
return true;
}
return salesManager[_manager] == true ? true : false;
}
| 1,820,328 |
./full_match/1/0xd3FCf40bc00ce800066E9f16608c5545Ff530531/sources/contracts/MultiSenderV1.sol | solhint-disable not-rely-on-time | function registerVIP(address[] memory beneficiarys, uint256 duration)
public
onlyOwner
{
for (uint256 i = 0; i < beneficiarys.length; i++) {
if (vipMap[beneficiarys[i]].startedAt == 0) {
vipMap[beneficiarys[i]].startedAt = block.timestamp;
vips... | 9,625,824 |
// SPDX-License-Identifier: AGPL-3.0-only
/*
ValidatorService.sol - SKALE Manager
Copyright (C) 2019-Present SKALE Labs
@author Dmytro Stebaiev
@author Artem Payvin
@author Vadim Yavorsky
SKALE Manager is free software: you can redistribute it and/or modify
it under the terms of the GNU Af... | Allows Admin to enable a validator by adding their ID to the trusted list. Emits a {ValidatorWasEnabled} event. Requirements: - Validator must not already be enabled./ | function enableValidator(uint validatorId) external checkValidatorExists(validatorId) onlyValidatorManager {
require(!_trustedValidators[validatorId], "Validator is already enabled");
_trustedValidators[validatorId] = true;
trustedValidatorsList.push(validatorId);
emit ValidatorWasEn... | 6,301,320 |
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
interface IERC20Upgradeable {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf... | balancewithdraw to a convex tokenized depositwithdraw directly to curve LP tokenclaim rewardsstake a convex tokenized depositstake a convex tokenized deposit for another address(transfering ownership) | interface IBaseRewardsPool {
function balanceOf(address _account) external view returns (uint256);
function withdraw(uint256 _amount, bool _claim) external returns (bool);
function withdrawAndUnwrap(uint256 _amount, bool _claim) external returns (bool);
function getReward() external returns (bool);
... | 1,553,305 |
//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... | confirms payments via a batch method _investmentIds uint256[] array of uint256 of the investment ids to confirm/ | function batchConfirmPayments(uint256[] _investmentIds) public onlyManager onlyConfirmPayment {
uint256 investmentId;
for (uint256 c; c < _investmentIds.length; c = c.add(1)) {
confirmPayment(investmentId);
}
}
| 13,074,883 |
./full_match/80001/0xd0BE417Fbe925eb1322dAe0fdF8f6f6bC60B0e7c/sources/_openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol | Returns the downcasted int176 from int256, reverting on overflow (when the input is less than smallest int176 or greater than largest int176). Counterpart to Solidity's `int176` operator. Requirements: - input must fit into 176 bits _Available since v4.7._/ | function toInt176(int256 value) internal pure returns (int176 downcasted) {
downcasted = int176(value);
require(downcasted == value, "SafeCast: value doesn't fit in 176 bits");
}
| 858,561 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
// File: @openzeppelin/contracts/math/SafeMath.sol
/**
* @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... | See {IStrategy-harvest}./ | function harvest(uint256 _bankPoolId, uint256 _poolId) external override {
_harvest(_bankPoolId, _poolId);
}
uint256 public log_golffBal;
uint256 public log_wethBal;
uint256 public log_yfvGovVault;
| 11,958,460 |
// to test issue with nodes breaking with large clients over WS
// fixed in web3 with fragmentationThreshold: 8192
pragma solidity ^0.4.17;
contract BigFreakingContract {
event Transfer(address indexed from, address indexed to, uint value);
event Approval( address indexed owner, address indexed spender, uint valu... | TODO: should increase instead | function approve_750(address spender, uint value) public returns (bool ok) {
_approvals[msg.sender][spender] = value;
emit Approval( msg.sender, spender, value );
return true;
}
| 6,454,463 |
/**
* Copyright BOOSTRY Co., 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 applicable law or agreed to in writing,... | 約定情報の参照(約定単価) _orderId 注文ID _agreementId 約定ID return 約定単価 | function getAgreementPrice(uint256 _orderId, uint256 _agreementId)
public
view
returns(uint256)
{
return agreements[_orderId][_agreementId].price;
}
| 2,574,578 |
./partial_match/1/0x1A963Df363D01EEBB2816b366d61C917F20e1EbE/sources/src/ComptrollerG7.sol | Calculate number of tokens of collateral asset to seize given an underlying amount Used in liquidation (called in cToken.liquidateBorrowFresh) cTokenBorrowed The address of the borrowed cToken cTokenCollateral The address of the collateral cToken actualRepayAmount The amount of cTokenBorrowed underlying to convert ... | function liquidateCalculateSeizeTokens(
address cTokenBorrowed,
address cTokenCollateral,
uint256 actualRepayAmount
)
external
view
override
returns (uint256, uint256)
{
uint256 priceBorrowedMantissa =
oracle.getUnderlyingPrice(CTok... | 2,595,075 |
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.0;
import "./IERC721Receiver.sol";
import "./Pausable.sol";
import "./Squuid.sol";
import "./SQUID.sol";
import "./ReentrancyGuard.sol";
contract Arena is Ownable, IERC721Receiver, Pausable {
// maximum alpha score for a Guard
uint8 public constant... | adds a single Guard to the Pack account the address of the staker tokenId the ID of the Guard to add to the Pack/ | function _addGuardToPack(address account, uint256 tokenId) internal {
uint256 alpha = _alphaForGuard(tokenId);
pack[alpha].push(Stake({
owner: account,
tokenId: uint16(tokenId),
value: uint80(squidPerAlpha)
emit TokenStaked(account, tokenId, squidPerAlpha);
}
function claimManyFrom... | 11,715,967 |
./full_match/1/0x0De60C639Dd6EF4bA621C6D0b74548E403Ee74e5/sources/contracts/LotManager/V2/LotManagerV2LotsHandler.sol | Get allowance Check if Allowance exceeds lot contract cost Buy lot by transfering tokens Buys Lot(s) (defaults buys ETH lot) Transfer unused tokens(underlying) back to the pool | function _buyLots(uint256 _ethLots, uint256 _wbtcLots) internal returns (bool) {
uint256 allowance = token.allowance(address(pool), address(this));
uint256 lotsCosts = _ethLots.add(_wbtcLots).mul(LOT_PRICE);
require (allowance >= lotsCosts, 'LotManagerV2LotsHandler::_buyLots::not-enough-allowance');
t... | 8,417,875 |
pragma solidity ^0.4.21;
//Decalre all functions to use in Token Smart Contract
contract EIP20Interface {
/// total amount of tokens
uint256 public totalSupply;
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address ... | Code To Burn the token starts from here. | function _burn(address account, uint256 value) internal {
require(account != address(0));
totalSupply = totalSupply - value;
balances[account] = balances[account] - value;
emit Transfer(account, address(0), value);
}
| 12,709,930 |
// to test issue with nodes breaking with large clients over WS
// fixed in web3 with fragmentationThreshold: 8192
pragma solidity ^0.4.17;
contract BigFreakingContract {
event Transfer(address indexed from, address indexed to, uint value);
event Approval( address indexed owner, address indexed spender, uint valu... | TODO: should increase instead | function approve_558(address spender, uint value) public returns (bool ok) {
_approvals[msg.sender][spender] = value;
emit Approval( msg.sender, spender, value );
return true;
}
| 6,454,271 |
/**
*Submitted for verification at Etherscan.io on 2021-12-15
*/
// File: contracts/IWoofpackNFTToken.sol
// SPDX-License-Identifier: MIT
pragma experimental ABIEncoderV2;
pragma solidity ^0.8.0;
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IWoofpackNFTToken {
/**
* @dev ... | Executed when a purchase has been validated and is ready to be executed. Doesn't necessarily emit/send tokens. beneficiary Address receiving the tokens mintAmount Total mint tokens/ | function _processPurchase(address beneficiary, uint256 mintAmount) internal virtual {
_deliverTokens(beneficiary, mintAmount);
}
| 2,234,317 |
./partial_match/1/0xae248D0dCC7503126744b510D9B6703F1CaC8870/sources/DoubleEndedQueue.sol | Returns the number of items in the queue./ The interface preserves the invariant that begin <= end so we assume this will not overflow. We also assume there are at most int256.max items in the queue. | function length(Bytes32Deque storage deque) internal view returns (uint256) {
unchecked {
return uint256(int256(deque._end) - int256(deque._begin));
}
}
| 3,723,195 |
./full_match/5/0x6DFAfE92A3158994e067F33359C1DCeA2434bf7A/sources/contracts/PayrollNFT.sol | - You can get tokenId from userId. - userIdからtokenIdを取得できます。/ | function getMintedTokenId(string calldata userId) external view returns (uint256) {
require(isMintedUserId(userId), "not minted");
uint256 tokenId = 0;
for (uint256 i = 1; i <= _tokenIds.current(); i++) {
if(keccak256(abi.encodePacked(_tokenIdtoSignature[i])) == keccak256(abi.enc... | 7,088,716 |
pragma solidity ^0.6.6;
import "./ERC20.sol";
import "./Address.sol";
import "./BokkyPooBahsDateTimeLibrary.sol";
import "./Strings.sol";
/**
* @title ACOToken
* @dev The implementation of the ACO token.
* The token is ERC20 compliance.
*/
contract ACOToken is ERC20 {
using Address for address;
/**
... | Internal function to exercise the assignable tokens from an account and transfer to its address the respective payment. account Address of the account. tokenAmount Amount of tokens. exerciseAccount Address of the account that is exercising. return Remaining amount of tokens./ | function _exerciseAccount(address account, uint256 tokenAmount, address exerciseAccount) internal returns(uint256) {
uint256 available = _getAssignableAmount(account);
if (available > 0) {
TokenCollateralized storage data = tokenData[account];
uint256 valueToTran... | 13,466,130 |
pragma solidity ^0.8.0;
// SPDX-License-Identifier: MIT
import "../../core/DaoRegistry.sol";
/**
MIT License
Copyright (c) 2020 Openlaw
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without ... | check that the step is indeed part of the resultreturn 1 if yes, 2 if no and 0 if the vote is incorrectinvalid choiceinvalid proposal hashhas voted outside of the voting time | function getBadNodeError(
DaoRegistry dao,
bytes32 proposalId,
bool submitNewVote,
bytes32 resultRoot,
uint256 blockNumber,
uint256 gracePeriodStartingTime,
VoteResultNode memory node
) public view returns (BadNodeError) {
(address adapterAddress, ... | 13,603,407 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppel... | Internal function that writes new stake checkpoint for some account account The address to write checkpoint for newStake New stake size/ | function _writeCheckpoint(address account, uint256 newStake) private {
uint32 nCheckpoints = numCheckpoints[account];
if (
nCheckpoints > 0 &&
checkpoints[account][nCheckpoints - 1].fromBlock == block.number
) {
checkpoints[account][nCheckpoints - 1].stake... | 11,756,423 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.12;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function balanceOf(address account) ext... | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address ... | 37,963 |
pragma solidity 0.4.21;
// ----------------------------------------------------------------------------
// 'ANDRS' 'Andreis Token' token contract
//
// Symbol : INO8
// Name : AndreisToken
// Total supply: Generated from contributions
// Decimals : 18
//
//
// -------------------------------------------... | Sell `amount` tokens to contract amount amount of tokens to be sold | function sell(uint256 amount) public {
}
| 1,520,731 |
./full_match/80001/0x94588694589dA99cf281d3275402D3AD19Ea4827/sources/contracts/RandomNumberGenerator.sol | Set the address for the MakiSwap Lottery _makiLottery: address of the MakiSwap lottery/ | function setLotteryAddress(address _makiLottery) external onlyOwner {
makiLottery = _makiLottery;
}
| 9,512,198 |
pragma solidity 0.8.6;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint... | Removes a staked token from the list/ If we find it, then swap it with the last element and delete the end | function removeStakedTkoen(address _stakedToken) external onlyGovernor {
uint256 len = stakedTokenContracts.length;
for (uint256 i = 0; i < len; i++) {
if (address(stakedTokenContracts[i]) == _stakedToken) {
stakedTokenContracts[i] = stakedTokenContracts[len - 1];
... | 638,710 |
./partial_match/1/0x1A963Df363D01EEBB2816b366d61C917F20e1EbE/sources/src/DAIInterestRateModelV3.sol | Calculates the current supply interest rate per block including the Dai savings rate cash The total amount of cash the market has borrows The total amount of borrows the market has outstanding reserves The total amnount of reserves the market has reserveFactorMantissa The current reserve factor the market has retur... | function getSupplyRate(uint cash, uint borrows, uint reserves, uint reserveFactorMantissa) override public view returns (uint) {
uint protocolRate = super.getSupplyRate(cash, borrows, reserves, reserveFactorMantissa);
uint underlying = cash + borrows - reserves;
if (underlying == 0) {
... | 2,594,800 |
./partial_match/1/0x883A0E7b329Df75476d9378462522CF2f78Fab3d/sources/Synthetix.sol | Ensure they're not trying to exceed their locked amount -- only if they have debt. Perform the transfer: if there is a problem, an exception will be thrown in this call. | function transferFrom(
address from,
address to,
uint value
) external onlyProxyOrInternal systemActive returns (bool) {
_canTransfer(from, value);
return _transferFromByProxy(messageSender, from, to, value);
}
| 15,766,129 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
import "./EternalStorage.sol";
import "./StorageDefinition.sol";
import "./Consortium.sol";
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflo... | Gets the token ID at a given index of all the tokens in this contract Reverts if the index is greater or equal to the total number of tokens. index uint256 representing the index to be accessed of the tokens list return uint256 token ID at the given index of the tokens list/ | function tokenByIndex(uint256 index) public view returns (string memory) {
require(index < totalSupply(), "ERC721Enumerable: global index out of bounds");
return _allTokens[index];
}
| 13,014,035 |
//SPDX-License-Identifier: MIT
//Copyright 2021 Louis Sobel
pragma solidity ^0.8.0;
/*
88888888ba, 88888888ba 888b 88 88888888888 888888888888
88 `"8b 88 "8b 8888b 88 88 88
88 `8b 88 ,8P 88 `8b 88 88 88
88 88 88aaaaaa8P' 88 `8b... | Returns a partial JSON string with the metadata of the image. Used by both the full tokenURI and the plain-metadata serializers. metadata The struct holding information about the drawing/ name | function _metadataJSONFragmentWithoutImage(Token.Metadata memory metadata) internal pure returns (string memory) {
return string(abi.encodePacked(
'{"name":"',
metadata.name,
'","description":"',
metadata.description,
'","external_url":"'... | 13,463,339 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.6.0 <0.9.0;
pragma experimental ABIEncoderV2;
import "@chainlink/contracts/src/v0.6/ChainlinkClient.sol";
interface GetCurrencyInfoInterface {
function addCurrency(int256 _currencyQuantity) external;
function getCurrencyName(int256 _id) external view r... | return getAnswerContract.getVolume(); | function returnAnswer() public view returns (uint256) {
}
| 12,721,511 |
./full_match/1/0xE39dEC81B2186A1A2e36bFC260F3Df444b36948A/sources/contracts/DIVAOwnershipMain.sol | Check whether the 7 day minimum staking period has been respected Check that outside of ownership claim submission period | function unstake(address _candidate, uint256 _amount) external override nonReentrant {
uint _minStakingPeriodEnd =
_voterToTimestampLastStakedForCandidate[msg.sender][_candidate] + _MIN_STAKING_PERIOD;
if (block.timestamp < _minStakingPeriodEnd) {
revert MinStakingPeriodNotEx... | 16,496,000 |
/**
*Submitted for verification at Etherscan.io on 2021-11-19
*/
pragma solidity 0.8.10;
/**
* @title Multisig
* @author 0age (derived from Christian Lundkvist's Simple Multisig)
* @notice This contract is a multisig based on Christian Lundkvist's Simple
* Multisig (found at https://github.com/christianlundkvis... | Prevent replays across different chains. | function _getHash(
bytes memory data,
address executor,
uint256 gasLimit,
bytes32 salt
) internal view returns (bytes32 hash, bool usable) {
uint256 chainId;
assembly {
chainId := chainid()
}
abi.encodePacked(address(this), chainId, salt, executor, gasLimit, data)
);
... | 1,967,951 |
pragma solidity 0.8.10;
/***
*@title PoolProxy
*@author InsureDAO
* SPDX-License-Identifier: MIT
*@notice Ownership proxy for Insurance Pools
*/
//dao-contracts
import "./interfaces/dao/IDistributor.sol";
//pool-contracts
import "./interfaces/pool/ICDSTemplate.sol";
import "./interfaces/pool/IFactory.sol";
impo... | distribute accrued admin fees from multiple coins Only callable by an EOA to prevent flashloan exploits _id List of distributor id/any EOA | function distribute_many(
address[20] memory _tokens,
uint256[20] memory _ids
) external nonReentrant {
require(tx.origin == msg.sender);
require(!distributor_kill, "distribution killed");
for (uint256 i; i < 20; ) {
if (_tokens[i] == address(0)) {
... | 1,821,962 |
pragma solidity 0.5.11;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/introspection/IERC1820Registry.sol";
import "@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/access/Roles.sol";
in... | solhint-disable-previous-line no-empty-blocks | function onlyPauserMock() public view onlyPauser {
}
| 1,008,862 |
./full_match/4/0x4051F88D4f17B7E7F03F1a1E6C0180355b58D0Bb/sources/browser/GangMemberFactory.sol | Must be sent from the owner proxy or owner.Gang bundle full gang | function mint(uint256 _optionId, address _toAddress) public override {
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
assert(
address(proxyRegistry.proxies(owner())) == msg.sender ||
owner() == msg.sender
);
GangMember member = GangMe... | 12,308,109 |
pragma solidity ^0.4.24;
contract KAICompany {
// Company name and address of who did BD
bytes32 public name;
address public initiator;
// link back to the address of CEngine
address public contractInitiated;
// mapping of addresses to booleans that holds true if a user is on IC, HOD or on bd... | hold holds a project from an investment state given (address of sender: _from) | function hold(address _from) public onlyOwner {
require(onProject[_from] && state != States.HOLD, "must be on team");
onHold = true;
heldState = state;
state = States.HOLD;
}
| 12,557,854 |
pragma solidity ^0.5.0;
// Safe math
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function mul(... | Returns the INCH balance of the vault contract ALL TOKENS UNCLUDING ETHER ARE DISPLAYED AS 10^-18 THE BASE UNIT OF CURRENCY | function getInchBalance() public view returns(uint) {
return inchWormContract.balanceOf(address(this));
}
| 893,040 |
pragma solidity ^0.5.0;
import "./GhostOwnership.sol";
contract AuctionBase {
// @notice The ERC-165 interface signature for ERC-721.
bytes4 constant InterfaceSignature_ERC721 = bytes4(0x9f40b779);
ERC721 public nonFungibleContract;
constructor (address _nftAddress) public {
ERC721 candidate... | cancel ongoing auction. _tokenId - Ghost ID in auction to cancel. | function _cancelAuction(uint256 _tokenId) internal {
_transfer(tokenIdToAuction[_tokenId].seller, _tokenId);
_removeAuction(_tokenId);
uint256 gene = nonFungibleContract.getGene(_tokenId);
emit AuctionCancelled(gene);
}
| 1,780,925 |
/**
* @authors: [@hbarcelos]
* @reviewers: []
* @auditors: []
* @bounties: []
* @deployments: []
*
* SPDX-License-Identifier: MIT
*/
pragma solidity ^0.7.6;
import "@kleros/erc-792/contracts/erc-1497/IEvidence.sol";
import "./dependencies/IAMB.sol";
import "./CrossChainBinaryArbitration.sol";
contract HomeBin... | Registers the meta evidence at the arbitrable item level. Should be called only by the arbitrable contract. _arbitrableItemID The ID of the arbitrable item on the arbitrable contract. _metaEvidence The MetaEvicence related to the arbitrable item./ | function registerMetaEvidence(uint256 _arbitrableItemID, string calldata _metaEvidence)
external
override
onlyIfInitialized
{
emit MetaEvidenceRegistered(ICrossChainArbitrable(msg.sender), _arbitrableItemID, _metaEvidence);
bytes4 methodSelector = IForeignBinaryArbitrati... | 5,371,275 |
/**
*Submitted for verification at Etherscan.io on 2021-08-11
*/
// File: iface/IERC20.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.4;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the name of the token.
*/
f... | Moves `amount` of tokens from `sender` to `recipient`. This internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount ... | 2,317,925 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.3;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../WrappedToken.sol";
import "../interfaces/IERC2612Permit.sol";
import "../interfaces/IRouter.sol";
import "../libraries/LibDiamond.sol";
import "../libraries/LibFeeCalculator.sol";
import ... | return Returns true if the contract is paused, and false otherwise | function paused() internal view returns (bool) {
return governanceStorage().paused;
}
| 1,525,994 |
./full_match/80001/0x32eB355270230643321561E84f04A6d7Cc022b03/sources/project_/contracts/ApedToken.sol | Burn some LVRJ token and return reserve token based on current curve price _amount Number of LVRJ token to convert to reserve tokens/ | function burn(uint256 _amount) public returns (uint256) {
uint256 reserveAmount = _continuousBurn(_amount);
return reserveAmount;
}
| 840,858 |
/**
*Submitted for verification at Etherscan.io on 2021-07-28
*/
// File: @pancakeswap/pancake-swap-lib/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solid... | Update reward variables for all pools. Be careful of gas spending! | function massUpdatePools()
public
{
uint256 length = poolInfo.length;
for (uint256 pid = 0; pid < length; ++pid) {
updatePool(pid);
}
}
| 6,771,054 |
/**
*Submitted for verification at Etherscan.io on 2022-05-02
*/
// File: @openzeppelin/contracts/utils/math/SafeMath.sol
// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies o... | Function to mint new NFTs during the presale/ | function mintNFTDuringPresale(uint16 _numOfTokens) external payable onlyPresaleActive {
require(NFT_LOW_PRICE.mul(_numOfTokens) == msg.value, "Ether value sent is not correct");
require(_numOfTokens + totalSupply <= LIMIT_NFT_PRESALE, "Number of token to be minted exceed allowed");
_mintNFT(... | 6,723,989 |
./full_match/4/0x6003CeE35E9D1faBa51C24B65D1B0aD6Ef0a4DDb/sources/contracts/scam.sol | Unpauses transfers on the token./ | function unpause() public onlyOwner {
require(paused(), "CoinToken: Contract is not paused");
_unpause();
}
| 796,127 |
./full_match/1/0xc3f2C8F9d5F0705De706b1302B7a039e1e11aC88/sources/contracts/logic/RailgunLogic.sol | Verifies transaction validity return valid, reason/ Gas price of eth transaction should be equal or greater than railgun transaction specified min gas price This will only work correctly for type 0 transactions, set to 0 for EIP-1559 transactions Adapt contract must either equal 0 or msg.sender ChainID should match the... | function validateTransaction(Transaction calldata _transaction)
public
view
returns (bool, string memory)
{
if (tx.gasprice < _transaction.boundParams.minGasPrice) return (false, "Gas price too low");
if (
_transaction.boundParams.adaptContract != address(0) &&
_transaction.boundPar... | 17,076,243 |
pragma solidity ^0.4.24;
import "zeppelin/token/ERC20/SafeERC20.sol";
import "zeppelin/math/SafeMath.sol";
import "zeppelin/math/Math.sol";
import "./lib/AdditionalMath.sol";
import "contracts/MinersEscrow.sol";
import "contracts/NuCypherToken.sol";
import "contracts/proxy/Upgradeable.sol";
/**
* @notice Contract h... | Calculate amount of refund _policyId Policy id _node Node/ | function calculateRefundValue(bytes16 _policyId, address _node)
external view returns (uint256 refundValue)
{
require(_node != RESERVED_NODE);
return calculateRefundValueInternal(_policyId, _node);
}
| 889,802 |
//! The Secret Store service contract intefaces.
//!
//! Copyright 2017 Svyatoslav Nikolsky, Parity Technologies 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:... | Return index of key server at given address. | function requireKeyServer(address keyServer) public view returns (uint8) {
return KeyServerSet(keyServerSetAddress).getCurrentKeyServerIndex(keyServer);
}
| 7,281,860 |
./full_match/80001/0x954933B3a3a47F888bfdb178950A8dbe3CB34065/sources/ampersand721.sol | Create a new role identifiers | {
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
mapping(uint256 => string) private _ampersandURI;
bytes32 public constant CREATORS_MANAGER_ROLE =
keccak256("CREATORS_MANAGER_ROLE");
bytes32 public constant CREATOR_ROLE = keccak256("CREATOR_ROLE");
pragma solidity... | 5,625,417 |
./partial_match/1/0x43c6eE9D5B2369C5484f69E2Eb3361466855beDd/sources/FabricaToken.sol | `mintBatch` allows users to mint in bulk/ | function mintBatch(
address[] memory recipients,
uint256[] memory sessionIds,
uint256[] memory amounts,
string[] memory definitions,
string[] memory operatingAgreements,
string[] memory configurations,
address[] memory validators
) public whenNotPaused ret... | 2,672,106 |
/*
* Copyright 2020, NTT Communications Corp.
*
* 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... | Use new keyword to create dynamic length array | function history(
address token,
address seeker,
uint limit,
uint offset
) external view returns (Task[] memory) {
require(limit > 0, "Specify more than 1");
if (_tasks.length == 0)
return new Task[](0);
Task[] memory matchTasks = new Task[](... | 15,847,503 |
/**
*Submitted for verification at Etherscan.io on 2021-07-28
*/
/**
*Submitted for verification at Etherscan.io on 2021-07-13
*/
pragma solidity ^0.7.4;
// SPDX-License-Identifier: MIT
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. Wh... | Allows the current owner to transfer control of the contract to a newOwner. newOwner The address to transfer ownership to./ | function transferProxyOwnership(address newOwner) public onlyProxyOwner {
require(newOwner != address(0),"38");
emit ProxyOwnershipTransferred(proxyOwner(), newOwner);
setUpgradeabilityOwner(newOwner);
}
| 6,508,932 |
./partial_match/42/0x495cDCD6ae32B697Ab6d66b3ad077D570133E86e/sources/ExampleTokenCrowdsale.sol | low level token purchase DO NOT OVERRIDE _beneficiary Address performing the token purchase/ payable view returns(address,uint256,address,address) return(_beneficiary,weiAmount,address(0),address(this)); calculate token amount to be created uint256 tokens = _getTokenAmount(weiAmount); update state weiRaised = weiRais... | function buyTokens(address _beneficiary) public payable{
uint256 weiAmount = msg.value;
_preValidatePurchase(_beneficiary, weiAmount);
}
| 8,906,059 |
./full_match/1/0x92E79B2779460acd23548Af27a175467b32561b0/sources/ERC20.sol | Returns the current nonce for `owner`. This value is used to compute the signature for EIP-2612 permit. @solidity memory-safe-assembly Compute the nonce slot and load its value. | function nonces(
address owner
) public view virtual returns (uint256 result) {
assembly {
mstore(0x0c, _NONCES_SLOT_SEED)
mstore(0x00, owner)
result := sload(keccak256(0x0c, 0x20))
}
}
| 3,876,029 |
./full_match/1/0x4838099e16FC56bFdD8a76B7Fb9f338513Dd1575/sources/contracts/CrashTrading.sol | Transfers `tokenId` from `from` to `to`. As opposed to {transferFrom}, this imposes no restrictions on msg.sender. Requirements: - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. Emits a {Transfer} event./ Clear approvals from the previous owner | function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, 'ERC721: transfer of token that is not own');
require(to != address(0), 'ERC721: transfer to the zero address');
_beforeTokenTransfer(from, to, tokenId);
_approve(address(0), tokenId);
... | 3,103,471 |
pragma solidity ^0.4.13;
contract Ownable {
address internal owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
... | Function to mint tokens _to The address that will receive the minted tokens. _amount The amount of tokens to mint. return A boolean that indicates if the operation was successful./ | function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
require(totalSupply.add(_amount) <= cap);
return super.mint(_to, _amount);
}
| 6,476,982 |
./full_match/5/0x6e41fbb72Cf866c1Bb0356cBb22e6792D9245e2e/sources/contracts/Contract.sol | require(products[_id].quantity == 0, "The product is out of stock"); | function buyProductsID(uint256 _id)
external
payable
returns (uint256 quantity)
{
products[_id].quantity = products[_id].quantity - 1;
ownedProducts.push(
Product({
id: _id,
name: products[_id].name,
price: prod... | 1,956,169 |
// File: contracts/interfaces/IMarketHandler.sol
pragma solidity 0.6.12;
/**
* @title BiFi's market handler interface
* @author BiFi(seinmyung25, Miller-kk, tlatkdgus1, dongchangYoo)
*/
interface IMarketHandler {
function setCircuitBreaker(bool _emergency) external returns (bool);
function setCircuitBreakWithOwn... | Update (apply) interest entry point (external) userAddr The user address return "latest" (userDepositAmount, userBorrowAmount)/ | function applyInterest(address payable userAddr) external override returns (uint256, uint256)
{
return _applyInterest(userAddr);
}
| 1,420,272 |
./full_match/80001/0x6885802fdb3f027b8F45aFfe7fc56592Afe1aaDB/sources/contracts/CyberMarketplace2.sol | cyberVerse.transferFrom( address(this), idToMarketItem[itemId].seller, price ); | function createMarketSale(
address nftContract,
uint256 itemId
) public payable nonReentrant {
uint256 price = idToMarketItem[itemId].price;
uint256 tokenId = idToMarketItem[itemId].tokenId;
require(
cyberVerse.balanceOf(msg.sender) > price,
"Not ... | 5,685,590 |
./full_match/4/0x376fbFD580Ff7A26fA3F82E6BFa524cd22d74f85/sources/_jpegmint/contracts/token/ERC721/ERC721Lean.sol | Returns whether `spender` is allowed to manage `tokenId`. Requirements: - `tokenId` must exist./ | function _isApprovedOrOwner(address spender, uint16 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(own... | 13,328,908 |
./full_match/1/0x9ED98fD1C29018B9342CB8F57A3073B9695f0c02/sources/solidity/contracts/StakeDelegatable.sol | Gets the list of operators of the specified address. return An array of addresses. | function operatorsOf(address _address) public view returns (address[] memory) {
return ownerOperators[_address];
}
| 8,312,233 |
./full_match/1/0x5Bb938861f7561a4Bc2332980CcBC92519173b70/sources/contracts/utils/AuctionOwnable.sol | Sets the auctioneer for the contract to a new account (`newAuctioneer`). Can only be called by the current owner./ | function setAuctioneer(address newAuctioneer) public virtual onlyOwner {
_auctioneer = newAuctioneer;
}
| 8,416,553 |
./full_match/8453/0x3A5E791405526EFaDf1432Bac8d114B77Da3628c/sources/src/farms/LeetChefV1.sol | Update reward variables of the given pool. pid The index of the pool. See `poolInfo`. return pool Returns the pool that was updated. | function updatePool(uint256 pid) public returns (PoolInfo memory pool) {
pool = poolInfo[pid];
if (block.timestamp > pool.lastRewardTime) {
uint256 lpSupply = lpToken[pid].balanceOf(address(this));
if (lpSupply > 0) {
uint256 time = block.timestamp.sub(pool.la... | 11,550,717 |
./full_match/1/0x3Bd85DF9633eF0205206BB519E4dDee152Bb0005/sources/contracts/token/RewardsDistributor.sol | Sends profits and BABL tokens rewards to an address (contributor or heart garden) after a claim is requested to the protocol. _to Address to send the BABL tokens to _babl Amount of BABL to send/ | function _sendBABLToAddress(address _to, uint256 _babl) internal returns (uint256) {
_onlyUnpaused();
uint256 bablBal = babltoken.balanceOf(address(this));
uint256 bablToSend = _babl > bablBal ? bablBal : _babl;
_require(bablToSend <= (maxBablCap != 0 ? maxBablCap : DEFAULT_BABL_CAP)... | 3,050,118 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4 <0.9.0;
import '../Keep3rAccountance.sol';
import '../Keep3rParameters.sol';
import '../../../interfaces/peripherals/IKeep3rKeepers.sol';
import '../../../interfaces/external/IKeep3rV1.sol';
import '../../../interfaces/external/IKeep3rV1Proxy.sol';
import '@ope... | @inheritdoc IKeep3rKeeperFundable | function unbond(address _bonding, uint256 _amount) external override {
canWithdrawAfter[msg.sender][_bonding] = block.timestamp + unbondTime;
bonds[msg.sender][_bonding] -= _amount;
pendingUnbonds[msg.sender][_bonding] += _amount;
emit Unbonding(msg.sender, _bonding, _amount);
}
| 1,757,473 |
./partial_match/1/0xEa135c1c267124107F448f454Ad33f24FF521702/sources/StrategyWBTCPickle.sol | require(_p3crv <= pledgePickles, "Invalid amount!"); | function _withdrawSome(uint256 _amount) internal returns(uint256){
uint256 crvBefore = IERC20(crvPla).balanceOf(address(this));
uint256 _crvpla = _amount.mul(1e18).div((ICurveFi(curvefi).get_virtual_price().div(1e10)));
if (crvBefore < _crvpla)
{
_crvpla = _crvpla.sub(crvBefore);
uin... | 3,661,156 |
// UstxDEXv2.sol
// SPDX-License-Identifier: MIT
// solhint-disable-next-line
pragma solidity ^0.8.0;
import "./IUSTX.sol";
import "./IERC20.sol";
import "./Roles.sol";
import "./Initializable.sol";
import "./SafeERC20.sol";
/// @title Up Stable Token eXperiment DEX
/// @author USTX Team
/// @dev This contract imple... | Private function to get damping correction/ | function _getDamp(uint256 tokenReserve, uint256 usdtReserve) private view returns (uint256,uint256) {
tokenCirc = tokenCirc - tokenReserve;
if (ratio>_targetRatioDamp) {
ratio=_targetRatioDamp;
}
uint256 damp = _targetRatioDamp - ratio;
damp = damp * _dampFactor / _targetRatioDamp;
if (damp<_maxDamp... | 12,534,573 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.3;
import "./ZkSyncBridgeSwapper.sol";
import "./interfaces/ILido.sol";
import "./interfaces/ICurvePool.sol";
import "./interfaces/IYearnVault.sol";
/**
* @notice Exchanges Eth for the "Yearn vault Curve pool staked Eth" token.
* Indexes:
* 0: Eth
* 1: yvCrvSt... | yvCrvStETH -> crvStETH crvStETH -> ETH | function swapYvCrvForEth(uint256 _amountIn) public returns (uint256) {
uint256 crvStEthAmount = IYearnVault(yvCrvStEth).withdraw(_amountIn);
uint256 minAmountOut = getMinAmountOut((crvStEthAmount * stEthPool.get_virtual_price()) / 1 ether);
return stEthPool.remove_liquidity_one_coin(crvStEt... | 14,004,963 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.