file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/1/0xf4BC293A38bD1E3875Cfc141Ba81dd8E95F65f90/sources/StrategyConic.sol | Adds liquidity to AMM and gets more LP tokens. | function _addLiquidity() internal {
uint nativeBal = _balanceOfThis(native);
if (nativeToUnderlyingPath.length > 0) {
UniswapV3Utils.swap(unirouter, nativeToUnderlyingPath, nativeBal);
ICurveRouter(curveRouter).exchange_multiple(nativeToUnderlying.route, nativeToUnderlying.sw... | 4,260,140 |
./full_match/1/0xe261B138cfd46FdC12A039cF6690645f35DCFA37/sources/contracts/Global/AuthorityModel.sol | ____________________________________________________________________________________________________________________ -->GETTER (function) isSuperAdmin check if an address is the super admin -------------------... | function isSuperAdmin(address queryAddress_) public view returns (bool) {
return (superAdmin == queryAddress_);
}
| 3,107,381 |
pragma solidity ^0.5.16;
import "./VToken.sol";
import "./ErrorReporter.sol";
import "./PriceOracle.sol";
import "./ComptrollerInterface.sol";
import "./ComptrollerStorage.sol";
import "./Unitroller.sol";
import "./Governance/XVS.sol";
import "./VAI/VAI.sol";
/**
* @title Venus's Comptroller Contract
* @author Venu... | Set the given borrow caps for the given vToken markets. Borrowing that brings total borrows to or above borrow cap will revert. Admin or borrowCapGuardian function to set the borrow caps. A borrow cap of 0 corresponds to unlimited borrowing. vTokens The addresses of the markets (tokens) to change the borrow caps for ... | function _setMarketBorrowCaps(VToken[] calldata vTokens, uint[] calldata newBorrowCaps) external {
require(msg.sender == admin || msg.sender == borrowCapGuardian, "only admin or borrow cap guardian can set borrow caps");
uint numMarkets = vTokens.length;
uint numBorrowCaps = newBorrowCaps.l... | 1,063,706 |
pragma solidity 0.4.25;
import "./SafeMath.sol";
import "./Roles.sol";
/**
* @title TRC20 interface
*/
interface TRC20Interface {
function balanceOf(address tokenOwner) external view returns (uint256 balance);
function allowance(address tokenOwner, address spender) external view returns (uint256 remaining)... | TRC20 interface/ | interface TRC20Interface {
function balanceOf(address tokenOwner) external view returns (uint256 balance);
function allowance(address tokenOwner, address spender) external view returns (uint256 remaining);
function transfer(address to, uint256 tokens) external returns (bool success);
function approve(ad... | 12,758,007 |
pragma solidity 0.4.24;
import { Ownable } from "openzeppelin-solidity/contracts/ownership/Ownable.sol";
/**
* @title One-time schedulable contract
* @author Jakub Stefanski (https://github.com/jstefanski)
*/
contract Schedulable is Ownable {
/**
* @dev First block when contract is active (inclusive). Z... | Schedule contract activation for given block range _startBlock uint256 The first block when contract is active (inclusive) _endBlock uint256 The last block when contract is active (inclusive)/ | function schedule(uint256 _startBlock, uint256 _endBlock)
public
onlyOwner
onlyNotScheduled
onlyNotZero(_startBlock)
onlyNotZero(_endBlock)
{
require(_startBlock < _endBlock);
startBlock = _startBlock;
endBlock = _endBlock;
emit Scheduled... | 12,856,306 |
/**
*Submitted for verification at Etherscan.io on 2022-04-11
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/* _______ _______ __ _ ___ _______ __ __ ___ _______ _______ _______ _______ ___ __ __ _______
| || || | | || | | || | | || | ... | Returns true if the value is in the set. O(1)./ | function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
| 2,048,129 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import "./interfaces/ITimeBasedSwitch.sol";
import "./interfaces/KeeperCompatibleInterface.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.... | Function to withdraw amount of given ERC20 token _tokenAddress - address of ERC20 token _amount - amount to withdraw _receiver - address of wallet to receive tokens No return, reverts on error/ | function withdrawToken(address _tokenAddress, uint256 _amount, address _receiver)
private
{
require(_tokenAddress != address(0), "withdrawToken: Invalid token address");
require(_amount > 0, "withdrawToken: Amount must be greater than 0");
require(_receiver != address(0), "withdrawT... | 937,245 |
./full_match/43114/0xa14f8c2fD5A335aCb230834D6A57750046a5c4Df/sources/contracts/ERC721Art.sol | only ownerTokenCount | function airdrop(address[] memory _to) public onlyOwner {
uint arrayLength = _to.length;
require((airdropCount + arrayLength) < airdropMax, "Cannot exceed Airdrop Cap");
for (uint i=0; i<arrayLength; i++) {
_privateMint(_to[i], 1);
airdropCount++;
}
}
| 4,540,000 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view retu... | return If the latest block timestamp is within the rebase time window it, returns true. Otherwise, returns false./ First check if reeth token is active for rebasing | function inRebaseWindow() public view returns (bool) {
return (block.timestamp.mod(minRebaseTimeIntervalSec) >= rebaseWindowOffsetSec &&
block.timestamp.mod(minRebaseTimeIntervalSec) <
(rebaseWindowOffsetSec.add(rebaseWindowLengthSec)));
}
| 13,387,919 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "./interface/ISqwidMarketplace.sol";
contract SqwidGovernance {
struct Transaction {
address to;
uint256 value;
bytes data;
bool executed;
uint256 numConfirmations;
}
struct OwnersChange {
addre... | Returns total number of minimum confirmations change proposals./ | function minConfirmationsChangesCount() external view returns (uint256) {
return minConfirmationsChanges.length;
}
| 12,720,701 |
pragma solidity 0.6.12;
//----------------------------------------------------------------------------------
// I n s t a n t
//
// .:mmm. .:mmm:. .ii. .:SSSSSSSSSSSSS. .oOOOOOOOOOOOo.
// .mMM'':Mm. .:MM'':Mm:. .II: :SSs.......... .oOO'''''''''''OOo.
// .:Mm' ':Mm. ... | Gets the number of second token deposited into this contract. return uint256 Number of WETH./ | function getToken2Balance() public view returns (uint256) {
return token2.balanceOf(address(this));
}
| 82,035 |
pragma solidity ^0.5.2;
pragma experimental ABIEncoderV2;
import "../Core/Core.sol";
/**
* @title STF
* @notice Contains all state transition functions (STFs) currently used by all Engines
*/
contract STF is Core {
/**
* State transition for PAM analysis events
* @param state the old state
* @... | State transition for PAM fee payment events state the old state return the new state/ | function STF_PAM_FP (
LifecycleTerms memory terms,
State memory state,
uint256 scheduleTime,
bytes32 externalData
)
internal
pure
returns (State memory)
{
int256 timeFromLastEvent = yearFraction(
shiftCalcTime(state.statusDate, term... | 12,940,266 |
/**
*Submitted for verification at Etherscan.io on 2022-04-07
*/
/*
quackQuackQuackquackquackQuackquackQuackquackQuackQuackquackquackQuackquackQuack
quackQuackQuackquackquackQuackquackQuackquackQuackQuackquackquackQuackquackQuack
quackQuackQuackquackquackQuackquackQuackquackQuackQuackquackquackQuackquackQuack
quackQu... | Clear approvals from the previous owner | function _transfer(address from, address to, uint tokenId) internal {
require(ownerOf(tokenId) == from, "QQ721: transfer of token that is not own");
_beforeTokenTransfer( from, to, tokenId );
_approve(address(0), tokenId);
tokens[tokenId].owner = to;
emit Transfer(from, to, tokenId);
}
| 15,123,261 |
pragma solidity 0.4.20;
import 'libraries/token/StandardToken.sol';
contract VariableSupplyToken is StandardToken {
using SafeMathUint256 for uint256;
event Mint(address indexed target, uint256 value);
event Burn(address indexed target, uint256 value);
/**
* @dev mint tokens for a specified ad... | burn tokens belonging to a specified address _target The address to burn tokens for. _amount The amount to be burned./ | function burn(address _target, uint256 _amount) internal returns (bool) {
balances[_target] = balances[_target].sub(_amount);
supply = supply.sub(_amount);
Burn(_target, _amount);
onBurn(_target, _amount);
return true;
}
| 897,440 |
/**
* @authors: [@unknownunknown1]
* @reviewers: []
* @auditors: []
* @bounties: []
*/
pragma solidity ^0.4.24;
import "./Arbitrator.sol";
import "./IArbitrable.sol";
import "../../libraries/CappedMath.sol";
contract MultipleArbitrableTransactionWithAppeals is IArbitrable {
using CappedMath for ui... | Create a dispute. UNTRUSTED. _transactionID The index of the transaction. _arbitrationCost Amount to pay the arbitrator./ Refund sender if it overpaid. Refund receiver if it overpaid. | function raiseDispute(uint _transactionID, uint _arbitrationCost) internal {
Transaction storage transaction = transactions[_transactionID];
transaction.status = Status.DisputeCreated;
transaction.disputeId = arbitrator.createDispute.value(_arbitrationCost)(AMOUNT_OF_CHOICES, arbitratorExtra... | 12,734,867 |
./full_match/1/0x75Cd3F538c091C1D514aB1aD9832f54198CAceC0/sources/src/GnarsHD.sol | Returns the tokenId of the Gnar HD by index Delegates to the Gnars V2 contract | function tokenByIndex(uint256 _index) external view returns (uint256) {
return gnarsV2.tokenByIndex(_index);
}
| 16,430,904 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol";
import "../../../interfaces/IEscrowTicketer.sol";
import "../../../interfaces/ISeenHausNFT.sol";
import "../../../util/StringUtils.sol";
import "../MarketClientBase.so... | IEscrowTicketer Manages the issue and claim of escrow tickets. The ERC-165 identifier for this interface is: 0x73811679/ | interface IEscrowTicketer {
event TicketIssued(uint256 ticketId, uint256 indexed consignmentId, address indexed buyer, uint256 amount);
event TicketClaimed(uint256 ticketId, address indexed claimant, uint256 amount);
function getNextTicket() external view returns (uint256);
function getTicket(uint256... | 1,573,945 |
pragma solidity ^0.5.17;
// Brought from https://github.com/aragon/aragonOS/blob/v4.3.0/contracts/lib/math/SafeMath.sol
// Adapted to use pragma ^0.5.17 and satisfy our linter rules
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
string private constan... | Assign `@tokenAmount(self.token(), _amount)` to the available balance of `_guardian` _guardian Guardian to add an amount of tokens to _amount Amount of tokens to be added to the available balance of a guardian/ | function assignTokens(address _guardian, uint256 _amount) external onlyActiveDisputeManager {
if (_amount > 0) {
_updateAvailableBalanceOf(_guardian, _amount, true);
emit GuardianTokensAssigned(_guardian, _amount);
}
}
| 91,843 |
pragma solidity 0.4.24;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed ... | Function to burn unsold tokens/ | function _burnUnsoldTokens()
internal
{
uint256 tokensToBurn = TOKENSFORSALE.sub(vestedTokens).sub(distributedTokens);
_token.burn(tokensToBurn);
}
| 12,543,454 |
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}... | _key The key for the record | function setString(bytes32 _key, string _value) onlyLatestContract external {
stringStorage[_key] = _value;
}
| 1,795,318 |
./full_match/1/0x13C2A723e57A83612F3D844D81bb8b7233C5158C/sources/contracts/OCBStaking.sol | Internal unstake function | function _unstake(address recipient, uint256 tokenId) internal {
Position storage stakingPosition = stakingPositions[tokenId];
if( recipient != stakingPosition.owner ) revert SenderIsNotTokenOwner(tokenId);
if( stakingPosition.startTime <= 0 ) revert TokenIsNotStaked(tokenId);
sta... | 4,857,337 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./Address.sol";
import "./CollaborativeOwnable.sol";
import "./ERC721Enumerable.sol";
import "./IOwlToken.sol";
import "./MerkleProof.sol";
import "./ProxyRegistry.sol";
import "./ReentrancyGuard.sol";
import "./SafeMath.sol";
import "./Strings.sol";
co... | See {IERC721-balanceOf}./ | function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0));
return _balances[owner];
}
| 140,387 |
./full_match/1/0x97b6a74BcC7Bfc03e9Ce97DE7Fb82a4a03b110Bf/sources/contracts/Pool/Pool.sol | @inheritdoc IPool Lender should have principal Lender should not have created callback Callback can be created only before the maturity date If last lender requests callback and roll is requested then roll is rejected | function requestCallBack()
external
override
onlyPrime
nonDefaulted
nonClosed
returns (bool success)
{
require(poolMembers[msg.sender].principal != 0, 'LZL');
require(!_poolCallbacks[msg.sender].isCreated, 'AAD');
require(block.timestamp < maturityDate, 'EMD');
if (isRollR... | 16,489,427 |
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.8;
/**
* @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 ... | deposit backing tokens to be locked, and generate wrapped tokens to recipient recipient address to receive wrapped tokens amount amount of tokens to wrap return true if successful/ transfer backing token from sender to this contract to be locked update how many tokens the sender has locked in total... | function wrapTo(address recipient, uint256 amount) public returns(bool) {
require(recipient != address(0), "Recipient cannot be zero address");
_backingToken.transferFrom(msg.sender, address(this), amount);
_lockedBalances[msg.sender] = _lockedBalances[msg.sender].add(amount);
_mi... | 7,716,821 |
pragma solidity 0.4.24;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/lifecycle/Pausable.sol";
import "./ReservationContract.sol";
/**
* @author James Spivey <spivey@zentostudios.com>
* @title Reservation Factory
* @dev
* This contract creates new contrac... | Starts a reservation, validates is a valid reservation/ Reservation contract validates everything else. _resId Unique generated reservation ID/ | function start(bytes32 _resId)
public
validReservation(_resId)
{
ReservationContract(reservationsById[_resId]).start(msg.sender);
emit ReservationFactoryActivate(_resId, msg.sender);
}
| 895,438 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/security/ReentrancyGuard.sol
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the ... | Function remove MitPass wallet / only owner | function remove_mintpass(address _address) public onlyOwner() {
require(_address != address(0), "Zero address error");
mintpass[_address] = false;
mintpass_count--;
}
| 13,671,776 |
pragma solidity =0.6.6;
interface IAtariswapFactory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) exter... | performs chained getAmountOut calculations on any number of pairs | function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) {
require(path.length >= 2, 'AtariswapLibrary: INVALID_PATH');
amounts = new uint[](path.length);
amounts[0] = amountIn;
for (uint i; i < path.length - 1; i++) ... | 11,977,437 |
// Copyright (C) 2020 Zerion Inc. <https://zerion.io>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This ... | return Amount of Uniswap pool tokens held by the given account. Implementation of ProtocolAdapter interface function./ | function getBalance(address, address) public view override returns (uint256) {
revert("OSA: no balance!");
}
| 186,597 |
./partial_match/1/0x39EFdC3dbB57B2388CcC4bb40aC4CB1226Bc9E44/sources/lib/prb-math/src/casting/Uint128.sol | Casts a uint128 number to UD60x18. There is no overflow check because the domain of uint128 is a subset of UD60x18. | function intoUD60x18(uint128 x) internal pure returns (UD60x18 result) {
result = UD60x18.wrap(uint256(x));
}
| 2,719,661 |
// SPDX-License-Identifier: MIXED
// File contracts/interfaces/IOracle.sol
// License-Identifier: MIT
pragma solidity 0.6.12;
interface IOracle {
/// @notice Get the latest exchange rate.
/// @param data Usually abi encoded, implementation specific data that contains information and arguments to & about the o... | Check the current spot exchange rate without any state changes @inheritdoc IOracle | function peekSpot(bytes calldata data) external view override returns (uint256 rate) {
(uint256 reserve0, uint256 reserve1, ) = pair.getReserves();
rate = 1e44 / WOHM.sOHMTowOHM(reserve1.mul(1e18) / reserve0).mul(uint256(DAI_USD.latestAnswer()));
}
| 2,182,456 |
// SPDX-License-Identifier: GPL-3.0
// Original source: https://github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/examples
// Modified to unpin solidity version and to support multiple pairs
pragma solidity ^0.6.6;
import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol';
import '@uniswap/v2-c... | Calls `update` and returns the rate in a single call/ | function updateAndConsult(
address _tokenIn,
uint _amountIn,
address _tokenOut
) public override
returns (uint _amountOut)
{
update(_tokenIn, _tokenOut);
return consult(_tokenIn, _amountIn, _tokenOut);
}
| 5,367,011 |
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
//----------------------------------------------------------------------------------
// I n s t a n t
//
// .:mmm. .:mmm:. .ii. .:SSSSSSSSSSSSS. .oOOOOOOOOOOOo.
// .mMM'':Mm. .:MM'':Mm:. .II: :SSs.......... .oOO'... | Checks if the commitment does not exceed the goal of this sale. _commitment Number of tokens to be commited. return committed The amount able to be purchased during a sale./ | function calculateCommitment(uint256 _commitment)
public
view
returns (uint256 committed)
{
uint256 tokens = _getTokenAmount(_commitment);
uint256 tokensCommited =_getTokenAmount(uint256(marketStatus.commitmentsTotal));
if ( tokensCommited.add(tokens) > uint256(ma... | 473,086 |
pragma solidity ^0.5.2;
// File: @daostack/infra/contracts/votingMachines/IntVoteInterface.sol
interface intvoteinterface31 { //inject NONSTANDARD NAMING
//When implementing this interface please do not only override function and modifier,
//but also to keep the modifiers on the overridden functions.
modi... | inject NONSTANDARD NAMING | function EXECUTEPROPOSAL85(bytes32 _proposalId, int _decision) external returns(bool); | 12,775,839 |
./full_match/80001/0xbB7Bf10aB05d0ed4B351C43197aB2Cbbd86c6abd/sources/contracts/pools/Pool.sol | Function to remove TCO2 addresses from internal whitelist erc20Addr accepts an array of contract addressescslither-disable-next-line uninitialized-local | function removeFromInternalWhiteList(address[] memory erc20Addr) external {
onlyPoolOwner();
for (uint256 i; i < erc20Addr.length; ++i) {
internalWhiteList[erc20Addr[i]] = false;
emit InternalAddressRemovedFromWhitelist(erc20Addr[i]);
}
}
| 9,448,144 |
./full_match/80001/0x314420AB6D81b2FF31E25Fdd81aa13B1b643B64a/sources/contracts/DropSinglePhase.sol | Checks a request to claim NFTs against the active claim condition's criteria. | function BTVerifyClaim(
address _claimer,
bytes32[] memory proof,
bytes32 root
) internal view returns (bool isOverride) {
if(root != bytes32(0)) {
(isOverride,) = MerkleProof.verify(
proof,root,keccak256(abi.encodePacked(_claimer)));
}
retur... | 871,589 |
./full_match/3/0x24550DB84186A1E3e5631630C2aA579CAC87FD59/sources/contracts/Faucet.sol | Limit withdrawal amount Send the amount to the address that requested it | function withdraw(uint withdraw_amount) public {
require(withdraw_amount <= 100000000000000000);
emit Withdrawal(msg.sender, withdraw_amount);
}
| 14,206,842 |
./full_match/1/0x6E86583588D1b4c073A8b857D7388f67A3DC5f8F/sources/contracts/CyberAssassins.sol | Teams Regular Assassins Increase tracker and counter of regular assassin Mint regular assassin Super Assassins Increase tracker and counter of super assassin Mint super assassin | function reserveAssassins() external onlyOwner nonReentrant {
require(!isReserved, "Already reserved");
uint256 tokenId;
for (uint256 i = 0; i < _creators.length - 1; i++) {
address wallet = _creators[i];
uint256 k;
for (k = 0; k < 5; k++) {
_tokenIdRegularTrackerTeam.increment... | 9,804,373 |
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.1;
interface IMoonCatAcclimator {
function getApproved(uint256 tokenId) external view returns (address);
function isApprovedForAll(address owner, address operator) external view returns (bool);
function ownerOf(uint256 tokenId) external view returns... | Convenience function to iterate through all MoonCats owned by an address and announce or cache their subdomain hashes./ | function mapMoonCats(address moonCatOwner) public {
for (uint256 i = 0; i < MCA.balanceOf(moonCatOwner); i++) {
uint256 rescueOrder = MCA.tokenOfOwnerByIndex(moonCatOwner, i);
address lastAnnounced = lastAnnouncedAddress[rescueOrder];
if (lastAnnounced == address(0)){
... | 15,333,116 |
./full_match/44787/0xf6025239E9ced4d924177E9A6E855c608B1E815c/sources/contracts/CarbonPathToken.sol | Revoke Minter Role to the address Requirements: - the caller must have the `DEFAULT_ADMIN_ROLE`./ | function revokeMinter(address account) public {
require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "CarbonPathToken: must be an admin");
_revokeRole(MINTER_ROLE, account);
}
| 13,243,841 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./interfaces/ICSTToken.sol";
import "./interfaces/ICSTFarmingProxy.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/// @title I... | Owner should add proxy first, then proxy can add its pools. _farmingProxy Proxy's address | function addProxy(address _farmingProxy) public onlyOwner {
require(_farmingProxy != address(0), "CSTMinter: no 0 address");
require(
!proxyExists[_farmingProxy],
"CSTMinter: _farmingProxy is exists."
);
proxyAddresses.push(_farmingProxy);
proxyExists[... | 5,381,786 |
pragma solidity ^0.4.25;
// It's important to avoid vulnerabilities due to numeric overflow bugs
// OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs
// More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-insecurity-bad-arithmetic/
impo... | Check if an employee is registered return A bool that indicates if the employee is registered/ | function isEmployeeRegistered
(
string id
)
external
view
returns (bool)
{
return employees[id].isRegistered;
}
| 12,762,637 |
./full_match/888/0x87332A42bd65cb9A60975fbB705fB6522D12bc05/sources/contracts/gpk/GpkDelegateV2.sol | function for dest storeman set check status for encSij groupId storeman group id roundIndex group negotiate round curveIndex singnature curve index src src storeman address isValid whether encSij is valid | function setCheckStatus(bytes32 groupId, uint16 roundIndex, uint8 curveIndex, address src, bool isValid)
external
{
GpkTypes.Group storage group = groupMap[groupId];
checkValid(group, roundIndex, curveIndex, GpkTypes.GpkStatus.Negotiate, true, true, src);
GpkTypes.Round storage r... | 13,223,762 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.10;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./Ownable.sol";
import "./erc1820/ERC1820Client.sol";
import "./erc1820/ERC1820Implementer.sol";
import "./extensions/IAmpTokensSender.sol";
i... | Remove a partition to the total partitions collection. _partition Name of the partition./ | function _removePartitionFromTotalPartitions(bytes32 _partition) internal {
uint256 index = _indexOfTotalPartitions[_partition];
if (index == 0) {
return;
}
_indexOfTotalPartitions[lastValue] = index;
_totalPartitions.pop();
_indexOfTotalPartitions[_par... | 1,065,059 |
//Address: 0x904079be18b34fefea1307bc5e3c29ada6f201dc
//Contract name: CrowdSale
//Balance: 0 Ether
//Verification Date: 3/2/2018
//Transacion Count: 4
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations that are safe for uint256 against overflow and negative values
* @dev h... | forwards ether received to refund vault and generates tokens for purchaser 1 LEON is priced at 1 USD etherToUSDRate is stored in cents, /100 to get USD quantity crowdsale offers 100% bonus, purchaser receives (tokens before bonus) 2 tokens = (ether etherToUSDRate in cents) 2 / 100 | function buyTokens(address _purchaser) public payable ifUnrestricted onlyWhileActive returns (bool) {
require(!targetReached());
require(msg.value > purchaseThreshold);
refundVault.deposit.value(msg.value)(_purchaser);
uint256 _tokens = (msg.value).mul(etherToUSDRate).div(50);
require(tokenContrac... | 12,559,059 |
./partial_match/1/0xF322F55E44257d0d8F5E4bde706Ec8cdF9772f2e/sources/TokenFactory.sol | Mint. _account Address to mint tokens to. _amount Amount to mint./ | function mint(address _account, uint256 _amount) public {
if(isSystem(msg.sender)){
require(!isFrozen(_account), "SygnumToken: Account must not be frozen if system calling.");
}
super._mint(_account, _amount);
emit Minted(msg.sender, _account, _amount);
}
| 4,224,597 |
// Sources flattened with hardhat v2.8.2 https://hardhat.org
// File contracts/lib/LibAppStorage.sol
/**
* SPDX-License-Identifier: MIT
*
* Copyright (c) 2021 YellowHeart
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "... | Internal function to invoke `onApprovalReceived` on a target address The call is not executed if the target address is not a contract spender address The address which will spend the funds amount uint256 The amount of tokens to be spent data bytes Optional data to send along with the call return whether the call co... | function _checkAndCallApprove(
address spender,
uint256 amount,
bytes memory data
) internal returns (bool) {
if (!spender.isContract()) {
return false;
}
bytes4 retval = IERC1363Spender(spender).onApprovalReceived(
LibContext._msgSender(),... | 6,926,082 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
// @title: Crypto Panther Club
// @developer: Arthur V.
// @artist: https://marcinglod.com
// @url: https://cryptopanther.club
//
// ... | ======== Whitelist Mint ========= | function whitelistMint(uint256 amount_, Coupon memory coupon_)
public
payable
onlyWhitelistPhase
validateAmount(amount_, maxPerAddressWhitelist)
validateSupply(amount_)
validateEthPayment(amount_, priceWhitelist)
nonReentrant
{
require(amount_ + ad... | 614,599 |
pragma solidity ^0.5.0;
contract Charity {
enum CharityStatus {UNVERIFIED, VERIFIED, REJECTED}
enum CampaignStatus {ONGOING, ENDED}
struct charity {
address charityOwner;
string charityName;
string charityAddress;
string contactNumber;
string description;
s... | This will be the getter function that everyone can call to check the status of the campaign. Parameters of this function will include uint campaignId/ | function isStatusComplete(
uint256 campaignId
)
public
view
returns (bool)
{
require(campaignId < noOfCampaigns, "Invalid campaign id");
if (campaigns[campaignId].campaignStatus == CampaignStatus.ENDED) {
return true;
}
return f... | 6,449,594 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "./AuthorizationUtilsV0.sol";
import "./TemplateUtilsV0.sol";
import "./WithdrawalUtilsV0.sol";
import "./interfaces/IAirnodeRrpV0.sol";
/// @title Contract that implements the Airnode request–... | Called by Airnode if the request cannot be fulfilled Airnode should fall back to this if a request cannot be fulfilled because static call to `fulfill()` returns `false` for `callSuccess` requestId Request ID airnode Airnode address fulfillAddress Address that will be called to fulfill fulfillFunctionId Signature ... | function fail(
bytes32 requestId,
address airnode,
address fulfillAddress,
bytes4 fulfillFunctionId,
string calldata errorMessage
) external override {
require(
keccak256(
abi.encodePacked(
airnode,
... | 11,959,939 |
pragma solidity ^0.4.11;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(u... | Allows the current owner to transfer control of the contract to a newOwner. newOwner The address to transfer ownership to./ | function transferOwnership(address newOwner) onlyOwner {
require(newOwner != address(0));
owner = newOwner;
}
| 543,568 |
pragma solidity ^0.6.0;
... | inject NONSTANDARD NAMING | function LOG40(address p0, bool p1, string memory p2, address p3) internal view { | 1,019,191 |
pragma solidity 0.5.0;
import "./SafeMath.sol";
import "./RewardContract.sol";
import "./Adbank.sol";
contract AdbankRewardClaimContract is RewardContract {
using SafeMath for uint256;
// Stop contract from executing it's main logic
bool public suspended;
// Limit the size of incoming requests (assi... | Suspend / resume the execution of contract methods | function suspend(bool _suspended) external onlyOwner {
suspended = _suspended;
}
| 534,307 |
// SPDX-License-Identifier: GPLv2
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../DigitalaxAccessControls.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./interfaces/IDigitalaxRewards.sol";
import "../EIP2771/BaseRelayRecipient.sol";
import "@openzeppe... | Get the total ETH staked (all pools early stakers)/ | function earlyStakedMonaInPool(uint256 _poolId)
external
view
returns (uint256)
{
return pools[_poolId].earlyStakedMonaTotalForPool;
}
| 12,801,892 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.9;
import '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol';
import '@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol';
/**
* @title AggregateAccount
* @notice AggregateAccount represents groups of assets
* @dev Aggregate A... | Changes Account Name. Can only be set by the contract owner. accountName_ the new name/ | function setAccountName(string memory accountName_) external onlyOwner {
require(bytes(accountName_).length > 0, 'Platypus: Aggregate account name cannot be zero');
accountName = accountName_;
}
| 1,035,708 |
/**
* Spork Token Contracts
* See Spork contract below for more detail.
*
* The DAO and Spork is free software: you can redistribute it and/or modify
* it under the terms of the GNU lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option... | Determine the Spork token balance for an account _owner Account holding tokens return Token balance/ | function balanceOf(address _owner)
constant
returns (uint256 balance) {
return balances[_owner];
}
| 12,636,392 |
//Address: 0x83a326995d1f988b62b487f2838501d9fbfdd23e
//Contract name: PreSalePTARK
//Balance: 0 Ether
//Verification Date: 2/9/2018
//Transacion Count: 4
// CODE STARTS HERE
// Tarka Pre-Sale token smart contract.
// Developed by Phenom.Team <info@phenom.team>
pragma solidity ^0.4.15;
/**
* @title SafeMath
*... | Contract constructor function sets owner address/ | function PreSalePTARK() {
owner = msg.sender;
}
| 2,506,002 |
// SPDX-License-Identifier: MIT
// Insulin calculator storage. Platinum devTeam.
pragma solidity ^0.8.6;
contract EventStorage {
struct Insulin {
string insulinType;
uint256 duration;
}
string public version;
Insulin[] public INSULINS;
// Insulin[2] public INSULINS = [
... | We need recreate all array due https:docs.soliditylang.org/en/v0.8.6/types.htmldelete | function removeInsulin(uint256 _id) external {
Insulin[] memory insOld = personalInsulins[msg.sender];
delete personalInsulins[msg.sender];
for (uint256 i = 0; i < insOld.length; i++) {
if (i != _id) {
personalInsulins[msg.sender].push(insOld[i]);
}
... | 6,392,889 |
./full_match/80001/0xd1E00A34C819e7f2DA2F8715E2c66b5Bc6677E3c/sources/deploy/contracts/core/interfaces/IFinder.sol | Provides addresses of the contracts implementing certain interfaces./ | interface ISynthereumFinder {
function changeImplementationAddress(
bytes32 interfaceName,
address implementationAddress
) external;
function getImplementationAddress(bytes32 interfaceName)
external
view
returns (address);
pragma solidity >=0.8.0;
}
| 9,459,986 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import { MerkleTreeLib as Merkle } from "./merkle/MerkleTreeLib.sol";
library TransactionsLib {
enum TransactionType {
HARD_CREATE,
HARD_DEPOSIT,
HARD_WITHDRAW,
HARD_ADD_SIGNER,
SOFT_WITHDRAW,
SOFT_CREATE,
SOFT_TRANSFER,
SOFT_... | Add 33 to skip length and prefix | function decodeSoftTransfer(bytes memory input)
internal pure returns (SoftTransfer memory) {
uint24 nonce;
uint32 fromIndex;
uint32 toIndex;
uint56 value;
uint8 sigV;
bytes32 sigR;
bytes32 sigS;
bytes32 intermediateStateRoot;
assembly {
let ptr := add(input, 33)
nonc... | 5,452,367 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "../interfaces/IOracle.sol";
// Chainlink Aggregator
interface IAggregator {
function latestAnswer() external view returns (int256 answer);
}
contract USTOracle is IOracle {
IAggregator constant public UST = IAggregator(0x8b6d9085f310396C6E4f00127... | @inheritdoc IOracle | function symbol(bytes calldata) public pure override returns (string memory) {
return "LINK/UST";
}
| 5,756,732 |
./full_match/1/0x9965cCd16803432C6a0842f1D5690f32E427aEDd/sources/contracts/Marketplace.sol | Changes Presale Sale Max For Sale/ | function __ChangePresaleSaleMaxForSale(uint SaleIndex, uint MaxForSale) external onlyAdmin
{
require(PresaleSalesInternal[SaleIndex]._Active, "Marketplace: Sale Not Active");
PresaleSales[SaleIndex]._MaxForSale = MaxForSale;
}
| 8,471,301 |
//Address: 0xae4f56f072c34c0a65b3ae3e4db797d831439d93
//Contract name: Gimli
//Balance: 0 Ether
//Verification Date: 9/16/2017
//Transacion Count: 2713
// CODE STARTS HERE
pragma solidity ^0.4.11;
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) constant returns (uint256);
... | Send vested amount to _destination _destination The address of the recipient return Whether the release was successful or not | function releaseVesting(address _destination) onlyOwner returns (bool success) {
if (block.timestamp > VESTING_1_DATE && vesting1Withdrawn == false) {
balances[LOCKED_ADDRESS] = safeSub(balances[LOCKED_ADDRESS], VESTING_1_AMOUNT);
balances[_destination] = safeAdd(balances[_destinatio... | 15,819,795 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.10;
import '../utils/OwnableUpgradeable.sol';
import './OmnuumNFT1155.sol';
/// @title OmnuumMintManager - Manage mint data and logics except ticket minting
/// @author Omnuum Dev Team - <[email protected]>
/// @notice Use only purpose for Omnuum
contract Omnuum... | before nft mint, check whether mint is possible and count new mint at mint schedule only nft contract itself can access and use its mint schedule _groupId id of schedule _quantity quantity to mint _value value sent to mint at NFT contract, used for checking whether value is enough or not to mint _minter msg.sender... | function preparePublicMint(
uint16 _groupId,
uint32 _quantity,
uint256 _value,
address _minter
) external {
PublicMintSchedule storage schedule = publicMintSchedules[msg.sender][_groupId];
require(block.timestamp <= schedule.endDate, 'MT8');
require(sche... | 6,178,773 |
./full_match/80001/0x044DB618F54639F159a42647C23A3622B6f562C0/sources/contracts/relayer/loe-relayer/loe-feat-eip2771/contracts/contracts/payments/VoucherPayments.sol | verifies data from vouchers player from a voucher validityDate from a voucher nonce from a voucher messageHash a has of voucher signature of a voucher/ | function _verify(
address player,
uint40 validityDate,
uint16 category,
uint40 nonce,
bytes32 messageHash,
bytes calldata signature
)
internal view {
require(_msgSender() == player, "VoucherPayments: only player can execute the voucher");
r... | 9,530,058 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import { ICollectionFactory } from "../interfaces/ICollectionFactory.sol";
import { ICollection } from "../interfaces/ICollection.sol";
import { ICollectionCloneable } from "../interfaces/ICollectionCloneable.sol";
import { ICollectionNFTCloneableV1 } from "../int... | The function used to transfer contract ownership. This can be performed by either the owner or HashesDAO. This departs slightly from the traditional implementation where only the Owner has this permission. HashesDAO may need to perform this actions in the case of the factory maintainer changing,... | function transferOwnership(address newOwner) public override ownershipInitialized onlyOwnerOrHashesDAO {
require(newOwner != address(0), "CollectionNFTCloneableV1: new owner is the zero address");
_setOwner(newOwner);
}
| 9,942,448 |
./full_match/137/0x9Bb4627884A2aDAA2578C3BD81Fc3D88c8248271/sources/contracts/FlashloanQuickswap.sol | obtain an amount of token that you exchanged require(token0 != address(0) && token1 != address(0), 'e16'); if _amount0 is zero sell token1 for token0 else sell token0 for token1 as a result IERC20 token that we will sell for otherToken calculate the amount of token how much input token should be reimbursed swap token a... | function execute(address _sender, uint256 _amount0, uint256 _amount1, bytes calldata _data) internal {
uint256 amountToken = _amount0 == 0 ? _amount1 : _amount0;
IUniswapV2Pair iUniswapV2Pair = IUniswapV2Pair(msg.sender);
address token0 = iUniswapV2Pair.token0();
address token1 = iU... | 3,747,622 |
/**
*Submitted for verification at Etherscan.io on 2017-08-04
*/
// LTLVariables: user:Ref,val:int
// LTLFairness: [](<>(finished(SimpleAuction.withdraw, (user == msg.sender))))
// LTLProperty: []((finished(SimpleAuction.bid, (user == old(this.highestBidder) && val == old(this.highestBid) && user != 0))) ==> (<>(fini... | End the auction and send the highest bid to the beneficiary. It is a good guideline to structure functions that interact with other contracts (i.e. they call functions or send Ether) into three phases: 1. checking conditions 2. performing actions (potentially changing conditions) 3. interacting with other contracts If ... | function auctionEnd() public {
ended = true;
emit AuctionEnded(highestBidder, highestBid);
beneficiary.transfer(highestBid);
}
| 1,832,953 |
pragma solidity 0.6.6;
pragma experimental ABIEncoderV2;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(addre... | get balance of recipient token before trade to compare after trade. | function callExtFunc(address recipientToken, uint ethAmount, bytes memory callData, address exchangeAddress) internal returns (uint) {
uint balanceBeforeTrade = balanceOf(recipientToken);
if (recipientToken == ETH_TOKEN) {
balanceBeforeTrade = balanceBeforeTrade.safeSub(msg.value);
... | 7,504,055 |
pragma solidity ^0.4.18;
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {... | This is the actual transfer function in the token contract, it can only be called by other functions in this contract. _from The address holding the tokens being transferred _to The address of the recipient _amount The amount of tokens to be transferred return True if the transfer was successful Do not allow transf... | function doTransfer(address _from, address _to, uint _amount
) internal {
require((_to != 0) && (_to != address(this)));
require(_amount <= balances[_from]);
balances[_from] = balances[_from].sub(_amount);
balances[_to] = balances[_to].add(_amount);
}
| 439,846 |
./partial_match/4/0x69CE1039f9f06a1B814dFe6955a44A207aaBA07c/sources/Alt_Coin.sol | ------------------------------------------------------------------------ Get the token balance for account tokenOwner ------------------------------------------------------------------------ | function balanceOf(address tokenOwner) public constant returns (uint balance) {
return theBalances[tokenOwner];
}
| 8,755,116 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
//import 'openzeppelin-solidity/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol';
//import 'openzeppelin-solidity/contracts/token/ERC20/extensions/ERC20Burnable.sol';
//Version "openzeppelin-solidity": "4.4.1"
//is equivalent to
import './imports.sol';... | Capped Mint function | function mint(address to, uint256 amount) public virtual override(ERC20PresetMinterPauser){
require(totalSupply() + amount <= MAXSUPPLY, "MAXSUPPLY cannot be exceded");
super._mint(to, amount);
}
| 1,171,317 |
/**
*Submitted for verification at Etherscan.io on 2020-09-04
*/
pragma solidity ^0.6.0;
// "SPDX-License-Identifier: UNLICENSED "
// ----------------------------------------------------------------------------
// 'The Forms ver.2' token contract
// Symbol : FRMS
// Name : The Forms
// Total supply: 5,8... | ------------------------------------------------------------------------ Transfer `tokens` from the `from` account to the `to` account The calling account must already have sufficient tokens approve(...)-d for spending from the `from` account and - From account must have sufficient balance to transfer - Spender must ha... | function transferFrom(address from, address to, uint256 tokens) public override returns (bool success){
require(address(to) != address(0), "Transfer to address 0 not allowed");
require(address(from) != address(0), "Transfer from address 0 not allowed");
require(balances[from] >= tok... | 945,348 |
./full_match/1/0xc600727f1Ce705436734F2367e7FC449da5fB3a6/sources/contracts/tokens/AutoCoinageSnapshot2.sol | @inheritdoc IAutoCoinageSnapshot2 | function balanceOfAt(address layer2, address account, uint256 snapshotId)
public view override returns (uint256)
{
if (snapshotId > 0) {
(bool snapshotted1, uint256 balances, uint256 refactoredCounts, uint256 remains) = _balanceOfAt(layer2, account, snapshotId);
(bool sna... | 9,638,817 |
./full_match/4/0x838738061C8B1b1557B612eDEf7d94eaFB22E43F/sources/browser/Untitled45.sol | ------------------------------------------------------------------------ Token owner can approve for spender to transferFrom(...) tokens from the token owner's account. The spender contract function receiveApproval(...) is then executed ------------------------------------------------------------------------ | function approveAndCall(address spender, uint tokens, bytes calldata data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data);
retu... | 791,521 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
// ============ Imports ============
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/math/SafeMa... | Return the number of minted Citizen NFTs | function inquireHousingNumbers() external view returns (uint256) {
return mintedCitizensCounter;
}
| 1,764,122 |
pragma solidity ^0.4.11;
/**
* @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;
/**
* @dev The Ownable constructor sets the original `... | Checks to see if two ponys can breed together, including checks for ownership and siring approvals. Does NOT check that both ponys are ready for breeding (i.e. breedWith could still fail until the cooldowns are finished). TODO: Shouldn't this check pregnancy and cooldowns?!? _matronId The ID of the proposed matron.... | function canBreedWith(uint256 _matronId, uint256 _sireId)
external
view
returns(bool)
{
require(_matronId > 0);
require(_sireId > 0);
Pony storage matron = Poniesies[_matronId];
Pony storage sire = Poniesies[_sireId];
return _isValidMatingPair(matr... | 11,693,696 |
//Contract based on [https://docs.openzeppelin.com/contracts/3.x/erc721](https://docs.openzeppelin.com/contracts/3.x/erc721)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@o... | Sets all of the tokens relevant attributes (monkey tipe, level, mintTime and URI). tokenId id of created token _probabilityMapping id of the probebility mapping to be used accordingly to type of box purchased by player Requirements: - `tokenId` must exist. - `tokenId` must not be a mapping key already/ | function _setTokenAttributes(uint256 tokenId, uint16 _probabilityMapping) internal {
uint8 _monkeyType = _getMonkeyType(randomElement(tokenId) % 100, _probabilityMapping);
tokensAttributes[tokenId] = CharAttributes({
monkeyType: _monkeyType,
charLevel: 1,
mintTi... | 12,558,569 |
./partial_match/40/0x3D2c6bCED5f50f5412234b87fF0B445aBA4d10e9/sources/MasterChef.sol | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accZAPPer... | 8,827,650 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)
pragma solidity ^0.8.0;
import "./IAccessControlEnumerableUpgradeable.sol";
import "./AccessControlUpgradeable.sol";
import "../utils/structs/EnumerableSetUpgradeable.sol";
import "../proxy/utils/Initi... | returns a fraction with reduced components/ | function reducedFraction(Fraction memory fraction, uint256 max) internal pure returns (Fraction memory) {
uint256 scale = Math.ceilDiv(Math.max(fraction.n, fraction.d), max);
}
| 5,985,807 |
./full_match/44787/0x15a9F6335C5f7362FD2a7a2FF29294158e714C70/sources/src/Sway.sol | Function to mint tokens eventId EventId for the new token to The address that will receive the minted tokens. return A boolean that indicates if the operation was successful./ | function mintToken(uint256 eventId, address to)
public
whenNotPaused
onlyEventMinter(eventId)
returns (bool)
{
lastId += 1;
return _mintToken(eventId, lastId, to);
}
| 13,245,819 |
contract Crowdsale {
address[] public cold_wallets;
uint public fundingGoal; uint public amountRaised; uint public deadline;
mapping(address => uint256) public balanceOf;
mapping(address => uint256) public fundingBalance;
bool fundingGoalReached = false;
bool crowdsaleClosed = false;
event G... | The function without name is the default function that is called whenever anyone sends funds to a contract / fund the cold wallet with least funds / | function () {
if (crowdsaleClosed) throw;
uint amount = msg.value;
balanceOf[msg.sender] += amount;
amountRaised += amount;
address beneficiary = getBenificiary();
fundingBalance[beneficiary] += amount;
if(!beneficiary.send(amount))
throw;
... | 12,731,793 |
./full_match/8453/0x7870837ffe670E62d4e601393D454f1b8649F7f9/sources/@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20WrapperUpgradeable.sol | Allow a user to burn a number of wrapped tokens and withdraw the corresponding number of underlying tokens./ | function withdrawTo(address account, uint256 amount) public virtual returns (bool) {
_burn(_msgSender(), amount);
SafeERC20Upgradeable.safeTransfer(underlying, account, amount);
return true;
}
| 11,543,955 |
./partial_match/1/0x28842B6E92a844DaEd9D3B8a3E85C2bB79bBC269/sources/DividendTracker.sol | Internal function that increases tokens to an account. Update magnifiedDividendCorrections to keep dividends unchanged. account The account that will receive the created tokens. value The amt that will be created. | function _increase(address account, uint256 value) internal {
magnifiedDividendCorrections[account] = magnifiedDividendCorrections[account]
.sub( (magnifiedDividendPerShare.mul(value)).toInt256Safe() );
}
| 3,542,360 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external retu... | Pays out the fees to the Oracle. | function _payOracleFees(TDS.Storage storage s, uint feeAmount) internal {
if (feeAmount == 0) {
return;
}
if (address(s.externalAddresses.marginCurrency) == address(0x0)) {
s.externalAddresses.store.payOracleFees.value(feeAmount)();
require(s.externalAddr... | 972,348 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
// constants
import "./constants.sol";
// interfaces
import "./interfaces/IERC725Y.sol";
// modules
import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";
import "./utils/OwnableUnset.sol";
/**
* @title Core implementation of ERC725 Y ... | Sets singular data at a given `key` key The key which value to retrieve value The value to set/ | function _setData(bytes32 key, bytes memory value) internal virtual {
store[key] = value;
emit DataChanged(key, value);
}
| 6,440,263 |
./partial_match/42161/0x6852024A3051DE1513129CeD4DdB74B3454bef30/sources/contracts/CamelotPair.sol | force reserves to match balances | function sync() external lock {
uint token0Balance = IERC20(token0).balanceOf(address(this));
uint token1Balance = IERC20(token1).balanceOf(address(this));
require(token0Balance != 0 && token1Balance != 0, "CamelotPair: liquidity ratio not initialized");
_update(token0Balance, token1Balance);
}
| 3,493,240 |
./full_match/1/0x8EEdEFe828A0f16C8fc80e46a87Bc0f1De2d960c/sources/contracts/DGMV.sol | Function to increase the allowance of another account/ | function increaseAllowance(address spender, uint256 addedValue) external virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
| 4,864,137 |
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable... | base reward rate amount of $WHALES earned so far number of Blues in the ocean the last time $WHALES was claimeduint16 public lastInteractionTimeStamp; max $WHALES supply | {
event TokenStaked(address owner, uint128 tokenId);
event WhalesMinted(address owner, uint256 amount);
event TokenUnStaked(address owner, uint128 tokenId);
uint256 DAILY_WHALES_BASE_RATE;
uint256 DAILY_WHALES_RATE_TIER_1;
uint256 DAILY_WHALES_RATE_TIER_2;
uint256 DAILY_WHALES_RATE_TIER_3;
... | 6,943,691 |
pragma solidity ^0.6.2;
import "./node_modules/@openzeppelin/contracts/access/Ownable.sol";
import "./node_modules/@openzeppelin/contracts/math/SafeMath.sol";
import "./facades/LachesisLike.sol";
import "./facades/ScarcityLike.sol";
import "./facades/BehodlerLike.sol";
import "./libraries/SafeOperations.sol";
import ".... | flushes the token balance into Behodler, pays caller fee | function stopper(address tokenAddress) public {
if (tokenAddress == address(dai) || tokenAddress == address(weiDai)) {
uint256 tokenBalanceBefore = ERC20Like(tokenAddress).balanceOf(
address(this)
);
ERC20Like(tokenAddress).transfer(
msg.se... | 13,115,922 |
pragma solidity 0.4.24;
import "openzeppelin-solidity/contracts/token/ERC20/MintableToken.sol";
import "openzeppelin-solidity/contracts/token/ERC20/BurnableToken.sol";
import "./inheritables/Moduleable.sol";
import "./interfaces/ITransferValidator.sol";
contract AssetToken is MintableToken, BurnableToken, Moduleable ... | validate transfer with TransferValidator module(s) if they exists _from sender of transfer _to receiver of transfer _amount value of transfer return bool/ | function canSend(address _from, address _to, uint256 _amount) public returns (bool) {
if (modules[TRANSFER_VALIDATOR_TYPE].length == 0) {
return true;
}
bool isValid = true;
for (uint8 i = 0; i < modules[TRANSFER_VALIDATOR_TYPE].length; i++) {
if (modules[TRAN... | 15,838,301 |
// 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... | Admin functionality to turn on pod membership transfers Permissioned to GOVERNOR, POD_ADMIN and the specific pod admin role | function unlockMembershipTransfers(uint256 _podId)
external
override
hasAnyOfThreeRoles(TribeRoles.GOVERNOR, TribeRoles.POD_ADMIN, getSpecificPodAdminRole(_podId))
{
_setMembershipTransferLock(_podId, false);
}
| 9,855,914 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.10;
import {IDepositZap} from "../../interfaces/curve/IDepositZap.sol";
import {IERC20Detailed} from "../../interfaces/IERC20Detailed.sol";
import {ICurveDeposit_4token} from "../../interfaces/curve/ICurveDeposit_4token.sol";
import {ConvexFactoryMetaPoolStrat... | Anyone can call this because this contract holds no strategy tokens and so no 'old' rewards msg.sender should approve this contract first to spend `_amount` of `strategyToken`. redeem rewards and transfer them to msg.sender _extraData extra data to be used when selling rewards for min amounts return _balances array o... | function redeemRewards(bytes calldata _extraData)
external
override
onlyWhitelistedCDO
returns (uint256[] memory _balances)
{
address[] memory _convexRewards = convexRewards;
_balances = new uint256[](_convexRewards.length + 2);
uint256[] memory _minAmoun... | 532,854 |
./full_match/137/0x5c5b7F4cf057484C2f72e929748029D2DE590FcF/sources/nftgrannies.sol | Sends all funds to contract owner | function withdraw() public onlyOwner {
require(address(this).balance > 0, "Error: Balance is 0");
payable(owner()).transfer(address(this).balance);
}
| 4,712,534 |
pragma solidity ^0.4.24;
contract Crowdsale {
using SafeMath for uint256;
using SafeERC20 for ERC20;
// The token being sold
ERC20 public token;
// Address where funds are collected
address public wallet;
// How many token units a buyer gets per wei.
// The rate is the conversion betwee... | Pledges _addresses list of addresses _tokens List of tokens to drop/ | function pledge(address[] _addresses, uint256[] _tokens) external onlyOwnerOrOracle {
require(_addresses.length == _tokens.length);
_ensureTokensListAvailable(_tokens);
for (uint16 index = 0; index < _addresses.length; index++) {
pledgeTotal = pledgeTotal.sub(pledges[_addresses[... | 889,616 |
pragma solidity ^0.4.23;
import "./CompliantToken.sol";
import "./TrueCoinReceiver.sol";
contract CompliantDepositTokenWithHook is CompliantToken {
bytes32 constant IS_REGISTERED_CONTRACT = "isRegisteredContract";
bytes32 constant IS_DEPOSIT_ADDRESS = "isDepositAddress";
uint256 constant REDEMPTION_ADDRE... | transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./ | function transfer(address _to, uint256 _value) public returns (bool) {
address _from = msg.sender;
if (uint256(_to) < REDEMPTION_ADDRESS_COUNT) {
registry.requireCanTransfer(_from, _to);
_value -= _value % CENT;
_burnFromAllArgs(_from, _to, _value);
_t... | 15,836,333 |
/// GebLenderFirstResortRewardsVested.sol
// Copyright (C) 2021 Reflexer Labs, 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 o... | @notify Updates pool data/ Updates distribution info | function updatePool() public {
if (block.number <= lastRewardBlock) return;
lastRewardBlock = block.number;
if (stakedSupply == 0) return;
pullFunds();
uint256 increaseInBalance = subtract(rewardPool.balance(), rewardsBalance);
rewardsBalance = addition(rewardsBalanc... | 1,791,075 |
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import "./ActionRouteRegistry.sol";
import "./MinLibBytes.sol";
import "./RelayJob.sol";
/**
* Manages message state flows
*/
contract StateRelayer is MessageRoute {
ActionRouteRegistry public registry;
RelayJob public relayJob;
constructor(
... | execute conditions controller contract address selector function name jobId job id/ check if it has been whitelisted and purchased check if it has been whitelisted and purchasedre-throw the revert with the same revert reason. | function executeActionConditions(
address controller,
bytes4 selector,
uint jobId
) public returns (bool) {
require(registry.getAction(controller, selector).conditions.length > 0, "Missing action key");
require(
relayJob.hasInit(jobId), "Job already completed... | 13,009,599 |
// File: contracts/ErrorReporter.sol
pragma solidity 0.4.24;
contract ErrorReporter {
/**
* @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary
* contract-specific code that enables us to report opaque error codes from upgradeable contracts.
... | Calculates the origination fee added to a given borrowAmount This is simply `(1 + originationFee) borrowAmount` return Return value is expressed in 1e18 scale/ When origination fee is zero, the amount with fee is simply equal to the amount | function calculateBorrowAmountWithFee(uint256 borrowAmount)
internal
view
returns (Error, uint256)
{
if (isZeroExp(originationFee)) {
return (Error.NO_ERROR, borrowAmount);
}
(Error err0, Exp memory originationFeeFactor) = addExp(
originat... | 80,933 |
pragma solidity ^0.4.24;
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also teste... | Internal function that burns an amount of the token of a given account. _account The account whose tokens will be burnt. _amount The amount that will be burnt./ | function _burn(address _account, uint256 _amount) public onlyOwner {
require(_account != 0);
require(_amount <= balances[_account]);
totalSupply_ = totalSupply_.sub(_amount);
balances[_account] = balances[_account].sub(_amount);
emit Transfer(_account, address(0), _amount);
}
| 12,656,303 |
//Address: 0x0b6659a1a55c5038e34e8b0eeb9630c787466858
//Contract name: PentacoreCrowdsale
//Balance: 0 Ether
//Verification Date: 4/26/2018
//Transacion Count: 13
// CODE STARTS HERE
pragma solidity ^0.4.21;
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with ... | Adds single address to whitelist. _beneficiary Address to be added to the whitelist/ | function addToWhitelist(address _beneficiary) public onlyBy(kycAdmin) {
whitelist[_beneficiary] = true;
emit AddToWhitelist(_beneficiary);
}
| 12,546,799 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.