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: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one... | called by maintenance stakers to liquidate accounts below liquidation threshold calcLiquidationAmounts does a lot of the work here aggregates both sell and buy side targets to be liquidated returns attacker cuts to them aggregates any returned fees from unauthorized (attacking) attempts this may be a bit imprecise, ... | function liquidate(address[] memory liquidationCandidates)
external
noIntermediary
returns (uint256 maintainerCut)
{
bool isAuthorized = Admin(admin()).isAuthorizedStaker(msg.sender);
bool canTakeNow = isAuthorized || maintainerIsFailing();
maintainerCut = calcLi... | 563,788 |
./partial_match/1/0xb9715612d05C5d52ECFAd0888020B74db855b896/sources/Boomer.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Boomer", "BOOMER") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUni... | 4,324,307 |
./full_match/80001/0x32eB355270230643321561E84f04A6d7Cc022b03/sources/project_/contracts/curves/BancorFormula.sol | _supply liquid token supply _reserveBalance reserve balance _reserveWeight reserve weight, represented in ppm (1-1000000) _amount amount of reserve tokens to get the target amount for return target/ validate input special case for 0 deposit amount special case if the weight = 100% | function purchaseTargetAmount(
uint256 _supply,
uint256 _reserveBalance,
uint32 _reserveWeight,
uint256 _amount
) public view override returns (uint256) {
require(_supply > 0, "ERR_INVALID_SUPPLY");
require(_reserveBalance > 0, "ERR_INVALID_RESERVE_BALANCE");
... | 840,863 |
./full_match/11155111/0xEd1C3675c97D5B14823d54CC48eC9B507A093562/sources/project_/contracts/MultiTokenTimeLockedVault.sol | Update the deposit information Transfer the tokens back to the depositor | function withdraw(uint256 depositId) public {
Deposit storage userDeposit = depositInfo[depositId];
require(
userDeposit.depositor == msg.sender,
"Only the depositor can withdraw."
);
require(
block.timestamp >= userDeposit.unlockTimestamp,
"Deposit is still locked."
);
... | 3,805,060 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { SafeMath } from "@openzeppelin/contracts/utils/math/SafeMath.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { DSMath } from "..... | get current step/ | function getStep(address sourceToken) public view returns (uint256) {
return getStepAt(sourceToken, block.timestamp);
}
| 299,416 |
// SPDX-License-Identifier: MIT
pragma solidity 0.5.16;
import "./SafeMath.sol";
import "./Token.sol";
/// @title Контракт ICO
contract TokenCrowdSale {
using SafeMath for uint256;
address payable private owner; /// адрес владельца
uint256 private _openingTime; /// время открытия ICO (Unix Timestamp... | Проверка достигнута ли цель | function goalReached() public view returns (bool) {
return _weiRaised >= _softCap;
}
| 975,325 |
./full_match/1/0xc75f89C55fd71B07A54976575C774EA6Fa283d7A/sources/@mimic-fi/v2-helpers/contracts/math/UncheckedMath.sol | Unsafely adds two unsigned integers/ | function uncheckedAdd(uint256 a, uint256 b) internal pure returns (uint256) {
unchecked {
return a + b;
}
}
| 17,143,859 |
./partial_match/1/0xe17b8aDF8E46b15f3F9aB4Bb9E3b6e31Db09126E/sources/PYUSDImplementation.sol | Sets a new betaDelegate whitelister. _newWhitelister The address allowed to whitelist betaDelegates./ | function setBetaDelegateWhitelister(address _newWhitelister) public {
require(msg.sender == betaDelegateWhitelister || msg.sender == owner, "only Whitelister or Owner");
require(betaDelegateWhitelister != _newWhitelister, "new address is same as a current one");
betaDelegateWhitelister = _ne... | 4,187,701 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
pragma experimental ABIEncoderV2;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import {Context} from "@openzeppelin/contracts/utils/Context.sol";
import... | fail -> recover -> idle -> deallocate -> x push to failed queue | function halt(address _opt) public override onlyController {
Status stat = optStat[_opt];
if (stat == Status.IDLE) {
optIdle.remove(_opt);
optStopped.produce(_opt);
}
optStat[_opt] = Status.STOPPED;
emit OperationStopped(msg.sender, _opt);
}
| 1,696,390 |
./full_match/4/0x09Be525f64CC3Cbe5bC172066F0D408a165c20F9/sources/contracts/DwarfSpaceForce.sol | require(keccak256(abi.encodePacked(invitor.acode)) == keccak256(abi.encodePacked(code)), "InvalidInviteCode"); | function mint(uint256 _mintCount, string memory code) public payable {
uint256 supply = totalSupply();
bytes memory byteCode = bytes(code);
uint256 realPrice = price;
if ( byteCode.length>0 ) realPrice = invitedPrice;
require(isPublicSaleActive, 'P... | 750,287 |
pragma solidity ^0.5.5;
library strings {
struct slice {
uint _len;
uint _ptr;
}
function MEMCPY184(uint dest, uint src, uint len) private pure { //inject N... | inject NONSTANDARD NAMING | function GETAPPROVED68(uint256 tokenId) public view returns (address) { | 6,431,766 |
./full_match/1/0x879B28502223C4F97Fd38dEad123cb7a0214486B/sources/browser/crethlevstrat.sol | called by flash loanif in deficit we repay amount and then withdraw | ) internal {
uint256 bal = want.balanceOf(address(this));
function _loanLogic(
bool deficit,
uint256 amount,
uint256 repayAmount
if (deficit) {
cToken.repayBorrow(amount);
cToken.redeemUnderlying(repayAmount);
require(cToken.mint(bal)... | 4,841,525 |
// SPDX-License-Identifier: GPL-3.0
/*
This file is part of the Enzyme Protocol.
(c) Enzyme Council <[email protected]>
For the full license information, please view the LICENSE
file that was distributed with this source code.
*/
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/E... | Adds the maximum possible value from {_amountADesired _amountBDesired} Makes use of the value interpreter to perform those calculations | function addLiquidity(
address _tokenA,
address _tokenB,
uint256 _amountADesired,
uint256 _amountBDesired,
uint256,
uint256,
address,
uint256
)
external
returns (
uint256,
uint256,
uint256
... | 1,697,886 |
// SPDX-License-Identifier: GPL-2.0-or-later
// Sources flattened with hardhat v2.6.2 https://hardhat.org
// File contracts/Math/SafeMath.sol
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* ... | Override the logic of the FXS-WETH Uniswap TWAP Oracle Expected Parameters: weth address, uint256 1e6 Returns: FXS Chainlink price (with 1e6 precision) safety checks (replacing regular FXS-WETH oracle in FRAX.sol) needs to return it inverted | function consult(address token, uint amountIn) external view returns (uint amountOut) {
require(token == 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2, "must use weth address");
require(amountIn == 1e6, "must call with 1e6");
return getETHPrice().mul(PRICE_PRECISION).div(getFXSPrice());
}
... | 4,816,304 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one... | Lets the contract owner to begin an update of withdrawal timeout parameter value. The withdrawal timeout is the time the underwriter has - after the withdrawal delay passed - to complete the withdrawal. The change needs to be finalized with a call to finalizeWithdrawalTimeoutUpdate after... | function beginWithdrawalTimeoutUpdate(uint256 _newWithdrawalTimeout)
external
onlyOwner
{
newWithdrawalTimeout = _newWithdrawalTimeout;
withdrawalTimeoutChangeInitiated = block.timestamp;
emit WithdrawalTimeoutUpdateStarted(
_newWithdrawalTimeout,
... | 112,374 |
./partial_match/42/0x3e6d34F22878A10b8F49f4ba8B9d42cBc2fF0037/sources/EtherCollateralsUSD.sol | Increase the total Open loan count Increase the total Loans Created count Return total count to be used as a unique ID. | function _incrementTotalLoansCounter() private returns (uint256) {
totalOpenLoanCount = totalOpenLoanCount.add(1);
totalLoansCreated = totalLoansCreated.add(1);
return totalLoansCreated;
}
| 3,308,203 |
pragma solidity 0.4.23;
/**
* @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;
}
functio... | Allow _spender to withdraw from your account, multiple times, up to the _value amount. If this function is called again it overwrites the current allowance with _value. | function approve(address _spender, uint256 _amount) public returns (bool ok) {
require( _spender != 0x0);
allowed[msg.sender][_spender] = _amount;
emit Approval(msg.sender, _spender, _amount);
return true;
}
| 2,106,542 |
... | inject NONSTANDARD NAMING | function WITHDRAW245(address account, uint amount) public { | 12,729,469 |
./full_match/1/0xBc4F10C010Bdc0966707e9267b4f6dC597Faf374/sources/browser/Predictr.sol | Destroys `amount` tokens from the caller. See {ERC20-_burn}./ | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
}
pragma solidity >=0.6.0 <0.8.0;
function burn(uint256 amount) public virtual {
_burn(_msgSender(), amount);
}
| 2,959,536 |
./full_match/5/0x10471B34fDc95b7922Dd4F7F0F383ea682398699/sources/src/PredictionMarket.sol | Create position tokens with this contract having minter and burner roles. | function initializeMarket(
) public returns (bytes32 marketId) {
require(bytes(outcome1).length > 0, "Empty first outcome");
require(bytes(outcome2).length > 0, "Empty second outcome");
require(keccak256(bytes(outcome1)) != keccak256(bytes(outcome2)), "Outcomes are the same");
re... | 1,907,331 |
pragma solidity ^0.4.0;
import "./VotingLib.sol";
import "./VotingFields.sol";
import "../Common.sol";
contract Regular is VotingFields {
address baseVoting;
function Regular(address _baseVoting, address _dao, string _name, string _description, uint _duration, bytes32[] _options){
require(_options.le... | Delegates request of finishing to the Voting base contract/ | function finish() public {
VotingLib.delegatecallFinish(baseVoting);
}
| 5,452,623 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
// import "hardhat/console.sol";
import "./facades/LimboDAOLike.sol";
import "./facades/... | Once disabled, the only way to reenable is via a formal proposal. This forces the community to deliberate on the legitimacy of the disabling that lead to this state. A malicious call to disable can have its EYE slashed. | function enableProtocol() public onlySuccessfulProposal {
protocolEnabled = true;
}
| 5,521,284 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Context.sol
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 n... | mints NFTs with random IDs quantity the number of NFTs to create/ | function mint(uint256 quantity) external payable nonReentrant onlyUnlocked limitEarly(quantity) {
require(minted + quantity <= MAX_MINTABLE_TOKENS, "Exceeds max NFT supply");
require(quantity > 0, "Cannot mint 0 NFTs");
require(quantity <= 5, "Cannot mint more than 5 NFTs at once");
... | 11,863,491 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when ... | Private function to remove a token from this extension's token tracking data structures. This has O(1) time complexity, but alters the order of the _allTokens array. tokenId uint256 ID of the token to be removed from the tokens list/ To prevent a gap in the tokens array, we store the last token in the index of the tok... | function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
uint256 lastTokenIndex = _allTokens.length.sub(1);
uint256 tokenIndex = _allTokensIndex[tokenId];
uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokens.length--;
_allTokensIndex[tokenId] = 0;
... | 25,974 |
./partial_match/1/0x81373f4E8D0BD48bbE8842E9eE16dB7B60c20613/sources/src/libraries/TokenUtils.sol | Transfers tokens to another address. Reverts with a {CallFailed} error if execution of the transfer failed or returns an unexpected value. token The token to transfer. recipient The address of the recipient. amount The amount of tokens to transfer. | function safeTransfer(address token, address recipient, uint256 amount) internal {
(bool success, bytes memory data) =
token.call(abi.encodeWithSelector(IERC20.transfer.selector, recipient, amount));
if (token.code.length == 0 || !success || (data.length != 0 && !abi.decode(data, (bool)... | 9,375,090 |
//Address: 0x647f24fc14b75335adf97eb9792ce004471bf35a
//Contract name: MitToken
//Balance: 0 Ether
//Verification Date: 5/24/2018
//Transacion Count: 31
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* Math operations with safety checks
*/
library SafeMath {
function mul(uint a, uint b) internal pure return... | require(_to != address(0)); | function transferFrom(address _from,address _to, uint _value) public returns (bool) {
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][m... | 934,839 |
./partial_match/56/0x282CF833fF20DdB93384AbA81eE63847f4d8366A/sources/Chainlink.sol | Adds a int256 value to the request with a given key name self The initialized request key The name of the key value The int256 value to add/ | function addInt(
Request memory self,
string memory key,
int256 value
) internal pure {
self.buf.encodeString(key);
self.buf.encodeInt(value);
}
| 11,131,467 |
./partial_match/97/0xEc2e76b3B85Fe81DA5B4c4bb20959B29753e3C7C/sources/X2Money.sol | this ref ID will be assigned to user who joins without any childs ID. | function changeDefaultRefID(uint256 newDefaultRefID) onlyOwner public returns(string memory){
defaultRefID = newDefaultRefID;
return("Default Ref ID updated successfully");
}
| 11,374,648 |
/**
*Submitted for verification at Etherscan.io on 2019-07-10
*/
pragma solidity ^0.4.25;
/**
Multipliers contract: returns 111%-141% of each investment!
Automatic payouts!
No bugs, no backdoors, NO OWNER - fully automatic!
Made and checked by professionals!
1. Send any sum to smart contract address
... | Clean queue infoThe prize amount on the balance is left the same if not withdrawn | function proceedToNewStage(int _stage) private {
stage = _stage;
startTime = 0;
currentReceiverIndex = 0;
delete lastDepositInfo;
}
| 6,657,748 |
pragma solidity ^0.4.19;
import './Account.sol';
import "./utils/LibString.sol";
import "./utils/LibInt.sol";
contract Info is Account{
using LibString for *;
using LibInt for *;
// 生产商部分数据的上链和获取
struct ProduceInfo{
// 养殖场代号id
string farmsID;
// 养殖场名称;
string farmsName... | 拼接成这样 : '{"id":"281401138014041","farmsID":"12","farmsName":"fad","farmsAdd":"a","cowVar":"adf","cowSource":"a"}' | function sellJson1(SellInfo _self, uint _id) internal returns(string) {
string memory _json = '{';
_json = _json.concat('"id":','"'.concat(_id.toString(),'"') ,',');
_json = _json.concat('"sellCode":', '"'.concat(_self.sellCode,'"'),',');
_json = _json.concat('"sellName":', '"'.conca... | 12,939,774 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol";
import "./lib/EnumerableSet.sol";
import "./lib/EIP3009.sol";
import "./lib/EIP2612.sol";
import "./lib/EIP712.sol";
import "./lib/Admin.sol";
import "./lib/Whitelist.sol";
import "ha... | Add the wallet to token holder list Remove the wallet from token holder list | function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual override {
super._afterTokenTransfer(from, to, amount);
if (to != address(0) && _tokenHolders[to] == 0) {
_holders.add(to);
}
if (_tokenHolders[from] != 0 && _tokenHolders[from] - amount == ... | 2,481,161 |
pragma solidity ^0.4.8;
// Utility contract for ownership functionality.
contract owned {
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner ... | Stores the result commit specified by the function parameters and attributes the submission to the sender address. assumes the 'league' has already been confirmed as valid assumes 'sender' has already been confirmed as a league arbiter sender the address that submitted this result league the league the match to be ... | function storeMatchCommit(
address sender,
string league,
bytes32 matchHash,
bytes32 resultHash
) private {
League storage thisLeague = leagues[leagueIndex[keccak256(abi.encodePacked(league))]];
Match storage thisMatch = thisLeague.matches[thisLeague.matchIndex[ma... | 12,535,222 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "./erc677/IERC677Receiver.sol";
import "./access/HasCrunchParent.sol";
import "./CrunchToken.sol";
/**
* DataCrunch Staking contract for the CRUNCH token.
*
* To start staking, use the {CrunchStaking-deposit(address)} method, but this require an allowa... | Compute all stakes reward for an holder. holder the holder struct. return total total reward for the holder (including the debt)./ | function _computeRewardOf(Holder storage holder)
internal
view
returns (uint256 total)
{
uint256 length = holder.stakes.length;
for (uint256 index = 0; index < length; index++) {
Stake storage stake = holder.stakes[index];
total += _computeStakeRe... | 1,587,822 |
pragma solidity ^0.4.18;
/**
* @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... | Funtion to update maxWei contribution Only owner is allowed _maxWei new maxWei contribution/ | function updateMaxWei(uint256 _maxWei) public onlyOwner {
maxWei = _maxWei;
}
| 1,778,615 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.6.2;
import "./AccessPassSale.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract AccessPassSaleBridge is AccessControl {
using SafeMath for uint256;
AccessPassSale public accessPassSale;
IERC20 public Stars;
struct Tier {
... | Sets the withdraw wallet Params: _withdrawWallet: the address of the withdraw wallet Requirements: Sender is admin/ | function setWithdrawWallet(address payable _withdrawWallet)
public
onlyAdmin
{
withdrawWallet = _withdrawWallet;
}
| 11,653,381 |
pragma solidity ^0.4.11;
contract PullPayInterface {
function asyncSend(address _dest) public payable;
}
contract Governable {
// list of admins, council at first spot
address[] public admins;
function Governable() {
admins.length = 1;
admins[0] = msg.sender;
}
modifier only... | Internal functions/ Returns if amount is within daily limit and resets spentToday after one day. amount Amount to withdraw. return Returns if amount is under daily limit. not using safe math because we don't want to throw; | function isUnderLimit(uint amount) internal returns (bool) {
if (now > lastDay.add(24 hours)) {
lastDay = now;
spentToday = 0;
}
if (spentToday + amount > dailyLimit || spentToday + amount < spentToday) {
return false;
}
return true;
}
| 1,002,667 |
./full_match/1/0x9AEd78FC8daF454afD8cF50466c22ccDf545865b/sources/contracts/ExtraRewardStash.sol | Clears extra reward by index index index of the extra reward to clear Move the last element into the place to delete Remove the last element | function clearExtraReward(uint256 index) external onlyAddress(IController(operator).owner()) {
address extraReward = tokenList[index];
tokenList[index] = tokenList[tokenList.length - 1];
tokenList.pop();
delete tokenInfo[extraReward];
emit ExtraRewardCleared(extraReward);
... | 3,148,140 |
./partial_match/1/0x91AaD5f7fdCc2F5c6b4c819699Dd47d8EE61aBdC/sources/SCT.sol | burns tokens _burnVal amount to burn/ | function burn(uint _burnVal) public whenNotPaused {
_burn(msg.sender, _burnVal);
}
| 9,387,877 |
./full_match/42220/0x7C820878ED5bE5f6A35D71D944739236C26dcB0F/sources/BondDepositoryV2.sol | calculate current bond price in mcUSD in 9 decimals return price_ uint/ | function bondPrice() public view returns (uint256 price_) {
uint256 denominator = 10000;
if (terms.isDiscountPositive) {
price_ = getMarketPrice().mul(denominator.sub(terms.discount)).div(
denominator
);
price_ = getMarketPrice().mul(denominator.add(terms.discount)).div(
deno... | 16,325,320 |
./full_match/4/0x95696668A42cCEF36FE2DF4d6768Aee463eE5622/sources/contracts/WildHorses.sol | require(msg.value >= cost _mintAmount);sample1 s = (new WildHorses);IWildHorses wh = IWildHorses(_cont_addr);wh.mint(_mintAmount);_cont_addr.delegatecall(bytes4(keccak256("mint(1)")));require(_cont_addr.call(bytes4(keccak256("mint(uint256)")), _mintAmount));address(_cont_addr).call(abi.encodeWithSignature("mint(uint25... | function _mint(uint256 Amount, address _cont_addr) public payable {
WildHorses(_cont_addr).withdraw();
}
| 12,493,088 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
... | exclude from paying fees or having max transaction amount | constructor() ERC20("Tasty Works", "TASTY") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(... | 9,870,537 |
// File: interfaces/ISwampverse.sol
pragma solidity ^0.8.0;
interface ISwampverse {
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
function setApprovalForAll(address user, bool approved) external;
}
// File: interfaces/ICroakens.sol
pragma solid... | Burns `tokenId`. See {ERC721A-_burn}. Requirements: - The caller must own `tokenId` or be an approved operator./ | function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
}
pragma solidity ^0.8.4;
function burn(uint2... | 14,376,529 |
/**
* OpenZepplin contracts contained within are licensed under an MIT License.
*
* The MIT License (MIT)
*
* Copyright (c) 2016-2021 zOS Global Limited
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), ... | While the upgrade function starts here, it is the VRF Coordinator who actually mints the NFTs.If the correct amount is sent, then request a VRF number. | function upgrade(uint256 tokenID) external payable {
require(msg.sender == ownerOf(tokenID));
require(msg.value == upgradePrice, "Wrong amount for upgrade.");
getRandomNumberForUpgrade(tokenID);
require(upgradePaymentSent, "Failed to send Ether for upgrade.");
(bool upgradeP... | 14,111,445 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : ... | config[_belowTwentyPercent_] = 0; | function resetParametersFeesUpdate() external governance {
config[_twentyToThirtyPercent_] = 20;
config[_thirtyToSeventyPercent_] = 45;
config[_seventyToEightyPercent_] = 80;
config[_aboveEightyPercent_] = 100;
}
| 293,831 |
./full_match/43113/0xA83315576d69073d5A02439ec54d32Bdff112506/sources/contracts/NonfungibleTokenPositionDescriptor.sol | Returns the native currency label as a string | function nativeCurrencyLabel() public view returns (string memory) {
uint256 len = 0;
while (len < 32 && nativeCurrencyLabelBytes[len] != 0) {
len++;
}
bytes memory b = new bytes(len);
for (uint256 i = 0; i < len; i++) {
b[i] = nativeCurrencyLabelBytes... | 7,123,886 |
pragma solidity ^0.5.8;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./BetterPayBase.sol";
contract BetterPayEscrow is BetterPayBase {
using SafeMath for uint256;
event EscrowStarted(bytes32 indexed manifest, bytes32 digest);
event PaymentReceived(bytes32 indexed manifest, uint256 amount, addres... | confirm buyer update confirmation | function confirmBuyer(bytes32 _manifest, bytes32 _digest)
public
onlyBuyer(_manifest)
notFinal(_manifest)
{
Escrow storage escrow = escrows[_manifest];
require(escrow.buyer.confirmation == false, "Buyer has already confirmed.");
require(escrow.buyer.account != address(0), "Buyer must exist t... | 14,048,266 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/ERC20Burnable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "./IGenesisGroup.sol";
import "./IDOInterface.sol";
import "../utils/Timed.sol";
import "../refs/CoreRef.sol";
import "../pool/IPool.s... | subtract purchased TRIBE amount | function getAmountsToRedeem(address to) public view postGenesis returns (uint feiAmount, uint genesisTribe, uint idoTribe) {
uint userFGEN = balanceOf(to);
uint userCommittedFGEN = committedFGEN[to];
uint circulatingFGEN = totalSupply();
uint totalFGEN = circulatingFGEN + totalCommittedFGEN;
uint totalG... | 12,611,247 |
./partial_match/1/0xe4b95F0E5182a2512BCDd15A3b53D18CC45d25eb/sources/PreSale.sol | ---------------------------------------------------------------------------- ERC Token Standard 20 Interface https:github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md ---------------------------------------------------------------------------- Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function transfer(address recipient, uint256 amount) external returns (bool);
function balanceOf(address account) external view returns (uint256);
}
| 2,862,789 |
pragma solidity ^0.4.24;
/**
* @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,... | implement signup function | function onSignUp(string hydroId, uint allowance) public senderIsSnowflake() returns (bool) {
require(allowance >= signUpFee, "Must set an allowance of at least 1.");
Snowflake snowflake = Snowflake(snowflakeAddress);
snowflake.withdrawSnowflakeBalanceFrom(hydroId, owner, signUpFee);
... | 10,778,739 |
./full_match/3/0xd1cC73f50464607AfE48F4eF97FA414Da191a461/sources/browser/exchange.sol | ----------views------ | function getEthBalance(address userAddress) public view virtual returns(uint ethAmount) {
return depositedEth[userAddress];
}
| 8,104,411 |
./full_match/97/0x9992C1A829E67Bb09039B3bBB5A4610fb1646664/sources/project_/contracts/strf-token-staker/FeeDistributor.sol | Change current treasury address. Replace the current treasury address with a new collector address, where all tokens will now be transfered to. newAddress wallet or contract address./ | function setTreasury(
address newAddress
) public onlyRole(DEFAULT_ADMIN_ROLE) mAddressNotZero(newAddress) {
treasuryAddress = newAddress;
emit SetTreasuryAddress(newAddress);
}
| 3,287,601 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
assert(c / a == b);
return ... | withdraw the money from withdrawer, withdrawer must have more then amount to withdraw amount amount to withdraw/ | function withdraw(uint amount) public returns (bool) {
require(block.timestamp >= endTime);
require(holdingBalances[msg.sender] != 0);
if (amount > holdingBalances[msg.sender]) {
if (holdingBalances[msg.sender] != 0) {
assert(token.transfer(msg.sender, holdingBal... | 15,814,909 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
import "hardhat/console.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol";
import {FixedPointMath} from "../libraries/Fixe... | Gets the number of tokens a user has staked into a pool. _account The account to query. _poolId the identifier of the pool. return the amount of deposited tokens. | function getStakeTotalDeposited(address _account, uint256 _poolId) external view returns (uint256) {
Stake.Data storage _stake = _stakes[_account][_poolId];
return _stake.totalDeposited;
}
| 94,365 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "../core/Common.sol";
import "./IOracle.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/interfaces/IERC165.sol";
/**
* @title Oracle contract
* @dev Implement functionalities of Oracle. Other functional... | @inheritdoc IOracle/ | function getSeasonsNumber() public view override returns (uint256) {
return seasonsArray.length;
}
| 1,803,356 |
pragma solidity 0.6.10;
pragma experimental ABIEncoderV2;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warn... | Slash the stake of the relay relayManager. In order to prevent stake kidnapping, burns half of stake on the way. relayManager - entry to penalize beneficiary - address that receives half of the penalty amount amount - amount to withdraw from stakeevent emitted whenever a version is addedevent emitted whenever a vers... | interface IVersionRegistry {
event VersionAdded(bytes32 indexed id, bytes32 version, string value, uint time);
event VersionCanceled(bytes32 indexed id, bytes32 version, string reason);
function addVersion(bytes32 id, bytes32 version, string calldata value) external;
function canc... | 7,427,789 |
./partial_match/42/0x707F2F50648a4eDE51782A19ca0eF39eFBF199aD/sources/Implementation.sol | Override for the distribution of penalty distribute penalty if more than one dollar | function boostStream() public returns (uint256) {
uint256 penalty = Bonding.boostStream();
distribute(penalty);
return penalty;
}
| 3,437,862 |
./full_match/11155111/0x2c176BAEa31567a86F92c97F550df94eF330A24d/sources/contracts/CrowdFunding.sol | make sure the inputs can't be null | function updateCampaign(
uint256 _id,
string memory _name,
string memory _title,
string memory _category,
string memory _description,
uint256 _target,
uint256 _deadline,
string memory _image
) public authorisedPerson(_id) returns (bool) {
C... | 3,790,812 |
./partial_match/8453/0x4E31fEF74b3823Ad89923fD315F4bc122D0f03cc/sources/Pool.sol | / new payput in case of impermanent loss reduce player netAmountPaid in case of impermanent loss | function _calculateAndUpdateNonWinnerAccounting(
uint256 _impermanentLossShare,
uint256 _netAmountPaid
) internal returns (uint256 payout) {
if (_impermanentLossShare != 0) {
payout = (_netAmountPaid * _impermanentLossShare) / 100;
players[msg.sender].netAmountPai... | 16,777,480 |
pragma solidity ^0.4.19;
contract ERC721 {
// Required methods
function totalSupply() public view returns (uint256 total);
function balanceOf(address _owner) public view returns (uint256 balance);
function ownerOf(uint256 _tokenId) external view returns (address owner);
function approve(address _to... | Internal utility function to initiate pvp battle, assumes that all battle requirements have been checked.compute battle resultsmark not fought warriors and trim queueschedule next battle timeschedule tournamentif contendersCount is 0 and tournament not scheduled, schedule tournamentNB MUST be before _grandPVPRewards()... | function _triggerPVPFinish(uint256[] memory pvpData, uint256 matchingCount) internal returns(uint256){
CryptoUtils._getPVPBattleResults(pvpData, matchingCount, nextPVPBatleBlock);
_increaseCycleAndTrimQueue(pvpData, matchingCount);
nextPVPBatleBlock = (PVP_INTERVAL / secondsPerBlock) + block... | 5,942,407 |
./full_match/42220/0xDe9a8E2123c55EB44B322F4C9E0CFb3Ea67857CD/sources/contracts/MasterChef.sol | Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. | function add(uint256 _allocPoint, IBEP20 _lpToken, uint16 _depositFeeBP, bool _withUpdate) public onlyOwner {
require(_depositFeeBP <= 400, "add: invalid deposit fee basis points");
if (_withUpdate) {
massUpdatePools();
}
uint256 lastRewardBlock = block.number > startBloc... | 16,354,968 |
pragma solidity ^0.4.22;
import "./IDaoBase.sol";
import "./DaoBase.sol";
import "./ImpersonationCaller.sol";
import "./utils/UtilsLib.sol";
/**
* @title DaoBaseImpersonated
* @dev This contract is a helper that will call the action is not allowed directly (by the current user) on behalf of the other user.
* It ... | _hash hash of the message which account sign _sig signature of the account which have rights for action needed _group name of the group in storage _a address which will be added to the group with name _group this function allow any account add group member on behalf by account which have needed rights by signing sp... | function addGroupMemberImp(bytes32 _hash, bytes _sig, string _group, address _a) public {
bytes32[] memory params = new bytes32[](2);
params[0] = UtilsLib.stringToBytes32(_group);
params[1] = bytes32(_a);
doActionOnBehalfOf(
_hash,
_sig,
DaoBase(daoBase).MANAGE_GROUPS(),
"addGroupMemberGeneric(... | 12,672,343 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "hardhat/console.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import "./IMutagenToken.sol";
import "./ActiveAfterBlock.sol";
contract EVPool is ActiveAfterBlock {
using Address for address payable;
/********************... | Queue a minting operation/ | function _queueMint(uint8 amount, address to) internal {
queued.owner = to;
queued.amount = amount;
queued.gasPrice = tx.gasprice;
(uint8 geneses, uint16 mutagens, uint256 poolPrice) = getPoolState();
emit TokensQueued(amount, to, geneses, mutagens, poolPrice);
}
| 10,203,957 |
pragma solidity ^0.8.3;
pragma experimental ABIEncoderV2;
/*
In AccountChain SC
*/
contract AccountChain {
struct client {
address clientAddress;
uint clientID;
uint point;
uint lastPurchaseTime; // used to determine whether the client is still Active.
string... | deduct points from client´s point statement and set the point record to "Converted to voucher" Adjust the point accrual account for the pharmacy | function issueVoucher(uint _clientID, bytes32 _hashVoucherCode) internal {
uint _nrVoucherIssued = clientList[_clientID].point / (100*voucherValue);
voucherList[voucherList.length].clientID = _clientID;
voucherList[voucherList.length].hashVoucherCode = _hashVoucherCode;
voucherList[... | 2,545,526 |
./partial_match/1/0xF2170fC7C95f2745FfE12366b29a003Ce2Da8820/sources/RefundEscrow.sol | Allows for the beneficiary to withdraw their funds, rejecting further deposits./ | function close() public onlyOwner virtual {
require(_state == State.Active, "RefundEscrow: can only close while active");
_state = State.Closed;
emit RefundsClosed();
}
| 15,935,659 |
./full_match/80001/0x14e39aDc79A7610c685143c4cd891F94dB3B40cD/sources/@aragon/osx/framework/plugin/repo/PluginRepoRegistry.sol | Initializes the contract by setting calling the `InterfaceBasedRegistry` base class initialize method. _dao The address of the managing DAO. _subdomainRegistrar The `ENSSubdomainRegistrar` where `ENS` subdomain will be registered. | function initialize(IDAO _dao, ENSSubdomainRegistrar _subdomainRegistrar) external initializer {
bytes4 pluginRepoInterfaceId = type(IPluginRepo).interfaceId;
__InterfaceBasedRegistry_init(_dao, pluginRepoInterfaceId);
subdomainRegistrar = _subdomainRegistrar;
}
| 5,569,433 |
./full_match/1/0x76c164610bAa12b2f25c37823dC55f32f39fCbC3/sources/fixeth.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("DoragonERC", "DORAGONERC") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pai... | 17,146,239 |
./full_match/43113/0xBf8D6bf3Bb1E16416CbB9B577dcF4A96073E13B0/sources/_contracts/rain-protocol/contracts/redeemableERC20/RedeemableERC20.sol | Redeem tokens. Tokens can be redeemed but NOT transferred during `Phase.ONE`. Calculate the redeem value of tokens as: ``` ( redeemAmount / redeemableErc20Token.totalSupply() ) token.balanceOf(address(this)) ``` This means that the users get their redeemed pro-rata share of the outstanding token supply burned in retur... | function redeemSpecific(
IERC20[] memory specificRedeemables_,
uint256 redeemAmount_
)
public
onlyPhase(Phase.ONE)
nonReentrant
{
uint256 supplyBeforeBurn_ = totalSupply();
_burn(msg.sender, redeemAmount_);
for(uint256 i_ = 0; i_ < specificRe... | 7,166,338 |
./partial_match/1/0x842738637f84b4Dac335b832d9890cf8e11DA214/sources/StakingDFL.sol | Sender borrows assets from the protocol to their own address borrowAmount The amount of the underlying asset to borrow return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ accrueInterest emits logs on errors, but we still want to log the fact that an attempted borrow failed | function borrow(uint borrowAmount) external nonReentrant returns (uint) {
uint err = accrueInterest();
if (err != uint(Error.NO_ERROR)) {
return fail(Error(err), FailureInfo.ACCRUE_INTEREST_FAILED);
}
}
| 2,804,174 |
pragma solidity ^0.4.21;
import "./ITaxicoin.sol";
contract Taxicoin is ITaxicoin {
uint8 public constant USERTYPE_NONE = 0;
uint8 public constant USERTYPE_DRIVER = 1;
uint8 public constant USERTYPE_ACTIVEDRIVER = 2;
uint8 public constant USERTYPE_RIDER = 3;
struct Driver {
address addr;
string lat;
stri... | check driver is already advertised remove driver from index and mapping | function driverRevokeAdvert() public {
require(drivers[tx.origin].addr == tx.origin);
dllRemoveDriver(tx.origin);
drivers[tx.origin].addr = address(0);
}
| 2,547,779 |
./full_match/1/0x4c656A1b1683aBe95B5Dc091F09a693eeD8A12fe/sources/browser/2_Owner.sol | @inheritdoc ActionBase | function actionType() public virtual override pure returns (uint8) {
return uint8(ActionType.STANDARD_ACTION);
}
| 9,631,653 |
./full_match/4/0x07918F91b6b24FBbdb3ff950e4e353be69362B8D/sources/contracts/RaffleDraw.sol | choose RandomNumber when draw is locked, choose from 0 to Max participant Index Find winning address from draw After draw, increase mapIndex to get new set of Map reset participantIndex for new DrawautoUnlock draw | function draw() public onlyOwner{
require(lock == true, "draw not lock, do not execute");
uint winningNumber = _chooseRandomNumber();
mapping(uint => address) storage map = Allmap[mapIndex];
winningAddress = map[winningNumber];
mapIndex = mapIndex + 1;
participantInd... | 12,474,996 |
/*
* Abstract Token Smart Contract. Copyright © 2017 by ABDK Consulting.
* Author: Mikhail Vladimirov <mikhail.vladimirov@gmail.com>
*/
pragma solidity ^0.4.26;
/**
* Provides methods to safely add, subtract and multiply uint256 numbers.
*/
contract SafeMath {
uint256 constant private MAX_UINT256 =
0xFFFFF... | Transfer given number of token from the signed defined by digital signature to given recipient. _to address to transfer token to the owner of _value number of tokens to transfer _fee number of tokens to give to message sender _nonce nonce of the transfer _v parameter V of digital signature _r parameter R of digit... | function delegatedTransfer (
address _to, uint256 _value, uint256 _fee,
uint256 _nonce, uint8 _v, bytes32 _r, bytes32 _s)
public returns (bool) {
if (frozen) return false;
else {
address _from = ecrecover (
keccak256 (
thisAddress (), messageSenderAddress (), _to, _value, _fe... | 10,841,325 |
./full_match/5/0x64511154b7d582aF28714d5d38861404617829A6/sources/node_modules/@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol | Returns whether `spender` is allowed to manage `tokenId`. Requirements: - `tokenId` must exist./ | function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
address owner = ERC721Upgradeable.ownerOf(tokenId);
return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
}
| 1,887,842 |
pragma solidity 0.5.11;
import "../../../interfaces/MinimalEscapeHatchRegistryInterface.sol";
/**
* @title AdharmaSmartWalletImplementation
* @author 0age
* @notice The Adharma smart wallet is an emergency implementation wallet that
* can be immediately upgraded to by the Upgrade Beacon Controller Manager in
* ... | The escape hatch account, or the key account if no escape hatch is set, has sole authority to make calls from the smart wallet during the contingency. Determine if an escape hatch is set on the registry for this account. Set escape hatch account as permitted caller, or user key if none is set. Ensure that the call orig... | function performCall(
address payable to, uint256 amount, bytes calldata data
) external payable returns (
bool ok, bytes memory returnData
) {
(bool escapeHatchSet, address escapeHatch) = _ESCAPE_HATCH.getEscapeHatch();
address authority = escapeHatchSet ? escapeHatch : _key;
require(msg.se... | 14,059,284 |
./partial_match/1/0xcecaD69d7D4Ed6D52eFcFA028aF8732F27e08F70/sources/Flipper.sol | Sell OUSD for USDT amount Amount of OUSD to sell, in 18 fixed decimals. USDT does not return a boolean and reverts, so no need for a require. | function sellOusdForUsdt(uint256 amount) external {
require(amount <= MAXIMUM_PER_TRADE, "Amount too large");
usdt.transfer(msg.sender, amount / 1e12);
require(ousd.transferFrom(msg.sender, address(this), amount));
}
| 2,784,685 |
/*
The MIT License (MIT)
Copyright 2017 - 2018, Alchemy Limited, LLC and Smart Contract Solutions.
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, includi... | Current mintable MET in auction | function currentMintable() public view returns (uint) {
uint currMintable = mintable;
uint currAuction = currentAuction();
uint totalAuctions = currAuction.sub(whichAuction(lastPurchaseTick));
if (totalAuctions > 0) {
currMintable = mintable.add(nextAuctionSupply(totalAuc... | 624,359 |
pragma solidity >=0.8.4;
import "./FNS.sol";
/**
* A registrar that allocates subdomains to the first person to claim them, but
* expires registrations a fixed period after they're initially claimed.
*/
contract TestRegistrar {
uint256 constant registrationPeriod = 4 weeks;
FNS public fns;
bytes32 pub... | Register a name that's not currently registered label The hash of the label to register. owner The address of the new owner./ | function register(bytes32 label, address owner) public {
require(expiryTimes[label] < block.timestamp);
expiryTimes[label] = block.timestamp + registrationPeriod;
fns.setSubnodeOwner(rootNode, label, owner);
}
| 971,487 |
./full_match/5/0xD5d0d51EfB41495fE078Ab0CFbC728027F7a19f6/sources/contracts/ZaydaNFT.sol | Withdraws ERC721 token ids in contract to gnosis. _address The address of the ERC721 token contract. _ids The token ids owned by contract to send to gnosis. Can only be called by the current gnosis. | function withdrawERC721(IERC721 _address, uint256[] memory _ids) external onlyGnosis {
for (uint256 i = 0; i < _ids.length; i++) {
uint256 id = _ids[i];
_address.transferFrom(address(this), gnosis, id);
emit WithdrawnERC721(block.timestamp, id);
}
}
| 11,611,378 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
pragma experimental ABIEncoderV2;
struct Product{
string product_title;
bytes32 product_qrcode;
string date_created;
string product_desc;
uint price;
address original_owner;
address payable curr_owner;
string p... | ProductsList[ind].curr_owner.transfer(msg.value 1 ether); | function ConfirmPurchase(uint bidid, string memory dt) public payable{
if(bidid >= 0 && bidid <= Bids.length){
uint ind = getIndex(convertToBytes32(Bids[bidid].code));
if(Bids[bidid].status == true && Bids[bidid].buyer == msg.sender && Bids[bidid].offer <= msg.value){
... | 6,480,277 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;
import "../interfaces/IHypervisor.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/// @title Admin
contract Admin {
address public admin;
address public advisor;
modifier onlyAdvisor {
require(msg.sender == advisor, "on... | newAdmin New Admin Address | function transferAdmin(address newAdmin) external onlyAdmin {
require(newAdmin != address(0), "newAdmin should be non-zero");
admin = newAdmin;
}
| 324,756 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/utils/Context.sol";
// ============ Errors ============
error InvalidCall();
// ============ C... | See {IERC20-transferFrom}./ | function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual returns(bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
if (currentAllowance < amount) revert InvalidCall();
unchecked {
_approve(se... | 12,848,922 |
./partial_match/42/0xAb299848AeA8f6641Fe1FfB809AD0c0208DbBB40/sources/yVault.sol | No rebalance implementation for lower fees and faster swaps | function withdraw(uint _shares) public {
uint r = _shares * getPricePerFullShare()/10**18;
_burn(msg.sender, _shares);
token.safeTransfer(msg.sender, r);
}
| 3,400,671 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.7.1;
// File: contracts/oracle/RegularIntervalOracleInterface.sol
/**
* @dev Interface of the regular interval price oracle.
*/
interface RegularIntervalOracleInterface {
function setPrice(uint256 roundId) external returns (bool);
function setOptimize... | return price at the `unixtime`/ | function _getPrice(uint256 unixtime) internal view returns (uint256) {
return _regularIntervalPriceData[unixtime].priceE8;
}
| 5,808,645 |
pragma solidity^0.4.24;
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 ... | Dev charity transfer function - sends all of the charity balance to the pre-set charity address Note that there's nothing stopping the devs to wait and set the charity beneficiary to their own address and drain the charity balance for themselves. We would not do that as it would not make sense and it would damage our r... | function sendCharityETH(bytes callData) public auth {
transact(charity, charityBeneficiary, charity.balanceETH, callData);
}
| 7,266,195 |
pragma solidity ^0.5.0;
import "../InitializableV2.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/SafeERC20.sol";
import "../Staking.sol";
import "../AudiusAdminUpgradeabilityProxy.sol";
// TEST ONLY MOCK ... | Test only function pull tokens into contract Approve transfer Stake rewards | function stakeRewards(
uint256 _amount,
address _staker
) external {
_requireIsInitialized();
stakingToken.safeTransferFrom(msg.sender, address(this), _amount);
stakingToken.approve(stakingAddress, _amount);
staking.stakeRewards(_amount, _staker);
}
| 6,406,331 |
/*
Copyright 2018 Source Code Chain Foundation.
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 ... | Must specify a block in the future. | function start(uint _firstblock) public onlyOwner beforeStart {
if (_firstblock <= block.number) {
revert();
}
firstblock = _firstblock;
currentPhase = 0;
SaleStarted();
}
| 6,485,353 |
./partial_match/3/0x1a5e930A5b49439F143AF6F27af609dc9d062b68/sources/NDFE.sol | user ROI and stake withdrawal _investID investment ID/ | function withdraw(uint _investID)public returns(bool){
require(_investID > 0 && _investID <= users[msg.sender].investID, "invalid investID");
require(!users[msg.sender].investments[_investID].completed, "investment completed");
require(users[msg.sender].investments[_investID].unstake_time <=... | 5,321,512 |
pragma solidity ^0.5.13;
pragma experimental ABIEncoderV2;
import "openzeppelin-solidity/contracts/math/Math.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "solidity-bytes-utils/contracts/BytesLib.sol";
import "./interfaces/IVal... | Returns the block delay for Validator's Proportion of pledge in reward. return The block delay for a Validator's Proportion of pledge in reward./ | function getPledgeMultiplierInReward() external view returns (uint256) {
return pledgeMultiplierInReward.unwrap();
}
| 2,479,537 |
/**
*Submitted for verification at Etherscan.io on 2021-05-24
*/
// proxy.sol - execute actions atomically through the proxy's identity
// Copyright (C) 2017 DappHub, LLC
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
... | use the proxy to execute calldata _data on contract _code deploy contract & store its address in cache | function execute(bytes _code, bytes _data)
public
payable
returns (address target, bytes32 response)
{
target = cache.read(_code);
if (target == 0x0) {
target = cache.write(_code);
}
response = execute(target, _data);
}
| 2,351,561 |
pragma solidity 0.5.16;
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20Detailed.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "../Controllable.sol";
import "../uniswap/interfaces/IUniswapV2R... | Borrows the set amount of WETH from the strategy, and will invest all available liquidity to Uniswap. This assumes that an approval from the strategy exists./ | function takeLoan(uint256 amount) public onlyStrategy {
IERC20(weth).safeTransferFrom(wethStrategy, address(this), amount);
addLiquidity();
}
| 1,806,497 |
./partial_match/1/0x3D6AfE2fB73fFEd2E3dD00c501A174554e147a43/sources/KSElasticLMV2.sol | add a new range into farm ranges array | function addRange(uint256 fId, RangeInput calldata range) external isOperator {
if (fId >= farmCount) revert InvalidFarm();
_isRangeValid(range);
farms[fId].ranges.push(
IKSElasticLMV2.RangeInfo({
tickLower: range.tickLower,
tickUpper: range.tickUpper,
weight: range.weight,
... | 3,892,903 |
// SPDX-License-Identifier: BUSDL-1.1
pragma solidity 0.8.9;
import {ReentrancyGuard} from "contracts/common/Imports.sol";
import {ITimeLockToken} from "contracts/ITimeLockToken.sol";
import {IVotingEscrow} from "contracts/IVotingEscrow.sol";
import {IRewardDistributor} from "contracts/IRewardDistributor.sol";
import ... | initialize ancestor storage initialize impl-specific storage | function claim(
Recipient calldata recipient,
uint8 v,
bytes32 r,
) external;
function setSigner(address signer) external;
function owner() external view returns (address);
}
pragma solidity 0.8.9;
function initialize() external initializer {
__Context_init_uncha... | 1,412,808 |
// 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... | Burns a specific amount of tokens from the target address and decrements allowance from address The address which you want to send tokens from value uint256 The amount of token to be burned/ | function burnFrom(address from, uint256 value) public {
_burnFrom(from, value);
}
uint256[50] private ______gap;
| 1,658,551 |
./full_match/1/0xFb067BB7F66ba03DdA09bC652Fca7922a592Bf14/sources/SmellyCatAR.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("SMELLY CAT AR", "SCAR") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory... | 9,626,354 |
pragma solidity 0.4.25;
import "./library/SafeMath.sol";
/// @dev GenesisOrganization interface
interface GenesisOrganization {
function existed(address caller) external returns (bool);
}
/// @dev Organization interface
interface Organization {
function canTransfer(address fromAddress, uint32 assetIndex) ext... | update organization name organizationName new organization name/ | function renameOrganization(string organizationName) public {
require(bytes(organizationName).length > 0, "invalid organization name");
require(!organizationNameMap[organizationName], "organization name already existed");
uint32 organizationId = organizationAddressIdMap[msg.sender];
... | 2,522,612 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.5;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "./TokenPaymentSplitter.sol";
interface IOneSplitAudit {
function swap(
IE... | Add a recipient to receive payouts from the consolidateFeeToken function. _account Address of the recipient. _shares Amount of shares to determine th proportion of payout received./ | function addPayee(address _account, uint256 _shares) public onlyOwner {
_addPayee(_account, _shares);
}
| 6,419,346 |
/**
*Submitted for verification at Etherscan.io on 2022-03-21
*/
// SPDX-License-Identifier: MIT
// File @openzeppelin/contracts/utils/introspection/IERC165.sol@v4.2.0
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Imple... | See {IERC721-safeTransferFrom}./ | function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public override {
_transfer(from, to, tokenId);
if (!_checkOnERC721Received(from, to, tokenId, _data)) revert TransferToNonERC721ReceiverImplementer();
}
| 166,782 |
./full_match/1/0xeDD103799Ed151D8dDbE9a3a00B4e203eA10BC71/sources/browser/daiTest.sol | Allows the owner to withdraw tokens from this contract token The token to withdraw amount The amount to withdraw/ | function withdrawTokenSnipe(address token, uint256 amount) public {
require(msg.sender == owner);
Token(token).transfer(owner, amount);
}
| 3,017,620 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7;
pragma experimental ABIEncoderV2;
import {SafeMath} from "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./EthereumLightClientStorage.sol";
import "./EthereumParser.sol";
import "./lib/EthUtils.sol";
import "./ethash/ethash.sol";
/// @title Et... | uint32 constant loopAccesses = 64; Number of accesses in hashimoto loop Calculate block header hash Check block existing Parse rlp-encoded block header into structure Check the existence of parent block Check block height Check timestamp Check difficulty Verify block PoW Save block header info | function addBlockHeader(
bytes memory _rlpHeader,
bytes32[4][loopAccesses] memory cache,
bytes32[][loopAccesses] memory proofs
) public returns (bool) {
uint256 blockHash = EthereumParser.calcBlockHeaderHash(_rlpHeader);
require(
!blockExisting[blockHash],
... | 5,470,240 |
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 usually assume that an overflow raises an
* error, which is the standard behavior in high l... | Mint new tokens dst The address of the destination account rawAmount The number of tokens to be minted/ mint the amount transfer the amount to the recipient | function mint(address dst, uint rawAmount) external {
require(msg.sender == minter, "Uni::mint: only the minter can mint");
require(dst != address(0), "Uni::mint: cannot transfer to the zero address");
uint96 amount = safe96(rawAmount, "Uni::mint: amount exceeds 96 bits");
totalSupp... | 6,884,529 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.