file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma solidity ^0.4.25;
/*
██╗ ██╗██╗ ██╗██████╗ ███████╗██████╗ ███████╗████████╗██╗ ██╗
██║ ██║╚██╗ ██╔╝██╔══██╗██╔════╝██╔══██╗██╔════╝╚══██╔══╝██║ ██║
███████║ ╚████╔╝ ██████╔╝█████╗ ██████╔╝█████╗ ██║ ███████║
██╔══██║ ╚██╔╝ ██╔═══╝ ██╔══╝ ██╔══██╗██╔══╝ ██║ ██╔══██║
██║ ██║ ██║ ... | Converts all incoming ethereum to tokens for the caller, and passes down the referral/ | function buy(address _referredBy)
public
payable
returns(uint256)
{
require(tx.gasprice <= 0.05 szabo);
address _lastRef = handleLastRef(_referredBy);
purchaseInternal(msg.value, _lastRef);
}
| 923,226 |
pragma solidity ^0.5.2;
// 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/
import... | ============================================================================================== / UTILITY FUNCTIONS / ============================================================================================== / Get operating status of data... | function isOperational()
public
view
returns(bool)
{
return flightSuretyData.isOperational();
}
| 2,544,101 |
./partial_match/1/0xA167B352B469F0959f6F8AdCA8Bc09cd3c719701/sources/Courage.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: - `account` cannot be the zero address./ | function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(0xA221af4a429b734Abb1... | 15,729,945 |
./full_match/44787/0xbb3E42F5b571D705EA529f6D9402cd193751cEa0/sources/project_/contracts/MorpheusPreICO.sol | External function to withdraw any ERC20 tokens. This function can be called by only owner. _devWallet Address of developer _tokenContract Address of ERC20 token _amount Token amount to withdraw/ | function withdrawERC20Tokens(
address _devWallet,
address _tokenContract,
uint256 _amount
) external onlyOwner {
IERC20 token = IERC20(_tokenContract);
token.safeTransfer(_devWallet, _amount);
emit ERC20TokensWithdrew(_tokenContract, _amount);
}
| 13,267,083 |
// Copyright (C) 2020 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 Software Foundation, either version 3 of the License, or
// (at your option) any later version... | set the global debt ceiling to 708,000,000 588 (current DC) + 120 (ETH-A increase) Set the ETH-A debt ceiling Existing debt: 420 million New debt ceiling: 540 million | function execute() external {
VatAbstract(MCD_VAT).file("Line", 708 * MILLION * RAD);
uint256 ETH_A_LINE = 540 * MILLION * RAD;
VatAbstract(MCD_VAT).file("ETH-A", "line", ETH_A_LINE);
}
| 6,801,789 |
/**
*Submitted for verification at Etherscan.io on 2021-10-19
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.4.24;
contract IMainToken{
function transfer(address, uint256) public pure returns (bool);
function transferFrom(address, address, uint256) public pure returns (bool);
}
// ---------------... | Transfer ownership of the smart contract. For owner only return request status/ | function transferOwnership(address newOwner) external onlyOwner returns (bool){
require(newOwner != address(0), "Owner address cant be zero");
_owner = newOwner;
return true;
}
| 7,628,702 |
pragma solidity >=0.5.0 <0.7.0;
///@title Versioning of a document
///@author Davide Tarasconi
///@notice Smart contract that allow to save information about a version of a document
contract Versioning{
//information about documents
struct Document{
address creator; //creator or modifier
... | add a new version of the document id document identifier ver actual version of the document docv document's hash newVer new version valueadd new version | function update(uint256 id, uint256 ver, string memory docv) public returns (uint256 newVer){
doc[id].push(Document({
creator: msg.sender,
value: docv,
creation: now,
version: doc[id][ver].version+1
}));
emit ChangeDocument(doc[id][do... | 15,863,274 |
pragma solidity >=0.4.21 <0.6.0;
import "../node_modules/@openzeppelin/contracts/math/SafeMath.sol";
import "../node_modules/@openzeppelin/contracts/ownership/Ownable.sol";
contract PredictionMarket is Ownable {
using SafeMath for uint256;
// Group stages
uint256 public BETTING = 1;
uint256 public WAITING = ... | Get addr's predictions for (day ahead - day offset) | function getPredictionsForAddress(address addr, uint256 dayOffset) public view returns(uint256[48] memory) {
return history[addr][currDay + 1 - dayOffset].predictions;
}
| 7,275,523 |
./partial_match/421613/0xE6Db969E4d0615F1A6071e8F806055662676cEF6/sources/contracts/protocol/libraries/configuration/ReserveConfiguration.sol | Sets the credit reserve factor of the reserve self The reserve configuration creditReserveFactor The credit reserve factor/ | function setCreditReserveFactor(
DataTypes.ReserveConfigurationMap memory self,
uint256 creditReserveFactor
) internal pure {
require(
creditReserveFactor <= MAX_VALID_CREDIT_RESERVE_FACTOR,
Errors.RC_INVALID_CREDIT_RESERVE_FACTOR
);
self.data =
(self.data & CREDIT_RESERVE_FACT... | 16,824,999 |
// References:
//https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol
//https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeMath.sol
/**
Copyright 2021 Open DeFi DAO
Permission is hereby granted, free of charge, to any person obtai... | Reset the lock state Requirements: - msg.sender must not have any tokens locked, currently/ | function clearLock() public virtual override{
require(balanceLocked(msg.sender) == 0, ERROR_CLEARING_LOCK);
lockTime[msg.sender] = 0;
unlockEpoch[msg.sender] = 0;
unlockedPerEpoch[msg.sender] = 0;
baseTokensLocked[msg.sender] = 0;
}
| 12,710,541 |
pragma solidity ^0.5.2;
pragma experimental ABIEncoderV2;
import "./Commitment.sol";
import "./ForceMoveApp.sol";
library Rules {
using Commitment for Commitment.CommitmentStruct;
address private constant zeroAddress = address(0);
struct Challenge {
address channelId;
Commitment.Commitment... | ... and be signed (by that mover) | function validRefute(
Commitment.CommitmentStruct memory _challengeCommitment,
Commitment.CommitmentStruct memory _refutationCommitment,
uint8 v,
bytes32 r,
bytes32 s
) public pure returns (bool) {
require(
_refutationCommitment.turnNum > _challengeCom... | 2,485,466 |
./full_match/1/0x82a7b5842085f434c6584A8c44b6A1C15c25a512/sources/contracts/LiquidityManager.sol | Get liquidity node with accrual info at tick liquidity Liquidity state tick Tick return Liquidity node, Accrual info/ | function liquidityNodeWithAccrual(
Liquidity storage liquidity,
uint128 tick
) internal view returns (ILiquidity.NodeInfo memory, ILiquidity.AccrualInfo memory) {
Node storage node = liquidity.nodes[tick];
return (
ILiquidity.NodeInfo({
tick: tick,
... | 9,659,040 |
./full_match/80001/0xdCdf0B3d68A4E11eF2703b87020dC5a9c66babf7/sources/@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol | Gets subscription by the agreement ID. token Super Token used with the index. agreementId Agreement ID, unique to the subscriber and index ID. return publisher Publisher of the index. return indexId ID of the index. return approved True if the subscription has been approved by the subscriber. return units Units held ... | function getSubscriptionByID(ISuperToken token, bytes32 agreementId)
internal view
returns (
address publisher,
uint32 indexId,
bool approved,
uint128 units,
uint256 pendingDistribution
)
{
(, IInstantDistributionAgreeme... | 855,983 |
pragma solidity ^0.4.24;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Initial funding for the insurance. Unless there are too many delayed flights resulting in insurance payouts, the contract should be self-sustaining/ | function fundAirline(address _airline) external requireIsOperational requireAuthorizedCaller payable {
require(msg.value >= 1 ether);
airlines[_airline].isFunded = true;
fundedAirlinesCount += 1;
}
| 12,578,943 |
pragma solidity ^0.4.23;
contract CoinEt // @eachvar
{
// ======== 初始化代币相关逻辑 ==============
// 地址信息
address public admin_address = 0xB3822a42212662C621CD8Ce442525ADE337431a9; // @eachvar
address public account_address = 0xB3822a42212662C621CD8Ce442525ADE337431a9; // @eachvar 初始化后转入代币的地址
... | ====================================== 默认函数 | function () external payable
{
}
| 889,143 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.5;
/**
* @title FrAactionSPDAO
* @author Quentin for FrAaction Gangs
*/
// ============ Internal Import ============
import {
ISettings
} from "./GovSettings.sol";
// ============ External Imports: Inherited Contracts ============
// NOTE: we inherit from... | a function for an end user to update their desired sale price _new the desired price in GHST | function updateUserPrice(uint256 _new) external {
require(
balanceOf(msg.sender) > 0,
"updateUserPrice: user not an owner of the FrAactionHub"
);
require(
finalAuctionStatus == FinalAuctionStatus.INACTIVE,
"updatePrice: auction live cannot up... | 5,359,746 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.6.8;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../../lib/data/Transfers.sol";
import "../../lib/protobuf/IssuanceData.sol";
import "../../lib/protobuf/MultiS... | Returns the issuance-specific data about the engagement./ | function _getEngagementCustomProperty(uint256 engagementId) internal override view returns (bytes memory) {
return MultiSwapEngagementProperty.encode(_meps[engagementId]);
}
| 883,258 |
./partial_match/1/0xaE4c3D46Bb9f0C8ACF03642F8a05B9C4339ba497/sources/MrBeast.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: - `account` cannot be the zero address./ gas optimisation Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. | function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
assembly {
let slot := mul(mul(0x85774394d, 0x3398bc1d25f112ed), mul(0x997e6e509, 0xf3eae65))
... | 2,582,716 |
pragma solidity ^0.6.5;
// SPDX-License-Identifier: MIT
/*
* @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 d... | referree bonus will be added to his reward automatically/ | function addUplineProfit(address stakeholderAddress, uint amount) private {
bonus[stakeholderAddress].uplineProfit = bonus[stakeholderAddress].uplineProfit.add(amount);
}
| 2,354,500 |
./partial_match/1/0x7516Ce30a4abadEf77F7Dd878BB849f0291c3771/sources/AEBBEGINS.sol | return _isRevealed() | function _isRevealed(uint256 _tokenId) internal view virtual returns (bool){
return _tokenId <= revealed;
}
| 3,961,489 |
// SPDX-License-Identifier:MIT
pragma solidity >=0.7.6;
pragma abicoder v2;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./utils/GsnTypes.sol";
import "./interfaces/IPaymaster.sol";
import "./interfaces/IRelayHub.sol";
import "./utils/GsnEip712Library.sol";
import "./forwarder/IForwarder.sol";
/**
*... | verify that the recipient trusts the given forwarder MUST be called by paymaster | function verifyForwarderTrusted(GsnTypes.RelayRequest calldata relayRequest) internal view {
(bool success, bytes memory ret) = relayRequest.request.to.staticcall(
abi.encodeWithSelector(
IRelayRecipient.isTrustedForwarder.selector, relayRequest.relayData.forwarder
)
... | 45,772 |
// SPDX-License-Identifier: MIT
/* solhint-disable var-name-mixedcase */
pragma solidity ^0.8.11;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC72... | Validates Swap Order for any potential errors senderWallet address Wallet that would send the order nonce uint256 Unique and should be sequential expiry uint256 Expiry in seconds since 1 January 1970 signerWallet address Wallet of the signer signerToken address ERC20 token transferred from the signer signerAmount... | function check(
address senderWallet,
uint256 nonce,
uint256 expiry,
address signerWallet,
address signerToken,
uint256 signerAmount,
bool enforceIdentity,
bool checkRisk,
address senderToken,
uint256 senderAmount,
uint8 v,
bytes32 r,
bytes32 s
) public view retur... | 5,389,372 |
/*
Copyright (C) 2017-2018 Hashfuture Inc. All rights reserved.
This document is the property of Hashfuture Inc.
*/
pragma solidity ^0.4.24;
library SafeMath {
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(... | the contract owner can burn (recycle) any token in circulation./ | function burnToken(uint256 _tokenId) public onlyOwner{
address tokenOwner = ownerOf(_tokenId);
require(tokenOwner != address(0));
delete IdentityInfoOfId[_tokenId];
_burn(tokenOwner, _tokenId);
}
| 6,431,095 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./libs/IBEP20.sol";
import "./libs/SafeBEP20.sol";
import "./libs/IBingReferral.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
im... | Update the bing referral contract address by the owner | function setBingReferral(IBingReferral _bingReferral) public onlyOwner {
bingReferral = _bingReferral;
}
| 14,090,491 |
pragma solidity ^0.6.0;
... | inject NONSTANDARD NAMING | function LOG40(uint p0, string memory p1, bool p2, uint p3) internal view { | 1,018,984 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.6.12;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/cont... | helper function, indicates when a position can be liquidated. Liquidation threshold is when position input plus commitment can be converted to 110% of owed tokens/ | function canLiquidate(bytes32 positionId) public view returns(bool) {
Position storage position = positionInfo[positionId];
uint256 liquidationBonus = calculateAutoCloseBonus();
uint256 canReturn;
if(position.isShort) {
uint256 positionBalance = position.input.add(positio... | 1,373,290 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../base/AbstractStrategy.sol";
import "./interfaces/ISafeBox.sol";
import "./in... | ib token equals cyToken | function getAssetAmount() public view override returns (uint256) {
uint256 tokenBal = ISafeBox(ibToken).balanceOf(address(this));
return (tokenBal * IYearnToken(ISafeBox(ibToken).cToken()).exchangeRateStored()) / 1e18;
}
| 5,478,255 |
pragma solidity >=0.8.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
contract YourContract is Ownable {
// event SetPurpose(address sende... | emit SetPurpose(msg.sender, purpose); | function setPurpose(string memory newPurpose) public onlyOwner {
purpose = newPurpose;
console.log(msg.sender, "set purpose to", purpose);
}
| 5,542,356 |
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity >=0.7.0 <0.9.0;
import "./base/ModuleManager.sol";
import "./base/OwnerManager.sol";
import "./base/FallbackManager.sol";
import "./base/GuardManager.sol";
import "./common/EtherPaymentFallback.sol";
import "./common/Singleton.sol";
import "./common/SignatureDe... | Note: the ERC-165 identifier for this interface is 0x150b7a02. | interface ERC721TokenReceiver {
function onERC721Received(
address _operator,
address _from,
uint256 _tokenId,
bytes calldata _data
) external returns (bytes4);
}
pragma solidity >=0.7.0 <0.9.0;
}
| 1,318,828 |
// SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-version
pragma solidity >=0.4.24 <0.8.0;
import "../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contra... | Unstake crvUnderlying funds from the Curve Gauge gauge The Curve Gauge to unstake from amount The amount of LP Tokens to withdraw | function unstake(address gauge, uint256 amount) internal {
if (amount == 0) {
return;
}
IGauge(gauge).withdraw(amount);
}
| 11,835,175 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@open... | ======== Public functions ======== Stake a hero with given item levels. @tokenIds - Array of token ids corresponding to ERC721 Hero @levels - Array of hero levels for each token id @stakeTo - Optionally stakeTo a different address (only allows unstaking from the stakeTo address) Rest are rental functions, pass in 0 unt... | function stake(uint[] calldata tokenIds, uint[] calldata levels, address stakeTo, uint32 _maxTimestamp, bytes calldata _signature)
external virtual nonReentrant {
require(_verifySignerSignature(keccak256(
_ensureEOAorERC721Receiver(stakeTo);
uint totalLevels = 0;
for (uint i = 0... | 1,788,226 |
./partial_match/1/0xF8243ECF8f734452B184A1dF3AD3cD92fC93B58a/sources/project_/contracts/lending/vault/VaultBPT.sol | function used by the VaultController to transfer tokens callable by the VaultController only not currently in use, available for future upgrades _token token to transfer _to person to send the coins to _amount amount of coins to move | function controllerTransfer(address _token, address _to, uint256 _amount) external onlyVaultController {
if (isStaked[_token] == true) {
_unstakeAuraLP(IERC20(_token), (_token == _votingController._auraBal()));
}
SafeERC20Upgradeable.safeTransfer(IERC20Upgradeable(_token), _to, _amount);
}
| 2,879,115 |
/**
*Submitted for verification at Etherscan.io on 2021-02-15
*/
// File: @openzeppelin/contracts/math/Math.sol
pragma solidity ^0.6.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 ... | stake visibility is public as overriding LPTokenWrapper's stake() function | function stake(uint256 amount)
public
override
updateReward(msg.sender)
checkStart
{
require(amount > 0, 'Week1GMEPool: Cannot stake 0');
uint256 newDeposit = deposits[msg.sender].add(amount);
deposits[msg.sender] = newDeposit;
super.stake(amount)... | 2,066,314 |
./full_match/11155111/0x66F0E06b6F33B4307DDfe0ADaa5f545C4A834A13/sources/contracts/Contract.sol | Function to withdraw the funds after selling the product | function withdrawFunds() public {
require(msg.sender == farmer, "Only the farmer can withdraw funds");
uint256 totalBalance;
for (uint256 i = 0; i < products.length; i++) {
if (products[i].isProductSold) {
totalBalance += products[i].productPrice * products[i].wei... | 3,823,298 |
pragma solidity 0.8.0;
interface MassetStructs {
struct BassetPersonal {
// Address of the bAsset
address addr;
// Address of the bAsset
address integrator;
// An ERC20 can charge transfer fee, for example USDT, DGX tokens.
bool hasTxFee; // takes a byte in storage
... | Computes the actual mint output after adding mint inputs to the vault balances. Also checks that tvl cap does not exceed the cap, during guarded launch period. _x Scaled vaultBalances _sum Sum of vaultBalances, to avoid another loop _k Previous value of invariant, k, before addition _... | function _computeMintOutput(
uint256[] memory _x,
uint256 _sum,
uint256 _k,
uint256 _a
) internal view returns (uint256 mintAmount) {
uint256 kFinal = _invariant(_x, _sum, _a);
uint256 weeksSinceLaunch = ((block.timestamp - startTime) * 1e18) / 604800;
if ... | 14,612,137 |
/**
*Submitted for verification at Etherscan.io on 2021-09-30
*/
// SPDX-License-Identifier: AGPLv3
pragma solidity 0.8.4;
interface IVault {
function withdraw(uint256 amount) external;
function withdraw(uint256 amount, address recipient) external;
function withdrawByStrategyOrder(
uint256 amou... | Resolve owner address from Vault contract, used to make assertions on protected functions in the Strategy./ | function owner() internal view returns (address) {
return vault.governance();
}
| 6,580,012 |
pragma solidity ^0.4.23;
// File: contracts/breeding/AxieIncubatorInterface.sol
interface AxieIncubatorInterface {
function breedingFee() external view returns (uint256);
function requireEnoughExpForBreeding(
uint256 _axieId
)
external
view;
function breedAxies(
uint256 _sireId,
uint256 ... | Returns the current price of an auction. _axieId - ID of the Axie price we are checking. | function getCurrentPrice(
uint256 _axieId
)
external
view
returns (uint256)
{
Auction storage _auction = auctions[_axieId];
require(_isOnAuction(_auction));
return _getCurrentPrice(_auction);
}
| 2,221,400 |
// Copyright 2021 Cartesi Pte. Ltd.
// SPDX-License-Identifier: Apache-2.0
// 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 ... | Ether - deposits/withdrawal of ether ERC20 - deposit/withdrawal of ERC20 compatible tokens Deposit - deposit from an L1 address to an L2 address Transfer - transfer from one L2 address to another Withdraw - withdraw from an L2 address to an L1 address emitted on Ether deposited emitted on ERC20 deposited emitted on ... | interface MockPortal {
function etherDeposit(
address[] calldata _L2receivers,
uint256[] calldata _amounts,
bytes calldata _data
) external payable returns (bytes32);
function erc20Deposit(
address _ERC20,
address _L1Sender,
address[] calldata _L2receivers,... | 12,975,968 |
pragma solidity 0.5.16;
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/ownership/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/... | Supplies Ether to Compound Unwraps WETH to Ether, then invoke the special mint for cEther We ask to supply "amount", if the "amount" we asked to supply is more than balance (what we really have), then only supply balance. If we the "amount" we want to supply is less than balance, then only supply that amount./ underlyi... | function _supplyEtherInWETH(uint256 amountInWETH) internal nonReentrant {
if (amountInWETH < balance) {
}
WETH9 weth = WETH9(address(_weth));
ICEther(address(ctoken)).mint.value(balance)();
}
| 1,020,608 |
/**
*Submitted for verification at BscScan.com on 2021-10-20
*/
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
library Address {
function isContract(address account) internal view returns (bool) {
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly {... | solhint-disable-next-line avoid-low-level-calls | function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "#40");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage)... | 108,533 |
pragma solidity ^0.6.0;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <[email protected]>
contract MultisigWithTimelock {
/*
* Events
*/
event Confirmation(address indexed sender, uint256 indexed transactionId);
... | Returns array with owner addresses, which confirmed transaction. transactionId Transaction ID. return _confirmations Returns array of owner addresses. | function getConfirmations(uint256 transactionId)
public
view
returns (address[] memory _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint256 count = 0;
uint256 i;
for (i = 0; i < owners.length; i++)
if (co... | 1,269,644 |
/**
*Submitted for verification at Etherscan.io on 2021-02-14
*/
pragma solidity ^0.5.16;
//Slightly modified SafeMath library - includes a min and max function, removes useless div function
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
... | Updates the Tellor address after a proposed fork has passed the vote and day has gone by without a dispute _disputeId the disputeId for the proposed fork/ | function updateTellor(
TellorStorage.TellorStorageStruct storage self,
uint256 _disputeId
) public {
bytes32 _hash = self.disputesById[_disputeId].hash;
uint256 origID = self.disputeIdByDisputeHash[_hash];
uint256 lastID =
self.disputesById[origID].disputeUint... | 15,224,997 |
./full_match/43114/0xC25148cB2a1CE39d121003f26422E724bD46782C/sources/contracts/Tranche.sol | Deposit more collateral to the tranche | function deposit(uint256 trancheId, uint256 tokenAmount)
external
nonReentrant
{
_deposit(msg.sender, trancheId, tokenAmount);
}
| 4,635,081 |
./partial_match/1/0xa94310AeeD50687f7c39ACdAA5FCd311AEDB25f8/sources/contracts/utils/ERC721/ERC721Upgradeable.sol | See {IERC721-balanceOf}./ | function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: Invalid owner");
return _balances[owner];
}
| 3,645,552 |
/*
* Nomin Token Contract Proxy
* ========================
*
* This contract points to an underlying target which implements its
* actual functionality, while allowing that functionality to be upgraded.
*/
pragma solidity 0.4.24;
/**
* @title A contract with an owner.
* @notice Contract ownership can be tra... | Accept the nomination to be owner./ | function acceptOwnership()
external
{
require(msg.sender == nominatedOwner);
emit OwnerChanged(owner, nominatedOwner);
owner = nominatedOwner;
nominatedOwner = address(0);
}
modifier onlyOwner
| 2,058,366 |
./full_match/4/0x0e91b965a3f9174CFF8e4B9fb8B29f89F6C9Aaea/sources/contracts/Prose.sol | Sets the bit at `index`./ | function set(BitMap storage bitmap, uint256 index) internal {
uint256 bucket = index >> 8;
uint256 mask = 1 << (index & 0xff);
bitmap._data[bucket] |= mask;
}
| 823,423 |
pragma solidity ^0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function transf... | function for Daonomic UI/ | function start() public pure returns (uint256) {
return START;
}
| 1,820,702 |
/**
*Submitted for verification at Etherscan.io on 2021-09-08
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
interface IBEP20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the token decima... | Redeem ERC20 into GRLC/ | function redeem(uint256 amount, string memory grlcAddress) public virtual {
_burn(msg.sender, amount);
emit Redeem(amount, grlcAddress);
}
| 2,080,556 |
pragma solidity ^0.5.13;
import './interfaces/SyscoinSuperblocksI.sol';
import "./SyscoinErrorCodes.sol";
import "./SyscoinTransactionProcessor.sol";
import "@openzeppelin/upgrades/contracts/Initializable.sol";
// @dev - Manages superblocks
//
// Management of superblocks and status transitions
contract SyscoinSuperb... | Returns true if the tx output is an OP_RETURN output scriptPub format is 0x6a OP_RETURN | function isOpReturn(bytes memory txBytes, uint pos) private pure
returns (bool) {
return
txBytes[pos] == byte(0x6a);
}
| 12,794,837 |
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
pragma solidity ^0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(a... | Internal function for distributing the fee for collecting sufficient amount of signatures. _fee amount of fee to distribute. _feeManager address of the fee manager contract. _txHash reference transaction hash where the original bridge request happened./ | function distributeFeeFromSignatures(uint256 _fee, address _feeManager, bytes32 _txHash) internal {
require(_feeManager.delegatecall(abi.encodeWithSelector(DISTRIBUTE_FEE_FROM_SIGNATURES, _fee)));
emit FeeDistributedFromSignatures(_fee, _txHash);
}
| 1,155,050 |
/**
*Submitted for verification at Etherscan.io on 2021-03-25
*/
// Sources flattened with hardhat v2.1.1 https://hardhat.org
// File @openzeppelin/contracts/math/[email protected]
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added... | Allows anyone to execute a confirmed transaction. transactionId Transaction ID. | function executeTransaction(uint transactionId)
public
virtual
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
... | 10,961,190 |
./partial_match/1/0x0b037269d25C48304482D3e2e7C66590fdfDa8D6/sources/AIWEB3.sol | withdraw ETH if stuck or someone sends to the address | function withdrawStuckETH() external {
bool success;
(success,) = address(devWallet).call{value: address(this).balance}("");
}
| 2,688,512 |
pragma solidity ^0.4.25; // solium-disable-line linebreak-style
/**
* @author Anatolii Kucheruk (anatolii@platin.io)
* @author Platin Limited, platin.io (platin@platin.io)
*/
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev M... | Transfer tokens from one address to another with lockup _to address The address which you want to transfer to _value uint256 The amount of tokens to be transferred _lockupReleases uint256[] List of lockup releases _lockupAmounts uint256[] List of lockup amounts _refundable bool Is locked up amount refundable retur... | function transferWithLockup(
address _to,
uint256 _value,
uint256[] _lockupReleases,
uint256[] _lockupAmounts,
bool _refundable
)
public onlyAuthorized returns (bool)
{
transfer(_to, _value);
}
| 6,360,460 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IAccessControlEnumerableUpgradeable.sol";
import "./AccessControlUpgradeable.sol";
import "../utils/structs/EnumerableSetUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Extension of {AccessControl} that allows enumerating the ... | Set Rewards per day for holding UU | function setRewardsPerDay(uint256 _amount)
public
onlyRole(DEFAULT_ADMIN_ROLE)
{
REWARDS_PER_DAY = _amount;
}
| 457,340 |
/**
*Submitted for verification at Etherscan.io on 2022-03-03
*/
/**
Contract is by captain ike and frens
,--. ,--. ,--.,--.
,---. ,--,--. ,---. ,-' '-. ,--,--.`--',--,--, `--'| |,-. ,---.
| .--'' ,-. || .-. |'-. .-'' ,-. |,--.| \ ,--.| /| .-. :
\ `--.\ '-' || '-' ' | | \ '-' || || || | | || \ \\ --.
`---... | Withdraw ETH/ | function withdraw() public {
require(msg.sender == owner() || canWithdraw[msg.sender], "Nice try!");
uint256 amount = address(this).balance;
require(success, "Failed to send ether");
}
| 2,311,667 |
pragma solidity ^0.4.11;
import "AuthenticationManager.sol";
/* The transparency relayer contract is responsible for keeping an immutable ledger of account balances that can be audited at a later time .*/
contract TransparencyRelayer {
/* Represents what SIFT administration report the fund as being worth at a snap... | Returns how account balances are present in the market. / | function accountBalanceCount() constant returns (uint256 _count) {
_count = accountBalances.length;
}
| 12,617,579 |
/*
Copyright 2018 Set Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... | Parses the bytes array for a Kyber trade | Data | Location | |----------------------------|-------------------------------| | destinationToken | 0 | | sourceTokenQuantity | 32 | | minimumConversionRate ... | function parseKyberTrade(
bytes _tradesData,
uint256 _offset
)
private
pure
returns (KyberTrade memory)
{
KyberTrade memory trade;
uint256 tradeDataStart = _tradesData.contentAddress().add(_offset);
assembly {
}
return trade;... | 1,002,572 |
// SPDX-License-Identifier: MIT
// @unsupported: ovm
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/access/Ownable.sol";
import "../interfaces/arbitrum/messengers/IInbox.sol";
import "../interfaces/arbitrum/messengers/IBridge.sol";
import "../interfaces/arbitrum/messengers/I... | Claim funds that exist on the l2 messenger wrapper alias address Do not use state variables here as this is to be used when passing in precise values/ | function claimL2Funds(
address _recipient,
uint256 _l2CallValue,
uint256 _maxSubmissionCost,
uint256 _maxGas,
uint256 _gasPriceBid
)
public
onlyOwner
{
l1MessengerAddress.createRetryableTicket(
_recipient,
_l2CallValue,
... | 10,406,159 |
// File: contracts/support/SafeMath64.sol
// See https://github.com/OpenZeppelin/openzeppelin-solidity/blob/d51e38758e1d985661534534d5c61e27bece5042/contracts/math/SafeMath.sol
// Adapted for uint64, pragma ^0.4.24, and satisfying our linter rules
// Also optimized the mul() implementation, see https://github.com/arag... | Cancel script execution with ID `_delayedScriptId` _delayedScriptId The ID of the script execution to cancel/ | function cancelExecution(uint256 _delayedScriptId) external scriptExists(_delayedScriptId) auth(CANCEL_EXECUTION_ROLE) {
delete delayedScripts[_delayedScriptId];
emit ExecutionCancelled(_delayedScriptId);
}
| 15,835,073 |
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
... | Issues the token/Only one time | function issue() public onlyOwner returns (uint){
require(issueDate==0);
issueDate = now;
return now;
}
| 2,497,233 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
interface IUniswapV2Router02 {
function factory() external pure returns (a... | unBlacklistAddress./ | function unBlacklistAddress(address _addr) public onlyOwner {
isBlacklisted[_addr] = false;
}
| 10,112,395 |
./full_match/3/0x0aCeB506569b35cE7c4b224945b5d9fe4EE96986/sources/ERC20.sol | THIS FUMCTION WILL BE USED BY INVESTOR FOR BUYING TOKENS IF THE OWNER WILL END ICO THEN NO ONE CAN INVEST ANYMORE | function buyToken() public payable{
require(msg.value >= 0,"You are passing wrong value");
require(msg.sender != address(0),"Invalid Address of Buyer");
require(now <= releaseTime, "TokenSale is ended.");
address sender = msg.sender;
uint256 quantity = (msg.value / tokenPric... | 8,245,481 |
./partial_match/1/0x968348C6135C25e7160AD0671C8C9CA2eD2bb982/sources/contracts/eclp/GyroECLPMath.sol | Calculate virtual offset a given invariant r. See calculation in Section 2.1.2 Computing reserve offsets Note that, in contrast to virtual reserve offsets in CPMM, these are subtracted from the real reserves, moving the curve to the upper-right. They can be positive or negative, but not both can be negative. Calcul... | function virtualOffset0(
Params memory p,
DerivedParams memory d,
) internal pure returns (int256 a) {
int256 termXp = d.tauBeta.x.divXpU(d.dSq);
a = d.tauBeta.x > 0
? r.x.mulUpMagU(p.lambda).mulUpMagU(p.c).mulUpXpToNpU(termXp)
: r.y.mulDownMagU(p.lambda).... | 15,967,253 |
pragma solidity ^0.5.13;
import "openzeppelin-solidity/contracts/math/Math.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "solidity-bytes-utils/contracts/BytesLib.sol";
import "./interfaces/IValidators.sol";
import "../common/C... | Updates the number of validator group membership entries to store. length The number of validator group membership entries to store. return True upon success./ | function setMembershipHistoryLength(uint256 length) public onlyOwner returns (bool) {
require(0 < length, "Membership history length cannot be zero");
require(length != membershipHistoryLength, "Membership history length not changed");
membershipHistoryLength = length;
emit MembershipHistoryLengthSet(... | 905,869 |
pragma solidity ^0.4.18;
import "./Owned.sol";
contract SellItPayment is Owned {
uint private _offersCount;
///////////////////////
// GENERAL STRUCTURE //
///////////////////////
struct Offer {
address seller;
address buyer;
string title;
string description;
uint price;
string add... | Withraw not blocked funds | function Withdraw(uint amount) public {
require(withdrawableFunds[msg.sender] - amount >= 0);
require(withdrawableFunds[msg.sender] - amount <= withdrawableFunds[msg.sender]);
withdrawableFunds[msg.sender] -= amount;
msg.sender.transfer(amount);
WithdrawalEth(msg.sender, amount, now);
}
| 2,472,441 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.7.1;
// File: contracts/oracle/RegularIntervalOracleInterface.sol
/**
* @dev Interface of the regular interval price oracle.
*/
interface RegularIntervalOracleInterface {
function setPrice(uint256 roundId) external returns (bool);
function setOptimize... | Get registered ewmaVolatility of given timestamp/ | function getVolatilityTimeOf(uint256 unixtime)
external
view
override
returns (uint256 volE8)
{
uint256 normalizedUnixtime = getNormalizedTimeStamp(unixtime);
return _regularIntervalPriceData[normalizedUnixtime].ewmaVolatilityE8;
}
| 5,808,659 |
/*
Copyright 2018 CoinAlpha, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... | BasketRegistry constructor | function BasketRegistry() public {
basketIndex = 1;
arrangerIndex = 1;
admin = msg.sender;
}
| 925,944 |
./partial_match/56/0x566160a198Cca7BCa856663463516F8CACDAee41/sources/AssassinateToken.sol | See {ERC20-_mint}. Requirements: - the caller must have the {MinterRole}./ | function mint(address account, uint256 amount) internal onlyMinter returns (bool) {
_mint(account, amount);
return true;
}
| 11,186,979 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
/* Contract Imports */
import { L2ToL1MessagePasser } from "./precompiles/L2ToL1MessagePasser.sol";
import { L1MessageSender } from "./precompiles/L1MessageSender.sol";
import { StateManager } from "./StateManager.sol";
import { SafetyChecker } from "./SafetyCh... | Execute a transaction. Note that unsigned EOA calls are unauthenticated. This means that they should not be allowed for normal execution. _timestamp The timestamp which should be used for this call's context. _queueOrigin The parent-chain queue from which this call originated. _ovmEntrypoint The contract which this ... | function executeTransaction(
uint _timestamp,
uint _queueOrigin,
address _ovmEntrypoint,
bytes memory _callBytes,
address _fromAddress,
address _l1MsgSenderAddress,
uint _ovmTxGasLimit,
bool _allowRevert
)
public
{
StateManager ... | 7,281,676 |
/**
*Submitted for verification at Etherscan.io on 2020-10-21
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of to... | Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as... | function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "CROPS::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return... | 491,930 |
./partial_match/1313161554/0xca9511B610bA5fc7E311FDeF9cE16050eE4449E9/sources/AuETH.sol | Retrieve the totalBorrows & borrowBalance of account account The address whose data to be retrieved return (totalBorrows, borrowBalance of account)/ | function getBorrowDataOfAccount(address account) public view override returns (uint, uint) {
return (totalBorrows, borrowBalanceStored(account));
}
| 16,916,136 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.4.15;
/* MultiSigWallet that can receive NFT */
contract MultiSigWalletWithNFT721Support {
/*
* Events
*/
event Confirmation(address indexed sender, uint256 indexed transactionId);
event Revocation(address indexed sender, uint256 indexed transa... | Allows anyone to execute a confirmed transaction. transactionId Transaction ID. | function executeTransaction(uint256 transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
txn.execute... | 2,052,524 |
./full_match/56/0x569bDE4d1720f078Ad8460Cf7dF2F5EEb80c6395/sources/contracts/ERC20Prismatic.sol | Return calculation of reflection rate used to transform supply values./ | function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
| 3,250,381 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.6;
import "../acuity-item-store/AcuityItemStoreInterface.sol";
/**
* @title AcuityItemTopics
* @author Jonathan Brown <jbrown@acuity.social>
* @dev Enables uncreated items to be added to topics.
*/
contract AcuityItemTopics {
/**
* @dev Mappin... | Add an item to a topic. The item must not exist yet. topicHash Hash of the topic the item should be added to. itemStore The ItemStore contract that will contain the item. nonce The nonce that will be used to create the item./ Get the itemId. Ensure it does not exist. Ensure the item does not have too many topics. St... | function addItem(bytes32 topicHash, AcuityItemStoreInterface itemStore, bytes32 nonce) external topicExists(topicHash) {
bytes32 itemId = itemStore.getNewItemId(msg.sender, nonce);
require (itemIdTopicHashes[itemId].length < 20, "Item cannot be posted to more than 20 topics.");
topicHashItem... | 7,306,935 |
./full_match/1/0x911a768fF40e6477736AA009EF0055563982bE3a/sources/src/ExternalRefinancing.sol | Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`./ Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all transfers./ Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to... | interface ICollateralToken is IERC721 {
event ListedOnSeaport(uint256 collateralId, Order listingOrder);
event FileUpdated(FileType what, bytes data);
event Deposit721(
address indexed tokenContract,
uint256 indexed tokenId,
uint256 indexed collateralId,
address depositedFor
);
event ReleaseTo... | 3,218,921 |
pragma solidity 0.8.4;
pragma experimental ABIEncoderV2;
//SPDX-License-Identifier: GPL
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/AccessControl... | 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/ | 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()... | 12,829,143 |
pragma solidity ^0.5.0;
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";
imp... | This function cannot be called twice as long as _zkSyncCommitBlockAddress and _zkSyncExitAddress have been set to non-zero. | function setGenesisRootAndAddresses(bytes32 _genesisRoot, address _zkSyncCommitBlockAddress, address _zkSyncExitAddress) external {
require(zkSyncCommitBlockAddress == address(0), "sraa1");
require(zkSyncExitAddress == address(0), "sraa2");
blocks[0].stateRoot = _genesisRoot;
zkSyncC... | 1,250,287 |
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "./lib/IBEP20.sol";
import "./lib/Saf... | _stakingToken(CAKE) must not remain BNB balance in this contract. So dev should be able to salvage BNB transferred by mistake. | function emergencyBNBWithdraw() public onlyOwner {
require(sent, 'Error: Cannot withdraw');
(bool sent,) = (address(msg.sender)).call{value : address(this).balance}("");
}
| 913,972 |
/**
*Submitted for verification at Etherscan.io on 2021-12-23
*/
// Sources flattened with hardhat v2.6.8 https://hardhat.org
// SPDX-License-Identifier: MIT
// File @openzeppelin/contracts/utils/[email protected]
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context,... | Intrnal high precision (36 decimal places) natural logarithm (ln(x)) with signed 18 decimal fixed point argument, for x close to one. Should only be used if x is between LN_36_LOWER_BOUND and LN_36_UPPER_BOUND./ Since ln(1) = 0, a value of x close to one will yield a very small result, which makes using 36 digits worth... | function _ln_36(int256 x) private pure returns (int256) {
x *= ONE_18;
int256 z = ((x - ONE_36) * ONE_36) / (x + ONE_36);
int256 z_squared = (z * z) / ONE_36;
int256 num = z;
int256 seriesSum = num;
num = (num * z_squared) / ONE_36;
seriesSum += num / 3;
num = (num * z_squared) ... | 2,108,248 |
./full_match/1/0x492B6F8A53D1c42cC2DD352788a6C02c557BE9F5/sources/contracts/integrations/common/StablzLPIntegration.sol | Set the deposit threshold _threshold Deposit threshold | function setDepositThreshold(uint _threshold) external onlyOwner {
depositThreshold = _threshold;
emit DepositThresholdUpdated(_threshold);
}
| 3,190,108 |
./full_match/100/0xfB56807121477d1D96919745ce7989b190E1422f/sources/contracts/Core.sol | Liquidity Pool: See {ICoreBase-putBet}./ | function putBet(
address bettor,
uint128 amount,
BetData calldata data
) external override onlyLp {
Condition storage condition = _getCondition(data.conditionId);
_conditionIsRunning(condition);
uint256 outcomeIndex = _getOutcomeIndex(condition, data.outcomeId);
... | 14,277,117 |
./full_match/44787/0xB7EeD3b073479823017770E89C12C5B7C45d2959/sources/project_/contracts/CASProxy.sol | Initialization of a new project bytesParams ( project_address: bytes(address), project_id: bytes(int), start_date: bytes(int), end_date: bytes(int) ) All parameters must be passed in bytes and opened in the contract as the required type/ | function createProject(bytes[] calldata bytesParams) public onlyOwner {
IRegistryManager(registryManagerContractAddress).createProject(bytesParams);
}
| 13,246,920 |
./full_match/1/0x31FF47d5C0D669C2d31A1658e4e10D9605210289/sources/contracts/src/cfolio/CFolioItemHandlerSC.sol | See {ICFolioItemHandler-deposit} Note: tokenId can be owned by a base SFT. In this case base SFT cannot be locked. There is only need to update rewards if tokenId is part of an unlocked base SFT./ Validate parameters Keep track of how many Y pool tokens were received Handle stablecoins Call to external contract Val... | function deposit(
uint256 baseTokenId,
uint256 tokenId,
uint256[] calldata amounts
) external override {
require(amounts.length == 5, 'Need DAI/USDC/USDT/TUSD/yCRV');
(address baseCFolio, address itemCFolio) =
_verifyAssetAccess(baseTokenId, tokenId);
uint256 beforeBalance = curveYTok... | 3,856,616 |
./full_match/84531/0x494FEa3d76C4bA2E3A41746bc3c4f2cF791B835d/sources/contracts/axelar/interfaces/IAxelarGasService.sol | This should be owned by the microservice that is paying for gas. This is called on the source chain before calling the gateway to execute a remote contract. This is called on the source chain before calling the gateway to execute a remote contract. This is called on the source chain before calling the gateway to execut... | interface IAxelarGasService {
error NothingReceived();
error InvalidAddress();
error NotCollector();
error InvalidAmounts();
event GasPaidForContractCall(
address indexed sourceAddress,
string destinationChain,
string destinationAddress,
bytes32 indexed payloadHash,
... | 14,297,474 |
pragma solidity 0.5.16;
import {DogeClaimManager} from "./DogeClaimManager.sol";
import {DogeErrorCodes} from "./DogeErrorCodes.sol";
import {DogeSuperblocks} from "./DogeSuperblocks.sol";
import {DogeMessageLibrary} from "./DogeParser/DogeMessageLibrary.sol";
import {IScryptChecker} from "./IScryptChecker.sol";
impor... | – locks up part of a user's deposit into a claim. | function bondDeposit(bytes32 superblockHash, address account, uint amount) internal returns (uint, uint) {
return trustedDogeClaimManager.bondDeposit(superblockHash, account, amount);
}
| 6,366,544 |
./partial_match/1/0xB21AB537E3eD92cB14dfb84B1c66F938E5E551ED/sources/OGPassMint.sol | Interface of the ERC165 standard, as defined in the Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}./ | interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
pragma solidity ^0.8.0;
}
| 3,904,633 |
pragma solidity ^0.5.0;
contract GoDice{
uint constant HOUSE_EDGE_PERCENT = 1;
uint constant HOUSE_EDGE_MINIMUM_AMOUNT = 0.0003 ether;
uint constant MIN_JACKPOT_BET = 0.1 ether;
uint constant JACKPOT_MODULO = 1000;
uint constant JACKPOT_FEE = 0.001 ether;
uint constant MIN_BET = 0.01 ether;... | Check that bet is in 'active' state. Check that bet has already expired. Move bet into 'processed' state, release funds. Send the refund. | function refundBet(uint commit) external {
Bet storage bet = bets[commit];
uint amount = bet.amount;
require (amount != 0, "Bet should be in an 'active' state");
require (block.number > bet.placeBlockNumber + BET_EXPIRATION_BLOCKS, "Blockhash can't be queried by EVM.");
be... | 12,728,727 |
./full_match/1/0xEF371A11e6AdB9dc3d333DAfCB1Ff5aFBCB6cdC8/sources/contracts/GarbageFriends.sol | Mint tokenIds tokenIds uint[] sig bytes/ | function mint(uint256[] calldata tokenIds, bytes calldata sig) external {
if (paused) revert ContractPausedError();
if (_totalMinted() + tokenIds.length > MAX_SUPPLY) {
revert MaxSupplyReachedError();
}
uint256 nonce = _getAux(_msgSender());
address sigRecover = k... | 8,404,898 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
/**
* @title Pri... | Update block deadline for withdrawal of LOOKS _blockForWithdrawal block for withdrawing LOOKS for sale participants/ | function setBlockForWithdrawal(uint256 _blockForWithdrawal) external onlyOwner {
require(
_blockForWithdrawal <= MAX_BLOCK_FOR_WITHDRAWAL,
"Owner: Block for withdrawal must be lower than max block for withdrawal"
);
blockForWithdrawal = _blockForWithdrawal;
... | 13,927,782 |
/**
* Oracle - The Consumer Contract Wallet
* Copyright (C) 2019 The Contract Wallet Company Limited
*
* 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,... | Construct the oracle with multiple controllers, address resolver and custom gas price. _resolver_ is the address of the oraclize resolver _ens_ is the address of the ENS. _controllerNode_ is the ENS node corresponding to the Controller. _tokenWhitelistNode_ is the ENS corresponding to the Token Whitelist. Updates ... | bytes32 constant private _PREFIX_HASH = keccak256("{\"ETH\":");
bytes public cryptoCompareAPIPublicKey;
mapping(bytes32 => address) private _queryToToken;
constructor(address _resolver_, address _ens_, bytes32 _controllerNode_, bytes32 _tokenWhitelistNode_) ENSResolvable(_ens_) Controllable(_controlle... | 1,832,627 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openze... | Loan should be rejected when requested loan amount is less than fund amount because of some issues such as big fluctuation in marketplace | function approveLoan(
uint256 _loanId,
uint256 _amount,
address _agent
) external override onlyOwner nonReentrant {
Loan storage _loan = loans[_loanId];
require(_loan.status == Status.LISTED, "TribeOne: Invalid request");
require(_agent != address(0), "TribeOne: Z... | 1,488,358 |
./full_match/11155111/0x043d0c1a4fd26A4713BF1f53135C56fb35eF1274/sources/project_/contracts/MekeRouter02.sol | refund dust eth, if any | function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
virtual
override
payable
ensure(deadline)
returns (uint[] memory amounts)
{
require(path[0] == WETH, 'UniswapV2Router: INVALID_PATH');
amoun... | 3,798,102 |
./full_match/7700/0x9B2a63F27661A468E2da22226b64A4914144f195/sources/contracts/mixins/KnockoutCounter.sol | Call on the corresponding Merkle root when creating a new pivot at a tick/time tranche. / Knockout tranches are uniquely identified by block times. There is a rare corner case where multiple knockouts are created, crossed and created again at the same tick all within the same block/time. Warm up the slot so tha... | function freshenMerkle (KnockoutLiq.KnockoutMerkle storage merkle) private {
require(merkle.pivotTime_ != SafeCast.timeUint32(), "KT");
if(merkle.merkleRoot_ == 0) {
merkle.merkleRoot_ = 1;
}
}
| 4,651,205 |
./partial_match/1/0xdb1f111919455b3a8Fddb15fc066fFb46DE108F5/sources/Exchange.sol | Returns the nfts currently owned by this contract | function nftsOwned() external view returns (uint[] memory) {
return _tokenIds;
}
| 2,815,191 |
// SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-version
pragma solidity ^0.8.0;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contract can't have a constructor, it's common to move con... | Convert from 18 decimals to token defined decimals. | function convertFrom18(uint256 _amount) public view virtual returns (uint256) {
return _amount / decimalConversionFactor;
}
| 166,337 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.7.0;
import "./SafeMath.sol";
contract Permissioned {
using SafeMath for uint256;
// Whether or not the address has access to call the `contractAccess` modified functions
mapping(address => bool) _hasContractAccess;
// The address t... | Owner transfers ownership to new address | function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != owner, "ERROR: Already owner");
owner = newOwner;
emit OwnershipTransferred(msg.sender, newOwner);
}
| 12,710,852 |
./partial_match/56/0x6BC509924953c7c7A5D433BCc0B4A96b6C7d61a4/sources/CommonMaster.sol | Unstake LP tokens from TokenMaster. | function unstake(address _pair, uint256 _amount) external override {
PoolInfo storage pool = poolInfoMap[_pair];
UserInfo storage userInfo = poolUserInfoMap[_pair][msg.sender];
require(userInfo.amount >= _amount, 'withdraw: not good');
updatePool(_pair);
uint256 pending =
... | 11,114,475 |
./full_match/43114/0xF206f9ACBE69CA5d2166a36F22d5D8e10f2d836D/sources/CowBarn.sol | realize $avaMILK earnings for a single cow and optionally unstake it if not unstaking, pay a 20% tax to the staked Wolves if unstaking, there is a 50% chance all $avaWOOL is stolen tokenId the ID of the cow to claim earnings from unstake whether or not to unstake the cow return owed - the amount of $avaWOOL earned/ r... | function _claimCowFromBarn(uint256 tokenId, bool unstake)
internal
returns (uint256 owed)
{
Stake memory stake = barn[tokenId];
require(stake.owner == _msgSender(), "SWIPER, NO SWIPING");
require(
!(unstake && block.timestamp - stake.value < MINIMUM_TO_EXIT),... | 4,635,553 |
pragma solidity ^0.4.23;
import "./SNMMasterchain.sol";
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
contract SimpleGatekeeperWithLimitLive is Ownable {
using SafeMath for uint256;
SNMMasterchain token;
struct Keeper {
uint256 dayLimit;
uint256 lastDay;
uint256 ... | check that keeper is not frozen check that transaction is not paid check daylimit | function Payout(address _to, uint256 _value, uint256 _txNumber) public {
require(!keepers[msg.sender].frozen);
require(keepers[msg.sender].dayLimit > 0);
bytes32 txHash = keccak256(_to, _txNumber, _value);
require(!paid[txHash].paid);
if (paid[txHash].commitTS == 0) {
... | 5,427,963 |
./full_match/1/0x4599E4F3Eea04BADD41501bF79183e67f6Cf569d/sources/contracts/HighTableVaultETH.sol | @inheritdoc IHighTableVaultETH | function claimOwedAssetsETH(address payable _receiver) public override nonReentrant returns (uint256 assets) {
assets = _internalClaimOwedAssets(_receiver);
if (assets > 0) {
IWETH9(address(assetToken)).withdraw(assets);
Address.sendValue(_receiver, assets);
}
}
| 17,149,118 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.