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/0x2411C98CC59D88e13Cc9CbFc576F7D40828aC47c/sources/contracts/registry/BDNS.sol | Logged when the owner of a node assigns a new owner to a subnode. Logged when the owner of a node transfers ownership to a new account. Logged when the resolver for a node changes. Logged when the TTL of a node changes Logged when an operator is added or removed. | interface BDNS {
event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);
event Transfer(bytes32 indexed node, address owner);
event NewResolver(bytes32 indexed node, address resolver);
event NewTTL(bytes32 indexed node, uint64 ttl);
event ApprovalForAll(
address index... | 9,805,159 |
./partial_match/1/0x1776e1F26f98b1A5dF9cD347953a26dd3Cb46671/sources/NumeraireBackend.sol | constructor is given number of sigs required to do protected "onlymanyowners" transactions as well as the selection of addresses capable of confirming them. | function Shareable(address[] _owners, uint _required) {
owners[1] = msg.sender;
ownerIndex[msg.sender] = 1;
for (uint i = 0; i < _owners.length; ++i) {
owners[2 + i] = _owners[i];
ownerIndex[_owners[i]] = 2 + i;
}
if (required > owners.length) throw;
required = _required;
}
| 4,382,433 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import '@openzeppelin/contracts/token/ER... | require(msg.value >= minPrice, "Not enough ETH sent; check price!"); payable(owner()).transfer(msg.value); | function mintScinion(string memory _name) external payable returns(uint id) {
_tokenIds.increment();
uint256 tokenId = _tokenIds.current();
Scinion memory newScinion = _createScinion(_name);
_safeMint(msg.sender, tokenId);
tokenURI(tokenId);
scinions.push(newScinion);
emit NewScinion(id, ... | 2,464,236 |
/**
*Submitted for verification at Etherscan.io on 2022-04-25
*/
// Sources flattened with hardhat v2.9.1 https://hardhat.org
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.
*/
f... | Claim Taxed Token FUNCTIONS | function claimToken(address token, uint amount, address to) external onlyOwner {
IERC20(token).transfer(to, amount);
}
| 2,162,520 |
./partial_match/1/0x8687DCac0AE3C150C947Ec14B0BB86FA2B119773/sources/OwnedUpgradeabilityProxy.sol | Allows the proxy owner to upgrade the current version of the proxy and call the new implementation to initialize whatever is needed through a low level call. implementation representing the address of the new implementation to be set. data represents the msg.data to bet sent in the low level call. This parameter may ... | function upgradeToAndCall(address implementation, bytes memory data) public payable onlyProxyOwner {
upgradeTo(implementation);
bool success;
bytes memory result;
(success, result) = address(this).call.value(msg.value)(data);
require(success);
}
| 9,137,294 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import { IERC20 } from "./interfaces/IERC20.sol";
import { IVault } from "./interfaces/IVault.sol";
import { IExchange } from "./interfaces/IExchange.sol";
import { IKeeperCompatible } from "./interfaces/IKeeperCompatible.sol";
import { ReentrancyGuard } from "./... | TODO: Remove user from array once (s)he closes her position | function withdraw(IERC20 token, uint256 amount) external override nonReentrant {
require(amount > 0, Errors._AmountZero);
require(token == from || token == to, Errors._WrongToken);
uint256 fromBalance = balances[msg.sender][from];
uint256 toBalance = balances[msg.sender][to];
... | 2,531,972 |
/**
*Submitted for verification at Etherscan.io on 2022-03-25
*/
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity >=0.8.0;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
ui... | Allows the current owner to transfer control of the contract to a newOwner. newOwner The address to transfer ownership to./ | function transferOwnership(address newOwner) onlyOwner public returns(bool) {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
return true;
}
| 2,293,543 |
./full_match/43113/0x891C3eD61c3c039A84D5C4C0c8E40f86dA3202D5/sources/project_/contracts/FoldStaking.sol | Used to only claim their earned rewards | function _claim(Position storage _position, address _recipient) private returns (uint256 rewardsToBeClaimed) {
Pool storage pool = pools[0];
int256 accumulatedFoldTokens = (_position.stakedAmount * uint256(pool.accumulatedRewardsPerShare)).toInt256();
rewardsToBeClaimed = (accumulatedFoldTo... | 7,119,085 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts-upgradeable/utils/EnumerableSetUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "./MSD.sol";
/**
* @dev Interface for Minters, minters now can be iMSD and MSDS
*/
interface IMi... | Add `_minters` into minters. If `_minters` have not been in minters, emits a `MinterAdded` event. _minters The addresses to add as minters Requirements: - the caller must be `owner`./ | function _addMinters(address _token, address[] memory _minters)
public
onlyOwner
onlyMSD(_token)
{
uint256 _len = _minters.length;
for (uint256 i = 0; i < _len; i++) {
require(
_minters[i] != address(0),
"minter cannot be a zer... | 12,630,486 |
/*
-----------------------------------------------------------------
FILE INFORMATION
-----------------------------------------------------------------
file: Owned.sol
version: 1.1
author: Anton Jurisevic
Dominic Romanowski
date: 2018-2-26
----------------------------------------------... | Exchange nUSD for Havvens while insisting on a particular rate. This allows a user to exchange while protecting against frontrunning by the contract owner on the exchange rate. nominAmount The amount of nomins the user wishes to exchange. guaranteedRate A rate (havven price) the caller wishes to insist upon./ | function exchangeNominsForHavvensAtRate(uint nominAmount, uint guaranteedRate)
public
pricesNotStale
notPaused
{
require(guaranteedRate == usdToHavPrice);
return exchangeNominsForHavvens(nominAmount);
}
| 2,140,246 |
pragma solidity ^0.5.4;
library Counters {
using SafeMath for uint256;
struct Counter {
// This variable should never be directly accessed by users of the library: interactions must be restricted to
// the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a pr... | Transfer tokens from one address to another. Note that while this function emits an Approval event, this is not required as per the specification, and other compliant implementations may not emit the event. from address The address which you want to send tokens from to address The address which you want to transfer t... | function transferFrom(address from, address to, uint256 value) public returns (bool) {
require(!_isBlacklisted[to]);
return super.transferFrom(from, to, value);
}
| 5,390,945 |
./full_match/7700/0xaE51A21554986434303D999660aEfd8f8D9b2658/sources/contracts/FukkenClown69ButtsOnCanto721.sol | Do you own this butt? You can have it a simple on-chain variation rather than the more delightful traditionally hosted version. | function toggleOnChainButtSituation(uint256 tokenId) external {
if(ownerOf(tokenId) != msg.sender){
revert NoAccess();
}
onChainTokenIds[tokenId] = !onChainTokenIds[tokenId];
}
| 4,654,552 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./TestFramework.sol";
//////////////////////////////////////////////
////// TestCrowdfunding helper contracts /////
//////////////////////////////////////////////
contract Investor {
Crowdfunding private crowdfunding;
// Allow contract to rece... | This is for the test purposes and exposes finish auction to outside. | function finish(Auction.Outcome _outcome, address _highestBidder) public {
finishAuction(_outcome, _highestBidder);
}
| 14,101,615 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./Signature.sol";
contract TGE is Ownable, Signature {
using SafeERC20 for ... | Validates a signature for the hashed terms & conditions message. The T&Cs hash is converted to an ERC-191 message before verifying. signature The signature to validate./ | function signTermsAndConditions(bytes memory signature) public {
if (signedTermsAndConditions[msg.sender]) return;
address signer = getSignatureAddress(
termsAndConditionsERC191,
signature
);
require(signer == msg.sender, "Invalid signature");
signedTe... | 9,961,068 |
// SPDX-License-Identifier: MIT
// todo: add events, add require statements, use chainlink oracles
pragma solidity ^0.6.7;
// add some events to contract
import "https://github.com/smartcontractkit/chainlink/blob/master/evm-contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
import "https://github.com/OpenZep... | redeem aEURs tokens | function aEURs_to_aDai(uint _amount, uint _exchange_rate) public view returns (uint256) {
uint interest_part = aEURs_interest(_amount, exchange_rate_start);
uint principal_part = aEURs_to_dollar(_amount, limit_exchange_movement_long(_exchange_rate));
return principal_part.add(interest_part)... | 1,037,423 |
./full_match/1/0xeFFe069b1c62c2f55F41A501eCc3c6Ff4dB6D70a/sources/src/modules/price-router/PriceRouter.sol | Helper function to get an assets price in USD. Returns price in USD with 8 decimals. Favors using cached prices if available./ First check if the price is in the price cache. Did not find our price in the cache. Save the last index. If there is room in the cache, the price fits in a uint96, then find the next spot av... | function _getPriceInUSD(
ERC20 asset,
AssetSettings memory settings,
PriceCache[PRICE_CACHE_SIZE] memory cache
) internal view returns (uint256) {
uint8 lastIndex = PRICE_CACHE_SIZE;
for (uint8 i; i < PRICE_CACHE_SIZE; ++i) {
if (cache[i].asset == address(0)) ... | 3,124,348 |
./partial_match/1/0xdc888B8c76eF26852B6f6c0008D6E2f29A96Cb50/sources/contracts-verify/KIBTAggregator.sol | return Contract version./ | function version() external pure returns (uint8) {
return _VERSION;
}
| 9,350,625 |
pragma solidity 0.6.6;
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol";
import "@pancakeswap-libs/pancake-swap-core/contracts/interfaces/IPancakeFactory.sol";
import "../../interfaces/IWETH.sol";
import "./PancakeLibraryV2.sol";
import "../pancake/IPancakeRouter02.sol";
import "../... | REMOVE LIQUIDITY | function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) public virtual override ensure(deadline) returns (uint amountA, uint amountB) {
address pair = PancakeLibraryV2.pairFor(factory, tokenA, tokenB);
... | 2,482,054 |
pragma solidity ^0.4.25;
import "./Register.sol";
import "./Counters.sol";
import "./Roles.sol";
contract IBAC002Receiver {
/**
* @notice Handle the receipt of an NFT
* @dev The BAC002 smart contract calls this function on the recipient
*/
function onBAC002Received(address operator, address fr... | Safely sends the ownership of a given asset ID to another address/ | function sendFrom(address from, address to, uint256 assetId, bytes memory data) public whenNotSuspended {
require(_isApprovedOrOwner(msg.sender, assetId), "BAC002: send caller is not owner nor approved");
_sendFrom(from, to, assetId, data);
require(_checkOnBAC002Received(from, to, assetId,... | 12,696,217 |
pragma solidity ^0.4.24;
// import 'openzeppelin-solidity/contracts/math/SafeMath.sol';
// pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, ... | Initializes contract with initial supply tokens to the creator of the contract / function MyAdvancedToken( initialSupply = _initialSupply; tokenName = _tokenName; tokenSymbol = _tokenSymbol; | function WADCoin( uint256 _initialSupply) TokenERC20(_initialSupply) public {
}
| 12,760,736 |
./partial_match/1/0x591bb8bB94D2FF406A5E8Ce6962D37210606dfB6/sources/WePiggyRewardToken.sol | Claim for recipient Emits a {Claim} event./ Make sure this reward has not already been claimed (and claim it) | function _claim(bytes32[] memory proof_, address recipient) internal {
require(!_claimPaused, "Claim is paused.");
require(!claimed[recipient], "You have already claimed your rewards.");
require(verifyProof(proof_, recipient), "The proof could not be verified.");
claimed[recipient]... | 3,907,196 |
// SPDX-License-Identifier: WTFPL
pragma solidity 0.8.12;
import "./libraries/EIP712s.sol";
import "./libraries/Signatures.sol";
import "./Timelock.sol";
import "./MultiSigGovernance.sol";
contract CoreTeam is Timelock, MultiSigGovernance {
// keccak256("QueueTransactions(address[] target,uint256[] value,string[... | Core team can call this to queue multiple transactions with a number of signatures higher than quorum/ | function queueTransactions(
address[] memory target,
uint256[] memory value,
string[] memory signature,
bytes[] memory data,
uint64[] memory eta,
address[] memory signers,
Signatures.Signature[] memory signatures
) external requirementMet(uint128(signature... | 2,551,014 |
pragma solidity =0.6.6;
import '@uniswap/v2-core/contracts/interfaces/IOzonepieCallee.sol';
import '../libraries/OzonepieLibrary.sol';
import '../interfaces/V1/IUniswapV1Factory.sol';
import '../interfaces/V1/IUniswapV1Exchange.sol';
import '../interfaces/IOzonepieRouter01.sol';
import '../interfaces/IERC20.s... | gets tokens/WETH via a V2 flash swap, swaps for the ETH/tokens on V1, repays V2, and keeps the rest! | function OzonepieCall(address sender, uint amount0, uint amount1, bytes calldata data) external override {
address[] memory path = new address[](2);
uint amountToken;
uint amountETH;
address token0 = IOzonepiePair(msg.sender).token0();
address token1 = IOzonepiePair(msg.sende... | 14,053,669 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/utils/Strings.sol";
import "./interfaces/RarelifeLibrary.sol";
contract RarelifeTalents is IRarelifeTalents, RarelifeConfigurable {
/* *******
* Globals
* *******
*/
uint public immutable ACTOR_DESIGNER = ... | REVIEW: check exclusivity at first | function talent_character(uint _actor) external
onlyApprovedOrOwner(_actor)
{
require(!actor_talents_initiated[_actor], "RarelifeTalents: already init talents");
IRarelifeRandom rand = rlRoute.random();
uint tltCt = rand.dn(_actor, 4);
if(tltCt > talent_ids.leng... | 6,446,931 |
./full_match/80001/0x0392F6416DCA6305A7aB44A7652fE12c6367322c/sources/marketplaceupdated.sol | Cancel an already published order can only be canceled by seller or the contract owner _nftAddress - Address of the NFT registry _assetId - ID of the published NFT/ Remove pending bid if any | function cancelOrder(address _nftAddress, uint256 _assetId) public whenNotPaused {
Order memory order = orderByAssetId[_nftAddress][_assetId];
require(order.seller == msg.sender || msg.sender == owner(), "Marketplace: unauthorized sender");
Bid memory bid = bidByOrderId[_nftAddress][_asset... | 5,579,266 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
pragma abicoder v2;
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
im... | Internal function called by `unlock`, `withdrawUnlocked`. _account The address of account to update pending unlock list. | function _updateUnlocked(address _account) internal {
UserInfo storage _info = userInfo[_account];
uint256 _currentEpoch = block.timestamp / REWARDS_DURATION;
uint256 _nextUnlockIndex = _info.nextUnlockIndex;
uint256 _totalUnlocked = _info.totalUnlocked;
EpochUnlockInfo[] storage _pendingUnlockLis... | 14,939,478 |
./full_match/44787/0x712D063ea31e2a39d1aAAbced00737f455f5Cbbb/sources/contracts/Fundraise.sol | check if user have active fundraising campaign | function isLive(address _fundraiser) internal view returns (bool) {
for (uint i = 0; i < campaignsNum; i++){
if (campaigns[i].fundraiser == _fundraiser
&& campaigns[campaignsNum].closed == false) {
return true;
}
}
return false;
... | 13,254,755 |
./full_match/80001/0x92759EEf7CD2CAd6A40734dd8bC252a214130C50/sources/contracts/farm.sol | Withdraw without caring about rewards. EMERGENCY ONLY. | function emergencyWithdrawEnable(uint256 _pid) public onlyOwner {
PoolInfo storage pool = poolInfo[_pid];
pool.emergencyMode = true;
}
| 5,655,353 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./ERC721A.sol";
import "./ERC721ABurnable.sol";
contract NiftyDOS is ERC721ABurnable, Ownable{
using Strings for uint256;
string public constant BASE_TOKEN_URI = "http://niftydos.com/token?";
... | See {IERC721Enumerable-totalSupply}./ Counter underflow is impossible as _burnCounter cannot be incremented more than _currentIndex times | function totalSupply() public view returns (uint256) {
unchecked {
return _currentIndex - _burnCounter;
}
}
| 14,390,056 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./AllowanceCrowdsale.sol";
/// @custom:security-contact [email protected]
contract AfterPrivateSale is AllowanceCrowdsale {
constructor(
uint256 rate_,
address payable wallet_,
IERC20 token_,
address tokenWallet_
)... | Determines how ETH is stored/forwarded on purchases./ | function _forwardFunds() internal {
require(success, "Crowdsale: unable to forward funds");
}
| 14,937,753 |
/*
Copyright 2021 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... | Create the action info struct to be used in internal functions return ActionInfo Struct containing data used by internal lever and delever functions/ Calculate prices from chainlink. Chainlink returns prices with 8 decimal places, but we need 36 - underlyingDecimals decimal places. This is so that when t... | function _createActionInfo() internal view returns(ActionInfo memory) {
ActionInfo memory rebalanceInfo;
int256 rawCollateralPrice = strategy.collateralPriceOracle.latestAnswer();
rebalanceInfo.collateralPrice = rawCollateralPrice.toUint256().mul(10 ** strategy.collateralDecimalAdjustment);... | 6,894,433 |
./full_match/1/0x3C6FBc94288f5af5201085948DdB18aDED2E6879/sources/contracts/ApeFiNFT.sol | Return all the account's MAYC token IDs and its eligibility. account The account/ | function getAccountEligibleMayc(
address account
) public view returns (ApeUsed[] memory) {
uint256 balance = mayc.balanceOf(account);
ApeUsed[] memory apes = new ApeUsed[](balance);
for (uint256 i = 0; i < balance; i++) {
uint256 tokenId = mayc.tokenOfOwnerByIndex(ac... | 3,053,455 |
/**
*Submitted for verification at Etherscan.io on 2019-12-06
*/
// File: ../../mosaic-contracts/contracts/lib/RLP.sol
pragma solidity ^0.5.0;
/**
* @title RLPReader
*
* RLPReader is used to read and parse RLP encoded data in memory.
*
* @author Andreas Olofsson (androlo1980@gmail.com)
*/
library RLP {
/** Con... | Get the number of items in an RLP encoded list. self The RLP item. return The number of items./ solium-disable-next-line / | function items(RLPItem memory self) internal pure returns (uint) {
if (!isList(self)) {
return 0;
}
uint b0;
uint memPtr = self._unsafe_memPtr;
assembly {
b0 := byte(0, mload(memPtr))
}
uint pos = memPtr + _payloadOffset(self);
... | 12,905,842 |
./full_match/420/0xB3201C217e3A466D2eD7a198742d98eF91b25cF2/sources/contracts/libs/Tokens.sol | Get a checksummed string hex representation of an account address. account address The account to get the checksum for./ call internal function for converting an account to a checksummed string. | function _getChecksum(
address account
) internal pure returns (string memory accountChecksum) {
return _toChecksumString(account);
}
| 13,227,767 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "./AccessExtension.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
/**
* @title Intelligent NFT Interface
* ... | Checks if requested feature is enabled globally on the contract feature the feature to check return true if the feature requested is enabled, false otherwise/ delegate to Zeppelin's `hasRole` | function isFeatureEnabled(bytes32 feature) public override view returns(bool) {
return hasRole(feature, address(this));
}
| 116,686 |
// File contracts/general/Ownable.sol
pragma solidity ^0.6.6;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*
* @dev We've added a second owner to share control of the timeloc... | Find the arNxm value of a certain amount of wNxm. _nAmount The amount of NXM to check arNxm value of. return arAmount The amount of arNxm the input amount of wNxm is worth./ Get reward allowed to be distributed. aum() holds full reward so we sub lastReward (which needs to be distributed over time) and add reward that ... | function arNxmValue(uint256 _nAmount)
public
view
returns (uint256 arAmount)
{
uint256 reward = _currentReward();
uint256 totalN = aum().add(reward).sub(lastReward);
uint256 totalAr = arNxm.totalSupply();
if (totalN == 0) {
arAmount = _nAmount;
... | 6,135,469 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @artist: FVCKRENDER
/// @title: ESSENCE//
/// @author: manifold.xyz
//////////////////////////////////////////////////////////////////////////////////////////////
// //... | Return whether mints need to be tracked isPresale - pass in to explicitly consider in presale/ | function _shouldTrackMints(bool isPresale) internal view returns (bool) {
return !transferLocked && ((isPresale && (useDynamicPresalePurchaseLimit || presalePurchaseLimit > 0)) || purchaseLimit > 0);
}
| 93,949 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.10;
pragma experimental "ABIEncoderV2";
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { IBasketToken } from "../interfaces/IBasketToken.sol";
import { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import... | PRIVELEGED MODULE FUNCTION. Low level function that allows a module to make an arbitrary function call to any contract. _target Address of the smart contract to call _value Quantity of Ether to provide the call (typically 0) _data Encoded function selector and argum... | function invoke(
address _target,
uint256 _value,
bytes calldata _data
)
external
whenLockedOnlyLocker
returns (bytes memory _returnValue)
{
_returnValue = _target.functionCallWithValue(_data, _value);
emit Invoked(_target, _value, _data, _ret... | 5,445,160 |
pragma solidity 0.4.23;
/**
* Helios token http://heliosprotocol.io
*
*/
/**
* @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 (uint25... | 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));
newOwnerTemp = newOwner;
}
| 1,368,259 |
// SPDX-License-Identifier: Apache-2.0
/*
Copyright 2020 ZeroEx Intl.
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 a... | Executes a swap on 0x API data calldata expected by data field on 0x API (https://0x.org/docs/apiresponse-1) tokenOut the address of currency to sell - 0x address for ETH tokenIn the address of currency to buy - 0x address for ETH referee address of referee for msg.sender, 0x adress if none fee boolean if fee shou... | function executeZeroExSwap(
bytes calldata data,
address tokenOut,
address tokenIn,
address referee,
bool fee
) external payable nonReentrant whenNotPaused isValidReferee(referee) {
referee = _getReferee(referee);
bytes4 selector = data.readBytes4(0);
... | 10,222,053 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.4;
import '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import '@openzeppelin/contracts/math/SafeMath.sol';
import '@uniswap/lib/contracts/libraries/FixedPoint.sol';
import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol';
import '@uniswap/v2-periphery/... | transfer tokens, deducting fee account recipient of transfer amount quantity of tokens to transfer, before deduction/ | function burnAndTransfer (address account, uint amount) override external {
uint withheld = FeePool(_feePool).calculateWithholding(amount);
_transfer(msg.sender, _feePool, withheld);
_burn(_feePool, withheld / 2);
_transfer(msg.sender, account, amount - withheld);
}
| 1,037,054 |
./full_match/73799/0xf4F41dcBB159cc401BB60Ae328bbc4159c776CF6/sources/contracts/trove-factory.sol | returns fee from borrowing the amount/ | function getBorrowingFee(uint256 _amount) public view returns (uint256) {
return (_amount * BONQMath.min(MAX_BORROWING_RATE, (BORROWING_RATE + baseRate))) / DECIMAL_PRECISION;
}
| 16,363,595 |
pragma solidity ^0.5.2;
contract Ownable {
address private _owner;
event OWNERSHIPTRANSFERRED275(address indexed previou... | inject NONSTANDARD NAMING | function WITHDRAWPAYMENTS729(address payable payee) public { | 7,302,980 |
//SPDX-License-Identifier: MIT"
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
// This contract is designed to freeze an amount of ether within the contract until a release block.
// per amount frozen and per blocks held,... | Function that takes amount ETH and block delta to calculate ERC20 token reward. Tokens come from initial 1,000,000,000 pool for liquidity. 1 token = .1 eth staked per block frozen _ethereum: ethereum frozen blockDelta: Difference in block height from freeze to release | function calculateReward(uint256 _wei, uint256 blockDelta) private returns (uint256) {
return _wei * rewardMultiplier * blockDelta / weiPerEther ;
}
| 12,749,805 |
pragma solidity ^0.6.0;
... | inject NONSTANDARD NAMING | function LOG40(address p0, bool p1, string memory p2, bool p3) internal view { | 1,019,190 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "./ERC2981.sol";
contract ERC721Royalty is ERC721, ERC2981, Ownable {
using Count... | Dumb implementation | function royaltyInfo(uint256 _tokenId, uint256 _salePrice)
public
view
override
returns (address receiver, uint256 royaltyAmount)
{
Royalty memory royalty = _royalties[_tokenId];
if (royalty.recipient == address(0)) {
return (address(0), 0);
}
return (royalty.recipient, (_sal... | 6,416,536 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.7.6;
pragma experimental ABIEncoderV2;
import "../openzeppelin/access/AccessControl.sol";
import "../openzeppelin/utils/math/SafeMath.sol";
import "../openzeppelin/token/ERC20/SafeERC20.sol";
import "../openzeppelin/token/ERC20/IERC20.sol";
import "../sablierh... | Divide a scalar by an Exp, returning a new Exp.// | function divScalarByExp(uint256 scalar, Exp memory divisor)
internal
pure
returns (MathError, Exp memory)
{
We are doing this as:
getExp(mulUInt(expScale, scalar), divisor.mantissa)
How it works:
Exp = a / b;
Scalar = s;
`s / (a / b)` = `b * s / a` an... | 12,569,873 |
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 val... | lock one address one address only be locked at the same time. because the gas reson, so not support multi lock of one address _lockValue how many tokens locked _releaseTimeS the lock release unix time/ | function setLock(address _address, uint256 _lockValue, uint256 _releaseTimeS) onlyAdmins public {
require( uint256(now) > locks[_address].releaseTimeS );
locks[_address].balance = _lockValue;
locks[_address].releaseTimeS = _releaseTimeS;
emit SetLock(_address, _lockValue, _releaseTim... | 6,133,416 |
./full_match/44787/0xE872636cca1c141B62bd9f82C745cE6b9113C6bD/sources/project_/contracts/KolorLandToken.sol | increase number of holders set approval for dev or other operator | function newInvestment(
address investor,
uint256 tokenId,
uint256 amount,
uint256 tokenPrice
) public onlyAuthorized {
require(exists(tokenId), "KolorLandToken: land must exists!");
require(
availableTokensOf(tokenId) - amount >= 0,
"Kolor... | 13,260,551 |
./full_match/1/0x5773681CBeBf0f3fB79Fdb139bDa12eFBc12A7A9/sources/contracts/hacker/LOVELY.sol | Gas consumes testing/ | function testing() external {
uint256 mkpmd = 77 + 2 % 29;
uint256 kizgmy = 71 % 52;
uint256 fupvdgci = 5;
uint256 qsywq = 55 + 8;
uint256 aya = 38 + 88;
if (mkpmd == 57 % 75 + 44 + 91 && kizgmy == 79 * 24 && fupvdgci == 83 + 22 + 50 && qsywq == 82 % 82 && aya == 56 + 39 % 88) re... | 4,861,854 |
./partial_match/1/0xe14F2e37935A7b500CeF56D2779FFeCa79F0bf65/sources/TokenSale.sol | This lets owner to withdraw any leftover tokens./ | function withdrawLeftoverTokens(address tokenAddress) external onlyOwner{
uint256 balance = IERC20(tokenAddress).balanceOf(address(this));
require(balance > 0, "No token balance to withdraw");
IERC20(tokenAddress).transfer(msg.sender, balance);
}
| 4,079,766 |
pragma solidity ^0.4.21;
/*
* ##### ## ##### ## ### ## ### ###
* ###### /### ###### / #### / /#### #### / ### ###
* /# / / ### /# / / ####/ / ### /####/ ## ##
* ... | Determine if the "_from" address is a contract | function _humanSender(address _from) private view returns (bool) {
uint codeLength;
assembly {
codeLength := extcodesize(_from)
}
}
| 5,812,956 |
./full_match/5/0xCbEDAB3193dc8027cc403a01cE054695a08E2F34/sources/contracts/upgrade_initializers/DiamondInit.sol | initalize the Fee Manager facet _feePerClaim fee per claim to reward the validators _feeManagerBank fee manager bank address _feeManagerOwner fee manager owner address | function initFeeManager(
uint256 _feePerClaim,
address _feeManagerBank,
address _feeManagerOwner
) private {
LibFeeManager.DiamondStorage storage feeManagerDS = LibFeeManager
.diamondStorage();
feeManagerDS.feePerClaim = _feePerClaim;
feeManagerDS.ban... | 1,895,336 |
./full_match/80001/0xBB24d7CBade17c26a19B97A1E6204125985f0412/sources/useCases/vehicle-management/vehicleModificationTracker.sol | Function to check if a user is blacklisted | function isBlacklisted(address _user) external view returns (bool) {
return blacklistedUsers[_user];
}
| 9,495,835 |
pragma solidity ^0.5.0;
/**
* @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 a, uint256 b) internal pure returns (uint256) {
// Gas optimiz... | Decrease held balance./ | function _decreaseHeldBalance(address token, Hold storage executableHold, uint256 value) private {
_heldBalance[token][executableHold.sender] = _heldBalance[token][executableHold.sender].sub(value);
_totalHeldBalance[token] = _totalHeldBalance[token].sub(value);
_heldBalanceByPartition[token][executableH... | 1,722,074 |
./partial_match/1/0x373ae78a14577682591E088F2E78EF1417612c68/sources/contracts/HomoraBank.sol | Return the borrow balance for given positon and token without trigger interest accrual. positionId The position to query for borrow balance. token The token to query for borrow balance. | function borrowBalanceStored(uint positionId, address token) public view override returns (uint) {
uint totalDebt = banks[token].totalDebt;
uint totalShare = banks[token].totalShare;
uint share = positions[positionId].debtShareOf[token];
if (share == 0 || totalDebt == 0) {
return 0;
return... | 4,169,084 |
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Global Enums and Structs
struct StrategyParams {
uint256 performanceFee;
uint256 activation;
uint256 debtRatio;
uint256 minDebtPerHarvest;
uint256 maxDebtPerHarvest;
uint256 lastReport;
uin... | we don't need to repay | function _leverDownTo(uint256 newAmountBorrowed, uint256 currentBorrowed)
internal
returns (uint256)
{
if (newAmountBorrowed >= currentBorrowed) {
return 0;
}
uint256 totalRepayAmount = currentBorrowed.sub(newAmountBorrowed);
if (isDyDxActive) {
... | 219,142 |
// SPDX-License-Identifier: BUSL-1.1
// For further clarification please see https://license.premia.legal
pragma solidity ^0.8.0;
import {EnumerableSet} from "@solidstate/contracts/utils/EnumerableSet.sol";
import {ABDKMath64x64} from "abdk-libraries-solidity/ABDKMath64x64.sol";
import {IPoolIO} from "./IPoolIO.sol"... | Calculate x / y rounding towards zero, where x and y are unsigned 256-bit integer numbers. Revert on overflow or when y is zero. x unsigned 256-bit integer number y unsigned 256-bit integer number return unsigned 64.64-bit fixed point number/ | function divuu (uint256 x, uint256 y) private pure returns (uint128) {
unchecked {
require (y != 0);
uint256 result;
if (x <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
result = (x << 64) / y;
else {
uint256 msb = 192;
uint256 xc = x >> 192;
resu... | 103,850 |
pragma solidity ^0.4.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure ret... | Установить дату окончания PreICO | function setPreICOEndDate (uint256 _preICOEndDate) public onlyOwner {
require(_preICOEndDate > preICOStartDate);
preICOEndDate = _preICOEndDate;
}
| 5,522,672 |
pragma solidity ^0.5.8;
import "./IERC20.sol";
import "./SoraToken.sol";
/**
* Provides functionality of master contract
*/
contract Master {
bool internal initialized_;
address public owner_;
mapping(address => bool) public isPeer;
uint public peersCount;
/** Iroha tx hashes used */
mapping... | Register a clientIrohaAccountId for the caller clientEthereumAddress clientEthereumAddress - ethereum address to register clientIrohaAccountId - iroha account id txHash - iroha tx hash of registration v array of signatures of tx_hash (v-component) r array of signatures of tx_hash (r-component) s array of signatur... | function register(
address clientEthereumAddress,
bytes memory clientIrohaAccountId,
bytes32 txHash,
uint8[] memory v,
bytes32[] memory r,
bytes32[] memory s
)
public
{
require(used[txHash] == false);
require(checkSignatures(
... | 15,831,173 |
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.7.5;
pragma abicoder v2;
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "../presets/OwnablePausableUpgradeable.sol";
import "../interfaces/IStakedEthToken.sol";
import "../interfaces/IDepositContract.sol";
import "../interf... | This interface is designed to be compatible with the Vyper version. This is the Ethereum 2.0 deposit contract interface. For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs https://github.com/ethereum/eth2.0-specs/blob/dev/solidity_deposit_contract/deposit_contract.sol | interface IDepositContract {
event DepositEvent(
bytes pubkey,
bytes withdrawal_credentials,
bytes amount,
bytes signature,
bytes index
);
function deposit(
bytes calldata pubkey,
bytes calldata withdrawal_credentials,
bytes calldata signature... | 6,233,599 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.7;
import "./strategy-alcx-farm-symbiotic.sol";
contract StrategyAlusd3Crv is StrategyAlcxSymbioticFarmBase {
uint256 public alusd_3crv_poolId = 4;
address public alusd_3crv = 0x43b4FdFD4Ff969587185cDB6f0BD875c5Fc83f8c;
constructor(
address _g... | Collects Alcx tokens 10% is locked up for future gov | function harvest() public override onlyBenevolent {
uint256 _alcxHarvestable = getAlcxFarmHarvestable();
uint256 _harvestable = getHarvestable();
uint256 _alcx = IERC20(alcx).balanceOf(address(this));
if (_alcx > 0) {
uint256 _keepAlcx = _alcx.mul(keepAlcx).div(keepAlcx... | 11,737,595 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.10;
/**
* @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, which i... | Resets the fallback set date to the current block's timestamp. This can be used to delay the start of the fallback period without publishing a new root, or to deactivate the fallback mechanism so a new fallback root may be published./ | function resetFallbackMechanismDate() external {
require(msg.sender == owner() || msg.sender == fallbackPublisher, "Invalid sender");
fallbackSetDate = block.timestamp;
emit FallbackMechanismDateReset(fallbackSetDate);
}
| 6,532,346 |
pragma solidity 0.6.12;
//
/**
* @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, which is the standard behavior in h... | α=2.570e-05,β=8.542e-07 | function impactCostForBuyInETH(uint256 vol) public pure returns (uint256 impactCost) {
if (vol < 500 ether) {
return 0;
}
| 14,965,909 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// Contracts
import { RolesMods } from "../contexts2/access-control/roles/RolesMods.sol";
import { PausableMods } from "../settings/pausable/PausableMods.sol";
import {
ReentryMods
} from "../contexts2/access-control/reentry/ReentryMods.sol";
import { AUTHORI... | It gets the current liquidation reward for a given loan. loanID The loan ID to get the info. return inLending_ The value the liquidator will receive denoted in lending tokens. return inCollateral_ The value the liquidator will receive denoted in collateral tokens./ | function getLiquidationReward(uint256 loanID)
external
view
returns (uint256 inLending_, uint256 inCollateral_)
{
(inLending_, ) = RepayLib.getLiquidationReward(
loanID,
LibCollateral.e(loanID).loanSupply(loanID)
);
inCollateral_ = PriceAgg... | 6,395,457 |
./full_match/420/0x3de80F2f5610d2cA96534cf560357fD2db5bBb3B/sources/contracts/thirdweb-wallet/WalletEntrypoint.sol | Calls an account with transaction data. solhint-disable-next-line avoid-low-level-calls Next 5 lines from https:ethereum.stackexchange.com/a/83577 | function execute(TransactionRequest calldata req, bytes memory signature)
public
payable
onlyValidTimeWindow(req.validityStartTimestamp, req.validityEndTimestamp)
returns (bool, bytes memory)
{
require(req.value == msg.value, "WalletEntrypoint: incorrect value sent.");
... | 13,226,228 |
./full_match/1/0x8430Be7B8fd28Cc58EA70A25C9c7A624F26f5D09/sources/src/core/processors/RollupProcessorV2.sol | Returns true if deposits are capped, false otherwise return capped - True if deposits are capped, false otherwise/ | function getCapped() public view override (IRollupProcessorV2) returns (bool capped) {
return rollupState.capped;
}
| 4,874,851 |
./partial_match/1/0x43eA73168B8f192dBDEC088DA29F2C5E517f6fcB/sources/contracts-verify/KUMASwap.sol | Visibility function that calculates the face value of a bond at the current timestamp tokenId Bond tokenId. return Bond value e.g. principal value + accrued interests./ | function getBondValue(uint256 tokenId) external view returns (uint256) {
if (!_bondReserve.contains(tokenId)) {
revert Errors.INVALID_TOKEN_ID();
}
IKUMABondToken.Bond memory bond = IKUMABondToken(_KUMAAddressProvider.getKUMABondToken()).getBond(tokenId);
return _getBon... | 15,921,125 |
./full_match/43114/0x7766E37357598FeF21007E689f07b89788c56a9b/sources/production-contracts/BlizzVault.sol | Withdraw full unlocked balance and claim pending rewards | function withdrawAll() external updateReward(msg.sender) {
(uint256 amount, uint256 penaltyAmount) = withdrawableBalance(msg.sender);
delete userEarnings[msg.sender];
Balances storage bal = balances[msg.sender];
bal.total = bal.total.sub(bal.unlocked).sub(bal.earned);
bal.unl... | 4,571,027 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contract... | Used by renter to vacate tenant in case of default, or when rental period expires. If payment + deposit covers minRentDays then deposit can be used as rent. Otherwise rent has to be provided in addition to the deposit. If rental period is shorter than minRentDays then deposit will be forfeited. swap and purge if not th... | function terminateRental(uint tokenId) external override virtual {
uint paidUntil = rentalPaidUntil(tokenId);
address tenant = worldRentInfo[tokenId].tenant;
emit RentalTerminated(tokenId, tenant);
rentCount[tenant]--;
uint lastIndex = rentCount[tenant];
uint tokenInd... | 12,991,668 |
./full_match/4/0x0199C6242d1ca20E05b88Da441C43F771498d8FB/sources/browser/Comptroller.sol | Checks if the account should be allowed to repay a borrow in the given market cToken The market to verify the repay against payer The account which would repay the asset borrower The account which would borrowed the asset repayAmount The amount of the underlying asset the account would repay return 0 if the repay i... | function repayBorrowAllowed(
address cToken,
address payer,
address borrower,
uint repayAmount) external returns (uint) {
payer;
borrower;
repayAmount;
if (!markets[cToken].isListed) {
return uint(Error.MARKET_NOT_LISTED);
}
... | 760,692 |
./full_match/1/0x7D576dE740e290bC3c279C8A879442c4108b9398/sources/contracts/feiotherarb.sol | use rai to get fei out | function rai_curve_best_out(uint256 lowerbound, uint256 higherbound , uint256 step) public returns(uint256 bestin, uint256 bestprofit, uint256 bestraiout){
uint256 curve_out;
uint256 amountin;
uint256 v3_raiout;
uint256 v3_usdc_out;
uint256 v3_dai_out;
while(lowerbo... | 9,698,281 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "./libraries/Utils.sol";
import "./libraries/Signature.sol";
import "./Domain.sol";
import "./TLD.sol";
import "./Settings.sol";
contract Orderin... | See {IERC165-supportsInterface}./ | function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControlEnumerable).interfaceId
|| super.supportsInterface(interfaceId);
}
| 8,802 |
./full_match/1/0x2fC246149B4B8d7bcEF6188A10AF1791380227f1/sources/src/Estate/EstateBaseToken.sol | add a single land to an existing estate sender address perforing the operation that will add the quad to its Estate estateId the estate that is going to be modified id land id to be added to the estate junction this need to be the index (in the estate) of a quad/land part of the estate that is adjacent to the newly... | function addSingleLand(
address sender,
uint256 estateId,
uint256 id,
uint256 junction
) external {
_addLand(sender, estateId, id, junction);
}
| 8,434,832 |
pragma solidity ^0.4.18;
/**
* Math operations with safety checks that throw on error
*/
contract SafeMath {
function safeMul(uint256 a, uint256 b) public pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) public pure returns (uint25... | Function that is called when a user or another contract wants to transfer funds .Override/ | function transfer(address _to, uint256 _value, bytes _data) public whenNotPaused notSelf(_to) returns (bool success){
require(_to != address(0));
if(isContract(_to)) {
return transferToContract(msg.sender, _to, _value, _data);
}
else {
return transferToAddress(msg.sender, _to, _value, _data);
}
}
| 6,212,654 |
pragma solidity >=0.5.4 <0.6.0;
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external; }
contract TheAO {
address public theAO;
address public nameTAOPositionAddress;
// Check whether an address is whitelisted and granted a... | Send `_value` Primordial ions to `_to` from `_from` _from The address of the sender _to The address of the recipient _value The amount to send return true on success/ | function transferPrimordialFrom(address _from, address _to, uint256 _value) public returns (bool) {
require (_value <= primordialAllowance[_from][msg.sender]);
primordialAllowance[_from][msg.sender] = primordialAllowance[_from][msg.sender].sub(_value);
return _createLotAndTransferPrimordial(_from, _to, _value);... | 985,635 |
// File: @openzeppelin/contracts/utils/Counters.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
* of elements in a mapping, issu... | we override the _baseURI() method of ERC721 to return our own baseURI | function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}
| 219,719 |
./partial_match/1/0xa52c0Bb1b802e9d6A483072d56fd22B58B964455/sources/contracts/mixins/nftDropMarket/NFTDropMarketDutchAuction.sol | Get the price per NFT for sale in a dutch auction if purchased at the given time. nftContract The NFT collection address. time Time in seconds since the Unix epoch to calculate the price for. return price The price per NFT at the time provided. This should not be used for historical prices, once the collection sells... | function getPriceAtTimeForDutchAuction(address nftContract, uint256 time) public view returns (uint256 price) {
DutchAuctionInfo storage auctionInfo = $collectionToDutchAuctionInfo[nftContract];
if (auctionInfo.totalMintedCount >= auctionInfo.totalAvailableSupply) {
price = auctionInfo.lastSalePrice;
... | 2,625,039 |
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/access/Ownable.sol";
/** @title Know You Customer contract
* @author Chris Ball
* @notice This contract handles basic "white listing" of addresses
*/
contract KycContract is Ownable {
mapping(address => bool) allowed; /** @dev valid... | function revokes whitelisting of the incoming address _addr the address to revoke/ | function setKycRevoked(address _addr) public onlyOwner {
allowed[_addr] = false;
}
| 12,913,556 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./Marketplace.sol";
contract MarketplaceAuction is Marketplace {
//currency medamon
struct Listing {
address lister;
uint256 initialPrice;
uint256 endTime;
address highestBidder;
uint256 highestBid;
}
... | modificado en linea 75. Agrega suma de tiempo si la subasta esta por terminarcambiar a memory | function bid(
IERC721 _token,
uint256 _tokenId,
uint256 _amount
) public whenNotPaused onlyWhitelistedTokens(_token) {
Listing storage listing = listings[_token][_tokenId];
require(listing.lister != address(0), "MARKETPLACE: Token not listed");
require(listing.li... | 15,860,271 |
./full_match/97/0x309569E6920a78c97d7A4a881D41EB432b565603/sources/contracts/MethodsExposureFacet.sol | Gets reward account information by address | function getRewardAccount(address _account)
public
view
returns (
address account,
int256 index,
int256 numInQueue,
uint256 withdrawableRewards,
uint256 totalRewards,
bool manualClaim
)
{
return (addr... | 5,017,322 |
./partial_match/1/0x99b57Abf76E69E52EfF39a5f876280d4B525119F/sources/contracts/cedar/drop/CedarERC721DropLogic.sol | Interpret empty string as unsetting tokenURI | function setTokenURI(
DropERC721DataTypes.ClaimData storage claimData,
uint256 _tokenId,
string memory _tokenURI
) public {
if (bytes(_tokenURI).length == 0) {
claimData.tokenURIs[_tokenId].sequenceNumber = 0;
return;
}
claimData.tokenURIs[... | 3,659,950 |
./full_match/1/0xd712A863766dE7e7cA13289A97997E01832A6571/sources/@mimic-fi/v2-smart-vaults-base/contracts/actions/OracledAction.sol | Extracts the number of feeds encoded in the extra calldata. This function returns bogus data if there is no extra calldata in place. The number of encoded feeds is encoded in the 4th word from the calldata end./ | function _getFeedsLength() private pure returns (uint256) {
return uint256(_decodeCalldataWord(3));
}
| 2,974,014 |
./full_match/100/0x1Cb33B22118d1e60545A5241fF187f737B21732c/sources/home/didi/src/artis2/artis2-launch-contracts/contracts/Artis2Launch.sol | After the end of the swapping period, the owner can withdraw remaining new tokens to a given address. | function withdrawRemainingNewTokensTo(address receiver)
external
onlyOwner
{
require(block.timestamp > SWAP_DISABLED_AFTER, "withdrawal not yet allowed");
newToken.transfer(receiver, newToken.balanceOf(address(this)));
}
| 14,272,677 |
./full_match/44787/0x5C3847f9CCa301232795CDd4Eb9732928B0CC916/sources/contracts/StarNFTLogic.sol | uint256 _rndCateIndex2; _rndCateIndex = uint256(keccak256(abi.encodePacked(block.coinbase, msg.sender, nonce, block.timestamp))) % (_cate.length -1); _rndCateIndex2 = uint256(keccak256(abi.encodePacked(block.coinbase, msg.sender, nonce, block.timestamp))) % (_cate.length -1) + 1; if (cateId[_cate[_rndCateIndex2]].maxUn... | function getRndCateIndex(StarLevel _level) view public returns (uint256) {
uint256[] storage _cate = starCate[_level];
require(_cate.length > 0, "no cate");
uint256 _rndCateIndex;
uint256 nonce;
do {
_rndCateIndex = uint256(keccak256(abi.encodePacked(block.coinbas... | 13,254,395 |
pragma solidity ^0.5.2;
library SafeMath {
function MUL803(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTAN... | inject NONSTANDARD NAMING | function TRANSFERFROM406(address from, address to, uint256 value) public returns (bool) { | 14,105,829 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
... | Get Seller Level HnIds Length/ | function getSellerLevelHnIdsLength(address seller, uint256 level)
external
view
returns (uint256)
{
return sellerLevelHnIds[seller][level].length();
}
| 908,918 |
pragma solidity ^0.4.25;
/**
* Kitsune Token Lockup
*/
contract Token {
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function a... | lock tokens/update balance in address | function lockTokens(address _tokenAddress, uint256 _amount, uint256 _unlockTime) public returns (uint256 _id) {
require(_amount > 0, 'token amount is Zero');
require(_unlockTime < 31536000, 'Enter an unix timestamp in seconds, not miliseconds');
require(Token(_tokenAddress).approve(this, _am... | 2,302,468 |
./full_match/1/0x23c9ba9A19a4F3Fcc7Fdd3899c79Ea5a1b42dCCE/sources/contracts/interfaces/ICommunityIssuance.sol | --- Events --- --- Functions --- | interface ICommunityIssuance {
event TotalMAHAIssuedUpdated(uint256 _totalMAHAIssued);
event RewardAdded(uint256 reward);
function issueMAHA() external returns (uint256);
function sendMAHA(address _account, uint256 _MAHAamount) external;
function lastTimeRewardApplicable() external view returns ... | 4,853,487 |
./full_match/1/0x8940fd30496bD58De8f574919f3A0382c378D842/sources/contracts/interfaces/IMerkleDistributor.sol | Allows anyone to claim a token if they exist in a merkle root. Returns true if the index has been marked claimed. Claim the given amount of the token to the given address. Reverts if the inputs are invalid. This event is triggered whenever a call to claim succeeds. | interface IMerkleDistributor {
function isClaimed(uint256 index) external view returns (bool);
function claim(
uint256 index,
address account,
uint256 amount,
bytes32[] calldata merkleProof
) external;
event Claimed(uint256 index, address account, uint256 amount);
pragm... | 9,801,234 |
./full_match/43113/0x28F5c190AE9F6E2C08b5C3ebd26b9d8da0E16c92/sources/Certifications.sol | returns the api Link of the dynamic certificate having id = `certificationID`. certificationID Id of the certificate./ | function getDynamicCertificateLink(uint256 certificationID) external view returns(string memory) {
return m_dynamicCertifications[certificationID]._apiLink;
}
| 13,209,220 |
./full_match/5/0x2500439FE503A1b9b51704BD9d8d91a2738150c0/sources/contracts/v7.sol | Function to return all restrictions for all users | function getRestrictions() public onlyOwner view returns (address[] memory, uint8[] memory, uint256[] memory) {
address[] memory accounts = new address[](_restrictedAccounts.length);
uint8[] memory restrictions = new uint8[](_restrictedAccounts.length);
uint256[] memory endDates = new uint25... | 1,892,548 |
pragma solidity 0.7.6;
//@dev - Chainlink VRF
import { VRFConsumerBase } from "@chainlink/contracts/src/v0.7/VRFConsumerBase.sol"; // Solidity-v0.7
//import { VRFConsumerBase } from "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol"; // Solidity-v0.8
//@dev - NFT (ERC721)
import { ERC721 } from "@openzeppelin/con... | overRideTokenIdToWeatherURI[tokenId] = tokenUri; | function setDiplomaURI(string memory diploma, string memory tokenUri, uint256 tokenId) public {
}
| 1,061,561 |
/*
This file is part of the DAO.
The DAO is free software: you can redistribute it and/or modify
it under the terms of the GNU lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The DAO is distributed in the hope that it ... | Refund `msg.sender` in the case the Token Creation did not reach its minimum fueling goal Execute refund its the recipients responsibilty to ensure their address does not use too much gas | function refund() noEther {
if (now > closingTime && !isFueled) {
if (msg.sender.send(balances[msg.sender])) {
Refund(msg.sender, balances[msg.sender]);
totalSupply -= balances[msg.sender];
balances[msg.sender] = 0;
}
}
}
| 7,212,582 |
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------------------------
//Bit Capital Vendor by BitCV Foundation.
// An ERC20 standard
//
// author: BitCV Foundation Team
contract ERC20Interface {
function totalSupply() public constant returns (uint256 _totalSupp... | Recover Tokens in case incorrect amount was sent to contract. Transfer all tokens on this contract back to the owner | function recoverFailedLock() external notLocked notAllocated onlyOwner {
require(token.transfer(owner, token.balanceOf(address(this))));
}
| 12,266,743 |
pragma solidity 0.6.6;
import "https://github.com/smartcontractkit/chainlink/blob/develop/evm-contracts/src/v0.6/interfaces/AggregatorInterface.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/SafeMath.sol";
/// @title Manage the backend of the Tetri0n game i.e. leaderbo... | Confirm an unconfirmed score to leaderboard/player. Adds unconfirmed to existing score. Player can not confirm his own score boardId The randomly generated boardId from the chainlink VRF playerAddress The name of the player who's score should be confirmed return true/false | function confirmBoardScore(uint256 boardId, address playerAddress) public returns (bool){
uint8 playerID = getPlayerId (boardId, playerAddress);
uint8 confirmerID = getPlayerId (boardId, msg.sender);
boards[boardId].players[playerID].score += boards[boardId].players[playerID].score_unconfirm... | 6,435,478 |
pragma solidity ^0.4.23;
// For safe math operations
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
assert(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function mu... | transfer tokens approved to spend | function transferFrom(address _from, address _to, uint _tokens) public returns (bool success){
require(_tokens > 0);
balances[_from] = balances[_from].sub(_tokens);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_tokens);
balances[_to] = balances[_to].add(_token... | 15,788,058 |
./full_match/44787/0x6B21Af6aA0F656A4ea1b2Db85A676cF33E67711E/sources/src/SpiralsStaking.sol | Activates pending votes (if ready) with a given validator group. all pending -> active for this group | function activate() external {
IElection c_election = getElection();
require(
c_election.hasActivatablePendingVotes(
address(this),
validatorGroup
),
"NOT_READY_TO_ACTIVATE"
);
uint256 pendingVotes = getElection().ge... | 13,246,279 |
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* ... | Swap an existent artwork from bitmark to ERC721 The range of _editionNumber should be between 0 (AP) ~ artwork.editionSize | function swapArtworkFromBitmark(
uint256 _artworkID,
uint256 _bitmarkID,
uint256 _editionNumber,
address _owner,
string memory _prevProvenance,
string memory _ipfsCID
) public onlyAuthorized {
Artwork memory artwork = artworks[_artworkID];
require(... | 6,186,755 |
./partial_match/42220/0x9de4171EDc1F69EAD07f7595bD3beD62d9215532/sources/contracts/CToken.sol | Payer supplies assets into the market and receiver receives cTokens in exchange Assumes interest has already been accrued up to the current block payer The address of the account which is paying the underlying token receiver The address of the account which is receiving cToken mintAmount The amount of the underlyin... | function mintBehalfFresh(address payer, address receiver, uint mintAmount) internal returns (uint, uint) {
require(receiver != address(0), "receiver is invalid");
uint allowed = comptroller.mintAllowed(address(this), receiver, mintAmount);
if (allowed != 0) {
return (failOpaque(E... | 3,495,170 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.