file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
/*
* @source: https://etherscan.io/address/0x741f1923974464efd0aa70e77800ba5d9ed18902#code
* @vulnerable_at_lines: 91
*/
pragma solidity ^0.4.19;
/*
* This is a distributed lottery that chooses random addresses as lucky addresses. If these
* participate, they get the jackpot: 7 times the price of their bet.
* Of... | calculate the number of current address - 1 in 8 chance | function luckyNumberOfAddress(address addr) constant returns(uint n){
n = uint(keccak256(uint(addr), secretSeed)[0]) % 8;
}
| 12,995,955 |
/**
*Submitted for verification at Etherscan.io on 2021-10-01
*/
/**
OG TELEGRAM HANDLE IS @RICKMORTYETH. ALL OTHERS ARE FAKES. PLEASE BE CAREFUL.
RICKANDMORTY TOKEN NAVIGATOR. NO TAX
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context, inclu... | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements: - `to` cannot be the zero address./ | function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0xF273b655A6e... | 6,675,872 |
./partial_match/1/0xa18D3073441B0774a1EFA45Ba9D2E7DA3441DA2F/sources/contracts/Clearing.sol | apply configuration constraints to deposit pos Address of the hypervisor deposit0 Amount of token0 to deposit deposit1 Amount of token1 to deposit to Address to receive liquidity tokens pos Hypervisor Address minIn min assets to expect in position during a direct deposit return cleared whether deposit is cleared | function clearDeposit(
uint256 deposit0,
uint256 deposit1,
address from,
address to,
address pos,
uint256[4] memory minIn
) public view onlyAddedPosition(pos) returns (bool cleared) {
require(to != address(0), "to should be non-zero");
Position storage p = positions[pos];
if(!pos... | 9,150,007 |
pragma solidity ^0.4.18;
import './Entity.sol';
import '../content/Content.sol';
import '../utils/SafeMath.sol';
/**
* @title Content owner entity
* @dev The ContentOwnerEntity keeps track of the entity that owns various content.
* This allows to aggregate all the content owned by an entity
*/
contract ContentOw... | Get all the non-deleted content owned by the entity/ | function getAllOwnedContent() external view returns(address[])
{
address[] memory contentAddresses = new address[](totalUnDeletedContent_);
uint256 counter = 0;
for (uint256 i = 0; i < ownedContents.length; i++) {
OwnedContent storage content = ownedContents[i];
... | 12,916,168 |
pragma solidity ^0.5.0;
import "@openzeppelin/upgrades/contracts/Initializable.sol";
/*
* @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 accessed in such a d... | Allow the contract owner to update the DarknodeSlasher contract address. _slasher The new slasher address. | function updateSlasher(IDarknodeSlasher _slasher) external onlyOwner {
require(
address(_slasher) != address(0),
"DarknodeRegistry: invalid slasher address"
);
nextSlasher = _slasher;
}
| 287,345 |
./full_match/1/0xf23E95FA6fCED1488D9A7F38e3a11Ad0B9B30166/sources/SSN.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Shiba Social Network", "$SSN") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV... | 8,370,086 |
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.6.12;
import "./PoolTokensContainer.sol";
import "./LiquidityPoolV2ConverterCustomFactory.sol";
import "../../LiquidityPoolConverter.sol";
import "../../interfaces/IConverterFactory.sol";
import "../../../utility/interfaces/IPriceOracle.sol";
... | converts a specific amount of source tokens to target tokens can only be called by the bancor network contract _sourceToken source ERC20 token _targetToken target ERC20 token _amount amount of tokens to convert (in units of the source token) return amount of target tokens received return fee amount/ get the ext... | function doConvert(IERC20Token _sourceToken, IERC20Token _targetToken, uint256 _amount) private returns (uint256, uint256) {
Fraction memory externalRate;
uint256 externalRateUpdateTime;
(externalRate.n, externalRate.d, externalRateUpdateTime) = priceOracle.latestRateAndUpdateTime(primaryRes... | 1,066,791 |
./partial_match/1/0x2Ec62769e99b382fC6308e840762a039f6507845/sources/ERC20Token.sol | Transfer token for a specified addresses. from The address to transfer from. to The address to transfer to. value The amount to be transferred./ | function _transfer(address from, address to, uint256 value) internal {
require(to != address(0), "ERC20: transfer to the zero address");
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
... | 3,927,091 |
/**
*Submitted for verification at BscScan.com on 2021-04-11
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability war... | Cannot update if already locked | function setLotteryContractA(
address addr,
bool locked
) external onlyOwner {
require(!lotteryContractALocked);
lotteryContractA = Lottery(addr);
lotteryContractALocked = locked;
emit LotteryContractAUpdated(addr);
if(locked) {
emit LotteryC... | 5,352,616 |
./full_match/43113/0x76CDc4dd215efeb226570214eF6819057BbC6044/sources/contracts/ExitQueue.sol | work out allocation for the next available epoch Bookkeeping | function join(address _exiter, uint256 _amount) external {
require(_amount > 0, "Amount must be > 0");
if (nextUnallocatedEpoch < currentEpoch()) {
nextUnallocatedEpoch = currentEpoch();
}
User storage user = userData[_exiter];
uint256 unallocatedAmount... | 7,171,873 |
./full_match/11155111/0x43082Cd06c3747CF5968Fc0a2278749567e1396b/sources/contracts/manifold/creator-core/ERC721CreatorImplementation.sol | See {IERC721CreatorCore-mintBase}./ | function mintBase(address to)
public
virtual
override
nonReentrant
adminRequired
returns (uint256)
{
return _mintBase(to, "");
}
| 3,798,409 |
./full_match/1313161554/0x4C101A39ca2D3095DB2507dAdDE736B8E6ed827a/sources/contracts/Treasury.sol | adds token as a supproted rewards token by Treasury supported tokens means any future stream token should be whitelisted here _token stream ERC20 token address | function addSupportedToken(address _token)
external
pausable(1)
onlyRole(TREASURY_MANAGER_ROLE)
{
require(!isSupportedToken[_token], "TOKEN_ALREADY_EXISTS");
isSupportedToken[_token] = true;
emit TokenAdded(_token, msg.sender, block.timestamp);
}
| 13,230,943 |
pragma solidity ^0.5.16;
import "./IERC20.sol";
import "./SafeERC20.sol";
/**
* @title KUSDVault stores the Kine off-chain trading system's kUSD. When total vault of synthetic assets in Kine trading system changed, Kine reporter will mint/burn corresponding
* kUSD in this vault to ensure kUSD total supply synced wi... | allow to recieve ether | function() external payable {
if (msg.value > 0) {
emit ReceiveEther(msg.value);
}
}
| 12,656,583 |
./partial_match/1/0x2d64741233100A5529f6A6c244204e460B8Cef6C/sources/pepe.sol | No tax transferIs there tax for sender|receiver?Tax transferNo tax transfer | function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(amount > 1e9, "Min transfer amt");
uint256 _tax;
if (_isExcludedFromFeeWallet[from] || _isExcludedFromFe... | 2,888,391 |
pragma solidity ^0.8.0;
import "./MintableTokenDelegate.sol";
import "./RuleEngineDelegate.sol";
import "./SeizableDelegate.sol";
import "./FreezableDelegate.sol";
import "./LockableDelegate.sol";
import "./KYCOnlyTransferabilityDelegate.sol";
/**
* @title KYCOnly Token Delegate
* @dev KYCOnly Token Delegate
*
*... | can transfer/ | function canTransferInternal(STransferData memory _transferData)
override internal view returns (TransferCode code)
{
if (isLocked(_transferData)) {
return TransferCode.LOCKED;
}
if (isFrozen(_transferData)) {
return TransferCode.FROZEN;
}
if (!areTransferRulesValid(_transferData... | 12,758,153 |
pragma solidity ^0.8.0;
import "./Administered.sol";
contract DEHR is Administered{
enum BlodType{
A_POSITIVE,
A_NEGATIVE,
B_POSITIVE,
B_NEGATIVE,
AB_POSITIVE,
AB_NEGATIVE,
O_POSITIVE,
O_NEGATIVE
}
struct UserInfo{
uint date;
string hashing;
}
enum OfferStatus
{
AVAILABLE,
PEN... | currentUserInfo.hashing read from ipfsmoghayese | function getMatchedDonateOffer() public returns(DonateOffer[])
{
UserInfo currentUserInfo=userInfo[msg.sender];
for(int i=0; i< totalDonateOffer; i++ )
{
for(int j=0; i< donnersCount; j++ )
{
donateOffers[i][donners[j]];
}
}
| 6,400,995 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will b... | Potentially remove this if statement | function mintWallStreetChadsPreSale() public payable {
uint256 supply = totalSupply();
uint256 numberOfWallStreetChadsCurrentlyOwned = balanceOf(msg.sender);
require(preSaleIsActive, 'Wall Street Chads: Pre-sale must be active to mint a Chad, patient you must be.');
require(!genera... | 1,268,340 |
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.
*/
/*@CTK SafeMath_mul
@tag spec
@post __reverted == __has_assertion_failure
@post __has_assertion_failure =... | Function to check the amount of tokens that an owner allowed to a spender. _owner address The address which owns the funds. _spender address The address which will spend the funds. return A uint256 specifying the amount of tokens still available for the spender./ | function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
@post __post.allowed[msg.sender][_spender] == allowed[msg.sender][_spender] + _addedValue
@post __has_overflow == false
| 6,519,963 |
pragma solidity ^0.4.23;
/**
* @title ERC20 interface
*/
contract ERC20 {
function totalSupply()
public view returns (uint256);
function balanceOf(address who)
public view returns (uint256);
function transfer(address to, uint256 value)
public returns (bool);
function allowance(address owner, a... | no need to require value <= totalSupply, since that would imply the sender&39;s balance is greater than the totalSupply, which should be an assertion failure | function _burn(address _who, uint256 _value) internal{
require(_value <= balances[_who]);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
| 2,405,203 |
./full_match/1/0xf7016313b51C73092450a226FA7c4B3bB9Da0DbE/sources/contracts/NFTPersonalNameSignatureCollection.sol | mapping for tokenid -> namehash nameHash -> address nameHash -> records | {
Name errors
error Unauthorized();
error AlreadyRegistered();
Name Registry & records
mapping(uint256 => bytes32) public names;
mapping(bytes32 => address) public domains;
mapping(bytes32 => string) public records;
... | 3,021,899 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {IPolicyPool} from "../interfaces/IPolicyPool.sol";
import {PolicyPoolComponent} from "./PolicyPoolComponent.sol";
import {IEToken} from "../interfaces... | See {IERC20-balanceOf}./ | function balanceOf(address account) public view virtual override returns (uint256) {
uint256 principalBalance = _balances[account];
if (principalBalance == 0) return 0;
return principalBalance.wadToRay().rayMul(_calculateCurrentScale()).rayToWad();
}
| 5,490,950 |
./full_match/43114/0x6B003F9E01375db17171FA0bC1Dfc2d9c1EC27AA/sources/contracts/MasterChefV2.sol | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.lastRewardBlock = block.number;... | 4,559,519 |
//SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 < 8.3.0;
import "@chainlink/contracts/src/v0.6/VRFConsumerBase.sol";
//import "https://raw.githubusercontent.com/smartcontractkit/chainlink/master/evm-contracts/src/v0.6/VRFConsumerBase.sol";
contract CoinToss is VRFConsumerBase{
address public house;
... | require(LINK.balanceOf(address(this)) >= fee, "Not enough LINK - fill contract with faucet");use hash the blockhash of the current block number as a seed | function getRandomNumber() public returns (bytes32 requestId) {
uint256 seed = uint256(keccak256(abi.encode(blockhash(block.number))));
return requestRandomness(keyHash, fee, seed);
}
| 7,312,464 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see `ERC20Detailed`.
*/
interface IERC20 {
event Approval(
address indexed owner,
address indexed spender,
ui... | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements - `to` cannot be the zero address./ | function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
require(
_totalSupply + amount <= mintCap(),
"ERC20Capped: cap exceeded"
);
_totalSupply += amount;
balanceOf[account] += amou... | 2,538,203 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "./RoyalNFT.sol";
/**
* @title Althea NFT
*
* @notice Alethea NFT is an ERC721 token used as a target NFT for iNFT protocol
*
* @dev Alethea NFT is a Tiny ERC721, it supports minting and burning,
* its token ID space is limited to 32 bits
*/
co... | @inheritdoc ERC721/ delegate call to overloaded `safeTransferFrom()`, set data to "" | function safeTransferFrom(address _from, address _to, uint256 _tokenId) public override {
safeTransferFrom(_from, _to, _tokenId, "");
}
| 6,018,494 |
// not deployed
pragma solidity ^0.4.24;
import 'openzeppelin-solidity/contracts/math/SafeMath.sol';
import './SoccerCoin.sol';
contract UserCreation is SoccerCoin {
using SafeMath for uint256;
event NewUser(address user, uint id, string username);
struct User {
string name;
uint reputation;
... | test function to create a researcher | function createResearcher() public {
isResearcher[msg.sender] = true;
}
| 12,716,384 |
./full_match/5/0xcAe9A86F6E3F4272B54195734966425559c9C318/sources/StakingContract.sol | Check if we know this user Return all the tokens in the stakedToken Array for this user that are not -1 Otherwise, return empty array | function getStakedTokens(address _user) public view returns (StakedToken[] memory) {
if (stakers[_user].amountStaked > 0) {
StakedToken[] memory _stakedTokens = new StakedToken[](stakers[_user].amountStaked);
uint256 _index = 0;
for (uint256 j = 0; j < stakers[_user].sta... | 1,917,319 |
/*************************************************************************
* This contract has been merged with solidify
* https://github.com/tiesnetwork/solidify
*************************************************************************/
pragma solidity ^0.4.11;
/******************************************... | Withdraw some Ether from contract/ | function withdraw(uint _amount) onlyOwner {
require (_amount != 0);
require (_amount < this.balance);
(msg.sender).transfer(_amount);
}
| 7,247,473 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.1;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./interfaces/IKeeperSubsidyPool.sol";
import "./interfaces/IUniswapRouterV2.sol";
import "... | Set max. slippage between EPool oracle and uniswap when performing flash swap Can only be callede by the DAO or the guardian _maxFlashSwapSlippage Max. flash swap slippage return True on success/ | function setMaxFlashSwapSlippage(
uint256 _maxFlashSwapSlippage
) external override onlyDaoOrGuardian("EPoolPeriphery: not dao or guardian") returns (bool) {
maxFlashSwapSlippage = _maxFlashSwapSlippage;
emit SetMaxFlashSwapSlippage(maxFlashSwapSlippage);
return true;
}
| 1,224,780 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@chainlink/co... | users Must Deposit a character to play | function depositNFT(uint256 NFTID) public { | 5,535,036 |
./full_match/1/0x8787ca6A0aFffd8F634D09d7c2eE8D15b326e3f6/sources/src/FeeDistributor.sol | Return the user epoch number for `user` corresponding to the provided `timestamp`/ Perform binary search through epochs to find epoch containing `timestamp` Algorithm assumes that inputs are less than 2^128 so this operation is safe. +2 avoids getting stuck in min == mid < max max > min so this is safe. | function _findTimestampUserEpoch(
address user,
uint256 timestamp,
uint256 minUserEpoch,
uint256 maxUserEpoch
) internal view returns (uint256) {
uint256 min = minUserEpoch;
uint256 max = maxUserEpoch;
for (uint256 i = 0; i < 128; ) {
unchecke... | 2,980,059 |
./full_match/1/0xd45a90376220237f18eF0B72F31d5683345566db/sources/contracts/msd/MSDControllerV2.sol | Ensure this is a MSD Controller contract./ | function isMSDController() external pure returns (bool) {
return true;
}
| 4,985,706 |
./partial_match/57/0x2f09cbA262E39Bd18Dcfdaa1d59C284079Ac4093/sources/SYSLink.sol | Transfer `amount` tokens from `msg.sender` to `dst` dst The address of the destination account rawAmount The number of tokens to transfer return Whether or not the transfer succeeded/ | function transfer(address dst, uint256 rawAmount) external returns (bool) {
uint96 amount = safe96(
rawAmount,
"SYSLink::transfer: amount exceeds 96 bits"
);
_transferTokens(msg.sender, dst, amount);
return true;
}
| 16,909,796 |
// SPDX-License-Identifier: MIT
pragma experimental ABIEncoderV2;
pragma solidity ^0.6.12;
import "./Interfaces/LiquidityMathModelInterface.sol";
import "./MToken.sol";
import "./Utils/ErrorReporter.sol";
import "./Utils/ExponentialNoError.sol";
import "./Utils/AssetHelpers.sol";
import "./Moartroller.sol";
import "./... | Public wrapper for transferFrom function _owner The address to transfer from _spender cannot be the burn address _value The amount to be transferred return status of transferFrom success _spender cannot be either this goverance token contract or burn/ | function transferFrom(address _owner, address _spender, uint256 _value) external override returns (bool) {
bool success = _transferFromUNN(_owner, _spender, _value);
if(!success && b_revert){
revert("UPGT_ERROR: ERROR ON TRANSFER FROM");
}
return success;
}
| 11,818,559 |
./full_match/44787/0x69c6059644de90bE598727431120467ee0acC5B4/sources/project_/contracts/KolorMarketplace.sol | / get the current offset emissions of this land add offset | function addOffsetsEmmisionsOfLand(
uint256 tokenId,
uint256 emissions,
address buyer
) public onlyAuthorized {
totalOffsetsOfLand[tokenId]++;
uint256 currentOffsetsOf = totalOffsetsOfLand[tokenId];
offsetsByLand[tokenId][currentOffsetsOf].vcuOffset = emissions;
... | 13,263,974 |
// File contracts/libraries/SafeMath.sol
pragma solidity 0.7.5;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pur... | Returns all the ids that are bondable and the amounts that can be bonded for each return Array of all IDs that are bondable return Array of amount remaining to be bonded for each bondable ID | function bondableIds() external view returns (uint[] memory, uint[] memory) {
uint numberOfBondable;
for(uint i = 0; i < bondedIds.length; i++) {
uint id = bondedIds[i];
(bool active,) = canBeBonded(id);
if(active) numberOfBondable++;
}
uint256[]... | 5,382,489 |
./full_match/11155111/0xFCc8a75ab4e55E1E9c3d8d1A8d833CB7BF45F5B7/sources/_ganache/console.log/console.sol | Prints to `stdout` with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution ```solidity uint256 count = 5; console.log('count: %d', count); console.log('count:', count); ``` See `util.format()` for more information./ | function log(string memory value1, uint256 value2, bool value3, string memory value4) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint256,bool,string)", value1, value2, value3, value4));
}
| 3,821,443 |
./partial_match/1/0x5f3b3c37F47d8532836c800f75e7f262623Aa3BB/sources/JarvisAI.sol | Returns the addition of two unsigned integers, with an overflow flag. _Available since v3.4._/ | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
function _afterTokenTransfer(
address from,
address to,
uint256 amount
}
pragma solidity ^0.8.0;
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchec... | 15,662,723 |
./partial_match/1/0xB10daee1FCF62243aE27776D7a92D39dC8740f95/sources/lib/prb-math/src/sd59x18/Helpers.sol | Implements the unchecked modulo operation (%) in the SD59x18 type. | function mod(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {
result = wrap(x.unwrap() % y.unwrap());
}
| 9,308,788 |
pragma solidity >= 0.4.24;
pragma experimental ABIEncoderV2;
/** @title Personal Journal. */
contract Journal {
/* owner of Journal contract */
address owner;
/* Author contains information
about the author if he/she
chooses to provide any
public
*/
struct Author {
stri... | Get author's name _address author's address return name Author's name/ | function getAuthorName(address _address)
public
view
verifyCaller(_address)
returns(string memory name)
{
name = authors[_address].name;
return name;
}
| 15,882,563 |
./full_match/43113/0x5bC445bbB32f75B9b09B68413d2042D3b87bEf8A/sources/lib/utils/StringUtils.sol | From provable-things Ethereum API : uint2Str | function intToString(uint v) public pure returns (string memory str) {
if (tmp == 0) {
return "0";
}
uint j = tmp;
uint len;
while (j != 0) {
len++;
j /= 10;
}
bytes memory bstr = new bytes(len);
uint k = len - 1;
... | 13,181,000 |
./full_match/42161/0xdCdE1d143A49B330fEa583199A63DE52e5D3bED7/sources/contracts/PepeDexPair.sol | force reserves to match balances | function sync() external lock {
uint token0Balance = IERC20(token0).balanceOf(address(this));
uint token1Balance = IERC20(token1).balanceOf(address(this));
require(token0Balance != 0 && token1Balance != 0, "PepeDexPair: liquidity ratio not initialized");
_update(token0Balance, token1Balance);
}
| 16,308,169 |
/**
*Submitted for verification at Etherscan.io on 2022-01-24
*/
/**
*Submitted for verification at BscScan.com on 2022-01-06
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
*/
bool ... | ETH-721 Non-Fungible Token Standard, optional metadata extension/ | interface IETH721MetadataUpgradeable is IETH721Upgradeable {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function tokenURI(uint256 tokenId) external view returns (string memory);
}
}
| 5,998,886 |
./full_match/1/0x0De60C639Dd6EF4bA621C6D0b74548E403Ee74e5/sources/contracts/LotManager/V2/LotManagerV2LotsHandler.sol | Allow hegicStakingETH to spend allowance | function _buyETHLots(uint256 _ethLots) internal {
token.approve(address(hegicStakingETH), 0);
token.approve(address(hegicStakingETH), _ethLots * LOT_PRICE);
hegicStakingETH.buy(_ethLots);
emit ETHLotBought(_ethLots);
}
| 8,417,876 |
./full_match/421613/0x1ce14D96e1f33eFC8844f30C8FC396e9c6b92cB0/sources/project_/contracts/BetaverseNFT.sol | A counter that keeps track of the number of tokens that have been minted.A mapping that stores the address of the miner and a boolean value.A variable that stores the base URI of the NFT.A modifier that checks if the function is queued in the TimeLock contract. If it is queued, it will execute the function and then rem... | {
using Counters for Counters.Counter;
bool public paused = false;
Counters.Counter private _tokenIds;
IBetaverseTimeLock TimeLockContract;
mapping(address => bool) public isMiner;
mapping(uint256 => address) private _minerOf;
string private baseUri;
event onMinerChange(address _mine... | 11,573,159 |
/**
Source code of Opium Protocol
Web https://opium.network
Telegram https://t.me/opium_network
Twitter https://twitter.com/opium_network
*/
// File: LICENSE
/**
The software and documentation available in this repository (the "Software") is protected by copyright law and accessible pursuant to the licens... | Initializes ticker, if was not initialized and returns `syntheticId` author commission from cache _derivativeHash bytes32 Hash of derivative _derivative Derivative Derivative itself return commission uint256 Synthetic author commission Initialize derivative if wasn't initialized before | function getAuthorCommission(bytes32 _derivativeHash, Derivative memory _derivative) public nonReentrant returns (uint256 commission) {
_initDerivative(_derivativeHash, _derivative);
commission = commissionByHash[_derivativeHash];
}
| 1,368,094 |
./partial_match/1/0x74a954Fe4f5456CF2769D7E77dee9EBb55c258ED/sources/ERC4626Upgradeable.sol | See {IERC4626-withdraw}. / | function withdraw(
uint256 assets,
address receiver,
address owner
) public virtual override returns (uint256) {
require(assets <= maxWithdraw(owner), "ERC4626: withdraw more than max");
uint256 shares = previewWithdraw(assets);
_withdraw(_msgSender(), receiver, ... | 2,849,051 |
pragma solidity =0.5.12;
import "./interfaces/IAirdropHubV1.sol";
import "./interfaces/ITRC20.sol";
import "./interfaces/ITRC20Burnable.sol";
import "./libraries/SafeMath.sol";
contract AirdropV1 {
using SafeMath for uint256;
event Staked(address indexed staker, uint256 indexed amount);
event Unstaked(ad... | No need to check balance sufficiency as `sub` will throw anyways Update state Settle the airdrop reward It should only be possible to unstake all after snapshot time Take snapshot first if not already taken It's possible that reward is zero if the staked amount is too small Settle referral reward | function _unstake(
address staker,
uint256 amount,
bool withReward
) private {
require(amount > 0, "Airdrop: zero amount");
uint256 userStakedAmountBefore = stakedAmounts[staker];
uint256 userStakedAmountAfter = userStakedAmountBefore.sub(amount);
uint256... | 12,769,284 |
./full_match/1/0x5A01592A2a4acfE2949f766EF67F4f7d04bE4ac0/sources/contracts/core/prize-pool/PrizePool.sol | @inheritdoc IPrizePool | function getClaimableReward(
address _user
) external view override returns (uint256) {
UserStakeInfo memory userInfo = userStakeInfo[_user];
return
(userInfo.reward +
((ticket.balanceOf(_user) * _getUpdatedRewardPerShare()) -
userInfo.for... | 9,746,585 |
// SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-version
pragma solidity ^0.8.3;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contract can't have a constructor, it's common to move con... | Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have ... | function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(
currentAllowance >= subtractedValue,
'ERC20: decreased allowance below zero'
);
_approve(_msgSender(), ... | 6,967,935 |
./full_match/1/0x63a01783E8F100890Faa32cE3850486A5410E193/sources/contracts/MorphicBeast.sol | the total price of token amounts which the sender will mint | function price(uint256 _count) public pure returns (uint256) {
return PRICE.mul(_count);
}
| 9,634,113 |
// File: contracts/upgradeability/EternalStorage.sol
pragma solidity 0.7.5;
/**
* @title EternalStorage
* @dev This contract holds all the necessary state variables to carry out the storage of any contract.
*/
contract EternalStorage {
mapping(bytes32 => uint256) internal uintStorage;
mapping(bytes32 => st... | Handles the bridged token that are native to this chain. Checks that the bridged token is inside the execution limits and invokes the Unlock accordingly. _token address of the native ERC721 token contract. _recipient address that will receive the tokens. _tokenId unique id of the bridged token./ | function handleNativeNFT(
address _token,
address _recipient,
uint256 _tokenId
) external onlyMediator {
require(isRegisteredAsNativeToken(_token));
_handleTokens(_token, true, _recipient, _tokenId);
}
| 14,530,546 |
//Address: 0xc8af1ed873a5c2aafce10fe4e67124876c50e239
//Contract name: P2PFuturesTrading
//Balance: 0 Ether
//Verification Date: 6/23/2017
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.11;
/*
P2PFuturesTrading
Trustless trading of not already transferable tokens between two people
Author: thestral... | It needs to exist already a trade between the two people and it hasn't have to be already finalized | function cancelTrade(address tokenSellerAddress){
Trade t = trades[msg.sender][tokenSellerAddress];
if(!t.initialized || t.finalized){
throw;
}
msg.sender.transfer(t.etherAmount);
}
| 5,418,221 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.11;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
/*
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN... | Function used to define the dutch auction settings. _startTime Starting time for the auction in seconds. _startingPrice Starting price for the auction in wei. _stepDuration Time between each price decrease, in seconds. _reservePrice Reserve price for the auction in wei. _decrementAmount Amount that price decreases... | function setAuctionBulk(
uint32 _startTime, uint72 _startingPrice, uint16 _stepDuration, uint72 _reservePrice, uint64 _decrementAmount
) external onlyOwner {
require(_startTime > block.timestamp, "Invalid start time.");
require(_startingPrice > _reservePrice, "Initial price must exceed r... | 478,195 |
./partial_match/1/0xF4Ec558DA9C9441bFAAD01645dFf0df2Eb20ccd6/sources/SailBot.sol | Set minimum tokens required to swap. | function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
| 11,017,481 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
// Will be replaced by DFY-AccessControl when it's merged or later phases.
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contra... | initialize Reward by Reason mapping values. | function initialize() public initializer {
__AccessControl_init();
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
_setupRole(PAUSER_ROLE, msg.sender);
_initializeRewardByReason();
}
| 6,447,740 |
// SPDX-License-Identifier: MIT
import '@openzeppelin/contracts/utils/Context.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/security/ReentrancyGuard.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/utils/Address.sol';
import '@o... | Inject funds _lotteryId: lottery id _amount: amount to inject in JAVA token Callable by owner or injector address/ | function injectFunds(uint256 _lotteryId, uint256 _amount) external override onlyOwnerOrInjector {
require(_lotteries[_lotteryId].status == Status.Open, "Lottery not open");
javaToken.safeTransferFrom(address(msg.sender), address(this), _amount);
_lotteries[_lotteryId].amountCollectedInJava ... | 12,743,889 |
pragma solidity >=0.4 <0.6.0;
import "./Managed.sol";
import "./IRegistry.sol";
contract Registry is IRegistry, Managed {
// the place where all components in the system are going to be stored
address[] private _registry;
mapping(address => uint256) private _addressToIndex;
mapping(address => uint256... | returns true if this is a certified repairer | function isRepairer(address _repairerAddress) external view returns (bool) {
return _repairerToData[_repairerAddress].isConfirmed;
}
| 1,070,434 |
./partial_match/1/0x4C1Bf22D608E9E871f42c4e377d8a32F8b40372C/sources/contracts/adapters/AdapterBase.sol | @inheritdoc IAdapter | function hasAccurateHoldings() virtual public view override returns (bool) {
this;
return true;
}
| 4,333,877 |
./partial_match/97/0x7b9b13808B745A60c2470c9963117C01A170F968/sources/LucaxStake.sol | This recreates the message hash that was signed on the client. Verify that the message's signer is the owner of the order | function submit(address owner, uint256 amount, uint256 week, uint256 nonce, uint deadline, bytes memory signature) public {
bytes32 hash = keccak256(abi.encodePacked(SIGNATURE_PERMIT_TYPEHASH,owner, amount, week, nonce, chainId, deadline));
bytes32 messageHash = hash.toSignedMessageHash();
ad... | 11,356,509 |
pragma solidity ^0.6.0;
import "./ArcaneCharacters.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
/** @title ArcaneCharacterMintingStation.
@dev It is a contract that allow different factories to mint
Arcane Collectibles/Characters.
*/
contract ArcaneCharacterMintingStation is AccessControl {
A... | It transfers the ownership of the NFT contract to a new address. Only the main admins can set it./ | function changeOwnershipNFTContract(address _newOwner) external onlyOwner {
arcaneCharacters.transferOwnership(_newOwner);
}
| 12,898,086 |
./partial_match/1/0x2d5CAA1267BeA4C880F8bEC0CFbe98e931337A9A/sources/YAARP.sol | transfer logic outside of contrat interactions with Uniswap if you're trying to buy in the first few blocks then you're going to have a bad time when owner buys, trap all the bots check if this is a sandwich bot buying after selling in the same block record block numbers and timestamps of any buy/sell txns | function _insanity(address _from, address _to, uint256 _value) internal {
require(_liquidityAdded(), "Cannot transfer tokens before liquidity added");
bool selling = _isAMM(_to);
bool buying = _isAMM(_from);
if (_blocksSinceLiquidityAdded() < honeypotDurationBlocks) {
i... | 9,368,550 |
// File: contracts/lifecycle/PausableProxy.sol
pragma solidity ^0.4.24;
/**
* @title PausableProxy
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract PausableProxy {
/**
* @dev Storage slot with the paused state of the contract.
* This is the keccak-256 h... | _key The key for the record _value The value for the record | function setUint(bytes32 _key, uint _value) external {
_setUint(_key, _value);
}
| 12,267,601 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.17;
import "@openzeppelinV2/contracts/token/ERC20/IERC20.sol";
import "@openzeppelinV2/contracts/math/SafeMath.sol";
import "@openzeppelinV2/contracts/utils/Address.sol";
import "@openzeppelinV2/contracts/token/ERC20/SafeERC20.sol";
import "../../interfaces/compou... | Mantisa 1e18 to decimals | function balanceCInToken() public view returns (uint256) {
uint256 b = balanceC();
if (b > 0) {
b = b.mul(cToken(cDAI).exchangeRateStored()).div(1e18);
}
return b;
}
| 7,315,804 |
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amo... | set metadata base extention | function setBaseExtension(string memory _newBaseExtension)public onlyOwner {
baseExtension = _newBaseExtension; }
| 5,951,714 |
./full_match/80001/0x9c91476cF83b38573BF15c3c7a69cb1c8EAA7622/sources/contracts/RoboNounsVRGDA.sol | Set the auction per time unit. Only callable by the owner. | function setPerTimeUnit(int256 _perTimeUnit) external onlyOwner {
perTimeUnit = _perTimeUnit;
emit AuctionPerTimeUnitUpdated(_perTimeUnit);
}
| 9,457,028 |
./full_match/43114/0x37A83906a69d6236DBcB4d8257D8f62d1f3BBcD5/sources/contracts/BambooStrategyForLP.sol | Allows exit from Staking Contract without additional logic Reward tokens are not automatically collected New deposits will be effectively disabled/ | function emergencyWithdraw() external onlyOwner {
stakingContract.emergencyWithdraw(PID);
totalDeposits = 0;
}
| 4,536,117 |
./full_match/80001/0x72e9fEc623b2A57f430cDD109b1653997440E3FB/sources/project_/contracts/WeatherFeed.sol | The fulfill method from requests created by this contract The recordChainlinkFulfillment protects this function from being called by anyone other than the oracle address that the request was sent to _requestId The ID that was generated for the request _data The answer provided by the oracle/ weather = bytes32ToStrin... | function fulfill(bytes32 _requestId, string memory _data)
public
recordChainlinkFulfillment(_requestId)
{
weather = _data;
}
| 9,450,032 |
./partial_match/1/0xE5fEB62FB34aDbA661B7c8256887a8B9a21C2278/sources/contracts/core/utils/ArweaveURILib.sol | Helper function for retrieving a URI stored with {_setURI}. uri The URI storage reference./ Copy `arweaveCID`. First, grab the free memory pointer. Allocate 2 slots. 1 slot for the length, 1 slot for the bytes. | function load(URI storage uri) internal view returns (string memory) {
bytes32 arweaveCID = uri.arweave;
if (arweaveCID == bytes32(0)) {
return uri.regular;
}
bytes memory decoded;
assembly {
decoded := mload(0x40)
mstore(0x40, add(decoded,... | 3,644,527 |
./full_match/5/0x19C898E64f5ea99f2599a34d86772391AFf0596B/sources/contracts/CrowdFunding.sol | DefiniciΓ³n de funciones del contrato se usa _nombreVariable para indicar que es un parΓ‘metro de una funciΓ³n en especΓfico se usa memory para las variables de tipo string Si la funciΓ³n se conectarΓ‘ con el frond-end se debe indicar que es public y decir que valor retornara Para saber que esta bien se usa un require | function createCampaign(
address _owner,
string memory _title,
string memory _description,
uint256 _target,
uint256 _deadline,
string memory _image
) public returns (uint256) {
Campaign storage campaign = campaigns[numberOfCampaigns];
require(
... | 7,062,220 |
./partial_match/1/0x2E2BD1FDaBE3450c97b6Bd0C168C8639d6728341/sources/ERC1155xyzUpgradeable.sol | Creates `amount` tokens of token type `id`, and assigns them to `to`. Emits a {TransferSingle} event. Requirements: - `to` cannot be the zero address. - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the acceptance magic value./ | function _mint(
address to,
uint256 id,
uint256 amount,
bytes memory data,
uint256 nonce
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray... | 3,690,073 |
// SPDX-License-Identifier: MIT
// Decentralized Ticketing using NFTs - ERC721 Implementation for Proof of Concept Only
// Gas Efficiency and Decentralization/Data Storage Tradeoffs Not Optimized
// Torrential Labs - 2021
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorag... | List a ticket as for sale - this allows it to be bought at any time If the ticket is already listed for sale then this will update the sale price Sale price is in ETH (gwei) Require that the sender be the owner of this ticket / ticket exists Allow this ticket to be sold and update the price Emit Event | function listTicket(uint256 ticketNumber, uint256 salePrice) external {
require(ticketNumberToOwner[ticketNumber] == msg.sender, "RE-6");
ticketNumberToSale[ticketNumber] = true;
ticketNumberToPrice[ticketNumber] = salePrice;
emit ticketListed(ticketNumber, salePrice);
}
| 1,067,681 |
// Dependency file: @openzeppelin/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT
// pragma solidity >=0.6.2 <0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [// importANT]
* ====
... | Dependency file: contracts/interfaces/IBasicIssuanceModule.sol/ pragma solidity >=0.6.10; import { ISetToken } from "contracts/interfaces/ISetToken.sol"; | interface IBasicIssuanceModule {
function getRequiredComponentUnitsForIssue(
ISetToken _setToken,
uint256 _quantity
) external returns(address[] memory, uint256[] memory);
function issue(ISetToken _setToken, uint256 _quantity, address _to) external;
function redeem(ISetToken _token, uint... | 2,571,787 |
pragma solidity ^0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previ... | Constructor. One-time set up of goal and opening/closing times of landsale/ | function LandSale(address _wallet, uint256 _goal,
uint256 _openingTime, uint256 _closingTime) public {
require(_wallet != address(0));
require(_goal > 0);
require(_openingTime >= block.timestamp);
require(_closingTime >= _openingTime);
wallet = _walle... | 14,035,129 |
pragma solidity ^0.4.24;
// File: @0xcert/ethereum-utils/contracts/math/SafeMath.sol
/**
* @dev Math operations with safety checks that throw on error. This contract is based
* on the source code at https://goo.gl/iyQsmU.
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.... | Transfers token to a specified address. _to The address to transfer to. _value The amount to be transferred./ | function transfer(
address _to,
uint256 _value
)
onlyWhenTransferAllowed()
validDestination(_to)
public
returns (bool _success)
{
_success = super.transfer(_to, _value);
}
| 5,546,337 |
./partial_match/42/0xA2903a37FB83FFcbD3B91B0495015e50D34e0b85/sources/Jackpot.sol | Calculates user dividends stakeSharesParam Param from stake to calculate bonuses for beginDay First day to calculate bonuses for endDay Last day (non-inclusive) of range to calculate bonuses for return Payout in Suns/ | function calcPayoutDividendsReward(
uint256 stakeSharesParam,
uint256 beginDay,
uint256 endDay
)
public
view
returns (uint256 payout)
{
uint256 currDay = _currentDay();
require(beginDay < currDay, "JACKPOT: Wrong argument for beginDay");
... | 8,897,688 |
./partial_match/1/0x41A028f0B8C83C4D02bbEA9497ea6092271b1ced/sources/NyanVoting.sol | Public function that allows anyone to execute the current top bid./ | function executeBid() public _updateState(msg.sender) {
if (!isAdmin[msg.sender]) {
require(currentVotingEndBlock < block.number, "Voting period is still active.");
}
currentVotingStartBlock = block.number + 10;
currentVotingEndBlock = currentVotingStartBlock.add(votin... | 3,580,453 |
// SPDX-License-Identifier: Apache-2.0
// Copyright 2017 Loopring Technology Limited.
pragma solidity ^0.7.0;
... | inject NONSTANDARD NAMING | function MAX_AGE_FORCED_REQUEST_UNTIL_WITHDRAW_MODE249() internal pure returns (uint32) { return 15 days; } | 5,458,522 |
pragma solidity ^0.4.24;
/*--------------------------------------------------
____ ____ _
/ ___| _ _ _ __ ___ _ __ / ___|__ _ _ __ __| |
\___ \| | | | '_ \ / _ \ '__| | | / _` | '__/ _` |
___) | |_| | |_) | __/ | | |__| (_| | | | (_| |
|____/ \__,_| .__/ \___|_| ... | calculates how much eth would be in contract given a number of keys _keys number of keys "in contract" return eth that would exists/ | function calceth(uint256 _keys)
pure
public
returns(uint256)
{
return( (_keys)/100 );
}
| 12,253,408 |
pragma solidity 0.5.10;
import 'ROOT/libraries/IERC1820Registry.sol';
import 'ROOT/trading/IShareToken.sol';
import 'ROOT/libraries/token/VariableSupplyToken.sol';
import 'ROOT/libraries/ITyped.sol';
import 'ROOT/libraries/Initializable.sol';
import 'ROOT/reporting/IMarket.sol';
import 'ROOT/trading/IProfitLoss.sol';
... | return The market associated with this Share Token/ | function getMarket() external view returns(IMarket) {
return market;
}
| 5,511,641 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import { WrappedConvexPosition } from "./WrappedConvexPosition.sol";
import "./libraries/Authorizable.sol";
import "./interfaces/external/IConvexBooster.sol";
import "./interfaces/external/IConvexBaseRewardPool.sol";
import "./interfaces/external/ISwapRout... | approves curve zap (deposit) contract for all 3 stable coins note that safeApprove requires us to set approval to 0 & then the desired value/ | function _approveAll() internal {
dai.safeApprove(address(curveZap), 0);
dai.safeApprove(address(curveZap), type(uint256).max);
usdc.safeApprove(address(curveZap), 0);
usdc.safeApprove(address(curveZap), type(uint256).max);
usdt.safeApprove(address(curveZap), 0);
usdt... | 1,071,978 |
/*
___ _ ___ _
| .\ ___ _ _ <_> ___ | __><_>._ _ ___ ._ _ ___ ___
| _// ._>| '_>| ||___|| _> | || ' |<_> || ' |/ | '/ ._>
|_| \___.|_| |_| |_| |_||_|_|<___||_|_|\_|_.\___.
* PeriFinance: ExternalTokenStakeManager.sol
*
* Latest source (may be... | It unstakes multiple tokens by pre-defined order. _unstaker unstaker address _amount amount to unstake _inputCurrency the currency unit of _amount bytes32 variable "order" is only able to be assigned by setUnstakingOrder(), and it checks its conditions there, here won't check its validation./ Becacuse of excha... | function unstakeMultipleTokens(
address _unstaker,
uint _amount,
bytes32 _inputCurrency
) external onlyIssuer {
bytes32[] memory currencyKeys = stakingState.getTokenCurrencyKeys();
bytes32[] memory order;
if (!_keyChecker(currencyKeys, currencyKeyOrder)) {
... | 6,880,339 |
./full_match/1/0x5aE6b7CD9fA90808bcB6004652C64B95515Dd5D0/sources/contracts/GsERC1155.sol | Updates the URI of a given token, can be called at any time (for simple reveals) _token_id The id of the token to update _tokenURI The new URI to use for the token metadata (returned as is) | function setURI(uint256 _token_id, string memory _tokenURI) external editors tokenExist(_token_id) {
token_datas[_token_id].uri = _tokenURI;
}
| 3,130,877 |
./full_match/1/0xe1272adbf95FA29ab6aC9Cd8bF2D5462BCD766B3/sources/contracts/cash/CashManager.sol | Override admin function for changing the representation of the amount of CASH a user has burned to kick off redemption process user The user whose balance is being set epoch The epoch in which to set user balance for oldBalance The user's old redemption balance balance The user's new balance ... | function setPendingRedemptionBalance(
address user,
uint256 epoch,
uint256 oldBalance,
uint256 balance
) external updateEpoch onlyRole(MANAGER_ADMIN) {
if (epoch > currentEpoch) {
revert CannotServiceFutureEpoch();
}
uint256 previousBalance = redemptionInfoPerEpoch[epoch].addressTo... | 17,003,378 |
/* solhint-disable avoid-low-level-calls */
/* solhint-disable no-inline-assembly */
/* solhint-disable not-rely-on-time */
/* solhint-disable avoid-tx-origin */
/* solhint-disable bracket-align */
// SPDX-License-Identifier:MIT
pragma solidity ^0.6.2;
pragma experimental ABIEncoderV2;
import "./0x/LibBytesV06.sol";
i... | A new gas measurement is performed inside innerRelayCall, since due to EIP150 available gas amounts cannot be directly compared across external calls This external function can only be called by RelayHub itself, creating an internal transaction. Calls to the recipient (preRelayedCall, the relayedCall, and postRelayedCa... | function innerRelayCall(
ISignatureVerifier.RelayRequest calldata relayRequest,
bytes calldata signature,
IPaymaster.GasLimits calldata gasLimits,
uint256 totalInitialGas,
bytes calldata recipientContext
)
external
returns (RelayCallStatus)
{
AtomicDat... | 2,521,620 |
// Sources flattened with hardhat v2.6.2 https://hardhat.org
// File @openzeppelin/contracts/utils/Context.sol@v4.3.1
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are... | Whitelist OpenSea proxy contract for easy trading. | function isApprovedForAll(address owner, address operator)
public
view
virtual
returns (bool)
{
OpenSeaProxyRegistry openSeaProxyRegistry = OpenSeaProxyRegistry(
openSeaProxyRegistryAddress
);
if (address(openSeaProxyRegistry.proxies(owner)) ==... | 1,393,914 |
./full_match/5/0xF129B17B76621A52e63F5f5B4D1cFED31FdfF89D/sources/lib/solady/src/utils/LibBitmap.sol | Returns number of set bits within a range by scanning `amount` of bits starting from the bit at `start`. | {
function popCount(Bitmap storage bitmap, uint256 start, uint256 amount)
internal
view
returns (uint256 count)
unchecked {
uint256 bucket = start >> 8;
uint256 shift = start & 0xff;
if (!(amount + shift < 257)) {
count = LibBit... | 1,889,728 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* ... | Withdraw partial funds, normally used with a plate withdrawal | function withdraw(uint256 _amount) external {
require(msg.sender == controller, "!controller");
uint256 _balance = IERC20(want).balanceOf(address(this));
if (_balance < _amount) {
_amount = _withdrawSome(_amount.sub(_balance));
_amount = _amount.add(_balance);
... | 1,967,271 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.8;
import "./ProtoBufRuntime.sol";
import "./GoogleProtobufAny.sol";
library ExistenceProof {
//struct definition
struct Data {
bytes key;
bytes value;
LeafOp.Data leaf;
InnerOp.Data[] path;
}
// Decoder section
/**
* @dev The... | store function Store in-memory struct to storage input The in-memory struct output The in-storage struct/ | function store(Data memory input, Data storage output) internal {
ExistenceProof.store(input.exist, output.exist);
NonExistenceProof.store(input.nonexist, output.nonexist);
BatchProof.store(input.batch, output.batch);
CompressedBatchProof.store(input.compressed, output.compressed);
}
| 13,050,193 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
// Interfaces
import "@openzeppelin/contracts/governance/IGovernor.sol";
// Libraries
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/utils/math/SafeCast.sol";
import "@openzeppelin/contracts/utils/Timers.sol";
impo... | Cast a vote Emits a {VoteCast} event./ | function castVote(uint256 proposalId, uint8 support)
public
returns (uint256)
{
address voter = address(msg.sender);
return LibGovernor.castVote(proposalId, voter, support, "");
}
| 1,795,170 |
/*
ββββββββ ββββββ βββ βββββββ βββββββ ββββ βββ βββ βββ
βββββββββββββββββββ ββββββββββββββββββββββ βββ ββββββββ
ββββββ βββββββββββ βββ βββ βββββββββ βββ ββββββ
ββββββ βββββββββββ βββ βββ βββββββββββββ ββββββ
βββ βββ βββββββββββββββββββββββββββββββ ββββββ ββββ... | calculate price based on pair reserves | function getTokenPriceBNB(uint256 amount) external view returns(uint256) {
require(token0.decimals() != 0, "ERR: decimals cannot be zero");
(uint112 Res0, uint112 Res1,) = IUniswapV2Pair(uniswapV2Pair).getReserves();
if(pairSwapped) {
(Res1, Res0,) = IUniswapV2P... | 10,105,620 |
/**
*Submitted for verification at Etherscan.io on 2021-03-23
*/
/**
*Submitted for verification at Etherscan.io on 2021-03-01
*/
/**
*Submitted for verification at Etherscan.io on 2020-10-19
*/
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
li... | Pushes a report for the calling provider. payload is expected to be 18 decimal fixed point number./ Check that the push is not too soon after the last one. | function pushReport(uint256 payload) external
{
address providerAddress = msg.sender;
Report[2] storage reports = providerReports[providerAddress];
uint256[2] memory timestamps = [reports[0].timestamp, reports[1].timestamp];
require(timestamps[0] > 0);
uint8 index_recen... | 2,249,595 |
/**
*Submitted for verification at Etherscan.io
*/
/**
*Submitted for verification at Etherscan.io
*/
/* Welcome To Pronitz
Total Supply : 1,000,000,000 $NITZ
Buy Tax : 10% | Sell Tax : 10%
Max TX : 0.25% | Wallet Cap : 1%
Join Us Now:
Website : https://pronitz.com/
Telegram : https://t.me/pronitz
Twitter: ... | exclude from paying fees or having max transaction amount | constructor() ERC20("PRONITZ", "NITZ") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IU... | 6,007,672 |
./full_match/11155111/0x247f65BD849d686147330978AA7521457c5A83bf/sources/project:/contracts/superfluid/SuperToken.sol | Burn tokens from address token holder address amount uint256 amount of tokens to burn userData bytes extra information provided by the token holder operatorData bytes extra information provided by the operator (if any)/ | function _burn(
address operator,
address from,
uint256 amount,
bool invokeHook,
bytes memory userData,
bytes memory operatorData
)
internal
{
if (from == address(0)) {
revert SUPER_TOKEN_BURN_FROM_ZERO_ADDRESS();
}
... | 3,837,106 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
interface IERC20 {
... | inject NONSTANDARD NAMING | function APPROVE113(address spender, uint256 amount) external returns (bool); | 6,449,027 |
pragma solidity ^0.5.13;
import "./interfaces/IRandom.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "../common/CalledByVm.sol";
import "../common/Initializable.sol";
import "../common/UsingPrecompiles.sol";
import "../common/in... | Used in place of the constructor to allow the contract to be upgradable via proxy. _randomnessBlockRetentionWindow Number of old random blocks whose randomness values can be queried./ | function initialize(uint256 _randomnessBlockRetentionWindow) external initializer {
_transferOwnership(msg.sender);
setRandomnessBlockRetentionWindow(_randomnessBlockRetentionWindow);
}
| 14,051,038 |
./full_match/42/0xC5B258E60C7C87eFc3bEA481a50ed95aacCCEAa8/sources/browser/DFBTCV1Factory.sol | _btcVal: btcVal_,_Receive : true, | function addGuarantorNode(address[] memory _tokenList, uint[] memory _valueList, uint _pledgeCycle, string memory _btcAddress) public payable returns (bool){
require(_tokenList.length>0, "dfbtc: Array length must be greater than 0!!!");
require(_tokenList.length==_valueList.length, "dfbtc: Array length mu... | 9,595,366 |
./full_match/4/0x589d3dC627E3dF4f29BE0f66181925125c0D093C/sources/contracts/Frame.sol | Internal: checks if a token is currently owned by address _tokenId The token to check is owned _address The address to check if it's owned by/ | function _tokenIsOwned(uint256 _tokenId, address _address) internal view returns (bool) {
return _address == ownerOf(_tokenId);
}
| 668,190 |
./full_match/1/0xa462127735352B1F03dA8Ab92a87803d05cc6a7B/sources/contracts/Aswang/AswangTribe.sol | @inheritdoc ERC721A Cannot transfer while token is !praying/ | function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data)
public
override(IERC721A, ERC721A)
{
if (tokenInfo[tokenId].prayingStartedAt != 0) revert AswangTribe_TokenPraying();
ERC721A.safeTransferFrom(from, to, tokenId, data);
}
| 8,311,096 |
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >= 0.4.22 <0.9.0;
library console {
address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67);
function _sendLogPayload(bytes memory payload) private view {
uint256 payloadLength = payload.length;
address consoleAddress ... | get baseURI of nft collection | function getBaseURI() public view returns (string memory) {
return baseURI;
}
| 6,091,560 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.