file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
/**
*Submitted for verification at Etherscan.io on 2021-07-16
*/
/**
......''''......
.',:cldxxkOOO0kddk0OOOkxxdlc:;'.
.,:lxkO00000000000k, .;k00000000000Okxl:,.
... | full priceinfo object of a given historical time/ | function historicalPriceInfo(uint256 timeStamp) public view returns (PriceInfo memory) {
return _computePriceInfo(timeStamp);
}
| 8,009,740 |
./full_match/1/0xc2731fb2823af3Efc2694c9bC86F444d5c5bb4Dc/sources/@keep-network/sortition-pools/contracts/SortitionTree.sol | Inserts an operator into the sortition pool operator the address of an operator to insert weight how much weight that operator has in the pool Fetch the operator's ID, and if they don't have one, allocate them one. | function _insertOperator(address operator, uint256 weight) internal {
require(
!isOperatorRegistered(operator),
"Operator is already registered in the pool"
);
uint256 id = getOperatorID(operator);
if (id == 0) {
id = allocateOperatorID(operator);
}
}
| 2,973,640 |
// SPDX-License-Identifier: MIT
// Reference: https://github.com/repuswap
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeCast.sol";
import "./REPU.sol";
interface IRewarder ... | Calculates and returns the `amount` of REPU over the given _from to _to block. TODO: Distribution max cap if (_to <= bonusEndBlock) { return _to.sub(_from).mul(BONUS_MULTIPLIER); } else if (_from >= bonusEndBlock) { return _to.sub(_from); } else { return bonusEndBlock.sub(_from).mul(BONUS_MULTIPLIER).add( ... | function calRepuAmount(uint256 _from, uint256 _to) public view returns (uint256 amount) {
return _to - _from;
}
| 7,228,014 |
/**
*Submitted for verification at Etherscan.io on 2022-03-23
*/
/**
https://t.me/DecypherInu
*/
pragma solidity 0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes c... | exclude from paying fees or having max transaction amount | constructor() ERC20("Decypher", "DECYPHER") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(... | 6,570,122 |
./full_match/8217/0xe41066e28Ff95244741262Bd877015Edf3f8a9a0/sources/contracts/StKlay.sol | Transfers shares from one address to another from address to transfer from to address to transfer to amount amount to transfer Emits a `SharesChanged` event/ | function _transferShares(
address from,
address to,
uint256 amount
) private validAddress(from) validAddress(to) {
uint256 fromShares = sharesOf(from);
require(fromShares >= amount, "StKlay:: insufficient shares");
shares[from] = fromShares - amount;
uint... | 13,229,582 |
./full_match/137/0x08d78ADcbc9EC5E537Dd7a45A737669e28BcF223/sources/browser/pepemonone.sol | Get the amount of LP tokens the address deposited | function getLPBalance(address addr) public view returns(uint){
return LPBalance[addr];
}
| 4,705,805 |
pragma solidity ^0.6.12;
// ----------------------------------------------------------------------------
// DreamFrameDividendToken Contract
//
// Deployed to : {TBA}
//
// Enjoy.
//
// (c) BokkyPooBah / Bok Consulting Pty Ltd 2018. The MIT Licence.
// (c) Adrian Guerrera / Deepyr Pty Ltd for Dreamframes 2019. The MI... | ------------------------------------------------------------------------ Minting and management ------------------------------------------------------------------------ | function setMinter(Data storage self, address minter) public {
require(msg.sender == self.owner);
require(self.mintable);
emit MinterUpdated(self.minter, minter);
self.minter = minter;
}
| 1,777,466 |
// 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
);
}
// Fi... | Interface of the price oracle./ | interface PriceOracleInterface is LatestPriceOracleInterface {
function latestId() external returns (uint256);
function getPrice(uint256 id) external returns (uint256);
function getTimestamp(uint256 id) external returns (uint256);
}
}
| 70,391 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableS... | Get User Slots/ | function getUserSlots(address user) public view returns (uint256) {
return 2 + userSlots[user];
}
| 5,527,768 |
pragma solidity 0.5.2;
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol";
import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol";
import "../marketprotocol/MarketCol... | Set oracle address can only be called by owner _honeyLemonOracleAddress oracle address/ | function setOracleAddress(address _honeyLemonOracleAddress) external onlyOwner {
require(
_honeyLemonOracleAddress != address(0),
"invalid HoneyLemonOracle address"
);
HONEY_LEMON_ORACLE_ADDRESS = _honeyLemonOracleAddress;
}
| 12,752,059 |
./full_match/1/0x0F07685A92c9B5c63a9e9Af205948BECeb8eb5f6/sources/contracts/priceProviders/balancerV2/BalancerV2PriceProvider.sol | Change number of seconds in the past when calculations start for average price _ago new seconds ago value in seconds, ie. 1800 means 30 min | function changeSecondsAgo(uint32 _ago) external onlyManager {
_setSecondsAgo(_ago);
}
| 2,931,397 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.17;
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(addr... | Controller only function for creating additional rewards from dust | function withdraw(IERC20 _asset) external returns (uint balance) {
require(msg.sender == controller, "!controller");
require(want != address(_asset), "want");
require(y != address(_asset), "y");
require(ycrv != address(_asset), "ycrv");
require(yycrv != address(_asset), "yycr... | 58,006 |
// SPDX-License-Identifier: Apache-2.0
/*
* Copyright 2020, Offchain 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
*
*... | L1 gateway must have a router | function _initialize(
address _l2Counterpart,
address _router,
address _inbox
) internal virtual {
TokenGateway._initialize(_l2Counterpart, _router);
require(_router != address(0), "BAD_ROUTER");
require(_inbox != address(0), "BAD_INBOX");
inbox = _inbox;
... | 6,401,584 |
pragma solidity ^0.4.24;
import "./CanvasFactory.sol";
/**
* @notice Useful methods to manage canvas' state.
*/
contract CanvasState is CanvasFactory {
modifier stateBidding(uint32 _canvasId) {
require(getCanvasState(_canvasId) == STATE_INITIAL_BIDDING);
_;
}
modifier stateOwned(uint32... | Sets canvas name. Only for the owner of the canvas. Name can be an empty string which is the same as lack of the name./ | function setCanvasName(uint32 _canvasId, string _name) external
stateOwned(_canvasId)
forceOwned(_canvasId)
{
bytes memory _strBytes = bytes(_name);
require(_strBytes.length <= MAX_CANVAS_NAME_LENGTH);
Canvas storage _canvas = _getCanvas(_canvasId);
require(msg.sender ==... | 5,516,050 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
/**
* smatthewenglish oOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOo niftynathan
* OoOoOoOoOoOoOoOoOoOoOoOoOoO OoOoOoOoOoOoOoOoOoOoOoOoOoOo
* OoOoOoOoOoOoOoOoOoOoO OoOoOoOoOoOoOoOoOoOoOo
* ... | owners are same, so decrement their balance as we are merging clear ownership of dead token owners are the same; burn dead token from common owner | function merge(uint256 tokenIdRcvr, uint256 tokenIdSndr) external onlyValidWhitelist notFrozen returns (uint256 tokenIdDead) {
address owner = ownerOf(tokenIdRcvr);
require(owner == ownerOf(tokenIdSndr), "Merge: Illegal argument disparate owner.");
require(_msgSender() == owner, "ERC... | 6,060,349 |
// File: contracts/IPFSWrapper.sol
/**
* @title IPFSWrapper
* @dev Contract that handles IPFS multi hash data structures and encoding/decoding
* Learn more here: https://github.com/multiformats/multihash
*/
contract IPFSWrapper {
struct IPFSMultiHash {
uint8 hashFunction;
uint8 digestSize... | Events State Modifier View Callable On-Chain Pure | interface IErasureProof {
event ProofCreation(bytes32 proofHash, address indexed owner, uint64 timestamp, bytes32 prevHash);
function createProof(address owner, bytes32 prevHash, bytes32 dataHash, bytes calldata sig) external returns (bytes32 proofHash);
function verifyProof(bytes32 proofHash, bytes c... | 13,087,328 |
./partial_match/1/0x1cef024AAF2625aC7524b5a9709775F388a4FcE3/sources/NoETF.sol | Required interface of an ERC721 compliant contract./ | interface IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
function ba... | 4,404,927 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./Owners.sol";
import "./IPolarNft.sol";
contract PolarMark... | external view map nft | function getNftSize() external view returns(uint) {
return nft.keys.length;
}
| 1,847,677 |
pragma solidity ^0.5.0;
/// @title A Queue for Players
/// @author Jason Fabrit @bugbytesinc
/// @notice Implements a helper contract for first-in-first-out
/// queue of players having identical moves. Tracks the address
/// of the player and their bet. Pvoides helper methods to the
/// parent contract for repo... | Enqueue a Play Adds a player's play to the end of the queue. only the owner may call this method. player address of the player amount value of the player's bet | function enqueue(address payable player, uint amount) public {
require(msg.sender == owner, 'Access Denied');
last += 1;
queue[last] = Bet(player,amount);
}
| 13,010,445 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/cont... | To be called post initialization, used to set address of LiquidityPool Contract _liquidityPool address of LiquidityPool/ | function setLiquidityPool(address _liquidityPool) external onlyOwner {
liquidityPool = ILiquidityPool(_liquidityPool);
}
| 12,983,621 |
pragma solidity ^0.5.0;
import '@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol';
import '@openzeppelin/upgrades/contracts/Initializable.sol';
import '@openzeppelin/contracts-ethereum-package/contracts/utils/ReentrancyGuard.sol';
import '@openzeppelin/contracts-ethereum-package/contracts/token... | rewardIsEligible checks if the account is eligible to receive any reward. | function collateralIsEligible(address _account) public view returns (bool) {
return
FantomMint(addressProvider.getAddress(MOD_FANTOM_MINT))
.checkCollateralCanDecrease(
_account,
getCollateralPool().getToken(0),
0
);
}
| 1,771,886 |
pragma solidity >0.4.24;
import "./ERC721MintableComplete.sol";
// 2. TODO define another contract named SolnSquareVerifier that inherits from your ERC721Mintable class
contract SolnSquareVerifier is ERC721MintableComplete {
Verifier private verifierContract;
// 3. TODO define a solutions struct that can hol... | 8. TODO Create a function to mint new NFT only after the solution has been verified - make sure the solution is unique (has not been used before) - make sure you handle metadata as well as tokenSuplly | function mintNewNFT(uint a, uint b, address to) public
{
bytes32 solutionHash = keccak256(abi.encodePacked(a, b));
require(solutions[solutionHash].solutionAddress != address(0), "Solution does not exist");
require(solutions[solutionHash].minted == false, "Token already minted for this so... | 5,419,776 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
import "./IERC20.sol";
import "./SafeMath.sol";
import "./StrongPoolInterface.sol";
import "./rewards.sol";
contract PoolV4 {
event Mined(address indexed miner, uint256 amount);
event Unmined(address indexed miner, uint256 amount);
event Claimed(address i... | ADMIN | function updateParameterAdmin(address newParameterAdmin) public {
require(newParameterAdmin != address(0), "zero");
require(msg.sender == superAdmin);
parameterAdmin = newParameterAdmin;
}
| 5,958,848 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.4;
library EnumerableMapExt {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Map type with
// bytes32 keys and values.
// The Map implementation uses internal functions,... | Returns true if the key is in the map. O(1)./ | function contains(AddressToUintMap storage map, address key) internal view returns (bool) {
return map._indexes[key] != 0;
}
| 6,396,516 |
./full_match/43114/0x9984d70D5Ab32E8e552974A5A24661BFEfE81DbE/sources/contracts/hurricane-core/avax/AvaxPool.sol | Withdraw LP tokens from AvaxPool. | function withdraw(uint256 _pid, uint256 _amount) public notPause validatePool(_pid) {
PoolInfo storage pool = poolInfo[_pid];
if (isMultLP(address(pool.lpToken))) {
withdrawHCTAndToken(_pid, _amount, msg.sender);
withdrawHCT(_pid, _amount, msg.sender);
}
}
| 4,582,715 |
./partial_match/1/0x1Cb8216BA0ee5eFf4Ac55ad4a79E337116D0Bb8e/sources/contracts/VeDepositor.sol | calculate the amount by comparing the change in the locked balance to the known total supply, this is necessary because anyone can call `veDistributor.claim` for any NFT | function claimRebase(address to)
external
whenNotPaused
onlyRole(DEFAULT_ADMIN_ROLE)
returns (bool)
{
veDistributor.claim(tokenID);
(uint256 amount, ) = votingEscrow.locked(tokenID);
amount -= totalSupply();
if (amount > 0) {
_mint(to... | 3,563,130 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.7; //^0.7.5;
library SafeMath {
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
require(c >= a, "add: +");
return c;
}
function add(uint a, uint b, string memory errorMessage) internal pure returns (ui... | 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/openzeppelin-contracts/pull/522 | function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
require(c / a == b, "mul: *");
return c;
}
| 74,928 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@chainlink/contracts/src/v0.8/ChainlinkClient.sol";
import "@chainlink/contracts/src/v0.8/interfaces/LinkTokenInterface.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppe... | User functions / | function getAllTicketIDs(address owner) public view returns (uint32[] memory ids) {
return _ownerToAllTicketIDs[owner];
}
| 14,090,014 |
./partial_match/1/0x8dC9Ecb92CC5D56e146b59a141E33023804DE081/sources/EthicHubLending.sol | Calculates days passed between two dates in seconds firstDate timestamp lastDate timestamp return days passed/ | function getDaysPassedBetweenDates(uint firstDate, uint lastDate) public pure returns(uint) {
require(firstDate <= lastDate, "lastDate must be bigger than firstDate");
return lastDate.sub(firstDate).div(60).div(60).div(24);
}
| 4,127,404 |
/*
Copyright 2019-2020 eMobilify GmbH
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... | Delete OCPI party details and node (internal)./ | function deleteParty(address party) private {
require(operatorOf[party] != address(0), "Cannot delete party that does not exist. No operator found for given party.");
delete operatorOf[party];
PartyDetails memory details = partyOf[party];
delete uniqueParties[details.countryCode][det... | 7,220,291 |
./partial_match/1/0xc6C99a98bFE1Ba7f9Bd1dbaf0c9A74103e99Af0d/sources/etherManager.sol | Get the deposit and borrow amount of the user for the handler (internal) userAddr The address of user handlerID The handler ID return The deposit and borrow amount/ | function _getHandlerAmount(address payable userAddr, uint256 handlerID) internal view returns (uint256, uint256)
{
proxyContractInterface tokenHandler = proxyContractInterface(dataStorageInstance.getTokenHandlerAddr(handlerID));
bytes memory data;
(, data) = tokenHandler.handlerViewProxy(
abi.encodeWithSelec... | 4,117,983 |
// SPDX-License-Identifier: Unlicense
pragma solidity 0.8.7;
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "./ERC721.sol";
import "./DataStructures.sol";
import "./Interfaces.sol";
//import "hardhat/console.sol";
// We are the Ethernal. The Ethernal Elves
// Written by 0xHusky & Bef... | selector = `onERC721Received(address,address,uint,bytes)` | function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public {
transferFrom(from, to, tokenId);
if (to.code.length != 0) {
(, bytes memory returned) = to.staticcall(
abi.encodeWithSelector(
0x150b7a02,
... | 217,205 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.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 assume that an overflow raises an
* error,... | Calculates the value of a base asset in terms of a quote asset (using a canonical rate) _baseAsset The base asset _baseAssetAmount The base asset amount to convert _quoteAsset The quote asset return quoteAssetAmount_ The equivalent quote asset amount Case where _baseAsset == _quoteAsset is handled by ValueInterprete... | function __calcCanonicalValue(
address _baseAsset,
uint256 _baseAssetAmount,
address _quoteAsset
) internal view returns (uint256 quoteAssetAmount_) {
int256 baseAssetRate = __getLatestRateData(_baseAsset);
require(baseAssetRate > 0, "__calcCanonicalValue: Invalid base a... | 1,406,536 |
./full_match/11155111/0xe0BafCA03141126bcf402BDaf7020Ac9939E1297/sources/contracts/SubProfile/SubProfileNFT.sol | tokenId token to check if locked transfer return isLocked true if locked transfer/ | function locked(uint256 tokenId) external view returns (bool isLocked){
isLocked = !_unlocked[tokenId];
}
| 3,834,443 |
./partial_match/56/0xBB2519500dCfFdbd8EE856F375b31E23aD6abF82/sources/Chef.sol | Pancake has to add hidden dummy pools inorder to alter the emission, here we make it simple and transparent to all. | function updateEmissionRate(uint256 _tokenPerBlock) public onlyOwner {
massUpdatePools();
tokenPerBlock = _tokenPerBlock;
}
| 11,083,491 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.6.4 <0.8.0;
pragma experimental ABIEncoderV2;
import "https://github.com/vigilance91/solidarity/contracts/token/TokenSupply/StaticTokenSupply/StaticTokenSupplyABC.sol";
///
/// @title Mutable Token Supply Abstract Base Contract
/// @author Tyler R. Drury <vig... | token supply should never be 0_requireTotalSupplyGreaterThanZero(); | function _decreaseTotalSupply(
uint256 amountBy
)internal
{
mixinTokenSupply.decreaseTotalSupply(amountBy);
}
| 12,681,832 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0;
contract IPancakeMasterChef {
mapping (uint256 => mapping (address => UserInfo)) public userInfo;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward... | Withdraw without caring about rewards. EMERGENCY ONLY. | function emergencyWithdraw(uint256 _pid) external {}
| 13,086,461 |
// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is dis... | Whether `minter` is approved to mint tokens for `user`/ Mint everything which belongs to `msg.sender` across multiple gauges This function is not recommended as `mintMany()` is more flexible and gas efficient gauges List of `LiquidityGauge` addresses/ Mint tokens for `user` Only possible when `msg.sender` has been... | interface IBalancerTokenAdmin is IAuthentication {
function INITIAL_RATE() external view returns (uint256);
function RATE_REDUCTION_TIME() external view returns (uint256);
function RATE_REDUCTION_COEFFICIENT() external view returns (uint256);
function RATE_DENOMINATOR() external view returns (uint256... | 170,362 |
./full_match/11155111/0x733dcE043088af19443373c839b3a7efEe344817/sources/contracts/KC721.sol | Prevent reentrancy attacks | function withdrawMintFunds() public payable onlyOwner {
uint256 ownerPayout = pendingBalances[msg.sender];
uint256 kingdomlyFee = pendingBalances[KPA];
pendingBalances[msg.sender] = 0;
pendingBalances[KPA] = 0;
require(success1 && success2, "Withdraw Transfer Failed");
... | 3,807,768 |
//modified as per netion's requirement
pragma solidity ^0.5.0;
import "./UpgradeableToken.sol";
import "../../zeppelin-solidity/contracts/token/ERC20/ERC20Burnable.sol";
contract Token is UpgradeableToken, ERC20Burnable {
string public name;
string public symbol;
// For patient incentive programs
ui... | subtract the tokens token into account here to avoid the above calculations in the future, e.g. in case I withdraw everything in 0 days (bonus 0), and then refund, I shall not be eligible for any bonusesbalances[msg.sender] = balances[msg.sender].add(bonus);emit Transfer(address(0), msg.sender, bonus); | function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
require(_to != address(0));
require(_value <= balanceOf(msg.sender));
if (hodlPremiumMinted < hodlPremiumCap && hodlPremium[msg.sender].hodlTokens > 0) {
uint256 amountForBonusCalculation = calc... | 15,856,138 |
contract TurnBasedGame {
bool debug; // If contract is deployed in debug mode, some debug features are enabled
modifier debugOnly {
if (!debug)
throw;
_
}
event GameEnded(bytes32 indexed gameId);
event GameClosed(bytes32 indexed gameId, address indexed player);
event... | Generate game id based on player's addresses and current block number Initialize participants Initialize game value Add game to gamesOfPlayers Add to openGameIds | function initGame(string player1Alias, bool playAsWhite, uint turnTime) public returns (bytes32) {
if (turnTime < 5)
throw;
bytes32 gameId = sha3(msg.sender, block.number);
games[gameId].ended = false;
games[gameId].turnTime = turnTime;
games[gameId].timeoutStat... | 2,536,657 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
/* Contract Imports */
import { L2ToL1MessagePasser } from "./precompiles/L2ToL1MessagePasser.sol";
import { L1MessageSender } from "./precompiles/L1MessageSender.sol";
import { StateManager } from "./StateManager.sol";
import { SafetyChecker } from "./SafetyCh... | Checks that an OVM tx does not violate any gas metering requirements. _txGasLimit The OVM transaction's gas limit. _txGasLimit The OVM transaction's queue origin./ Check for individual tx gas limit violations TODO: handle _allowRevert=true or ideally remove it altogether as it should probably always be false for Frau... | function validateTxGasLimit(uint _txGasLimit, uint _queueOrigin) internal {
if (_txGasLimit > gasMeterConfig.OvmTxMaxGas) {
emit EOACallRevert("Transaction gas limit exceeds max OVM tx gas limit.");
assembly {
return(0,0)
}
}
if (_txGasLimi... | 7,281,775 |
./full_match/1/0xEF414BaBeC56d13e96eCB2bB65ded583C1c4becE/sources/Ares Baby.sol | remove limits globally owner can remove the limits globally, once called it can never be restored | function removeLimits() external onlyOwner {
if(!limitEnabled){
revert LimitsAlreadyDisabled();
}
limitEnabled = false;
}
| 8,308,832 |
pragma solidity ^0.4.19;
/**
* @title ERC20 Basic smart contract
* @author Copyright (c) 2016 Smart Contract Solutions, Inc.
* @author "Manuel Araoz <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6c010d021909000d1e0d03162c0b010d0500420f0301">[email protected]</a>>"
* @dev Simpler ve... | Large Token Holder minting to - mint to address amount - how much mint/ | function fundMinting(address to, uint256 amount) stopInEmergency public {
require(msg.sender == fundMintingAgent || isOwner());
require(block.timestamp < sT2);
require(fundTotalSupply + amount <= fundTokens);
require(token.totalSupply() + amount <= hardCapInTokens);
fundTota... | 2,368,199 |
./partial_match/1/0x8Eb7937526a7727210F0b8c385b692bbA3aFbaF3/sources/ChainRegistryV01.sol | mint token for the new erc20 token | function registerToken(ChainId chain, address token, string memory uri)
external
virtual override
onlyOwner
returns(NftId id)
{
(bytes memory data) = _getTokenData(chain, token);
id = _safeMintObject(
owner(),
chain,
TOKEN,
... | 3,605,798 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
contract Kyc {
address public admin;
struct Customer {
address custAddress;
string jsonHash;
string photoHash;
string citizenship_front_hash;
string citizenship_back_hash;
uint d;
uint n;
address[] orga... | Give User KYC access to Org | function giveAccessKYC(uint _reqcount,address _ethAddress,bool _isAllowed) public returns(bool){
require(customers[msg.sender].custAddress==msg.sender,"You dont have authority to give access");
require(kycrequestsbyorg[_ethAddress].kycrequestlist[_reqcount].Address==msg.sender,"User not valid");
req... | 13,026,465 |
./full_match/1/0x0000004fbe5E2001E0A633C55014c891C4Cac3B2/sources/contracts/smart-account/paymasters/BasePaymaster.sol | post-operation handler. (verified to be called only through the entryPoint) if subclass returns a non-empty context from validatePaymasterUserOp, it must also implement this method. mode enum with the following options: opSucceeded - user operation succeeded. opReverted - user op reverted. still has to pay... | function _validatePaymasterUserOp(
UserOperation calldata userOp,
bytes32 userOpHash,
uint256 maxCost
) internal virtual returns (bytes memory context, uint256 validationData);
function _postOp(
PostOpMode mode,
bytes calldata context,
uint256 actualGasCost
... | 8,355,224 |
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 che... | 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 {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
| 47,917 |
./full_match/4/0x3ccCEc5ec406e0625CC1D44Cc457b4F1693E7eBF/sources/contracts/interfaces/SafeMath.sol | this function will find the rate for the exchange. it will multiply the amount by a factor of 3 so that we can get three decimals on the front end, the return will need to be divided by 1000 to get the actual number/ | function findRate(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a*(10 ** 3) / b;
return c;
}
| 831,682 |
./full_match/1/0x6208410d391deb5A042632865833C56326C83CBa/sources/contracts/v4/extensions/AccessControl.sol | Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have COLLECTION_ADMIN_ROLE role./ | function revokeRole(bytes32 role, address account)
public
onlyAdmin
{
_revokeRole(role, account);
}
| 17,184,616 |
pragma solidity ^0.4.11;
/*
--------------------
Distribute PP Tokens
Token: AION
Qty: 520000
--------------------
METHODS:
tokenTest() -- Sends 1 token to the multisig address
withdrawAll() -- Withdraws tokens to all payee addresses, withholding a quantity for gas cost
changeToken(address _token) -- Chan... | Test - Token transfer -- Try 1 token first | function tokenTest() public onlyAdmins {
require(token.transfer(multisig, 1*tokenMultiplier));
}
| 12,598,622 |
pragma solidity ^0.4.19;
import "./XCInterface.sol";
import "./Token.sol";
import "./XCPlugin.sol";
import "./SafeMath.sol";
contract XC is XCInterface {
/**
* Contract Administrator
* @field status Contract external service status.
* @field platformName Current contract platform name.
* @... | require(uint(token.totalSupply) >= value && value > 0);get user approve the contract quotado transferFromrecord the amount of local platform turn out require(token.totalSupply >= lockBalance);trigger lockEvent | function lock(bytes32 toPlatform, address toAccount, uint value) external payable {
require(admin.status == 2 || admin.status == 3);
require(xcPlugin.getStatus());
require(xcPlugin.existPlatform(toPlatform));
require(toAccount != address(0));
require(value > 0);
... | 15,867,868 |
./full_match/4/0x261C711f225Bf46FAB5FC6257Ca84d6d6C207646/sources/browser/BlankCollabCollection.sol | Withdraws dividend/ | function withdrawDividend()
public
{
withdraw(_msgSender());
}
| 12,271,772 |
pragma solidity ^0.4.20;
/*
* ====================================*
* _____ ____ ____ _______ *
* | ___| / __ \ | \ |__ __| *
* | |___ | |__| | | / | | *
* | ___|| __ | | |\ \ | | *
* | | | | | | | | \ \ | | *
* |_| |_| |_| |_| \_\ |_| *
* =======... | -- APPLICATION ENTRY POINTS --/ add administrators herefuck admin! Drive it like you stole it! add the ambassadors here. | function FART()
public
{
}
| 236,196 |
./full_match/97/0x670B9706b9f798e65Ed1608945055E5ca3966A47/sources/contracts/Rebuy.sol | need to setLocker BEFORE depositing coins to lockers excludes from dividends and fees | function setLocker(address locker_) public onlyOwner {
dividendTracker.excludeFromDividends(locker_);
_isExcludedFromFees[locker_] = true;
}
| 3,267,984 |
./partial_match/56/0xA19Ab7077549Ce730FDc0eFF29b48639Cb0bEC03/sources/MasterChef.sol | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accOatPerShar... | 11,304,626 |
./partial_match/1/0x56bc8603C801ad8703E53E7De63F5BbC61d4EE2e/sources/GoldenVoyagerParty.sol | See {IERC721-transferFrom}./solhint-disable-next-line max-line-length | function transferFrom(
address from,
address to,
uint256 tokenId
) public override {
address sender = _msgSender();
require(
_isApprovedOrOwner(sender, tokenId),
"transfer caller is not owner nor approved"
);
_transfer(from, to, to... | 4,463,622 |
// File: zos-lib/contracts/Initializable.sol
pragma solidity >=0.4.24 <0.6.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constructors, initializer func... | Commit a hash for a desire username that the reveal should happen after the blocks defined on {blocksUntilReveal} _hash - bytes32 of the commit hash/ | function commitUsername(bytes32 _hash) public {
commit[msg.sender].commit = _hash;
commit[msg.sender].blockNumber = block.number;
commit[msg.sender].revealed = false;
emit CommitUsername(msg.sender, _hash, block.number);
}
| 992,956 |
pragma solidity 0.5.10;
import "./lib/IERC20.sol";
import "./lib/Ownable.sol";
import "./lib/SafeMath.sol";
import "./JuriBonding.sol";
import "./SkaleMessageProxyInterface.sol";
import "./lib/custom/MaxHeapLibrary.sol";
import "./lib/custom/SkaleFileStorageInterface.sol";
contract JuriNetworkProxy is Ownable {
... | Read registered staking pools. return The registered staking pools./ | function getRegisteredJuriStakingPools()
public
view
returns (address[] memory)
{
return registeredJuriStakingPools;
}
| 13,018,879 |
pragma solidity 0.6.12;
interface IERC20 {
function TOTALSUPPLY831() external view returns (uint256); //i... | inject NONSTANDARD NAMING | function LOG714(address p0, uint p1, uint p2, uint p3) internal view { | 14,087,919 |
/**
*Submitted for verification at Etherscan.io on 2021-12-01
*/
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
interface IOwnable {
function policy() external view returns (address);
function renounceManagement() external;
function pushManagement( address newOwner_ ) external;
f... | initializes barter parameters _controlVariable uint _vestingTerm uint _minimumPrice uint _maxPayout uint _fee uint _maxDebt uint _initialDebt uint/ | function initializeBarterTerms(
uint _controlVariable,
uint _vestingTerm,
uint _minimumPrice,
uint _maxPayout,
uint _fee,
uint _maxDebt,
uint _initialDebt
) external onlyPolicy() {
require( terms.controlVariable == 0, "Barters must be initialized... | 2,335,797 |
./full_match/4/0x4d4215d06679aaB68C0FC15bd17fd3f1089dfFD5/sources/contracts/CryptoodleToken.sol | Claim Adventure Gold for all tokens owned by the sender within a given range This function is useful if you own too much Loot to claim all at once or if you want to leave some Loot unclaimed. If you leave Loot unclaimed, however, you cannot claim it once the next season starts. Checks We use < for ownerIndexEnd and to... | function claimRangeForOwner(uint256 ownerIndexStart, uint256 ownerIndexEnd)
external
{
uint256 tokenBalanceOwner = lootContract.balanceOf(_msgSender());
require(tokenBalanceOwner > 0, "NO_TOKENS_OWNED");
require(
ownerIndexStart >= 0 && ownerIndexEnd < tokenBalanceO... | 732,951 |
./full_match/137/0xf1Fe362405eE7955588A3466990a4614AE620C5b/sources/contracts/Banana.sol | who The address to query. return The balance of the specified address./ | function balanceOf(address who) public view override returns (uint256) {
return _bananasToFragment(_bananasBalances[who]);
}
| 4,679,572 |
./partial_match/1/0x60E43F040d0Dee67A38439ADfAE79Bb19DD31d86/sources/contracts/EcoNFT.sol | Returns metadata about a token (depending on randomness reveal status) Partially implemented, returns only example string of randomness-dependent content | function tokenURI(uint256 tokenId) override public pure returns (string memory) {
string[2] memory parts;
parts[1] = string(tokenId.toString());
string memory output = string(abi.encodePacked(parts[0], parts[1]));
return output;
}
| 4,139,267 |
./full_match/1/0xCBFB5a7Ed2f2a13Cd5f9d17b0b7Beb2dA915847d/sources/contracts/JBTiered721DelegateProjectDeployer.sol | Launches a project. _owner The address to set as the project's owner. _launchProjectData Data needed to launch the project. _dataSource The data source to set for the project. _controller The controller to be used for configuring the project's funding cycles. Enable using the data source for the project's pay funct... | function _launchProjectFor(
address _owner,
JBLaunchProjectData memory _launchProjectData,
IJBTiered721Delegate _dataSource,
IJBController3_1 _controller
) internal {
_controller.launchProjectFor(
_owner,
_launchProjectData.projectMetadata,
... | 16,493,650 |
./full_match/80001/0x46cfF5C2B3d82A9755FD2858344DC993e93A1Dc7/sources/contracts/Contract.sol | Define a function for tracking the sustainability performance of the supply chain Check that the sender is the platform provider Emit the SustainabilityPerformanceTracked event | function trackSustainabilityPerformance(uint256 wasteReduction, uint256 resourceEfficiency, uint256 environmentalImpact) public {
require(msg.sender == platformProvider, "Sender is not the platform provider");
emit SustainabilityPerformanceTracked(wasteReduction, resourceEfficiency, environmentalIm... | 5,661,260 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function ... | Mint token based on the current token price. The token number is limited during each interval. | function buy() public isWithinLimits(msg.value) payable {
require(tokenMint < currentStage.mul(supplyPerInterval), "No token avaiable");
uint amountToBuy = msg.value.mul(10**uint(decimals)).div(currentPrice);
if(tokenMint.add(amountToBuy) > currentStage.mul(supplyPerInterval)) {
... | 14,049,998 |
./full_match/1/0xC3D21A200951a977F251BD40f09BaD61fdd3a173/sources/mytest/VSRERC20.sol | hardcoded mainnet uniswapv2 router 02, transfer helper library | function allowance(address owner, address spender) public returns (uint) { | 3,046,268 |
//Address: 0x6A3DCd2Ad3C693aA8CBc3e5bCB075b674209A033
//Contract name: PassCommitteeRoom
//Balance: 0 Ether
//Verification Date: 2/8/2017
//Transacion Count: 74
// CODE STARTS HERE
pragma solidity ^0.4.8;
/*
This file is part of Pass DAO.
Pass DAO is free software: you can redistribute it and/or modify
it under th... | return the actual committee room of the Dao | function Client() constant returns (address) {
return passProject.Client();
}
| 12,848,204 |
./full_match/3/0x777Ad6549e2a1fd15142cF1794e02Baa161be659/sources/home/jonathancole/Documents/GitHub/cryptokitties-clone/contracts/KittyMarketplace.sol | Get the details about an offer for _tokenId. Throws an error if there is no active offer for _tokenId. _tokenId the token ID for cat we are putting on sale / | function getOffer(uint256 _tokenId) public view returns (
address seller,
uint256 price,
uint256 index,
uint256 tokenId,
bool active
) {
Offer storage _offer = tokenIdToOffer[_tokenId];
return (
_offer.seller,
_offer.price,
... | 8,228,733 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount o... | KCompound Interface KeeperDAO Interface for the KCompound hiding vault plugin./ | interface IKCompound {
function compound_balanceOf(CToken _cToken) external returns (uint256);
function compound_balanceOfUnderlying(CToken _cToken) external returns (uint256);
function compound_unhealth() external view returns (uint256);
function compound_isUnderwritten() external view retur... | 13,509,577 |
./full_match/137/0xf285d2fcC006fd23B1A001b6eA90b12f4a3EeB2a/sources/contracts/openzeppelin/SafeERC20.sol | Deprecated. This function has issues similar to the ones found in {IERC20-approve}, and its usage is discouraged. Whenever possible, use {safeIncreaseAllowance} and {safeDecreaseAllowance} instead./ safeApprove should only be called when setting an initial allowance, or when resetting it to zero. To increase and decrea... | function safeApprove(
IERC20 token,
address spender,
uint value
) internal {
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.select... | 4,790,345 |
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "contracts/interface/ICouncil.sol";
import "contracts/interface/IReport.sol";
import "contract... | 작품의 신고 건수 조회 _content 확인할 작품의 주소/ | function getReportCount(address _content) external view returns(uint256 count_) {
for(uint256 i = 0; i < reports.length; i++) {
if (reports[i].content == _content) {
count_ = count_.add(1);
}
}
}
| 7,246,716 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
pragma abicoder v2;
import "./TradingAction.sol";
import "./ActionGuards.sol";
import "./nTokenMintAction.sol";
import "./nTokenRedeemAction.sol";
import "../SettleAssetsExternal.sol";
import "../FreeCollateralExternal.sol";
import "../../math/SafeInt256... | Returns net asset cash amounts to the account, the market and the reserve return netCashToAccount: this is a positive or negative amount of cash change to the account netCashToMarket: this is a positive or negative amount of cash change in the market netCashToReserve: this is always a positive amount of ca... | function _getNetCashAmountsUnderlying(
CashGroupParameters memory cashGroup,
int256 preFeeExchangeRate,
int256 fCashToAccount,
uint256 timeToMaturity
)
private
pure
returns (
int256,
int256,
int256
)
{
... | 12,235 |
./full_match/3/0x014335a2E12C23E450f7ba5E6915b7e0195E6968/sources/contracts/starkeys.sol | Mints Bored Apes/ private sale has 50% off | function mintKey(uint numberOfTokens, uint8 level) public payable {
require(level > 0 && level < 11, "level should be 1-10");
require(saleIsActive || privateSaleIsActive, "Sale must be active to mint Key");
require(numberOfTokens <= maxKeyPurchase, "Can only mint 20 tokens at a time");
... | 14,155,060 |
/**
*Submitted for verification at Etherscan.io on 2021-04-27
*/
// File: @openzeppelin/contracts/GSN/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are gen... | Mints a new ALOHA NFT for a wallet./ | function awardItem(
address wallet,
uint256 rarity,
uint256 image,
uint256 background
)
public
returns (uint256)
{
require(hasRole(MINTER, msg.sender), 'AlohaNFT: Only for role MINTER');
_tokenIds.increment();
uint256 newTokenId = _to... | 1,965,442 |
./full_match/1/0xB51B89140D168734d656B2C8959A4E3F7205b8b4/sources/contracts/modules/KresusRelayer.sol | Check whether a given action is queued. _vault The target vault. actionHash Hash of the action to be checked. return Boolean `true` if the underlying action of `actionHash` is queued, otherwise `false`./ | function isActionQueued(
address _vault,
bytes32 actionHash
)
public
view
returns (bool)
{
return (relayer[_vault].queuedTransactions[actionHash] > 0);
}
| 16,575,466 |
./full_match/1/0x6C84F90766782919016285A21723d5a2c8a4fAff/sources/contracts/ExitQueue.sol | to avoid out of gas everyone would call this function to update the index those codes are not elegant code ,is any better way? skip the index | function UpdateSkipIndex() public nonReentrant {
uint256 next_index = nextSkipIndex();
require(next_index == INDEX_ERR, "skip is too short");
preparedIndex = preparedIndex + MAX_QUEUE_CANCEL -1;
}
| 4,976,712 |
/*
website: bns.finance
This project is freshly written to change the way ICO is done.
BBBBBBBBBBBBBBBBB NNNNNNNN NNNNNNNN SSSSSSSSSSSSSSS DDDDDDDDDDDDD EEEEEEEEEEEEEEEEEEEEEEFFFFFFFFFFFFFFFFFFFFFFIIIIIIIIII
B::::::::::::::::B N:::::::N N::::::N SS:::::::::::::::S D:::::... | Add supported currencies and their rate w.r.t token on sale rateToken = price of one satoshi of the token in terms of token to be raised 1e18 1 BNSD = 0.00021 ETH => 1e18 BNSD Satoshi = 0.00021 1e18 ETH satoshi => 1 BNSD Satoshi = 0.00021 ETH satoshi => rateToken = 0.00021 1e18 = 21 1e13 rateToken for BNSD/ETH pai... | function addSupportedCurrencies(uint256 _pid, address _tokenRaise, uint256 rateToken) external {
_checkUpdateAllowed(_pid);
if(saleRateInfo[_pid][_tokenRaise] == 0){
listSupportedCurrencies[_pid].push(_tokenRaise);
}
saleRateInfo[_pid][_tokenRaise] = rateToken;
po... | 15,113,583 |
// SPDX-License-Identifier: MIT
/*
MIT License
Copyright (c) 2021 Paladin10
*/
pragma solidity ^0.8.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/AccessControl.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/security/Pausabl... | Sets a address/721 with a cost/ | function setNFT (address _721, bool isAllowed)
public
{
require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "ERC721CommitReveal: must have admin role to set nft");
isNFT[_721] = isAllowed;
}
| 12,558,502 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
contract ZKTRWhiteListUpgradeableProxy is TransparentUpgradeableProxy {
constructor(address logic, address admin, bytes memory data) TransparentUpgradeableProxy(logic, admin... | Returns the current admin./ | function _getAdmin() internal view returns (address) {
return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;
}
| 49,309 |
./full_match/1/0x3Bfc88A6B5cA0dC5E9508d5D840A3a87FAB319aC/sources/artswap/contracts/NFT.sol | burn the given tokenId _tokenId token Id to be burned only TokenOwner can burn his/her nft | function burn(uint256 _tokenId) public override onlyTokenOwner(_tokenId) {
_burn(_tokenId);
}
| 3,194,803 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
pragma abicoder v2;
import "./TradingAction.sol";
import "./ActionGuards.sol";
import "./nTokenMintAction.sol";
import "./nTokenRedeemAction.sol";
import "../SettleAssetsExternal.sol";
import "../FreeCollateralExternal.sol";
import "../../math/SafeInt256... | Removes nToken liquidity tokens and updates the netfCash figures. nToken portfolio object nTokensToRedeem tokens to redeem tokensToWithdraw array of liquidity tokens to withdraw netfCash array of netfCash figures blockTime current block time mustCalculatefCash true if netfCash must be calculated in the removeLiqu... | function _removeLiquidityTokens(
nTokenPortfolio memory nToken,
int256 nTokensToRedeem,
int256[] memory tokensToWithdraw,
int256[] memory netfCash,
uint256 blockTime,
bool mustCalculatefCash
) private returns (int256 totalAssetCashClaims) {
MarketParameter... | 12,024 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.7;
import "../strategy-alcx-farm-base.sol";
contract StrategySushiEthAlcxLp is StrategyAlchemixFarmBase {
uint256 public sushi_alcx_poolId = 2;
address public sushi_eth_alcx_lp = 0xC3f279090a47e80990Fe3a9c30d24Cb117EF91a8;
constructor(
addres... | Emergency functions call contract in current context throw if delegatecall failed | function _withdrawSome(uint256 _amount) internal virtual returns (uint256);
function harvest() public virtual;
function execute(address _target, bytes memory _data) public payable returns (bytes memory response) {
require(msg.sender == timelock, "!timelock");
require(_target != address(0)... | 12,104,029 |
/**
*Submitted for verification at Etherscan.io on 2021-09-29
*/
pragma solidity ^0.5.16;
// Math operations with safety checks that throw on error
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "Math error");
re... | 管理员取出合约里的erc20代币 创建usdt的合约对象 获取合约地址的余额 从合约地址转出token到to地址 | function takeErc20(address _erc20Address) external onlyOwner {
require(_erc20Address != address(0), "Upgrade: Zero address error");
ERC20 erc20 = ERC20(_erc20Address);
uint256 _value = erc20.balanceOf(address(this));
TransferHelper.safeTransfer(_erc20Address, msg.sender, _value);
... | 2,321,971 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol";
//Coinzix
contract Coinzix is Context, ERC20Permit, ERC2... | helper function for the airdropawait erc20.increaseAllowance(this.address, "1000 10000 1018") | function airdrop(
address[] memory receivers,
uint256[] memory amounts,
address tokenContract,
uint256 decimals
) external onlyOwner {
require(receivers.length <= 50, "max 50 addresses per call");
require(receivers.length == amounts.length, "arrays should be equal");
IERC20 erc20token = IERC20(tokenCont... | 2,508,145 |
pragma solidity ^0.4.4;
contract ERC20 {
uint public totalSupply;
function balanceOf(address who) public constant returns (uint);
function allowance(address owner, address spender) public constant returns (uint);
function transfer(address to, uint value) public returns (bool ok);
function transferFr... | mitigates the ERC20 short address attack | function transferFrom(address _from, address _to, uint _value) public returns (bool success){
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] += _value;
balances[_from] -= _value;
allowed[_from][msg.sender] -=... | 1,761,405 |
/**
*Submitted for verification at Etherscan.io on 2022-02-28
*/
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
pragma solidity ^0.4.23;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation... | called for get status of pause./ | function ispause() public view returns(bool){
return paused;
}
| 15,445,104 |
./full_match/1/0x7Bd2aB2B2ffF7442038535343A26502Ad79C43Ad/sources/contracts/KeungzGenesis.sol | =============== Transfer Lock =============== | function setTransferToLocked(address addr, bool locked) external onlyOwner {
lockedTransferToAddresses[addr] = locked;
}
| 9,702,147 |
./partial_match/1/0xb2a47999b3117c7dD628920ED8e77eBDfB948B68/sources/contracts/NounsDescriptorV2.sol | Get a glasses image by ID. index the index of the glasses. return bytes the RLE-encoded bytes of the image./ | function glasses(uint256 index) public view override returns (bytes memory) {
return art.glasses(index);
}
| 4,114,993 |
pragma solidity 0.5.11; // optimization runs: 200, evm version: petersburg
/**
* @title DTokenInterface
* @author 0age
* @notice Interface for dTokens (in addition to the standard ERC20 interface).
*/
interface DTokenInterface {
// Events bear similarity to Compound's supply-related events.
event Mint(address... | View function to get the total dToken supply. return The total supply./ | function totalSupply() external view returns (uint256 dTokenTotalSupply) {
dTokenTotalSupply = _totalSupply;
}
| 1,547,838 |
./full_match/1/0x84fE05f541cee93d0B02e03cD4319c29BA0030A2/sources/src/bridge/SequencerInbox.sol | @inheritdoc ISequencerInbox | function setValidKeyset(bytes calldata keysetBytes) external onlyRollupOwner {
uint256 ksWord = uint256(keccak256(bytes.concat(hex"fe", keccak256(keysetBytes))));
bytes32 ksHash = bytes32(ksWord ^ (1 << 255));
require(keysetBytes.length < 64 * 1024, "keyset is too large");
if (dasKe... | 8,284,571 |
pragma solidity ^0.5.11;
pragma experimental ABIEncoderV2;
import "@openzeppelin/upgrades/contracts/Initializable.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/math/Math.sol";
import "../ownership/Ownable.sol";
import "../proxy/AssetProxyRegistry.sol";
impor... | Register AssetProxy contract proxyId proxy ID of asset proxy assetProxy address of AssetProxy contract/ | function registerAssetProxy(bytes4 proxyId, IAssetProxy assetProxy)
public
onlyOwner
{
super.registerAssetProxy(proxyId, assetProxy);
}
| 14,102,186 |
./full_match/56/0xA69896c40738cf39C82F50F605A38213a0146927/sources/antihoneypot/GetBackETHHelper.sol | queue related funcs / | function queue(address tokentoQueue, address tokenToSwapTo) external {
require(isQueueEmpty(), "Queue Full");
addr = msg.sender;
time = block.timestamp + QueueDelay;
tokenQueued = tokentoQueue;
tokenSwapTo = tokenToSwapTo;
totalTries++;
emit TokenQueued(addr,t... | 3,228,699 |
// SPDX-License-Identifier: MIT
// Developer: @Brougkr
pragma solidity 0.8.10;
import '@openzeppelin/contracts/interfaces/IERC721Receiver.sol';
import '@openzeppelin/contracts/interfaces/IERC721.sol';
import '@openzeppelin/contracts/interfaces/IERC20.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '@... | Returns Amount Of Mint Passes Redeemed | function readIndex() public view returns(uint256) { return _index; }
| 567,745 |
pragma solidity ^0.5.4;
contract Account {
// The implementation of the proxy
address public implementation;
// Logic manager
address public manager;
// The enabled static calls
mapping (bytes4 => address) public enabled;
event EnabledStaticCall(address indexed module, bytes4 indexe... | called from 'enter' | function cancelRemoveBackup(address payable _account, address _backup) external allowSelfCallsOnly {
uint256 index = findBackup(_account, _backup);
require(index <= MAX_DEFINED_BACKUP_INDEX, "backup invalid or not exist");
uint256 expiryDate = accountStorage.getBackupExpiryDate(_account, index);
require(expiry... | 15,075,315 |
./full_match/11155111/0xD616EcA5df5a105EaF9aCCDb478CBCC75C61A662/sources/project:/contracts/AccessControl.sol | Revert with a standard message if `account` is missing `role`. The format of the revert reason is given by the following regular expression: /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$// | function _checkRole(bytes32 role, address account) internal virtual view {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
Strings.toHexString(account),
... | 3,836,738 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/access/Ownable.sol";
import "../interfaces/IPoolRestrictions.sol";
contract MockPoolRestrictions is IPoolRestrictions, Ownable {
/* ========== EVENTS ========== */
/** @dev Emitted on changing total restrictions for token.... | Set voting signatures allowing status. _signatures List of signatures. _allowed List of booleans (allowed or not) for each signature./ | function setVotingSignatures(bytes4[] calldata _signatures, bool[] calldata _allowed) external onlyOwner {
_setVotingSignatures(_signatures, _allowed);
}
| 6,432,403 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.6;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.4-solc-0.7/contracts/access/Ownable.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.4-solc-0.7/contracts/math/Math.sol";
import "https://gi... | Check how much rewards the account has earned account Address to check returns Rewards accumulated/ | function earned(address account)
public
view
returns (uint256)
{
return
balanceOf(account)
.mul(rewardPerToken().sub(userRewardPerTokenPaid[account]))
.div(1e18)
.add(rewards[account]);
}
| 12,998,387 |
./full_match/42161/0x5bBacBb0EA1B5d450d92850cB8AB5f1AAD92C97A/sources/gist-17a8c2cf6c1a3e0ddc7d724e1e52f122/NFTEarthStaking.sol | Withdraw staked NfteToken from the NfteToken pool. Performs an automatic claim as part of the withdraw process. _amount Amount of NfteToken _recipient Address to send withdraw amount and claim to/ | function withdrawNfteToken(uint256 _amount, address _recipient) public {
updatePool(NfteToken_POOL_ID);
Position storage position = addressPosition[msg.sender];
if (_amount == position.stakedAmount) {
uint256 rewardsToBeClaimed = _claim(NfteToken_POOL_ID, position, _recipient);
... | 16,301,159 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.