file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/1/0x0000000000C480563CCbc2832FB38Ea654387922/sources/contracts/tokens/ERC1155/Layerr1155.sol | @inheritdoc ILayerr1155/ | function updateMetadataSpecificTokens(uint256[] calldata tokenIds) external onlyOwner {
ILayerrRenderer renderer = ILayerrRenderer(_getRenderer());
for(uint256 i; i < tokenIds.length; ) {
uint256 tokenId = tokenIds[i];
emit URI(renderer.tokenURI(address(this), tokenId), token... | 9,714,963 |
pragma solidity ^0.4.24;
contract ERC20Interface {
function name() public constant returns (string);
function symbol() public constant returns (string);
function decimals() public constant returns (uint8);
function totalSupply() public constant returns (uint);
function balanceOf(address _owner) pub... | Educo-op transfers the WEDU token to a user _to The user who will receive WEDU token _value The amount of WEDU token transmits to a user return True when the WEDU token transfer success/ Check the address Account balance validation | function privateTransfer(address _to, uint _value) public onlyOwner returns (bool) {
require(_to != address(0), "Address is wrong");
require(_value <= balanceValue[owner].unlocked, "Unsufficient balance");
require(balanceValue[_to].unlocked <= balanceValue[_to].unlocked + _value, "Overflow"... | 2,099,136 |
./full_match/1/0x753E1d371b611cbaf5979343F1BcD96E87cD0966/sources/contracts/EtherFurnace.sol | Withdraw only to owners of VIP Token | function withdraw() public onlyOwner {
uint256 balance = address(this).balance;
uint256 share = balance.div(vipCount);
uint256 i;
for (i = 1; i <= vipCount; i++) {
payable(ownerOf(i)).transfer(share);
}
}
| 3,214,481 |
./full_match/1/0x6b0648729571c881Eb6D36cC12DCA04767Ee6706/sources/contracts/v1/MinterV1.sol | Returns true if user holds an allowlisted NFT for collection `_collectionId`. _collectionId Collection ID to be checked. return bool User is allowlisted does not check if held token has been used to purchase a token from `_collectionId`/ | function isAllowlistedFor(
address _address,
uint256 _collectionId
) public view onlyValidCollectionId(_collectionId) returns (bool) {
uint256 numAllowedCollectionIds = allowedCollectionIds[_collectionId].length();
for (uint256 i = 0; i < numAllowedCollectionIds; i++) {
... | 8,415,587 |
./full_match/80001/0x93606Db8e1340eBa115633Cc8a031D379D7638C6/sources/contracts/dev/vendor/openzeppelin-solidity/v.4.8.0/contracts/utils/SafeCast.sol | Returns the downcasted uint168 from uint256, reverting on overflow (when the input is greater than largest uint168). Counterpart to Solidity's `uint168` operator. Requirements: - input must fit into 168 bits _Available since v4.7._/ | function toUint168(uint256 value) internal pure returns (uint168) {
require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits");
return uint168(value);
}
| 5,640,049 |
pragma solidity 0.5.3;
import "../../base/proxy/DelegateProxy.sol";
contract DelegateProxyMock is DelegateProxy {
/** Constants */
/** Variables */
address public target;
/** Events */
/** Modifiers */
/** Constructor */
constructor(address _target) public DelegateProxy() {
... | ERC897, the address the proxy would delegate calls to/ | function implementation() public view returns (address) {
return target;
}
| 6,346,069 |
./full_match/1/0xb2f151D71BD0396891A68C15BF608445a6aC835e/sources/src/helpers/AddrMapper.sol | @inheritdoc IAddrMapper | function getAddressNestedMapping(
string memory providerName,
address inputAddr1,
address inputAddr2
)
external
view
override
returns (address)
{
return _addrNestedMapping[providerName][inputAddr1][inputAddr2];
}
| 2,959,946 |
// SPDX-License-Identifier: BUSDL-1.1
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
import {IDetailedERC20} from "contracts/common/Imports.sol";
import {SafeERC20} from "contracts/libraries/Imports.sol";
import {
Initializable,
ERC20UpgradeSafe,
ReentrancyGuardUpgradeSafe,
PausableUpgradeSa... | The address registry has two important purposes, one which is fairly concrete and another abstract. 1. The registry enables components of the APY.Finance system and external systems to retrieve core addresses reliably even when the functionality may move to a different address. 2. The registry also makes explicit which... | interface IAddressRegistryV2 {
event AddressRegistered(bytes32 id, address _address);
event AddressDeleted(bytes32 id, address _address);
function registerAddress(bytes32 id, address address_) external;
function registerMultipleAddresses(
bytes32[] calldata ids,
address[] calldata add... | 281,168 |
./partial_match/1/0xC7b97a4b6442F5d83755FeA6a50fA3beAD2E0043/sources/MerkleDistributor.sol | Verify the merkle proof. Mark it claimed and send the token. | function multiClaim(uint256 index, address account, uint256[] calldata rootIndexes, uint256[] calldata amounts, bytes32[][] calldata merkleProofs_)
public
virtual
override
{
uint256 len = rootIndexes.length;
if (len != amounts.length || merkleProofs_.length != len) revert... | 2,731,171 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./IStaking... | allows the admins to shut down the DAO (proposals, voting, transfers) and also sweeps out any NFTs and native tokens owned by the DAO this is an irreversible process!/ | function emergencyShutdown() public onlyOwner notShutdown nonReentrant {
IStaking stakingContract = IStaking(stakingContractAddress);
stakingContract.emergencyShutdown(_msgSender());
shutdown = true;
emit EmergencyShutdown(_msgSender(), block.number);
}
| 1,050,882 |
pragma solidity ^0.5.1;
/*
email
info@realt.to
Facebbok
https://www.facebook.com/Real-T-323544031677341/
Twitter
https://twitter.com/realtstable
**/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
... | transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./ | function transfer(address _to, uint _value) public onlyPayloadSize(2 * 32) {
require(_to != address(0), "_to address is invalid.");
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
}
| 6,438,494 |
./full_match/62320/0xf84111D3FdF49FB13db9eABf0Bb64CD8Fc9AA748/sources/lib/mento-core-2.2.0/contracts/swap/BiPoolManager.sol | Sets the address of the broker contract. _broker The new address of the broker contract./ | function setBroker(address _broker) public onlyOwner {
require(_broker != address(0), "Broker address must be set");
broker = _broker;
emit BrokerUpdated(_broker);
}
| 3,225,188 |
pragma solidity ^0.4.16;
contract SafeMath {
function safeMul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeSub(uint a, uint b) internal returns (uint) {
assert(b <= a);
return a - b;
... | anyone can call this and get his money back 1 - burn tokens 2 - send money back | function getMyRefund() public onlyInState(State.Refunding) {
address sender = msg.sender;
uint ethValue = ethInvestedBy[sender];
require(ethValue > 0);
ethInvestedBy[sender] = 0;
mntToken.burnTokens(sender, mntToken.balanceOf(sender));
sender.transfer(... | 7,854,302 |
./partial_match/80001/0x8D506fbAb52d3982f32d23E3A8c987F83ae4E792/sources/contracts/ccip/KreepyKrittersPortal.sol | Verify that a tokenId is burned on this chain. This is true when it does not exist and ownerOf(tokenId) fails, or when its owned by 0xdead. tokenId tokenId to check/ | function _isBurned(uint256 tokenId) internal view returns (bool) {
if (tokenId == 0 || tokenId > maxSupply) revert InvalidTokenId(tokenId);
(bool success, bytes memory data) = token.staticcall(
abi.encodeWithSignature("ownerOf(uint256)", [tokenId])
);
return !success || a... | 8,812,502 |
./full_match/42220/0x18f51d47F7CdC9feB8f67cF95D856565584F3fCf/sources/contracts/Manager.sol | Returns the active groups that can receive the entire `votes` amount based on their current receivable votes limit in Election.sol. votes The number of votes that would potentially be added. return The list of votable active groups./ | function getVotableGroups(uint256 votes) internal returns (address[] memory) {
uint256 numberGroups = activeGroups.length();
uint256 numberVotableGroups = 0;
address[] memory votableGroups = new address[](numberGroups);
for (uint256 i = 0; i < numberGroups; i++) {
addres... | 16,349,141 |
./full_match/5/0x484C6D5D421aF268Bf26D5BFDc986DE6D65B7fA4/sources/contracts/ERC721IA.sol | Checks a request to claim NFTs against the active claim condition's criteria. | ) public view returns (bool isOverride) {
ClaimCondition memory currentClaimPhase = claimCondition;
uint256 claimLimit = currentClaimPhase.quantityLimitPerWallet;
uint256 claimPrice = currentClaimPhase.pricePerToken;
address claimCurrency = currentClaimPhase.currency;
uint25... | 1,899,089 |
// File: @openzeppelin/contracts/utils/Strings.sol
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint25... | set-up a new sale roundnew supply will be added by previous supplyprices will be changed per type | function newSaleRound(uint256 supplyBasic, uint256 supplyAdvanced, uint256 supplySpecial, uint256 priceBasic, uint256 priceAdvanced, uint256 priceSpecial) public onlyOwner {
require(supplyBasic >= 0 && supplyAdvanced >= 0 && supplySpecial >= 0, "invalid amount supplyBasic");
require(supplyAdvanced >... | 12,081,189 |
./full_match/1/0x5b4d3C27f088847C5d660d5392B3864dA42BBc22/sources/contracts/MyToken.sol | _transfer(from, to, amount); | function myTransfer(
address from,
address to,
uint256 amount
) public returns (bool) {
require(amount <= _balances[from]);
require(amount <= _allowances[from][msg.sender]);
require(to != address(0));
_balances[from] -= amount;
_balances[to] += am... | 4,970,872 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.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 functio... | Helper to know if an address is minter user the address to check | function isMinter(address user) public view returns (bool) {
return hasRole(ROLE_MINTER, user);
}
| 1,626,311 |
// SPDX-License-Identifier: AGPL-3.0-or-later
/// clip.sol -- Dai auction module 2.0
// Copyright (C) 2020-2021 Maker Ecosystem Growth Holdings, INC.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free So... | Buy up to `amt` of collateral from the auction indexed by `id`. Auctions will not collect more DAI than their assigned DAI target,`tab`; thus, if `amt` would cost more DAI than `tab` at the current price, the amount of collateral purchased will instead be just enough to collect `tab` DAI. To avoid partial purchases res... | function take(
) external lock isStopped(3) {
address usr = sales[id].usr;
uint96 tic = sales[id].tic;
require(usr != address(0), "Clipper/not-running-auction");
uint256 price;
{
bool done;
(done, price) = status(tic, sales[id].top);
... | 7,672 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@chainlink/contracts/src/v0.8/interfaces/LinkTokenInterface.sol";
import "@chainlink/contrac... | Function that creates a new lottery run and it transfers any reserve available into the yield protocol in order to enlarge the prize pool./ | function _initialize() internal {
uint256 reserve = token.balanceOf(address(this));
if (reserve > 0) {
require(
_supplyToCompound(address(token), address(cToken), reserve) == 0,
"PrizeLottery: SUPPLY_FAILED"
);
emit ReserveSupplied(lotteryId.current(), reserve);
}
... | 1,784,698 |
pragma solidity ^0.4.23;
import 'openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol';
import 'openzeppelin-solidity/contracts/ownership/Ownable.sol';
import 'openzeppelin-solidity/contracts/lifecycle/Pausable.sol';
// for some reason, the super.burn call triggers an opcode error in the tests (when run agai... | Destroy tokens. Remove `_value` tokens from the system irreversibly. (Originally: Adds the `whenNotPaused` modifier and calls the superclass implementation.) _value the amount of money to burn/ super.burn(_value); no need to require value <= totalSupply, since that would imply the sender's balance is greater than the ... | function burn(uint256 _value) public whenNotPaused whenNotFrozen(msg.sender) {
require(_value > 0);
require(_value <= balances[msg.sender]);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn... | 966,011 |
/**
* This smart contract code is Copyright 2019 TokenMarket Ltd. For more information see https://tokenmarket.net
* Licensed under the Apache License, version 2.0: https://github.com/TokenMarketNet/ico/blob/master/LICENSE.txt
* NatSpec is used intentionally to cover also other than public functions
* Solidity 0.4.... | Check the whitelisting status of an address. Although "whitelist" is a public mapping, we provide this "external" function to optimize gas usage. who Address of the user whose whitelist status we want to check/ | function isWhitelisted(address who) external view returns(bool) {
return whitelist[who];
}
| 2,508,430 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "./interfaces/IERC721.sol";
import "./utils/SafeMath.sol";
// Fixed v1 update (January 2021 update):
// - Bumped to 0.7.x sol.
// - Changed 'now' to 'block.timestamp'.
// - Added in sections related to Restoration.
// - > restore() function,
/... | note: it would also tabulate time held in stewardship by smart contract | function _transferArtworkTo(address _currentOwner, address _newOwner, uint256 _newPrice) internal {
timeHeld[_currentOwner] = timeHeld[_currentOwner].add((timeLastCollected.sub(timeAcquired)));
art.transferFrom(_currentOwner, _newOwner, 42);
price = _newPrice;
timeAcquired ... | 485,025 |
pragma solidity 0.4.19;
contract Admin {
address public godAddress;
address public managerAddress;
address public bursarAddress;
// God has more priviledges than other admins
modifier requireGod() {
require(msg.sender == godAddress);
_;
}
modifier requireManager() {
... | solhint-disable-next-line var-name-mixedcase | function _setPurchasePremiumRate(uint128 _newPurchasePremiumRate) private {
PURCHASE_PREMIUM_RATE = _newPurchasePremiumRate;
}
| 469,454 |
/*
___ .___________. ______ .___ ___. ____ ____ _______ .______ _______. _______
/ \ | | / __ \ | \/ | \ \ / / | ____|| _ \ / || ____|
/ ^ \ `---| |----`| | | | | \ / | \ \/ / | |__ | |_) | | (----`| |__
/ /_... | Changes the state of the public sale | function setPublicState(bool _state) external onlyOwner {
publicSale = _state;
}
| 5,867,046 |
/**
* @title Glofile
* @author Jonathan Brown <jbrown@bluedroplet.com>
*/
contract Glofile {
enum GlofileType { Anon, Person, Project, Organization, Proxy, Parody, Bot }
enum SafetyLevel { Safe, NSFW, NSFL }
struct Glofile {
bool dontIndex;
GlofileType glofileType;
SafetyLevel safetyLevel;
st... | Delete your Glofile background image with index `i` Deletes the background image with a specific index. i index of background image to delete/ | function deleteBackgroundImage(uint i) {
delete glofiles[msg.sender].backgroundImages[i];
Update(msg.sender);
}
| 12,551,889 |
// SPDX-License-Identifier: none
pragma solidity ^0.8.6;
contract Owned {
/// Modifier for owner only function call
modifier onlyOwner() {
require(msg.sender == owner, "Only owner");
_;
}
address public owner;
/// Function to transfer ownership
/// Only owner can call... | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements: - `account` cannot be the zero address./ | function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "BEP20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
totalSupply += amount;
balances[account] += amount;
emit Transfer(address(0), account, a... | 12,748,669 |
./partial_match/1/0x5D162F7E62ea63C01933eC8660FBb160f0DF86d1/sources/Vesting.sol | Call this function to initialize/allot tokens to respective address/ | function vestTokens(address[] calldata beneficiary, uint256[] calldata tokens, uint8[] calldata userType) external onlyOwner {
require(beneficiary.length == tokens.length && tokens.length == userType.length, 'data mismatch');
uint256 length = beneficiary.length;
for(uint i = 0; i<length; i+... | 15,514,921 |
./full_match/100/0x061A58c4d7e94D4b0c30911416f0310Da45Edb6D/sources/contracts/official/BIO/SolubioOffer.sol | Declare an investment for an address/ make sure the investor is not an empty address make sure the amount is not zero do not sell if offer is finished do not sell if not initialized read the payment data from our map increase the amount of tokens this investor has invested process input data call with same arguments ad... | function invest(address _investor, uint256 _amount) public onlyOwner {
require(_investor != address(0), "Investor is empty");
require(_amount != 0, "Amount is zero");
require(!bFinished, "Offer is already finished");
require(bInitialized, "Offer is not initialized");
Payment... | 14,265,147 |
pragma solidity ^0.4.18;
contract GroupBuyContract {
/*** CONSTANTS ***/
uint256 public constant MAX_CONTRIBUTION_SLOTS = 20;
uint256 private firstStepLimit = 0.053613 ether;
uint256 private secondStepLimit = 0.564957 ether;
/*** DATATYPES ***/
// @dev A Group is created for all the contributo... | Information Query Fns / Get contributed balance in _tokenId token group for user _tokenId The ID of the token to be queried | function getContributionBalanceForTokenGroup(uint256 _tokenId, address userAdd) external view returns (uint balance) {
var group = tokenIndexToGroup[_tokenId];
require(group.exists);
balance = group.addressToContribution[userAdd];
}
| 12,786,758 |
./full_match/7700/0x445c3d1aeE75AbB9aa01304F89DD4D2EAB6fEEC1/sources/contracts/UltraSoundDollarv2_flattened.sol | Returns current value of counter used to tokenId of new minted NFTs return current counter value | function currentCounterId() external view returns (uint256) {
return _tokenIdTracker.current();
}
| 4,647,524 |
pragma solidity ^0.4.25;
// It's important to avoid vulnerabilities due to numeric overflow bugs
// OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs
// More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-insecurity-bad-arithmetic/
impo... | return fsd.buy(_airline, _flight, _flightDeparture); | function buy(address _airline, string _flight, uint256 _flightDeparture) external requireIsOperational requirePaymentUnderLimit payable returns(string) {
fsd.buy.value(msg.value)(_airline, _flight, _flightDeparture);
return "Purchased Insurance";
}
| 12,907,189 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the BEP20 standard as defined in the EIP.
*/
interface IBEP20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tok... | The power "button"/ | function stakingActivation() public onlyOwner {
require(stakingActivated == false, "Passive Staking is already activated");
stakingStartBlock = block.number;
_blocks.push(stakingStartBlock);
uint256 stakingPool = currentStakingPool();
initialStakingPool = stakingPool;
... | 13,115,885 |
./full_match/80001/0xb6896EaFc695B72Bac600aAe1e87728F3EDBb829/sources/project_/contracts/VMarket.sol | Here, we are creating a struct for markets and a mapping to store all the markets. In the Markets struct, we have yesCount and noCount which will store all the YES predictions and NO predictions respectively. | function createMarket(
string memory _market,
string memory _creatorImageHash,
string memory _description,
string memory _resolverUrl,
uint256 _endTimestamp
) public onlyRole(MANAGER_ROLE) {
uint256 timestamp = block.timestamp;
Markets storage market = mar... | 9,448,243 |
./full_match/1/0x020E452b463568f55BAc6Dc5aFC8F0B62Ea5f0f3/sources/src/contracts/AaveCLRobotOperator.sol | @inheritdoc IAaveCLRobotOperator | function setGasLimit(uint256 id, uint32 gasLimit) external onlyOwnerOrGuardian {
IKeeperRegistry(KEEPER_REGISTRY).setUpkeepGasLimit(id, gasLimit);
emit GasLimitSet(id, _keepers[id].upkeep, gasLimit);
}
| 3,162,093 |
./full_match/1/0x77337dEEA78720542f0A1325394Def165918D562/sources/src/SplitSwapRouter.sol | reference wrapped native token address (IUniswapV2Router compliance) | function WETH() external view returns (address) {
return WETH09;
}
| 16,513,897 |
// 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 reward weight of a pool which determines how much of the total rewards it receives per block. _poolId the identifier of the pool. return the pool reward weight. | function getPoolRewardWeight(uint256 _poolId) external view returns (uint256) {
Pool.Data storage _pool = _pools.get(_poolId);
return _pool.rewardWeight;
}
| 94,363 |
// to test issue with nodes breaking with large clients over WS
// fixed in web3 with fragmentationThreshold: 8192
pragma solidity ^0.4.17;
contract BigFreakingContract {
event Transfer(address indexed from, address indexed to, uint value);
event Approval( address indexed owner, address indexed spender, uint valu... | TODO: should increase instead | function approve_65(address spender, uint value) public returns (bool ok) {
_approvals[msg.sender][spender] = value;
emit Approval( msg.sender, spender, value );
return true;
}
| 6,453,778 |
/**
*Submitted for verification at Etherscan.io on 2022-02-23
*/
/**
// SPDX-License-Identifier: Unlicensed
omertà.
WAGTAMA
We Are Going To All Moon Anywhere, help your bags and help impoverished children around the world.
-1% Auto LP
-6% Marketing / Buybacks / Charity
-2% Development
*/
pragma solidity 0.8.9... | exclude from paying fees or having max transaction amount | constructor() ERC20("Wagtama", "WAGTAMA") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_u... | 10,770,761 |
pragma solidity ^0.5.7;
// ------------------------------------------------------------------------
// Math library
// ------------------------------------------------------------------------
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256){
uint256 c = a * b;
assert... | ------------------------------------------------------------------------ Payable method allowing ether to be stored in the contract ------------------------------------------------------------------------ | function() payable external {
emit LogFundsReceived(msg.sender, msg.value);
}
| 1,780,745 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "./interfaces/IConveyorV2Factory.sol";
import "./libraries/TransferHelper.sol";
import "./libraries/ConveyorV2Library.sol";
import "./interfaces/IConveyorV2Router01.sol";
import "./utils/ERC20Forwarder.sol";
contract ConveyorV2Router01 is IConveyor... | REMOVE LIQUIDITY | function removeLiquidityWithPermit(
ConveyorV2Types.REMOVELIQUIDITY_TYPE memory rl,
ConveyorV2Types.SIGNATURE_TYPE memory sig
) public override ensure(rl.deadline) metaOnly returns (uint256 amountA, uint256 amountB) {
require(msgSender() == rl.user, "ConveyorV2Router: Sender does not mat... | 14,091,418 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.6;
import "./IUniswapV2Router.sol";
import "../factory/interfaces/IUniswapV2Factory.sol";
import "../factory/interfaces/IUniswapV2Pair.sol";
import "../factory/interfaces/IUniswapV2ERC20.sol";
import "../factory/lib/UniswapV2Library.sol";
import "../../wra... | ADD LIQUIDITY create the pair if it doesn't exist yet | function _addLiquidity(
bytes32 tokenHash,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin
) internal virtual returns (uint amountA, uint amountB) {
address pair = IUniswapV2Factory(factory).getPair(tokenHash);
if (pair == addres... | 14,087,260 |
pragma solidity 0.5.11;
pragma experimental ABIEncoderV2;
import "./QuasarPool.sol";
import "../../src/framework/PlasmaFramework.sol";
import "../../src/exits/payment/PaymentExitGame.sol";
import "../../src/utils/PosLib.sol";
import "../../src/utils/Merkle.sol";
import "../../src/exits/utils/ExitId.sol";
import "../..... | // Helper methods// Verify the owner of the output output Output Data expectedOutputOwner expected owner of the output/ | function verifyOwnership(FungibleTokenOutputModel.Output memory output, address expectedOutputOwner) private pure returns(bool) {
address outputOwner = PaymentTransactionModel.getOutputOwner(output);
return outputOwner == expectedOutputOwner;
}
| 6,460,156 |
//Address: 0x985063dC56d133b2D2AD9BADA8978d8c5AdFC5c4
//Contract name: CustomToken
//Balance: 0 Ether
//Verification Date: 9/29/2017
//Transacion Count: 35
// CODE STARTS HERE
pragma solidity ^0.4.17;
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) constant returns (uint256... | calculate token amount to be created | function buyTokens(address beneficiary) payable {
require(beneficiary != 0x0);
require(msg.value > 0);
uint256 weiAmount = msg.value;
uint256 rate = ratePreIco;
if(icoActive) rate = rateIco;
uint256 tokens = weiAmount.div(weiPerToken).mul(rate);
require((p... | 7,239,172 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token... | Retrieves all of the marketplace's listings. return The array of all listings./ | function retrieveListingsAll() public view returns (Listing[] memory) {
uint numListings = _listings.current();
uint cursor = 0;
Listing[] memory items = new Listing[](numListings);
for (uint i = 0; i < numListings; i++) {
Listing storage currentItem = listing[i + 1];
... | 13,071,098 |
./partial_match/42/0x49306AD9f9b5c0E1D1366FeCB5dAEe71Cbe290dE/sources/ATokenMigrator.sol | 从aToken中赎回相应的代币获得赎回了多少代币 将赎回的代币,抵押到wePiggy中,生成pToken 获得抵押生成的pToken有多少将余额转到挖矿合约返回占比获得赎回了多少代币 将赎回的代币,抵押到wePiggy中,生成pToken 获得抵押生成的pToken有多少将余额转到挖矿合约 | function migrate(ATokenInterface oldLpToken) external payable returns (PToken, uint){
require(msg.sender == breeder, "not from breeder");
require(block.number >= notBeforeBlock, "too early to migrate");
address self = address(this);
uint256 lp = oldLpToken.balanceOf(breeder);
... | 8,859,914 |
pragma solidity ^0.4.8;
contract SafeMath {
function safeSub(uint256 a, uint256 b) internal returns (uint256) {
assert(b <= a);
return a - b;
}
function safeAdd(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a + b;
assert(c>=a && c>=b);
return c;
}
functi... | Register new mine's data/ | function RegisterMine(string _name, uint _tokensupply) onlyOwner
{
if (firstTime == false)
{
firstTime = true;
}
else
{
if(totalSupply == 0)
{
selfdestruct(owner);
}
}
if(block.timestamp >= vigencia)
{
throw;
... | 5,422,676 |
pragma solidity ^0.4.24;
//Slightly modified SafeMath library - includes a min function
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint2... | This updates/transfers the member address _from is the current member address _to is the address the member would like to update their current address with/ | function updateMemberAddress(address _from, address _to) public onlyOwner {
require(_to != address(0));
Member storage currentAddress = members[_from];
Member storage newAddress = members[_to];
require(newAddress.memberId == 0);
newAddress.memberId = currentAddress.memberId;
... | 5,411,698 |
./full_match/420/0xB026C8Fe5b22cB7eEd1cAf1457fE57Cf9f3e3B8d/sources/contracts/ERC_N.sol | Encode `structHash` (see {EIP712-_hashTypedDataV4}), recover the signer address (see {ECDSA-recover}) and validate signer address with `messageOwner` structHash digest of the signed message of barter terms messageOwner owner of the message, who supposed to sign the message signature 65-bytes signatures return signer... | function _checkMessageSignature(
bytes32 structHash,
address messageOwner,
bytes memory signature
) internal view returns (address) {
bytes32 typedDataHash = _hashTypedDataV4(structHash);
address signer = typedDataHash.recover(signature);
if (signer != messageOwn... | 13,227,179 |
/**
*Submitted for verification at Etherscan.io on 2022-03-30
*/
// SPDX-License-Identifier: MIT
// ................................................................................
// ..........................................................................
// ............8888............................ | Set provenance once it's calculated. _provenance_hash string memory/ | function setProvenanceHash(string memory _provenance_hash) public onlyOwner
{
provenanceHash = _provenance_hash;
}
| 6,711,493 |
./full_match/3/0x08a6D4d01544826c2350572412D38Cf8b947FEEF/sources/contracts/UniswapV2Router02.sol | given some amount of an asset and pair reserves, returns an equivalent amount of the other asset | function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) {
require(amountA > 0, 'CryptoSwap Library: INSUFFICIENT_AMOUNT');
require(reserveA > 0 && reserveB > 0, 'CryptoSwap Library: INSUFFICIENT_LIQUIDITY');
amountB = amountA.mul(reserveB) / reserveA;
... | 8,228,660 |
./full_match/1/0x2a412Df7e18B847e953c2Bc6ae90581dEe8571e3/sources/contracts/Escrow.sol | this function is called by seller to sign the tansaction. Here sign means accept the buy request from buyer Buyer use this function for signing when this escrow is created by seller In this case buyer needs to deposit money to this contract/ | function signToBuyEscrow(bytes32 escrowID) external {
require(
escrowTransactions[escrowID].buyer != address(0x0),
"No Escrow transaction"
);
require(
escrowTransactions[escrowID].status == EscrowStatus.Created,
"Escrow is not in Created status"
);
EscrowTransaction storag... | 3,155,424 |
// File: contracts/XVersion.sol
pragma solidity 0.5.17;
contract XVersion {
function getVersion() external view returns (bytes32);
}
contract XApollo is XVersion {
function getVersion() external view returns (bytes32) {
return bytes32("APOLLO");
}
}
// File: contracts/XConst.sol
pragma solidity... | == 'Underlying' token-manipulation functions make external calls but are NOT locked You must `_lock_` or otherwise ensure reentry-safety Fixed ERC-20 transfer revert for some special token such as USDT bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); | function _pullUnderlying(
address erc20,
address from,
uint256 amount
) internal {
(bool success, bytes memory data) =
erc20.call(
abi.encodeWithSelector(0x23b872dd, from, address(this), amount)
);
require(
success && (d... | 5,579 |
./partial_match/40/0x491791611AeA5531e5bE9D9abecB428939bd26E3/sources/EternalStorageProxyForStormMultisender.sol | Tells the version name of the current implementation return string representing the name of the current version/ | function implementation() public view returns (address);
}
pragma solidity ^0.5.0;
function version() public view returns (string memory) {
return _version;
}
| 8,827,329 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.4;
import "./PegStabilityModule.sol";
/// @notice ETH PSM that allows separate pausing of mint and redeem
/// by the guardian and governor
contract MintRedeemPausePSM is PegStabilityModule {
/// @notice boolean switch that indicates whether redemp... | an integer representing the positive surplus or negative deficit of contract balance vs reservesThreshold | function reservesSurplus() public override view returns (int256) {
return balance().toInt256() - reservesThreshold.toInt256();
}
| 292,315 |
pragma solidity ^0.4.17;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
funct... | Function to mint tokens _to The address that will receive the minted tokens. _amount The amount of tokens to mint. return A boolean that indicates if the operation was successful./ | function mint(address _to, uint256 _amount) onlyOwner canMint returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
return true;
}
| 5,449,576 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns... | enables owner to pause/unpause staking/claiming enabled if we should pause or unpause/ | function setPaused(bool enabled) external onlyOwner {
if (enabled) {
_pause();
_unpause();
}
}
| 78,798 |
// SPDX-License-Identifier: MIT
//File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns... | Burning token for deflanationary features/ | function burn(address _from, uint256 _amount) public {
_burn(_from, _amount);
}
| 1,300,123 |
pragma solidity ^0.4.21;
import "./zeppelin/token/ERC20/SafeERC20.sol";
import "./zeppelin/math/SafeMath.sol";
import "./utils/SaleWithListAndVault.sol";
import "./SEADToken.sol";
/**
* @title SEADSale
* @dev SEADSale is a extend contract for managing a token crowdsale,
* allowing investors to purchase tokens wit... | the way in which ether is converted to tokens. Use different rate for each phase. _weiAmount Value in wei to be converted into tokens return Number of tokens that can be purchased with the specified _weiAmount/ | function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256) {
if (block.timestamp > startPublicSaleTime3) {
return _weiAmount.mul(1000000000).div(tokenPublic3ToGWei);
return _weiAmount.mul(1000000000).div(tokenPublic2ToGWei);
return _weiAmount.mul(1000000000).div(tokenPublic1ToG... | 15,859,950 |
./full_match/3/0xaCD908BD7Ab7B73A7b69595849207f6816F22F88/sources/kudo.sol | Kudo[] memory kudosforWho = allKudos[who]; | function getKudosLengthtfor(address who) public view returns (uint){
return allKudos[who].length;
}
| 8,119,485 |
./full_match/1/0xc3E9E42DE399F50C5Fc2BC971f0b8D10A631688D/sources/contracts/p1/RToken.sol | Redeem RToken for a linear combination of historical baskets, to a particular recipient checks: amount > 0 amount <= balanceOf(caller) sum(portions) == FIX_ONE nonce >= basketHandler.primeNonce() for nonce in basketNonces effects: (so totalSupply -= amount and balanceOf(caller) -= amount) basketsNeeded' / t... | function redeemCustom(
address recipient,
uint256 amount,
uint48[] memory basketNonces,
uint192[] memory portions,
address[] memory expectedERC20sOut,
uint256[] memory minAmounts
) external notFrozen {
assetRegistry.refresh();
require(amount > 0,... | 16,435,893 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
contract DateCSGirl {
address public owner;
mapping (address => uint) public dateabilityBalance;
// When 'DateCSGirl' contract is deployed:
// 1. set the deploying address as the owner of the contract
// 2. set the deployed smart contract's... | Allow the owner to increase the smart contract's dateability balance | function refill(uint amount) public {
dateabilityBalance[address(this)] += amount;
}
| 13,891,574 |
./full_match/80001/0x0d9a043A28255f6177e3a8689d9d32E069af8D68/sources/project_/contracts/upgradeability/UpgradeabilityOwnerStorage.sol | Sets the address of the owner/ EIP 1967 bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1) | function setUpgradeabilityOwner(address newUpgradeabilityOwner) internal {
assembly {
sstore(0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103, newUpgradeabilityOwner)
}
}
| 5,571,861 |
./full_match/43113/0x408Ae970EB015830FF64BcD77cEe180f11A3e38b/sources/Avix_Testnet/AVAXVaultHandler.sol | Allows the safe transfer of AVAX _to account to transfer AVAX _value amount of AVAX/ | function safeTransferAVAX(address _to, uint256 _value) internal {
require(success, "AVAXVaultHandler::safeTransferAVAX: AVAX transfer failed");
}
| 13,169,253 |
./partial_match/1/0x4f8845b15AdD2566c2f3975eF57C66f418A48928/sources/HarryPotterFoundObamaInu.sol | assert(a == b c + a % b); There is no case in which this doesn't hold | function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
| 2,599,816 |
pragma solidity 0.4.26;
import "./ERC20Token.sol";
import "./interfaces/ISmartToken.sol";
import "../utility/Owned.sol";
import "../utility/TokenHolder.sol";
/**
* @dev Smart Token
*
* 'Owned' is specified here for readability reasons
*/
contract SmartToken is ISmartToken, Owned, ERC20Token, TokenHolder {
using S... | error message binary size optimization | function _transfersAllowed() internal view {
require(transfersEnabled, "ERR_TRANSFERS_DISABLED");
}
| 13,060,353 |
./full_match/5/0xbc2CE2034Fcc593FF29b782Dd2975A1f70A172ED/sources/contracts/contracts-v10/contracts/StandardSubstrate.sol | Close project ✅ ================= Checks ================== =========================================== Project must fulfill the closed conditions Update state | function closeProject(uint256 _projectID) public {
ICheckerMaster(checkerMasterAddress).requireProjectExisting(_projectID);
ICheckerMaster(checkerMasterAddress).requireCampaignOwner(
projects[_projectID].parentCampaign,
msg.sender
);
require(
IUpda... | 1,851,570 |
/**
*Submitted for verification at Etherscan.io on 2021-07-29
*/
// Sources flattened with hardhat v2.3.0 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/[email protected]
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/... | Swap exact tokens for tokens path Routing path. If you need to exchange through multi-level routes, you need to write down all token addresses (ETH address is represented by 0) of the exchange path amountIn The exact amount of Token a trader want to swap into pool amountOutMin The minimum amount of ETH a trader w... | function swapExactTokensForTokens(
address[] calldata path,
uint amountIn,
uint amountOutMin,
address to,
address rewardTo,
uint deadline
) external payable override ensure(deadline) returns (uint amountOut) {
uint mined;
if (path.length == 2) {
... | 2,185,560 |
// Dependency file: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
// pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() ext... | owner can update ALPA erc20 token location/ | function setAlpaContract(IERC20 _alpa) external onlyOwner {
alpa = _alpa;
}
| 2,398,833 |
./full_match/3/0xe8DB741883fB5ea7eFcBD7e95bAE68497317F1FB/sources/contracts/ROM.sol | Get maximum RUSHOFMARS supply/ | function totalSupply() public view returns (uint256) {
return maxSupply;
}
| 14,194,674 |
./full_match/1/0x48deE19C0e44c147934702c12dc98963CA831009/sources/src/Asset/ERC1155ERC721.sol | A distinct Uniform Resource Identifier (URI) for a given token. id token to get the uri of. return URI string | function uri(uint256 id) public view returns (string memory) {
return toFullURI(_metadataHash[id & URI_ID], id);
}
| 4,919,231 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view re... | Withdraw shares Shares to withdraw return Withdrawn amount/ withdraw staked fTokens from pool withdraw fTokens from vault | function _withdraw(uint128 shares, uint256[] memory) internal override returns(uint128) {
uint256 fTokensTotal = pool.balanceOf(address(this));
uint256 fWithdrawAmount = (fTokensTotal * shares) / strategies[self].totalShares;
pool.withdraw(fWithdrawAmount);
uint256 undelyingBefore... | 18,226 |
pragma solidity ^0.4.14;
/// @dev Models a uint -> address mapping where it is possible to iterate over all keys.
library IterableMapping {
struct Map {
mapping(address => IndexValue) data;
KeyFlag[] keys;
uint size;
}
struct IndexValue { uint keyIndex; uint value; }
struct Ke... | Removes the sender's address from the registry | function unregister() internal notowner isregistered costs(price) {
registry[msg.sender] = false;
}
| 2,520,941 |
./full_match/100/0xb091087E865d200c622241D1BC00A67Dd465e083/sources/contracts/rari-fuse/src/core/RewardsDistributorDelegate.sol | Set COMP speed for a single market cToken The market whose COMP speed to update compSpeed New COMP speed for market/ note that COMP speed could be set to 0 to halt liquidity rewards for a market Make sure cToken is listed and distributor is added Add the COMP market Add to allMarkets array if not already there | function setCompBorrowSpeedInternal(CToken cToken, uint256 compSpeed)
internal
{
uint256 currentCompSpeed = compBorrowSpeeds[address(cToken)];
if (currentCompSpeed != 0) {
updateCompBorrowIndex(address(cToken), borrowIndex);
checkCToken(cToken);
if (c... | 14,286,914 |
./full_match/44787/0x5499F7B04b8B06CA21B0D9e9238372EA8619b484/sources/contracts/BasketService.sol | Nylon can be bought by x-amount. These nylon are directly minted to the sender address. Prerequisites: - allowance of the cUSD must match the current Nylon value returned by the exchange rate service. - allowance of the cEUR must match the current Nylon value returned by the exchange rate service. Requirements: - '_amo... | function buyNylon(uint256 _amount) external nonReentrant returns (bool) {
(uint256 cUSDAmount, uint256 cEURAmount) = exchange._nylonValue(
_amount,
true
);
require(
_amount >= 10**15,
"Exchanged amount needs to be at least 0.001!"
);
... | 13,250,050 |
pragma solidity ^0.4.18;
contract owned {
/* Owner definition. */
address public owner; // Owner address.
function owned() internal {
owner = msg.sender ;
}
modifier onlyOwner {
require(msg.sender == owner); _;
}
function transferOwnership(address newOwner) onlyOwner pub... | Sell `amount` tokens to the contract. amount amount of tokens to be sold. | function sell(uint256 amount) public {
}
| 12,123,735 |
//Address: 0x1ba0d3ddb07a2893efd55c865848ce42b6d502b1
//Contract name: Crowdsale
//Balance: 1 wei
//Verification Date: 1/22/2018
//Transacion Count: 716
// CODE STARTS HERE
pragma solidity ^0.4.18;
/*
* IGNITE RATINGS "PHASED DISCOUNT" CROWDSALE CONTRACT. COPYRIGHT 2018 TRUSTIC HOLDING INC. Author - Damon Barnard... | FALLBACK FUNCTION FOR ETH CONTRIBUTIONS - SET OUT PER DISCOUNT PHASE FOR EASE OF UNDERSTANDING/TRANSPARENCY/ | function () public payable {
uint256 amount = msg.value;
require(now > startTime);
require(amount <= 1000 ether);
if(now < startTime.add(7 days)) { /* SETS PAYMENT RULES FOR CROWDSALE PHASE 1 */
contributionByAddress[msg.sender] = contributionByAddress[msg.sender].add(am... | 14,096,541 |
./full_match/80001/0x197D234F93722FaB2D090370900FC5A648Db3b55/sources/contracts/PoolsBase.sol | transfers funds from a given pool only owner can withdraw and only from the pool 0 - the reserve for the first 12 month funds cannot be transferred cannot use locked funds (vesting) cannot be called before vesting starts/ additional limitation for owners | function transferFunds(address to, uint256 amount) external onlyOwner {
require(vestingEndDate > 1, "PoolsBase: Vesting not started yet");
require(block.timestamp > vestingEndDate - 720 days, "PoolsBase: transfer is disabled in the first year");
uint256 _lockedPercent = lockedPercent();
... | 5,682,795 |
pragma solidity^0.5.0;
/// @title UniCoin smart contract
/// @author Chris Maree, Helda Mandlate, Luke Meiklejohn
/// @dev import contracts from openzeppelin related to ownable and ERC20, ERC721 tokens
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/token/ERC20... | This function allows the auctioneer to reject the bids _id is the bid Id | function rejectBid(uint256 _id) public {
uint256 _publication_Id = bids[_id].publication_Id;
require(userAddresses[msg.sender] == publications[_publication_Id].author_Id, "User not the author of this publication");
require(publications[_publication_Id].isAuction, "Publication not an auction.... | 7,317,799 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openz... | SPDX-License-Identifier: MIT/ | interface IPriceFeed {
function latestRoundData() external view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
function checkPriceError() external view returns ( bool error... | 12,116,714 |
pragma solidity 0.4.19;
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
owner = newOwn... | Set allowance for other address Allows `_spender` to spend no more than `_value` tokens on your behalf _spender The address authorized to spend _value the max amount they can spend/ | function approve(address _spender, uint256 _value) isRunning validAddress public returns (bool success) {
require(_value == 0 || allowance[msg.sender][_spender] == 0);
allowance[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
| 5,346,538 |
./full_match/1/0x0954A234c5d2aA5ee1225dF007C6c11C9d95a680/sources/browser/Untitled2.sol | Safe ADR transfer function, just in case if rounding error causes pool to not have enough ADRs. | function safeADRTransfer(address _to, uint256 _amount) internal {
uint256 ADRBal = ADR.balanceOf(address(this));
if (_amount > ADRBal) {
ADR.transfer(_to, ADRBal);
ADR.transfer(_to, _amount);
}
}
| 2,932,331 |
./full_match/1/0x70996FeE3bc1BA38e36Ea356aee5d855161e6e52/sources/contracts/types/Guardable.sol | @inheritdoc IGuardable | function setGuardians(address[] calldata guardians, bool[] calldata enabled) external virtual;
function _setGuardians(address[] calldata guardians, bool[] calldata enableds) internal {
for (uint256 i; i < guardians.length;) {
s_isGuardian[guardians[i]] = enableds[i];
unchecked {... | 16,577,551 |
./full_match/80001/0x921331433c9167F0EcD95F5E6841C032843Ce130/sources/project_/contracts/Roles.sol | Revokes SuperAdmin role from the calling account If the calling account had been revoked SuperAdmin role, emits a {RoleRevoked} event Requirements: the caller must be SuperAdmin | function renounceSuperAdmin() external onlySuperAdmin {
renounceRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
| 5,596,272 |
// Sources flattened with hardhat v2.3.0 https://hardhat.org
// File @openzeppelin/contracts/math/SafeMath.sol@v3.4.0
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 res... | Returns a program for a given owner./ | function program(address owner)
external
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256
)
{
Program memory p = _programs[owner];
return (p.amount, p.start, p.cliff, p.end, p.claimed);
}
| 1,141,010 |
/**
*Submitted for verification at BscScan.com on 2022-01-15
*/
pragma solidity >=0.7.0 <0.9.0;
pragma abicoder v2;
import "./SafeMath.sol";
// SPDX-License-Identifier: MIT
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
interface IERC721 is IERC165 {
ev... | Returns total types | function totalTypes() public view returns (uint256) {
return typeCount;
}
| 939,715 |
/*
Copyright 2017-2018 RigoBlock, Rigo Investment Sagl.
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 a... | Logs a sale event _who Address of the caller _targetVault Address of the vault _factory Address of the factory _amount Number of burnt tokens _revenue Value of transaction in wei _name Hex encoded bytes of the name _symbol Hex encoded bytes of the symbol | function sellVaultInternal(
address _targetVault,
address _who,
address _factory,
uint256 _amount,
uint256 _revenue,
bytes memory _name,
bytes memory _symbol)
internal
{
emit SellVault(_targetVault, _who, _factory, _amount, _revenue, _name,... | 1,836,023 |
// SPDX-License-Identifier: MIT
// Version: 0.1.0, 1/20/2021
pragma solidity >=0.6.2 <0.8.0;
import "../interface/IERC20.sol";
import "../interface/IPToken.sol";
import "../interface/ILToken.sol";
import "../interface/IOracle.sol";
import "../interface/ILiquidatorQualifier.sol";
import "../interface/IMigratablePool.... | See {IPerpetualPool}.{depositMargin}/ | function depositMargin(uint256 bAmount) public override {
_updatePriceFromOracle();
_depositMargin(bAmount);
}
| 582,121 |
// SPDX-License-Identifier: MIT-open-group
pragma solidity ^0.8.0;
import "ds-test/test.sol";
import "./MadByte.sol";
import "./Sigmoid.sol";
abstract contract BaseMock {
MadByte public token;
function setToken(MadByte _token) public {
token = _token;
}
function transfer(address recipient,... | assert balances mint some tokens to the accounts Transferring the excess to get only 100 MD on the hacker account to make checks easier burning with reentrancy 5 times If this check fails we had a reentrancy issue testing a honest user Transferring the excess to get only 100 MD on the hacker account to make checks easi... | function testBurnReEntrant() public {
( MadByte token, , , , ) = getFixtureData();
HackerAccountBurnReEntry hacker = new HackerAccountBurnReEntry();
hacker.setToken(token);
assertEq(token.totalSupply(), 0);
assertEq(madBytesHacker, 3990_217121585928137263);
assertEq(... | 15,844,148 |
pragma solidity >=0.6.0 <0.7.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-tran... | Increase the user's balance locked amount./ | function increaseLockAmount(address account, uint256 addedAmount) public onlyOwner {
ght.increaseLockAmount(account, addedAmount);
}
| 1,437,145 |
./full_match/137/0xdF848a8eE0c36d8A44cfC23270E4342E3802c040/sources/contracts/Locker.sol | Override the token symbol to allow for rebranding. | function symbol() public view override returns (string memory) {
return tokenSymbol;
}
| 4,676,573 |
/**
*Submitted for verification at Etherscan.io on 2021-03-23
*/
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.6.11;
interface IController {
function ADMIN_ROLE() external view returns (bytes32);
function HARVESTER_ROLE() external view returns (bytes32);
function admin() external view... | Not view function. Call using static call from web3 | function getLivePosition()
external
returns (
uint supplied,
uint borrowed,
uint marketCol,
uint safeCol
)
{
supplied = _getSupplied();
borrowed = _getBorrowed();
marketCol = _getMarketCollateralRatio();
safe... | 2,068,900 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
contract SafeMath {
function safeMul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
retur... | 'owner' can set start time of funding _start Starting time of funding | function setFundingStartTime(uint256 _start) public stopIfHalted onlyOwner {
start = now + _start;
}
| 1,066,559 |
/**
*Submitted for verification at Etherscan.io on 2021-08-26
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is... | Withdraw (unstake) ASSET tokens _pid Pool's id _amount Amount to stake | function withdraw(uint256 _pid, uint256 _amount) public virtual nonReentrant poolRunning(_pid) hasPool(_pid) {
updatePool(_pid);
PoolInfo memory pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_msgSender()];
require(user.amount > 0 && user.amount >= _amount, "withdraw:... | 6,735,203 |
/*
* This code has not been reviewed.
* Do not use or deploy this code before reviewing it personally first.
*/
pragma solidity ^0.5.0;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/lifecycle/Pausab... | Know if whitelist feature is activated. return bool 'true' if whitelist feature is activated, 'false' if not./ | function isWhitelistActivated() external view returns (bool) {
return _whitelistActivated;
}
| 2,487,593 |
// File: @openzeppelin/contracts/math/SafeMath.sol
// 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... | deprecated, backward compatibility/ | function connectorTokenCount() public view override returns (uint16) {
return reserveTokenCount();
}
| 1,736,081 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
import 'ds-test/test.sol';
import 'forge-std/Vm.sol';
import 'forge-std/console.sol';
import '../levels/08-Vault/VaultFactory.sol';
import '../core/Ethernaut.sol';
contract VaultTest is DSTest {
//-------------------------------------------------------------... | -------------------------------------------------------------------------------- Setup Level Instance---------------------------------------------------------------------------------------------------------------------------------------------------------------- St... | function testVaultHack() public {
VaultFactory vaultFactory = new VaultFactory();
ethernaut.registerLevel(vaultFactory);
vm.startPrank(attacker);
address levelAddress = ethernaut.createLevelInstance(vaultFactory);
Vault vaultContract = Vault(payable(levelAddress));
bytes32 password = vm.load... | 5,475,902 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./interfaces/IMigratable.sol";
import "./interfaces/IRegistry.sol";
contract Registry is Ownable, IRegistry {
// The base of percentage.
uint256 public override constant PERCENTAGE_BASE = 100;... | Upgradable, in case we want to change premium formula. | function setPremiumCalculator(address premiumCalculator_) external onlyOwner {
premiumCalculator = premiumCalculator_;
}
| 12,975,771 |
./full_match/11155111/0x05968f40939fdc016AD58F82Cd08dA884825aD55/sources/project_/contracts/SmartController.sol | Transfers tokens from a specific address [ERC20]. The address owner has to approve the spender beforehand. The from address, to address and amount are validated before executing method. Overrides method in a parent. Prior to transfering tokens the validator needs to approve. caller Address of the caller passed throug... | function transferFrom_withCaller(
address caller,
address from,
address to,
uint amount
) public override returns (bool) {
require(
smartToken.validate(from, to, amount),
"transferFrom request not valid"
);
return super.transferFrom... | 3,813,291 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.