file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/1/0x0c56f29B8D90eea71D57CAdEB3216b4Ef7494abC/sources/contracts/IDelegationRegistryExcerpt.sol | A partial interface taken from the IDelegationRegistry provided under the CC0-1.0 Creative Commons license by delegate.xyz/ | interface IDelegationRegistry {
function checkDelegateForAll(address delegate, address vault)
external
view
returns (bool);
pragma solidity ^0.8.19;
}
| 3,007,797 |
/**
*Submitted for verification at Etherscan.io on 2021-11-15
*/
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma experimental ABIEncoderV2;
abstract contract IDFSRegistry {
function getAddr(bytes32 _id) public view virtual returns (address);
function addNewContract(
bytes32 _i... | @inheritdoc ActionBase | function executeActionDirect(bytes[] memory _callData) public payable override {
Params memory inputData = parseInputs(_callData);
gUniDeposit(inputData);
}
| 1,968,677 |
/**
*Submitted for verification at Etherscan.io on 2020-02-20
*/
pragma solidity ^0.5.2;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error.
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 ... | Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first re... | function approve(address spender, uint256 value) public whenNotPaused returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
| 12,683,021 |
pragma solidity ^0.4.24;
import "./WrapEtheremonInterface.sol";
import "./WrapEtheremonPermissions.sol";
import "./Utils2.sol";
contract WrapEtheremon is WrapEtheremonInterface, WrapEtheremonPermissions, Utils2 {
event SwapTokenChange(uint startTokenBalance, uint change);
event CaughtWithToken(address indexed... | Verifies that monster catching is possible _kyberProxy KyberNetworkProxyInterface address _etheremon EtheremonExternalPayment address _classId Class ID of monster token ERC20 token address tokenQty Amount of tokens required to acquire the monster return monsterInETH Get monster catchable status and price in ETH Ch... | function catchVerify(
KyberNetworkProxyInterface _kyberProxy,
EtheremonExternalPayment _etheremon,
uint32 _classId,
ERC20 token,
uint tokenQty
)
private
view
returns (uint monsterInETH)
{
bool catchable;
uint monsterInTokens;
... | 5,510,887 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// OpenZeppelin contracts
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {ReentrancyGuardUpgradeable} fr... | Update royalty fee manager _royaltyFeeManager new fee manager address/ | function updateRoyaltyFeeManager(address _royaltyFeeManager)
external
onlyOwner
{
require(
_royaltyFeeManager != address(0),
"Owner: Cannot be null address"
);
royaltyFeeManager = IRoyaltyFeeManager(_royaltyFeeManager);
emit NewRoyaltyFeeMa... | 486,638 |
./full_match/8453/0xdf1f518fE77FC0723e5Fa387964522FdC645a11C/sources/contracts/LinearDexPCP.sol | It allows users to deposit LP tokens to pool _amount: the number of LP token used _pid: pool id/ Check if the pool has a limit per user | function depositPool(uint256 _amount, uint8 _pid) external override nonReentrant payable {
require(_pid < POOLS_LIMIT, "Deposit: Invalid pool id");
PoolInfo storage poolInfo = _poolInfo[_pid];
require(
poolInfo.offeringAmount > 0 && poolInfo.raisingAmount > 0,
"Deposi... | 11,558,621 |
./partial_match/1/0xF98bb4943eb8a3eB6234a9f6B1Fa758714381753/sources/src/contracts/IncentivizingLiquidityAMO.sol | Add/Change/Remove Constant Incentivization can be set (e.g. DAO Deal) _poolAddress Address of liquidity pool _hasConstIncent bool _amountPerCycle Amount of constant incentives | function setConstIncent(address _poolAddress, bool _hasConstIncent, uint256 _amountPerCycle) external onlyByOwnerOperator {
if (poolInitialized[_poolAddress]) {
poolHasConstIncent[_poolAddress] = _hasConstIncent;
poolConstIncentAmount[_poolAddress] = _amountPerCycle;
emit... | 4,404,914 |
/*
Copyright 2017-2019 RigoBlock, Rigo Investment Sagl.
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 applicabl... | CONSTANT PUBLIC FUNCTIONS/ Returns whether a wizard can claim reward tokens _thePool Address of the target pool return Bool the wizard can claim | function canWithdraw(address _thePool)
external
view
returns (bool)
{
if (now >= performers[_thePool].endTime) {
return true;
}
}
| 13,010,288 |
./partial_match/1/0x7C923AB2e3680F22811eC696a321b80F37655C0c/sources/ShibariumFrens.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Shibarium Frens", "FRENS") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())... | 4,250,308 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./owner/Operator.sol";
import "./lib/Babylonian.sol";
import "./lib/FixedPoint.sol";
import "./lib/PancakeswapOracleLibrary.sol";
import "... | _pair is CHIP/BNB LP, _pair_1 is CHIP/BUSD LP | function initialize(IPancakePair _pair, IPancakePair _pair_1) external onlyOperator notInitialized {
pair = _pair;
token0 = pair.token0();
token1 = pair.token1();
uint112 reserve0;
uint112 reserve1;
(reserve0, reserve1, blockTimestampLast) = pair.getReserves();
... | 881,745 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.11;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../lib/BlackholePrevention.sol";
import "../interfaces/IStaking.sol";
contract Yield... | checks for requested epoch | function harvest (uint128 epochId) external whenNotPaused returns (uint){
require (_getEpochId() > epochId, "YLD:E-306");
require(epochId <= NR_OF_EPOCHS, "YLD:E-408");
require (lastEpochIdHarvested[msg.sender].add(1) == epochId, "YLD:E-204");
uint userReward = _harvest(epochId);
... | 588,045 |
./full_match/4/0xd500667e9dA2462adE81121810e0f57589b32837/sources/browser/Kudo.sol | Calls topThreeKudoerIndex() function to get the index of the winner contained in the kudoerAddresses array and then returns the address of the winner | function topThreeKudoers()
public
view
returns (address payable firstWinner_, address payable secondWinner_, address payable thirdWinner_)
{
uint8 first;
uint8 second;
uint8 third;
(first, second, third) = topThreeKudoerIndex();
firstWinner_ = addr... | 668,798 |
./partial_match/1/0xAb90b1b7BC11c0636c1D0a7249709B3Ab0F12D7b/sources/DICLUBToken.sol | Function to perform auto-burn Calculate the amount to burn (limited to 100,000 tokens) Check if the maximum lifetime burn limit is reached Burn the tokens | function autoBurn() public onlyOwner {
require(block.timestamp >= _lastAutoBurnTimestamp + _autoBurnInterval, "Auto-burn interval not reached yet");
uint256 currentBalance = balanceOf(_initialSupplyWallet);
require(currentBalance >= 100000 * 10 ** uint256(_decimals), "Not enough balance for ... | 3,727,083 |
/*
.'''''''''''.. ..''''''''''''''''.. ..'''''''''''''''..
.;;;;;;;;;;;'. .';;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;,.
.;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;,.
.;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;;,. .;;;;;;;;;;;;;;;;;;;;,.
';;;;;;;;'. .';;;;;;;;;;;;;;;;;;... | Exit pool only with liquid tokens This function will withdraw TUSD but with a small penalty Uses the sync() modifier to reduce gas costs of using curve amount amount of pool tokens to redeem for underlying tokens/ burn tokens sent | function liquidExit(uint256 amount) external nonReentrant sync {
require(block.number != latestJoinBlock[tx.origin], "TrueFiPool: Cannot join and exit in same block");
require(amount <= balanceOf(msg.sender), "TrueFiPool: Insufficient funds");
uint256 amountToWithdraw = poolValue().mul(amou... | 14,862,100 |
./full_match/1/0xaEFaDE254E92CCC55877022AdD3218217ebb175c/sources/Loodlstaking.sol | owner can change minimum balance requirement/ | function setMinimumBalanceForPayNoder(address _token, uint256 _minimumBalance)
external
onlyOwner()
returns (bool)
{
tokenMinimumBalance[_token] = _minimumBalance;
return true;
}
| 2,982,171 |
// SPDX-License-Identifier: Unlicense
pragma solidity >=0.7.6;
import './HabitatBase.sol';
import './HabitatWallet.sol';
import './HabitatVault.sol';
import './IModule.sol';
/// @notice Voting Functionality.
// Audit-1: ok
contract HabitatVoting is HabitatBase, HabitatWallet, HabitatVault {
event ProposalCreated(ad... | Updates the state of a proposal. Only emits a event if the status changes to CLOSED or PASSED finalize if the new status is CLOSED or PASSED save voting status PASSED verify the internal actions and execute verify external actions and store a permit | function onProcessProposal (
address msgSender,
uint256 nonce,
bytes32 proposalId,
bytes calldata internalActions,
bytes calldata externalActions
) external returns (uint256 votingStatus, uint256 secondsTillClose, uint256 quorumPercent) {
HabitatBase._commonChecks();
HabitatBase._checkUp... | 922,833 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import 'OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/math/SafeMath.sol';
import '../Governable.sol';
import '../../interfaces/IOracle.sol';
import '../../interfaces/IBaseOracle.sol';
import '../../interfaces/IERC20Wrappe... | Unset token factors for the given list of token addresses tokens List of tokens to unset info | function unsetTokenFactors(address[] memory tokens) external onlyGov {
for (uint idx = 0; idx < tokens.length; idx++) {
delete tokenFactors[tokens[idx]];
emit UnsetTokenFactor(tokens[idx]);
}
}
| 5,435,703 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @author: manifold.xyz
import "../../openzeppelin-upgradeable/token/ERC1155/ERC1155Upgradeable.sol";
import "../libraries-solidity/access/AdminControlUpgradeable.sol";
import "./core/ERC1155CreatorCore.sol";
/**
* @dev ERC1155Creator implementation
*/
co... | See {ICreatorCore-setTokenURIExtension}./ | function setTokenURIExtension(uint256 tokenId, string calldata uri_)
external
override
extensionRequired
{
_setTokenURIExtension(tokenId, uri_);
}
| 11,819,353 |
/*
* @source: https://capturetheether.com/challenges/lotteries/guess-the-random-number/
* @author: Steve Marx
* @vulnerable_at_lines: 15
*/
pragma solidity ^0.4.21;
contract GuessTheRandomNumberChallenge {
uint8 answer;
function GuessTheRandomNumberChallenge() public payable {
require(msg.value =... | <yes> <report> BAD_RANDOMNESS | function GuessTheRandomNumberChallenge() public payable {
require(msg.value == 1 ether);
answer = uint8(keccak256(block.blockhash(block.number - 1), now));
}
| 1,070,854 |
pragma solidity ^0.5.0;
import "./interfaces/IComponentsRegistry.sol";
import "../../common/component/interfaces/IComponent.sol";
import "../../request-verification-layer/permission-module/PermissionModuleMetadata.sol";
import "../../request-verification-layer/permission-module/interfaces/IPermissionModule.sol";
impor... | Update existing component oldAddress Component to update newAddress New component address/ | function updateComponent(address oldAddress, address newAddress)
external
verifyPermission(msg.sender, msg.sig)
{
require(oldAddress != newAddress, "Invalid addresses.");
require(componentsIds[oldAddress] != bytes4(0), "Can't update unregistered component");
bytes4 idO... | 6,414,999 |
./partial_match/1/0xBC91d455648C6fA59Dd927E0d6DBC0d90bC318Fd/sources/XCivic.sol | FOR GOERLI uniswapV2Pair = IUniswapV2Factory(0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f).createPair(address(this), 0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6); FOR BSCSCAN uniswapV2Pair = IUniswapV2Factory(0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73).createPair(address(this), 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);... | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
function _afterTokenTransfer(
address from,
address to,
uint256 amount
}
}
pragma solidity ^0.8.0;
constructor() ERC20("X-Civic", "CIVIC") {
_mint(msg.sender, (maxSupply * LIQU... | 4,240,736 |
// File: @openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assum... | Converts exchange token into `consumableAmount` of this consumable/ | function _mintByExchange(address account, uint256 consumableAmount) internal onlyEnabled {
uint256 amountExchangeToken = this.amountExchangeTokenNeeded(consumableAmount);
_exchangeToken.transferFrom(account, address(this), amountExchangeToken);
_mint(account, consumableAmount);
}
| 64,960 |
./full_match/80001/0x355F66dA12aD922a145Ac8431Af67cD79c42B97d/sources/project_/contracts/extensions/round-time/RoundTimeUpgradeable.sol | Round duration value/ Emit if change `_roundTime`/ roundTime Initial round duration value/ | function __RoundTime_init(uint256 roundTime) internal onlyInitializing {
_setRoundTime(roundTime);
}
| 5,636,336 |
./partial_match/56/0xc4fcAA44AA0d5B103D57068f50930828B6a5e124/sources/MasterChef.sol | View function to see pending PLTS on frontend. | function pendingXml(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accXmlPerShare = pool.accXmlPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if... | 11,119,652 |
./partial_match/4/0x6b0787A77c11458EF87Bd733a63BBC11980d285D/sources/OroNetwork.sol | Update loan percentage Only owner/ | function setLoanpercentage(uint256 percentage)
public
onlyOwner
returns (bool)
{
loanPercentage = percentage;
return true;
}
| 8,638,049 |
./partial_match/1/0x14BcEEfb9924f8DD6CF1462a51b4675Ddc2AcB99/sources/TAH.sol | generate the uniswap pair path of token -> weth make the swap | function swapTokensForEth(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHS... | 2,828,580 |
./full_match/100/0x3f7c5935e1ee6D4910A753b2B6229C8e0D53E57b/sources/contracts/utils/LiquidityTree.sol | emulating push changes from last "lazy update" down to leaf node - last node from lazy update start - leaf search start end - leaf search end leaf - last node to update amount - pushed (calced) amount for the node/ if node is leaf, stop | function _getPushView(
uint48 node,
uint48 start,
uint48 end,
uint48 leaf,
uint128 amount
) internal view returns (uint128 withdrawAmount) {
if (node == leaf) {
return amount;
}
uint48 lChild = node * 2;
uint48 rChild = node * ... | 14,285,371 |
pragma solidity ^0.5.16;
/**
* @dev Allow tokens to be transferred to contracts and have the contract trigger logic for how to respond to receiving the tokens within a single transaction.
* https://github.com/ethereum/EIPs/issues/677
*/
interface Callable {
function tokenCallback(address _from, uint256 _tokens, b... | Gets the current fee in BONK. return BONK fee./ | function getBonkFee() public view returns (uint256) {
return bonkFee;
}
| 14,330,597 |
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import { TokenInterface, AccountInterface } from "../../../../common/interfaces.sol";
import { CTokenInterface } from "./interfaces.sol";
import { Helpers } from "./helpers.sol";
import { Events } from "./events.sol";
import { Variables } from "./variables.sol"... | console.log("_transferCtokens", ctokenContracts[i].allowance(userAccount, address(this)), amts[i], ctokenContracts[i].balanceOf(userAccount)); | function _transferCtokens(
address userAccount,
CTokenInterface[] memory ctokenContracts,
uint[] memory amts,
uint _length
) internal {
for (uint i = 0; i < _length; i++) {
if (amts[i] > 0) {
require(ctokenContracts[i].transferFrom(userAccount,... | 14,851,777 |
./partial_match/1/0x490254bF34590e8177De4F73BC9941554DA7e683/sources/contracts/7_BlackDAOTreasury.sol | allow approved address to borrow reserves _amount uint256 _token address/ | function incurDebt(uint256 _amount, address _token) external override {
uint256 value;
if (_token == address(BLKD)) {
require(permissions[STATUS.BLKDDEBTOR][msg.sender], notApproved);
value = _amount;
require(permissions[STATUS.RESERVEDEBTOR][msg.sender], notAppro... | 16,098,612 |
// SPDX-License-Identifier: MIT
/*///////////////////////////////////////////////////////////////////* *////////
/////////////////////////////////////////////////////////////////////, ,////////
///////////////////////////////////////////////////////////////////// .////////
/////////////////////////////////////////////... | show current blockchain time | function showBCtime() public view returns (uint256) {
return block.timestamp;
}
| 14,603,112 |
./full_match/80001/0xF891072cdBb3849Bb9Ff809742B81F5ddcbbCD7C/sources/contracts/GameTokenBurnable.sol | Set a new Ipfs Base URI for the items metadata _ipfsbaseuri token URI in string format/ | function setIpfsBaseURI(string memory _ipfsbaseuri) external onlyOwner {
ipfsBaseURI = _ipfsbaseuri;
}
| 5,681,442 |
// "SPDX-License-Identifier: MIT"
pragma solidity ^0.8.3;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.s... | Allow the owner to withdraw Ether payed into the contract | function withdrawEth(uint256 _amount)
external onlyOwner {
require(_amount <= address(this).balance, "not enough balance");
require(success, "transfer failed");
}
| 193,700 |
./full_match/1/0xDF6e02aa226e69888241e7D8689C1b1FFbA48Ae7/sources/src/module/governance-pool/ModuleConfig.sol | Reverts if the module has an open lock | function _isNotLocked() internal view virtual {
if (Wallet(_cfg.base).hasActiveLock()) {
revert ConfigModuleHasActiveLock();
}
}
| 3,007,642 |
/**
*Submitted for verification at Etherscan.io on 2021-12-14
*/
// Sources flattened with hardhat v2.7.0 https://hardhat.org
// File @openzeppelin/contracts/utils/introspection/[email protected]
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/introspection/IERC165.sol)
pragma solidity ^0.8... | burn token Clear approvals | function _burnToken(uint256 tokenId) private {
address from = ERC721.ownerOf(tokenId);
_approve(address(0), tokenId);
_removeTokenFromOwnerEnumeration(from, tokenId);
_removeTokenFromAllTokensEnumeration(tokenId);
_balances[from] -= 1;
delete _owners[tokenId];
... | 7,963,518 |
pragma solidity ^0.4.23;
contract JYToken {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyBagholders() {
require(myTokens() > 0);
_;
}
// only people with profits
... | Liquifies tokens to ethereum./ setup data russian hackers BTFOfunder bonus burn the sold tokens update dividends tracker dividing by zero is a bad idea update the amount of dividends per token | function sell(uint256 _amountOfTokens)
onlyBagholders()
public
{
address _customerAddress = msg.sender;
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
uint256 _tokens = _amountOfTokens;
uint256 _ethereum = tokensToEthereum_(_tokens);
ui... | 10,218,810 |
pragma solidity ^0.4.23;
// Copyright 2018 OpenST Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applic... | Report an OSTblock. A reported OSTblock can be committed by receiving a majority vote from the validators. The core contract must be approved for the `COST_REPORT_BLOCK`. _blockHash The hash of the header of the block. _height The OSTblock height of the reported block. _gas The amount of gas consumed on the... | function reportBlock (
bytes32 _blockHash,
uint256 _height,
uint256 _gas,
bytes32 _signatureRoot,
bytes32 _stateRoot
)
external
returns (bool success_)
{
require(
height == _height,
"Cannot report a block at a height dif... | 1,007,786 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "./interfaces/IERC1155Ubiquity.sol";
import "./interfaces/IMetaPool.sol";
imp... | set the lp rewards debts so that this bonding share only get lp rewards from this day | function _mint(
address to,
uint256 lpAmount,
uint256 shares,
uint256 endBlock
) internal returns (uint256) {
uint256 _currentShareValue = currentShareValue();
require(
_currentShareValue != 0,
"Bonding: share value should not be null"
... | 980,047 |
pragma solidity =0.6.6;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions... | solium-disable-next-line security/no-block-members | function release(IERC20 _token) public {
require(block.timestamp >= releaseTime);
uint256 amount = _token.balanceOf(address(this));
require(amount > 0);
_token.safeTransfer(beneficiary, amount);
}
| 2,193,848 |
pragma solidity >=0.4.4;
import 'truffle/Assert.sol';
import "../contracts/Token.sol";
import "../contracts/Common.sol";
contract Person {
Token token;
function Person(address _token) {
token = Token(_token);
}
function transfer(address to, uint value) returns (bool) {
return token.tr... | this function initially passed without throwbut actually we want to throw for nowwe don't want people to burn with the current placeholder tokenHolderso, changed the placeholder so it returns false causing throwand changed this test to pass if it throws | function testThrowsBurn() {
address th = address(new TokenHolder());
token.setTokenHolder(th);
uint firstbal = token.balanceOf(address(p1));
uint firstsupply = token.totalSupply();
bool result = p1.burn(3);
Assert.equal(token.balanceOf(address(p1)), firstbal - 3, "bur... | 2,518,978 |
/**
*Submitted for verification at Etherscan.io on 2022-04-21
*/
// SPDX-License-Identifier: MIT
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.1.0/contracts/utils/ReentrancyGuard.sol
pragma solidity ^0.6.0;
/**
* @dev Contract module that helps prevent reentrant calls to a functi... | This method is used to settle a bet that was mined into an uncle block. At this point the player was shown some bet outcome, but the blockhash at placeBet height is different because of Ethereum chain reorg. We supply a full merkle proof of the placeBet transaction receipt to provide untamperable evidence that uncle bl... | function settleBetUncleMerkleProof(uint reveal, uint40 canonicalBlockNumber) external onlyOwner {
uint commit = uint(keccak256(abi.encodePacked(reveal)));
Bet storage bet = bets[commit];
require (block.number <= canonicalBlockNumber + BET_EXPIRATION_BLOCKS, "Blockhash can't be queried by E... | 2,402,616 |
./full_match/11155111/0x5152785582Ca55139B7CB173cCECAB903107b709/sources/contracts/Lottery.sol | This function was called by the contract to distribute the prize to the winners | function execute(uint256[] memory winner) internal {
uint16 tokenId = lotteryNFT.tokenId();
uint256 balance = address(this).balance;
uint256 id = (winner[0] % tokenId) + 1;
address winnerAdd = lotteryNFT.ownerOf(id);
uint256 winnerAmount = (balance * 5902230) / 10000000;
... | 3,797,277 |
pragma solidity ^0.4.22;/*
_ _____ ___ _ _ __
` __ ___ ___ _ _ ,'
`. __ ____ /__ ,'
`. __ __ / ,'
`.__ _ /_,'
`. _ /,'
`./'
,/`.
,'/ __`.
,'_/_ _ _`.
,'__/_ ... | Sell function that takes tokens and converts them into Ether. Also comes with a 10% fee to discouraging dumping, and means that if someone near the top sells, the fee distributed will be significant. x% of the resulting Ether is used to pay remaining holders. | function sell(uint256 amount) internal {
var numEthersBeforeFee = getEtherForTokens(amount);
uint256 fee = 0;
uint256 trickle = 0;
totalBondSupply = add(totalBondSupply, numTokens);
bondHoldings[sender] = add(bondHoldings[sender], numTokens);
in... | 10,885,170 |
./full_match/62320/0x18b6588b8721Da433825Ced0dc6F7580F8FB63F9/sources/lib/mento-core/contracts/Reserve.sol | Check if a collateral asset is added to the reserve. collateralAsset The address of the token being checked. return Returns true if the token was added as a collateral asset./ | function checkIsCollateralAsset(address collateralAsset) public view returns (bool) {
return isCollateralAsset[collateralAsset];
}
| 3,224,847 |
// 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 one... | Begins the liquidated notifier reward update process. _newLiquidatedNotifierReward New liquidated notifier reward | function beginLiquidatedNotifierRewardUpdate(
Storage storage self,
uint256 _newLiquidatedNotifierReward
) internal {
self.newLiquidatedNotifierReward = _newLiquidatedNotifierReward;
self.liquidatedNotifierRewardChangeInitiated = block.timestamp;
| 11,901,985 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
// Important Instructions:
// You can add additional variables or functions wherever required
// You have to keep track of all external users along with their role like student, mess_manager, mess_representative, faculty, warden To achieve this you m... | Anyone within the organization can add comment | function add_comment(uint complaint_id, string memory comment_str) public {
}
| 12,638,208 |
pragma solidity ^0.5.0;
import "../interfaces/IPMETokenRolesStorage.sol";
import "../interfaces/IPMRolesManagerStorage.sol";
import "../../../common/libraries/SafeMath8.sol";
import "../../../registry-layer/components-registry/getters/PermissionModuleAddress.sol";
/**
* @title Permission module extended token roles s... | Delete index of the token dependent role wallet Wallet address token Address of the token role Role name subId Additional role identifier/ | function delTokenDependentRoleIndexWithSubId(
address wallet,
address token,
bytes32 role,
bytes32 subId
)
public
onlyPermissionModule(msg.sender)
{
delete indexesOfTheTokenDependentRoles[wallet][token][subId][role];
}
| 12,669,926 |
pragma solidity 0.6.6;
import "@pancakeswap-libs/pancake-swap-core/contracts/interfaces/IPancakePair.sol";
import "../apis/pancake/IPancakeRouter02.sol";
import "../interfaces/IStrategy.sol";
import "../interfaces/IWorker.sol";
import "../interfaces/IPancakeMasterChef.sol";
import "../utils/HuskyMath.sol";
import "../... | Return the amount of wei to get back if we are to liquidate the position. | function health(uint256 /*id*/) external override view returns (uint256) { return 0; }
| 6,367,611 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
// import "@openzeppelin/contracts/access/AccessControl.sol";
contract Soundly {
event ArtistAdded(address artist, string artistName, uint8 verified);
event MusicAdded(bytes32 id, address artist, uint category);
mapping(bytes32 => address) artistMus... | add an artist to the contract | function addArtist(address _artist, string memory _name, uint8 _verified)
external
artistExist(_artist)
returns (bool success)
{
Artist storage artist = artists[_artist];
artist.name = _name;
artist.verified = _verified;
artist.isArtist = 1;
allArt... | 5,523,501 |
./partial_match/3/0xf03518534Ec76AEb697C99cFE0CDA08077091c7B/sources/Heroes.sol | internal function to call from the main contract/ | function incrementtokenID() internal {
_incrementtokenID();
}
| 5,226,242 |
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/helpers/PointerLibraries.sol | Reads the uint136 at `cdPtr` in calldata. | function readUint136(
CalldataPointer cdPtr
) internal pure returns (uint136 value) {
assembly {
value := calldataload(cdPtr)
}
}
| 4,300,244 |
./full_match/9001/0xdE9A07E5F1eaF3236e84724e0a221Ce44D7b2657/sources/contracts/N2MTokenCommon.sol | Only owner can call this function. Free of charge. Mints sizeof(`to`) to `to` addresses with random tokenIds. Requires `minting type` to be `random`. to The addresses of the NFTs receivers soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred. | function airdropRandom(address[] memory to, bool soulbound)
external
payable
override
onlyOwner
{
uint256 toLength = to.length;
if (_mintingType != MintingType.RANDOM) revert InvalidMintingType();
if ((_soldTokens + toLength) > _collectionSize) revert Col... | 11,532,166 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "../access/Roles.sol";
/**
* @title FriendlyCrowdsale
* @author Vittorio Minacor... | return the per mille rate fee./ | function feePerMille() external view returns (uint256) {
return _feePerMille;
}
| 5,473,431 |
/**
* Copyright 2017-2020, bZeroX, LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
import "../core/State.sol";
import "../mixins/VaultController.sol";
import "../swaps/SwapsUser.sol";
import "../swaps/ISwapsImpl.sol";
import "... | Get the swap expected return value. External wrapper that calls SwapsUser::_swapsExpectedReturn sourceToken The address of the source token instance. destToken The address of the destiny token instance. sourceTokenAmount The amount of source tokens. return The expected return value. / | function getSwapExpectedReturn(
address sourceToken,
address destToken,
uint256 sourceTokenAmount
) external view returns (uint256) {
return _swapsExpectedReturn(sourceToken, destToken, sourceTokenAmount);
}
| 1,045,127 |
pragma solidity =0.4.25;
contract SafeMath {
function safeMul(uint a, uint b) pure internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeSub(uint a, uint b)pure internal returns (uint) {
assert(b <= a);
return ... | Default fallback function | function()public payable
{
buyTokens();
}
| 177,000 |
pragma solidity >=0.4.24;
import "./Ownable.sol";
/**
* @title blacklist
* @dev Base contract which allows children to implement an emergency blacklist mechanism. Identical to OpenZeppelin version
* except that it uses local Ownable contract
*/
contract Blacklist is Ownable {
event AddToBlacklist(address in... | called by the owner to enable some address for blacklist/ | function addToBlacklist(address _address) public onlyOwner {
blacklist[_address] = true;
emit AddToBlacklist(_address);
}
| 6,347,682 |
//SPDX-License-Identifier: Unlicense
pragma solidity >=0.7.0 <0.9.0;
library SharedStructs {
// struct date{
// int day;
// int month;
// int year;
// }
struct prescriptionPage{
string licId;
string reciever;
string docName;
string date;
... | Called during chemist sign up | function addChemistLic(string memory chemAddr,string memory LicId) public{
chemistlicenseList[chemAddr] = LicId;
}
| 7,320,095 |
// SPDX-License-Identifier: Unlicense
pragma solidity >=0.6.2;
import './Utilities.sol';
/// @notice This contract looks to be useful for bootstrapping/funding purposes.
contract TokenTurner is Utilities {
/// @dev How many epochs the funding event is open.
uint256 constant FUNDING_EPOCHS = 12;
/// @dev The dec... | How many epochs the funding event is open. The decay rate per funding epoch. Maximum decay rate. Price of 1 `OUTPUT_TOKEN` for 1 `INPUT_TOKEN`. The maximum epoch that needs to be reached so that the last possible funding epoch has a decay of 100%. The ERC-20 token this contract wants in exchange of `OUTPUT_TOKEN`.... | function INPUT_TOKEN () internal view virtual returns (address) {
}
| 6,441,125 |
./partial_match/4/0x1e03508d3127637a47C5c9CC1F4831d304f6dAD1/sources/JuiceswapRoll.sol | performs chained getAmountOut calculations on any number of pairs | function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) {
require(path.length >= 2, 'JuiceswapLibrary: INVALID_PATH');
amounts = new uint[](path.length);
amounts[0] = amountIn;
for (uint i; i < path.length - 1; i++) ... | 8,535,642 |
pragma solidity ^0.8.4;
// SPDX-License-Identifier: UNLICENSED
interface IBEP20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
function name() external view returns (string memory);
functio... | applies taxes, checks for limits, locks generates autoLP and stakingETH, and autostakesSells can't exceed the sell limit(21,000 Tokens at start, can be updated to circulating supply)If buyer bought less than buyLockTime(2h 50m) ago, buy is declined, can be disabled by TeamSets the time buyers get locked(2 hours 50 mins... | function _taxedTransfer(address sender, address recipient, uint256 amount,bool isBuy,bool isSell) private{
uint256 recipientBalance = _balances[recipient];
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "Transfer exceeds balance");
uint8 tax;
if(... | 965,406 |
pragma solidity ^0.4.21;
/**
* Math operations with safety checks
*/
library SafeMath
{
function mul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal returns (uint) {
// assert(b > 0); // Solidity automat... | Aprove the passed address to spend the specified amount of tokens on beahlf of msg.sender. _spender The address which will spend the funds. _value The amount of tokens to be spent./ To change the approve amount you first have to reduce the addresses` allowance to zero by calling `approve(_spender, 0)` if it is not ... | function approve(address _spender, uint _value) {
if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) throw;
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
}
| 6,892,342 |
./partial_match/56/0x3b4f1dFCE62B786EC9aADe778E21a5824FA7B2d5/sources/MasterChef.sol | Safe abz transfer function, just in case if rounding error causes pool to not have enough PLTs. | function safeAbzTransfer(address _to, uint256 _amount) internal {
uint256 abzBal = abz.balanceOf(address(this));
if (_amount > abzBal) {
abz.transfer(_to, abzBal);
abz.transfer(_to, _amount);
}
}
| 11,284,319 |
./full_match/1/0x5E0af2ded0FD10b0990C0B57AF0D7F2Af877285B/sources/contracts/RabbitHoleReceipt.sol | mint a receipt to_ the address to mint to questId_ the quest id | function mint(address to_, string memory questId_) external onlyMinter {
_tokenIds.increment();
uint newTokenID = _tokenIds.current();
questIdForTokenId[newTokenID] = questId_;
timestampForTokenId[newTokenID] = block.timestamp;
_safeMint(to_, newTokenID);
}
| 3,862,598 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
contract brDFI is ERC20Upgradeable {
address private _minter;
function initialize_coin(address minter_gateway) public initializer {
__ERC20_init("bridged DFI (DefiCh... | Only minters can upgrade | function change_minter(address minter_gateway) public initializer {
require(_minter == msg.sender, "DOES_NOT_HAVE_MINTER_ROLE");
_minter = minter_gateway;
}
| 578,447 |
./full_match/1/0x67C9dACB50fAcB2853B26931b67C266d7BB022dA/sources/src/PillFactory.sol | implicitly returning: | function mintPill(uint appID, address who)
public
payable
returns (address pillSetContract, uint pillID)
{
PillSet pillSet = _getPillSetIfValid(appID);
require(msg.value >= pillSet.appPrice(), "Not enough ETH included to pay for the pill.");
pillSetContract = ad... | 3,198,177 |
pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @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 owne... | Mint `_amount` of reputation that are assigned to `_to` . _amount amount of reputation to mint _to beneficiary address return bool which represents a success/ | function mintReputation(uint256 _amount, address _to,address _avatar)
external
onlyRegisteredScheme
onlySubjectToConstraint("mintReputation")
isAvatarValid(_avatar)
returns(bool)
{
emit MintReputation(msg.sender, _to, _amount);
return nativeReputation.mint(_to, _amount);
... | 1,299,077 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is... | return The Address of the implementation./ Delegates execution to an implementation contract. This is a low level function that doesn't return to its internal call site. It will return to the external caller whatever the implementation returns. implementation Address to delegate./ Copy msg.data. We take full control ... | function _implementation() internal virtual view returns (address);
function _delegate(address implementation) internal {
assembly {
calldatacopy(0, 0, calldatasize())
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
sw... | 131,462 |
// File: contracts/interfaces/ISaffronBase.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.1;
interface ISaffronBase {
enum Tranche {S, AA, A}
enum LPTokenType {dsec, principal}
// Store values (balances, dsec, vdsec) with TrancheUint256
struct TrancheUint256 {
uint256 S;
uint256 AA;
ui... | TIME UTILITY FUNCTIONS / | function get_epoch_end(uint256 epoch) public view returns (uint256) {
return epoch_cycle.start_date.add(epoch.add(1).mul(epoch_cycle.duration));
}
| 39,636 |
/**
*Submitted for verification at Etherscan.io on 2020-07-09
*/
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.6.2 <0.7.0;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error.
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on... | Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first re... | function approve(address spender, uint256 value) public whenNotPaused override returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
| 1,964,663 |
./full_match/5/0x53f6D3A44b503fA514d1ababA0fC5DBcf4d6272d/sources/contracts/mintable-token-owner.sol | mints tokens to the recipient, to be called from owner _recipient address to mint _amount amount to be minted | function mint(address _recipient, uint256 _amount) public {
require(minters[msg.sender], "MintableTokenOwner:mint: the sender must be in the minters list");
token.mint(_recipient, _amount);
}
| 1,959,499 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/Ownable.... | Minting function for standard Lobby3 token. to Address to mint token to./ | function mintStandardETHBackup(address to, uint256 numTokens) external onlyOwner{
require(uint64(block.timestamp) < _saleEnd, "Sale period has not started or is over");
require(numTokens > 0, "Must mint at least 1 token");
for (uint256 i=0; i < numTokens; i++) {
uint256 tokenId = _tokenIdCounter.cu... | 14,825,360 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
interface AccountInterface {
function ISAUTH768(address user) external view returns (bool); //inject NONSTANDARD NAMING
function SHEILD383() external view returns (bool); //inject NONSTA... | inject NONSTANDARD NAMING | function ACCOUNTS436() external view returns (uint); | 1,789,214 |
./full_match/137/0xf6fe664d0D61297fBfBb829A1FF77286b887a9Fd/sources/project:/contracts/TxocoCalPadri.sol | Get the winning option for a proposal. _proposalId The ID of the proposal. return winningOption The index of the winning option. return optionName The name of the winning option. return voteCount The vote count of the winning option./ | function getWinningOption(uint256 _proposalId) external view returns (uint256 winningOption, string memory optionName, uint256 voteCount) {
uint256[] memory counts = proposals[_proposalId].optionVoteCounts;
uint256 maxVotes = 0;
for (uint256 i = 0; i < counts.length; i++) {
if (... | 3,738,022 |
./full_match/1/0x14f23fef645586d59bAC7D843795162343d47487/sources/contracts/exchange/core/ExchangeCore.sol | Split and Send ETH or FAIL. ETH amount will be split to: - 1 Service fees, Will be sent to {protocolFeesRecipient}. - 2 Royalty fees, Will be sent to royalty recipient. - 3 Remaining funds (total - 1 - 2), Will be sent to {to}. If any of the above failed to send ETH, transaction will revert./ | function _executeETHPayment(
address collection,
uint256 tokenId,
address to,
uint256 amount
) internal {
(address royaltyFeesRecipient, uint256 royaltyCut) = royaltyManager
.calculateRoyaltyFeeAndGetRecipient(collection, tokenId, amount);
uint256 ser... | 16,534,392 |
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) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than a... | Force a withdrawal by proving that the player has committed to sending 'amount' of their balance associated with 'nonce' to the owner. This would be done during the lockup period in case of fraud or just because the player spent their whole balance and has no incentive to withdraw the 0 balance on their own. player: th... | function forceWithdrawal(
address player,
uint nonce,
uint amount,
Button move,
bytes32 r,
bytes32 s,
uint8 v
) public onlyOwner {
require(accounts[player].nonce == nonce);
require(checkSignature(player, nonce, amount, move, r, s, v));
... | 2,522,576 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/math/Math.sol";
import "./libraries/boringcrypto/libraries/BoringMath.sol";
import "./libraries/boringcrypto/BoringBatchable.sol";
import "./libraries/boringcrypto/BoringOwnable.sol";
import "./l... | Set the grace per second to be distributed. Can only be called by the owner. _gracePerSecond The amount of Grace to be distributed per second. | function setGracePerSecond(uint256 _gracePerSecond, uint256 _endTime)
external
onlyOwner
ownerMassUpdate
{
_requireMsg(
_gracePerSecond <= type(uint128).max,
"setGracePerSecond",
"new grace per second exceeds uint128"
);
_requir... | 12,866,029 |
// SPDX-License-Identifier: CONSTANTLY WANTS TO MAKE THE WORLD BEAUTIFUL
// ///..//*..//..//,..////////#,,,,,,,,,,,,,,,,,&&&&&,**(*./,///*%(.%,,%*,#%/%#(///
// *#%%%%%%%%%%/%/////*&@@(*#(#,,,,,,,,,,,,,,,,,@@@@@/***,./,///%./%#(%.#%/.(.*////
// *******%%%%(/(/(/(/******#(#,,,,,,,,,,,,,,,,,********((#((@%%.........%@@@@... | @inheritdoc IERC2981Royalties | function royaltyInfo(uint256, uint256 value)
external
view
override
returns (address receiver, uint256 royaltyAmount)
{
receiver = projectInfo.royaltyReceiver;
royaltyAmount = (value * projectInfo.royaltyAmount) / 10000;
}
| 953,208 |
pragma solidity 0.4.25;
contract Ownable {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor () public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}... | ------------------------------------------------------------------------ Transfer `tokens` from the `from` account to the `to` account The calling account must already have sufficient tokens approve(...)-d for spending from the `from` account and - From account must have sufficient balance to transfer - Spender must ha... | function transferFrom(address from, address to, uint tokens) public whenNotPaused returns (bool) {
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[from] = balances[from].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Tra... | 1,676,614 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/introspection/IERC165.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/con... | Method for listing NFT _nftAddress Address of NFT contract _tokenId Token ID of NFT _quantity token amount to list (needed for ERC-1155 NFTs, set as 1 for ERC-721) _payToken Paying token _pricePerItem sale price for each iteam _startingTime scheduling for a future sale | function listItem(
address _nftAddress,
uint256 _tokenId,
uint256 _quantity,
address _payToken,
uint256 _pricePerItem,
uint256 _startingTime
) external notListed(_nftAddress, _tokenId, _msgSender()) {
_listItem(_nftAddress, _tokenId, _quantity, _payToken, ... | 14,679,194 |
/**
*Submitted for verification at Etherscan.io on 2022-02-10
*/
/*
* Generated by @Thrasher66099
* Email [email protected] for your NFT launch needs
*/
pragma solidity ^0.8.0;
interface IByteContract {
function burn(address _from, uint256 _amount) external;
}
/**
* @dev Interface of the ERC165 standard, as d... | Set the identityMinters value to tokenId for this address so the identity cannot mint againSet the s2 identity that minted this token for reverse lookup | function identityClaim(uint256 identityTokenId, uint256 spotOnLeaderboard, uint256 spotInWhitelist, bytes32[] memory proof) public nonReentrant {
require(itemMintActive, "Minting is not currently active");
require(identityTokenId > 0 && identityTokenId < 4501, "That is not a claimable item");
... | 6,716,071 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
// Libraries
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "../../util/ECDSALib.sol";
// Interfaces
import "../../interfaces/loans/ILoanData.sol";
import "../../interfaces/loans/ILoanTermsConsensus.sol";
import "../../in... | / In case it is the first time that borrower requests loan terms, we don't validate the rate limit. | function _validateLoanRequest(address borrower, uint256 nonce)
internal
view
{
uint256[] storage _borrowerLoans = borrowerLoans[borrower];
uint256 numberOfLoans = _borrowerLoans.length;
require(nonce == numberOfLoans, "BAD_NONCE");
if (numberOfLoans == 0) {
... | 5,398,151 |
./partial_match/1/0x203F41489033f85F646Da53765E9920205915389/sources/contracts/CheersUpBadge.sol | for the purpose of protecting user assets, under extreme conditions, the circulation of all tokens in the contract needs to be frozen. This process is under the supervision of the community./ | function emergencyPause() external onlyOwner {
_pause();
}
| 3,888,436 |
./full_match/1/0x07B0226465A50300F91c8A7930f90aEcae3D6Ed4/sources/contracts/staking/Series.sol | Unstake previously staked OGN. This will unstake their full OGN stake amount and pay out any rewards (if within a claim period) return amount of OGN unstaked/ Make sure to unstake from staking season as well to zero-out user Ignored return val because there can't be multiple seasons in claim period at one time. T... | function unstake() external override requireActiveSeason returns (uint256) {
address userAddress = msg.sender;
uint256 amount = stakedOGN[userAddress];
ISeason claimSeason = _acquireClaimingSeason();
(uint256 rewardETH, uint256 rewardOGN) = claimSeason.unstake(
userAddre... | 16,523,424 |
./full_match/1/0x7DF18E4eFD6e6f73cfb462937dAC40FE42533016/sources/contracts/ZkittyToken.sol | 5% fee for buy/sell exclude from paying fees or having max transaction amount | ) ERC20(name, symbol) {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTrading(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswap... | 4,888,115 |
./full_match/1/0xbDb2cEdD3928B4523F3347a1e94c24897E81730d/sources/Zpunks4.sol | Reserve some for marketing purpose | function reserveSome(address _to, uint256 _reserveAmount) public onlyOwner {
uint supply = totalSupply();
require(_reserveAmount > 0 && _reserveAmount <= ZpunkReserve, "Not enough reserve left for team");
for (uint i = 0; i < _reserveAmount; i++) {
_safeMint(_to, supply + i);... | 9,810,759 |
./full_match/1/0xF5abAdec1bcb7d79D0E972981F13D731D5d06aA8/sources/contracts/loyalty/GenArtLoyalty.sol | Set the {GenArtLoyaltyVault} contract address/ | function setGenartVault(address genartVault_) external onlyAdmin {
genartVault = GenArtLoyaltyVault(payable(genartVault_));
}
| 4,883,576 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
contract TellorPlayground {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
event TipAdded(address indexed _sender, bytes32 indexed _requestId, ui... | Internal function to perform token transfer/ | function _transfer(address _sender, address _recipient, uint256 _amount) internal virtual {
require(_sender != address(0), "ERC20: transfer from the zero address");
require(_recipient != address(0), "ERC20: transfer to the zero address");
_balances[_sender] -= _amount;
_balances[_re... | 5,522,177 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "./IAaveInterfaces.sol";
import "./ImmutableOwnable.sol";
/**
* Single asset lev... | iterations - MAX loop count return Withdrawn amount of ASSET to OWNER/ | function exitPosition(uint256 iterations) external onlyOwner returns (uint256) {
for (uint256 i = 0; i < iterations && getBorrowBalance() > 0; i++) {
_redeemSupply((getLiquidity() * 1e4) / ltv);
_repayBorrow(getAssetBalance());
}
if (getBorrowBalance() == 0) {
... | 1,013,541 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
// use single pragma version for security
import "../node_modules/@openzeppelin/contracts/access/Ownable.sol";
contract raffleLottery is Ownable {
// Owner address of the lottery contract through OpenZepplin
// name of the lottery
string public lott... | Mark the lottery inactive so no more entries For final front end lottery variable display updates for personal testing see if any discrepency uint discrepency = jackpotTotal - address(this).balance; emit discrepencyTest(discrepency); between 1 and entryCount winner declartion for updating front end with winner details.... | function declareWinner(uint randNonce) public onlyOwner {
isLotteryLive = false;
hasLotteryEnded = true;
emit runningEntryCount(entryCount);
emit runningJackpotTotal(jackpotTotal);
uint randomEntryNumber = generateRandomNumber(randNonce);
winnerAddres... | 5,415,208 |
pragma solidity ^0.4.18;
contract DSSafeAddSub {
function safeToAdd(uint a, uint b) internal returns (bool) {
return (a + b >= a);
}
function safeAdd(uint a, uint b) internal returns (uint) {
if (!safeToAdd(a, b)) throw;
return a + b;
}
function safeToSubtract(uint a, uint... | only owner address can set casino address / | function ownerSetCasino(address newCasino) public
onlyOwner
{
casino = newCasino;
}
| 6,999,939 |
./partial_match/3/0x65B29b471f69400244Ffee30914745c88883810d/sources/option.sol | add premium fee in USDT/ | function totalPremiums() public view returns (uint) {
return rounds[round].totalPremiums;
}
| 5,236,929 |
./full_match/80001/0x889268608CBB6B70a0E8f0AdAaB40a85e0D2E5e2/sources/Users/famousbirthdays/Sites/mb-contracts/contracts/VaultMiner.sol | Release Liquidity Tokens once unlock time is overOnly callable if liquidity Unlock time is over uint256 amount = liquidityToken.balanceOf(address(this)); only allow 20% amount=amount2/10; | function releaseLiquidity() public onlyOwner {
require(block.timestamp >= liquidityUnlockTime, "Locked");
liquidityUnlockTime=block.timestamp+DefaultLiquidityLockTime;
IERC20Uniswap liquidityToken = IERC20Uniswap(swapPair);
liquidityToken.transfer(treasuryWallet, (liquidityTo... | 5,650,400 |
/*
____ __ __ __ _
/ __/__ __ ___ / /_ / / ___ / /_ (_)__ __
_\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ /
/___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\
/___/
* Synthetix: GAMERRewards.sol
*
* Docs: https://docs.synthetix.io/
*
*
* MIT License
* ===========
*
* Copyright (c) 2020 Sy... | This function allows governance to take unsupported tokens out of the contract, since this one exists longer than the other pools. This is in an effort to make someone whole, should they seriously mess up. There is no guarantee governance will vote to return these. It also allows for removal of airdropped tokens. only ... | function governanceRecoverUnsupported(IERC20 _token, uint256 amount, address to)
external
{
require(msg.sender == owner(), "!governance");
require(_token != yfi, "yfi");
require(_token != gamer, "gamer");
_token.safeTransfer(to, amount);
}
| 11,657,413 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import { AddressAliasHelper } from "@eth-optimism/contracts/standards/AddressAliasHelper.sol";
import { CommonTest } from "./CommonTest.t.sol";
import { L2OutputOracle } from "../L1/L2OutputOracle.sol";
import { OptimismPortal } from "../L1/OptimismPortal.sol";
... | Test: depositTransaction should emit the correct log when a contract deposits a contract creation with 0 value | function test_depositTransaction_createWithZeroValueForContract() external {
vm.expectEmit(true, true, false, true);
emit TransactionDeposited(
AddressAliasHelper.applyL1ToL2Alias(address(this)),
ZERO_ADDRESS,
ZERO_VALUE,
ZERO_VALUE,
NON_ZE... | 7,224,534 |
./full_match/5/0x374FD7Cc87cC9bb384456C82A59d36C6957b486c/sources/contracts/NFTstaking.sol | Retrieve the staked amount and staking time of the account | function calculateNFTReward(address account) public view returns (uint256) {
uint256 accountStake = stakes[account];
uint256 stakingTime = block.timestamp;
if (lastStakeTimestamp[account] < origintime) {
stakingTime -= origintime;
stakingTime -= lastStakeTimestamp[acc... | 1,913,011 |
// Implementation of the U42 Token Specification -- see "U42 Token Specification.md"
//
// Standard ERC-20 methods and the SafeMath library are adapated from OpenZeppelin's standard contract types
// as at https://github.com/OpenZeppelin/openzeppelin-solidity/commit/5daaf60d11ee2075260d0f3adfb22b1c536db983
// note ... | check that service existsupdate must be by the application address or, if specified, update addresscheck that service is not already removedadd to removed arraychange value of isRemoved to true | function removeService (
address _targetApplicationAddress,
uint32 _serviceId )
public returns (
bool success ) {
require(services[_targetApplicationAddress][_serviceId].applicationAddress != 0);
require(msg.sender == _targetApplicationAddress ||
( services[_targetApplicationAddress][_serviceId]... | 12,876,136 |
./partial_match/1/0x702ecF93156962e9ffE53FeaD114Dbd54209B796/sources/ERC1155LazyPayableClaim.sol | See {IERC1155LazyClaim-updateClaim}./ Overwrite the existing claim | function updateClaim(
address creatorContractAddress,
uint256 claimIndex,
ClaimParameters memory claimParameters
) external override creatorAdminRequired(creatorContractAddress) {
Claim memory claim = _claims[creatorContractAddress][claimIndex];
require(claim.storageProto... | 3,681,676 |
// contracts/CryptoshackStaking.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
interface ICryptoshackContract {
function balanceOf(address owner) external view returns (uint256);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function transfer... | stake tokens increase staked tokens of a type amount set claimed level to the current reward set staker set idex of token in staker's wallet push the token to staker's wallet move the CS token to the contract | function stake(uint[] calldata tokenIds) external onlyStakingAllowed noContracts {
uint tokenId;
uint tokenType;
for (uint i;i<tokenIds.length;i++) {
tokenId=tokenIds[i];
tokenType=tokenId/10000;
typeToNumbers[tokenType][0]++;
tokenToClaimed[t... | 15,134,781 |
/*
Copyright 2018 Set Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... | Return current protocol fee in basis points return uint256 Protocol fee in basis points of the manager's rebalancing fees/ | function protocolFee()
public
view
returns(uint256)
{
return state.protocolFee;
}
| 12,829,958 |
./partial_match/42/0xd3cc0f4B5247b4635ca35572dBDD17E1AFa713A9/sources/BScore.sol | NOTICE: borrowIndex is already normalized to underlying token quantity | function _getDeltaBorrowIndex(address cToken) internal view returns (uint224 deltaBorrowIndex) {
uint224 currBorrowIndex = snapshot[cToken].borrowIndex;
deltaBorrowIndex = safe224(
sub_(uint(currBorrowIndex), uint(initialSnapshot[cToken].borrowIndex)),
"unable-to-cast-to-uint... | 3,409,540 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.