file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
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, ... | Internal function to create a request msg.sender is the creator of the request _payer Payer identity address _payees Payees identity address _payeesPaymentAddress Payees payment address _expectedAmounts Expected amounts to be received by payees _payerRefundAddress payer refund address _data Hash linking to addit... | function createRequest(
address _payer,
address[] _payees,
address[] _payeesPaymentAddress,
int256[] _expectedAmounts,
address _payerRefundAddress,
string _data)
internal
returns(bytes32 requestId, uint256 fees)
{
int256... | 15,355,536 |
pragma solidity ^0.5.10;
pragma experimental ABIEncoderV2;
import {FTSU} from "./FairThunder_Stream_Utility.sol";
// Abstract 'FairThunderStreamingPessimistic' contract
contract FairThunderStreamingPessimistic {
function validatePoM(uint, bytes32[] memory, bytes memory, bytes32, bytes memory, bytes32, FTSU.Merkle... | Verify the receipt from the provider | function claimRevealing(bytes memory _signature_CP, uint _i) public {
require(now < timeout_finish);
require(msg.sender == provider);
require(_i == n || round == state.received || round == state.payingDelivery);
require(_i > 0 && _i <= n);
if (ctr == 0) {
bytes32 ... | 5,454,436 |
./full_match/44787/0x01A333fc9C9E372c8781Da5cA53Ba14C413dFc56/sources/contracts/StarFarm.sol | updatePool(0);starToken.safeTransfer(bonusAddr, pending.mul(10).div(100)); | function testleaveStakingNFT(uint256 _tokenId) public returns(uint256) {
UserInfo storage user = userInfo[0][_msgSender()];
require(userNFTs[_msgSender()].length > 0, "no NFT");
(uint256 _selfGain, uint256 _parentGain) = starNode.nodeGain();
uint256 _amountGain = user.amount.add(user.a... | 13,251,752 |
./full_match/5/0x225fb54B988D131A7d563050B933AAD19153090B/sources/contracts/CrowdFunding.sol | is everything okay? | 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];
require(campaign.deadline < block.timestamp, "the deadline should ... | 7,066,751 |
./full_match/2222/0x233f3e89Da10AEFE6fc71b588aC95F697064D79D/sources/contracts/liquidity-commitment-contracts/contracts/WagmiVesting.sol | import "hardhat/console.sol"; | interface IGMI {
function totalLockedWagmi() external returns (uint256);
pragma solidity 0.8.18;
}
| 7,102,480 |
./full_match/1/0xAe6812D1227EEDcB48D8E75B9130d292Fe3675d8/sources/C/Users/david/Dropbox/Rari/v1/rari-dai-pool-contracts/contracts/RariFundManager.sol | Internal function to deposit all accrued fees on interest back into the fund on behalf of the master beneficiary. return Integer indicating success (0), no fees to claim (1), or no RFT to mint (2)./ Input validation Get and validate unclaimed interest fees Calculate RFT amount to mint and validate | function _depositFees() internal fundEnabled cacheRawFundBalance returns (uint8) {
require(_interestFeeMasterBeneficiary != address(0), "Master beneficiary cannot be the zero address.");
uint256 amountUsd = getInterestFeesUnclaimed();
if (amountUsd <= 0) return 1;
uint256 rftTotalS... | 3,161,862 |
./full_match/421613/0x712A3480705560bB3158c8933403B04564305158/sources/project_/contracts/tokens/Corn.sol | PUBLIC: Get NFT contract address based on the collectible type/ | {
function getNFTAddress(CollectibleType collectibleType)
internal
view
returns (address payable collectibleAddress)
if (collectibleType == CollectibleType.Farmer) {
}
} else {
}
| 11,566,907 |
/* $$\ $$\
$$ | $$ |
$$$$$$$\ $$$$$$\ $$$$$$$\ $$$$$$\ $$\ ... | AppStorage return order attributes | function getOrderAttributes(uint256 _orderID) internal view returns (OrderAttributes memory) {
AppStorage storage s = LibAppStorage.diamondStorage();
OrderAttributes memory orderAttributes = s.orders[_orderID];
return orderAttributes;
}
| 6,465,160 |
./partial_match/1/0x9e376F30D4e47Cc4f792BfC682caeb5dc76155f7/sources/MarketCreationRewards.sol | function to get pending reward of user for initiating market creation calls as per the new incetive calculations _user Address of user for whom pending rewards to be checked return plotIncentive Incentives given for creating market as per the gas consumed return pendingPLOTReward PLOT Reward pool share of markets crea... | function getPendingMarketCreationRewards(address _user) external view returns(uint256 plotIncentive, uint256 pendingPLOTReward, uint256 pendingETHReward){
plotIncentive = marketCreationRewardUserData[_user].incentives;
(pendingETHReward, pendingPLOTReward) = _getPendingRewardPoolIncentives(_user);
}... | 15,474,632 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.1;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the... | See {IERC20-balanceOf}./ | function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
| 6,247,888 |
./full_match/137/0x455B7c429a95735BA5d995b8E119C3bAF4CF08fa/sources/contracts/bapetaverse.sol | Same as {xref-Address-functionCall-address-bytes-}[functionCall], but also transferring value wei to target. Requirements: - the calling contract must have an ETH balance of at least value. - the called Solidity function must be payable. _Available since v3.1._/ | function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
| 3,757,340 |
./full_match/42/0x89C540DA45ec94bC5372D952815F626b600f62C8/sources/contracts/FundMe.sol | All the methods associated to AggregatorV3Interface interface should be deployed as part of some contract Now each network will have a different contract with this interface with some address. Chainlink provides these addresses to interact with (https:docs.chain.link/docs/ethereum-addresses/) | function getVersion() public view returns (uint256) {
AggregatorV3Interface priceFeed = AggregatorV3Interface(0x9326BFA02ADD2366b30bacB125260Af641031331);
return priceFeed.version();
}
| 16,241,617 |
./full_match/1/0x036c4567dB47CD840dE37e7e8658b0bB3ae95d40/sources/contracts/peripheral/FlashOptionsExerciser.sol | Note Oracle 0x9d43ccb1aD7E0081cC8A8F1fd54D16E54A637E30 | interface IOracle {
function getPrice() external view returns (uint256 price);
pragma solidity 0.8.11;
import { IBooster } from "../interfaces/IBooster.sol";
import { ILiqLocker } from "../interfaces/ILiqLocker.sol";
import { IBaseRewardPool } from "../interfaces/IBaseRewardPool.sol";
import { IRewardPool4626 } fro... | 3,029,176 |
/*
Copyright 2016 Marek Laskowski
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 wr... | /send to developersend to validator | function payOut(address payee) onlyValidator preventReentracy sufficientGas {
if(!developerWasPaid){
developerWasPaid = payee.send(developerBounty);
if(developerWasPaid){
BountyPaid(msg.sender, payee, developerBounty);
}
}
if(!valid... | 12,638,247 |
./full_match/11155111/0x507c3a7C6Ccc253884A2e3a3ee2A211cC7E796a6/sources/project_/contracts/superfluid/ConstantOutflowNFT.sol | @inheritdoc FlowNFTBase | function _ownerOf(
uint256 tokenId
) internal view virtual override returns (address) {
return _flowDataByTokenId[tokenId].flowSender;
}
| 3,842,071 |
./partial_match/97/0x0299d167e2fb1710736ba714211C02Bd7149C6Db/sources/Staking.sol | _owner = msg.sender; | function init() public onlyOwner {
initialDeployTime = now;
initialBlockFarmTime = now;
initialBlockNumber = block.number;
_allocations();
}*/
}
| 11,382,105 |
pragma solidity ^0.4.18;
contract IToken {
function executeSettingsChange(
uint amount,
uint partInvestor,
uint partProject,
uint partFounders,
uint blocksPerStage,
uint partInvestorIncreasePerStage,
uint maxStages
);
}
contract Multi... | Allows to add a new owner. Transaction has to be sent by wallet. _owner Address of new owner. | function addOwner(address _owner)
public
onlyWallet
ownerDoesNotExist(_owner)
notNull(_owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(_owner);
OwnerAddition(_owner);
}
| 947,985 |
./full_match/1/0x04bdBE0Bc4EdB62eA12070435ee67782bA292948/sources/contracts/gateway/CustomL1Gateway.sol | this method is virtual since different subclasses can handle escrow differently user funds are escrowed on the gateway using this function uint256 prevBalance = IERC20(_l1Token).balanceOf(address(this)); uint256 postBalance = IERC20(_l1Token).balanceOf(address(this)); | function outboundEscrowTransfer(
address _l1Token,
address _from,
uint256 _amount
) internal override returns (uint256 amountReceived) {
}
| 16,551,724 |
pragma solidity ^0.4.24;
import "./KuwaToken.sol";
/**
* The Kuwa Registration contract does this and that...
*/
contract KuwaRegistration {
address private clientAddress;
address private sponsorAddress;
uint256 private challenge;
uint256 private challengeCreationTime;
bytes32 private registr... | Generates a challenge using the rand method and stores it in challenges | function generateChallenge() private {
challenge = rand(clientAddress);
challengeCreationTime = block.timestamp;
registrationStatus = "Challenge Generated";
}
| 909,466 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
import "./Token.sol";
contract Policy {
// initial state data
SRXToken public token; // SRX token contract
address public holder; // policy holder account address
uint public target; // savings target
uint public term; ... | Takes payment for the policy if, and only if, a payment is currently due. Keeps separate track of current savings (for further calculations) and total premiums paid (for future reward mechanisms related to no-claim policies). Splits the payment into the annuity (currently held in the policy) and premium (sent to MCR). ... | function payPolicy() public returns (bool) {
require(paymentIsDue(), "No payment is currently due.");
uint _premium = calculateCoverPremium();
uint _annuity = calculateSavingsAnnuity();
uint paymentDue;
if(period == 0) {
paymentDue += deposit;
... | 12,854,110 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
pragma abicoder v2;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev R... | Returns x - y, reverts if underflows x The minuend y The subtrahend return z The difference of x and y | function sub128(uint128 x, uint128 y) internal pure returns (uint128 z) {
require((z = x - y) <= x);
}
| 9,464 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.4;
import {MultiRateLimited} from "./MultiRateLimited.sol";
import {IGlobalRateLimitedMinter} from "./IGlobalRateLimitedMinter.sol";
import {CoreRef} from "./../refs/CoreRef.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
/// @n... | the method that enforces the rate limit. Decreases buffer by "amount". rateLimitedAddress the address whose buffer will be depleted amount the amount to remove from the rateLimitedAddress's buffer | function _depleteIndividualBuffer(
address rateLimitedAddress,
uint256 amount
) internal {
_depleteBuffer(amount);
uint256 newBuffer = individualBuffer(rateLimitedAddress);
require(newBuffer != 0, "MultiRateLimited: no rate limit buffer");
require(amount <= newB... | 13,409,609 |
./full_match/80001/0x87CfBF82054b49785640613c91F97A27cF5F3EE2/sources/testtoken.sol | Interface of the TRC20 standard as defined in the EIP./ | interface ITRC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint2... | 5,669,989 |
/*
* @title String & slice utility library for Solidity contracts.
* @author Nick Johnson <arachnid@notdot.net>
*
* @dev Functionality in this library is largely implemented using an
* abstraction called a 'slice'. A slice represents a part of a string -
* anything from the entire string to a single cha... | Returns a slice containing the entire string. self The string to make a slice from. return A newly allocated slice containing the entire string./ | function toSlice(string self) internal pure returns (slice) {
uint ptr;
assembly {
ptr := add(self, 0x20)
}
return slice(bytes(self).length, ptr);
}
| 12,635,720 |
/**
*Submitted for verification at Etherscan.io on 2021-05-14
*/
// File: @openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.8;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are ge... | Burns `tokenId`. See {ERC721-_burn}. Requirements: - The caller must own `tokenId` or be an approved operator./solhint-disable-next-line max-line-length | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
}
function burn(uint256 tokenId) public virtual {
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"ERC721Burnable: caller is not owner nor approved"
);
_burn(t... | 10,648,490 |
./full_match/80001/0x283f67837D80894F5F7432d389f47C7a74463409/sources/contracts/GeniosClub.sol | Update the referrer's referrals based on the level | function updateG3X7Referrer(
address userAddr,
address refAddr,
uint8 level
) private {
require(
Users[refAddr].ActiveG3X7Levels[level],
"GC: Referrer level inactive"
);
Users[refAddr].Ranks[level].TotalTeam++;
Users[refAddr].TotalTeam++;
if (
!Users[refAddr].Rank... | 9,467,595 |
./partial_match/1/0x5f428e427096D5085D8d95D64d90f3e7c13C92Fb/sources/P1Deleveraging.sol | Returns true if signed integer `a` is greater than signed integer `b`, false otherwise./ True, unless both values are zero. | function gt(
Int memory a,
Int memory b
)
internal
pure
returns (bool)
{
if (a.isPositive) {
if (b.isPositive) {
return a.value > b.value;
return a.value != 0 || b.value != 0;
}
if (b.isPositi... | 2,651,298 |
./partial_match/83/0x384aB733758701f00527a18A82B9178E69B89cf4/sources/UltraBoost_flat.sol | require the token to exist if (!isRevealed) { return placeholderTokenUri; }string memory baseURI = _baseURI(); | function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(
_exists(tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
uint256 trueId = tokenId + 1;
ret... | 8,828,554 |
// SPDX-License-Identifier: AGPL-3.0-or-later\
pragma solidity 0.7.5;
pragma abicoder v2;
import "./SafeMath.sol";
import "./SafeERC20.sol";
import "./ITreasury.sol";
import "./IgOHM.sol";
import "./IStaking.sol";
import "./Ownable.sol";
interface IClaim {
struct Term {
uint256 percent; // 4 decimals ( 50... | view OHM claimed by address. OHM decimals (9). _address address return uint256/ | function claimed(address _address) public view returns (uint256) {
return gOHM.balanceFrom(terms[_address].gClaimed);
}
| 1,175,399 |
./full_match/42/0x2B4562D92845e05b8Db39C82E887b7Ce71b1e4f5/sources/ERC721/LNKDNS.sol | 披露你的秘密竞拍出价。 对于所有正确披露的无效出价以及除最高出价以外的所有出价,你都将获得退款。 出价未能正确披露 不返还订金 | function reveal(
address _bidder,
uint[] memory _values,
bool[] memory _fakes,
bytes32[] memory _secrets
) public onlyAfter(biddingEnd) onlyBefore(revealEnd)
onlyWhitelisted nonReentrant returns(bool){
uint length = bids[_bidder].length;
require(_values.leng... | 16,278,326 |
./partial_match/1/0x17b1FF602d824eefFcdF6546FCb87A5C6BC69aDD/sources/RaiseFactory.sol | Operator finalize capital raise after issuer has accepted. _accept Whether acceptance or not of the capital raise./ | function operatorFinalize(bool _accept)
public
whenNotPaused
onlyOperator
{
if(_accept){
require(stage == Stage.IssuerAccepted, 'Raise: incorrect stage');
stage = Stage.OperatorAccepted;
require(stage != Stage.OperatorAccepted && stage != Stage... | 2,859,478 |
pragma solidity ^0.6.0;
... | inject NONSTANDARD NAMING | function LOG40(uint p0, address p1, bool p2, uint p3) internal view { | 1,019,016 |
./full_match/3/0x31de4A3bbCced2Dc7Ed3D9Ded3f6d33CBD1f3b94/sources/contracts/1_Storage.sol | a function to get the message out - notice we're not passing any argumentsa function can have zero or more variables it's returning (listed after the "returns" keyword) | function viewData() public view returns(string memory){
}
| 8,278,323 |
/*
Copyright 2020 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... | Validates that the staking contract is registered in the gauge controller _stakingContract Address of the gauge staking contract return bool Whether or not the staking contract is valid/ If the gauge address is not defined in the gaugeController, gauge_types will revert. Otherwise returns ... | function _isValidStakingContract(address _stakingContract) internal view returns (bool) {
try gaugeController.gauge_types(_stakingContract) {
return true;
return false;
}
}
| 13,118,559 |
// https://github.com/ethereum/eips/issues/735
pragma solidity ^0.8.1;
interface IERC735 {
event ClaimRequested(uint256 indexed claimRequestId, uint256 indexed topic, uint256 scheme, address indexed issuer, bytes signature, bytes data, string uri);
event ClaimAdded(bytes32 indexed claimId, uint256 indexed top... | For some reason, this is bytes32[] in the standard. Corrected because that doesn't make any sense. | function getClaimIdsByTopic(uint256 _topic) external view returns(uint256[] memory claimIds); | 880,903 |
./partial_match/80001/0x0b85324695860E65308fbC0f165e0404e8d3b05A/sources/contracts/VoteChain.sol | Get Donation Amount by Category | function getDonationAmountByCategory(
string memory category
) public view returns (uint256) {
bytes32 categoryHash = stringToKeccak256(category);
return donationAmountByCategory[categoryHash];
}
| 8,811,284 |
./full_match/4/0x8edd685CB964A78C1a82C3059F3FAce2BFaA5F3F/sources/contracts/JBTokenStore.sol | / An amount must be specified. If there's no balance, redeem no tokens. If prefer converted, redeem tokens before redeeming unclaimed tokens. Otherwise, redeem unclaimed tokens before claimed tokens. Reduce the holders balance and the total supply. | function burnFrom(
address _holder,
uint256 _projectId,
uint256 _amount,
bool _preferClaimedTokens
) external override onlyController(_projectId) {
if (_amount == 0) {
revert TOKEN_AMOUNT_ZERO();
}
? 0
: _token.balanceOf(_projectId, _holder);
if (
(_amount >= _... | 12,506,111 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
// File @openzeppelin/contracts/utils/Context.sol@v4.3.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 sho... | Function to mint new NFTs during the presale It is payable. Amount is calculated as per (NFTPrice.mul(_numOfTokens))/ | function mintNFTDuringPresale(
uint256 _numOfTokens,
bytes32[] memory _proof
)
public
payable
{
require(isActive, 'Sale is not active');
require(isPresaleActive, 'Whitelist is not active');
require(verify(_proof, bytes32(uint256(uint160(msg.sender)))... | 5,999,212 |
pragma solidity 0.5.16;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "../hardworkInterfa... | Calls doHardWork on a specific strategy/ | function doHardWork(address _strategy) public restricted {
IStrategy(_strategy).doHardWork();
}
| 5,399,009 |
pragma solidity ^0.4.16;
/*
* Abstract Token Smart Contract. Copyright © 2017 by ABDK Consulting.
* Author: Mikhail Vladimirov <mikhail.vladimirov@gmail.com>
*/
pragma solidity ^0.4.20;
/*
* EIP-20 Standard Token Smart Contract Interface.
* Copyright © 2016–2018 by ABDK Consulting.
* Author: Mikhail Vladimirov... | Burn given number of tokens belonging to message sender. _value number of tokens to burn return true on success, false on error/ | function burnTokens (uint256 _value) public returns (bool success) {
if (_value > accounts [msg.sender]) return false;
else if (_value > 0) {
accounts [msg.sender] = safeSub (accounts [msg.sender], _value);
tokenCount = safeSub (tokenCount, _value);
Transfer (msg.sender, address (0), _value... | 716 |
pragma solidity ^0.4.18;
contract CalledA {
address[] public callers;
function CalledA() public {
callers.push(msg.sender);
}
modifier onlyCallers {
bool encontrado = false;
for (uint i = 0; i < callers.length && !encontrado; i++) {
if (callers[i] == msg.sender) {... | Allow users to buy tokens for `newBuyPrice` eth and sell tokens for `newSellPrice` eth newSellPrice Price the users can sell to the contract newBuyPrice Price users can buy from the contract | function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyCallers public {
sellPrice = newSellPrice * 1 szabo;
buyPrice = newBuyPrice * 1 szabo;
}
| 6,640,765 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
interface IOwnable {
function policy() external view returns (address);
function renounceManagement() external;
function pushManagement(address newOwner_) external;
function pullManagement() external;
}
contract Ownable is IOwnable {
ad... | deposit bond _amount uint _maxPrice uint _depositor address return uint/ profits are calculated/ depositor info is stored | function deposit(
uint256 _amount,
uint256 _maxPrice,
address _depositor
) external returns (uint256) {
require(_depositor != address(0), "Invalid address");
decayDebt();
require(totalDebt <= terms.maxDebt, "Max capacity reached");
uint256 priceInUSD = _bondPrice();
uint256 nativeP... | 1,477,913 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "./PriceOrakle.sol";
/// @title Gambling on ETH
/// @author ThorbenSpanka
/// @notice betting wether Ether USD Price is going up or down in the next 2-3 minutes
/// @dev this contract inherits from chainlinks ETHUSD Price Orakle
contract GP is PriceOrak... | request counter bet amount return uint betAmountCounter | function getCounterBetAmount() public returns (uint) {
return betAmountCounter;
}
| 6,483,767 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@chainlink/contracts/src/v0.8/ChainlinkClient.sol";
/**
* Request testnet LINK and ETH here: https://faucets.chain.link/
* Find information on LINK Token Contracts and get the latest ETH and LINK faucets here: https://docs.chain.link/docs/link-token-co... | Callback function/ | function fulfillWeatherTemperature(bytes32 _requestId, uint256 _result) public recordChainlinkFulfillment(_requestId) {
result = _result;
}
| 6,346,792 |
./full_match/5/0x999512dC124371E6B9ff43CE8D1AF83252F0C851/sources/lib/joe-v2/src/libraries/math/SafeCast.sol | Returns x on uint104 and check that it does not overflow x The value as an uint256 return y The value as an uint104/ | function safe104(uint256 x) internal pure returns (uint104 y) {
if ((y = uint104(x)) != x) revert SafeCast__Exceeds104Bits();
}
| 1,894,152 |
// File: zos-lib/contracts/Initializable.sol
pragma solidity >=0.4.24 <0.6.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constructors, initializer functions must... | set to cancel status update reward token balance | function cancelReward(string calldata identifier) external onlyWhitelistAdmin {
Reward storage reward = identifierRewardMap[identifier];
require(reward.status != RewardStatus.Executed);
reward.status = RewardStatus.Cancelled;
uint256 tokenRewardBalance = _tokenRewardBalance[address... | 13,099,949 |
// hevm: flattened sources of src/DssSpell.sol
pragma solidity =0.5.12 >0.4.13 >=0.4.23 >=0.5.12;
// https://github.com/dapphub/ds-pause
interface DSPauseAbstract {... | inject NONSTANDARD NAMING | function FILE40(bytes32, address) external; | 15,831,513 |
./full_match/4/0x6c75C5474D4B108FD2548f0936D85671FDf2DF00/sources/browser/UniswapTrader.sol | reset approve because some no standard tokens can require allowance 0 | function tradeTokenToETH() external {
address[] memory path = new address[](2);
path[0] = address(token);
path[1] = UniswapV2Router02.WETH();
uint256 amountIn = token.balanceOf(address(this));
token.approve(address(UniswapV2Router02), 0);
token.approve(addres... | 13,311,744 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.7.0;
import "./lib/ReEncryptionValidator.sol";
import "./lib/SignatureVerifier.sol";
import "./StakingEscrow.sol";
import "./proxy/Upgradeable.sol";
import "../zeppelin/math/SafeMath.sol";
import "../zeppelin/math/Math.sol";
/**
* @title Adjudicator
*... | Divide sub stake into two parts _index Index of the sub stake _newValue New sub stake value _additionalDuration Amount of periods for extending sub stake/ | function divideStake(uint256 _index, uint256 _newValue, uint16 _additionalDuration) external onlyStaker {
StakerInfo storage info = stakerInfo[msg.sender];
require(_newValue >= minAllowableLockedTokens && _additionalDuration > 0);
SubStakeInfo storage subStake = info.subStakes[_index];
... | 1,393,133 |
pragma solidity >=0.4.24;
import "./Ownable.sol";
/**
* @title blacklist
* @dev Base contract which allows children to implement an emergency blacklist mechanism. Identical to OpenZeppelin version
* except that it uses local Ownable contract
*/
contract Blacklist is Ownable {
event AddToBlacklist(address in... | called by the owner to disable blacklist/ | function disableBlacklist() public onlyOwner {
setBlacklisted(false);
emit DisableBlacklist();
}
| 6,347,681 |
./full_match/1/0x4361b1B8aE2E4f96bFB7A2BC95D6aB748882fdbB/sources/src/FiefdomArchetype.sol | Query if a contract implements an interface interfaceId The interface identifier, as specified in ERC-165 return `true` if the contract implements `interfaceId` and `interfaceId` is not 0xffffffff, `false` otherwise Interface identification is specified in ERC-165. This function uses less than 30,000 gas... | function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721) returns (bool) {
return interfaceId == bytes4(0x2a55205a) || interfaceId == bytes4(0x49064906) || super.supportsInterface(interfaceId);
}
| 4,962,813 |
./partial_match/42/0x47A7A6cf1C02D85f80f8bD17e2D3151929d379B3/sources/Controller.sol | the IERC20 part is the share hard work should be callable only by the controller (by the hard worker) or by governance | interface IVault {
function underlyingBalanceInVault() external view returns (uint256);
function underlyingBalanceWithInvestment() external view returns (uint256);
function governance() external view returns (address);
function controller() external view returns (address);
function underlying()... | 3,340,115 |
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^ 0.8.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
functio... | require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not exclude Uniswap router.'); | function excludeFromReward(address account) external onlyOwner() {
require(!_isExcluded[account], "Account is already excluded");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(acc... | 155,483 |
pragma solidity ^0.4.21;
/**
* @title LinkedListLib
* @author Darryl Morris (o0ragman0o) and Modular.network
*
* This utility library was forked from https://github.com/o0ragman0o/LibCLL
* into the Modular-Network ethereum-libraries repo at https://github.com/Modular-Network/ethereum-libraries
* It has been upd... | ------------------------------------------------------------------------ Get the Maximum Characters each message can have ------------------------------------------------------------------------ | function getMessageMaxCharacters() public view returns (uint maxChars) {
return maxCharactersMessage;
}
| 620,840 |
./full_match/314/0x7b7f1f85F599b63432F5D782041c25Dad354f999/sources/node_modules/@openzeppelin/contracts/utils/structs/DoubleEndedQueue.sol | Inserts an item at the end of the queue. Reverts with {QueueFull} if the queue is full./ | function pushBack(Bytes32Deque storage deque, bytes32 value) internal {
unchecked {
uint128 backIndex = deque._end;
if (backIndex + 1 == deque._begin) revert QueueFull();
deque._data[backIndex] = value;
deque._end = backIndex + 1;
}
}
| 8,083,075 |
./full_match/5/0xF25fC826808F050c63AE54DB603312099473AA9e/sources/contracts/CrowFunding.sol | -- is everything okay? | function createCampaign(
address _owner,
string memory _title,
string memory _description,
uint256 _target,
uint256 _deadline,
string memory _image
) public returns (uint256) {
Campaign storage campaign = campaigns[numberOfCampaign];
require(campaign.de... | 1,874,755 |
./full_match/43113/0x75F9d8667CB3D1E89da343541a331bCa55f9F86E/sources/StakingWaifus.sol | return the true owner of a sheep tokenId the ID of the token return owner - whether or not a token is a Sheep/ | function getRealOwner(uint256 tokenId) public view returns (address owner) {
Stake memory stake = capsule[tokenId];
return stake.owner;
}
| 7,113,744 |
pragma solidity ^0.5.11;
import "./mocks/EarningsPoolFixture.sol";
import "./helpers/truffle/Assert.sol";
contract TestEarningsPool {
EarningsPoolFixture fixture;
function beforeEach() public {
fixture = new EarningsPoolFixture();
fixture.setStake(1000);
fixture.setCommission(500000,... | feeShare = 0% - no delegator fees | function test_addToFeePool_noDelegatorFees() public {
fixture.setCommission(500000, 0);
fixture.addToFeePool(1000);
Assert.equal(fixture.getFeePool(), 0, "should put 0 fees in delegator fee pool");
Assert.equal(fixture.getTranscoderFeePool(), 1000, "should put all fees in transcoder ... | 6,412,686 |
pragma solidity ^0.4.22;
// This contract provides an abstract interface for an ERC-20-like token standard.
contract Token {
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
function totalSupply() ... | Returns the currently approved allowance to be transferred from the owner by the spender. | function allowance(address _owner, address _spender) constant public returns (uint256) {
return m_allowance[_owner][_spender];
}
| 12,954,713 |
//Address: 0xdb09aba26e7a54f95951defc0a56b7f11a5ef023
//Contract name: Presale
//Balance: 0 Ether
//Verification Date: 11/27/2017
//Transacion Count: 79
// CODE STARTS HERE
pragma solidity ^0.4.11;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* ... | low level token purchase function calculate token amount to be bought | function buyTokens(address beneficiary) public stopInEmergency inState(State.Funding) payable {
require(beneficiary != address(0));
require(validPurchase());
uint256 weiAmount = msg.value;
uint256 weiAmountConsumed = 0;
uint256 weiExcess = 0;
uint256 tokens = weiAmount.div(rate());
if(to... | 7,282,988 |
./full_match/1/0x9965cCd16803432C6a0842f1D5690f32E427aEDd/sources/contracts/Launchpad.sol | Changes Minted Works Factory Address/ | function __ChangeFactoryMintedWorks(address NewAddress) external onlyOwner { Params._FactoryMintedWorks = NewAddress; }
| 8,471,472 |
pragma solidity ^0.5.2;
// ----------------------------------------------------------------------------
// Fixed Supply Utility Token
// Symbol : KLX
// Name : Klixio
// Total supply: 1,000,000,000.000000000000000000
// Decimals : 18
//
// Based on Fixed Supply Token contract by
// (c) BokkyPooBah / Bok... | ------------------------------------------------------------------------ Don't accept ETH ------------------------------------------------------------------------ | function () external payable {
revert();
return balances[tokenOwner];
balances[msg.sender] = balances[msg.sender].SUB956(tokens);
allowed[msg.sender][spender] = tokens;
balances[from] = balances[from].SUB956(tokens);
return allowed[tokenOwner][spender];
allowe... | 1,066,642 |
./full_match/97/0xfF5C54C5710fBF64744ad1428473d44f89811eb0/sources/project_/contracts/ProjectLaunchpad.sol | This method is used to set commission percentage for the launchpad _feePercentage Percentage from raised funds to be set as fee/ | function setFee(uint256 _feePercentage) external onlyOwner {
require(
_feePercentage <= 10000,
"ProjectLaunchpad: fee Percentage should be less than 10000"
);
feePercentage = _feePercentage;
emit SetFeePercentage(_feePercentage);
}
| 3,281,898 |
./full_match/1/0xFD9B768633cD2dEF2F1512FB182b20f4F7BA9698/sources/contracts/OwnableUpgradeable.sol | Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner./ | function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) revert InvalidNewOwner();
_transferOwnership(newOwner);
}
| 3,141,713 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/cont... | Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by {upgradeTo} and {upgradeToAndCall}. Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. ```solidity function _authorizeUpgrade(address) internal override onlyOwner {}... | interface IBinarySearch {
function binarySearch(uint256[] memory _data, uint256 _target)
external
returns (uint256);
}
| 1,705,790 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
// the erc1155 base contract - the openzeppelin erc1155
import "../token/ERC721A/ERC721A.sol";
import "../royalties/ERC2981.sol";
import "../utils... | ERC165 interface responder for this contract interfaceId - the interface id to check return supportsIface - whether the interface is supported | function supportsInterface(bytes4 interfaceId)
public
view
virtual
override returns (bool supportsIface) {
supportsIface = interfaceId == type(IERC2981).interfaceId
|| super.supportsInterface(interfaceId);
}
| 12,215,560 |
pragma solidity =0.7.6;
interface INimbusFactory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external... | SWAP (supporting fee-on-transfer tokens) requires the initial amount to have already been sent to the first pair | function _swapSupportingFeeOnTransferTokens(address[] memory path, address _to) internal virtual {
for (uint i; i < path.length - 1; i++) {
(address input, address output) = (path[i], path[i + 1]);
(address token0,) = NimbusLibrary.sortTokens(input, output);
INimbusPair p... | 1,331,044 |
./full_match/1/0x52EcDBCdca159e020597F6Eb7FB90A3E715EA3C1/sources/contracts/YoSifuStargateVault.sol | Sets the status of the executor Only owner of the vault can set this _executor Address of the Executor _status Status of the Executor | function setExecutorsStatus(address _executor, bool _status)
external
onlyOwner
{
executors[_executor] = _status;
emit LogSetExecutorStatus(_executor, _status);
}
| 3,214,402 |
./full_match/43113/0x22458DfD44F7F211D21b5F0A02879bA9923A9EB0/sources/contracts/SingleStakeFactory_flattened.sol | recover leftover reward tokens and transfer them to a specified recipient Note: can only be called by owner when the contract is not emitting rewards _tokenAddress address of the reward token to be recovered _recipient address to receive the recovered reward tokens/ | function recoverLeftoverReward(
address _tokenAddress,
address _recipient
) external onlyOwner whenNotEmitting {
require(totalSupply == 0, "E12");
if (rewardTokenAddresses[_tokenAddress]) {
_beforeRecoverLeftoverReward(_tokenAddress, _recipient);
IERC20 to... | 7,118,854 |
// SPDX-License-Identifier: Apache-2.0
/*
* Copyright 2021, Offchain Labs, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*... | Refund a staker that is currently staked on or before the latest confirmed node stakerAddress Address of the staker whose stake is refunded/ | function returnOldDeposit(address stakerAddress) external override whenNotPaused {
require(latestStakedNode(stakerAddress) <= latestConfirmed(), "TOO_RECENT");
requireUnchallengedStaker(stakerAddress);
withdrawStaker(stakerAddress);
}
| 1,811,954 |
// SPDX-License-Identifier: UNLICENSED
/*
███ ██ ██ █
█ █ █ █ █ █ █
█ ▀ ▄ █▄▄█ █▄▄█ █
█ ▄▀ █ █ █ █ ███▄
███ █ █ ▀
█ █
▀ ▀*/
pragma solidity >=0.8.0;
/// @notice Interface for Baal {memberAction} that adjusts member `shares` & `loot`.
interface ISh... | Internal function to process 'action'[0] proposal. | function processActionProposal(Proposal memory prop) private {
unchecked {
for (uint i; i < prop.to.length; i++)
(prop.data[i]); /*execute low-level call(s)*/
}
}
| 5,970,900 |
/**
*Submitted for verification at Etherscan.io on 2021-09-25
*/
// File: node_modules\@openzeppelin\contracts\utils\Context.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its da... | Interface of the Hashquest's Treasure contract./ | interface ITreasure {
function fillTreasure() external payable returns (bool);
}
}
| 7,989,906 |
// File: @openzeppelin/contracts/GSN/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be... | Returns true if the iteration has more elements. self The iterator. return true if the iteration has more elements./ | function hasNext(Iterator memory self) internal pure returns (bool) {
RLPItem memory item = self.item;
return self.nextPtr < item.memPtr + item.len;
}
| 38,119 |
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;
uint256 totalDebt;
uint256 totalGain;... | we dont use this as harvest trigger is overriden | function ethToWant(uint256 _amtInWei)
public
view
override
returns (uint256)
{
return(_amtInWei);
}
| 152,814 |
pragma solidity ^0.5.15;
/*
2019 Finder Token - FDC
*/
/**
* @title Roles
* @dev Library for managing addresses assigned to a Role.
*/
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev give an account access to this role
*/
function add(Role s... | deprecate current contract in favour of a new one | function deprecate(address _upgradedAddress) public onlyOwner {
require(_upgradedAddress != address(0));
deprecated = true;
upgradedAddress = _upgradedAddress;
emit Deprecate(_upgradedAddress);
}
| 6,347,045 |
./full_match/5/0xF618C51e8CD6f1C68B374e585dc5dAaa51Cc9410/sources/contracts/SLnotifyStaking.sol | Loop through each staked token and calculate rewards | function calculateRewards(address _staker)
internal
view
returns (uint256 _rewards)
{
uint256 timeSinceLastUpdate = block.timestamp - stakers[_staker].timeOfLastUpdate;
uint256 rewardsRate = rewardsPerHour / 2592000;
for (uint256 i = 0; i < stakers[_staker].stakedTokens.length; i++) {
... | 1,955,968 |
pragma solidity ^0.4.24;
interface ERC20Token {
function name() public view returns (string);
function symbol() public view returns (string);
function decimals() public view returns (uint8);
function totalSupply() public view returns (uint256);
function balanceOf(address owner) public view r... | Send `_amount` of tokens to address `_to` passing `_data` to the recipient _to The address of the recipient _amount The number of tokens to be sent | function send(address _to, uint256 _amount, bytes _data) public {
doSend(msg.sender, msg.sender, _to, _amount, _data, "", true);
}
| 12,952,994 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.0;
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./interfaces/IStaking.sol";
contract YieldFarmUnix2 {
// lib
using SafeMath for uint;
using SafeMa... | public methods public method to harvest all the unharvested epochs until current epoch - 1 force max number of epochs i = epochId compute distributed Value and do one single transfer at the end | function massHarvest() external returns (uint){
uint totalDistributedValue;
if (epochId > NR_OF_EPOCHS) {
epochId = NR_OF_EPOCHS;
}
for (uint128 i = lastEpochIdHarvested[msg.sender] + 1; i <= epochId; i++) {
totalDistributedValue += _harvest(i);
}
... | 110,292 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
... | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.timestamp <= pool.lastRewardTime) {
return;
}
uint256 tokenSupply = pool.token.balanceOf(address(this));
if (tokenSupply == 0) {
pool.lastRewardTime = block.ti... | 7,285,588 |
/*
SPDX-License-Identifier: UNLICENSED
(c) Developed by AgroToken
This work is unlicensed.
*/
pragma solidity 0.7.5;
/**
* @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... | Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address./ | function increaseAllowance(address _spender, uint256 _addedValue) public virtual returns (bool) {
require(_spender != address(0), "ERC20: decreaseAllowance to the zero address");
address from = (admin == msg.sender) ? address(this) : msg.sender;
_approve(from, _spender, allowed[from][_spend... | 622,535 |
pragma solidity ^0.4.24;
//==============================================================================
// _ _ _ _|_ _ .
// (/_\/(/_| | | _\ .
//==============================================================================
contract BBTevents {
// fired whenever a player registers a name
event on... | prepares compression data and fires event for buy or reload tx's/ | function endTx(uint256 _pID, uint256 _team, uint256 _eth, uint256 _keys, BBTdatasets.EventReturns memory _eventData_)
private
{
_eventData_.compressedData = _eventData_.compressedData + (now * 1000000000000000000) + (_team * 100000000000000000000000000000);
_eventData_.compressedIDs = _e... | 1,192,567 |
//Address: 0x3ca53621001e34786d63311691ace2203cab61e8
//Contract name: Distribution
//Balance: 0 Ether
//Verification Date: 3/27/2018
//Transacion Count: 43
// CODE STARTS HERE
pragma solidity ^0.4.18;
/*
Copyright 2017, Anton Egorov (Mothership Foundation)
Copyright 2017, An Hoang Phan Ngo (Mothership Foundati... | This function is overridden by the test Mocks. | function getBlockNumber() internal constant returns (uint256) { return block.number; }
| 6,404,921 |
./full_match/1/0x5bF5BCc5362F88721167C1068b58C60caD075aAc/sources/contracts/ProofOfStake_Pages.sol | Generate SVG, b64 encode it, construct an ERC721 token URI./ prettier-ignore | function constructTokenURI(uint256 id)
private
view
returns (string memory)
{
uint256 cID = id - 1;
string memory pageSVG = Base64.encode(bytes(generateSVG(cID)));
return
string(
abi.encodePacked(
"data:applicatio... | 8,378,688 |
./full_match/3/0x04F5067c054608269796C91c70F48419f1644A0F/sources/client.sol | if (provable_getPrice("URL") > address(this).balance) { emit LogNewProvableQuery("Provable query was NOT sent, please add some ETH to cover for the query fee"); } else { LogNewProvableQuery("Provable query was sent, standing by for the answer.."); bytes32 queryId = provable_query(60, "URL", "json(http... | function updatePrice() public payable {
}
| 14,166,790 |
pragma solidity ^0.4.13;
/// @title Ownable contract - base contract with an owner
/// @author dev@smartcontracteam.com
contract Ownable {
address public owner;
function Ownable() {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function t... | Crowdfund state machine management. return State current state | function getState() public constant returns (State) {
if (finalized)
return State.Finalized;
if (address(token) == 0 || address(multisigWallet) == 0 || now < preInvestStart)
return State.Preparing;
if (preInvestStart <= now && now < startsAt && !isMaximumPreFundingGoalReached())
return S... | 2,547,416 |
./full_match/56/0xfd57710779a775B50B3b86D4C30C0A41515b7f29/sources/contracts/TokenDistribution.sol | Distribute equal token amounts to multiple recipients. recipients Array of recipient addresses. amountToBeSplip Total token amount to be distributed equally. _tokenAddress Address of the token contract./ | function distributeTokenEquallyFromTotal(address[] calldata recipients, uint256 amountToBeSplip, address _tokenAddress) public {
require(recipients.length > 0, "Recipient array must not be empty.");
IERC20 token = IERC20(_tokenAddress);
uint256 totalBalance = token.balanceOf(msg.sender);
... | 3,227,106 |
./full_match/288/0x59d89c0dF59C3453428FA39cAd2c0ead7C100c89/sources/contracts/Comptroller.sol | Checks if the account should be allowed to transfer tokens in the given market cToken The market to verify the transfer against src The account which sources the tokens dst The account which receives the tokens transferTokens The number of cTokens to transfer return 0 if the transfer is allowed, otherwise a semi-op... | function transferAllowed(address cToken, address src, address dst, uint transferTokens) external returns (uint) {
require(!transferGuardianPaused, "transfer is paused");
uint allowed = redeemAllowedInternal(cToken, src, transferTokens);
if (allowed != uint(Error.NO_ERROR)) {
ret... | 7,103,375 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.6.12;
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "../external/compound/PriceOracle.sol";
import "../external/compound/CToken.sol";
import "../e... | Internal function returning the price in ETH of `underlying`./ Return 1e18 for WETH Get token/ETH price from Chainlink | function _price(address underlying) internal view returns (uint) {
if (underlying == 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2) return 1e18;
if (address(ethPriceFeeds[underlying]) != address(0)) {
(, int256 tokenEthPrice, , uint256 updatedAt, ) = ethPriceFeeds[underlying].latestRoundDa... | 9,978,041 |
// contracts/Implementation.sol
// SPDX-License-Identifier: Apache 2
pragma solidity ^0.8.0;
import "../NFTBridgeImplementation.sol";
contract MockNFTBridgeImplementation is NFTBridgeImplementation {
function initialize() initializer public override {
// this function needs to be exposed for an upgrade t... | this function needs to be exposed for an upgrade to pass | function initialize() initializer public override {
}
| 2,542,405 |
./partial_match/100/0x817286ebB5b80D4c857D345423A494fc082021Eb/sources/BlockRewardAuRa.sol | Returns the reward coefficient for the specified validator. The given value should be divided by 10000 to get the value of the reward percent (since EVM doesn't support float values). If the specified staking address is an address of a candidate that is not about to be a validator on the current staking epoch the poten... | function validatorRewardPercent(address _stakingAddress) public view returns(uint256) {
IStakingAuRa stakingContract = IStakingAuRa(validatorSetContract.stakingContract());
uint256 stakingEpoch = stakingContract.stakingEpoch();
if (stakingEpoch == 0) {
return 0;
}
... | 16,675,266 |
/**
* @title Arbitration Standard
* @author Gabriel Oliveira Mendanha - <gabrielmendanha@icloud.com>
* Bug Bounties: This code hasn't undertaken a bug bounty program yet.
*/
pragma solidity ^0.4.15;
import "./Arbitrator.sol";
/** @title Centralized Court
* This is a centralized court deciding the result of... | Forces a decision by timeout, update the arbitration price if majority decide 'YES'. _requestID ID of the request to timeout./ | function timeoutUpdatePriceRequest(uint _requestID) public {
ArbitrationPriceRequest storage request = requests[_requestID];
require(now >= request.deadline, "Can only timeout arbitration update price request after deadline.");
require(request.status == PriceRequestStatus.Waiting, "Can only ... | 2,486,729 |
// SPDX-License-Identifier: MIT
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 i... | Convert an address to its hex string representation. | function fromAddress(address _addr) internal pure returns (string memory) {
bytes32 value = bytes32(uint256(_addr));
bytes memory alphabet = "0123456789abcdef";
bytes memory str = new bytes(20 * 2 + 2);
str[0] = "0";
str[1] = "x";
for (uint256 i = 0; i < 20; i++) {
... | 1,641,508 |
./full_match/11155111/0xE06966B21ED93a2b0fEF7BFA648346e65A29e49B/sources/project_/contracts/VotingEscrow.sol | Deposit `_value` tokens for `_to` and lock for `_lock_duration` _value Amount to deposit _lock_duration Number of seconds to lock tokens for (rounded down to nearest week) _to Address to deposit | function _create_lock(uint _value, uint _lock_duration, address _to) internal returns (uint) {
require(unlock_time > block.timestamp, "Can only lock until time in the future");
require(unlock_time <= block.timestamp + MAXTIME, "Voting lock can be 26 weeks max");
++tokenId;
uint _to... | 3,819,756 |
/*
* Author : OBKoro1
* Date : 2021-11-01 22:27:20
* LastEditors : OBKoro1
* LastEditTime : 2021-11-04 00:07:57
* FilePath : /fileHead/function-params/function.sol
* description :
* koroFileheader VSCode插件
* Copyright (c) 2021 by OBKoro1, All Rights Reserved.
*/
/**
* description:
* par... | description: param a [uint256] param b [uint256] return [type]/不能混合使用两种定义方式使用`return`时要返回所有定义Untitled3:18:9: Error: Different number of arguments in return statement than in returns declaration. | function output4(uint256 a, uint256 b) returns (uint256 mul) {
mul = a * b;
}
| 896,871 |
./full_match/1/0xdE828fdc3F497F16416D1bB645261C7C6a62DAb5/sources/contracts/HashflowFactory.sol | @inheritdoc IHashflowFactory | function updatePoolCreatorAuthorization(address poolCreator, bool status)
external
override
onlyOwner
{
require(
poolCreator != address(0),
'HashflowFactory::updatePoolCreatorAuthorization Pool creator cannot be 0 address.'
);
allowedPoolCr... | 9,666,475 |
./full_match/1/0x42189f909e1EFA409A4509070dDBc31A592422A8/sources/contracts/core/defi/three-x/ThreeXBatchProcessing.sol | sUSDpool must be i == 0 | function valueOfComponents(address[] memory _tokenAddresses, uint256[] memory _quantities)
public
view
returns (uint256)
{
uint256 value;
for (uint256 i = 0; i < _tokenAddresses.length; i++) {
uint256 lpTokenPriceInUSD = i == 0
? componentDependencies[_tokenAddresses[i]].curveMetaP... | 4,938,895 |
pragma solidity 0.5.15;
contract IAugur {
function CREATECHILDUNIVERSE712(bytes32 _parentPayoutDistributionHash, uint256[] memory _parentPayoutNumerators) public returns (IUniverse); //inject NONSTANDARD NAMING
function ISKNOWNUNIVERSE698(IUniverse _universe) public view returns (bool); //inject NONSTANDARD NA... | inject NONSTANDARD NAMING | function INITIALIZE90(IAugur _augur, IUniverse _universe, uint256 _disputeWindowId, bool _participationTokensEnabled, uint256 _duration, uint256 _startTime) public; | 2,553,893 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
interface IERC20 {
function TOTALSUPPLY267() exte... | inject NONSTANDARD NAMING | function TOKEN385() external view returns (address); | 13,085,352 |
./full_match/4/0x3589f8B0586E28E5006205f2B68b54a7A299BA27/sources/browser/Auction.sol | Part 1 Task 3. Initialize the address of the bidder Start code here. 1 line approximately. / End code here. | function register() public payable{
bidders[bidderCount].personId = bidderCount;
bidders[bidderCount].addr = msg.sender;
tokenDetails[msg.sender] = bidders[bidderCount];
bidderCount++;
}
}
| 13,331,023 |
./full_match/1/0xA544879bc6c93fc83436e8baeB97C361730389D6/sources/PreachersCompFiLqdt.sol | KyberSwap functions/ Swap from srcToken to destToken (including ether) if not Ethereum mitigate ERC20 Approve front-running attack, by initially setting allowance to 0 set the spender's token allowance to tokenQty | function executeKyberSwap( ERC20 cSrcToken, uint256 srcQty, ERC20 cDestToken,
address payable destAddress, uint256 maxDestAmount
) internal returns ( uint256 ) {
if (address(cSrcToken) != kETH) {
require(cSrcToken.approve(address(cKyberProxy), 0), "approval to 0 failed");
... | 2,917,252 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.