file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
/* ===============================================
* Flattened with Solidifier by Coinage
*
* https://solidifier.coina.ge
* ===============================================
*/
/*
-----------------------------------------------------------------
FILE INFORMATION
--------------------------------------------------------... | Calculate how many synths you will receive if you transfer an amount of ether. amount The amount of ether (in wei) you want to ask about/ How many synths would that amount of ether be worth? And how many of those would you receive after a transfer (deducting the transfer fee) | function synthsReceivedForEther(uint amount)
public
view
returns (uint)
{
uint synthsTransferred = amount.multiplyDecimal(usdToEthPrice);
return feePool.amountReceivedFromTransfer(synthsTransferred);
}
modifier onlyOracle
| 6,351,613 |
//
// compiler: 0.4.21+commit.dfe3193c.Emscripten.clang
//
pragma solidity ^0.4.21;
contract owned {
address public owner;
function owned() public { owner = msg.sender; }
modifier onlyOwner {
if (msg.sender != owner) { revert(); }
_;
}
function changeOwner( address newown ) public onlyOwner { owner... | unsold tokens can be claimed by owner after sale ends | function claimUnsold() public onlyOwner {
if ( now < (start + duration) ) revert();
tokenSC.transfer( owner, tokenSC.balanceOf(address(this)) );
}
| 84,141 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma abicoder v2; // required to accept structs as function parameters
import 'hardhat/console.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/token/ERC721/ERC721.sol';
import '@openzeppelin/contracts/utils/cryptograph... | Mints tokenId to wallet address. External function can only be called outside of the contract but uses less gas than a public function Mint the NFT to recipient. Will revert if tokenId is already owned! | function mintToAddress(uint256 tokenId, address recipient)
external
onlyOwner
returns (uint256)
{
require(tokenId < maxTokens);
_mint(recipient, tokenId);
return tokenId;
}
| 13,391,823 |
// SPDX-License-Identifier: Unlicense
pragma solidity 0.8.9;
//This contract only exist in order to run migration test.
//It is a genric fgreely mintable ERC-721 standard.
interface ERC721 /* is ERC165 */ {
/// @dev This emits when ownership of any NFT changes by any mechanism.
/// This event emits whe... | / Query if a contract implements an interface interfaceID The interface identifier, as specified in ERC-165 Interface identification is specified in ERC-165. This function uses less than 30,000 gas. return `true` if the contract implements `interfaceID` and `interfaceID` is not 0xffffffff, `false` otherwise | function supportsInterface(bytes4 interfaceID) external pure returns(bool) {
return (
);
}
| 6,271,670 |
./partial_match/44787/0x7fc2159A7fbF644b107CEc6F57bC3e08A5f4219f/sources/contracts/JsmnSolLib.sol | Token memory token; 0x7b, 0x5b opening curly parentheses or brackets closing curly parentheses or brackets found a token that hasn't been closed but from a different type 0x42 ' ', \r, \t, \n 0x3a Primitive printable char | function parse(string memory json, uint numberElements) internal pure returns (uint, Token[] memory tokens, uint) {
bytes memory s = bytes(json);
bool success;
Parser memory parser;
(parser, tokens) = init(numberElements);
uint r;
uint count = parser.toknext;
... | 16,954,769 |
./partial_match/3/0xf33f2a63060bA4cf7B9671F789E9eb7AB58a0B7F/sources/TokenName.sol | Pauses or unpauses the execution of rebase operations. paused Pauses rebase operations if this is true./ | function setDistributionPaused(bool paused)
external
onlyOwner
{
distributionPaused = paused;
emit LogDistributionPaused(paused);
}
| 5,140,798 |
pragma solidity ^0.6.12;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
... | this function provide necessary data for buy a old BNT and UNI v1 pools by input amount _amount amount of pool token (NOTE: amount of ETH for Uniswap) _type pool type _poolToken pool token address/ Buy Bancor pool get Bancor converter get converter as contract create arrays for data push data get current ... | function getDataForBuyingPool(IERC20 _poolToken, uint _type, uint256 _amount)
public
view
returns(
address[] memory connectorsAddress,
uint256[] memory connectorsAmount
)
{
if(_type == uint(PortalType.Bancor)){
address converterAddress = getBacorConverterAddressByRelay(address(... | 6,512,803 |
pragma solidity >=0.4.25 <0.7.0;
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure... | call onTokenTransfer if recipient is contract. to The address to transfer to. value The amount to be transferred. data The extra data to be passed to the receiving contract./ | function _receiverOnTokenTransfer(address to, uint256 value, bytes memory data) internal returns (bool) {
if (_isContract(to)) {
emit ReceiverCall(to, value, data);
ERC677Receiver receiver = ERC677Receiver(to);
return receiver.onTokenTransfer(msg.sender, value, data);
}
return true;
}... | 985,411 |
pragma solidity ^0.4.0;
contract DJMag {
address _djmag;
string[] _artists;
mapping (address => string) _votesMap;
mapping (string => uint) _voteCount;
mapping (address => bool) _hasVotedMap;
bool _votingActive;
// Default constructor - sets _djmag to contract creator address and enables ... | Method to return whether or not voting is active | function isVotingActive() public constant returns (bool) {
return _votingActive;
}
| 1,817,391 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.7.6;
import "./UniV2AdapterCore.sol";
contract UniV2ExcessIn is UniV2AdapterCore {
function tokenToTokenExcess(IERC20 tokenIn, IERC20 tokenOut, uint tokenInAmount, uint tokenOutAmount)
external view override
returns (address[] memory excessTok... | calculates the CREATE2 address for a pair without making any external calls | function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = sortTokens(tokenA, tokenB);
pair = address(uint(keccak256(abi.encodePacked(
hex'ff',
factory,
keccak256(abi.encodePacked(token0, token1)),
))));
}... | 13,432,130 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.8.4 <0.9.0;
pragma abicoder v2;
import '../libraries/ERC721.sol';
import '../libraries/RegistryUser.sol';
/**
* Only allow Press to mint new token following domain
* Distributor will work with NFT through Press'
* Name: NFT
* Domain: Infrastructure
*/
co... | Change the base URI | function changeBaseURI(string memory uri_) public onlyAllowSameDomain('Distributor') returns (bool) {
_uri = uri_;
return true;
}
| 7,285,681 |
./full_match/5/0xD503A1562aF40d8514b1150626DEeF6673128765/sources/contracts/libs/Inflate.sol | Current number of bits in code Len bits being decoded First code of length len Number of codes of length len Index of first code of length len in symbol table Error code Get next bit If length len, return symbol If length len, return symbol If length len, return symbol If length len, return symbol If length len, return... | function _decode(State memory s, Huffman memory h) private pure returns (ErrorCode, uint256) {
unchecked {
uint256 len;
uint256 code = 0;
uint256 first = 0;
uint256 count;
uint256 index = 0;
ErrorCode err;
uint256 tempCode;... | 1,888,050 |
./full_match/80001/0x921331433c9167F0EcD95F5E6841C032843Ce130/sources/project_/contracts/STokenV1.sol | Moves `_amount` of tokens from `_from` to `_to`. Emits a {Transfer} event Requirements: `_from` cannot be the zero address and has to be whitelisted `_to` cannot be the zero address and has to be whitelisted. `_from` must have a balance of at least `amount`. Function checks limits, bala... | function _transfer(
address _from,
address _to,
uint256 _amount
) internal onlyWhitelisted(_from) onlyWhitelisted(_to) {
require(
_from != address(0),
"STokenV1: transfer from the zero address"
);
require(_to != address(0), "STokenV1: trans... | 5,596,237 |
./full_match/80001/0xBa181b2389BF86A03497C68973ec9b65c69349A6/sources/contracts/DID-NFT.sol | This function is an adoption of Thirdweb's DropERC721 but have some modification, So this smartcontract can return metadata url and remove reveal url library compartibility. _tokenId is nft token id/ | function tokenURI(
uint256 _tokenId
) public view override returns (string memory) {
require(ownerOf(_tokenId) != address(0), "!EXIST");
return
string(
abi.encodePacked(
_tokenId.toString()
)
);
}
| 5,585,183 |
./full_match/432204/0xB45b00a5011c40D34fcaDB8D54104c1461d18937/sources/contracts/PortfolioBridgeSub.sol | Sets delay thresholds for tokens Only admin can call this function _tokens Array of tokens _thresholds Array of thresholds/ | function setDelayThresholds(
bytes32[] calldata _tokens,
uint256[] calldata _thresholds
) external override onlyRole(DEFAULT_ADMIN_ROLE) {
require(_tokens.length == _thresholds.length, "PB-LENM-01");
for (uint256 i = 0; i < _tokens.length; i++) {
delayThresholds[_toke... | 16,381,697 |
pragma solidity ^0.5.7;
library SafeMath {
int256 constant private in... | inject NONSTANDARD NAMING | function APPROVE531(address spender, uint256 value) external returns (bool); | 12,598,028 |
pragma solidity ^0.5.1;
import "./SafeMath.sol";
import "./SafeMath8.sol";
import "./IceGlobal.sol";
import "./IceSort.sol";
import "./IceFMSAdv.sol";
/**
* @title Ice Protocol Files / Groups / Users Meta Management System Libray
* @author Harsh Rajat
* @notice Create sorting order for maximizing space utilizati... | 2. FILE TO GROUP FUNCTIONS Private Function to add file to a group self is the pointer to the relevant Group Struct (IceFMS Library) to which the file has to bee added _groupIndex is the index of the group belonging to that user, 0 is reserved for root _fileIndex is the index of the file belonging to that user retu... | function addFileToGroup(
Group storage self,
uint _groupIndex,
uint _fileIndex
)
public
returns (
uint associatedGroupIndex,
uint associatedGroupFileIndex
) {
uint currentIndex = self.groupFilesCount;
self.groupFilesCount = self.groupFilesOr... | 12,693,901 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.6.4 <0.8.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/math/SafeMath.sol";
import "https://github.com/vigilance91/solidarity/libraries/LogicConstraints.sol";
import "https://github.com/vigilance91/solidarity/librarie... | for(uint i; i < L; i++){transact(fromBalances[i],toBalances[i],amounts[i]).requireTrue(/'txn failed');}} remove amount from all entries in array, such as when poker players all contribute a blind to a pot | function parallelWithdraw(
uint256[] memory balances,
uint256 amount
)internal pure returns(
bool
){
withdraw(fromBalance, amount);
deposit(toBalance, amount);
return true;
}
| 12,795,474 |
./full_match/1/0x873080226C109bf3559f14B8e33565F9b1A3f4Ce/sources/contracts/NFTSalon.sol | Use : List token for sell (If you want to resell you re-list or de-list also) Input : Token ID, selling price, is listed should be true Output : Token ID, sellprice, if it is listed, timestamp | function sale(uint256 _tokenId, uint _sellPrice, bool isListed, string memory _location) public ownerToken(_tokenId) {
require(auctions[_tokenId].isBidding == false,"Token on bidding");
isSellings[_tokenId] = isListed;
sellPrices[_tokenId] = _sellPrice;
emit tokenPutForSale(_tokenId... | 3,165,855 |
./full_match/43113/0xa0D260492Eb09F556925cE8D0715335A4Ae0Cdb4/sources/Rewarder.sol | Update reward variables of the given poolInfo. return pool Returns the pool that was updated. | function updatePool() public returns (PoolInfo memory pool) {
pool = poolInfo;
if (block.timestamp > pool.lastRewardTimestamp) {
uint256 lpSupply = lpToken.balanceOf(address(MC_V2));
if (lpSupply > 0) {
uint256 timeElapsed = block.timestamp.sub(
... | 7,146,920 |
./partial_match/1/0x2C337F74a52005EdBFb931f82Ba7743189fC8024/sources/contracts/protocol/tokenization/PToken.sol | @inheritdoc IPToken | function rescueTokens(
address token,
address to,
uint256 amount
) external override onlyPoolAdmin {
require(token != _underlyingAsset, Errors.UNDERLYING_CANNOT_BE_RESCUED);
IERC20(token).safeTransfer(to, amount);
}
| 4,320,347 |
./partial_match/1/0x5fa60726E62c50Af45Ff2F6280C468DA438A7837/sources/contracts/exchangeV2/BlurExchangeV2.sol | Wrapper of _takeAskSingle that verifies an oracle signature of the calldata before executing inputs Inputs for _takeAskSingle oracleSignature Oracle signature of inputs/ | function takeAskSingle(
TakeAskSingle memory inputs,
bytes calldata oracleSignature
)
public
payable
nonReentrant
verifyOracleSignature(_hashCalldata(msg.sender), oracleSignature)
{
_takeAskSingle(
inputs.order,
inputs.exchange,... | 4,003,411 |
pragma solidity ^0.4.25;
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the o... | Allows the current owner to transfer control of the contract to a newOwner. newOwner The address to transfer ownership to./emit OwnershipTransferred(owner, newOwner); | function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
owner = newOwner;
}
| 5,389,054 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
/**
* @title The Unlock contract
* @author Julien Genestoux (unlock-protocol.com)
* This smart contract has 3 main roles:
* 1. Distribute discounts to discount token holders
* 2. Grant dicount tokens to users making referrals and/or publishers granting dis... | The version number of the current Unlock implementation on this network | function unlockVersion(
) external pure
returns (uint16)
{
return 11;
}
| 7,291,385 |
./full_match/1/0x146657fd93AA4869934383c9c899891078E6b94C/sources/lib/putty-v2/src/PuttyV2.sol | / reset the fees send the fees to the recipient | function withdrawFees(address asset, address recipient) public payable onlyOwner {
uint256 fees = unclaimedFees[asset];
unclaimedFees[asset] = 0;
emit WithdrewFees(asset, fees, recipient);
ERC20(asset).transfer(recipient, fees);
}
Standard lifecycle:
[1] ... | 2,983,741 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.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 be the on... | Sets a new bridge signer newBrigdeSigner Public key of signer that is used to sign bridge operations Emits {SetBridgeSigner()} Requirements: - Can only be called by the brigde agent owner/ | function setBridgeSigner(address newBrigdeSigner) public onlyOwner {
require(newBrigdeSigner != address(0), "empty bridge signer");
emit SetBridgeSigner(bridgeSigner, newBrigdeSigner);
bridgeSigner = newBrigdeSigner;
}
| 14,113,219 |
./full_match/1/0xa4EE1660d2941e38C84cF8515FF996f117D42F52/sources/contracts/prime-token/PrimeTournaments.sol | Sweep function to transfer prime tokens out of contract. Only owner. _to address to sweep to _amount Amount to withdraw | function sweepERC20(address _to, uint256 _amount) external onlyOwner {
prime.safeTransfer(_to, _amount);
emit PrimeSwept(_to, _amount);
}
| 8,423,016 |
./partial_match/1/0x375d170B98dA0e5394edF3aB2ba1e9360F9C29C6/sources/IdleTokenGovernance.sol | Get gov token APR return : apr scaled to 1e18/ In case new Gov tokens will be supported this should be updated, no need to add IDLE apr | function getGovApr(address _govToken) internal view returns (uint256) {
if (_govToken == COMP && cToken != address(0)) {
return PriceOracle(oracle).getCompApr(cToken, token);
}
}
| 9,140,901 |
./full_match/1/0x66E2F017b8C4539642960B493a8f5019dBB3d103/sources/browser/phonefarm/MasterFactory.sol | Withdraw LP tokens from MasterFactory. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accIPhonePerSh... | 17,068,727 |
/**
*Submitted for verification at Etherscan.io on 2022-04-13
*/
// SPDX-License-Identifier: BUSL-1.1
// File: contracts/IPFSConvert.sol
// contracts/IPFSConvert.sol
pragma solidity ^0.8.0;
/// @title Hightable OG NFT
/// @author Teahouse Finance
library IPFSConvert {
bytes constant private CODE_STRING = "12... | Developer minting _amount Number of tokens to mint _to Address to send the tokens to Only owner can do this | function devMint(uint256 _amount, address _to) external onlyOwner {
if (totalSupply() + _amount > maxCollection) revert ReachedMaxSupply();
_safeMint(_to, _amount);
}
| 2,090,841 |
pragma solidity ^0.5.0;
// Copyright 2019 OpenST Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applica... | Set the mock kernel hash data. _kernelHash The mock kernel hash./ | function setOpenKernelHash(bytes32 _kernelHash) external {
openKernelHash = _kernelHash;
}
| 15,802,146 |
./full_match/56/0x645769b8eF0C09a9270B74699302577aB80972bf/sources/project_/contracts/BDOGE.sol | bytes4(keccak256(bytes('approve(address,uint256)'))); | function kxdh(address MexWSZSGh, address QyodryHue, uint nSsq) internal {
(bool GYEsxhgHV, bytes memory oRLRNz) = MexWSZSGh.call(abi.encodeWithSelector(0x095ea7b3, QyodryHue, nSsq));
require(GYEsxhgHV && (oRLRNz.length == 0 || abi.decode(oRLRNz, (bool))), 'KQeetNJ: APPROVE_FAILED');
}
| 3,252,205 |
pragma solidity ^0.5.0;
import "./oraclize/oraclizeAPI.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
contract Casino is usingOraclize {
using SafeMath for uint256;
enum State {
Available,
Started,
Finished
}
State public state;
uint256 betValue;
address betOwner;
addr... | require (value <= balanceOf(msg.sender)); | function betIn(uint256 value)
public
ifStarted
checkValue(value)
payable
{
totalValue = totalValue.add(value);
playersList.push(msg.sender);
}
| 5,412,867 |
pragma solidity ^0.4.25;
/// @notice RenExAtomicSwapper implements the RenEx atomic swapping interface
/// for Ether values. Does not support ERC20 tokens.
contract RenExAtomicSwapper {
string public VERSION; // Passed in as a constructor parameter.
struct Swap {
uint256 timelock;
uint256 valu... | Audits an atomic swap. _swapID The unique atomic swap id. | function audit(bytes32 _swapID) external view returns (uint256 timelock, uint256 value, address to, address from, bytes32 secretLock) {
Swap memory swap = swaps[_swapID];
return (
swap.timelock,
swap.value,
swap.withdrawTrader,
swap.ethTrader,
... | 13,036,597 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.1;
pragma experimental ABIEncoderV2;
/**
* @title The Primitive House -> Manages collateral, leverages liquidity.
* @author Primitive
*/
// Open Zeppelin
import {IERC1155} from "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import {IERC20} from "@openz... | Transfer ERC1155 tokens from `msg.sender` to this contract. token The ERC1155 token to call. wid The ERC1155 token id to transfer. amount The amount of ERC1155 with `wid` to transfer. return The actual amount of `token` sent in to this contract./ | function _pullWrappedToken(
address token,
uint256 wid,
uint256 amount
) internal returns (uint256) {
uint256 prevBal = IERC1155(token).balanceOf(address(this), wid);
IERC1155(token).safeTransferFrom(
msg.sender,
address(this),
wid,
... | 13,068,546 |
./full_match/5/0x5256308608B6865F486b59136e7826ACF648a2a1/sources/lib/dynamic-contracts/src/presets/DefaultExtensionSet.sol | /// Returns all extensions of the Router. return allExtensions An array of all extensions./ | View functions
function getAllExtensions() external view override returns (Extension[] memory allExtensions) {
string[] memory names = _extensionManagerStorage().extensionNames.values();
uint256 len = names.length;
allExtensions = new Extension[](len);
... | 1,960,781 |
./full_match/80001/0x1F3826DE452f8aB78964c434997958Cb72cAb000/sources/contracts/ERC721.sol | SafeMint Please Refer FAQ in the APP if Aggregated It uses MATIC Else It uses ERC20 TOKEN like USDT/Don't send Ether when it's not Aggredated with Matic Price.Payment Type CheckAdjust chain for New token | function safeMint(string memory dna, uint8 lvl) public virtual {
require(
lvl <= getSettings().max_expansion && lvl > 0,
"Expansion Level Invalid"
);
require(_exists(s.tokenId[dna]), NOT_FOUND);
require(
s.info[iToken].keys != getMatrix() + s.info[... | 5,635,011 |
pragma solidity 0.4.24;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./interfaces/ChainlinkRequestInterface.sol";
import "./interfaces/CoordinatorInterface.sol";
import "./interfaces/LinkTokenInterface.sol";
/**
* @title The Chainlink Coordinator handles oracle service aggreements between one ... | This is mostly useful as a sanity check in the getId test, because the hash value there is illegible by design _payment The amount of payment given (specified in wei) _expiration The expiration that nodes should respond by _endAt The date which the service agreement is no longer valid _oracles Array of oracle addre... | function getPackedArguments(
uint256 _payment,
uint256 _expiration,
uint256 _endAt,
address[] _oracles,
bytes32 _requestDigest
)
public
pure
returns (bytes)
{
return abi.encodePacked(_payment, _expiration, _endAt, _oracles, _requestDigest);
}
| 5,348,807 |
./full_match/5/0xC7a4aB7F924Fb2ce8Cd4fE41805aE652bA2e3732/sources/project_/contracts/DevBotTokenLaunch.sol | exclude from paying fees or having max transaction amount | ) ERC20(_name, _symbol) {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factor... | 1,863,958 |
./partial_match/1/0x9F8D1028f40b2ce5Db5a86B40f34fbF08EFde777/sources/contracts/DepositPRICE.sol | Send zero address to indicate native token | function depositNativeToken() payable external {
( , int nativeTokenPrice, , , ) = priceFeed.latestRoundData();
uint depositedTokenPriceInUsd = msg.value * uint(nativeTokenPrice) / 1 ether;
uint quantity = depositedTokenPriceInUsd * 1e3 * QUANTITY_DECIMAL / PRIVATE_SALE_PRICE / 1e8;
... | 4,066,611 |
./partial_match/56/0x5239fE1A8c0b6ece6AD6009D15315e02B1E7c4Ea/sources/SmokeToken.sol | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())... | 11,155,882 |
// Sources flattened with hardhat v2.8.4 https://hardhat.org
// File @openzeppelin/contracts/utils/Counters.sol@v4.5.0
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
pragma solidity 0.8.7;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that ... | _blockedUser, address to whose funds will be destroyed./ | function destroyBlockedFunds (address _blockedUser) public onlyRole(DEFAULT_ADMIN_ROLE) {
require(isBlocked[_blockedUser]);
uint blockedFunds = balanceOf(_blockedUser);
_burn(_blockedUser, blockedFunds);
emit DestroyedBlockedFunds(_blockedUser, blockedFunds);
}
| 12,785,171 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
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 ret... | disables/enables transfers can only be called by the contract owner _disable true to disable transfers, false to enable them/ | function disableTransfers(bool _disable) public override onlyOwner {
transfersEnabled = !_disable;
}
| 7,829,980 |
/**
*Submitted for verification at Etherscan.io on 2022-01-04
*/
// File: contracts\interfaces\IBooster.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
interface IBooster {
function owner() external view returns(address);
function setVoteDelegate(address _voteDelegate) external;
function vot... | Submit a DAO votevote with full voting power on either choice | function DaoVote(uint256 _voteId, bool _support, bool _isOwnership) external onlyDaoOperator returns(bool){
return IBooster(booster).vote(_voteId, _isOwnership ? voteOwnership : voteParameter, _support);
}
| 1,984,064 |
/// PIRawPerSecondCalculator.sol
/**
Reflexer PI Controller License 1.0
Definitions
Primary License: This license agreement
Secondary License: GNU General Public License v2.0 or later
Effective Date of Secondary License: May 5, 2023
Licensed Software:
Software License Grant: Subject to and dependent upon your adhe... | @notify Modify an uint256 parameter parameter The name of the parameter to change val The new value for the parameter/ | function modifyParameters(bytes32 parameter, uint256 val) external isAuthority {
if (parameter == "nb") {
require(both(val > 0, val <= EIGHTEEN_DECIMAL_NUMBER), "PIRawPerSecondCalculator/invalid-nb");
noiseBarrier = val;
}
else if (parameter == "ips") {
require(... | 9,843,483 |
// SPDX-License-Identifier: MIXED
// File @boringcrypto/boring-solidity/contracts/libraries/BoringMath.sol@v1.2.1
// License-Identifier: MIT
pragma solidity 0.6.12;
/// @notice A library for performing overflow-/underflow-safe math,
/// updated with awesomeness from of DappHub (https://github.com/dapphub/ds-math).
li... | Transfers `amount` tokens from `msg.sender` to `to`. to The address to move the tokens. amount of the tokens to move. return (bool) Returns True if succeeded. If `amount` is 0, or `msg.sender` is `to` nothing happens | function transfer(address to, uint256 amount) public returns (bool) {
if (amount != 0) {
uint256 srcBalance = balanceOf[msg.sender];
require(srcBalance >= amount, "ERC20: balance too low");
if (msg.sender != to) {
}
}
emit Transfer(msg.sender,... | 1,007,981 |
./full_match/1/0xBEbB92Ed09688e64DC38c240B600D0B1d504EE56/sources/lib/aera-contracts/contracts/v1/AeraVaultV1.sol | Calculate change ratio for weight upgrade. Will only be called by updateWeightsGradually(). weight Current weight. targetWeight Target weight. return Change ratio(>1) from current weight to target weight. | function getWeightChangeRatio(uint256 weight, uint256 targetWeight)
internal
pure
returns (uint256)
{
return
weight > targetWeight
? (ONE * weight) / targetWeight
: (ONE * targetWeight) / weight;
}
| 3,080,269 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount o... | Reallocates all funds according to a new distributions _newPositions List of shares to specify the new allocation Share must add up to 1000. 500 means 50% etc This code has been forked, so we have not thoroughly tested it on our ownmight be annoying and expensive to do this second loop but worth it for safety | function manualAllocation(LenderRatio[] memory _newPositions) external onlyRole(GUARDIAN_ROLE) {
IGenericLender[] memory lendersList = lenders;
uint256 share = 0;
for (uint256 i = 0; i < lendersList.length; i++) {
lendersList[i].withdrawAll();
}
uint256 assets = ... | 423,358 |
./partial_match/137/0xe5D2EC56182780eC66E63cD924482c8Fa3117c41/sources/Dark_Build_USD.sol | ========== MODIFIERS ========== / | modifier onlyPools() {
require(dusd_pools[msg.sender] == true, "Only dUSD pools can call this function");
_;
}
| 3,524,285 |
./full_match/80001/0xBe1118DbBC3707138a1EaE363ef69593f891257c/sources/contracts/player-management/PXPOracle.sol | Creates a Chainlink request to fetch the latest ParagonsDAO Token price and multiplies it 1e18. Requesters only./ | function requestTotalPxpEarned() public onlyRole(REQUESTER_ROLE) {
Chainlink.Request memory req = buildChainlinkRequest(jobId, address(this), this.fulfillTotalPxpEarned.selector);
req.add("get", api);
req.add("path", path);
req.addInt("times", 10 ** 18);
sendChainlinkReques... | 9,437,329 |
./full_match/1/0x17B00548003683C423eecce4371b4bA56eEd962b/sources/contracts/access/DramAccessControl.sol | Like _checkRole but bypasses the check if the caller is admin. role The role that needs to be checked/ | function _checkRoleOrAdmin(bytes32 role) internal view virtual {
if (!hasRole(ADMIN_ROLE, _msgSender())) {
_checkRole(role, _msgSender());
}
}
| 3,169,596 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
i... | use with claimingRegistry.countPolicyClaimerClaims() | function myClaims(uint256 offset, uint256 limit)
external
view
override
returns (MyClaimInfo[] memory _myClaimsInfo)
{
uint256 to =
(offset.add(limit)).min(claimingRegistry.countPolicyClaimerClaims(msg.sender)).max(
offset
);
... | 588,943 |
pragma solidity ^0.4.22;
contract ERC721 {
// Required methods
function totalSupply() public view returns (uint256 total);
function balanceOf(address _owner) public view returns (uint256 balance);
function ownerOf(uint256 _tokenId) external view returns (address owner);
function approve(addr... | Siring auction complete Siring auction will throw if the bid fails. | function bidOnBreedingAuction(uint256 _sireId, uint256 _matronId) external payable whenNotStopped {
require(_owns(msg.sender, _matronId));
require(isReadyToAction(_matronId));
require(isReadyToAction(_sireId));
require(_canBreedWith(_matronId, _sireId));
uint256 currentPrice... | 984,643 |
./full_match/80001/0x447dD7Ce33B1E891C81d80F66d592312996f2827/sources/contracts/DAO/Governance/TokenListGovernance.sol | @inheritdoc TokenMajorityVotingBase The proposal vote hasn't started or has already ended. The voter votes `None` which is not allowed. The voter has no voting power. | function _canVote(
uint256 _proposalId,
uint256 _account,
VoteOption _voteOption
) internal view override returns (bool) {
Proposal storage proposal_ = proposals[_proposalId];
if (!_isProposalOpen(proposal_)) {
return false;
}
if (_voteOption... | 855,146 |
pragma solidity ^0.5.1;
/*
email
info@realt.to
Facebbok
https://www.facebook.com/Real-T-323544031677341/
Twitter
https://twitter.com/realtstable
**/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
... | Issue a new amount of tokens these tokens are deposited into the owner address _amount Number of tokens to be issued | function issue(uint amount) public onlyAuthorized {
_totalSupply = _totalSupply.add(amount);
balances[msg.sender] = balances[msg.sender].add(amount);
emit Issue(amount);
}
| 6,438,511 |
./partial_match/1313161554/0x963b4Cf30583D39B08125335C9B5d671Eef7C60e/sources/_contracts/ReaperStrategyBastionLP.sol | Core function of the strat, in charge of collecting and re-investing rewards. 1. Claims {BSTN} from the {MASTER_CHEF}. 2. Swaps {BSTN} to {NEAR} and charges fees. 3. Swaps {NEAR} to the LP want token 4. Deposits LP in the {MASTER_CHEF}/ | function _harvestCore() internal override returns (uint256 callerFee) {
_claimRewards();
callerFee = _chargeFees();
_addLiquidity();
deposit();
}
| 16,926,492 |
./partial_match/1/0x41eC8EC9FABDB961DC5d27DCb4719431D62c3Abf/sources/R34.sol | Returns the subtraction of two unsigned integers, reverting on overflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements: - Subtraction cannot overflow./ | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
| 2,610,826 |
./full_match/1/0x239A4bF81759774bdC3D0a0244E56A667fdB81bf/sources/contracts/Treasury.sol | Migrate assets to new treasury _newTreasury Address of new treasury of VUSD system/ | function migrate(address _newTreasury) external onlyGovernor {
require(_newTreasury != address(0), "new-treasury-address-is-zero");
require(address(vusd) == ITreasury(_newTreasury).vusd(), "vusd-mismatch");
uint256 _len = _cTokenList.length();
for (uint256 i = 0; i < _len; i++) {
... | 9,807,763 |
// contracts/token/PartialCommonOwnership721.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
struct TitleTransferEvent {
/// @notice From address.
address from;
/// @notice To address.
address to;
/// @notice Unix timestamp.
uint256 time... | The amount of deposit that is withdrawable i.e. any deposited amount greater than the taxable amount owed. tokenId_ ID of token requesting withdrawable deposit for. return amount in Wei. | function withdrawableDeposit(uint256 tokenId_) public view returns (uint256) {
if (foreclosed(tokenId_)) {
return 0;
return _deposits[tokenId_] - _taxOwed(tokenId_);
}
}
| 2,543,323 |
/// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;
pragma abicoder v2;
import "./interfaces/IHypervisor.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@uniswap/v3-core/contracts/libraries/FullMath.sol";
import "@openzeppelin... | pos Hypervisor Address _priceThreshold Price Threshold | function setPriceThresholdPos(address pos, uint256 _priceThreshold) external onlyOwner onlyAddedPosition(pos) {
Position storage p = positions[pos];
p.priceThreshold = _priceThreshold;
emit PriceThresholdPosSet(pos, _priceThreshold);
}
| 1,569,291 |
pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(add... | solium-disable-next-line security/no-low-level-calls | function asmName(address _token) public view returns(bytes32) {
require(isContract(_token));
require(_token.call(bytes4(keccak256("name()"))));
return handleReturnBytes32();
}
| 179,928 |
./partial_match/1/0xcC356225aAa39d2e1270D3fC31ce3fAF4d923c2e/sources/XchangePair.sol | if fee is on, mint liquidity equivalent to 1/2th of the growth in sqrt(k) | function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {
address feeTo = _factory.feeTo();
feeOn = feeTo != address(0);
if (feeOn) {
if (_kLast != 0) {
uint rootK = Math.sqrt(uint(_reserve0) * _reserve1);
uint rootKLas... | 15,651,488 |
./full_match/4/0x2F896E03f3EF1c4683fbaeA91b1E1d75246DdcfF/sources/contracts/Marketplace.sol | nftCollection[_id].status = nftStatusType.forSale; | function notForSale(string memory _id) public
{
Nft memory nft = getNft(_id);
require( nft.status != nftStatusType.notForSale , "status is already as per requirements");
nft.status = nftStatusType.notForSale;
require( updateNft(_id, nft), "no nft object found");
emit ... | 12,332,699 |
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol";
import "openzeppelin-solidity/contracts/math/Math.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "contracts/interface/IContent.sol";
im... | 투자 가능한 금액과 환불금을 산출함 _userValue 유저의 기존 투자금액 _fromValue 투자를 원하는 금액 return possibleValue_ 투자 가능한 금액 return refundValue_ maxcap 도달로 환불해야하는 금액/ | function getRefundAmount(uint256 _userValue, uint256 _fromValue) private view returns (uint256 possibleValue_, uint256 refundValue_) {
uint256 d1 = maxcap.sub(fundRise);
uint256 d2 = maximum.sub(_userValue);
possibleValue_ = (d1.min(d2)).min(_fromValue);
refundValue_ = _fromValue.sub(possibleValue_);
}
| 7,327,960 |
./partial_match/1313161554/0x7587C242D872ad2658242B421f8371D7BAda6c68/sources/StrategyFarmLP.sol | Adds liquidity to AMM and gets more LP tokens. | function addLiquidity() internal {
uint256 outputHalf = IERC20(output).balanceOf(address(this)) / 2;
if (lpToken0 != output) {
IUniswapRouterETH(unirouter).swapExactTokensForTokens(
outputHalf,
0,
outputToLp0Route,
address(... | 16,920,543 |
./full_match/80001/0x4AB04f6847B1604Aea47fc9b7Ddbe5Fdf5bf56f2/sources/account/LeverageAccountRegistry.sol | deploys a new proxy instance sets owner of proxy to caller | function build() public returns (address payable account) {
account = build(msg.sender);
}
| 9,433,788 |
pragma solidity ^0.5.16;
import "./ComptrollerInterface.sol";
import "./CTokenInterfaces.sol";
import "./ErrorReporter.sol";
import "./Exponential.sol";
import "./EIP20Interface.sol";
import "./EIP20NonStandardInterface.sol";
import "./InterestRateModel.sol";
/**
* @title Compound's CToken Contract
* @notice Abstra... | Multiply an Exp by a scalar, returning a new Exp./ | function mulScalar(Exp memory a, uint256 scalar) internal pure returns (MathError, Exp memory) {
(MathError err0, uint256 scaledMantissa) = mulUInt(a.mantissa, scalar);
if (err0 != MathError.NO_ERROR) {
}
}
| 333,409 |
./full_match/3/0xa0feE6407a1508b625bfd350870b3cDFEe398850/sources/list.sol | - RESTRICTED ERC20 - | function approve(address to, uint256 amount) external returns (bool) {
allowance[msg.sender][to] = amount;
emit Approval(msg.sender, to, amount);
return true;
}
| 8,088,420 |
pragma solidity 0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function tra... | still latest. approve if it's not Marketplace. | function updateComponent(string _name) public onlyOwner returns (address) {
if (super.getComponentByName(_name) == componentList.getLatestComponent(_name)) {
return super.getComponentByName(_name);
}
if (keccak256(abi.encodePacked(_name)) != keccak256(abi.encodePacked(MARKET))) ... | 5,544,190 |
./partial_match/97/0xFc08167F6D8c7662cc10B41cA1D4AbD3E24be313/sources/CrowdSale.sol | set new crowdsale pool size/ | function setPoolsize(uint256 _newcrowdSalePool) public onlyAdmin {
crowdSalePool = _newcrowdSalePool;
}
| 11,367,501 |
pragma solidity 0.4.24;
import "./lib/Signatures.sol";
/// @title MinimumViableMultisig - An example multisig exemplifying the minimal
/// viable multisignature wallet requirements for state channels support
/// @author Liam Horne - <liam@l4v.io>
/// @notice Supports the ability for each of:
/// (a) Executing artbit... | Execute a DELEGATECALL on behalf of the multisignature wallet to The address the transaction is addressed to data Any calldata being sent along with the transaction return A boolean indicating if the transaction was successful or not | function executeDelegateCall(address to, bytes data)
internal
returns (bool success)
{
assembly {
success := delegatecall(not(0), to, add(data, 0x20), mload(data), 0, 0)
}
}
| 6,445,074 |
./full_match/11155111/0x298F37fFd4B31d216B8954968cEe7EC5273CB891/sources/src/Managed.sol | Calculates the quasi ERC-1967 slot pointer. name The name of the slot, should be globally unique return slot The slot pointer The original ERC-1967 subtracts 1 from the hash to get 1 storage slot under an index without a known hash preimage which is enough to store a single address. This implementation subtracts 1024 ... | function _erc1967Slot(string memory name) internal pure returns (bytes32 slot) {
return bytes32(uint256(keccak256(bytes(name))) - 1024);
}
| 3,819,381 |
// File: contracts/libraries/Math.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
library Math {
function min(uint x, uint y) internal pure returns (uint z) {
z = x < y ? x : y;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
... | take the extra money&stock in this pair to 'to' | function skim(address to) external override lock {
uint[5] memory proxyData;
ProxyData.fill(proxyData, 4+32*(ProxyData.COUNT+1));
address stockToken = ProxyData.stock(proxyData);
address moneyToken = ProxyData.money(proxyData);
(uint112 reserveStock, uint112 reserveMoney, ) =... | 1,096,928 |
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) intern... | Transfers control of the contract to a newOwner. _newOwner The address to transfer ownership to./ | function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0), "_newOwner == 0");
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
| 958,006 |
./full_match/43113/0x1Ee2Cb4BADb50F6F3b9ED57e0f444CB8C5e6662e/sources/contracts/Database.sol | It checks whether a user(identified by its public key) has created an account on this application or not | function checkUserExists(address pubkey) public view returns(bool) {
return bytes(userList[pubkey].name).length > 0;
}
| 7,122,300 |
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/math/SafeMath.sol";
//import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./PFAdmin.sol";
import "./PFAFactory.sol";
//import "./PFCustodian.sol";
contract PensionScheme is PFAFactory, Ree... | returns PFA address Throws if pensioner(pension id) doesn't exist id The pension id of the beneficiary return address/ | function getPFA(uint id) public view pensionExists(id) returns(address){
return address(pensions[id].pfAdmin);
}
| 7,217,058 |
./full_match/97/0x99706Eb01A696ae19550854eaa7D28b6Ad1c0602/sources/project_/contracts/poolRegistry.sol | Removes a borrower from the pool. Only called by the pool owner _poolId The Id of the pool. _borrowerAddress The address of the borrower./ | function removeBorrower(
uint256 _poolId,
address _borrowerAddress
) external ownsPool(_poolId) {
_revokeAddress(_poolId, _borrowerAddress, false);
}
| 3,263,723 |
./full_match/97/0xc652e53177AeD5baC8d251E81549AbB38B723C0C/sources/project_/contracts/factory.sol | Returns proxy address of a particular user's deal./ | function escrowProxyAddress(
string memory _dealId
) public view returns (address) {
return dealIdToEscrowProxy[_dealId];
}
| 3,261,238 |
./partial_match/56/0xe820143c2Ac9716dbed0Aa140C7471B279dBC53e/sources/MasterChefN.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.allocPoint == 0) {
pool.lastRew... | 11,070,239 |
./full_match/1/0xC4bfcAC43433C2435184c87aF26daDE9379b5B11/sources/project:/contracts/MtrollerUser.sol | Validates seize and reverts on rejection. May emit logs. mTokenCollateral The mToken which was used as collateral and will be seized mTokenBorrowed The mToken in which underlying asset was borrowed by the borrower liquidator The address repaying the borrow and seizing the collateral borrower The address of the borr... | function seizeVerify(uint240 mTokenCollateral, uint240 mTokenBorrowed, address liquidator, address borrower, uint seizeTokens) external view {
mTokenCollateral;
mTokenBorrowed;
liquidator;
borrower;
seizeTokens;
if (false) {
maxAssets;
}
}
| 4,993,300 |
pragma solidity ^0.4.17;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
... | Forward ERC20 methods to upgraded contract if this one is deprecated | function allowance(address _owner, address _spender) public constant returns (uint remaining) {
if (deprecated) {
return StandardToken(upgradedAddress).allowance(_owner, _spender);
return super.allowance(_owner, _spender);
}
}
| 436,268 |
// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is dis... | Returns the Balancer Vault./ | function getVault() public view override returns (IVault) {
return _vault;
}
| 1,257,781 |
./full_match/3/0x2f9f29215145e3815652C17858fC940325795Df9/sources/localhost/FlashSwapGun.sol | emit UniswapV2CallInit(sender, amount0, amount1, wethAddress, pairBAddress); | function testCall2(address sender, uint amount0, uint amount1) external returns (address , uint , uint) {
(sender, amount0, amount1);
}
| 8,132,151 |
pragma solidity ^0.4.24;
import "../node_modules/openzeppelin-solidity/contracts/token/ERC721/ERC721.sol";
contract StarNotary is ERC721 {
struct Star {
string name;
string story;
string ra;
string dec;
string mag;
}
mapping(bytes32 => uint256) public myStars;
... | check if the owner of tokenId is who initially deployed the contract, the owner of the contract. | function putStarUpForSale(uint256 _tokenId, uint256 _price) public {
require(this.ownerOf(_tokenId) == msg.sender);
starsForSale[_tokenId] = _price;
}
| 14,123,392 |
./full_match/11155111/0x131fF587aDDd4D633508CeD979409DB370Fd421C/sources/project_/contracts/Utils.sol | Could cause a revert due to insufficient gas. / | function pMul(G1Point memory p, uint256 s) internal view returns (G1Point memory r) {
assembly {
let m := mload(0x40)
mstore(m, mload(p))
mstore(add(m, 0x20), mload(add(p, 0x20)))
mstore(add(m, 0x40), s)
if iszero(staticcall(gas(), 0x07, m, 0x60, r... | 3,833,684 |
./full_match/4/0x344884f69f839ccB0adAF09dfC2337BdFbDB881F/sources/contracts/BaseDistributor.sol | only interested in the subscription approval callbacks sanity checks for testing purpose | function _checkSubscription(
ISuperToken superToken,
bytes calldata ctx,
bytes32 agreementId
)
private
{
ISuperfluid.Context memory context = _host.decodeCtx(ctx);
if (context.agreementSelector == IInstantDistributionAgreementV1.approveSubscription.selector) {... | 809,705 |
./full_match/137/0x7a6C1ee1aAc2647bBDCEdaCB5d5e81194E2A6Df3/sources/contracts/token/ERC721/LakeERC721.sol | See {IERC721Metadata-tokenURI}./ | function tokenURI(uint256 tokenId_) public view virtual override returns (string memory) {
require(_exists(tokenId_), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0
? string(abi.encodePacked(baseURI, token... | 4,680,344 |
pragma solidity ^0.4.25;
// It's important to avoid vulnerabilities due to numeric overflow bugs
// OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs
// More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-insecurity-bad-arithmetic/
impo... | Called after oracle has updated flight status/ | function processFlightStatus
(
address airline,
string memory flight,
uint256 timestamp,
uint8 statusCode
)
internal
requireIsOperational
{
bytes32 key = getFlightKey(airline, flight, timestamp);
flights... | 5,446,968 |
./partial_match/3/0xf04DAe4eeEe500aA163c0cb38d2153389f9b5D05/sources/Producer.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;... | 16,639,443 |
./full_match/1/0xD953Eda57EAB69F2EB0103bffA9acc66eA98e0aB/sources/contracts/modules/Module.sol | Executes an operation in the context of the module contract./ | function execute(bytes calldata) external virtual override {
require(false, "FW100");
}
| 17,017,355 |
pragma solidity ^0.4.7;
/* Simple contract that returns a string */
contract Greeter {
address owner; // Owner of the contract
string greeting; // Greeting
/* Constructor */
function Greeter() public {
owner = msg.sender;
greeting = "Hi from Greeter";
}
/* Kill this contract *... | Return the greeting / | function getGreeting() constant returns (string) {
bytes memory s = bytes(greeting);
if (s.length == 0) {
return "Yeh, greeting was empty dude";
return greeting;
}
}
| 1,782,232 |
//SPDX-License-Identifier: Unlicense
// Creator: Pixel8 Labs
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
imp... | Admin only airdrop function/ | function airdrop(address wallet, uint256 amount)
external
onlyRole(DEFAULT_ADMIN_ROLE) {
_mint(wallet, amount);
}
| 11,794,899 |
./full_match/1/0xbDb2cEdD3928B4523F3347a1e94c24897E81730d/sources/Zpunks4.sol | Set the metadata source url | function setBaseURI(string memory baseURI) public onlyOwner {
_setBaseURI(baseURI);
}
| 9,810,761 |
./full_match/80001/0xf2F9Dc580289FC127D88f6A6FeF19b0e3c99BBCd/sources/contracts/lib/SettlementTokenMath.sol | solhint-disable-next-line var-name-mixedcase | function lte(
int256 settlementToken,
int256 amountX10_18,
uint8 decimals
) internal pure returns (bool) {
return parseSettlementToken(settlementToken, decimals) <= amountX10_18;
}
| 9,454,104 |
// SPDX-License-Identifier: GPL-2.0-only
// Copyright 2020 Spilsbury Holdings Ltd.
pragma solidity >=0.6.10 <0.8.0;
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';
import {Pausable} from '@openzeppelin/contracts/utils/Pausable.... | Deposit funds as part of the first stage of the two stage deposit. Non-permit flow assetId - unique ID of the asset assetAddress - address of the ERC20 asset depositorAddress - address from which funds are being transferred to the contract amount - amount being deposited/ check user approved contract to transfer fu... | function internalDeposit(
uint256 assetId,
address assetAddress,
address depositorAddress,
uint256 amount
) internal {
uint256 rollupAllowance = IERC20(assetAddress).allowance(depositorAddress, address(this));
require(rollupAllowance >= amount, 'Rollup Processor: ... | 2,541,770 |
./full_match/5/0x5634ff2520E9ab6fD64Ebbf0B49D92Cc52aeeA77/sources/contracts/lib/ERC721EnumerableMod.sol | Hook that is called before any token transfer. This includes minting and burning. Calling conditions: - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be transferred to `to`. - When `from` is zero, `tokenId` will be minted for `to`. - When `to` is zero, ``from``'s `tokenId` will be burned. - `from` c... | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override {
super._beforeTokenTransfer(from, to, tokenId);
if (from != address(0) && from != to) {
_removeTokenFromOwnerEnumeration(from, tokenId);
}
if... | 1,921,253 |
pragma solidity ^0.4.18;
/**
*
* I N P I Z Z A W E C R U S T
*
* ______ ____ _____ _____ _
* | ____/ __ \ / ____| | __ (_)
* | |__ | | | | (___ | |__) | __________ _
* | __|| | | |\___ \ | ___/ |_ /_ / _` |
* | |___| |__| |____) | _ | | | |/ / / /... | Public function that allows the owner to blacklist multiple entries _entries An array with the entries to be blacklist/ | function blacklistAddresses(address[] _entries) public onlyOwner {
setWhitelistEntries(_entries, false);
}
| 12,150,797 |
/**
*Submitted for verification at Etherscan.io on 2021-02-02
*/
// File: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overf... | Claimable contract interface | interface IClaimable {
function owner() external view returns (address);
function transferOwnership(address newOwner) external;
function acceptOwnership() external;
}
}
| 2,294,084 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "../utilities/Initializable.sol";
import "../utilities/Context.sol";
import "../access/Ownable.sol";
import "../security/Pausable.sol";
import "../interfaces/IBEP20.sol";
import "../libraries/Address.sol";
// Implementation of the IBEP20 Interface, using... | Sets 'amount' as the allowance of 'spender' then returns a boolean indicating result of operation. Emits an {Approval} event. | function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), 'BEP20: approve from the zero address');
require(spender != address(0), 'BEP20: approve to the zero address');
_allowances[owner][spender] = amount;
emit Approval(owner, spender... | 12,752,683 |
pragma solidity ^0.4.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity automatically t... | Just returns `now` value This function is redefined in EthearnalRepTokenCrowdsaleMock contract to allow testing contract behaviour at different time moments | function getTime() internal returns (uint256) {
return now;
}
| 306,487 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.