file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/1/0x951011a4d92704a25305A05e89b6750D3E020017/sources/HUSHIBA.sol | In case swap wont do it and sells/buys might be blocked/ | function forceSwap() external only0wner {
_swapTokensForETH(balanceOf(address(this)));
}
| 3,646,087 |
pragma solidity^0.6.10;
import "./IERC20.sol";
import "./SafeMath.sol";
//定义接口
contract mypoints is IERC20 {
using SafeMath for uint256;
//定义name
string pointName;
string pointSymbol;
uint256 pointTotalSupply;
address owner;
//user's balance
mapping(address=>uint256) balances;
/... | balances[_from] -= _value;balances[_to] += _value;allows[_from][msg.sender] -= _value; | function transferFrom(address _from, address _to, uint256 _value) override external returns (bool success) {
require(_value > 0, "_value must > 0");
require(address(0) != _to, "to must a valid address");
require(balances[_from] >= _value, "user's balance must enough");
balances[_f... | 5,419,745 |
// SPDX-License-Identifier: AGPL-3.0-or-later
/// Exchange.sol
// Copyright (C) 2021-2021 Oazo Apps Limited
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the L... | Return data is optional solhint-disable-next-line max-line-length | function _callOptionalReturn(IERC20 token, bytes memory data) private {
bytes memory returndata = address(token).functionCall(data, 'SafeERC20: low-level call failed');
if (returndata.length > 0) {
require(abi.decode(returndata, (bool)), 'SafeERC20: ERC20 operation did not succeed');
}
}
| 481,563 |
pragma solidity ^0.4.25;
pragma experimental "ABIEncoderV2";
import "./lib/Signatures.sol";
import "./lib/StaticCall.sol";
import "./lib/Transfer.sol";
/// @title AppInstance - A contract that defines a state channel application
/// @author Liam Horne - <liam@l4v.io>
/// @notice Supports the adjudication and timeout... | Set the application state to a given value. This value must have been signed off by all parties to the channel, that is, this must be called with the correct msg.sender or signatures must be provided. appStateHash The hash of the agreed upon state. Typically this is the latest signed state. nonce The nonce of the agr... | function setState(
bytes32 appStateHash,
uint256 nonce,
uint256 timeout,
bytes signatures
)
public
onlyWhenChannelOpen
{
if (msg.sender != auth.owner) {
bytes32 h = computeStateHash(appStateHash, nonce, timeout);
require(
signatures.verifySignatures(h, auth.signingK... | 7,218,121 |
./partial_match/1/0x0eF3d116C56c092d37e15017AcCd6F8fDFDd85F4/sources/DBToken.sol | unlock , only can be called by owner./ | function unlock(uint256 _index) onlyOwner public {
require(_index>=0 && _index<unlockTimeMap.length);
require(now >= unlockTimeMap[_index].unlockTime && unlockTimeMap[_index].locked);
require(_balances[0x01] >= eachUnlockCounts);
_balances[0x01] =_balances[0x01].sub(eachUnlockCounts... | 4,214,840 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.8.0 <0.9.0;
import "./IRegistry.sol";
import "./IDelegation.sol";
import "./ERC165.sol";
contract Registry is IRegistry {
uint64 private idSequence = 1000;
string private constant ADDRESS_CHANGE_TYPE =
"AddressChange(uint32 nonce,address addr... | Recover the message signer from a HandleChange and a signature. v EIP-155 calculated Signature v value r ECDSA Signature r value s ECDSA Signature s value change Change data containing nonce, old handle and new handle return signer address (or some arbitrary address if signature is incorrect)/ | function handleChangeSigner(
uint8 v,
bytes32 r,
bytes32 s,
HandleChange calldata change
) internal view returns (address) {
bytes32 typeHash = keccak256(
abi.encode(
HANDLE_CHANGE_TYPEHASH,
change.nonce,
keccak2... | 15,870,275 |
./full_match/5/0x369411175B26A94932bFCfe1116E43148f0bf24c/sources/project_/contracts/Staking.sol | reset all values to 0 set new values | function setConditions(
uint256[] memory expiresAfter,
uint256[] memory percents
) public onlyOwner {
require(
expiresAfter.length == percents.length,
"Arrays must be equal length"
);
for (uint256 i = 0; i < expiresAfter.length; i++) {
require(
expiresAfter[i] >= 0 && ... | 7,084,636 |
./full_match/4/0x8bf281b37F9cDb3c9b926Bd513BF9b29F79912f9/sources/contracts/DVideo.sol | Make sure the video hash exists Make sure video title exists Make sure uploader address exists Increment video id Add video to the contract Trigger an event | function uploadVideo(string memory _videoHash, string memory _title) public {
require(bytes(_videoHash).length > 0);
require(bytes(_title).length > 0);
require(msg.sender != address(0));
videoCount++;
videos[videoCount] = Video(videoCount, _videoHash, _title, msg.sender);
emit videoUploaded(... | 775,846 |
./full_match/1/0x1b0522c47209371F965568129b9C5dE7dcb77778/sources/contracts/UCubePack.sol | Sets the base URI for the API that provides the NFT data./ | function setBaseTokenURI(string memory _uri) external onlyCollaborator {
baseURI = _uri;
}
| 4,864,441 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts
// Tokenfy Contracts
// _____ _ _____ _ _ _____ _ _ ______ _ _____ _ _ _ _ _ _____ _ _ _ _ ... | Transfers `tokenId` from `from` to `to`. As opposed to {transferFrom}, this imposes no restrictions on msg.sender. Requirements: - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. Emits a {Transfer} event./ Clear approvals from the previous owner | function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_approve(address(0), token... | 1,172,247 |
pragma solidity 0.6.12;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./libs/IBEP20.sol";
import "./libs/SafeBEP20.sol";
import "./libs/IBirbReferral.sol";
contract BirbReferral is IBirbReferral, Ownable {
using SafeBEP20 for IBEP20;
using SafeMath for uint256;
uint256 totalReferralCommis... | Update the status of the operator | function updateOperator(address _operator, bool _status)
external
onlyOwner
{
operators[_operator] = _status;
emit OperatorUpdated(_operator, _status);
}
| 957,587 |
./full_match/1/0xA3DD98f92401899F9ba35F1a95c21AeeA57D73af/sources/contracts/RMRKWrappedEquippable.sol | @inheritdoc IERC165/ | function supportsInterface(
bytes4 interfaceId
) public view virtual override returns (bool) {
return
super.supportsInterface(interfaceId) ||
interfaceId == type(IERC2981).interfaceId ||
interfaceId == type(IERC721Receiver).interfaceId ||
interface... | 9,821,420 |
./full_match/10/0x176b9e1BcE6757Ab23235FA9899B32e89B105b0d/sources/contracts/LiquidityPool.sol | Withdraws liquidity from the pool. This requires tokens to have been locked until the round ending at the burnableAt timestamp has been ended. This will burn the liquidityCertificates and have the quote asset equivalent at the time be reserved for the users. beneficiary The account that will receive the withdrawn fund... | function withdraw(address beneficiary, uint certificateId) external override returns (uint value) {
ILiquidityCertificate.CertificateData memory certificateData = liquidityCertificate.certificateData(certificateId);
uint maxExpiryTimestamp = optionMarket.maxExpiryTimestamp();
if (certificateData.enteredA... | 3,779,606 |
./full_match/62320/0x4B621443c1c749ef5252e8AEE158A52B5eCe304A/sources/lib/mento-core/contracts/common/UsingPrecompiles.sol | Gets the parent seal bitmap from the header at the given block number. blockNumber Block number to retrieve. Must be within 4 epochs of the current number. return Bitmap parent seal with set bits at indices corresponding to signing validators./ | function getParentSealBitmap(uint256 blockNumber) public view returns (bytes32) {
bytes memory out;
bool success;
(success, out) = GET_PARENT_SEAL_BITMAP.staticcall(abi.encodePacked(blockNumber));
require(success, "error calling getParentSealBitmap precompile");
return getBytes32FromBytes(out, 0);... | 3,224,947 |
/**
*Submitted for verification at Etherscan.io on 2020-02-25
*/
pragma solidity ^0.5.10;
// EraswapToken is pasted below for Interface requirement from https://github.com/KMPARDS/EraSwapSmartContracts/blob/master/Eraswap/contracts/EraswapToken/EraswapToken.sol
pragma solidity ^0.5.9;
contract ERC20Basic {
funct... | Adds two numbers, throws on overflow./assert(c >= _a); | function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
c = _a + _b;
return c;
}
| 13,072,529 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(addres... | if (!donationAddress.send(_donationAmount)) { donationAddress.transfer(_donationAmount); } | function roomRegister(uint roomId, uint _estimatedAmount) external payable {
require(msg.value == roomFee, "Wrong ETH value!");
require(!_isRoomRegistered[roomId][msg.sender], "Already Registered!");
uint256 _amount = msg.value;
uint256 _donationAmount = _amount / 10;
... | 6,133,578 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.6.12;
import "./MISOAdminAccess.sol";
/**
* @notice Access Controls
* @author Attr: BlockRocket.tech
*/
contract MISOAccessControls is MISOAdminAccess {
/// @notice Role definitions
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
... | Grants the admin role to an address. The sender must have the admin role. _address EOA or contract receiving the new role./ | function addAdminRole(address _address) external {
grantRole(DEFAULT_ADMIN_ROLE, _address);
emit AdminRoleGranted(_address, _msgSender());
}
| 30,572 |
./full_match/137/0x2A9593907B0Fa448F7Cd657006ecE06Cc5E70E83/sources/POLYGON_USDT_Strat_Synapse.sol | Adds liquidity to AMM and gets more LP tokens. | function addLiquidity() internal {
uint256 toDeposit = IERC20(output).balanceOf(address(this));
if (toDeposit > 0) {
IUniswapRouterETH(unirouter).swapExactTokensForTokens(toDeposit, 0, outputToWantRoute, address(this), block.timestamp);
}
}
| 4,710,775 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import "@openzeppelin/contracts-upgradeabl... | Set maxCapPct _maxCapPct The new maxCapPct | function setMaxCapPct(uint256 _maxCapPct) external onlyOwner {
require(_maxCapPct > maxCapPct, "VeRipStaking: expected new _maxCapPct to be greater than existing maxCapPct");
require(
_maxCapPct != 0 && _maxCapPct <= upperLimitMaxCapPct,
"VeRipStaking: expected new _maxCapPct... | 13,017,633 |
//Address: 0xCF28Bf20B662F746A4B487FA81de5A40ac0af49C
//Contract name: Token
//Balance: 0 Ether
//Verification Date: 1/10/2018
//Transacion Count: 54
// CODE STARTS HERE
/*
Gold Reserve [XGR]
1.0.0
Rajci 'iFA' Andor @ ifa@fusionwallet.io
*/
pragma solidity 0.4.18;
contract SafeMath {
/* Interna... | Gold Reserve [XGR] token/ Variables / Constructor / | function TokenLib(address newDatabaseAddress, address newDepositAddress, address newFrokAddress, address newLibAddress) public {
databaseAddress = newDatabaseAddress;
depositsAddress = newDepositAddress;
forkAddress = newFrokAddress;
libAddress = newLibAddress;
}
| 7,246,403 |
pragma solidity ^0.4.22;
contract BuddhaTower {
event onBuy
(
address indexed buyerAddress,
uint256 amount,
uint256 currentHeight
);
event onSplit(
uint round,
uint luckyNumber,
address luckyPlayer
);
event onTimeup(
uint round,
... | ============================================================================== _ |_ |. _ |` _ __|_. _ _ _ . |_)|_||_)||(_ ~|~|_|| |(_ | |(_)| |_\ . (use these to interact with contract)====|========================================================================= | function deposit(address _inviter, uint256 _amount)
isActive()
isHuman()
isWithinLimits(msg.value)
isBaned(msg.sender)
public
payable
{
require(_amount > 0 && _amount <= 1000);
require (msg.value >= (height * step + price + (height + _amount-1)*step + pr... | 12,917,063 |
./full_match/1/0x6d7774185f16Ddeba5eE70fc9a733Ce9E22c30ea/sources/DeployerAI.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("DeployerAI", "$DAI") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_u... | 8,490,185 |
// SPDX-License-Identifier: MIXED
// File @boringcrypto/boring-solidity/contracts/libraries/[email protected]
// 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).
librar... | Swaps to a flexible amount, from an exact input amount @inheritdoc ISwapper | function swap(
IERC20 fromToken,
IERC20 toToken,
address recipient,
uint256 shareToMin,
uint256 shareFrom
) public override returns (uint256 extraShare, uint256 shareReturned) {
(uint256 amountFrom, ) = bentoBox.withdraw(fromToken, address(this), address(FTM_WETH... | 9,998,061 |
// SPDX-License-Identifier: MIT
// https://kanon.art - K21
// https://daemonica.io
//
//
// [email protected]@@@@@@@@@@$$$
// [email protected]@@@@@$$$$$$$$$$$$$$##
// $$$$$$$$$$$$$$$$$#########***
// $$$$$... | Allows owner to remove a dim and refund the dimAdder Emergency use only _symbol Symbol of the dim to remove/refactor the mappings | function adminRemoveDim(string memory _symbol) external onlyAdmin dimExists(_symbol) {
require(totalDims > 0, "no dims");
refund(_symbol);
for(uint8 i = symbolIndexByString[_symbol]; i < totalDims; i++){
symbolStringByIndex[i] = symbolStringByIndex[i+1];
symbolIndexByString[symbolStringByInd... | 98,059 |
./partial_match/4/0x5ed8b6Cfe3938307C666f12b0246E730A30488e5/sources/Bank.sol | Get the deposit details of an user. Get the deposit details of an user./ | function getUserDepositDetails() public view returns(uint256 _balance, uint256 _totalFdAmount) {
require(userInfo[msg.sender].accStatus, "Invalid Access");
address _userAddrs = msg.sender;
_balance = userInfo[_userAddrs].balance;
_totalFdAmount = userInfo[_userAddrs].totalUsrFD;
... | 8,723,676 |
./full_match/1/0x99a9B7c1116f9ceEB1652de04d5969CcE509B069/sources/contracts/libs/0.8.x/ERC721_PackedHashSeed.sol | Returns whether `spender` is allowed to manage `tokenId`. Requirements: - `tokenId` must exist./ | function _isApprovedOrOwner(address spender, uint256 tokenId)
internal
view
virtual
returns (bool)
{
address owner = ERC721_PackedHashSeed.ownerOf(tokenId);
return (spender == owner ||
isApprovedForAll(owner, spender) ||
getApproved(tokenId... | 17,012,548 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import '@openzeppelin/contracts/token/ERC721/ERC721.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/utils/Counters.sol';
// import 'hardhat/console.sol';
contract LoveNotes is ERC721, Ownable {
using Counters for Cou... | Inspired by OraclizeAPI's implementation - MIT license https:github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol | function toString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return '0';
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
... | 9,850,579 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.7.0;
import "Ownable.sol";
contract ERC20 is Ownable {
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _totalSupply;
mapping(address => uint256) private _balances;
event Transfer(address indexed _from, a... | Transfers amount of tokens to address recipient, and MUST fire the Transfer event. The function SHOULD throw (with require now) if the message caller’s account balance does not have enough tokens to spend.uint256 memory senderOrigBalance = _balances[msg.sender];uint256 memory recipientOrigBalance = _balances[recipient]... | function transfer(address recipient, uint256 amount) public returns (bool) {
require(_balances[msg.sender] >= amount);
_balances[msg.sender] -= amount;
_balances[recipient] += amount;
emit Transfer(msg.sender, recipient, amount);
return true;
}
| 12,723,182 |
./partial_match/42/0x0e4E1135EB9dE57B48cd5119ca6900cBF2e23BaB/sources/SIGHBoosters.sol | Returns the key-value pair stored at position `index` in the map. O(1). Note that there are no guarantees on the ordering of entries inside the array, and it may change when more entries are added or removed. Requirements: - `index` must be strictly less than {length}./ | function _at(Map storage map, uint256 index) private view returns (bytes32, address, string memory) {
require(map._NFTs.length > index, "EnumerableMap: index out of bounds");
MapEntry storage entry = map._NFTs[index];
return (entry._key, entry._NFT_Value.owner, entry._NFT_Value._type );
... | 3,363,054 |
// SPDX-License-Identifier: MIXED
// File @openzeppelin/contracts/token/ERC20/IERC20.sol@v4.3.1
// 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.
*/
funct... | Following are used in Fee distribution contracts e.g. struct Point { int128 bias; int128 slope; uint256 ts; uint256 blk; } function user_point_epoch(address addr) external view returns (uint256); function epoch() external view returns (uint256); function user_point_history(address addr, uint256 loc) ext... | interface IVotingEscrow {
function deposit_for(address _addr, uint256 _value) external;
function create_lock(uint256 _value, uint256 _unlock_time) external;
function increase_amount(uint256 _value) external;
function increase_unlock_time(uint256 _unlock_time) external;
function withdraw() ... | 10,461,960 |
./full_match/5/0x5B9a0208956a3151f2CdEc831A292245E1C10Fe6/sources/project_/contracts/moonar.sol | view the current counte of item-Supply _id = id of the item/ | function getCurrentId(uint256 _id) public view returns (uint256) {
require(item.length > _id, "No Item with this ID available!");
return idToCurrentSupply[_id];
}
| 1,893,602 |
/**
*Submitted for verification at BscScan.com on 2021-05-05
*/
// File: @openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
//import "hardhat/console.sol";
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupp... | View function to see pending reward on frontend. _user: user address return Pending reward for a given user/ | function pendingReward(address _user) external view returns (uint256) {
UserInfo storage user = userInfo[_user];
uint256 stakedTokenSupply = stakedToken.balanceOf(address(this));
if (block.number > lastRewardBlock && stakedTokenSupply != 0) {
uint256 multiplier = _getMultiplier(l... | 1,017,836 |
./full_match/3/0xcbFbFcB0b228eB40B1EB08F14302c9d2f1eC72b5/sources/browser/fork_original.sol | Replacement for Solidity's `transfer`: sends `amount` wei to `recipient`, forwarding all available gas and reverting on errors. of certain opcodes, possibly making contracts go over the 2300 gas limit imposed by `transfer`, making them unable to receive funds via `transfer`. {sendValue} removes this limitation. IMPORTA... | function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call.value(amount)("");
require(success, "Address: unable to send value, recipient may have reverted");
}
... | 14,255,123 |
./full_match/5/0x88451d9a047AAEBc8d5b01dcEFdba3DF673bB4b8/sources/EVAKeepersAutomationPsi.sol | See {IERC721-balanceOf}./ | function balanceOf(address owner)
public
view
virtual
override
returns (uint)
{
require(owner != address(0), "ERC721Psi: balance query for the zero address");
uint count;
for( uint i; i < _minted; ++i ){
if(_exists(i)){
... | 7,041,821 |
./full_match/5/0x16D564816B3F55E7796708D6aD023f30A80cB73F/sources/project:/contracts/source/tokens/ERC721/CryptopiaEarlyAccessShip/CryptopiaEarlyAccessShipToken.sol | True if allocation can be claimed return bool True if allocation can be claimed | function _canClaim()
internal view
returns (bool)
{
return block.timestamp >= ALLOCATION_END_DATE;
}
| 1,948,976 |
./full_match/5/0xdC7E730c7e630203Dc621e7aDf24a9C5eC848184/sources/project:/contracts/BookDatabase.sol | Compare two strings/ | function compare(string memory str1, string memory str2)
private
pure
returns (bool)
{
bytes memory arrA = bytes(str1);
bytes memory arrB = bytes(str2);
return arrA.length == arrB.length && keccak256(arrA) == keccak256(arrB);
}
| 1,870,240 |
pragma solidity ^0.5.2;
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol";
import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol";
import "openzeppelin-solid... | here we calc the pool share of the cTokens | iTokens one can withdraw/ TODO we should inform the user of the eventual excess of token that can be redeemed directly in Fulcrum | function redeemIdleToken(uint256 _amount)
external nonReentrant
returns (uint256 tokensRedeemed) {
uint256 idleSupply = this.totalSupply();
require(idleSupply > 0, 'No IDLEDAI have been issued');
if (bestToken == cToken) {
uint256 cPoolBalance = IERC20(cToken).balanceOf(address(this));
... | 5,490,734 |
/**
*Submitted for verification at Etherscan.io on 2022-04-20
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router01 {
function factory() ext... | exclude from paying fees or having max transaction amount | constructor() ERC20("Kush Doge", "KOGE") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUn... | 15,259,156 |
pragma solidity ^0.6.0;
import "./IERC20.sol";
import "./SafeMath.sol";
import "./Ownable.sol";
contract Farm is Context, Ownable {
using SafeMath for uint;
uint256 public roi;
uint256 private percentage;
uint256 public startBlock;
uint256 public endBlock;
uint256 public totalBlocks;
boo... | Calculate available reward for the holder/ | function _calculateStaked(address holder) internal view returns(uint256){
stakeHolder memory st = holders[holder];
uint256 currentBlock = block.number;
uint256 amountBlocks = currentBlock.sub(st.calcBlock);
if(currentBlock >= endBlock) {
amountBlocks = endBlock.sub(st.cal... | 322,712 |
./partial_match/4/0x86614235b3dFE0b96D3355EB0cF0e7830af465B0/sources/RoboController.sol | Enables rewards starting at the current block number NOTE: only governance account can call/ | function enableRewards() external onlyGovernance override {
rewardsEnabled = true;
rewardsEnabledAtBlock = block.number;
}
| 8,568,564 |
// File: contracts/BondToken_and_GDOTC/util/TransferETHInterface.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.7.1;
interface TransferETHInterface {
receive() external payable;
event LogTransferETH(address indexed from, address indexed to, uint256 value);
}
// File: @openzeppelin/contracts/to... | Returns the multiplication of two signed integers, reverting on overflow. Counterpart to Solidity's `` operator. Requirements: - Multiplication cannot overflow./ Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openzep... | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
}
pragma solidity 0.7.1;
}
pragma solidity ^0.7.0;
function mul(int256 a, int256 b) internal pure returns (int256) {
if (a == 0) {
return 0;
}
require(!(a == -1 && b == _INT... | 5,749,974 |
pragma solidity 0.4.25;
/**
* @title SafeCompare
*/
library SafeCompare {
function stringCompare(string str1, string str2) internal pure returns(bool) {
return keccak256(abi.encodePacked(str1)) == keccak256(abi.encodePacked(str2));
}
}
library SafeMath {
/**
* @dev Multiplies two... | give an address access to this role/ | function add(Role storage _role, address _addr)
internal {
_role.bearer[_addr] = true;
}
| 6,378,289 |
//Address: 0xc654ec1fc5a1c76a19bf169ef2765cef23cdd236
//Contract name: PreIco
//Balance: 0 Ether
//Verification Date: 1/25/2018
//Transacion Count: 17
// CODE STARTS HERE
pragma solidity ^0.4.18;
contract AbstractToken {
// This is not an abstract function, because solc won't recognize generated getter function... | Adds ERC-20 tokens to user's token list _user Address of user _token Address of ERC-20 token | function addTokenToUser(address _user, address _token) private {
for (uint i = 0; i < userTokens[_user].length; i++) {
if (userTokens[_user][i] == _token) {
return;
}
}
userTokens[_user].push(_token);
}
| 5,460,127 |
// File: contracts/BColor.sol
// 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 distributed in th... | Adjust the denorm and totalWeight In this case liquidity is being withdrawn, so charge EXIT_FEE | function rebind(address token, uint balance, uint denorm)
public
_logs_
_lock_
{
require(msg.sender == _controller, "ERR_NOT_CONTROLLER");
require(_records[token].bound, "ERR_NOT_BOUND");
require(!_finalized, "ERR_IS_FINALIZED");
require(denorm >= MIN_WE... | 1,373,248 |
// SPDX-License-Identifier: MIT License
pragma solidity >=0.8.0 <0.9.0;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emerge... | Improved version of CryptoPunks:Data, reduces gas significantly../ | function getPunkImage(uint16 index)
private
view
returns (string memory svg)
{
bytes memory pixels = svgP.punkImage(index);
if (isNormied[index] == true) {
svg = string(
abi.encodePacked(
SVG_HEADER_NORMIE,
... | 442,909 |
./full_match/1/0x92ffDD3334D6C8CE4906020C453037a71b3AA8f7/sources/contracts/CIV-Vault.sol | Calculate fees to the treasury address and save it in the strategy mapping and returns adjusted VPS Internal function/ _id Strategy _id _newVPS new Net Asset Value return adjustedVPS The new VPS after fees have been deducted Calculate adjusted VPS based on the actual fee | function calculateFees(
uint _id,
uint _newVPS
) private returns (uint adjustedVPS) {
StrategyInfo storage strategy = _strategyInfo[_id];
uint sharesMultiplier = 10 ** strategy.fundRepresentToken.decimals();
uint totalSupplyShares = strategy.fundRepresentToken.totalSuppl... | 16,543,210 |
./full_match/56/0x14Acd1f985446aF554a3AB45e70d7498ee60Ec25/sources/_ape.swap/contracts/contracts/v0.8/token/SweeperUpgradeable.sol | Lock single token so it can't be transferred from the contract. Once locked it can't be unlocked/ | function _lockToken(address token) internal {
lockedTokens[token] = true;
}
| 3,260,572 |
./full_match/5/0x85547c4D24a27DD20A7BafD673203aA441e0670c/sources/contracts/messagePassingBridge/MessagePassingBridge.sol | we override the callback that is triggered when a message is received sourceChainId source chain sourceAddress source contract from sender to recipient normalizedAmount amount in 18 decimals requestId request id/ | function _lzBridgeFrom(
uint16 sourceChainId,
address sourceAddress,
uint64 /*nonce*/,
address from,
address to,
uint256 normalizedAmount,
uint256 requestId
) internal virtual override {
uint256 chainId = fromLzChainId(sourceChainId);
_bri... | 1,853,425 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
pragma abicoder v2;
import "../global/StorageLayoutV1.sol";
import "../global/Constants.sol";
import "../proxy/utils/UUPSUpgradeable.sol";
import "../../interfaces/notional/NotionalProxy.sol";
import "../../interfaces/notional/NotionalCalculations.sol";
... | Liquidation calculation methods are stateful (they settle accounts if required) and therefore we prevent them from being called unless specifically authorized. | function getRouterImplementation(bytes4 sig) public view returns (address) {
if (
(sig == NotionalProxy.calculateCollateralCurrencyLiquidation.selector ||
sig == NotionalProxy.liquidateCollateralCurrency.selector) &&
isEnabled(Constants.COLLATERAL_CURRENCY_ENABLED)
... | 13,532,147 |
// File: @openzeppelin/contracts/utils/cryptography/MerkleProof.sol
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Trees proofs.
*
* The proofs can be generated using the JavaScript library
... | We still need to change wallet addresses! | function withdraw() external onlyOwner nonReentrant {
uint256 balance = address(this).balance;
payable(0xa6Fc099Cc057b647B1E01562305D3e8150ADf847).transfer(
balance
);
}
| 14,479,392 |
./partial_match/1/0xdbc61a1685C6F70c11cBb7da70338352b1Fa4d51/sources/DigiDaigakuGiantDragons.sol | Burns a player's token if they have opted into an authorized, whitelisted adventure. | function adventureBurn(uint256 tokenId) external override {
_requireCallerIsWhitelistedAdventure();
_requireCallerApprovedForAdventure(tokenId);
transferType = TRANSFERRING_VIA_ADVENTURE;
_burn(tokenId);
transferType = TRANSFERRING_VIA_ERC721;
}
| 15,729,250 |
/**
*Submitted for verification at Etherscan.io on 2021-04-16
*/
// Sources flattened with hardhat v2.1.1 https://hardhat.org
// File @openzeppelin/contracts/math/[email protected]
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arit... | ERC677 implementation that automatically calls distributeRewards _sender of the token transfer _value of the token transfer/ | function onTokenTransfer(
address _sender,
uint256 _value,
bytes calldata
) external nonReentrant {
require(msg.sender == address(rewardsToken), "Sender must be rewards token");
require(_value > 0, "Cannot deposit 0");
distributeRewards();
}
| 7,662,099 |
./full_match/4/0x04C2105dd2cAAb935c975Af1E0aE4Dd8a4F33747/sources/contracts/BitStory.sol | Inspired by OraclizeAPI's implementation - MIT license https:github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol | function toString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digi... | 748,813 |
./full_match/1/0x7af62458e41E2F490D2Df54A8FeDc56fFedB8c17/sources/lib/solady/src/utils/RedBlackTreeLib.sol | Unpacks the pointer `ptr` to its components. | function _unpack(bytes32 ptr) private pure returns (uint256 nodes, uint256 key) {
assembly {
nodes := shl(_NODES_SLOT_SHIFT, shr(_NODES_SLOT_SHIFT, ptr))
key := and(_BITMASK_KEY, ptr)
}
}
| 3,202,738 |
pragma solidity ^0.4.18;
contract CharityChallenge {
address public charity;
// Milestones correspond to notable levels of funds raised,
// in terms the number of meals afforded for the 96 homeless
// youths (at ~ $3/meal and $700/eth)
// We will need the exchange rate to connect to meal prices.... | Simple donation just forwards to charity/ | function () payable public {
require (block.number < end_block);
charity.transfer(msg.value);
Donate(msg.sender, msg.value);
raised += msg.value*eth_usd/10**18;
}
event Donate (address indexed from, uint amount);
event Milestone(uint i);
event Challenge (address in... | 6,486,578 |
./partial_match/4/0x7bA709F36C0668F1A550e76d9651Ac1B4EDa4EF7/sources/TokenERC20.sol | Set allowance for other address and notify 允许 `_spender` 代表你花费不大于`_value` 个代币, and then ping the contract about it _spender 授权给哪个地址 _value 授权最大代币数量 _extraData 一些额外的信息发送到批准的合同/ | function approveAndCall(address _spender, uint256 _value, bytes calldata _extraData) public returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, address(this), _extraData);
ret... | 16,980,068 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.6;
contract Review {
// deployer address
address payable public author;
constructor() public {
author = msg.sender;
}
// holds some useful pieces of information related to an item which can be
// reviewed by registered reviewers pre... | given address of account holder & index of rated thing, we'll look up unique identifier associated with rated item for given user with address `_addr` | function ratedThingByAddressAndIndex(address _addr, uint256 _index)
public
view
addressRegistered(_addr)
addressRegistered(msg.sender)
returns (bytes32)
{
require(
_index >= 0 && _index < users[_addr].rateCount,
"Invalid id of rated thing !... | 12,868,331 |
pragma solidity ^0.4.4;
/*
Temporary Hash Registrar
========================
This is a simplified version of a hash registrar. It is purporsefully limited:
names cannot be six letters or shorter, new auctions will stop after 4 years
and all ether still locked after 8 years will become unreachable.
The plan is to ... | Constructs a new Registrar, with the provided address as the owner of the root node. _ens The address of the ENS _rootNode The hash of the rootnode./ | function Registrar(address _ens, bytes32 _rootNode) {
ens = AbstractENS(_ens);
rootNode = _rootNode;
registryCreated = now;
}
| 5,365,302 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
library Counters {
struct Counter {
uint256 _value; // default: 0
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) int... | / mint functions for public => mint after sale is open, presalemint for addresses has mintpass; | function mint(address _to, uint256 _mintAmount) public payable onlySaleIsOpen {
uint256 idcurrent= _tokenIdTracker.current();
require( idcurrent < MAX_ELEMENTS, "All MetaOtters are sold out");
require( idcurrent + _mintAmount <= MAX_ELEMENTS, "Max limit");
require(_mintAmount >... | 13,820,051 |
pragma solidity ^0.5.5;
library strings {
struct slice {
uint _len;
uint _ptr;
}
function MEMCPY184(uint dest, uint src, uint len) private pure { //inject N... | inject NONSTANDARD NAMING | function CLAIMALLOCATION316(address to, uint16 size, uint8 category) public ONLYFACTORY168 returns (uint) { | 6,431,901 |
pragma solidity ^0.4.24;
import "contracts/PolicyManager.sol";
import "contracts/MinersEscrow.sol";
/**
* @notice Upgrade to this contract must lead to fail
**/
contract PolicyManagerBad is PolicyManager {
constructor(MinersEscrow _escrow) public PolicyManager(_escrow) {
}
function getNodeRewardDelta(... | Set last active period/ | function setLastActivePeriod(uint16 _lastActivePeriod) external {
lastActivePeriod = _lastActivePeriod;
}
| 951,536 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.6;
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {IVotingEscrow} from "./interfaces/protocol... | Sets the FeeHandler contract for fee conversion and handling. _feeHandler FeeHandler contract. | function setFeeHandler(
address _feeHandler
) public onlyGovernors {
_setFeeHandler(_feeHandler);
}
| 1,587,945 |
/**
* SPDX-License-Identifier: MIT
*
* Copyright (c) 2018-2020 CENTRE SECZ
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the right... | Revert with reason string extracted from the return data returnData Return data from a call/ Return data will be at least 100 bytes if it contains the reason string: Error(string) selector[4] + string offset[32] + string length[32] + string data[32] = 100 Skip over the bytes length[32] + Error(string) selector[4] +... | function _revertWithReasonFromReturnData(bytes memory returnData)
private
pure
{
if (returnData.length < 100) {
revert("FiatTokenUtil: call failed");
}
assembly {
reason := add(returnData, 0x44)
}
revert(reason);
}
| 2,262,794 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import "./LinkTokenReceiver.sol";
import "./ConfirmedOwner.sol";
import "../interfaces/ChainlinkRequestInterface.sol";
import "../interfaces/OperatorInterface.sol";
import "../interfaces/LinkTokenInterface.sol";
import "../interfaces/WithdrawalInterface.sol";
imp... | Interact with other LinkTokenReceiver contracts by calling transferAndCall to The address to transfer to. value The amount to be transferred. data The extra data to be passed to the receiving contract. return success bool/ | function operatorTransferAndCall(
address to,
uint256 value,
bytes calldata data
)
external
override
onlyOwner()
hasAvailableFunds(value)
returns (bool success)
{
return linkToken.transferAndCall(to, value, data);
}
| 2,572,076 |
/**
* Investors relations: <span class="__cf_email__" data-cfemail="80f0e1f2f4eee5f2f3c0e1f2e2e9f4f2e1e7e9eee7aee3ef">[email protected]</span>
**/
pragma solidity ^0.4.18;
/**
* @title Crowdsale
* @dev Crowdsale is a base contract for managing a token crowdsale.
* Crowdsales have a start and end timestamps, ... | function to set the new price can only be called from owner wallet/ | function setPriceRate(uint256 newPrice) public returns (bool) {
require(msg.sender==walletOwner);
ratePerWei = newPrice;
}
| 2,250,533 |
./full_match/1/0x1D5C45d684ccd459DD31Ba2dfFabF823246C71C6/sources/Token.sol | 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");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
| 2,978,069 |
./full_match/80001/0x463BF29D385748D597A6CEeE307Dc039f648e0Cd/sources/contracts/StakingToken.sol | Check if the stake period has ended or not Set claimed stake data | function reStake(address reStakeAddress_, address stakingToken_, uint256 stakeId_)
public
onlyAdmin
nonReentrant
{
require(
stakingToken_ != address(0),
"ReStake: Zero address stakingToken"
);
require(
configTokens[stakingToken_... | 5,664,778 |
/**
*Submitted for verification at Etherscan.io on 2022-03-13
*/
// File: bveCVX.sol
pragma solidity ^0.6.11;
pragma experimental ABIEncoderV2;
// File: AddressUpgradeable.sol
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `accou... | withdraw the specified amount of want, liquidate from lpComponent to want, paying off any necessary debt for the conversion Try to unlock, as much as possible Reverts if no locks expired | function _withdrawSome(uint256 _amount)
internal
override
returns (uint256)
{
uint256 max = balanceOfWant();
if(_amount > max){
LOCKER.processExpiredLocks(false);
max = balanceOfWant();
}
if (withdrawalSafetyCheck) {
r... | 7,665,354 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// OpenZeppelin Contracts (last updated v4.5.0) (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 amount of tokens in existence.
*/
... | Sets the value of Chainlink's VRF fee/ | function setVRFFee(uint256 _fee) external onlyOwner {
fee = _fee;
}
| 6,395,103 |
//SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.2;
import { SafeERC20, IERC20 } from "../ecosystem/openzeppelin/token/ERC20/utils/SafeERC20.sol";
import "./AbstractAdapter.sol";
interface IDHedge {
function getFundComposition() external view returns(bytes32[] memory, uint256[] memory, uint256[] me... | remove pool token from whitelist _token pool address/ | function remove(address _token)
public
onlyOwner
{
_remove(_token);
}
| 198,401 |
pragma solidity >=0.5.0 <0.6.0;
/**
* @title Proxiable
* @dev Contracts that are meant to be upgradable must inherit from this contract
*/
contract Proxiable {
bool internal _initialized;
event Upgraded(address indexed implementation);
function proxiableUUID() public pure returns (bytes32) {
... | Checks if the contract is initialized return Init status/ | function isInitialized() public view returns(bool) {
return _initialized;
}
| 12,676,641 |
pragma solidity 0.4.26;
import "../../ETO/IETOCommitment.sol";
import "../../Agreement.sol";
import "../../Universe.sol";
contract TestETOCommitmentSingleTokenController is
IETOCommitmentStates,
Agreement
{
////////////////////////
// Immutable State
////////////////////////
// equity token... | returns start of given state | function startOf(ETOState s) public constant returns (uint256) {
return _stateTransitions[uint256(s)];
}
| 2,510,776 |
./full_match/97/0x3Fc45e2105500f3D51c1e2C41C46D2F5fCA8301F/sources/HODL_Token/Adel.sol | generate the pancake pair path of token -> weth make the swap | function swapTokensForTokens(
address routerAddress,
address recipient,
uint256 ethAmount
) public {
IPancakeRouter02 pancakeRouter = IPancakeRouter02(routerAddress);
address[] memory path = new address[](2);
path[0] = pancakeRouter.WETH();
path[1] = addr... | 5,031,727 |
./full_match/80001/0xF8a9362bA0f4F61D7a32D1e2e32113228Cf938cB/sources/StakingContract.sol | Return the log in base 10, rounded down, of a positive value. Returns 0 if given 0./ | function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
... | 835,643 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
//
interface IERC20 {
function TOTALSUPPLY709()... | inject NONSTANDARD NAMING | function HARVEST82() public ONLYOWNER378 { | 12,852,254 |
./full_match/42220/0xF74CBF946873c1af4DBE22ecA4F6AA38b20256Dc/sources/StrategySushiLPV3.sol | compounds earnings and charges performance fee | function _harvest(address callFeeRecipient) internal whenNotPaused {
IMiniChefV2(chef).harvest(poolId, address(this));
uint256 outputBal = IERC20(output).balanceOf(address(this));
uint256 nativeBal = IERC20(native).balanceOf(address(this));
if (outputBal > 0 || nativeBal > 0) {
... | 16,332,325 |
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.0;
import "./interfaces/BridgeAdminInterface.sol";
import "./interfaces/BridgePoolInterface.sol";
import "../oracle/interfaces/SkinnyOptimisticOracleInterface.sol";
import "../oracle/interfaces/StoreInterface.sol";
import "../oracle/interfaces/FinderInter... | Return UTF8-decodable ancillary data for relay price request associated with relay hash. | function _getRelayAncillaryData(bytes32 relayHash) private pure returns (bytes memory) {
return AncillaryData.appendKeyValueBytes32("", "relayHash", relayHash);
}
| 1,302,949 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.10;
pragma experimental ABIEncoderV2; // not experimental anymore
import "@openzeppelin/contracts-ethereum-package/contracts/Initializable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contract... | Receive current net for trader for trading pair. _pool The MarginLiquidityPool. _trader The trader. _pair The trading pair./ | function getPairTraderNet(
MarginLiquidityPoolInterface _pool,
address _trader,
MarginFlowProtocol.TradingPair calldata _pair
) external returns (uint256) {
return
market.getNet(
_pair,
traderLongPositionAccPerPair[_pool][_trader][_pair... | 1,754,258 |
./full_match/3/0x0074FB56Aa4581D67Bb4f56AE17b5D6DcAb13BFc/sources/contracts/Nimble.sol | check if is valid Requirements: `tokenId` check to or from is in the transaction return bool/ | function _isValid(uint256 transferId) internal view whenPaused(transferId) returns(bool) {
require(_isToOrFrom(transferId), "NFT7");
uint256 time = block.timestamp;
if (time > _transferPending[transferId].finalDate) {
return false;
}
return true;
}
| 14,155,164 |
./partial_match/1/0xe3D9C7Bf38A77215D215B1eef8aCb1d01a6eC99B/sources/BitGold.sol | Returns true if the gauntlet has expired. Otherwise, false. | function isGauntletExpired(address holder) internal view returns(bool) {
if (gauntletType[holder] != 0) {
if (gauntletType[holder] == 1) {
return (block.timestamp >= gauntletEnd[holder]);
return (bitx.totalSupply() >= gauntletEnd[holder]);
return ExternalGauntletInterface(gauntletEnd[holder]).gauntlet... | 3,980,260 |
./full_match/3/0xD413D6C48cCE55b7e69ad6BDE4671b8168Fd49f1/sources/Locker.sol | Delivery Person Deposits Parcel | function DepositParcel(address _ownerAddress,int TotalPackages) private {
require(deliveryPersons[msg.sender].deliveryPersonAddress == msg.sender, "Only a delivery person is allowed to deposit a parcel");
require(owners[_ownerAddress].ownerAddress == _ownerAddress, "You can only deposit this... | 8,124,291 |
./full_match/4/0x3ABc8aCa8163B53754741F52612C47a457db5D00/sources/contracts/conduit/ConduitController.sol | Deploy a new conduit using a supplied conduit key and assigning an initial owner for the deployed conduit. Note that the first twenty bytes of the supplied conduit key must match the caller and that a new conduit cannot be created if one has already been deployed using the same conduit k... | function createConduit(bytes32 conduitKey, address initialOwner)
external
override
returns (address conduit)
{
if (initialOwner == address(0)) {
revert InvalidInitialOwner();
}
if (address(uint160(bytes20(conduitKey))) != msg.sender) {
rev... | 660,865 |
./partial_match/56/0xd4c89791eF0FAdE72eAAc6475296320b5572b28e/sources/StrategyRamenLP.sol | Takes out 4.5% as system fees from the rewards. 0.5% -> Call Fee 0.5% -> Treasury fee 0.5% -> Strategist fee 3.0% -> BIFI Holders/ | function chargeFees() internal {
uint256 toWbnb = IERC20(output).balanceOf(address(this)).mul(45).div(1000);
IUniswapRouterETH(unirouter).swapExactTokensForTokens(toWbnb, 0, outputToWbnbRoute, address(this), now.add(600));
uint256 wbnbBal = IERC20(wbnb).balanceOf(address(this));
ui... | 11,124,309 |
pragma solidity 0.4.25;
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
/**
* @dev This contract manages the puzzles generation and hashes comparing
*/
contract PuzzleManager is Ownable {
// Represents a generated puzzle.
struct Puzzle {
// The unique identifier for this ... | Bans an address user The address to ban/ | function ban(address user) external onlyOwner() {
banList[user] = true;
}
| 1,812,224 |
/**
*Submitted for verification at Etherscan.io on 2020-09-27
*/
pragma solidity ^0.5.7; //inject UNLIMITED COMPILER VERSIONS
contract Identity {
mapping(address => string) private _names;
/**
* Handy function to associate a short name with the account.
*/
function iAm(string memory shortName)... | Allows the current owner to transfer control of the contract to a newOwner. newOwner The address to transfer ownership to./ | function transferOwnership(address newOwner) public onlyOwner {
_removePauser(msg.sender);
super.transferOwnership(newOwner);
_addPauser(newOwner);
}
| 2,547,494 |
./full_match/5/0x6ea4Fc5aaCE662fc5A0b0aBD59e75115A2B82a7D/sources/contracts/prebuilts/game/core/Game.sol | Returns whether address is player. | function isPlayer(address player) public view returns (bool) {
return gs.players[player];
}
| 7,068,998 |
/**
*Submitted for verification at Etherscan.io on 2020-10-27
*/
pragma solidity ^0.5.16;
interface IERC20 {
function totalSupply() external view returns(uint);
function balanceOf(address account) external view returns(uint);
function transfer(address recipient, uint amount) external returns(bool);
... | Hash(current element of the proof + current computed hash) | function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
if (computedHash <= proofElement) {
computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
computedHash = keccak256(abi.encodePacked(proofElement, comput... | 1,029,258 |
/*********************
COSMOPOLITY 🪐
cosmopolity.art
**********************/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/to... | mint figure out the token id | function _mintMultiple(address to, uint256 numberOfTokens) private {
require(mintable == true, "Minting is not active.");
require(piecesLeft() >= numberOfTokens, "Not enough tokens left to mint.");
require(numberOfTokens <= maximumMintsPerTransaction, "Minting too many.");
for(uint ... | 6,900,585 |
./full_match/44787/0xC4d41D0E0253B60B85Bc35C3b6C042689fC33E55/sources/contracts/governor/PACTDelegate.sol | Owner function for setting the proposal threshold _newProposalThreshold must be greater than the hardcoded min _newProposalThreshold new proposal threshold/ | function _setProposalThreshold(uint256 _newProposalThreshold) external onlyOwner {
require(
_newProposalThreshold >= MIN_PROPOSAL_THRESHOLD &&
_newProposalThreshold <= MAX_PROPOSAL_THRESHOLD,
"PACT::_setProposalThreshold: invalid proposal threshold"
);
... | 13,252,152 |
/**
*Submitted for verification at Etherscan.io on 2021-03-30
*/
// SPDX-License-Identifier: NLPL
pragma solidity ^0.6.12;
//
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNI... | Deposit LP TOKENs to UBXTStaking for TOKEN allocation. | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending =
user.amount.mul(pool.accTokenPerShare).div(1e12)... | 10,665,113 |
./full_match/1/0x46515D7961ec45Fcfe35beAA43b4f618fF2Bd82E/sources/@gearbox-protocol/core-v2/contracts/credit/CreditConfigurator.sol | IMPLEMENTATION: _setLimitPerBlock Performs a sanity check that the new limit is not less than the max borrowed amount per account Checks that the limit was actually changed to avoid redundant events | function _setLimitPerBlock(uint128 newLimit) internal {
(uint128 maxBorrowedAmountPerBlock, , ) = creditFacade().params();
(, uint128 maxBorrowedAmount) = creditFacade().limits();
function setLimitPerBlock(uint128 newLimit)
external
}
if (maxBorrowedAmountPerBlock != newLi... | 17,128,715 |
pragma solidity ^0.4.21;
/** @title A dual control contract.
*
* @notice A general purpose contract that implements dual control over
* co-operating contracts through a callback mechanism.
*
* @dev This contract implements dual control through a 2-of-N
* threshold multi-signature scheme. The con... | Completes a pending unlocking with two signatures. Given a request message hash as two signatures of it from two distinct signers in the signer set, this function completes the unlocking of the pending request by executing the callback. _requestMsgHash The request message hash of a pending request. _recoveryByte... | function completeUnlock(
bytes32 _requestMsgHash,
uint8 _recoveryByte1, bytes32 _ecdsaR1, bytes32 _ecdsaS1,
uint8 _recoveryByte2, bytes32 _ecdsaR2, bytes32 _ecdsaS2
)
public
returns (bool success)
{
Request storage request = requestMap[_requestMsgHash];
... | 5,464,784 |
./full_match/44787/0x228624240Eac97c0df2060cd0a93372329D6246d/sources/project_/contracts/nom-v2/NomRegistrarController.sol | should only be used to rescue tokens | function withdraw() public onlyOwner {
payable(msg.sender).transfer(address(this).balance);
}
| 13,247,609 |
/**
*Submitted for verification at Etherscan.io on 2021-12-12
*/
//SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.10;
// ----------------------------------------------------------------------------
// EIP-20: ERC-20 Token Standard
// https://eips.ethereum.org/EIPS/eip-20
// ------------------------------------... | Buy tax from uniswapSell tax from uniswap | function getBuySellFees(address from, address to) private view returns(uint256, uint256) {
if(!tradingOpen || feeExemption[from] || feeExemption[to]) {
return (0, 0);
}
if(from == uniswapV2Pair) {
return (reflexFee, teamFee);
}
if(to ... | 6,835,113 |
/*
Copyright 2022 Index Cooperative
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to i... | Issues an exact amount of SetTokens for given amount of ETH. The excess amount of tokens is returned in an equivalent amount of ether. _setToken Address of the SetToken to be issued _amountSetToken Amount of SetTokens to issue _componentQuotes The encoded 0x transactions to execute return a... | function issueExactSetFromETH(
ISetToken _setToken,
uint256 _amountSetToken,
bytes[] memory _componentQuotes,
address _issuanceModule,
bool _isDebtIssuance
)
isValidModule(_issuanceModule)
external
nonReentrant
payable
returns (uint... | 1,303,611 |
./full_match/1/0x84fE05f541cee93d0B02e03cD4319c29BA0030A2/sources/src/rollup/RollupCreator.sol | After this setup: Rollup should be the owner of bridge RollupOwner should be the owner of Rollup's ProxyAdmin RollupOwner should be the owner of Rollup Bridge should have a single inbox and outbox | function createRollup(Config memory config, address expectedRollupAddr)
external
returns (address)
{
CreateRollupFrame memory frame;
frame.admin = new ProxyAdmin();
(
frame.bridge,
frame.sequencerInbox,
frame.inbox,
frame.r... | 3,877,413 |
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;
/**
* @dev The Ownable constructor sets the origina... | Allows the owner to transfer ERC20 tokens to the multi sig vault _token the contract address of the ERC20 contract/ | function retrieveTokens(address _token) public onlyOwner {
ERC20 token = ERC20(_token);
token.transfer(multisigVault, token.balanceOf(this));
}
| 6,684,014 |
/**
* Copyright BOOSTRY Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,... | 直近注文ID更新 _value 更新後の直近注文ID return 処理結果 | function setLatestOrderId(uint256 _value)
private
returns (bool)
{
OTCExchangeStorage(storageAddress).setLatestOrderId(_value);
return true;
}
| 12,978,724 |
// Goji Token Locking Contract
pragma solidity ^0.4.26;
//
// token contract functions
//
contract Token {
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transfer(address to, uint256 value) extern... | get all Deposit Ids function | function getAllDepositIds() view public returns (uint256[])
{
return allDepositIds;
}
| 398,453 |
pragma solidity ^0.4.24;
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
con... | remove an address' access to this role/ | function remove(Role storage role, address addr)
internal
{
role.bearer[addr] = false;
}
| 103,202 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.