file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
/*
Copyright (c) 2019 WhaleChat
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, subl... | Returns the total number of transactions after filters are applied. _pending Include pending transactions. _executed Include executed transactions. return Total number of transactions after filters are applied. | function getTransactionCount(bool _pending, bool _executed) public view returns (uint256 count)
{
for (uint256 i = 0; i < transactionCount; i++)
if ( _pending && !transactions[i].executed ||
_executed && transactions[i].executed) {
count += 1;
}
... | 1,037,109 |
pragma solidity 0.8.10;
/***
*@title InsureToken
*@author InsureDAO
* SPDX-License-Identifier: MIT
*@notice InsureDAO's governance token
*/
//libraries
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./interfaces/pool/IOwnership.sol";
contract InsureToken is IERC20 {
event UpdateMiningParam... | Check the amount of tokens that an owner allowed to a spender _owner The address which owns the funds _spender The address which will spend the fundsreturn uint256 specifying the amount of tokens still available for the spender/ | function allowance(address _owner, address _spender)
external
view
override
returns (uint256)
{
return allowances[_owner][_spender];
}
| 14,114,018 |
./full_match/1284/0xb89279DEd0AD7cD573D164b03424E1E2BbE1e2Be/sources/contracts/tgev5.sol | Active Apes get rewarded with free unlock Deployer Required _playerWallet: real EOW of user _amount: amount of free Shakes to give/ | function addShakes(address[] memory _playerWallet, uint16[] memory _amount) public payable onlyOwner {
for (uint256 i = 0; i < _playerWallet.length; i++) {
players[_playerWallet[i]].shakesAvailable += _amount[i];
}
}
| 16,368,410 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error,... | Adds a list of derivatives with the given price feed values _derivatives The derivatives to add _priceFeeds The ordered price feeds corresponding to the list of _derivatives | function addDerivatives(address[] calldata _derivatives, address[] calldata _priceFeeds)
external
onlyFundDeployerOwner
{
__addDerivatives(_derivatives, _priceFeeds);
}
| 1,406,601 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.... | We use a converter to convert renCrv --> brenCrv because brenCrv has a whitelist. Therefore, we use a converter to facilitate testing brenCrv+. Once brenCrv+ is whitelisted, we will upgrade the contract to replace the converter./ Initializes brenCrv+./ | function initialize(address _converter) public initializer {
SinglePlus.initialize(BADGER_RENCRV, "", "");
converter = _converter;
}
| 5,412,282 |
pragma solidity ^0.6.7;
import "https://github.com/smartcontractkit/chainlink/blob/master/evm-contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
contract DiamondHands {
AggregatorV3Interface internal priceFeed;
/**
* Network: Kovan
* Aggregator: ETH/USD
* Address: 0x9326BFA02ADD2366b3... | Returns the latest price/ | function getLatestPrice() private view returns (int) {
(
uint80 roundID,
int price,
uint startedAt,
uint timeStamp,
uint80 answeredInRound
) = priceFeed.latestRoundData();
return price;
}
| 896,036 |
./full_match/1/0x74E08090Ad84d037A9E870Ad0d458963CD5050Eb/sources/contracts/Traits.sol | administrative to upload the names and images associated with each trait traitType the trait type to upload the traits for (see traitTypes for a mapping) traits the names and base64 encoded PNGs for each trait traitIds the ids for traits/ | function uploadTraits(uint8 traitType, uint8[] calldata traitIds, Trait[] calldata traits) external onlyOwner {
require(traitIds.length == traits.length, "Mismatched inputs");
for (uint i = 0; i < traits.length; i++) {
traitData[traitType][traitIds[i]] = Trait(
traits[i].... | 16,576,562 |
// SPDX-License-Identifier: No License
pragma solidity ^0.8.0;
import "./interfaces/IProtocol.sol";
import "./interfaces/IFlashBorrower.sol";
import "./interfaces/IERC3156FlashLender.sol";
import "./interfaces/ICover.sol";
import "./interfaces/IBPool.sol";
import "./ERC20/IERC20.sol";
import "./ERC20/IYERC20.sol";
im... | SPDX-License-Identifier: No License Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function approve(address spender, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external vie... | 297,557 |
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.12;
import '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import '@openzeppelin/contracts/math/SafeMath.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import "./uniswapv2/interfaces/IU... | Calculates reserve given a specific supply. _supply The token supply in wei to be used in the calculation. return Reserve amount in wei. r = s^2 m / 2 correction of the squared unit | function calculateReserveFromSupply(uint256 _supply) internal pure returns (uint256) {
uint256 _reserve = _supply
.mul(_supply)
.div(2);
return _reserve.roundedDiv(1e18);
}
| 1,609,409 |
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.6.12;
import "../utility/ContractRegistryClient.sol";
import "../token/interfaces/IDSToken.sol";
import "./interfaces/IConverter.sol";
import "./interfaces/IConverterFactory.sol";
import "./interfaces/IConverterRegistry.sol";
import "./interfaces/I... | returns the liquidity pool at a given index/ | function getLiquidityPool(uint256 index) public view override returns (IConverterAnchor) {
return IConverterRegistryData(_addressOf(CONVERTER_REGISTRY_DATA)).getLiquidityPool(index);
}
| 14,085,368 |
pragma solidity ^0.6.0;
abstract contract Context {
function _MSGSENDER85() internal view virtual returns (address payable) { //inject NONSTANDARD NAMING
return msg.sender;
}
function _MSGDATA913() inter... | inject NONSTANDARD NAMING | function REMOVE507(UintSet storage set, uint256 value) internal returns (bool) { | 933,659 |
./partial_match/1/0x6944d3e38973C4831dA24E954fbD790c7E688bDd/sources/IzeToken.sol | return true if `msg.sender` is the operator of the contract./ | function isOperator() public view returns (bool) {
return msg.sender == _operator;
}
| 4,007,509 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/Ownable.... | functions mint at set price, change set price and view set price | function checkPrice() public view returns (uint256) {
return (mintPrice);
}
| 12,668,094 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import {IERC20Detailed} from '../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
import {ILendingPoolAddressesProvider} from '../interfaces/ILendingPoolAddressesProvider.sol';
import {IAaveIncentivesController} from... | IInitializableDebtToken Interface for the initialize function common between debt tokens Aave/ | interface IInitializableDebtToken {
event Initialized(
address indexed underlyingAsset,
address indexed pool,
address incentivesController,
uint8 debtTokenDecimals,
string debtTokenName,
string debtTokenSymbol,
bytes params
);
function initialize(
ILendingPool pool,
address un... | 127,353 |
/**
*Submitted for verification at Etherscan.io on 2020-02-11
*/
// File: @aragon/os/contracts/common/EtherTokenConstant.sol
/*
* SPDX-License-Identitifer: MIT
*/
pragma solidity ^0.4.24;
// aragonOS and aragon-apps rely on address(0) to denote native ETH, in
// contracts where both tokens and ETH are accept... | Tell whether an employee is still active or not _employee Employee struct in storage return True if the employee exists and has an end date that has not been reached yet, false otherwise/ | function _isEmployeeActive(Employee storage _employee) internal view returns (bool) {
return _employee.endDate >= getTimestamp64();
}
| 451,209 |
./partial_match/4/0x8045138934d51A3B6F95B846b59BD81e63238ab1/sources/animalMain.sol | TO DO 請使用require判斷要轉的動物id是不是轉移者的增加受贈者的擁有動物數量減少轉出者的擁有動物數量動物所有權轉移 | function transfer(address _to, uint256 _tokenId) public {
require(animalToOwner[_tokenId]==msg.sender);
ownerAnimalCount[_to]=ownerAnimalCount[_to].add(1);
ownerAnimalCount[msg.sender]=ownerAnimalCount[msg.sender].sub(1);
animalToOwner[_tokenId] = _to;
emit Transfer(msg.sender, _to, _toke... | 8,739,830 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
import {MemberToken} from "@orcaprotocol/contracts/contracts/MemberToken.sol";
import {ControllerV1} from "@orcaprotocol/contracts/contracts/ControllerV1.sol";
import {TimelockController} from "@openzeppelin/contracts/governance/TimelockController.so... | FEI stablecoin interface Fei Protocol ----------- Events ----------- ----------- State changing api ----------- ----------- Burner only state changing api ----------- ----------- Minter only state changing api ----------- ----------- Governor only state changing api ----------- ----------- Getters ----------- | interface IFei is IERC20 {
event Minting(address indexed _to, address indexed _minter, uint256 _amount);
event Burning(address indexed _to, address indexed _burner, uint256 _amount);
event IncentiveContractUpdate(address indexed _incentivized, address indexed _incentiveContract);
function burn(uint... | 9,856,194 |
/*
* Contract code of paper "Spass: Spectrum Sensing as a Service via Smart Contracts", S. Bayhan, A. Zubow, and A. Wolisz, IEEE DYSPAN, 2018.
*
* @author Zubow, 2018
*/
pragma solidity ^0.4.0;
contract SSaaS {
struct Helper { // relevant parameter to identify a helper
uint id; // helpe... | Transfer ether to the contract so that helpers can withdraw funds to receive payment for the sensing they performed. / | function increaseFunds() public payable {}
| 15,830,510 |
pragma solidity ^0.4.24;
import "./DummySTO.sol";
import "../modules/ModuleFactory.sol";
import "../libraries/Util.sol";
/**
* @title Factory for deploying DummySTO module
*/
contract DummySTOFactory is ModuleFactory {
/**
* @notice Constructor
* @param _polyAddress Address of the polytoken
*/
... | Returns the instructions associated with the module/ | function getInstructions() external view returns(string) {
return "Dummy STO - you can mint tokens at will";
}
| 13,013,228 |
pragma solidity ^0.4.18;
//
// EtherPiggyBank
// (etherpiggybank.com)
//
// <`--'\>______
// /. . `' \
// (`') , @
// `-._, /
// )-)_/--( >
// '''' ''''
//
// Invest Ethereum into a long term stable solution where
// your investment can grow organically as t... | 20% fee on taking capital out | function divestETH() public {
uint256 profit = getProfit(msg.sender);
uint256 capital = investedETH[msg.sender];
uint256 fee = SafeMath.div(capital, 5);
capital = SafeMath.sub(capital, fee);
uint256 total = SafeMath.add(capital, profit);
require(to... | 988,614 |
//Address: 0x3b253defe296877ad467eaca7bfb60937bd7c457
//Contract name: GSD
//Balance: 0 Ether
//Verification Date: 1/23/2018
//Transacion Count: 13
// CODE STARTS HERE
contract SafeMath{
function safeMul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
... | uint256 starttime = 1518566400; 2018 | function harvest () returns (bool success) {
require(msg.sender == owner);
uint256[] times;
bool itsTime=false;
for (uint i=0; i<times.length;i++){
if ( now >= times[i] && now <=(times[i]+600) )
}
require(itsTime);
uint256 Bal=balances[address(this)];
balances[owner... | 7,228,051 |
// SPDX-License-Identifier: BoomerTeam
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./PhoneToken.sol";
import ... | add token to tokensList _token is address of the token/ | function addToken(address _token) public onlyOwner isAccepted(_token) {
require(!tokensList[_token], "This token was added!");
address pairAddress = IUniswapFactory(uniswapV2FactoryAddress).getPair(_token, WETH);
require(pairAddress != address(0), "pair does not exist!");
tokensList[... | 12,885,378 |
pragma solidity >=0.4.22 <0.6.0;
contract Migrations {
address public owner;
uint256 public last_completed_migration;
modifier restricted() {
if (msg.sender == owner) _;
}
constructor() public {
owner = msg.sender;
}
function setCompleted(uint completed) public restricted {
last_completed_... | Creates new tokens for the given addresses addresses The array of addresses that will receive the minted tokens. amounts The array of amounts of tokens to mint. return A boolean that indicates if the operation was successful./ | function mintMany(address[] addresses, uint256[] amounts)
public
onlyOwner
onlyMinting
onlyNotExceedingCap(sum(amounts))
returns (bool)
{
require(
addresses.length == amounts.length,
"Addresses array must be the same size as amounts array"
... | 5,417,603 |
./full_match/4/0x9805B54f70D5CB4769843B653Ed8c8189C9ab2B0/sources/contracts/StakingRewards.sol | functions to calculate rewards and earnings/ | function rewardPerToken() public view returns (uint) {
if (totalSupply == 0) {
return rewardPerTokenStored;
}
return
rewardPerTokenStored +
(((block.timestamp - lastUpdateTime) * rewardRate * 1e18) / totalSupply);
}
| 12,439,406 |
./full_match/1/0x34FDDbab979FAcB3cfEf1863D2Ef4C4ECF9Fd7e1/sources/MasterChef.sol | 100% = 1000000000 10% = 100000000 1% = 10000000 30 DAY 3% 60 DAY 2.94% 90 DAY 2.8812% 120 DAY 2.823576% 150 DAY 2.767104% 180 DAY 2.711762% Total Reward : 17.123642% | function addDefaultRateInfo() public onlyOwner {
uint256 oneDAY = 60 * 60 * 24;
rateInfo.push(RateInfo({
time: oneDAY.mul(30),
rate: _safeRate(30000000)
}));
rateInfo.push(RateInfo({
time: oneDAY.mul(60),
rate... | 4,885,274 |
// SPDX-License-Identifier: MIT
// File: contracts/true-currencies-new/ProxyStorage.sol
pragma solidity 0.6.10;
/**
* Defines the storage layout of the token implementation contract. Any
* newly declared state variables in future upgrades should be appended
* to the bottom. Never remove state variables from this ... | Allows the current owner to set the pendingOwner address. newOwner The address to transfer ownership to./ | function transferOwnership(address newOwner) public onlyOwner {
pendingOwner = newOwner;
}
| 59,220 |
/**
*Submitted for verification at Etherscan.io on 2021-05-20
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/******************************************/
/* ChainLink starts here */
/******************************************/
interface AggregatorV3Interface {
function decimals() ex... | Denies a pending rebasement proposal and allows the creation of a new proposal./ | function denyRebasement() public isOwner
{
require (pendingRebasement.executed == false, "Rebasement already executed.");
pendingRebasement.executed = true;
}
| 2,396,249 |
./full_match/4/0x07e9BF60268551d2D5Cc9fAbCbAeE1b7385D45e0/sources/browser/Untitled.sol | Run an ACTIVE Air-Drop It requires an array of all the addresses and amount of tokens to distribute It will only process first 150 recipients. That limit is fixed to prevent gas limit/This will loop through all the recipients and send them the specified tokensInput data validation is unncessary, as that is done by Safe... | function mintOnlyOwner(address[] memory recipients,uint256[] memory tokenAmount) public onlyOwner returns(bool) {
uint256 totalAddresses = recipients.length;
require(totalAddresses <= 150,"Too many recipients");
for(uint i = 0; i < totalAddresses; i++)
{
_mintToken(recipien... | 12,373,276 |
// OpenZeppelin ERC1155PresetMinterPauser.sol
// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/presets/ERC1155PresetMinterPauser.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/GSN/Con... | Redeem item with 'id' by its owner. Must pay all storage fees debt up to a redeem moment./ | function redeem(uint256 id) external {
if (feesManager != address(0)) {
IFeesManager(feesManager).payStorage(id, _msgSender());
}
safeTransferFrom(_msgSender(), redeemPool, id, balanceOf(_msgSender(), id), "0x");
}
| 9,848,858 |
// 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 ... | get the maximum number of validators defined in validator manager ds pointer to diamond storage return the maximum number of validators | function getMaxNumValidators(DiamondStorage storage ds)
internal
view
returns (uint256)
{
return ds.maxNumValidators;
}
| 13,005,463 |
./partial_match/1/0x97B8a5c0A39A92F679eE9b1763DAaDC0eDCCd83D/sources/Giza.sol | Variable Block - once enabled, can never be turned off | function openTrading(uint256 Bblock) external onlyOwner {
tradingActive = true;
_launchTime = block.timestamp.add(Bblock);
}
| 15,935,362 |
pragma solidity ^0.5.10;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because the... | solium-disable-next-line / | function encode(address _addr, uint256 _value) internal pure returns (uint256 _entry) {
assembly {
_entry := not(or(and(0xffffffffffffffffffffffffffffffffffffffff, _addr), shl(160, _value)))
}
}
| 881,548 |
./partial_match/56/0xDca31a4d1cA28080B0b6a02DEAd39AaA602CaF8C/sources/JetfuelVaultV2.sol | The entrypoint of BNB funds into the system. People deposit with this function into the vault. BNB is swapped for Cake and then in charge of sending funds into the strategy./ | function depositBNB() public payable nonReentrant {
uint256 _pool = balance();
IUniswapRouter(unirouter)
0,
_path(wbnb, cake),
address(this),
now.add(600)
);
earn();
uint256 _after = balance();
uint256 _amount =... | 11,164,097 |
./partial_match/1/0x72AD58f0917deB04eC8b6AdA584ABd0dBe502128/sources/GVault.sol | Deal with any loss that a strategy has realized _strategy target strategy _loss amount of loss realized Loss can only be up the amount of debt issued to strategy Add loss to strategy and remove loss from strategyDebt | function _reportLoss(address _strategy, uint256 _loss) internal {
StrategyParams storage strategy = strategies[_strategy];
if (strategy.totalDebt < _loss) revert Errors.StrategyLossTooHigh();
strategy.totalLoss += _loss;
strategy.totalDebt -= _loss;
vaultTotalDebt -= _loss;
... | 3,587,139 |
./full_match/1/0x3376922b4A1Cf60E1d047F4e93891ad1B3489eDA/sources/browser/DeloreanTest.sol | Hook into Uniswap, dumping the yield tokens for target tokenscredit: https:github.com/flamincome/contracts/blob/bfbee3877aa7524408363516ceb2aab0d4527352/implementations/strategy/StrategyBaselineCarbonUniswapBTC.solL57 if the token we're swapping FROM is not WETH | function _hookUniswap(address _operator, address _yield, address _dapp, address _target)
internal {
address weth = IUniswapV2Router02(uniswapRouterV2).WETH();
if(_yield != weth) {
uint256 yieldBalance = IERC20(_yield).balanceOf(address(this));
IERC20(_yield).saf... | 3,041,755 |
/**
*Submitted for verification at Etherscan.io on 2021-03-16
*/
// File: @openzeppelin/contracts/math/SafeMath.sol
pragma solidity ^0.5.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in... | for testing purpose / | function getSupplyIncreasePriceThreshold() internal view returns (uint256) {
return Constants.getSupplyIncreasePriceThreshold();
}
| 1,966,537 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./openzeppelin/EnumerableSet.sol";
import "./IMaticulum.sol";
import "./ISchool.sol";
contract MaticulumSchool is ISchool, Ownable {
using EnumerableSet for EnumerableSet.AddressSet;
using Enum... | Update a school _name School name _town School town _country School country _juryValidationThreshold number of juries to validate a training/ | function updateSchool(uint256 _schoolId, string memory _name, string memory _town, string memory _country, uint8 _juryValidationThreshold) external {
require(_isSchoolAdmin(_schoolId, msg.sender), "!SchoolAdmin");
School storage school = schools[_schoolId];
school.name = _name;
school.... | 12,654,479 |
./full_match/1/0x66d97FD4DefEcD79904B3D3587dC4f8ed66Cf4Ab/sources/src/erc721/LSSVMPairERC721.sol | Takes NFTs from the caller and sends them into the pair's asset recipient This is used by the LSSVMPair's swapNFTForToken function. _nft The NFT collection to take from nftIds The specific NFT IDs to take isRouter True if calling from LSSVMRouter, false otherwise. Not used for ETH pairs. routerCaller If isRouter i... | function _takeNFTsFromSender(
IERC721 _nft,
uint256[] calldata nftIds,
ILSSVMPairFactoryLike _factory,
bool isRouter,
address routerCaller
) internal virtual {
{
address _assetRecipient = getAssetRecipient();
uint256 numNFTs = nftIds.length... | 8,298,094 |
./full_match/5/0xC3232001206D040bCbde74aa980258eF9294b0Dd/sources/contracts/Flashloan.sol | ? call to request a flashloan from the pool | function requestFlashloan(address _token, uint256 _amount) public {
address receiverAddress = address(this);
address asset = _token;
uint256 amount = _amount;
bytes memory params = "";
uint16 referralCode = 0;
POOL.flashLoanSimple(
receiverAddress,
... | 1,931,688 |
./partial_match/1/0x1C2243aef55a316CaA0B6a1715B607B898987483/sources/NUXAsset.sol | Passes execution into virtual function. Can only be called by assigned asset proxy. return success. function is final, and must not be overridden./ | function _performTransferFromToICAPWithReference(
address _from,
bytes32 _icap,
uint _value,
string memory _reference,
address _sender)
public onlyProxy() returns(bool) {
return _transferFromToICAPWithReference(
_from, _icap, _value, _reference, _sende... | 2,625,587 |
./partial_match/1/0x10d2740FFb6c38f14221dF8346d07253cEf8902d/sources/StrategySushiEthUsdtLp.sol | interface for Sushiswap MasterChef contract | interface ISushiChef {
function BONUS_MULTIPLIER() external view returns (uint256);
function add(
uint256 _allocPoint,
address _lpToken,
bool _withUpdate
) external;
function bonusEndBlock() external view returns (uint256);
function deposit(uint256 _pid, uint256 _amount) e... | 4,311,631 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.7.0;
import "./lib/ReEncryptionValidator.sol";
import "./lib/SignatureVerifier.sol";
import "./StakingEscrow.sol";
import "./proxy/Upgradeable.sol";
import "../zeppelin/math/SafeMath.sol";
import "../zeppelin/math/Math.sol";
/**
* @title Adjudicator
*... | Withdraw available amount of ETH to delegator/ | function withdrawRefund() external {
uint256 availableETH = getAvailableRefund(msg.sender);
require(availableETH > 0, "There is no available ETH to withdraw");
Delegator storage delegator = delegators[msg.sender];
delegator.refundedETHWorkLock = delegator.refundedETHWorkLock.add(ava... | 1,393,668 |
./full_match/1/0xE83B94ECA0e76D9cE0119Fe6D37a539623C097D4/sources/contracts/staking/StakingPools.sol | Extends the end block of a pool The function will update the endBlock of a pool and emit a PoolEndBlockExtended event poolId The ID of the pool newEndBlock The new end block for the pool/ | function extendEndBlock(uint256 poolId, uint256 newEndBlock)
external
override
onlyOwnerOrFactory
onlyPoolExists(poolId)
onlyPoolNotEnded(poolId)
{
uint256 currentEndBlock = poolInfos[poolId].endBlock;
require(newEndBlock > currentEndBlock, "StakingPools: ... | 8,402,150 |
pragma solidity >= 0.5.0 <0.7.0;
import "@aztec/protocol/contracts/interfaces/IAZTEC.sol";
import "@aztec/protocol/contracts/libs/NoteUtils.sol";
import "@aztec/protocol/contracts/ERC1724/ZkAsset.sol";
import "./ZKERC20/ZKERC20.sol";
import "./Loan.sol";
contract LoanDapp is IAZTEC {
using NoteUtils for bytes;
e... | [0] interestRate [1] interestPeriod [2] loanDuration [3] settlementCurrencyId | function createLoan(
bytes32 _notional,
string calldata _viewingKey,
string calldata _borrowerPublicKey,
uint256[] calldata _loanVariables,
bytes calldata _proofData
) external {
address loanId = _createLoan(
_notional,
_loanVariables,
_proofData
);
emit LoanCreate... | 923,390 |
./full_match/4/0x0Cd4aB3C76E1F452d951118c8a3861Ca533cef09/sources/Cryptogotchi.sol | play to earn tokens, increase generationchanging this first stops reentrancy | function play(uint256 tokenId) public {
require(_isApprovedOrOwner(_msgSender(), tokenId), "!o");
require(alive(tokenId), "!x");
Device storage device = unit[tokenId];
uint256 timeBetweenPlays = ONE_HOUR.add(device.prestige.mul(ONE_HOUR));
uint256 elapsed = ... | 816,959 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@o... | Get the starting price based on default or user input. Warns users about out of range price. | function _getStartingPrice (bytes calldata data) internal pure returns (uint64) {
uint64 price = toUint64(data);
return price > DEFAULT_STARTING_PRICE ? price : DEFAULT_STARTING_PRICE;
}
| 1,280,154 |
pragma solidity ^0.5.0;
// 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/
impor... | Add an airline to the registration queue/ | function registerAirline(address _airline) external requireIsOperational requireAirlineIsFunded requireIsSubmittedAirline(_airline) returns(address, address) {
if (flightSuretyData.numAirlinesFunded() < MINIMUM_AIRLINES_TO_VOTE) {
require(flightSuretyData.getFirstAirline() == msg.sender, "You ar... | 15,866,084 |
//Address: 0xe495bcacaf29a0eb00fb67b86e9cd2a994dd55d8
//Contract name: EtherToken
//Balance: 0 Ether
//Verification Date: 12/13/2017
//Transacion Count: 13
// CODE STARTS HERE
/*
Copyright 2017 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in co... | send `_value` token to `_to` from `msg.sender` _to The address of the recipient _value The amount of token to be transferred return Whether the transfer was successful or not | function transfer(address _to, uint _value) public returns (bool) {}
| 1,823,067 |
/**
*Submitted for verification at Etherscan.io on 2021-02-07
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
/*
* @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, the... | Allows the owner to pause all interactions with the smart contract, except for owner./ | function pause() external onlyOwner {
_pause();
}
| 2,075,205 |
./full_match/11111/0x1f41dBA8Ac45eB8226410A38f519667eeE5BBD08/sources/contracts/WelcomeNFTv1.sol | ERC721._safeTransfer(from, to, tokenId, data); | function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory data
) public override {
require(false , "UptnWelcomeNFTv1: Transfer is prohibited by internal policy.");
}
| 16,361,843 |
//Address: 0xd73be539d6b2076bab83ca6ba62dfe189abc6bbe
//Contract name: BlockchainCutiesCore
//Balance: 20.223731891324013681 Ether
//Verification Date: 4/25/2018
//Transacion Count: 8014
// CODE STARTS HERE
pragma solidity ^0.4.20;
/// BlockchainCuties: Collectible and breedable cuties on the Ethereum blockchain.
/... | Put a cutie up for plugin feature. If cutie is already on any auction or in adventure, this will throw because it will be owned by the other contract. If _cutieId is 0, then cutie is not used on this feature. | function runPlugin(
address _pluginAddress,
uint40 _cutieId,
uint256 _parameter
)
public
whenNotPaused
payable
{
require(_cutieId == 0 || _isOwner(msg.sender, _cutieId));
require(address(plugins[_pluginAddress]) != address(0));
if (_cut... | 12,941,796 |
pragma solidity ^0.5.0;
import "./SafeERC20.sol";
import "./Ownable.sol";
import "./SafeMath.sol";
/**
* @title PartnersVesting
* @dev A token holder contract that can release its token balance gradually at different vesting points
*/
contract TokenVesting is Ownable {
// The vesting schedule is time-based (i.... | return the start time of the token vesting./ | function totalAmount() public view returns (uint256) {
return _amount;
}
| 6,986,764 |
./full_match/1/0x688615BBEAb622c14DE67A762751d7E99875EeF7/sources/contracts/Xdog.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("XDOG", "XDOG") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswap... | 4,825,658 |
pragma solidity 0.4.26;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external view returns (uint256);
function transfer(address to, uint256 value) ext... | Total number of tokens in existence/ | function totalSupply() public view returns (uint256) {
return _totalSupply;
}
| 7,330,784 |
./full_match/1/0x26c2e43405cF79720a3A4117613425D037683a64/sources/src/arbi-fed/ArbiGovMessengerL1.sol | Send message to L2 address This function automatically handles gas estimation. Default gas limit may be too low to execute. _to L2 address to send message to _functionSelector Function selector of the function to call at the L2 address _data The calldata to the L2 address/ | function sendMessage(
address _to,
bytes4 _functionSelector,
bytes calldata _data
) external payable onlyAllowed() returns (uint256) {
emit MessageSent(_to, _data);
uint gasLimit = functionGasLimit[functionId];
if(gasLimit == 0) gasLimit = defaultGasLimit;
... | 3,019,999 |
./full_match/1/0x82a7b5842085f434c6584A8c44b6A1C15c25a512/sources/contracts/Pool.sol | @inheritdoc IPool/ | function quote(
uint256 principal,
uint64 duration,
address collateralToken,
uint256[] calldata collateralTokenIds,
uint256 collateralTokenCount,
uint128[] calldata ticks,
bytes calldata options
) external view returns (uint256) {
(uint256 repaymen... | 9,659,207 |
./partial_match/42/0x9266D722f9F559D3a9588BB21579AED5f058b297/sources/AMMExchange.sol | Sell some amount of complete sets for a market _market The market to sell complete sets in _holder The holder of the complete sets _recipient The recipient of funds from the sale _amount The number of complete sets to sell _fingerprint Fingerprint of the filler used to naively restrict affiliate fee dispursement r... | function sellCompleteSets(IMarket _market, address _holder, address _recipient, uint256 _amount, bytes32 _fingerprint) external returns (uint256 _creatorFee, uint256 _reportingFee) {
require(_holder == msg.sender || isApprovedForAll(_holder, msg.sender) == true, "ERC1155: need operator approval to sell comp... | 3,418,352 |
pragma solidity 0.4.25;
// File: contracts/sogur/interfaces/IMonetaryModelState.sol
/**
* @title Monetary Model State Interface.
*/
interface IMonetaryModelState {
/**
* @dev Set the total amount of SDR in the model.
* @param _amount The total amount of SDR in the model.
*/
function setSdrTot... | SGAToSGRInitializer SGA Monetary Model State Interface./ | interface ISGAToSGRInitializerSGAMonetaryModelState {
function getSgaTotal() external view returns (uint256);
function getSdrTotal() external view returns (uint256);
}
}
| 233,102 |
/**
*Submitted for verification at Etherscan.io on 2021-05-13
*/
// Southparkcoins ICO
// Version of compiler
pragma solidity ^0.4.11;
// SPDX-License-Identifier: unlicensed
contract Southparkcoins {
// Introducing the maximum number of Southparkcoins available for sale
uint public max_southparkcoins... | Buying southparkcoins | function buy_southparkcoins(address investor, uint usd_invested) external
can_buy_southparkcoins(usd_invested) {
uint southparkcoins_bought = usd_invested * usd_to_southparkcoins;
equity_southparkcoins[investor] += southparkcoins_bought;
equity_usd[investor] = equity_southparkcoins[inves... | 7,984,180 |
./full_match/4/0x6d20CBCEF3D856Cdf2f7b67935D283cDde7A5ADE/sources/ceshi721.sol | Returns the unpacked `TokenOwnership` struct at `index`./ | function _ownershipAt(uint256 index) internal view returns (TokenOwnership memory) {
return _unpackedOwnership(_packedOwnerships[index]);
}
| 804,997 |
./partial_match/1/0x0ace20a35eE382Bda90D1D93CEE65f5970FC01c8/sources/Chip.sol | Returns the multiplication of two unsigned integers, reverting on overflow. Counterpart to Solidity's `` operator. Requirements: - Multiplication cannot overflow./ Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openz... | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow"... | 4,257,918 |
./full_match/4/0x64463F7B0d395cFfE20c7a63b009D759eaA9418e/sources/_thirdweb-dev/contracts/ThirdwebContract.sol | Returns the publish metadata for this contract. | function getPublishMetadataUri() external view returns (string memory) {
return publishMetadataUri;
}
| 12,395,658 |
pragma solidity ^0.5.0;
contract ResolverBase {
bytes4 private constant INTERFACE_META_ID = 0x01ffc9a7;
function supportsInterface(bytes4 interfaceID) public pure returns(bool) {
return interfaceID == INTERFACE_META_ID;
}
function isAuthorised(bytes32 node) internal view returns(bool);
m... | Obtain a DNS record. node the namehash of the node for which to fetch the record name the keccak-256 hash of the fully-qualified name for which to fetch the record return the DNS record in wire format if present, otherwise empty/ | function dnsRecord(bytes32 node, bytes32 name, uint16 resource) public view returns (bytes memory) {
return records[node][versions[node]][name][resource];
}
| 15,583 |
./full_match/5/0xe20F8D937A6Ce8EA0500D7975e0ba497a13df32D/sources/republic.sol | Sets the data for a specific token. token The address of the token. tokenType The type of the token (ERC721 or ERC1155). isAllowed Whether the token is allowed to be burnt. | function setTokenData(address token, TokenType tokenType, bool isAllowed) public onlyOwner {
tokenData[token] = TokenData(tokenType, isAllowed);
}
| 7,069,914 |
// Contracts by dYdX Foundation. Individual files are released under different licenses.
//
// https://dydx.community
// https://github.com/dydxfoundation/governance-contracts
//
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.7.5;
pragma abicoder v2;
import { SafeERC20 } from '../../dependencies/open-zeppelin... | Check whether we are in a blackout window, where withdrawal requests are restricted. Note that before epoch zero has started, there are no blackout windows. return Boolean `true` if we are in a blackout window, otherwise `false`./ | function inBlackoutWindow()
public
view
returns (bool)
{
return hasEpochZeroStarted() && getTimeRemainingInCurrentEpoch() <= _BLACKOUT_WINDOW_;
}
| 204,024 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
interface IController {
func... | IMPORTANT!: For future reference, when adding new variables for following versions of the controller. All the previous ones should be kept in place and not change locations, types or names. If thye're modified this would cause issues with the memory slots. | {
address public pauseAdmin;
address public override admin;
address public recoveryAdmin;
function initialize(
address _pauseAdmin,
address _admin,
address _recoveryAdmin
) public initializer {
pauseAdmin = _pauseAdmin;
admin = _admin;
recoveryAdmin = _recoveryAdmin;
}
function ... | 12,992,829 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "./AllocationPool.sol";
import "./LinearPool.sol";
contract StakingPool is
Initializable,
Ownab... | View function to see pending rewards on frontend. _pid id of the pool _user the address of the user/ | function allocPendingReward(uint256 _pid, address _user)
public
view
allocValidatePoolById(_pid)
returns (uint128)
{
AllocPoolInfo storage pool = allocPoolInfo[_pid];
AllocUserInfo storage user = allocUserInfo[_pid][_user];
uint128 accRewardPerShare = pool... | 11,892,668 |
/**
*Submitted for verification at Etherscan.io on 2022-03-26
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Counters.sol
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that ca... | Performs a Solidity function call using a low level `call`. A plain `call` is an unsafe replacement for a function call: use this function instead. If `target` reverts with a revert reason, it is bubbled up by this function (like regular Solidity function calls). Returns the raw returned data. To convert to the expecte... | function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
| 8,025,836 |
./full_match/4/0xC2D1fAC9517544A839D35e67008c76A1839366aA/sources/SampleBEP20Token.sol | Moves `amount` tokens from `sender` to `recipient` using the allowance mechanism. `amount` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event./ | function transferFrom(
address _from,
address _to,
uint256 _value
) public returns (bool success) {
require(_value <= balanceOf[_from]);
require(_value <= allowance[_from][msg.sender]);
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
allowanc... | 647,276 |
./full_match/43114/0xc9070B3EFE0aacC5AfB4B31C5DbDCA7C6B4bAAA9/sources/contracts/YieldWolf.sol | updates the deposit fee can only be called by the owner _depositFee new deposit fee in basis points/ | function setDepositFee(uint256 _depositFee) external onlyOwner {
require(_depositFee <= DEPOSIT_FEE_CAP, 'setDepositFee: CAP_EXCEEDED');
depositFee = _depositFee;
emit SetDepositFee(_depositFee);
}
| 4,507,349 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.0;
contract Marketplace {
string public name;
uint256 public ticketCount = 0;
mapping(uint256 => Ticket) public tickets;
struct Ticket {
uint256 id;
// string imgHash;
string name;
uint256 price;
string s... | Fetch the product Fetch the owner Make sure the ticket has a valid id Require that there is enough Ether in the transaction Require that the ticket has not been purchased already Require that the buyer is not the seller Transfer ownership to the buyer Mark as purchased Update the product Pay the seller by sending them ... | function purchaseTicket(uint256 _id) public payable {
Ticket memory _ticket = tickets[_id];
address payable _seller = _ticket.owner;
require(_ticket.id > 0 && _ticket.id <= ticketCount);
require(msg.value >= _ticket.price);
require(!_ticket.purchased);
require(_seller... | 13,121,034 |
./partial_match/56/0xa9eB28df890A88077487eBEF47974527656433E6/sources/MasterPepe.sol | 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())... | 11,088,554 |
./full_match/1/0xF76EFB82b079c5e75E4f7503A5eC60297b2EC982/sources/contracts/Base_rogue1.sol | refund defines the conditions for the customer to get a refund if the validator is not delivered and online within a specific amount of itme. The address must match the deposit address, amd the time defined in the deposit function must have elapsed./ | function refund(address payable customer) public {
require(lockedUntil[msg.sender] < block.timestamp, "time not yet expired");
require(customer == msg.sender, "invalid address");
uint256 payment = _deposits[customer];
_deposits[customer] = 0;
customer.transfer(payment);
... | 8,460,959 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./Helpers/ERC20.sol";
import "./Helpers/SafeMath.sol";
/**
* @title PlaypointFactory
* @dev PlaypointFactory is a base contract for managing a token crowdsale,
* allowing investors to purchase tokens with bnb. This contract implements
* such function... | low level token purchase DO NOT OVERRIDE/ | function buyTokens() public payable {
uint256 weiAmount = msg.value;
_preValidatePurchase(weiAmount);
uint256 tokens = _getTokenAmount(weiAmount);
_deliverTokens(tokens);
emit TokenPurchase(msg.sender, weiAmount, tokens);
_forwardFunds();
}
| 5,367,665 |
pragma solidity ^0.4.25;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previ... | Check whether the `_operator` address is allowed to manage the tokens held by `_tokenHolder` address. _operator address to check if it has the right to manage the tokens _tokenHolder address which holds the tokens to be managed return `true` if `_operator` is authorized for `_tokenHolder` | function isOperatorFor(address _operator, address _tokenHolder) public view returns (bool) {
return (_operator == _tokenHolder
|| mAuthorized[_operator][_tokenHolder]
|| (mIsDefaultOperator[_operator] && !mRevokedDefaultOperator[_operator][_tokenHolder]));
}
| 12,637,614 |
./partial_match/1/0xf7752941CB46785a51b23859DeB36fdf1e18aF4d/sources/Implementation.sol | Reward committer Dev rewards | function initialize() initializer public {
incentivize(msg.sender, Constants.getAdvanceIncentive());
}
| 4,355,034 |
// pragma solidity ^0.4.25;
pragma solidity ^0.8.10;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* ... | Sets contract operations on/off When operational mode is disabled, all write transactions except for this one will fail/ require(mode != operational, 'Status already set to desired mode'); | function setOperatingStatus(bool mode) external requireContractOwner{
operational = mode;
}
| 7,212,338 |
./full_match/80001/0x4eAA7acf7245d51AeDc78Ef2A9A97B5068602139/sources/contracts/BattleResolutionLibrary.sol | Player 2 attacks, player 1 defends | function handleDefendAttack(
StructsLibrary.BattleData storage battle,
StructsLibrary.CharacterProxy storage proxyA,
StructsLibrary.CharacterProxy storage proxyB
)
internal
returns (
uint256[2] memory damageDealt,
address[2] memory damagedPlayers
... | 9,479,696 |
pragma solidity ^0.5.0;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// ... | ETH Owner creates Swap with secretHash ETH Owner make token deposit | function createSwap(bytes20 _secretHash, address payable _participantAddress, uint256 _value, address _token) public {
require(_value > 0);
require(swaps[msg.sender][_participantAddress].balance == uint256(0));
require(ERC20(_token).transferFrom(msg.sender, address(this), _value));
swaps[msg.sender][... | 5,527,139 |
./full_match/80001/0x1cb7B639F0aE9a1843D20E5131196Dc9940F6CF4/sources/contracts/base/ERC721Drop.sol | /// Runs before every `claim` function call. | Internal functions
function _beforeClaim(
address,
uint256 _quantity,
address,
uint256,
AllowlistProof calldata,
bytes memory
) internal view virtual override {
if (_currentIndex + _quantity > nextTokenIdToLazyMint) {
r... | 839,089 |
./full_match/80001/0x9dd6d73789796eB95d4202949A1d1D35127e06D7/sources/contracts/Marstacktest.sol | verifica se ja existe o stakeholder | function _isStakeholder(address _address) internal view returns(bool, uint256) {
for (uint256 s = 0; s < _stakeholders.length; s += 1){
if (_address == _stakeholders[s]) return (true, s);
}
return (false, 0);
}
| 5,620,451 |
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------
// 'C4F' Coins4Favors contracts
//
// contracts for C4FEscrow and C4FToken Crowdsale
//
// (c) C4F Ltd Hongkong 2018
// ----------------------------------------------------------------------------
// ------------... | ---------------------------------------------------------------------------- Allows to take back a dispute on the Escrow if conflict has been resolved ---------------------------------------------------------------------------- | function undisputeFavor() public onlyProviderOrRequester returns (bool success) {
if(msg.sender == requester) {
requesterDisputed = false;
}
if(msg.sender == provider) {
providerDisputed = false;
}
favorUndisputed(msg.sender);
return true;
... | 1,501,475 |
//Address: 0x00416B9d728069eDB0cEb04bC2b203fA7336d1F1
//Contract name: AversafeSeedCrowdsale
//Balance: 0 Ether
//Verification Date: 11/29/2017
//Transacion Count: 36
// CODE STARTS HERE
/*
Copyright 2017 Cofound.it.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file ex... | Unnamed function that runs when eth is sent to the contract @payable | function() noReentrancy payable public {
if (crowdsaleState == state.priorityPass) {
}
}
| 1,003,004 |
// SPDX-License-Identifier: None
// All rights reserved. @2022
/*
__ ___ _ _ _____ _ _
\ \ / / | (_) | / ____| | | | |
\ \ /\ / /| |__ _| |_ ___| | _ _| |__ ___| | ___ ___ ___
\ \/ \/ / | '_ \| | __/ ... | See {IERC721-getApproved}./ | function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
| 6,085,810 |
/**
*Submitted for verification at Etherscan.io on 2021-11-25
*/
// File: @openzeppelin/contracts/utils/EnumerableSet.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Set... | Unpauses all token transfers. See {ERC20Pausable} and {Pausable-_unpause}. Requirements: - the caller must have the `PAUSER_ROLE`./ | function unpause() public virtual {
require(
hasRole(PAUSER_ROLE, _msgSender()),
"wATOM: must have pauser role to unpause"
);
_unpause();
}
| 15,012,751 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "../upkeeps/CronUpkeep.sol";
import "../upkeeps/CronUpkeepDelegate.sol";
import "../ConfirmedOwner.sol";
import {Spec, Cron as CronExternal} from "../libraries/external/Cron.sol";
/**
* @title The CronUpkeepFactory contract
* @notice This contract serve... | Gets the address of the delegate contract return the address of the delegate contract/ | function cronDelegateAddress() external view returns (address) {
return s_cronDelegate;
}
| 12,622,365 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/** @title Color.sol is a sample of a ERC721 token smart contract
* @a... | function is a wrapper for the ERC721 _mint function / | function mint(string memory _color) public onlyOwner {
require(!_colorExists[_color], "This color already exists...");
colors.push(_color);
uint _id = colors.length - 1;
_mint(msg.sender, _id);
_colorExists[_color] = true;
}
| 12,851,573 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.6.0 <0.7.0;
pragma experimental ABIEncoderV2;
import "@darwinia/contracts-utils/contracts/ECDSA.sol";
import "@darwinia/contracts-utils/contracts/Bitfield.sol";
import "@darwinia/contracts-verify/contracts/MerkleProof.sol";
import "@darwinia/contracts-verify/... | Clean up the expired commitment and slash id the identifier generated by submit commitment/ | function cleanExpiredCommitment(uint256 id) public {
ValidationData storage data = validationData[id];
require(block.number > data.blockNumber + BLOCK_WAIT_PERIOD + 256, "Bridge: Only expired");
SLASH_VAULT.transfer(MIN_SUPPORT);
delete validationData[id];
emit CleanExpiredCo... | 12,792,278 |
pragma solidity ^0.4.24;
/** @title NoFilter */
contract NoFilter {
address public owner;
/** @dev Constructor function */
constructor() public {owner = msg.sender;}
/**A struct holding and uploaded files details */
struct File {
address uploaderId;
string description;
... | returns the details of a uploaded file from the mapping ipfsHash bytes32 return details[ipfsHash].uploaderId address, details[ipfsHash].description String, details[ipfsHash].vote int/ | function getDetails(bytes32 ipfsHash) public view returns (
address,
string,
int
) {
return (details[ipfsHash].uploaderId,
details[ipfsHash].description,
details[ipfsHash].vote);
}
| 6,342,789 |
./partial_match/1/0xCB334a89e79499b16fAe21f40cD1561fB092245f/sources/LotteryToken.sol | File: contracts\interfaces\ILotteryGame.sol | interface ILotteryGame {
function setOracleIpfsHash(string memory _hash) external;
function setProvableGasLimit(uint256 _amount) external;
function setParticipationFee(uint256 _participationFee) external;
function lockTransfer() external;
function unlockTransfer() external;
function start... | 2,869,908 |
./partial_match/1/0xcecaD69d7D4Ed6D52eFcFA028aF8732F27e08F70/sources/Flipper.sol | Purchase OUSD with USDT amount Amount of OUSD to purchase, in 18 fixed decimals. Potential rounding error is an intentional tradeoff USDT does not return a boolean and reverts, so no need for a require. | function buyOusdWithUsdt(uint256 amount) external {
require(amount <= MAXIMUM_PER_TRADE, "Amount too large");
usdt.transferFrom(msg.sender, address(this), amount / 1e12);
require(ousd.transfer(msg.sender, amount));
}
| 2,784,684 |
./full_match/1/0xed4e21BD620F3C1Fd1853b1C52A9D023C33D83d4/sources/contracts/lib/RedemptionsBase.sol | vEth2 transfer from returns true otherwise reverts | function deposit(uint256 amount) external nonReentrant {
if (vEth2Token.transferFrom(msg.sender, address(this), amount)) {
_stakeForWithdrawal(msg.sender, amount);
}
}
| 3,851,806 |
// Contracts/SupplyChain.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "../emeraldaccesscontrol/MinerRole.sol";
import "../emeraldaccesscontrol/LaboratoryRole.sol";
import "../em... | Define a function 'buyItem' that allows the Manufacturer to mark an item 'Sold' Call modifier to check if upc has passed previous supply chain stage Call modifer to check if buyer has paid enough Call modifer to send any excess ether back to buyer Transfer money to Miner Tranfer emerald ownership Update emerald state E... | function buyFromMiner(uint _upc) public payable
forSale(_upc)
paidEnough(emeralds[_upc].GetMarketPrice())
checkValue(_upc)
onlyManufacturer
{
require(success, "Transfer failed");
emeralds[_upc].SetOwnerID(msg.sender);
emeralds[_upc].SetManufacturerID(msg.sender);
emeralds... | 5,454,282 |
./full_match/5/0x6295849FCDEA72Ed1cBc1a05C9a808aDad6aA932/sources/project_/contracts/Uniswap/TransferHelper.sol | bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); | function safeTransferFrom(
address token,
address from,
address to,
uint256 value
) internal {
(bool success, bytes memory data) = token.call(
abi.encodeWithSelector(0x23b872dd, from, to, value)
);
require(
success && (data.length =... | 1,878,620 |
./full_match/4/0x66c88c5A68EF53a5AbE9615E35a4e69342154D7A/sources/lexWrapper.sol | This is safe because ownership is checked against decrement, and sum of all user balances can't exceed 'type(uint256).max'. | function transferFrom(address, address to, uint256 tokenId) public virtual {
address owner = ownerOf[tokenId];
require(
msg.sender == owner
|| msg.sender == getApproved[tokenId]
|| isApprovedForAll[owner][msg.sender],
"NOT_APPROVED"
... | 12,302,242 |
/**
*Submitted for verification at Etherscan.io on 2021-09-28
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (b... | fetches and sorts the reserves for a pair | function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) {
(address token0,) = sortTokens(tokenA, tokenB);
(uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();
(reserveA, reserveB) ... | 2,296,169 |
// contracts/Messages.sol
// SPDX-License-Identifier: Apache 2
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
contract Migrator is ERC20 {
IERC20 public fromAsset;
IERC20 publi... | _amount denominated in fromToken deposit fromAsset send out toAsset | function migrate(uint _amount) external {
SafeERC20.safeTransferFrom(fromAsset, msg.sender, address(this), _amount);
SafeERC20.safeTransfer(toAsset, msg.sender, adjustDecimals(fromDecimals, toDecimals, _amount));
}
| 1,283,303 |
/**
*Submitted for verification at Etherscan.io on 2021-05-18
*/
// File: contracts/lib/Types.sol
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
library Types {
enum RStatus {ONE, ABOVE_ONE, BELOW_ONE}
}
// File: contracts/... | last step to shut down dodo | function finalSettlement() external onlyOwner notClosed {
_CLOSED_ = true;
_DEPOSIT_QUOTE_ALLOWED_ = false;
_DEPOSIT_BASE_ALLOWED_ = false;
_TRADE_ALLOWED_ = false;
uint256 totalBaseCapital = getTotalBaseCapital();
uint256 totalQuoteCapital = getTotalQuoteCapital();
... | 2,176,721 |
./full_match/7700/0x4f07f0a2AE51ac40fb5FbdDaC242B5D22Cc0C992/sources/contracts/Plebness.sol | @inheritdoc IPlebness | function getSpreadForJacketAssets() external view override returns (uint256) {
return jacketSpreadFactor;
}
| 4,649,794 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.6 <0.8.0;
import {AddressIsContract} from "@animoca/ethereum-contracts-core/contracts/utils/types/AddressIsContract.sol";
import {IERC165} from "@animoca/ethereum-contracts-core/contracts/introspection/IERC165.sol";
import {IERC721} from "./interfaces/IERC721.sol"... | @inheritdoc IERC721 | function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: zero address");
return _nftBalances[owner];
}
| 6,348,185 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.