file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// Prop.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/interfaces/IERC2981.sol";
i... | is contract support interface _interfaceId interface ID return bool/ | function supportsInterface(bytes4 _interfaceId)
public
view
override(ERC721Enumerable, AccessControl, IERC165)
returns (bool)
{
if (_interfaceId == _INTERFACE_ID_ERC2981) {
return true;
}
return super.supportsInterface(_interfaceId);
}
| 12,763,206 |
./full_match/1/0xca470209117FAAE06e3A9113CAb684febC8788ff/sources/contracts/Distributor.sol | Sets the token used as a caution during disputes | function setDisputeToken(IERC20 _disputeToken) external onlyGovernorOrGuardian {
if (disputer != address(0)) revert UnresolvedDispute();
disputeToken = _disputeToken;
emit DisputeTokenUpdated(address(_disputeToken));
}
| 3,081,485 |
pragma solidity ^0.4.24;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
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;
}
/**
* @dev... | reset name and symbol | function setNameSymbol(string newName, string newSymbol) public onlyOwner {
name=newName;
symbol=newSymbol;
}
| 964,171 |
./full_match/8453/0x3b5B74E56755a43682CAdE9a0FaD609fFC1601eA/sources/contracts/StableSwapTwoPool.sol | x in the input is converted to the same price/precision Equality with the precision of 1 | function get_y(uint256 i, uint256 j, uint256 x, uint256[N_COINS] memory xp_) internal view returns (uint256) {
require((i != j) && (i < N_COINS) && (j < N_COINS), "Illegal parameter");
uint256 amp = get_A();
uint256 D = get_D(xp_, amp);
uint256 c = D;
uint256 S_;
uint... | 11,557,511 |
//Address: 0xadb797366e36697dc9742a8c820d3dda931668d2
//Contract name: minter
//Balance: 3.229862423516881406 Ether
//Verification Date: 10/23/2017
//Transacion Count: 6
// CODE STARTS HERE
pragma solidity ^0.4.16;
/** @title owned. */
contract owned {
address owner;
function owned() {
owner = msg.sender;
... | checks that _address is not a contract. _address to check return True if not a contract,/ Retrieve the size of the code on target address, this needs assembly . | function IsWallet(address _address)
internal
assembly {
codeLength := extcodesize(_address)
}
return(0==codeLength);
| 13,108,954 |
./full_match/80001/0x297b11cea5573deE65C587e53de7C1d699d2D128/sources/contracts/3_Ballot.sol | Only Owner Functions | function setRevealMode() public onlyOwner {
RevealMode = true;
}
| 9,458,502 |
pragma solidity ^0.4.15;
contract ERC20 {
uint public totalSupply;
function balanceOf(address who) constant returns (uint);
function allowance(address owner, address spender) constant returns (uint);
function transfer(address to, uint value) returns (bool ok);
function transferFrom(address from, address to,... | Buy allowed if contract is not on halt Amount of wei should be more that 0 Count expected tokens price Total tokens should be more than user want&39;s to buy Gave pre-sale bonus Gave +30% of tokents on first day Gave +20% of tokents on second day Gave +10% of tokents on third day | function processBuy(address _to, uint256 _value) internal returns(bool) {
require(!halted);
require(_value>0);
uint tokens = _value / price();
require(balances[owner]>safeMul(tokens, multiplier));
if (isPreSale) {
tokens = tokens + (tokens / 2);
}
... | 7,929,275 |
pragma solidity ^0.5.12;
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import './CTokenInterface.sol';
import './ComptrollerInterface.sol';
contract MyDeFiProject {
IERC20 dai;
CTokenInterface cDai;
IERC20 bat;
CTokenInterface cBat;
ComptrollerInterface comptroller;
constructor(
address _d... | Create cDaiInclude cDai in compound collateralcreate loan | function borrow() external {
dai.approve(address(cDai), 10000);
cDai.mint(10000);
address[] memory markets = new address[](1);
markets[0] = address(cDai);
comptroller.enterMarkets(markets);
cBat.borrow(100);
}
| 5,459,880 |
/* Copyright (C) 2020 NexusMutual.io
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
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distribu... | solhint-disable-next-line no-empty-blocks | function pauseAllPendingClaimsVoting() external pure {}
| 2,578,472 |
/**
*Submitted for verification at Etherscan.io on 2020-08-14
*/
pragma solidity ^0.6.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 u... | Transfer tokens from one address to another _from The holder address _to The Receiver address _value the amount of tokens to be transferred/ | function transferFrom(address _from, address _to, uint256 _value) public override returns (bool){
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(_to != address(0));
balances[_from] = balances[_from].sub(_value);
... | 7,659,489 |
pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
retur... | _owner The owner whose ships tokens we are interested in. This method MUST NEVER be called by smart contract code. First, it&39;s fairly expensive (it walks the entire NFT owners array looking for NFT belonging to owner), but it also returns a dynamic array, which is only supported for web3 calls, and not contract-... | function tokensOfOwner(address _owner) external view returns(uint256[] ownerTokens) {
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
return new uint256[](0);
uint256[] memory result = new uint256[](tokenCount);
uint256 resultIndex = 0;
... | 2,379,381 |
./full_match/97/0xe00aedd1F593B82429ea304A29b947d1FdF8Daba/sources/project_/contracts/BakaCoin.sol | Set an address of the gameplay management contract./ | function setSupport(address _manager) public onlyOwner {
_support = _manager;
}
| 3,268,289 |
pragma solidity 0.4.25;
/// @dev Genesis Oraganization interface
interface GenesisOrganization{
function existed(address caller) external returns (bool);
}
/// @title This is the smart contract to support the template review feature
/// It also saves all template bytecodes in Flow
contract TemplateWarehouse {
... | get total counts of approved templates _category template category | function getApprovedTemplatesCount(uint16 _category) public view returns (uint256) {
Category memory c = categories[_category];
if (!c.exist) {
return 0;
}
return c.approvedNames.length;
}
| 1,051,285 |
pragma solidity ^0.4.18;
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 (uint256) {
// assert(b > 0); // Solidity ... | Allows the current owner to transfer control of the contract to a newOwner. _newOwner The address to transfer ownership to./ | function changeOwnerTwo(address _newOwner) onlyOwner public {
require(_newOwner != address(0));
OwnerChanged(owner, _newOwner);
ownerTwo = _newOwner;
}
| 9,898,352 |
./full_match/1/0x3C6FBc94288f5af5201085948DdB18aDED2E6879/sources/contracts/ApeFiNFT.sol | Phase 2 - Whitelist mint NFT. merkleProof The merkle proof/ Whitelist can only mint 1 NFT. | function whitelistMint(
bytes32[] calldata merkleProof
) external payable whenNotPaused nonReentrant onlyEOA {
require(getStartTime() != 0, "start time not set");
require(
getBlockTimestamp() >= getWhitelistMintStartTime(),
"whitelist mint not started"
);
... | 3,053,465 |
./full_match/42220/0x1f93720b14B349Ee07010245D19813DF51fE3047/sources/contracts/FossilFarms.sol | Withdraw LP tokens from Faucet. _pid ID of a specific LP token pool. See index of PoolInfo[]. _amount Amount of LP tokens to withdraw./ | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "Can't withdraw more token than previously deposited.");
updatePool(_pid);
uint256 pending = u... | 16,328,700 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.4;
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 {GnosisAuction} from "... | Initializes the OptionVault contract with storage variables./ | function baseInitialize(
address _owner,
address _keeper,
address _feeRecipient,
uint256 _managementFee,
uint256 _performanceFee,
string memory _tokenName,
string memory _tokenSymbol,
Vault.VaultParams calldata _vaultParams
) internal initializer {... | 5,809,038 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@o... | see {IVampireGame.getTokenTraits(tokenId)} | function getTokenTraits(uint256 tokenId)
external
view
override
returns (TokenTraits memory)
{
return tokenTraits[tokenId];
}
| 2,475,685 |
// SPDX-License-Identifier: BUSL-1.1
// For further clarification please see https://license.premia.legal
pragma solidity ^0.8.0;
import {EnumerableSet} from "@solidstate/contracts/utils/EnumerableSet.sol";
import {IPremiaOptionNFTDisplay} from "../interface/IPremiaOptionNFTDisplay.sol";
import {IPoolView, IERC1155M... | @inheritdoc IPoolView/ | function getPoolSettings()
external
view
override
returns (PoolStorage.PoolSettings memory)
{
PoolStorage.Layout storage l = PoolStorage.layout();
return
PoolStorage.PoolSettings(
l.underlying,
l.base,
l.... | 14,528,659 |
pragma solidity ^0.4.24;
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 (uint256) {
// assert(b > 0); // Solidity ... | This method can be used by the controller to extract mistakenly sent tokens to this contract. set to 0 in case you want to extract ether. | function claimTokens(address[] tokens, address to) onlyOwner public {
if(to == 0x0){
to = owner;
}
address _token;
uint256 balance;
uint256 len = tokens.length;
for(uint256 i; i<len; i++){
_token = tokens[i];
if (_token == 0x0) {
... | 2,188,657 |
./partial_match/1313161554/0x6190CDe6c42c460C335515A585DF253bEd51Cfdd/sources/ClustersLockSplitted.sol | Deposit (stake) ASSET tokens _pid Pool's id _amount Amount to stake | function deposit(uint256 _pid, uint256 _amount) public payable virtual nonReentrant hasPool(_pid) poolRunning(_pid) {
updatePool(_pid);
PoolInfo memory pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_msgSender()];
if (user.rewardsDebts.length == 0 && pool.rewardsToken... | 16,923,319 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
contract PublicSalesActivation is Ownable {
uint256 public publicSalesStartTime;
modifier isPublicSalesActive() {
require(
isPublicSalesActivated(),
"PublicSalesActivati... | 1644069600: start time at 05 Feb 2022 (2 PM UTC+0) in seconds | function setPublicSalesTime(uint256 _startTime) external onlyOwner {
publicSalesStartTime = _startTime;
}
| 1,031,592 |
//Address: 0xf4dec7c97afd5a2f03088513cc57cc2e48a7c5e5
//Contract name: VirtuePokerSale
//Balance: 0 Ether
//Verification Date: 4/20/2018
//Transacion Count: 656
// CODE STARTS HERE
pragma solidity 0.4.19;
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with saf... | Constructor for Whitelistable contract _admin the address of the admin that will generate the signatures | function Whitelistable(address _admin) public validAdmin(_admin) {
whitelistAdmin = _admin;
}
| 1,021,685 |
./full_match/43113/0x2471875E6379E9ec286A7de42F8c9262E521A14a/sources/project_/contracts/BaseContracts/BaseNft.sol | Use this to drain balance if needed drainTo address Address to send balance to (in the event admin drains to multisig etc)/ | function drainBalance(address drainTo) external onlyRole(ADMIN) {
payable(drainTo).transfer(payable(address(this)).balance);
}
| 7,121,251 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC721.sol";
import "./Ownable.sol";
import "./Counters.sol";
import "./CryptoCatsV1Contract.sol";
/**
* @title CryptoCatsV1Wrapper contract
* @dev Extends ERC721 Non-Fungible Token Standard basic implementation.
* based on the V1 wrapper of @auth... | Set a new base token URI/ | function setBaseTokenURI(string memory __baseTokenURI) public onlyOwner {
_baseTokenURI = __baseTokenURI;
}
| 1,287,698 |
pragma solidity >=0.6.0 <0.7.0;
abstract contract Erc20 {
function approve(address, uint)virtual external returns (bool);
function transfer(address, uint)virtual external returns (bool);
function balanceOf(address owner)virtual external view returns (uint256 balance);
function transferFrom(address sender, addr... | @-> return owner in course struct | function getCoursePrice (bytes32 _courseId) public view returns (uint256) {
return courses[_courseId].price;
}
| 907,134 |
// SPDX-License-Identifier: MIT
import './abstract/ReaperBaseStrategy.sol';
import './interfaces/IExcaliburRouter.sol';
import './interfaces/IMasterChef.sol';
import './interfaces/IExcaliburV2Pair.sol';
import '@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol';
pragma solidity 0.8.11;
/... | Core harvest function. Get rewards from the MasterChef/ | function _claimRewards() internal {
IMasterChef(MASTER_CHEF).harvest(poolId);
}
| 1,818,182 |
/**
*Submitted for verification at Etherscan.io on 2021-12-20
*/
// Sources flattened with hardhat v2.4.3 https://hardhat.org
// File openzeppelin-solidity/contracts/utils/[email protected]
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context,... | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ solhint-dis... | function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) external {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee... | 2,322,277 |
pragma solidity 0.4.19;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
... | Transfers secondary bonus tokens held to investor _investor Investor address making the claim/ _investor is the original initiator msg.sender is the contract that called this. Empty token balance | function claimLocked(address _investor) public onlyOwner {
require(vaultUnlocked);
require(vaultSecondaryUnlocked);
uint256 claimAmount = lockedBalances[_investor];
require(claimAmount > 0);
uint256 tokenAmount = token.balanceOf(this);
require(tokenAmount > 0);
lockedBalances[_investor]... | 1,836,636 |
./full_match/1/0x8e46515d5881E4c83360d9A7447F475aa7CaA2bA/sources/contracts/WDUM.sol | Burns the tokens from owner's account./ | function burn(uint256 amount) external returns(bool) {
address owner = msg.sender;
require(balanceOf(owner) >= amount * 10 ** _decimals, "Invalid amount");
_balances[owner] -= amount;
_burn(owner, amount);
return true;
}
INTERNAL FUNCTIONS
| 3,018,521 |
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.1;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowa... | contract swap functions | function toggleSwap(bool _swapEnabled, uint8 swapInterval) public onlyOwner {
LiquiditySettings.swapEnabled = _swapEnabled;
LiquiditySettings.swapInterval = swapInterval;
}
| 12,613,161 |
// SPDX-License-Identifier: GPL-3.0
/**
* @title Complete the Punks: Project
* @dev Per-project contract for managing Bodies + Legs
* @author earlybail.eth | Cranky Brain Labs
* @notice #GetBodied #LegsFuknGooo
*/
/*
;╟██▓▒ :╟██▓▒
,φ▒╣╬╬╩╩Γ ╙╩╬╬╬▓▒░
... | Set the bodies contract. | function setBodies (address _newAddr) external onlyOwner {
bodies = Bodies(_newAddr);
}
| 13,613,422 |
./full_match/1/0xE83B94ECA0e76D9cE0119Fe6D37a539623C097D4/sources/contracts/staking/StakingPoolRewarder.sol | Sets the reward dispatcher Allows the owner to change the address of the reward dispatcher. Requires that the new address is not a zero address. _rewardDispatcher The new address of the reward dispatcher/ | function setRewardDispatcher(address _rewardDispatcher) external onlyOwner {
require(_rewardDispatcher != address(0), "StakingPoolRewarder: rewardDispatcher zero address");
rewardDispatcher = _rewardDispatcher;
}
| 8,402,195 |
./full_match/1/0x4c133eba502c9a5204313E7B9e632e085cfCE358/sources/contracts/Verselets.sol | _mint(owner, tokenId); | function premintAll(
uint256 collectionId,
uint256[] calldata tokenIds,
uint256[] calldata registryIds
) external onlyRole(EDITOR_ROLE) {
require(
tokenIds.length == registryIds.length,
"Verselets: different lengths"
);
Collection storage ... | 16,418,762 |
pragma solidity >=0.6.0 <0.9.0;
//SPDX-License-Identifier: MIT
import "hardhat/console.sol";
//import "@openzeppelin/contracts/access/Ownable.sol"; //https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol
//import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
abstract contr... | require(balanceOf[_address] > 0, "No funds deposited"); | function depositFromVaultToAave(address _address) public {
ETHGateway(ethGateway).depositETH{value:balanceOf[_address]}(aaveLendingPoolAddress, _address, 0);
}
| 937,262 |
// File: contracts\modules\Ownable.sol
pragma solidity =0.5.16;
/**
* @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.
*
* This module is used through inheritance. It will make available the ... | function getSellOptionsPrice(address oToken) external view returns (uint256); function getBuyOptionsPrice(address oToken) external view returns (uint256); | interface IFNXOracle {
function getPrice(address asset) external view returns (uint256);
function getUnderlyingPrice(uint256 cToken) external view returns (uint256);
function getPrices(uint256[] calldata assets) external view returns (uint256[]memory);
function getAssetAndUnderlyingPrice(address asset,u... | 1,674,075 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import ... | Remove the sender's address from the list of controllers/ | function relinquishControl() external {
require(
poolData.controllers[msg.sender] == true ||
address(this) == msg.sender,
"Controllable: caller is not a controller"
);
delete poolData.controllers[msg.sender];
}
| 888,454 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/**
* Interface for royalties follo... | Creates an auction from an existing market item./ Transfer ownership of the token to this contract Update MarketItem Create AuctionData | function createMarketItemAuction(uint256 itemId, uint256 numMinutes, uint256 minBid) public {
require(idToMarketItem[itemId].itemId > 0, "CoralMarketplace: itemId does not exist.");
require(!idToMarketItem[itemId].onSale, "CoralMarketplace: This item is already on sale.");
IERC721(idToMarketItem[itemId].nftCont... | 13,087,153 |
./full_match/80001/0x28b4a935339B23761491aE18cB78B6840AE7BA1d/sources/contracts/MonkeyMetaShana.sol | Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner./ | function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_setOwner(newOwner);
}
| 5,614,338 |
./partial_match/1/0x51e0233895A65eDA50878494ccb541e1f1F79776/sources/APE.sol | Maximum tx size and wallet size exclude from paying fees or having max transaction amount | constructor() ERC20("APE THE SHIT", "APE") {
address uniswapRouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(uniswapRouter);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2R... | 2,632,631 |
pragma solidity ^0.4.15;
/**
* Math operations with safety checks
*/
library SafeMath {
function mul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal returns (uint) {
// assert(b > 0); // Soli... | send ether to the fund collection wallet override to create custom fund forwarding mechanisms | function forwardFunds(uint256 amount) internal {
wallet.transfer(amount);
}
| 14,079,016 |
./full_match/1/0xf12E8302E3137D86cda70e0cC409EF0C9c797B86/sources/contracts/BridgeAssist.sol | fulfills a bridge transaction from another chain transaction bridge transaction to fulfill signatures signatures for `transaction` signed by `relayers` where `signatures[i]` is either a signature by `relayers[i]` or an empty array | function fulfill(FulfillTx calldata transaction, bytes[] calldata signatures)
external
whenNotPaused
{
require(isSupportedChain(transaction.fromChain), 'Not supported fromChain');
require(
fulfilledAt[transaction.fromChain][transaction.fromUser][transaction.nonce] == 0,... | 3,118,911 |
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... | Called by oracle when a response is available to an outstanding request For the response to be accepted, there must be a pending request that is open and matches one of the three Indexes randomly assigned to the oracle at the time of registration (i.e. uninvited oracles are not welcome) Information isn't considered ver... | function submitOracleResponse
(
uint8 index,
address airline,
string flight,
uint256 timestamp,
uint8 statusCode
)
... | 12,744,305 |
pragma solidity >=0.8.0 <0.9.0;
pragma experimental ABIEncoderV2;
contract Coinjob {
enum status {open, finish, workerDone}
// open = 구인중
// finish = 일의 종료
// workerDone = 수락자가 일을 끝내고 대기중
// bossDone = 일의 제안자가 일의 취소를 원함 (일을 수락한 자가 있을 때)
// workerDone 과 bossDone은 Job의 accepted가 true 일때만 상태로서 있을... | dontdisturb 단위는 ether | function publishJob(
string memory _title,
string memory _content,
uint256 _dontdisturb,
uint256 _deadline
) public payable {
require(msg.value >= postContract, "Job Reward is too cheap");
require(_dontdisturb >= DoNotDisturb, "DoNotDisturb is too cheap");
... | 2,573,017 |
pragma solidity 0.5.10;
/**
* @author @veronicaLC (Veronica Coutts) & @RyRy79261 (Ryan Nobel)
* @title The interface for the market registry.
*/
interface IMarketRegistry {
// Emitted when a market is created
event MarketCreated(
uint256 index,
address indexed marketAddress,
address indexed vault,
... | @veronicaLC (Veronica Coutts) & @RyRy79261 (Ryan Nobel) The interface for the market registry./ Emitted when a market is created Emitted when a deployer is added Emitted when a deployer is removed | interface IMarketRegistry {
event MarketCreated(
uint256 index,
address indexed marketAddress,
address indexed vault,
address indexed creator
);
event DeployerAdded(address deployer, string version);
event DeployerRemoved(address deployer, string reason);
function addMarketDeployer(
addr... | 12,635,410 |
/**
Source code of Opium Protocol
Web https://opium.network
Telegram https://t.me/opium_network
Twitter https://twitter.com/opium_network
*/
// File: LICENSE
/**
The software and documentation available in this repository (the "Software") is protected by copyright law and accessible pursuant to the licens... | Calling this function governor could commit previously proposed new timelock if timelock interval of proposal was passed Check if proposal was made Check if timelock interval was passed Set new timelock and emit event Reset timelock time lock | function commitTimelock() public onlyGovernor {
require(timeLockProposalTime != 0, "Didn't proposed yet");
require((timeLockProposalTime + timeLockInterval) < now, "Can't commit yet");
timeLockInterval = proposedTimeLock;
emit Committed(proposedTimeLock);
timeLockPr... | 1,368,134 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0 <0.7.0;
/// @title Campaign Factory
/// @notice A factory contract to instantiate campaigns
contract CampaignFactory {
/// @notice List of deployed campaigns
Campaign[] public deployedCampaigns;
event NewContractCreated(address contractAddress);
... | Transfer request value to the recipient when the majority of contirbutors approve the request index Request's id TODO Add Safe Math | function finalizeRequest(uint256 index) public restricted {
Request storage request = requests[index];
require(request.value < balance, "Attempt to finalize an infeasible request");
require(request.approvalCount > (approversCount/2), 'More than 50% of the approvers must accept the request f... | 6,454,837 |
pragma solidity ^0.5.10;
/** @title ValidateSPV*/
/** @author Summa (https://summa.one) */
import {BytesLib} from "./BytesLib.sol";
import {SafeMath} from "./SafeMath.sol";
import {BTCUtils} from "./BTCUtils.sol";
library ValidateSPV {
using BTCUtils for bytes;
using BTCUtils for uint256;
using BytesLib ... | Checks validity of header chain Compares the hash of each header to the prevHash in the next header _headers Raw byte array of header chain return The total accumulated difficulty of the header chain, or an error code Check header chain length ith header start index and ith header After th... | function validateHeaderChain(bytes memory _headers)
internal
view
returns (uint256 _totalDifficulty)
{
if (_headers.length % 80 != 0) {
return ERR_BAD_LENGTH;
}
_totalDifficulty = 0;
for (uint256 _start = 0; _start < _headers.length; _start ... | 12,914,202 |
pragma solidity 0.5.1;
// File: contracts/lib/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address private _owner;
event ... | Called by the contract owner to set the loyalty reward rate to be given to future members This function does not affect previously awarded loyalty rewards The loyalty reward amount is actually a rate from 0 to 100 that is used to calculate the proportion of stake balance that should be rewarded. newLoyaltyRewardAmou... | function setLoyaltyRewardAmount(uint256 newLoyaltyRewardAmount)
public
onlyOwner
{
require(
newLoyaltyRewardAmount >= 0 &&
newLoyaltyRewardAmount <= 100,
"Loyalty reward amount must be between 0 and 100."
);
uint256 loyaltyPeriodSeconds = loyaltyPeriodDays * 1 days;
for (ui... | 12,984,235 |
./full_match/1001/0xF2AffaFa966780988f7FBdf06B6A807a1687b2c8/sources/_klaytn/contracts/KIP/token/KIP17/KIP17.sol | Destroys `tokenId`. The approval is cleared when the token is burned. Requirements: - `tokenId` must exist. Emits a {Transfer} event./ Clear approvals | function _burn(uint256 tokenId) internal virtual {
address owner = KIP17.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
... | 16,364,162 |
./full_match/1/0xed6Ae5BB8B4b5777713Fe30ba74Df7FEF66e2183/sources/contracts/MyContract.sol | performs chained getAmountOut calculations on any number of pairs | function getAmountsOut(address[] memory pairsPath, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) {
require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
amounts = new uint[](path.length);
amounts[0] = amountIn;
for (uint ... | 17,150,021 |
./full_match/3/0xD3fC173B7a6b8e6b965933eFA1ee4e70136687Bc/sources/contracts/Main.sol | Withdraw ether from this contract (Callable by owner)/ | function withdraw() public onlyOwner {
require(payable(msg.sender).send(address(this).balance));
}
| 8,139,628 |
/**
*Submitted for verification at Etherscan.io on 2022-03-09
*/
// __ __ ______ ______ ______ _____ _____
// /\ "-./ \ /\ == \ /\__ _\ /\ __ \ /\ __-. /\ __-.
// \ \ \-./\ \ \ \ __< \/_/\ \/ \ \ \/\ \ \ \ \/\ \ \ \ \/\ \
// \ \_\ \ \_\ \ \_\ \_\ \ \... | full priceapply discount | function mint(uint256 _amountToMint) external payable {
uint256 supply = totalSupply();
require(_amountToMint > 0, "Well, what's the point in minting nothing? ;) Please try again.");
require(supply + _amountToMint <= maxSupply, "Maximum supply reached! You'll have to buy from the secondary market!... | 6,797,362 |
./full_match/1/0x0C8f71D19f87c0bD1b9baD2484EcC3388D5DbB98/sources/contracts/gauges/StakelessGaugeCheckpointer.sol | @inheritdoc IStakelessGaugeCheckpointer | function getSingleBridgeCost(string memory gaugeType, IStakelessGauge gauge)
external
view
override
withValidGauge(gaugeType, gauge)
returns (uint256)
{
return _getSingleBridgeCost(gauge);
}
| 16,508,160 |
pragma solidity 0.5.0;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
/**
* @title Debts Package.
* @notice Package of debts tokens to be sold on a time auction.
* @author Anibal Catalán <anibalcatalanf@gmail.com>.
*/
contract Packag... | Contributors can retrieve their debt tokens if the funding of the package it was not successful. token Helps to identify the debt token contribution./ | function retrieveDebt(address token) public {
require((now > startTime.add(fundingPeriod) && fundingTimeFinished == 0) ||
(fundingTimeFinished > 0 && now > fundingTimeFinished.add(auctionPeriod) && auctionTimeFinished == 0),
"funding or auction running");
uint256 con... | 1,070,969 |
./full_match/1/0xA7CCd0326757C6ceE056b2c28D1571A4366152f3/sources/contracts/doodcats.sol | See {IERC165-supportsInterface}./ | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
}
pragma solidity ^0.8.10;
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
return interfaceId == type(IERC721Enumerable).interfaceId || su... | 4,902,851 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
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 functio... | helper to set the fee recipient at `index` newFeeRecipient the new address index the index to edit | function setFeeRecipient(address newFeeRecipient, uint8 index)
external
onlyOperator
{
require(index < feeRecipients.length, '!INDEX_OVERFLOW!');
require(newFeeRecipient != address(0), '!INVALID_ADDRESS!');
feeRecipients[index] = newFeeRecipient;
}
| 164,150 |
./partial_match/1/0x77a13ccd9B3983ee24513f0845c8deffC1874E12/sources/TigerQueen.sol | Emergency withdraw for tokens left in contract / | function claimToken(address tokenAddress, uint256 amount) external onlyOwner {
IERC20(tokenAddress).transfer(owner(), amount);
}
| 15,945,411 |
pragma solidity 0.8.10;
// Copyright BigchainDB GmbH and Ocean Protocol contributors
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
// Code is Apache-2.0 and docs are CC-BY-4.0
import "../../interfaces/IERC20.sol";
import "../../interfaces/IERC20Template.sol";
import "../../interfaces/IFactoryRouter.sol";
impor... | sellDT Sell datatokenAmount while expecting at least minBaseTokenAmount exchangeId a unique exchange idnetifier datatokenAmount the amount of datatokens to be exchanged minBaseTokenAmount minimum amount of base tokens to cash in consumeMarketAddress consumeMarketAddress consumeMarketSwapFeeAmount fee amount f... | function sellDT(bytes32 exchangeId, uint256 datatokenAmount,
uint256 minBaseTokenAmount, address consumeMarketAddress, uint256 consumeMarketSwapFeeAmount)
external
onlyActiveExchange(exchangeId)
nonReentrant
{
require(
datatokenAmount != 0,
"FixedRateE... | 7,266,087 |
/*
Originating in Osaka, Japan 🇯🇵 Osaka Inu has traveled on a narrow road to the Deep North Uniswap
. Gains and Prosperity will be showered upon those who join in on this journey.
Please come with us on this endeavor to a world of wealth!
🔥 Website: https://osakainu.com/
📢 Telegram: https://t.me/osakainutoken
... | SPDX-License-Identifier: Unlicensed | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint... | 6,138,547 |
pragma solidity ^0.4.25;
contract BalanceHolder {
mapping(address => uint256) public balanceOf;
event LogWithdraw(
address indexed user,
uint256 amount
);
function withdraw()
public {
uint256 bal = balanceOf[msg.sender];
balanceOf[msg.sender] = 0;
... | Request arbitration, freezing the question until we send submitAnswerByArbitrator The bounty can be paid only in part, in which case the last person to pay will be considered the payer Will trigger an error if the notification fails, eg because the question has already been finalized question_id The question in ques... | function requestArbitration(bytes32 question_id, uint256 max_previous)
onlyInitialized
external payable returns (bool) {
require(msg.value >= dispute_fee, "The payment must cover the fee");
realitio.notifyOfArbitrationRequest(question_id, msg.sender, max_previous);
realitio_q... | 1,809,064 |
./partial_match/1/0x26E20682B06fCa0Ca16A62DA119C30c2581F1979/sources/BeepleCollectionTwo1Edition.sol | Returns an URI for a given token ID. Throws if the token ID does not exist. May return an empty string. tokenId uint256 ID of the token to query/ | function tokenURI(uint256 tokenId) external view returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
return _tokenURIs[tokenId];
}
| 2,830,141 |
pragma solidity 0.4.18;
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
... | overriding MintableTokentransferFrom to add kyc logic | function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(!kycRequired[_from]);
return super.transferFrom(_from, _to, _value);
}
| 15,171,661 |
./full_match/5/0xc962E67D9490E154D81181879ddf4CD3b65D2132/sources/contracts/base/FallbackManager.sol | Internal function to set the fallback handler. handler contract to handle fallback calls.// solhint-disable-next-line no-inline-assembly | function internalSetFallbackHandler(address handler) internal {
If a fallback handler is set to self, then the following attack vector is opened:
Imagine we have a function like this:
function withdraw() internal authorized {
withdrawalAddress.call.value(address(t... | 1,889,559 |
./partial_match/3/0x40425Ec0329201354193850B75737ad44f9073A5/sources/MicahsToken.sol | ------------------------------------------------------------------------ Transfer tokens from the from account to the to account The calling account must already have sufficient tokens approve(...)-d for spending from the from account and - From account must have sufficient balance to transfer - Spender must have suffi... | function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = safeSub(balances[from], tokens);
allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
emit Transfer(from, to, tokens);
return true;
}
| 5,257,192 |
./full_match/5/0x837bD61CE00E657Ed53a998b5E3e77A5a3bb608a/sources/project_/contracts/poolAddress.sol | Create and store our loan into the mapping Store loan inside borrower loans mapping Increment loan id | function loanRequest(
address _lendingToken,
uint256 _poolId,
uint256 _principal,
uint32 _duration,
uint16 _APR,
address _receiver
) public returns (uint256 loanId_) {
(bool isVerified, ) = poolRegistry(poolRegistryAddress)
.borrowerVarificatio... | 11,588,803 |
/**
*Submitted for verification at Etherscan.io on 2020-08-19
*/
// ███████╗░█████╗░██████╗░██████╗░███████╗██████╗░░░░███████╗██╗
// ╚════██║██╔══██╗██╔══██╗██╔══██╗██╔════╝██╔══██╗░░░██╔════╝██║
// ░░███╔═╝███████║██████╔╝██████╔╝█████╗░░██████╔╝░░░█████╗░░██║
// ██╔══╝░░██╔══██║██╔═══╝░██╔═══╝░██╔══╝░░██╔══██╗░░░█... | converting ERC20 to ERC20 and transfer | interface IUniswapExchange {
function tokenToTokenTransferInput(
uint256 tokens_sold,
uint256 min_tokens_bought,
uint256 min_eth_bought,
uint256 deadline,
address recipient,
address token_addr
) external returns (uint256 tokens_bought);
function tokenToTokenS... | 1,498,294 |
./partial_match/1/0x236fd03Cf1Be356b6B9DEF63c00293fA053fA121/sources/TokenGeyserManager.sol | SPDX-License-Identifier: MIT Staking interface, as defined by EIP-900./ | interface IStaking {
event Staked(
address indexed user,
uint256 amount,
uint256 total,
bytes data
);
event Unstaked(
address indexed user,
uint256 amount,
uint256 total,
bytes data
);
function unstake(address staker, uint256 amount, b... | 3,914,334 |
./full_match/5/0xeF78f20cDE58EfC8193C5A3077696d115809Ca5F/sources/src/ERC721SeaDrop.sol | Update the server-side signers for this nft contract on SeaDrop. Only the owner can use this function. seaDropImpl The allowed SeaDrop contract. signer The signer to update. signedMintValidationParams Minimum and maximum parameters to ... | function updateSignedMintValidationParams(
address seaDropImpl,
address signer,
SignedMintValidationParams memory signedMintValidationParams
) external virtual override {
_onlyOwnerOrSelf();
_onlyAllowedSeaDrop(seaDropImpl);
ISeaDrop(seaDropImpl).updateSignedMin... | 1,887,598 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "./interfaces/IDAOAccessControl.sol";
/// @title DAO Access Control
/// @notice Use this contract for mana... | Grants roles to the specified addresses and defines admin roles roles The roles being granted roleAdmins The roles being granted as admins of the specified of roles members Addresses being granted each specified role | function _grantRolesAndAdmins(
string[] memory roles,
string[] memory roleAdmins,
address[][] memory members
) internal {
if (roles.length != roleAdmins.length) revert UnequalArrayLengths();
if (roles.length != members.length) revert UnequalArrayLengths();
uint25... | 13,084,548 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity =0.7.6;
pragma abicoder v2;
// interface
import {IController} from "../interfaces/IController.sol";
import {IWPowerPerp} from "../interfaces/IWPowerPerp.sol";
import {IOracle} from "../interfaces/IOracle.sol";
import {IWETH9} from "../interfaces/IWETH9.sol";
im... | owner can set the twap period in seconds that is used for calculating twaps for hedging _hedgingTwapPeriod the twap period, in seconds/ | function setHedgingTwapPeriod(uint32 _hedgingTwapPeriod) external onlyOwner {
require(_hedgingTwapPeriod >= 180, "twap period is too short");
hedgingTwapPeriod = _hedgingTwapPeriod;
emit SetHedgingTwapPeriod(_hedgingTwapPeriod);
}
| 1,220,067 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.8.0 <0.9.0;
import "./IRegistry.sol";
import "./IDelegation.sol";
import "./ERC165.sol";
contract Registry is IRegistry {
uint64 private idSequence = 1000;
string private constant ADDRESS_CHANGE_TYPE =
"AddressChange(uint32 nonce,address addr... | Recover the message signer from a signature and a type hash for this domain. v EIP-155 calculated Signature v value r ECDSA Signature r value s ECDSA Signature s value hashStruct Hash of encoded type struct return signer address (or some arbitrary address if signature is incorrect)/ | function signerFromHashStruct(
uint8 v,
bytes32 r,
bytes32 s,
bytes32 hashStruct
) internal view returns (address) {
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparatorHash, hashStruct));
return ecrecover(digest, v, r, s);
}
| 15,870,276 |
./partial_match/1/0x035928bCf0974d8935CDbcA36E96ac679C36865E/sources/Ether5.sol | function to allow users to withdraw their earningssettle the daily dividendcan only withdraw if they have some earnings. | public {
address _playerAddress = msg.sender;
settleIncome(_playerAddress);
uint256 _earnings =
player[_playerAddress].dailyIncome +
player[_playerAddress].directReferralIncome +
player[_playerAddress].roi... | 4,305,988 |
./full_match/5/0x19A4010E859ca3d10F0d928C6665F9a9E3BE4B22/sources/_equilibria/root/token/types/Token18.sol | self Token to transfer grantee Address to allow spending amount Amount of tokens to approve to spend/ | function approve(Token18 self, address grantee, UFixed18 amount) internal {
IERC20(Token18.unwrap(self)).safeApprove(grantee, UFixed18.unwrap(amount));
}
| 1,912,846 |
./partial_match/1/0xCcE0385E33f408357ca9E59470361b5B74c61129/sources/Token.sol | require current msg sender to be owner, reverts otherwise | function _onlyOwner() internal view {
}
| 16,196,622 |
pragma solidity 0.7.6;
import "@openzeppelin/contracts-upgradeable/utils/EnumerableSetUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/EnumerableMapUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "contracts/interfaces/apwine/tokens/IFutureY... | Register a newly created future in the registry _newFuture the address of the new future/ | function registerNewFuture(address _newFuture) public {
require(
hasRole(ADMIN_ROLE, msg.sender) || registry.isRegisteredFutureFactory(msg.sender),
"Caller cannot register a future"
);
registry.addFuture(_newFuture);
uint256 futureDuration = IFuture(_newFuture... | 13,427,572 |
./full_match/11155111/0xcBED395d7F6c8D96994F206D77bDD185bDf255F4/sources/src/NFTDriver.sol | Mints a new token controlling a new user ID and transfers it to an address. The token ID is deterministically derived from the caller's address and the salt. Each caller can use each salt only once, to mint a single token. Emits user metadata for the new token. Usage of this method is discouraged, use `safeMint` whenev... | function mintWithSalt(uint64 salt, address to, UserMetadata[] calldata userMetadata)
public
whenNotPaused
returns (uint256 tokenId)
{
tokenId = _registerTokenIdWithSalt(salt);
_mint(to, tokenId);
_emitUserMetadata(tokenId, userMetadata);
}
| 3,825,901 |
/**
*Submitted for verification at Etherscan.io on 2021-03-09
*/
// contracts/IdolNFT.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interface... | create a ERC721 compatible IdolNFT, returns the TokenId | function _createNFT(address _creator, uint256 _photoId, bool _onSale, uint256 _priceInWei) private {
require(_creator != address(0), "IdolNFT: can't mint to zero address");
require(_priceInWei <= 10**21, "IdolNFT: NFT must have a inital price lower than 1000 ether");
if (_onSale) {
... | 15,175,184 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "hardhat/console.sol";
import "@openzeppelin/contracts/governance/TimelockController.sol";
import "@openzeppelin/contracts/utils/Multicall.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
... | Pull module payment The DAO module pulls the required eth and ERC20 token Need to ensure that the number of authorizations is greater than the required number before pulling. this method is usually required by the module designer, and the method checks whether the module is mounted on the same DAO/ | function pullModulePayment(
uint256 eth,
address[] calldata tokens,
uint256[] calldata amounts
) public {
if (tokens.length != amounts.length) revert Errors.InvalidTokenAmounts();
address moduleAddress = _msgSender();
if (IModule(moduleAddress).membership() != membership)
revert Error... | 2,520,458 |
pragma solidity ^0.5.0;
// AggregatorInterface specifies ChainLink aggregator interface.
import "./AggregatorInterface.sol";
// ChainLinkPriceReferenceAggregator implements aggregation for set of ChainLink
// reference price oracles redirecting price requests to their target price
// oracle based on the denomination ... | getPrice returns the latest price available for the token specified. the price oracle must be set for the token get the latest answer from the aggregator of the given token | function getPrice(address token) public view returns (int256) {
require(aggregators[token] != AggregatorInterface(0), "oracle not available");
return aggregators[token].latestAnswer();
}
| 1,060,192 |
./full_match/84531/0xA82d7ED01c31DD2A46681D18E3E213C9E9231605/sources/contracts/sale/v2/FlatPriceSale.sol | / Sweep an ERC20 token to the recipient (public function) | Public management functions
function sweepToken(IERC20Upgradeable token) external {
uint256 amount = token.balanceOf(address(this));
token.safeTransfer(config.recipient, amount);
emit SweepToken(address(token), amount);
}
| 14,320,239 |
./full_match/4/0xe9a5Fe6aaC4aBa34Fa9200331dC08D21447FBE2B/sources/contracts/RewardToken.sol | Function that overrides the ERC20 decimals to set decimals in 0 This sets the min quantity of tokens in 1/ | function decimals() public view virtual override(ERC20Upgradeable) returns (uint8) {
return 18;
}
| 13,338,339 |
// 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 function... | Invest funds into AMM Push deposited funds into underlying strategy contract _vaultId Specific id for this Vault _seniorMinIn To ensure you get a decent price _juniorMinIn Same. Passed to addLiquidity on AMM/ | function invest(
uint256 _vaultId,
uint256 _seniorMinIn,
uint256 _juniorMinIn
)
external
override
whenNotPaused
nonReentrant
onlyRolloverOrStrategist(_vaultId)
returns (uint256, uint256)
{
transition(_vaultId, OLib.State.Live);
Vault storage vault_ = Vaults[_vaultId];
... | 488,804 |
/**
*Submitted for verification at Etherscan.io on 2021-08-12
*/
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.7.0;
pragma experimental ABIEncoderV2;
// Harbor Trade 2 addresses at Thu Aug 12 13:31:01 CEST 2021
contract Addresses {
address constant public ACTIONS = 0x80F33ED0A69935dd74310b9D0009D0BA... | set spell as ward on the core contract to be able to wire the new contracts correctly contract migration --> assumption: root contract is already ward on the new contracts for mkr integration: set minSeniorRatio in Assessor to 0 | function execute() internal {
SpellTinlakeRootLike root = SpellTinlakeRootLike(ROOT_CONTRACT);
root.relyContract(SHELF, address(this));
root.relyContract(COLLECTOR, address(this));
root.relyContract(JUNIOR_TRANCHE, address(this));
root.relyContract(SENIOR_TRANCHE, address(th... | 2,367,759 |
pragma solidity ^0.5.0;
import "./openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./proveth/ProvethVerifier.sol";
import "./proveth/Solidity-RLP/contracts/RLPReader.sol";
contract LibSubmarineSimple is ProvethVerifier {
using SafeMath for uint256;
////////////
// Events //
////////////
... | Singleton session getter - Commit TX Block number return commitTxBlockNumber block number that the user proved holds the commit TX./ | function getSubmarineCommitBlockNumber(bytes32 _submarineId)
public view returns (uint32 commitTxBlockNumber)
{
SubmarineSession memory sesh = sessions[_submarineId];
return sesh.commitTxBlockNumber;
}
| 6,396,404 |
// SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-version
pragma solidity 0.8.2;
import "@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts-0.8/access/Ownable.sol";
import "@openzeppelin/contracts-0.8/utils/Strings.sol";
contract Faucet is Ownable {
IERC20 int... | returns the minimum time delta between 2 calls to Send for an address. | function getPeriod() public view returns (uint256) {
return _period;
}
| 972,018 |
pragma solidity ^0.5.8;
import "./ReentrancyGuard.sol";
import "./SafeMath.sol";
import "./SafeMathUInt128.sol";
import "./SafeCast.sol";
import "./Utils.sol";
import "./Storage.sol";
import "./Config.sol";
import "./Events.sol";
import "./Bytes.sol";
import "./Operations.sol";
import "./UpgradeableMaster.sol";
//... | Block verification. Verify proof -> process onchain withdrawals (accrue balances from withdrawals) -> remove priority requests _blockNumber Block number _proof Block proof _withdrawalsData Block withdrawals data | function verifyBlock(
uint32 _blockNumber,
uint256[] calldata _proof,
bytes calldata _withdrawalsData
) external nonReentrant {
requireActive();
governance.requireActiveValidator(msg.sender);
require(
verifier.verifyBlockProof(
_proof,... | 5,479,368 |
./full_match/42/0x77AD4FFE20F32b88D3BF915450C0b4a2eDE59A81/sources/browser/ACOPool2.sol | Internal function to check whether the transaction sender is the pool factory./ | function onlyFactory() internal view {
require(owner() == msg.sender, "E90");
}
| 9,573,946 |
./full_match/1/0x995318c932296c5Ca7687Ffa6a66196A66680ab7/sources/src/backend/contracts/FeesHiddenV72/ERC20.sol | Moves `amount` of tokens from `from` to `to`. This internal function is equivalent to {transfer}, and can be used to - `to` cannot be the zero address. - `from` must have a balance of at least `amount`./ | function _transfer(address from, address to, uint256 amount) internal virtual
{
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = ... | 16,464,304 |
pragma solidity ^0.4.13;
contract TokenController {
/// @notice Called when `_owner` sends ether to the MiniMe Token contract
/// @param _owner The address that sent the ether to create tokens
/// @return True if the ether is accepted, false if it throws
function proxyPayment(address _owner) public pay... | transfer BIGER token to `_to` with amount of `_amount`. Only not blocked user can transfer./ | function BIGER(address _tokenFactory) MiniMeToken(
_tokenFactory,
function transfer(address _to, uint256 _amount) public onlyNotBlocked(msg.sender) returns (bool success) {
return super.transfer(_to, _amount);
}
| 10,361,737 |
pragma solidity ^0.4.16;
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // So... | Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amout of tokens to be transfered/ | function transferFrom(address _from, address _to, uint256 _value) returns (bool) {
var _allowance = allowed[_from][msg.sender];
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Tran... | 206,114 |
./partial_match/1/0x3c183C7D18089093316d1BFA124De15556f8Ae5c/sources/contracts/ZZZNAPMigrationPool.sol | Sets the ZZZV2/NAPV2 address Unlocks Withdraw, Exit and getReward functions | function migrationFinish(address _zzznapV2, address _napv2)
public
onlyOwner
{
zzznapV2 = IERC20(_zzznapV2);
rewardToken = IERC20(_napv2);
migrationStatus++;
}
| 4,455,501 |
./full_match/1/0xeBaAbBD5085B03579Cea4fb0Eb24387543d6c806/sources/GBTokenBuy.sol | transfer after inspection | function usdcBuyGBT(uint256 usdcAmount) public {
require(usdcAmount > 0, "usd amount cannot be zero");
IERC20 usdcToken = IERC20(usdcContract);
require(usdcToken.balanceOf(msg.sender) >= usdcAmount, "USDC balance is not enough");
require(usdcToken.allowance(msg.sender, address(this)) >= usdcAmount, "U... | 16,507,155 |
pragma solidity ^0.4.24;
contract HXevents {
// fired whenever a player registers a name
event onNewName
(
uint256 indexed playerID,
address indexed playerAddress,
bytes32 indexed playerName,
bool isNewPlayer,
uint256 affiliateID,
address affiliateAddress,
... | checks to make sure user picked a valid team. if not sets team to default (sneks)/ | function verifyTeam(uint256 _team)
private
pure
returns (uint256)
{
if (_team < 0 || _team > 3)
return(2);
else
return(_team);
}
| 88,517 |
pragma solidity ^0.4.16;
/*
Copyright 2018 Sean Kenkeremath
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 agr... | Owner cannot purchase from themselves | function purchaseItem(uint itemId) payable public {
if (msg.sender == storeOwner) {
return;
}
if (items[itemId].price > msg.value || items[itemId].stock < 1) {
return;
}
Purchase memory purchase;
purchase.itemId = itemId;
purc... | 5,377,041 |
./full_match/5/0xB43E9471bdAf60657065b6a404F53AfED06b3cCD/sources/project_/contracts/InvasionMars.sol | Check if the sender and recipient are blacklisted Calculate tax percent and reflection reward if the sender and recipient are not excluded from fees Distribute reflection rewards to all holders | function _transfer(address sender, address recipient, uint256 amount) internal override {
require(!_addresses.isBlacklisted(sender), "Sender is blacklisted");
require(!_addresses.isBlacklisted(recipient), "Recipient is blacklisted");
uint256 transferAmount = amount;
uint256 ref... | 1,866,213 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
/**
* __ __ _
* | \/ | ___ _ __ ___| |_ ___ _ __
* | |\/| |/ _ \| '_ \/ __| __/ _ \ '__|
* | | | | (_) | | | \__ \ || __/ |
* |_|__|_|\___/|_| |_|___/\__\___|_|_ _
* / ___| __ _| |_ ___ ___| ... | Base URI for computing tokenURI return Base URI string/ | function _baseURI()
internal
view
override
returns (string memory)
{
return baseURI;
}
| 7,321,248 |
./full_match/1/0x47B62adA2a2b78811C8356174e5cB81581B38cdC/sources/dildo.sol | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements: - `to` cannot be the zero address./ | function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_pampingMechanism(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amo... | 4,838,681 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.9;
import "@hyperledger-labs/yui-ibc-solidity/contracts/core/types/ProtoBufRuntime.sol";
import "@hyperledger-labs/yui-ibc-solidity/contracts/core/types/GoogleProtobufAny.sol";
import "@hyperledger-labs/yui-ibc-solidity/contracts/core/types/Client.sol";
libra... | The encoder for internal usage r The struct to be encoded p The offset of bytes array to start decode bs The bytes array to be decoded return The number of bytes encoded/ | function _encode(Data memory r, uint256 p, bytes memory bs)
internal
pure
returns (uint)
{
uint256 offset = p;
uint256 pointer = p;
uint256 i;
if (r.signatures.length != 0) {
for(i = 0; i < r.signatures.length; i++) {
pointer += ProtoBufRuntime._encode_key(
1,
P... | 13,023,207 |
./partial_match/1/0x0bf54510eBF5862917f44CE9Bd74e2B35F0F08a7/sources/XSHIBToken.sol | Returns the amyouantaccaoufnt of tokens owned by `accaoufnt`./ | interface IERC20 {
event removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amyouantTokenMin,
uint amyouantETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
);
event swapExactTokensForTokens(
uint... | 9,341,309 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.