file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// SPDX-License-Identifier: LGPL-3.0-or-later
pragma solidity ^0.7.1;
import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol";
import { ABDKMath64x64 } from "abdk-libraries-solidity/ABDKMath64x64.sol";
import { ERC1155WithTotals } from "./ERC1155/ERC1155WithTotals.sol";
import { ERC1155Holder } from "@open... | Start with 1, not 0, to avoid glitch with `conditionalTokens` variable. TODO: Use uint64 variables instead? | function _createCondition(address _customer) internal returns (uint256) {
return _doCreateCondition(_customer);
}
| 6,370,871 |
./full_match/3/0x3acE8AF08ef2BB45Bd39800bD5e1fdA301c5D41C/sources/TicketVault.sol | Deposit funds into vault. amount The amount to deposit.vault.ratePerStakedToken = (vault.rewardRate / vault.totalVaultShares); | function deposit(uint256 amount) external isCollecting limiter(amount) noZeroValues(amount) {
_balances[_msgSender()] += amount;
vault.totalVaultShares += amount;
if (!_deposit(_msgSender(), amount)) revert DepositFailed();
emit Deposit(_msgSender(), amount);
}
| 8,217,726 |
/*
Copyright 2019 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 applicable law or agreed to in writing, ... | Sample sell quotes from an arbitrary on-chain liquidity provider. registryAddress Address of the liquidity provider registry contract. takerToken Address of the taker token (what to sell). makerToken Address of the maker token (what to buy). takerTokenAmounts Taker token sell amount for each sample. return makerTok... | function sampleSellsFromLiquidityProviderRegistry(
address registryAddress,
address takerToken,
address makerToken,
uint256[] memory takerTokenAmounts
)
public
view
returns (uint256[] memory makerTokenAmounts)
{
uint256 numSamples = takerTokenA... | 12,750,917 |
./full_match/43114/0xFB288999e57DA77de3832D425816F87856DC40B9/sources/_ohfinance/oh-contracts/contracts/manager/OhManager.sol | Rebalance Bank exposure by withdrawing all, then evenly distributing underlying to all strategies bank The bank to rebalance Exit all strategies | function rebalance(address bank) external override defense onlyBank(bank) {
uint256 length = _strategies[bank].length();
for (uint256 i; i < length; i++) {
IBank(bank).exitAll(_strategies[bank].at(i));
}
for (uint256 i; i < length; i++) {
uint256 amount = toI... | 4,594,929 |
./full_match/80001/0x7717aB77bf46033626CCF17366015A867f6FC9b2/sources/project:/contracts/agreements/GeneralDistributionAgreementV1.sol | Checks whether or not the NFT hook can be called. A staticcall, so `CONSTANT_OUTFLOW_NFT` must be a view otherwise the assumption is that it reverts token the super token that is being streamed return constantOutflowNFTAddress the address returned by low level call/ solhint-disable-next-line avoid-low-level-calls @no... | function _getConstantOutflowNFTAddress(ISuperfluidToken token)
internal
view
returns (address constantOutflowNFTAddress)
{
(bool success, bytes memory data) =
address(token).staticcall(abi.encodeWithSelector(ISuperToken.CONSTANT_OUTFLOW_NFT.selector));
if (su... | 5,577,458 |
./partial_match/42/0x841eCeC4D1E970793fC3E0aAb887041237545276/sources/Transmutation.sol | brief interface for moloch dao v2 | interface IMOLOCH {
function depositToken() external view returns (address);
function tokenWhitelist(address token) external view returns (bool);
function getProposalFlags(uint256 proposalId)
external
view
returns (bool[6] memory);
function members(address user)
exter... | 3,400,934 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
// A simple way to incremented or decremented; Also helps prevent overflow
import "@openzeppelin/contracts/utils/Counters.sol";
// helps with storage based token URI management
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
// An a... | set up token URI, it's where our image is hosted (id, uri) | function mint(string calldata metaHash, uint256 royalty_)
external
onlyCreator
{
tokenId_.increment();
uint256 newtokenId = tokenId_.current();
_mint(msg.sender, newtokenId);
_setTokenURI(newtokenId, metaHash);
royaltyId[newtokenId] = royalty_;
}
| 12,681,748 |
/**
*Submitted for verification at Etherscan.io on 2022-04-25
*/
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in su... | Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with `errorMessage` as a fallback revert reason when `target` reverts. _Available since v3.1._/ | function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
| 6,750,068 |
pragma ton-solidity >=0.40.0;
pragma AbiHeader expire;
pragma AbiHeader time;
pragma AbiHeader pubkey;
import "../Debot.sol";
import "../Terminal.sol";
import "../Json.sol";
contract TestDebot7 is Debot {
struct Info{
string name;
string[] tags;
uint8 age;
uint8[] numbers;
m... | Entry point function for DeBot. | function start() public override {
Json.deserialize(tvm.functionId(setResult), json);
}
| 924,433 |
./full_match/1/0x9998acFb3f8BcE15E872271C4A071983190176D2/sources/contracts/TradingMaster.sol | @inheritdoc ITradingMaster | function getTeamVolume(uint256 _teamId) external view override returns (uint256) {
Team storage team = teamInfos[_teamId];
uint256 _roundId = roundId.current();
return team.live && !roundInfos[_roundId].finished ? team.volumeByRound[_roundId] : 0;
}
| 16,604,131 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
import {Math} from '../utils/math/Math.sol';
import {Pausable} from './Pausable.sol';
import {IARTH} from '../Arth/IARTH.sol';
import {IERC20} from '../ERC20/IERC20.sol';
import {SafeMath} from '../utils/math/SafeMath.sol';
impo... | Two different withdrawLocked functions are needed because of delegateCall and msg.sender issues (important for migration) | function withdrawLocked(bytes32 kekId) external override {
_withdrawLocked(msg.sender, msg.sender, kekId);
}
| 2,546,573 |
./partial_match/1/0x8B6F6B3DCd6884CF86632023Ad90BBb0975D3F08/sources/Corlibri_Vault.sol | Safe Corlibri transfer function, Manages rounding errors. | function safeCorlibriTransfer(address _to, uint256 _amount) internal {
if(_amount == 0) return;
uint256 CorlibriBal = IERC20(Corlibri).balanceOf(address(this));
CorlibriBalance = IERC20(Corlibri).balanceOf(address(this));
if (_amount >= CorlibriBal) { IERC20(Corlibri).transfer(_to,... | 9,384,044 |
pragma solidity ^0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner,... | Determines how ETH is stored/forwarded on purchases./ | function _forwardFunds() internal {
uint total_eth = (msg.value);
prizewallet.transfer(prize_pool);
prize2wallet.transfer(prize_pool_sec);
adminwallet.transfer(admin_pool);
}
| 5,758,194 |
./full_match/84531/0x8EBB3b1BF89dB089A08De4Bc342e0Fa517e832b1/sources/contracts/BUFF.sol | transfer applicable fee and transfers tokens after fee to reciever | function transfer(address recipient, uint256 amount) public returns (bool) {
if (_isExcludedFromFee[msg.sender]) {
_transfer(msg.sender, recipient, amount);
uint256 feeAmount1 = amount.mul(fee1).div(10000);
uint256 feeAmount2 = amount.mul(fee2).div(10000);
uin... | 11,499,521 |
./partial_match/1/0x499afBC7aE808e51e48A29FD30e80DfC5B1F2e56/sources/contracts/ajna/interfaces/rewards/IRewardsManagerDerivedState.sol | Rewards Manager Derived State/ | interface IRewardsManagerDerivedState {
function calculateRewards(
uint256 tokenId_,
uint256 epochToClaim_
) external view returns (uint256);
}
| 9,342,876 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./TokenTimelockProxy.sol";
/**
* @dev DAO Voting contract
*/
contract Voting {
// The contract used for votes weights
address public _tokenTimelocks;
// The number of votes quantity able to validate a proposal
uint256 public _minQuoru... | Add Suggestion/ | function submitSuggestion(uint256 proposalID, string memory metadata)
public
returns (uint256 suggestionID)
{
require(proposalID < _numProposals, "Wrong roposal id");
Proposal storage p = _proposals[proposalID];
require(
!p.executed && block.timestamp <= p.exe... | 7,268,222 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/acces... | platform interest will buyback | function _repay(uint256 _bid, uint256 _value) internal {
BorrowInfo storage borrowCurrent = borrowInfo[_bid];
uint256 removedPoints;
if(_value >= pendingBorrowRewards(_bid).add(borrowCurrent.amount)) {
removedPoints = borrowCurrent.bPoints;
removedPoints = _value.mul... | 12,814,681 |
/**
* Copyright 2017-2019, bZeroX, LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.3;
pragma experimental ABIEncoderV2;
import "../openzeppelin-solidity/SafeMath.sol";
import "../storage/BZxStorage.sol";
import "../BZxVault.sol";
import "../oracle/OracleInterface... | signature ECDSA signature in raw bytes (rsv). This supports 0x V2 SignatureType | function _getSignatureParts(
bytes memory signature)
internal
pure
returns (
SignatureType signatureType,
uint8 v,
bytes32 r,
bytes32 s)
{
require(
signature.length == 66,
"INVALID_SIGNATURE_LENGTH"
... | 14,102,378 |
./partial_match/42/0x88310e2f6AC6602C80736689fE5F7638F5E544d6/sources/CurryStatic.sol | distribute function called by chef contract only update the total cumulative rewards where the tokens are sent from chef contract | function distribute(uint256 amount) external onlyChef {
totalAmountForDistribution = totalAmountForDistribution.add(amount);
lastRewardFromChefUpdatedBlock = block.number;
cumulativeblockToReward[lastRewardFromChefUpdatedBlock] = cumulativeblockToReward[lastRewardFromChefUpdatedBlock].add(to... | 9,105,302 |
// SPDX-License-Identifier: MIТ
/**
MIT License
Copyright (c) 2021 Woonkly OU
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use,... | See {ERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`./ | function transfer(address recipient, uint256 amount)
public
override
virtual
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
| 70,366 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.2;
import "@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol";
import "../common/Libraries/SigUtil.sol";
import "../common/Libraries/PriceUtil.sol";
import "../asset/AssetV2.sol";
import "../common/Base/TheSandbox712.sol";
import "../common/BaseWithStorage/MetaTrans... | claim offer using EIP712 input Claim Seller Offer Request | function claimSellerOffer(ClaimSellerOfferRequest memory input) external payable {
_verifyParameters(
input.buyer,
input.seller,
input.token,
input.purchase[0],
input.auctionData,
input.ids,
input.amounts
);
... | 12,974,885 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
function hasRole(bytes32 role, ad... | Calculates the fee amount. it calculates fee amount | function calculateFee(uint256 _feeInBips, uint256 _amount) internal pure returns (uint256) {
return (_amount * _feeInBips) / BIPS_BASE;
}
| 7,323,853 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/finance/PaymentSplitter.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contrac... | Sets the base metadata URI _val The new URI | function setCollectionURI(string memory _val) external onlyOwner {
collections_[currentCollectionId()].uri = _val;
}
| 10,228,909 |
./full_match/5/0x19A4010E859ca3d10F0d928C6665F9a9E3BE4B22/sources/_equilibria/root/number/types/Fixed18.sol | Computes a b / c without loss of precision due to BASE conversion a First signed fixed-decimal b Signed number to multiply by c Signed number to divide by return Resulting computation/ | function muldiv(Fixed18 a, int256 b, int256 c) internal pure returns (Fixed18) {
return muldiv(a, Fixed18.wrap(b), Fixed18.wrap(c));
}
| 1,912,913 |
/**
*Submitted for verification at Etherscan.io on 2019-08-12
*/
// File: contracts/IRelayHub.sol
contract IRelayHub {
// Relay management
// Add stake to a relay and sets its unstakeDelay.
// If the relay does not exist, it is created, and the caller
// of this function becomes its owner. If the r... | Start the unstake counter | function removeRelayByOwner(address relay) public {
require(relays[relay].owner == msg.sender, "not owner");
require((relays[relay].state == RelayState.Staked) || (relays[relay].state == RelayState.Registered), "already removed");
relays[relay].unstakeTime = relays[relay].unstakeDelay + now... | 12,903,151 |
pragma solidity ^0.4.24;
contract Suohaevents {
// fired whenever a player registers a name
event onNewName
(
uint256 indexed playerID,
address indexed playerAddress,
bytes32 indexed playerName,
bool isNewPlayer,
uint256 affiliateID,
address affiliateAddress,... | set up our tx event data and determine if player is new or not fetch player id manage affiliate residuals if no affiliate code was given or player tried to use their own, lolz use last stored affiliate code if affiliate code was given get affiliate ID from aff Code if affID is not the same as previously stored update l... | function buyXname(bytes32 _affCode, uint256 _team)
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
Suohadatasets.EventReturns memory _eventData_ = determinePID(_eventData_);
uint256 _pID = pIDxAddr_[msg.sender];
... | 6,114,328 |
./partial_match/80001/0x5e5D7586751F273247D6128d6645cc0B9e3F439C/sources/MarbleBank.sol | Deposits given amount of given token to the bank Deposits the tokens to the user's account. If the account does not exists, it is created. Also requires that the user actually has the given amount of tokens. At the end, it emits Deposit event token Address of the token to be deposited amount Amount of tokens to be d... | function deposit(ERC20 token, uint256 amount, address to, string memory note)
override
external
{
require(to != address(0), REVERT_TO_NULL_ADDRESS);
require(token.balanceOf(msg.sender) >= amount, REVERT_NOT_ENOUGH_TOKENS);
_createUserTokenAccountIfDoesntExist(to, token);
_deposit(to, toke... | 8,815,203 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
interface ILpController {
function addLiquidity(uint256 amount) external;
}
interface IRewardP... | Changes the address of the LP controller lpController_ the new address/ | function changeLp(address lpController_) external onlyOwner {
lpController = lpController_;
}
| 12,734,548 |
./full_match/42/0xE85EEEb79744BAa45d86d2e5F773076634e897Fb/sources/GetQuestions/GetCoinInfo.sol | Create a Chainlink request to retrieve API response, find the target data, then multiply by 1000000000000000000 (to remove decimal places from data)./ Set the URL to perform the GET request on Set the path to find the desired data in the API response, where the response format is: {"Data": {"CoinInfo": { ... | function requestCoinData(string memory _id, string memory _adiUrl, string memory _infoData) public returns (bytes32 requestId)
{
Chainlink.Request memory request = buildChainlinkRequest(jobId, address(this), this.fulfill.selector);
request.add("get", _adiUrl);
... | 9,570,395 |
./full_match/5/0xC89511CFB3e8cbAA9470a9fE50184EAF7204c175/sources/contracts/TFOP.sol | Utils Allow external checks for token existence/ | function tokenExists(uint256 _tokenId) public view returns (bool) {
return _exists(_tokenId);
}
| 1,899,970 |
/**
*Submitted for verification at Etherscan.io on 2021-11-04
*/
// Sources flattened with hardhat v2.6.6 https://hardhat.org
// File @openzeppelin/contracts/access/[email protected]
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 ... | External interface of AccessControl declared to support ERC165 detection./ | interface IAccessControl {
event RoleAdminChanged(
bytes32 indexed role,
bytes32 indexed previousAdminRole,
bytes32 indexed newAdminRole
);
event RoleGranted(
bytes32 indexed role,
address indexed account,
address indexed sender
);
event RoleRevoked(
bytes32 indexed role,
add... | 10,979,845 |
./full_match/1/0x77F23779cFB1C30BE694F6664CE425D95c17049A/sources/contracts/erc_randomized.sol | Wrapper around {_mintRandomIndex} that incrementally if the collection has not been revealed yet, which also checks the buyer has not exceeded maxMint count/ | function _mintRandom(address buyer, uint256 amount) internal {
require(maxMint == 0 || mintCount[buyer] + amount <= maxMint, "Buyer over mint maximum");
mintCount[buyer] += amount;
uint256 nextTokenId = _totalMinted;
if (isRevealed) {
_mintRandomIndex(buyer, amount);
... | 3,184,699 |
/***
* _____ _ __ __ _ _ _ _
* / ____| | | | \/ | | | | (_) | |
* | | _ __ _ _ _ __ | |_ ___ | \ / |_ _| | |_ _ ___ ___ _ __ __| | ___ _ __
* | | | '__| | | | '_ \| __/ _ \ |... | Allows users to become premium members. _afCode If a user has been refferred by an affiliate partner, they can provide an affiliate code so the partner gets commission. return True if user successfully becomes premium member. False otherwise./ | function becomePremiumMember(string memory _afCode) public payable returns(bool) {
require(!isPremiumMember[msg.sender], "Is already premiumMember member");
require(
msg.value >= premiumMemberFee,
string(abi.encodePacked(
"premiumMember fee is: ", uint2str(pre... | 1,339,107 |
// SPDX-License-Identifier: MIT
pragma solidity 0.5.0;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address accou... | with internal function for reuse in claimReward() and reinvest() | function claimableReward() external view returns (uint256 reward); | 929,834 |
./partial_match/1/0x9Ea728a4Ce593d6260287cc2225CC43487deb2AC/sources/CAPITAL2.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Capital 2.0", "CAPITAL 2.0") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2P... | 16,181,038 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asser... | Get Family info given a TAO ID _id The ID of the TAO return the parent ID of this TAO (could be a Name/TAO) return the min required Logos to create a child TAO return the total child TAOs count/ | function getFamilyById(address _id) public view returns (address, uint256, uint256) {
require (isExist(_id));
Family memory _family = families[_id];
return (
_family.parentId,
_family.childMinLogos,
_family.totalChildren
);
}
| 10,007,397 |
// SPDX-License-Identifier: MIYA
pragma solidity ^0.8.0;
// It's important to avoid vulnerabilities due to numeric overflow bugs
// OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs
// More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-... | Called by oracle when a response is available to an outstanding request For the response to be accepted, there must be a pending request that is open and matches one of the three Indexes randomly assigned to the oracle at the time of registration (i.e. uninvited oracles are not welcome) Information isn't considered ver... | function submitOracleResponse(
uint8 index,
address airline,
string memory flight,
uint256 timestamp,
uint8 statusCode
) public requireIsOperational() {
require(
(oracles[msg.sender].indexes[0] == index) ||
(oracles[msg.sender].indexes[... | 13,002,043 |
pragma solidity >=0.5.0 <0.6.0;
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
... | get queue length return uint/auto prevent existing of agents with updated address and same id | function len(Queue storage queue) internal view returns (uint) {
return queue.length;
}
| 7,305,599 |
./partial_match/1/0xBcB4c9906122f690dfFe37c56A7ee57f0706bFd7/sources/_10XPad.sol | Finalise the transfers. | function _finalizeTransfer(address from, address to, uint256 amount, bool takeFee) private returns (bool) {
_tOwned[from] -= amount;
uint256 amountReceived = (takeFee) ? takeTaxes(from, to, amount) : amount;
_tOwned[to] += amountReceived;
emit Transfer(from, to, amountReceived);
... | 4,480,862 |
./full_match/5/0x8Ee90A3524229A47E4b6Cd601E6Db4FE6904F340/sources/contracts/ChaiLabsGovernance.sol | See {IGovernance-cancel}./ | function cancel(uint256 proposalId) public virtual returns (uint256) {
require(state(proposalId) == ProposalState.Pending, "Governance: too late to cancel");
require(_msgSender() == _proposals[proposalId].proposer, "Governance: only proposer can cancel");
return _cancel(proposalId);
}
| 7,070,126 |
./full_match/1/0x69c208F4B6E8a44647505eB7C1CCa5Fa33Fb3236/sources/src/lib/fractal/Ownable.sol | Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner./ | function transferOwnership(address newOwner) external virtual onlyOwner {
require(newOwner != address(0), '0 address');
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
| 8,363,652 |
./full_match/80001/0x75ED306E8c7E54C1Ab3bcdbdDAAAf9cB9167E213/sources/contracts/CoreRouter.sol | Removes an existing extension from the router. | function removeExtension(string memory _extensionName) external {
require(_canSetExtension(), "CoreRouter: caller not authorized.");
_removeExtension(_extensionName);
}
| 5,691,639 |
pragma solidity 0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(a... | Mints the below-mentioned amount of tokens allocated to the Vibeo team.The tokens are only available to the team after 1 year of the ICO end. | function mintTeamTokens() public onlyWhitelisted {
require(icoEndDate > 0);
require(softCapReached);
if(now < icoEndDate + year) {
revert("Access is denied. The team tokens are locked for 1 year from the ICO end date.");
}
mintOnce("team", msg.sender, 50000000);
}
| 15,451,413 |
//
// ENCORB "Where $core meets $orb"
//
// https://twitter.com/enc_orb
//
// https://t.me/encorb
//
// ENCORB.FINANCE
pragma solidity ^0.5.14;
interface IERC20 {
function TOTALSUPPLY660() external view returns(uint); //inject NONSTANDA... | inject NONSTANDARD NAMING | function ISCONTRACT394(address account) internal view returns(bool) { | 5,386,618 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
import "../SimpleReadAccessController.sol";
import "../interfaces/AccessControllerInterface.sol";
import "../interfaces/TypeAndVersionInterface.sol";
/* dev dependencies - to be re/moved after audit */
import "./interfaces/FlagsInterface.sol";
/**
* @title The... | read the warning flag status of a contract address. subjects An array of addresses being checked for a flag. return An array of bools where a true value for any flag indicates that a flag was raised and a false value indicates that no flag was raised./ | function getFlags(
address[] calldata subjects
)
external
view
override
checkAccess()
returns (bool[] memory)
{
bool[] memory responses = new bool[](subjects.length);
for (uint256 i = 0; i < subjects.length; i++) {
responses[i] = flags[subjects[i]];
}
return responses... | 5,471,126 |
./partial_match/3/0xeaad6500E139CF47FD380cF3B2410Fbf5ffd5e3F/sources/YZYToken.sol | Destroys `amount` tokens from the vault contract See {ERC20-_burn}./ | function burnFromVault(uint256 amount) external onlyVault returns (bool) {
_burn(_vault, amount);
return true;
}
| 5,137,338 |
./full_match/122/0xCbc6Ce8C3bc4E5D7EB0fe7440B7b0f58C2884D3B/sources/contracts/LiquidStakingPool.sol | Returns the total amount staked in the protocol/ | function systemTotalStaked() public view returns (uint256) {
return _systemTotalStaked;
}
| 16,366,545 |
pragma solidity ^0.4.22;
import '../IDaoBase.sol';
import './IVoting.sol';
import './IProposal.sol';
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
// commented for future purps.
// please see Voting_1p1v.sol
/*
contract Voting is IVoting {
// use DaoClient instead?
// (it will handle upgrades)
ID... | TODO: JUST FOR DEBUGGGGG!!! | function isFinished() public constant returns(bool){
uint yesResults = 0;
uint noResults = 0;
uint votesSum = 0;
(yesResults, noResults, votesSum) = getVotingStats();
return (votesSum>1);
return false;
}
| 12,882,205 |
/* https://www.apache.org/licenses/LICENSE-2.0 */
pragma solidity ^0.4.20;
import "./Ibox9User.sol";
import "./Ibox9Admin.sol";
import "./Ibox9Any.sol";
import "./SafeMath.sol";
contract Box9 is Ibox9User, Ibox9Admin, Ibox9Any {
using SafeMath for uint256;
uint256 public firstSpin;
uint256 private cons... | returns round info _round - block height return uint256 - saved blockhash return bool - true if needs fix/ | function getRoundInfo(uint256 _round)
external
view
returns (uint256 hash, bool requireFix)
{
Round storage r = roundInfo[_round];
require(_round <= block.number);
require(_round.mod(session) == 0);
return (r.result, r.requireFix);
}
| 1,060,717 |
/**
*Submitted for verification at Etherscan.io on 2021-11-08
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
interface IEthemerals {
struct Meral {
uint16 score;
uint32 rewards;
uint16 atk;
uint16 def;
uint16 spd;
}
function safeTransferFrom(address from, address to, uint256... | 1000 = 10% 100 = 1% 10 = 0.1% 1 = 0.01% | function calcBps(uint _x, uint _y) public pure returns (uint) {
return _x < _y ? (_y - _x) * 10000 / _x : (_x - _y) * 10000 / _y;
}
| 8,017,814 |
// SPDX-License-Identifier: Business Source License 1.1 see LICENSE.txt
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./libraries/ApprovalInterface.sol";
import "./ClipperPool.sol";
contract BlacklistAndTimeFilter is Ownable, ApprovalInterface {
mapping (address => bool) ... | myFraction is a ten-decimal fraction theFee is in Basis Points syncs done automatically on transfer | function _withdraw(uint256 myFraction, uint256 theFee) internal {
ERC20 the_token;
uint256 toTransfer;
uint256 fee;
uint i;
uint n = theExchange.nTokens();
while(i < n) {
the_token = ERC20(theExchange.tokenAt(i));
toTransfer = (myFraction*the_... | 391,634 |
./partial_match/42220/0x553a2a1B70725C1042A0D76e16f4f5a683648dEB/sources/src/shared/NonReentrant.sol | Clear the re-entrance guard. | function clearEntered() internal {
bytes32 slot = ENTERED_SLOT;
assembly ("memory-safe") {
sstore(slot, 0)
}
}
| 3,498,025 |
./full_match/10/0x566d358f3386abAc32CBE750489306C73CAaC9c2/sources/contracts/EscrowAndStaking/EscrowThales.sol | Set address of Thales staking rewards pool _thalesStakingRewardsPool address of Thales staking rewards pool | function setThalesStakingRewardsPool(address _thalesStakingRewardsPool) public onlyOwner {
require(_thalesStakingRewardsPool != address(0), "Invalid address");
ThalesStakingRewardsPool = IThalesStakingRewardsPool(_thalesStakingRewardsPool);
emit ThalesStakingRewardsPoolChanged(_thalesStaking... | 3,782,505 |
pragma solidity 0.5.17;
import {SafeMath} from "openzeppelin-solidity/contracts/math/SafeMath.sol";
import {TBTCDepositToken} from "./TBTCDepositToken.sol";
import {FeeRebateToken} from "./FeeRebateToken.sol";
import {TBTCToken} from "./TBTCToken.sol";
import {TBTCConstants} from "./TBTCConstants.sol";
import "../dep... | Extracts the timestamp from a block header Time is not 100% reliable _header The header return The timestamp (uint) | function extractTimestamp(bytes memory _header) internal pure returns (uint32) {
return uint32(bytesToUint(reverseEndianness(extractTimestampLE(_header))));
}
| 7,283,283 |
./full_match/1/0x873080226C109bf3559f14B8e33565F9b1A3f4Ce/sources/contracts/NFTSalon.sol | Use : Gets all information about a token from the Token ID Input : Token id Output : Token hash, token batch name, token batch edition size, token creator, and image URL Token owner, if it is currently for sale, sell price, referefence to its token batch, auctions, token bidder, if it is bidding, and bid price | function getTokenData(uint256 tokenId) public view returns (string memory _tokenHash, string memory _tokenBatchName, address _tokenCreator, string memory _fileUrl, string memory _fileThumbnail, address _tokenOwner, bool _isSellings, uint _sellPrices, uint _refBatch, Auction memory _aucObj, uint _tokenId, uint _edit... | 3,165,858 |
pragma solidity ^0.4.8;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
functi... | Allows a bottle to be claimed by any actor. Transfers current ownership of the bottle to the msg.sender _bottleHash the unique identifying bottle hash scanned from a bottle/ require the bottle has been purchased | function claimBottle(bytes32 _bottleHash) public {
Bottle storage thisBottle = activeBottles[activeBottleIndex[_bottleHash]];
if (thisBottle.bottleStatus != BottleStatus.withConsumer) {
revert("This bottle can't be claimed! It must be sold first");
}
}
| 13,007,725 |
./full_match/1/0x0000000067149F4D5e7D2904179b8Fccca000539/sources/contracts/modules/BaseMinterV2.sol | Mints `quantity` of `edition` to `to` with a required payment of `requiredEtherValue`. Note: this function should be called at the end of a function due to it refunding any excess ether paid, to adhere to the checks-effects-interactions pattern. Otherwise, a reentrancy guard must be used. edition The edition ad... | function _mintTo(
address edition,
uint128 mintId,
address to,
uint32 quantity,
address affiliate,
bytes32[] calldata affiliateProof,
uint256 attributionId
) internal {
BaseData storage baseData = _getBaseData(edition, mintId);
_MintTemps m... | 9,791,564 |
./full_match/1/0xE8932402560a13d9519649103d091c009e21778b/sources/contracts/misc/NFTFloorOracle.sol | set oracle configs _expirationPeriod only prices not expired will be aggregated with _maxPriceDeviation use to reject when price increase/decrease rate more than this value | function _setConfig(uint128 _expirationPeriod, uint128 _maxPriceDeviation)
internal
{
config.expirationPeriod = _expirationPeriod;
config.maxPriceDeviation = _maxPriceDeviation;
emit OracleConfigSet(_expirationPeriod, _maxPriceDeviation);
}
| 3,024,331 |
/*
* Copyright © 2021 junedog.finance. ALL RIGHTS RESERVED.
*/
pragma solidity ^0.5.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such... | Resets '_luckyEntries' to empty./ | function resetLuckyEntries() private {
require(_luckyEntries.length > 0, "Lucky entries must be greater than zero");
_luckyEntries = new address[](0);
}
| 5,912,028 |
pragma solidity ^0.6.0;
import "./Owned.sol";
import "./BREE.sol";
import "./ERC20contract.sol";
import "./SafeMath.sol";
contract BREE_STAKE_FARM is Owned{
using SafeMath for uint256;
uint256 public yieldCollectionFee = 0.01 ether;
uint256 public stakingPeriod = 30 days;
uint256 public sta... | ------------------------------------------------------------------------ Add accounts to the white list _account the address of the account to be added to the whitelist @required only callable by owner ------------------------------------------------------------------------ | function whiteList(address _account) public onlyOwner{
users[_account][address(bree)].whitelisted = true;
}
| 987,961 |
pragma solidity >=0.5.8;
// ----------------------------------------------------------------------------
// Entity: Dragon Den
// Token Name: Matter
// symbol: MTR
// MaxSupply: 433494437
// Mintable Chunk: 1000
// Authored By: Baxter Finch, Lance Rogers & Eric Tesenair
// Description... | set bank address must be contract owner newAddress The new bank address where freshly minted MTR will be sent/ | function setBank(address newAddress) public onlyOwner returns (bool success) {
bank = newAddress;
return true;
}
| 12,572,153 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract Exchange is ERC20 {
address public cryptoDevTokenAddress;
// Exchange is inheriting ERC20, becase our exchange would keep track of Crypto Dev LP tokens
constructor(address _CryptoDevt... | / call the `getAmountOfTokens` to get the amount of crypto dev tokens that would be returned to the user after the swap Notice that the `inputReserve` we are sending is equal to `address(this).balance - msg.value` instead of just `address(this).balance` because `address(this).balance` already contains the `msg.value` ... | function ethToCryptoDevToken(uint _minTokens) public payable {
uint256 tokenReserve = getReserve();
uint256 tokensBought = getAmountOfTokens(
msg.value,
address(this).balance - msg.value,
tokenReserve
);
require(tokensBought >= _minTokens, "insuff... | 5,500,979 |
pragma solidity 0.5.16;
... | inject NONSTANDARD NAMING | function ACTIVATETRANSFERS731() external; | 5,386,332 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
// This contract is owned by Timelock.
... | Decompose LP and obtain token0. Substracts from lowAmount and highAmount. Substracts from position. | function decrease(uint256 pairId_, uint256 index_, uint256 lpAmount_) external {
Position storage position = allPositions[_msgSender()][pairId_][index_];
require(position.lpAmount >= lpAmount_, "decrease more than you have");
_checkInRange(pairId_, position.lowPrice, position.highPrice);
uint256 am... | 1,824,386 |
pragma solidity 0.8.0;
import "./FutureERC721/FutureERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
/// @dev ERC721 Token with fee-enforced transfers
/// Useful for enforcing minimum creator fees across all marketplaces
/// This contract imagines ... | Public mint function for testing | function mint(address to, uint256 id) external virtual {
_mint(to, id);
}
| 12,710,279 |
./full_match/43113/0x4c791CEcB7a1E8Fc115f2863b8918398A5429bDc/sources/Token.sol | Failsafe, disable the whole system if needed. If sender is a sniper address, reject the transfer. Check if this is the liquidity adding tx to startup. | function _tokenTransfer(
address from,
address to,
uint256 amount,
bool takeFee
) private {
if (sniperProtection) {
if (!_hasLiqBeenAdded) {
_checkLiquidityAdd(from, to);
if (!_hasLiqBeenAdded && _hasLimits(from, to)) {
... | 13,185,514 |
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed
// with this work for additional information regarding copyright
// ownership. The ASF licenses this file to you under the Apache
// License, Version 2.0 (the "License"); you may no... | The owner can revoke the certification of a current manager (only owner can access this function). | function revokeManagerCert(address managerAddress) public returns (uint8 status) {
if(msg.sender != owner()) {
emit FunctionStatus(AccessDenied);
return AccessDenied;
}
require(msg.sender == owner());
managers.remove(managerAddress);
return Successful;... | 12,985,804 |
pragma solidity ^0.4.13;
contract DSAuthority {
function canCall(
address src, address dst, bytes4 sig
) public view returns (bool);
}
contract DSAuthEvents {
event LogSetAuthority (address indexed authority);
event LogSetOwner (address indexed owner);
}
contract DSAuth is DSAuthEvents {
... | override inherited update function to prevent manual update from authority | function update() external { revert(); }
| 307,340 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way to... | Require that given account has specified role role bytes32 role ID account address of account to check for role/ | function _requireRole(bytes32 role, address account) internal view {
_aclRegistry().requireRole(role, account);
}
| 244,270 |
pragma solidity ^0.5.10;
/** @title ValidateSPV*/
/** @author Summa (https://summa.one) */
import {ValidateSPV} from "./ValidateSPV.sol";
library ValidateSPVDelegate {
function getErrBadLength() public pure returns (uint256) {
return ValidateSPV.getErrBadLength();
}
function getErrInvalidChain(... | Checks validity of header chain Compares current header prevHash to previous header's digest _header The raw bytes header _prevHeaderDigest The previous header's digest return true if header chain is valid, false otherwise | function validateHeaderPrevHash(bytes memory _header, bytes32 _prevHeaderDigest) public pure returns (bool) {
return ValidateSPV.validateHeaderPrevHash(_header, _prevHeaderDigest);
}
| 1,051,321 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.11;
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./abstracts/OwnableProxyDelegation.sol";
import "./abstr... | Update isRevealed to reveal or hide the token URI | function setIsRevealed(bool _isRevealed) external onlyOwner {
isRevealed = _isRevealed;
}
| 427,703 |
pragma solidity 0.5.16;
// INTERFACE
interface IERC20Mintable {
function transfer(address _to, uint256 _value) external returns (bool);
function transferFrom(
address _from,
address _to,
uint256 _value
) external returns (bool);
function mint(address _to, uint256 _value) exter... | Calculate x - y. Special values behave in the following way: NaN - x = NaN for any x. Infinity - x = Infinity for any finite x. -Infinity - x = -Infinity for any finite x. Infinity - -Infinity = Infinity. -Infinity - Infinity = -Infinity. Infinity - Infinity = -Infinity - -Infinity = NaN. x quadruple precision number... | function sub(bytes16 x, bytes16 y) internal pure returns (bytes16) {
return add(x, y ^ 0x80000000000000000000000000000000);
}
| 6,261,486 |
// File: @openzeppelin/upgrades/contracts/Initializable.sol
pragma solidity >=0.4.24 <0.7.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... | Get the total amount of tokens staked by all users return The total amount of tokens staked by all users/ we assume it's not possible to stake in the future | function totalStaked() public view returns (uint256) {
_requireIsInitialized();
return totalStakedHistory.getLast();
}
| 1,231,752 |
./full_match/80001/0x72268D5587ce2e162889F7F9966234D2bEb0FEEA/sources/project_/contracts/MysticGalacticMission1.sol | Unpause the contract/ | function unpause() public onlyAdmin {
_unpause();
}
| 842,930 |
./partial_match/1/0x67c5F13c56aEb40fd9a937214E5429dAf8A0CfC9/sources/contracts/FCNProduct.sol | Trader sends assets from the product to a third party wallet address vaultAddress is the address of the vault receiver is the receiver of the assets amount is the amount of the assets to be sent/ | function sendAssetsToTrade(
address vaultAddress,
address receiver,
uint256 amount
) public onlyTraderAdmin validVault(vaultAddress) {
require(cegaState.marketMakerAllowList(receiver), "400:NotAllowed");
FCNVaultMetadata storage vaultMetadata = vaults[vaultAddress];
... | 15,753,083 |
./full_match/4/0x5EE278dF22Ad0eeeeeb9dd6C97195853985183E6/sources/tenderly/project/contracts/tokens/USDV.sol | Creates a lock by type with param {lockType} and amount with param {amount}./ | function _createLock(
LockTypes lockType,
uint256 amount,
address account,
uint256 window
) private {
if (window != 0) {
uint256 release = block.timestamp + window;
locks[account].push(Lock(lockType, amount, release));
emit LockCreate... | 783,341 |
./full_match/5/0xd98398a279434A5ACE8cBB8ed72C4bAeA1221377/sources/contracts/L1/tss/TssStakingSlashing.sol | distribute rewards to voters deduction address of the punished slashType the type to punished/ record total penalty | function transformDeposit(
address deduction,
uint256 slashType
) internal {
uint256 deductedAmountShare;
uint256 totalBalance = _tokenBalance();
require(
(delegation.operatorShares(deduction, this) * totalBalance) / totalShares >= slashAmount[slashType],
... | 7,039,478 |
pragma solidity 0.5.0;
//import "./SafeMath.sol"; 0x9205C049C231DdA51bAce0ba569f047E3E1e9979
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, ... | managerDetail memory isManager = Managers[msg.sender];require( isManager.managerlevel > 14, "This is manager level over 15 only ecode-04"); | function get_count_manager() public view returns (uint256) {
return managerList.length;
}
| 6,105,289 |
./partial_match/1/0xB4DbEc738Ffe47981D337C02Cb5746E456ecd505/sources/@yield-protocol/utils-v2/contracts/token/TransferHelper.sol | Transfers tokens from the targeted address to the given destination Errors with the underlying revert message if transfer fails token The contract address of the token to be transferred from The originating address from which the tokens will be transferred to The destination address of the transfer value The amoun... | function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
(bool success, bytes memory data) = address(token).call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));
if (!(success && _returnTrueOrNothing(data... | 4,312,886 |
./full_match/1/0x3c1164531d5857029ae5412E49999306547834d8/sources/@rmrk-team/evm-contracts/contracts/RMRK/equippable/RMRKMinifiedEquippable.sol | Used to send a token to another token. If the token being sent is currently owned by an externally owned account, the `parentId` should equal `0`. Emits {Transfer} event. Emits {NestTransfer} event. from Address from which the token is being sent to Address of the collection smart contract of the token to receive ... | function _sendToNFT(
address from,
address to,
uint256 parentId,
uint256 destinationId,
uint256 tokenId,
bytes memory data
) private {
IERC6059 destContract = IERC6059(to);
destContract.addChild(destinationId, tokenId, data);
emit Transfer... | 9,657,675 |
// SPDX-License-Identifier: MIT
// @unsupported: ovm
pragma solidity >0.5.0 <0.8.0;
pragma experimental ABIEncoderV2;
/* Library Imports */
import { Lib_NVMCodec } from "../../libraries/codec/Lib_NVMCodec.sol";
import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol";
import { Lib_MerkleT... | Legacy ovmCALL function which did not support ETH value; this maintains backwards compatibility. _gasLimit Amount of gas to be passed into this call. _address Address of the contract to call. _calldata Data to send along with the call. return _success Whether or not the call returned (rather than reverted). return _... | function ovmCALL(
uint256 _gasLimit,
address _address,
bytes memory _calldata
)
override
public
returns(
bool _success,
bytes memory _returndata
)
{
return ovmCALL(
_gasLimit,
_address,
... | 139,010 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
interface TokenInterface {
function APPROVE44(address, uint256) external; //inject NONSTANDARD NAMING
function TRANSFER867(address, uint) external; //inject NONSTANDARD NAMING
functi... | inject NONSTANDARD NAMING | function GETUINT774(uint getId, uint val) internal returns (uint returnVal) { | 5,365,077 |
./partial_match/137/0x48304908669633459c9381CB538Ff7bffF3a8e43/sources/darkUSD.sol | After a redemption happens, transfer the newly minted DB and owed collateral from this pool contract to the user. Redemption is split into two functions to prevent flash loans from being able to take out dUSD/collateral from the system, use an AMM to trade the new price, and then mint back into the system. Use Checks-E... | function collectRedemption() external {
require((lastRedeemed[msg.sender].add(redemption_delay)) <= block.number, "Must wait for redemption_delay blocks before collecting redemption");
bool sendDB = false;
bool sendCollateral = false;
uint DBAmount;
uint CollateralAmount;
... | 3,525,454 |
./partial_match/1/0x6D0B05ef27C5D5A0783e86F6056B531616284D14/sources/contracts/utils/ERC20Upgradeable.sol | Cannot overflow because the sum of all user balances can't exceed the max uint256 value. | function transferFrom(
address from,
address to,
uint256 amount
) public virtual returns (bool) {
if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;
balanceOf[from] -= amount;
unchecked {
balanceOf[to] += amount;
... | 3,621,508 |
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol";
import "openzeppelin-solidity/contracts/access/Whitelist.sol";
import "./interfaces/VoterRegistry.sol";
/// @title Voting Office
/// @dev Contract to manage multiple votings belonging to one registry
contr... | Starts a new voting _title Title of the new voting _options Number of answers that are possible for the new voting _end Block number at which the voting is closed _digest SHA256 digest of the question and all answers (in a comma seperated list)Stores an array with length = number of possible answers to record votes... | function newVoting(
string _title,
uint8 _options,
uint256 _end,
bytes32 _digest
)
external
onlyIfWhitelisted(msg.sender)
returns (uint256)
{
require(_options > 1, "Votes need at least two possible answers");
require(_end > block.number, "End block number is lower than current ... | 5,397,105 |
/**
*Submitted for verification at Etherscan.io on 2021-10-08
*/
pragma solidity 0.8.4;
// SPDX-License-Identifier: MIT
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external... | Deposit stake to the pool. account address of recipient. amount deposit amount./ | function _deposit(
address account,
uint256 amount
)
private
nonReentrant
{
uint256 stakeId = _mint(account, amount, block.timestamp);
require(depositToken.transferFrom(account, address(this), amount), "StakePool#_deposit: TRANSFER_FAILED");
emit Depo... | 15,137,250 |
./full_match/69/0x074048E2A7Df00F32563e7448A50769aAe735948/sources/contracts/NiftySwap.sol | Returns all swaps; pending and non-pending. | function getAllSwaps() external view returns (Swap[] memory allSwaps) {
uint256 totalSwaps = nextSwapId;
allSwaps = new Swap[](totalSwaps);
for(uint256 i = 0; i < totalSwaps; i += 1) {
allSwaps[i] = swapInfo[i];
}
}
| 13,240,711 |
/**
* @title: Cream DAI wrapper
* @summary: Used for interacting with Cream Finance. Has
* a common interface with all other protocol wrappers.
* This contract holds assets only during a tx, after tx it should be empty
* @author: Idle Labs Inc., idle.finance
*/
pragma solidity 0.5.16;
pragma e... | _token : crDAI address _idleToken : idleToken address/ | function initialize(address _token, address _idleToken) public {
require(!initialized, "Already initialized");
require(_token != address(0), 'crDAI: addr is 0');
token = _token;
underlying = address(ICreamDAI(_token).underlying());
idleToken = _idleToken;
IERC20(underlying).safeApprove(_token... | 14,113,421 |
// hevm: flattened sources of src/assimilators/mainnet/daiReserves/mainnetADaiToDaiAssimilator.sol
pragma solidity >0.4.13 >=0.4.23 >=0.5.0 <0.6.0 >=0.5.7 <0.6.0;
////// lib/abdk-libraries-solidity/src/ABDKMath64x64.sol
/*
* ABDK Math 64.64 Smart Contract Library. Copyright © 2019 by ABDK Consulting.
* Author: Mikh... | intakes raw amount of ASUsd and returns the corresponding raw amount | function intakeRaw (uint256 _amount) public returns (int128 amount_) {
IAToken _adai = getASUsd();
bool _success = _adai.transferFrom(msg.sender, address(this), _amount);
require(_success, "Shell/aDAI-transfer-from-failed");
_adai.redeem(_amount);
amount_ = _amount.divu(... | 5,730,558 |
// contracts/token/modules/interfaces/Taxation.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;
import "./interfaces/ITaxation.sol";
import "./Valuation.sol";
import "./ERC721.sol";
import "./Remittance.sol";
import "./Beneficiary.sol";
abstract contract Taxation is
ITaxation,
ERC721,
Valuation,
R... | Collects tax. tokenId_ ID of token to collect tax for. Strictly envoked by modifier but can be called publically. There's no tax to be collected on an unvalued token. If valuation > 0, contract has not foreclosed. Owed will be 0 when the token is owned by its beneficiary. i.e. no tax is owed. If foreclosure should ha... | function collectTax(uint256 tokenId_) public {
uint256 valuation = valuationOf(tokenId_);
if (valuation == 0) return;
uint256 owed = _taxOwed(tokenId_);
if (owed == 0) return;
if (foreclosed(tokenId_)) {
_setLastCollectionTime(tokenId_, _backdatedForeclosureTime(tokenId_));
owed = ... | 12,869,503 |
pragma solidity ^0.4.22;
/// @title facet of CarCore to control access to a car's functions
/// @author Lennart Grabowski
import 'openzeppelin-solidity/contracts/ownership/Ownable.sol';
contract CarAccessControl is Ownable {
event AuthorityAdded(uint256 authorityId, address authority, bytes32 name, uint8 level)... | returns the authority's address, name and level associated with parsed id | function getAuthority(
uint256 _authorityId
)
constant
public
returns(address, bytes32, uint8)
{
if (_authorityId < _authorities.length && _authorityId >= 0) {
return (
_authorities[_authorityId].authority,
_authorities[_aut... | 5,469,187 |
./partial_match/3/0xb421dF194F358D31F7f724018c3e4dca0923b4eD/sources/MyToken.sol | 1st years : 1825%2nd years percentage : 1460%3rd years percentage : 1095%4th years percentage : 730%5th years percentage : 365%6th years percentage : 182.5% | function getMintingReward() internal view returns (uint) {
require((now >= mintingStartTime) && (mintingStartTime > 0));
uint _now = now;
uint percentage = basePercentage;
uint minter = _balances[msg.sender];
if((_now.sub(mintingStartTime)) == 0){
percentage = per... | 5,094,942 |
./full_match/5/0xfe15B72631d64D6bCD0c999A9AbC337020355e48/sources/contracts/CrowdFunding.sol | 创建活动实例化结构体检查截止日期是否大于当前日期活动数量+1返回此活动 | function createCampaign(
address _owner,
string memory _title,
string memory _description,
uint256 _target,
uint256 _deadline,
string memory _image
) public returns(uint256){
Campaign storage campaign = campaigns[numberOfCampaigns];
... | 1,849,474 |
pragma solidity 0.4.19;
contract Fibonacci {
/* Carry out calculations to find the nth Fibonacci number */
function fibRecur(uint n) public pure returns (uint) {
if (n < 2) {
return n;
} else {
return fibRecur(n-1) + fibRecur(n-2);
}
}
/* Carry out calculations to... | Carry out calculations to find the nth Fibonacci number / | function fibRecur(uint n) public pure returns (uint) {
if (n < 2) {
return n;
return fibRecur(n-1) + fibRecur(n-2);
}
}
| 12,720,428 |
./partial_match/1/0xb696bE07FC77390092EDfF239214990c020ce92c/sources/SHIBAFUJIINU.sol | maxTransactionAmount = totalSupply 10 / 10000; 0.50% maxTransactionAmountTxn exclude from paying fees or having max transaction amount | constructor() ERC20("SHIFU", "SHIFU") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUn... | 4,212,370 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "./IERC900.sol";
import "./RewardStreamer.sol";
import "./StakingLib.... | Calculate the reward from current period return (uint256) the calculated reward/ | function getStakerRewardFromCurrentPeriod(
RewardStreamerLib.RewardStreamInfo storage rewardStreamInfo,
StakingInfo storage stakingInfo,
UserStake[] storage userStakes,
uint256 stakeIndex
)
public
view
returns(uint256)
{
if (stakeIndex >= userStakes.length) {
return 0;
}
uint256 stakerBalance... | 497,243 |
./full_match/8453/0x06Fea8513FF03a0d3f61324da709D4cf06F42A5c/sources/contracts/bridge/router/SwapQuoter.sol | Returns a list of all supported pools./ | function allPools() external view override returns (Pool[] memory pools) {
uint256 amount = poolsAmount();
pools = new Pool[](amount);
for (uint256 i = 0; i < amount; ++i) {
address pool = _pools.at(i);
}
}
| 11,546,133 |
./partial_match/1/0x373ae78a14577682591E088F2E78EF1417612c68/sources/contracts/wrapper/WERC20.sol | Return the underlying ERC20 balance for the user. | function balanceOfERC20(address token, address user) external view override returns (uint) {
return balanceOf(user, uint(token));
}
| 4,169,280 |
pragma solidity ^0.5.0;
import "../TransferManager.sol";
import "./BlacklistTransferManagerStorage.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
/**
* @title Transfer Manager module to automate blacklist and restrict transfers
*/
contract BlacklistTransferManager is BlacklistTransferManagerStora... | Used to add the multiple blacklist type _startTimes Start date of the blacklist type _endTimes End date of the blacklist type _blacklistNames Name of the blacklist type _repeatPeriodTimes Repeat period of the blacklist type/ | function addBlacklistTypeMulti(
uint256[] memory _startTimes,
uint256[] memory _endTimes,
bytes32[] memory _blacklistNames,
uint256[] memory _repeatPeriodTimes
)
public
withPerm(ADMIN)
{
require (_startTimes.length == _endTimes.length && _endTimes.leng... | 12,908,401 |
// SPDX-License-Identifier: MIT
//WARNING: Psuedo-code/Draft Phase... Do NOT USE THIS IN PRODUCTION. The current version of this contract is essentially pseudo code containing major functionality that will be edited to be operational by community
pragma solidity >=0.8.0 <0.9.0;
pragma experimental ABIEncoderV2;
//Requi... | User withdraws their tokens after the expiration date of the poolpercentage in 1e18do conversion and transfer | function withdraw(uint256 amount) public returns (bool) {
require(
allLPsCanWithdraw,
"allLPsCanWithdraw must be set to true for LPs to withdraw"
);
uint256 userPercentageOfDeposits = calculatePercentage(
poolOwnerBalance[msg.sender]
);
uin... | 1,754,147 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.