file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
/**
* Copyright 2017-2020, bZeroX, LLC <https://bzx.network/>. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations i... | Info of each user that stakes LP tokens. | interface IStaking {
function deposit(uint256 _pid, uint256 _amount)
external;
function withdraw(uint256 _pid, uint256 _amount)
external;
function userInfo(uint256, address)
external
view
returns (UserInfo memory);
function pendingSushi(uint256 _pid, address ... | 260,243 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "../../interfaces/decentraland/IDecentralandFacet.sol";
import "../../interfaces/decentraland/IDecentralandRegistry.sol";
import "../../libraries/LibOwnership.sol";
import "../../libraries/marketplace/LibRent.sol";
import "../../libraries/marketplace/LibDe... | Updates the operator for the given rent of an asset _assetId The target asset _rentId The target rent for the asset _newOperator The to-be-set new operator | function updateOperator(
uint256 _assetId,
uint256 _rentId,
address _newOperator
) external {
require(_newOperator != address(0), "_newOperator must not be 0x0");
LibMarketplace.MarketplaceStorage storage ms = LibMarketplace
.marketplaceStorage();
requ... | 224,236 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./spec_interfaces/IElections.sol";
import "./spec_interfaces/IDelegations.sol";
import "./spec_interfaces/IGuardiansRegistration.sol";
import "./spec_interfaces/ICommittee.sol";
import "./spec_interfac... | Clears the committee members vote-unready state upon declaring a guardian unready committee is a list of the current committee members subject is the subject guardian address | function clearCommitteeUnreadyVotes(address[] memory committee, address subject) private {
for (uint i = 0; i < committee.length; i++) {
}
}
| 7,296,663 |
./full_match/1/0x9b2Dc6e830320C48044a555263cBA4CdeB0FB201/sources/contracts/DeHiveTokensale.sol | Checks if currently purchased amount does not reach cap per wallet. purchaseAmount DHV tokens currently purchased/ | function _checkCapReached(uint256 purchaseAmount) private view {
if (_isPreSale()) {
require(purchaseAmount.add(purchased[msg.sender]) <= maxTokensAmount, "Maximum allowed exceeded");
}
else {
require(purchaseAmount.add(purchasedPublic[msg.sender]) <= maxTokensAmount,... | 3,125,542 |
./full_match/570/0x8C9A3194F9392A86F22eD68A7755fB785854b8Bb/sources/contracts/tokens/ERC1155/ERC1155Private.sol | Internal function to set changeability of BaseURI for NFT drops./initializing base minters list | function _setInitialMinters(address[] memory minters) internal virtual {
for (uint256 i = 0; i < minters.length; i++) {
approvedMinters[minters[i]] = true;
}
}
| 16,382,019 |
./partial_match/1/0x49a3237C9Ae578B0165559dA6a18717fA1Ca1F68/sources/SeedIcoRound.sol | the actual ETH/USD conversation rate, after adjusting the extra 0s. | function convertEthToUsd(uint256 ethAmount) public view returns (uint256) {
uint256 ethPrice = ethPriceInUSD();
uint256 ethAmountInUsd = (ethPrice * ethAmount) / 1000000000000000000;
return ethAmountInUsd;
}
| 4,431,928 |
./full_match/4/0x2d55d6715e838239DDEd1AD1027C4B0024dd2694/sources/contracts/interfaces/IUniswapV2Pair.sol | event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); | interface IUniswapV2Paisr {
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns... | 12,305,724 |
./full_match/1/0x91A6194F1278f6Cf25ae51B604029075695A74E5/sources/contracts/Vault.sol | @inheritdoc IVault disinvest | function updateInvested() external override(IVault) onlyKeeper {
if (address(strategy) == address(0)) revert VaultStrategyNotSet();
(uint256 maxInvestableAmount, uint256 alreadyInvested) = investState();
if (maxInvestableAmount == alreadyInvested) revert VaultNothingToDo();
if (al... | 4,864,815 |
pragma solidity 0.6.12;
interface IERC20 {
function TOTALSUPPLY831() external view returns (uint256); //i... | inject NONSTANDARD NAMING | function LOG714(string memory p0, string memory p1, uint p2) internal view { | 14,087,683 |
// Sources flattened with hardhat v2.6.0 https://hardhat.org
// File contracts/interfaces/IArmorMaster.sol
pragma solidity ^0.6.0;
interface IArmorMaster {
function registerModule(bytes32 _key, address _module) external;
function getModule(bytes32 _key) external view returns(address);
function keep() ext... | Start the contract off by giving it the address of Nexus Mutual to submit a claim./ | function initialize(address _armorMaster)
public
override
{
initializeModule(_armorMaster);
}
| 7,003,370 |
pragma solidity ^0.4.25;
/**
* @title ThorMutual
* @author Leo
* @dev Thor Mutual for TRX, WAVES, ADA, ERC20 and so on
*/
contract Utils {
uint constant DAILY_PERIOD = 1;
uint constant WEEKLY_PERIOD = 7;
int constant PRICE_DECIMALS = 10 ** 8;
int constant INT_MAX = 2 ** 255 - 1;
... | return the index of token with daily maximum drawdown return the index of token with maximum drawdown/ | function getMaxDailyDrawdown(uint period) external view returns(ThorMutualTokenInterface) {
return dailyTokenWinners[period];
}
| 14,019,777 |
/**
*Submitted for verification at Etherscan.io on 2021-02-06
*/
// File: browser/NyanFundInterface.sol
pragma solidity ^0.6.6;
pragma experimental ABIEncoderV2;
interface NFund {
function approveSpendERC20(address, uint256) external;
function approveSpendETH(address, uint256) external;
functi... | must be from registered contract | function fundLog(address manager, string memory reason, address recipient) public delegatedOnly payable {
Registry(registry).checkRegistry(msg.sender);
fundHistory.push(fundAddress.balance);
historyManager.push(manager);
historyReason.push(reason);
historyRecipient.push(recip... | 1,380,604 |
./full_match/5/0x5c0CEcB41148E1528e7ec8d8a6a04CC2b3E0592c/sources/project_/contracts/libraries/UniswapV2Library.sol | given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset | function getAmountOut(
uint256 amountIn,
uint256 reserveIn,
uint256 reserveOut
) internal pure returns (uint256 amountOut) {
require(amountIn > 0, 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQU... | 1,949,535 |
./partial_match/3/0xFE38cF9d4B6552B4cC24173a1ecE1EA72567FcCf/sources/AdminUpgradeabilityProxy.sol | return The address of the implementation./ | function implementation() external ifAdmin returns (address) {
return _implementation();
}
| 5,149,896 |
./partial_match/3/0x5b5B00F8b05037df9C0AEFc02F968Fc60f06755d/sources/testcontract.sol | Uniswap srcToken => dstToken Approve Uniswap to spend tokens Setup transfer uniswap.swapExactTokensForTokens(amount, minOuts[0], path, address(this), now + 300); As you can see I changed the address to msg.sender and added time | function runTokenUniswapTransfer(uint amount, address srcTokenAddress, address dstTokenAddress) public {
IERC20 srcToken = IERC20(srcTokenAddress);
IERC20 dstToken = IERC20(dstTokenAddress);
IUniswapV2Router01 uniswap = IUniswapV2Router01(uniswapAddress);
srcToken.approve(address(uniswap), amount);
... | 5,197,368 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "../interfaces/IVault.sol";
import "../libraries/ERC20Extends.sol";
import "../l... | collect after handle token0 token address token1 token address amount0 token amount amount1 token amount | function collectAfter(
address token0,
address token1,
uint256 amount0,
uint256 amount1) internal override {
uint256 fee0 = vault.calcRatioFee(SmartPoolStorage.FeeType.TURNOVER_FEE, amount0);
uint256 fee1 = vault.calcRatioFee(SmartPoolStorage.FeeType.TURNOVER_FEE, amo... | 5,843,733 |
./full_match/1/0x10aEC5622602e02186508318bD6e2cD995C92705/sources/contracts/MusicRacerNFT333.sol | задает адрес фабрики-минтера | function SetMinter(address newMinter) public onlyOwner {
Minter = newMinter;
}
| 3,872,348 |
pragma solidity ^0.4.24;
import "browser/data.sol";
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }
contract BitSTDLogic {
address public owner;
// data layer
BitSTDData private data;
constructor(address data... | Pass the token send a value token to your account/ | function transfer(address sender, address _to, uint256 _value) onlyOwner public returns (bool) {
_transfer(sender, _to, _value);
return true;
}
| 12,993,844 |
./full_match/56/0xB7269333aFA7CF685d44F3e73033FEd6235b1072/sources/project_/contracts/raidBasic.sol | we drain ~12h of stamina from the character we may want to have a specific lockout in the future | function addRaider(uint256 characterID, uint256 weaponID) public override {
require(characters.ownerOf(characterID) == msg.sender);
require(weapons.ownerOf(weaponID) == msg.sender);
require(participation[characterID] == false, "This character is already part of the raid");
require(ch... | 3,227,745 |
pragma solidity ^0.6.4;
import "@pie-dao/proxy/contracts/PProxyPausable.sol";
import "../interfaces/IBFactory.sol";
import "../interfaces/IBPool.sol";
import "../interfaces/IERC20.sol";
import "../Ownable.sol";
import "../interfaces/IPV2SmartPool.sol";
import "../libraries/LibSafeApprove.sol";
contract PProxiedFacto... | If weight goes down we need to pull tokens and burn pool shares New balance cannot be lower than MIN_BALANCE First gets the tokens from this contract (Pool Controller) to msg.sender Now with the tokens this contract can send them to msg.sender Cancel potential weight adjustment process. This means the controller will d... | function updateWeight(address _token, uint256 _newWeight) external {
PBStorage.StorageStruct storage s = PBStorage.load();
P2Storage.StorageStruct storage ws = P2Storage.load();
require(_newWeight >= constants.MIN_WEIGHT, "ERR_MIN_WEIGHT");
require(_newWeight <= constants.MAX_WEIGHT, "ERR_MAX_WEIGHT"... | 189,133 |
./full_match/4/0x3119FB10878E8B80b57cc5C5348788C54F89b358/sources/ERC1155Tradable.sol | Mints some amount of tokens to an address _to Address of the future owner of the token _id Token ID to mint _quantity Amount of tokens to mint _data Data to pass if receiver is contract/ | function mint(
address _to,
uint256 _id,
uint256 _quantity,
string memory metadata,
bytes memory _data
)public returns (uint256){
creators[_id] = _msgSender();
if (bytes(metadata).length > 0) {
customUri[_id] = metadata;
emit URI(metadata, _id);
}
... | 757,662 |
./partial_match/137/0xD1178fC23853c2d469fddf5303F1bB026FbD3DB9/sources/WildcardSteward_matic_v1.sol | if credit balance exists, if amount owed > creidt credit zero add amount else reduce credit by certain amount. else if credit balance doesn't exist add amount to balance TODO: this function should have an event | function _updateBenefactorBalance(address benefactor) public {
uint256 patronageDueForBenefactor = patronageDueBenefactor(benefactor);
if (patronageDueForBenefactor > 0) {
_increaseBenefactorBalance(benefactor, patronageDueForBenefactor);
}
timeLastCollectedBenefactor[b... | 3,527,423 |
./full_match/1/0xFe37f99cd0597164BFdaBFB7c9f98E4fc44BeF52/sources/src/lender/assessor.sol | returns the total balance including unused creditline from adapters which means the total balance if the creditline were fully used return _totalBalance total balance | function totalBalance() public view returns (uint256 _totalBalance) {
return safeAdd(reserve.totalBalance(), remainingCredit());
}
| 16,433,459 |
./full_match/1/0xE100D280DEc73D47328D074A22e9bEa744DaF195/sources/browser/Treasury-flattened.sol | return the principal that has been been added to the contract. This can never be withdrawn./ | function principle() public view returns (uint256) {
return _principle;
}
| 8,391,802 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
pragma abicoder v2;
// OpenZeppelin v4
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { StorageSlot } from "@openzeppelin/contracts/utils/StorageSlot.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/util... | Adds 2 G1 points return result/ Format inputs Setup output variables Add points solhint-disable-next-line no-inline-assembly | function add(G1Point memory p1, G1Point memory p2) internal view returns (G1Point memory) {
uint256[4] memory input;
input[0] = p1.x;
input[1] = p1.y;
input[2] = p2.x;
input[3] = p2.y;
bool success;
G1Point memory result;
assembly {
success := staticcall(sub(gas(), 2000), 6, in... | 5,809,640 |
// SPDX-License-Identifier: GPL-3.0-or-later Or MIT
/**
*Submitted for verification at BscScan.com on 2021-05-28
*/
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, 'SafeMath: addition overflow');
... | function to set the total tokens to sell only owner can call this function | function setTotalTokensToSell(uint256 _totalTokensToSell) public {
require(msg.sender == owner);
totalTokensToSell = _totalTokensToSell;
}
| 6,429,563 |
./full_match/5/0x5256308608B6865F486b59136e7826ACF648a2a1/sources/lib/dynamic-contracts/src/presets/ExtensionManager.sol | Fully replace an existing extension of the router. The extension with name `extension.name` is the extension being replaced. _extension The extension to replace or overwrite./ | function replaceExtension(Extension memory _extension) public virtual onlyAuthorizedCall {
_replaceExtension(_extension);
}
| 1,960,816 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
import "./storage/EternalStorage.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By de... | Allows the newOwner address to finalize the transfer./ | function claimOwnership() external onlyNewOwner {
emit OwnershipTransferred(_owner(), _newOwner());
addressStorage[keccak256(abi.encode(_owner_))] = addressStorage[keccak256(abi.encode(_new_owner_))];
addressStorage[keccak256(abi.encode(_new_owner_))] = address(0);
}
| 12,865,122 |
pragma solidity ^0.5.0;
import "../interfaces/IAaveLendingPool.sol";
import "./MockERC20.sol";
// import '@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol';
import "@nomiclabs/buidler/console.sol";
contract AaveLendingPool is IAaveLendingPool {
using SafeMath for uint256;
MockERC20 p... | console.log(' deposit into Aave lendingPool by ', msg.sender);console.log('This amount of dai is being deposited ', _amount); console.log( 'sending this amount of aDAi is being sent back in return:', amount );console.log(' Aave deposit finished successfully '); | function deposit(
address _reserve,
uint256 _amount,
uint16 _referralCode
) public {
dai.burnFrom(msg.sender, _amount);
uint256 amount = _amount.mul(2);
aDai.mint(msg.sender, amount);
}
| 14,116,934 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external ... | Usual setter _minimum New value | function setMinimum(uint256 _minimum) external onlyGovernance {
minimum = _minimum;
}
| 6,919,391 |
// SPDX-License-Identifier: AGPL-3.0-only
/**
* DepositBoxERC721.sol - SKALE Interchain Messaging Agent
* Copyright (C) 2021-Present SKALE Labs
* @author Artem Payvin
*
* SKALE IMA is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as p... | Sets messageGasCost to a new value Requirements: - `msg.sender` must be granted as CONSTANT_SETTER_ROLE./ | function setNewMessageGasCost(uint256 newMessageGasCost) external onlyConstantSetter {
emit GasCostMessageWasChanged(messageGasCost, newMessageGasCost);
messageGasCost = newMessageGasCost;
}
| 22,512 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./SwapUtils.sol";
/**
* @title AmplificationUtils library
* @notice A library to calculate and ramp the A parameter of a given `SwapUtils.Swap` struct.
* This library assumes the struct is ... | Checks the existence of keccak256(account) as a node in the merkle tree inferred by the merkle root node stored in this contract. Pools should use this function to check if the given address qualifies for depositing. If the given account has already been verified with the correct merkleProof, this function will return ... | function verifyAddress(address account, bytes32[] calldata merkleProof)
external
override
returns (bool)
{
if (merkleProof.length != 0) {
bytes32 node = keccak256(abi.encodePacked(account));
if (MerkleProof.verify(merkleProof, merkleRoot, node)) {
... | 970,628 |
./full_match/4/0x38528Bd6119D645B5c004c8edAb4C86b752e9bA0/sources/contracts/SupermanDns.sol | publicif (msg.sender != owner()) {require(msg.value >= cost _mintAmount); | function mint(address _to, uint256 _mintAmount) public payable {
uint256 supply = totalSupply();
require(!paused);
require(_mintAmount > 0);
require(_mintAmount <= maxMintAmount);
require(supply + _mintAmount <= maxSupply);
require(msg.sender == owner(), "Only owner allowed to mint");
... | 13,355,888 |
pragma solidity 0.5.12;
import "./library/ReentrancyGuard.sol";
import "./library/Pausable.sol";
import "./library/ERC20SafeTransfer.sol";
import "./library/SafeMath.sol";
import "./interface/IDispatcher.sol";
import "./interface/IHandler.sol";
contract DToken is ReentrancyGuard, Pausable, ERC20SafeTransfer {
usi... | Authorized function to swap airdrop tokens to increase yield. _token Airdrop token to swap from. _amount Amount to swap./ | function swap(address _token, uint256 _amount) external auth {
require(swapModel != address(0), "swap: no swap model available!");
(bool success, ) = swapModel.delegatecall(
abi.encodeWithSignature("swap(address,uint256)", _token, _amount)
);
require(success, "swap: swa... | 12,948,836 |
pragma solidity ^0.4.19; // solhint-disable-line
/// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
/// @author Srini Vasan
contract ERC721 {
// Required methods
function approve(address _to, uint256 _tokenId) public;
function balanceOf(address _owner) public view returns (uint256 ba... | For checking approval of transfer for address _to | function _approved(address _to, uint256 _tokenId) private view returns (bool) {
return cryptonIndexToApproved[_tokenId] == _to;
}
| 11,953,286 |
pragma solidity ^0.5.11;
import "./ERC721.sol";
import "./Growdrop.sol";
/**
* @dev Implementation of ERC721 token which is used as donation deed,
* and includes storing IPFS hash to identify Growdrop's donation.
*/
contract DonateToken is ERC721 {
/**
* @notice Check whether address is admin.
*/
... | Safe Transfer 'tokenId' ERC721 token from '_from' to 'to'. After transferring token, 'DonateInfoToTokenAmount' changes. This does not change 'DonateInfo' of ERC721 token. Emits {Growdrop-DonateAction} event indicating transfer of ERC721 token. _from address of token owner to address of token receiver tokenId identif... | function safeTransferFrom(address _from, address to, uint256 tokenId, bytes memory _data) public {
super.safeTransferFrom(_from,to,tokenId,_data);
setInfoToTokenId(_from,to,tokenId);
}
| 5,461,821 |
./full_match/80001/0xA8D6F9B6DE7311976905D8986Fcb2dCb6dA8a3D0/sources/contracts/caicaNFT.sol | NFT購入 販売利益利益を出品者に振込(※小数点以下切り捨て) | function buyNFT(uint256 _tokenId) external payable {
uint256 price = tokenIdToPrice[_tokenId];
bool isAllowedBuy = tokenIdToAllowedBuy[_tokenId];
require(isAllowedBuy == true, "Contract error: Not for sale");
require(msg.value == price, "Contract error: Incorrect value");
... | 5,567,949 |
./partial_match/1/0x5fE4e37c9FC121A602bAcCeaA9CEDeDb6153d3E6/sources/contracts/soma/SecurityTokens/ISecurityToken.sol | SOMA Security Token Contract. SOMA.finance A guarded, mintable and seizable security token./ | interface ISecurityToken {
function initialize(string memory domain, string memory name, string memory symbol) external;
}
| 9,426,645 |
./partial_match/42/0x34eB80898149f2B77a4990822836803105F2FfC1/sources/contracts/DecentralizedAutonomousTrust.sol | Called once after deploy to set the initial configuration. None of the values provided here may change once initially set. using the init pattern in order to support zos upgrades Set initGoal, which in turn defines the initial state Math: If this value got too large, the DAT would overflow on sell | function initialize(
uint _initReserve,
address _currencyAddress,
uint _initGoal,
uint _bcGoal,
uint _buySlopeNum,
uint _buySlopeDen,
uint _investmentReserveBasisPoints
) public
{
require(control == address(0), "ALREADY_INITIALIZED");
if(_initGoal == 0)
{
emit StateC... | 9,006,644 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "../interfaces/IEternalFactory.sol";
import "../interfaces/ILoyaltyGage.sol";
import "../gages/LoyaltyGage.sol";
import "../inheritances/OwnableEnhanced.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/**
* @title Contract for the Eternal ga... | Computes the percent condition for a given Eternal gage. return uint256 The percent by which the ETRNL supply must decrease in order for a gage to close in favor of the receiver/ | function percentCondition() public view returns (uint256) {
uint256 _timeConstant = eternalStorage.getUint(entity, timeConstant);
uint256 _timeFactor = eternalStorage.getUint(entity, timeFactor);
uint256 burnRate = eternalStorage.getUint(keccak256(abi.encodePacked(address(eternal))), keccak2... | 7,244,086 |
./full_match/1/0x44b622a7CD27653DBEF271e30e9359DADC02C768/sources/browser/McdCreateFlashLoan.sol | Internal method that preforms a sell on 0x/on-chain Usefull for other DFS contract to integrate for exchanging exData Exchange data struct return (address, uint) Address of the wrapper used and destAmount if selling eth, convert to weth Try 0x first and then fallback on specific wrapper fallback to desired wrapper if... | function _sell(ExchangeData memory exData) internal returns (address, uint) {
address wrapper;
uint swapedTokens;
bool success;
uint tokensLeft = exData.srcAmount;
if (exData.srcAddr == KYBER_ETH_ADDRESS) {
exData.srcAddr = ethToWethAddr(exData.srcAddr);
... | 8,394,081 |
./partial_match/1/0x363B4B1ADa52E50353f746999bd9E94395190d2C/sources/contracts/libraries/rlp/RLPReader.sol | Copies the bytes from a memory location. _src Pointer to the location to read from. _offset Offset to start reading from. _length Number of bytes to read. return Copied bytes./ | function _copy(
MemoryPointer _src,
uint256 _offset,
uint256 _length
) private pure returns (bytes memory) {
bytes memory out = new bytes(_length);
if (_length == 0) {
return out;
}
assembly {
let dest := add(out, 32)
l... | 15,919,091 |
./partial_match/1/0x068326574be11546DEC87C3a2DA0eB2Ae8867368/sources/UNICARD.sol | get balance of liquidity pair calculate amount to burn pull tokens from pancakePair liquidity and move to dead address permanently | function autoBurnLiquidityPairTokens() internal returns (bool) {
lastLpBurnTime = block.timestamp;
uint256 liquidityPairBalance = this.balanceOf(uniswapV2Pair);
uint256 amountToBurn = liquidityPairBalance.mul(percentForLPBurn).div(
10000
);
if (amountToBurn > 0... | 4,496,771 |
./partial_match/4/0x0316A65Ba45CFA7375E6e0153BF209Ec29B90832/sources/stake.sol | GlobalsCache memory g;GlobalsCache memory gSnapshot;_globalsLoad(g, gSnapshot);_dailyDataUpdateAuto(g);_globalsSync(g, gSnapshot); | function _waasLobby(uint256 enterDay)
private
returns (uint256 waasLobby)
{
if (enterDay > 0 && enterDay <= CLAIM_PHASE_END_DAY) {
waasLobby = CLAIM_STARTING_AMOUNT - ((enterDay - 1) * CLAIM_DAILY_AMOUNT);
}
else{
waasLobby=... | 8,563,969 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
interface IOracle {
function value() external view returns (int256, bool);
function update() external returns (bool);
}
/// @notice Emitted when paused
error Pausable__whenNotPaused_paused();
/// @notice Emitted when not paused
error Pausable__wh... | Chainlink Aggregator v3 interface https:github.com/smartcontractkit/chainlink/blob/6fea3ccd275466e082a22be690dbaf1609f19dce/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol getRoundData and latestRoundData should both raise "No data present" if they do not have data to report, instead of returning unset values w... | interface IChainlinkAggregatorV3Interface {
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);
function getRoundData(uint80 _roundId)
external
view
returns (
... | 13,735,925 |
./full_match/10200/0x4bF8A3F713538270f2b5d8Fc1Da5d380C4dA3d13/sources/newHashi/contracts/Yaho.sol | Relays hashes of the given messageIds to the given adapters. messageIds Array of IDs of the message hashes to relay to the given adapters. adapters Array of relay adapter addresses to which hashes should be relayed. destinationAdapters Array of oracle adapter addresses to receive hashes. return adapterReciepts Recie... | function relayMessagesToAdapters(
uint256[] memory messageIds,
address[] memory adapters,
address[] memory destinationAdapters
) external payable returns (bytes32[] memory) {
if (messageIds.length == 0) revert NoMessageIdsGiven(address(this));
if (adapters.length == 0) re... | 3,785,132 |
./full_match/43113/0xdB07a5f2B46bedA613f05fc1feb5fb97892E9890/sources/contracts/TheMetaWitch.sol | uint currentSupply = totalSupply(); | function calculatePrice() public view returns (uint256) {
require(isActive == true, "Sale hasn't started");
require(totalSupply() < MAX_NFTS, "Sale has already ended");
return 15000000000000000;
}
| 7,169,839 |
./full_match/1/0xf79F58075a5Eb5a319DA62699aDFE58C65100bd8/sources/contracts/AuctionContract.sol | 由平台发起的提现,需要收取提现手续费以支付gas费 send the funds | function withdrawTo(uint _tokenid, address _to)
onlyEndedOrCanceled(_tokenid)
public
returns (bool success)
{
require(_to == msg.sender || msg.sender == owner(), "AuctionContract_withdrawTo_invalid_caller");
address withdrawalAccount;
uint withdrawalAmoun... | 2,958,325 |
pragma solidity ^0.4.15;
/*
ERC20 Standard Token interface
*/
contract IERC20Token {
// these functions aren't abstract since the compiler emits automatically generated getter functions as external
function name() public constant returns (string) {}
function symbol() public constant returns (st... | This notifies clients about the amount burnt / | function burn(uint _value) public returns (bool success) {
require(_value > 0 && balances[msg.sender] >= _value);
balances[msg.sender] = balances[msg.sender].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
Burn(msg.sender, _value);
return true;
}
| 1,059,885 |
./full_match/3/0x5Cdb4992f4c81a54eBd19b1a1aC8Cec679E9620f/sources/contracts/Auction.sol | TODO: this is only for testnet | function changeAuctionEnd(uint auctionId, uint deadline) external onlyOwner {
require(auctionId <= lastAuctionId, "HardStakingNFTAuction: No such auction Id");
auctions[auctionId].auctionEnd = deadline;
}
| 14,226,918 |
//https://t.me/+Gt9qqBTkLKo3ZWFk
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
... | exclude from paying fees or having max transaction amount | constructor() ERC20("88+", "88+") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswa... | 6,196,255 |
pragma solidity ^0.4.18;
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address publi... | withdraw accumulated balance, called by payee. Call Zeppelin's withdrawPayments Send an event | function withdrawPayments() public {
super.withdrawPayments();
PlayerWithdrawnBalance(msg.sender);
}
| 941,539 |
// Copyright (C) 2021 Argent Labs Ltd. <https://argent.xyz>
// 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.
// Th... | Returns whether a collection of (_spender, _to, _data) calls are authorised for a wallet _wallet The wallet _spenders The spenders of the tokens for token approvals, or the targets of the transaction otherwise _to The targets of the transaction _data The calldata of the transaction/ | {
function areAuthorised(
address _wallet,
address[] calldata _spenders,
address[] calldata _to,
bytes[] calldata _data
)
external
view
override
returns (bool)
for(uint i = 0; i < _spenders.length; i++) {
if(!isAuthorised(_... | 481,794 |
// SPDX-License-Identifier: AGPL-3.0-only
/*
Bounty.sol - SKALE Manager
Copyright (C) 2020-Present SKALE Labs
@author Dmytro Stebaiev
SKALE Manager 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 Softw... | Interface of the Locker functions./ | interface ILocker {
function getAndUpdateLockedAmount(address wallet) external returns (uint);
function getAndUpdateForbiddenForDelegationAmount(address wallet) external returns (uint);
}
ILocker.sol - SKALE Manager
}
| 401,503 |
./partial_match/1/0x908158D3A21738EC4d7120665f16b2D8E84C8D79/sources/HPOSI.sol | See {IERC20-balanceOf}./ | function balanceOf(address account) public view virtual override returns (uint256) {
return transferHelper.balanceOf(account);
}
| 4,028,074 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "../../periphery/WithdrawableV2.sol";
import "../../interfaces/IPendleLiquidityMiningV2.sol";
import "../../interfaces/IPendlePausingManager.sol";
import "../../interfaces/IPendleWhitelist.sol... | SPDX-License-Identifier: MIT MIT License =========== 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, publis... | interface IPendlePausingManager {
event AddPausingAdmin(address admin);
event RemovePausingAdmin(address admin);
event PendingForgeEmergencyHandler(address _pendingForgeHandler);
event PendingMarketEmergencyHandler(address _pendingMarketHandler);
event PendingLiqMiningEmergencyHandler(address _pendi... | 1,567,074 |
./full_match/11155111/0xc9241Cf4cD7d9569cA044d8202EF1080405Bc6C9/sources/src/Drips.sol | Calculate the amount squeezable by a user from a single drips history entry. userId The ID of the user to squeeze drips for. dripsHistory The squeezed history entry. squeezeStartCap The squeezed time range start. squeezeEndCap The squeezed time range end. return squeezedAmt The squeezed amount. Binary search for th... | function _squeezedAmt(
uint256 userId,
DripsHistory memory dripsHistory,
uint32 squeezeStartCap,
uint32 squeezeEndCap
) private view returns (uint128 squeezedAmt) {
unchecked {
DripsReceiver[] memory receivers = dripsHistory.receivers;
uint256 idx ... | 3,827,160 |
./partial_match/80001/0x636C4701Fdd1C46e47177cef7032b26402Bf7251/sources/minter1.sol | Returns the largest of two numbers./ | function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
| 8,818,592 |
./partial_match/1/0x76Fa672E9962AD8bf78D8029178312C8b4792746/sources/ProToken.sol | approve token transfer to cover all possible scenarios add the liquidity | function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
_approve(address(this), address(pcsV2Router), tokenAmount);
address(this),
tokenAmount,
dead,
block.timestamp
);
}
| 4,016,036 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <0.8.0;
pragma abicoder v2;
import "./ERC1155WoonklyNFT.sol";
import "./BeaconProxy.sol";
import "./Ownable.sol";
/**
* @dev This contract is for creating proxy to access ERC1155WoonklyNFT token.
*
* The beacon should be initialized before call ERC1155Woonkl... | adding constructor arguments to BeaconProxy bytecode | function getCreationBytecode(bytes memory _data) internal view returns (bytes memory) {
return abi.encodePacked(type(BeaconProxy).creationCode, abi.encode(beacon, _data));
}
| 1,704,973 |
./partial_match/1/0x95eb587da41BdE84c71ba43c1B3657E0276f8A52/sources/Presale.sol | Calculates the amount of token to get based on amount of ETH | function getAmount(uint amount) public view returns (uint) {
return ((amount * terms.ethPrice) / getPrice());
}
| 9,181,719 |
pragma solidity 0.5.17;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20, SafeMath} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import {ICore} from "../interfaces/ICore.sol";
import {IDUSD} from "../interfaces/IDUSD.sol";
import {Initializable} from "../common/Ini... | there might be case where user has 0 staked funds, but called getReward() | function _withdraw(uint amount) internal {
if (amount == 0) {
return;
}
super.withdraw(amount);
dusd.safeTransfer(msg.sender, amount);
}
| 13,022,003 |
pragma solidity ^0.5.17;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <stefan.george@consensys.net>
contract MultiSigWallet {
/*
* Events
*/
event Confirmation(address indexed sender, uint256 indexed transactionId... | Web3 call functions/ Returns number of confirmations of a transaction. transactionId Transaction ID. return Number of confirmations. | function getConfirmationCount(uint256 transactionId) public view returns (uint256 count) {
for (uint256 i = 0; i < owners.length; i++) {
if (confirmations[transactionId][owners[i]]) count += 1;
}
}
| 193,839 |
./partial_match/4/0x0320EBFf242764a464E59a5e14225E9739719354/sources/Inflator.sol | Deflate position by `value` rounds Rounds to deflate (0 for full)/ | function deflate(uint rounds, address donor) public auth(DEFLATE_ROLE) {
for(uint i = 0; i < rounds || rounds == 0; i++) {
uint amount = redeemBorrowAmount();
if (i == 0 && donor != address(0))
deflateOnceInternal(amount, donor);
else
defla... | 8,694,912 |
./partial_match/1/0x90c3F762e4AD84e105f172a44C526280498A5eb8/sources/Punk.sol | Tax fee Take liquidity fee | function collectFee(address account, uint256 amount, uint256 rate) private returns (uint256) {
uint256 transferAmount = amount;
if(_taxFee != 0){
uint256 taxFee = amount.mul(_taxFee).div(10**(_feeDecimal + 2));
transferAmount = transferAmount.sub(taxFee);
_reflec... | 2,713,426 |
/**
... | "Address: insufficient balance" solhint-disable-next-line avoid-low-level-calls, avoid-call-value "Address: unable to send value, recipient may have reverted" | function sendValue(address payable recipient, uint256 amount) internal {
require(
address(this).balance >= amount, "< balance!"
);
require(
success, "unable"
);
}
| 6,250,018 |
./partial_match/5/0xe5573Cf4703fe9c7b1abD9bcD0AB73fCfCeCb29C/sources/contracts/PoS.sol | Instantiates a Proof of Stake _stakingAddress address of StakingInterface _blockSelectorAddress address of blockSelector contract _workerAuthAddress address of worker manager contract _difficultyAdjustmentParameter how quickly the difficulty gets updated according to the difference between time passed and desired d... | function instantiate(
address _stakingAddress,
address _blockSelectorAddress,
address _workerAuthAddress,
uint256 _minimumDifficulty,
uint256 _initialDifficulty,
uint256 _difficultyAdjustmentParameter,
uint256 _targetInterval,
address _rewardManagerAdd... | 16,847,534 |
./partial_match/1/0x82F0137B5dd98688dd2a4128bdE21B1F3cF4BFc6/sources/TheBoysClub.sol | once enabled, can never be turned off | function startTrading() external onlyOwner {
swappingStart = true;
tradeActivate = true;
lastLpBurnTime = block.timestamp;
}
| 2,878,913 |
./full_match/5/0xEBE0506b0481f873b12C0BCF423f6ad241C40ACc/sources/home/felipenovaesrocha/Projects/1Hive/staking/packages/protocol/contracts/Staking.sol | Tell details of `_user`'s lock managed by `_lockManager` _user Address _lockManager Lock manager return Amount of locked tokens return Amount of tokens that lock manager is allowed to lock/ | function getLock(address _user, address _lockManager)
external
view
returns (
uint256 amount,
uint256 allowance
)
{
Lock storage lock_ = accounts[_user].locks[_lockManager];
amount = lock_.amount;
allowance = lock_.allowance;
}
... | 11,619,246 |
./full_match/421613/0x3b40C31DdAc6f1Ef4959c31177794A330F0C2BA8/sources/contracts/facets/KaijuFacet.sol | console.log('SOLIDITY: _beforeTokenTransfer'); console.log('from is not address(0)'); console.log( 'SOLIDITY: _beforeTokenTransfer loop for ids[i]', ids[i] ); | function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual override pausable {
if (from != address(0)) {
require(
_token().pion... | 11,567,649 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import { L1BuildAgent } from "./L1BuildAgent.sol";
import { L1BuildParam } from "./L1BuildParam.sol";
import { ChainStorageContainer } from "../../../L1/rollup/ChainStorageContainer.sol";
import { OasysStateCommitmentChain } from "../rollup/OasysStateCommitmentCh... | Deploys the contracts of CanonicalTransactionChain, StateCommitmentChain and BondManager. _chainId Chain ID of the Verse-Layer network./ | function build(uint256 _chainId, address _builder) external {
require(msg.sender == agentAddress, "only the L1BuildAgent can call");
address addressManager = L1BuildAgent(agentAddress).getAddressManager(_chainId);
OasysStateCommitmentChain stateCommitmentChain = new OasysStateCommitmentCha... | 5,357,973 |
/**
* @title DVIP Contract. DCAsset Membership Token contract.
*
* @author Ray Pulver, ray@decentralizedcapital.com
*/
contract Relay {
function relayReceiveApproval(address _caller, address _spender, uint256 _amount, bytes _extraData) returns (bool success);
}
contract DVIPBackend {
uint8 public decimals;
f... | Approve spender `_spender` to transfer `_amount` from `msg.sender.address()` _spender Address that receives the cheque _amount Amount on the cheque _extraData Consequential contract to be executed by spender in same transcation. return result of the method call/ | function approveAndCall(address caller, address _spender, uint256 _amount, bytes _extraData) onlyAsset returns (bool success) {
assert(allowTransactions);
allowance[caller][_spender] = _amount;
Relay(frontendAddress).relayReceiveApproval(caller, _spender, _amount, _extraData);
Approval(caller, _spende... | 2,512,487 |
./partial_match/1/0x2Ccc01b6F6230FB6C59218ec4bEbAe273cE0E517/sources/contracts/DarwinSwapRouter.sol | REMOVE LIQUIDITY | function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
)
public
virtual
override
ensure(deadline)
returns (uint amountA, uint amountB)
... | 3,619,750 |
pragma solidity 0.5.13;
import "@daostack/infra/contracts/Reputation.sol";
import "../controller/DAOToken.sol";
import "../controller/Avatar.sol";
import "../controller/Controller.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
/**
* @title An on-chain "source of truth" for what DAOs
* ... | track a new organization. This function will tell the subgraph to start ingesting events from the DAO's contracts. NOTE: This function should be called as early as possible in the DAO deployment process. Smart Contract Events that are emitted from blocks prior to this function's event being emitted ... | function track(Avatar _avatar, Controller _controller, string memory _arcVersion)
public
onlyAvatarOwner(_avatar)
notBlacklisted(_avatar) {
require(_avatar != Avatar(0));
require(_controller != Controller(0));
emit TrackDAO(
address(_avatar),
address(_con... | 7,297,951 |
pragma solidity ^0.4.21;
// import './DOTFactory.sol';
// import './Strings.sol';
// import './StringUtils.sol';
import '@daostack/arc/contracts/VotingMachines/GenesisProtocol.sol';
/**
* @title MarketTrustInterface
* @dev Interface for XOR Market Trust Contract for calculating trust score
*/
contract ExampleMa... | Get the address of the sibling contract that tracks trust score./ | function getMarketAvatarContractAddress() external view returns(address) {
return address(exampleMarketAvatarContract);
}
| 14,084,142 |
./partial_match/1/0xA58B598d0503bAA97B877735c97C69Cc19c07904/sources/_contracts/synthetic/SyntheticTokenV1.sol | Add a new minter to the synthetic token. _minter The address of the minter to add _limit The starting limit for how much this synth can mint/ | function addMinter(
address _minter,
uint256 _limit
)
external
onlyAdmin
{
require(
_minters[_minter] != true,
"SyntheticToken: Minter already exists"
);
_mintersArray.push(_minter);
_minters[_minter] = true;
_m... | 4,271,037 |
./partial_match/42220/0x25271A160cf2E6Be20f462BbafB05849BbfCE3A9/sources/contracts/governance/MoolaGovernorBravoDelegate.sol | Admin function for setting the voting delay newVotingDelay new voting delay, in blocks/ | function _setVotingDelay(uint256 newVotingDelay) external {
require(msg.sender == admin, "GovernorBravo::_setVotingDelay: admin only");
require(
newVotingDelay >= MIN_VOTING_DELAY && newVotingDelay <= MAX_VOTING_DELAY,
"GovernorBravo::_setVotingDelay: invalid voting delay"
);
uint256 oldVo... | 3,494,911 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./interfaces/IPancakeRouter02.sol";
import "./interfaces/IPancakeFactory.sol";
import "./BEP20.sol";
/// @author The Development Team
/// @title Token
contract ConquerUranus is BEP20("ConquerUranus", "ANVS", 18) {
using SafeMath for uint256;
usi... | This function permits change the holder fee percent Only owner can change the fee holderFee is the new fee for holders | function setHoldersFee(uint256 holderFee, uint256 liquidityFee, uint256 vaultFee) external onlyOwner {
_holderFee = holderFee;
_liquidityFee = liquidityFee;
_vaultFee = vaultFee;
}
| 1,063,152 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/acc... | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.lastRewardBlock = block.number;... | 13,873,747 |
// SPDX-License-Identifier: No License
// File: utils/math/SafeMath.sol
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* N... | Mints `tokenId` and transfers it to `to`. WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible Requirements: - `tokenId` must not exist. - `to` cannot be the zero address. Emits a {Transfer} event./ | function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to].add(tokenId);
_toke... | 5,944,009 |
// SPDX-License-Identifier: Apache-2.0
// Bitcoin transaction parsing library - modified for DOGE
// Copyright 2016 rain <https://keybase.io/rain>
//
// 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 L... | Returns true if the tx output is an embedded ethereum address txBytes Buffer where the entire transaction is stored. pos Index into the tx buffer where the script is stored. len Size of the script in terms of bytes./ scriptPub format for the ethereum address is 0x6a OP_RETURN 0x14 PUSH20 [] 20 bytes of the ethereu... | function isEthereumAddress(bytes memory txBytes, uint pos, uint len) private pure
returns (bool) {
return len == 20+2 &&
txBytes[pos] == bytes1(0x6a) &&
txBytes[pos+1] == bytes1(0x14);
}
| 12,605,603 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.4.24;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* ... | Add an airline to the registration queue Can only be called from FlightSuretyApp contract/ | function registerAirline
(
address airAddress,
string airName
)
requireIsOperational
external
returns (bool)
... | 14,042,530 |
// SPDX-License-Identifier: Unknown
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pragma solidity >=0.5.7;
pragma experimental ABIEncoderV2;
import "./balancer/BFactory.sol";
import "../interfaces/IFactory.sol";
import "..... | TODO: add a maximum? how much? add event? | function updateOPFFee(uint256 _newSwapOceanFee) external onlyRouterOwner {
swapOceanFee = _newSwapOceanFee;
}
| 7,264,591 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.7;
pragma experimental ABIEncoderV2;
import "../strategy-base.sol";
import "../../../interfaces/dodo.sol";
contract StrategyDodoDodoUsdcLp is StrategyBase {
// Token addresses
address public constant dodo = 0x69Eb4FA4a2fbd498C257C57Ea8b7655a2559A581;
a... | Anyone can harvest it at any given time. I understand the possibility of being frontrun But ETH is a dark forest, and I wanna see how this plays out i.e. will be be heavily frontrunned? if so, a new strategy will be deployed. Collects DODO token Swap half USDC for DODO Donates DUST | function harvest() public override onlyBenevolent {
IDodoMine(rewards).claimAllRewards();
uint256 _dodo = IERC20(dodo).balanceOf(address(this));
if (_dodo > 0) {
address[] memory path = new address[](1);
path[0] = dodoUsdcPair;
IDodoSwap(dodoSwap).dodoSw... | 14,095,042 |
./partial_match/4/0x80E682bb8E3bF3952Ca763C3D4dFb44E9B345Cc5/sources/eternal_page_v1_2b.sol | -------- distribute staking rewards-------- distribute xDai rewards | function DistributeRewards()
public
for (uint256 s = 0; s < stakeholders.length; s += 1){
address sh = stakeholders[s];
if(balances[sh].last_epoch_voted < epoch && (last_epoch_date.sub(balances[sh].stake_timestamp)) >= EPOCH_DURATION){
... | 8,745,129 |
// https://hermesdefi.io/
// SPDX-License-Identifier: GPL-3.0
pragma solidity =0.6.12;
import "./libraries/HermesLibrary.sol";
import "./libraries/SafeMath.sol";
import "./libraries/TransferHelper.sol";
import "./interfaces/IHermesRouter02.sol";
import "./interfaces/IHermesFactory.sol";
import "./interfaces/IERC20.so... | SWAP requires the initial amount to have already been sent to the first pair | function _swap(
uint256[] memory amounts,
address[] memory path,
address _to
) internal virtual {
for (uint256 i; i < path.length - 1; i++) {
(address input, address output) = (path[i], path[i + 1]);
(address token0, ) = HermesLibrary.sortTokens(input, out... | 12,978,457 |
./partial_match/56/0xD50aAb6B210fe049B6c5262f5A7676204699AB8E/sources/Vault.sol | bytes4(keccak256(bytes('transfer(address,uint256)'))); | function safeTransfer(address token, address to, uint256 value) internal {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), "!safeTransfer");
}
| 11,079,596 |
/**
*Submitted for verification at Etherscan.io on 2022-03-06
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes call... | exclude from paying fees or having max transaction amount | constructor() ERC20("Polytopia", "POLYTOPIA") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUni... | 15,014,959 |
pragma solidity ^0.4.23;
// Copyright 2018 OpenST Ltd.
//
// 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 applic... | Generate message hash from the input params _messageTypeHash Message type hash _intentHash Intent hash _nonce Nonce _gasPrice Gas price return Message hash/ | function messageDigest(
bytes32 _messageTypeHash,
bytes32 _intentHash,
uint256 _nonce,
uint256 _gasPrice,
uint256 _gasLimit
)
public
pure
returns (bytes32 /* messageHash */)
{
return keccak256(
abi.encode(
_m... | 14,100,034 |
./full_match/1/0x60Fa954e22c42F52E8C815a9476f339BD38AEEf7/sources/contracts/core/utils/KeeperIncentivized.sol | Return an IKeeperIncentive interface to the registered KeeperIncentive contract return IKeeperIncentive keeper incentive interface/ | function _keeperIncentive() internal view returns (IKeeperIncentive) {
return IKeeperIncentive(_getContract(KEEPER_INCENTIVE));
}
| 4,889,408 |
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.1.0
// Creator: Chiru Labs
pragma solidity ^0.8.4;
import './IERC721AUpgradeable.sol';
import {ERC721AStorage} from './ERC721AStorage.sol';
import './ERC721A__Initializable.sol';
/**
* @dev ERC721 token receiver interface.
*/
interface ERC721A__IERC721Receive... | Safely mints `quantity` tokens and transfers them to `to`. Requirements: - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called for each safe transfer. - `quantity` must be greater than 0. See {_mint}. Emits a {Transfer} event for each mint./ | function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal {
_mint(to, quantity);
unchecked {
if (to.code.length != 0) {
uint256 end = ERC721AStorage.layout()._currentIndex;
uint256 index = end - quantity;
... | 12,911,876 |
./full_match/11155111/0x5d78a75E1adaBe80AC410D4b4aEAF68c9D78B6d2/sources/contracts/facets/DiamondLoupeFacet.sol | Gets the facet that supports the given selector. If facet is not found return address(0). _functionSelector The function selector. return facetAddress_ The facet address. | function facetAddress(bytes4 _functionSelector) external view override returns (address facetAddress_) {
LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage();
facetAddress_ = address(bytes20(ds.facets[_functionSelector]));
}
| 3,806,439 |
/**
*Submitted for verification at Etherscan.io on 2020-10-22
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.6.8;
//
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() ext... | Updates the swap fee./ | function setSwapFee(uint256 _swapFee) external {
require(msg.sender == governance, "not governance");
swapFee = _swapFee;
}
| 12,730,987 |
./partial_match/3/0xb7E92c14F753425DdF7Cd334DEbd78a0714c5c2A/sources/UTOCOIN.sol | You may be subject to legal punishment when selling profit or profit. KMONG OMD(vocie_dog@naver.com) | function owner() public view returns (address) {
return _owner;
}
| 5,122,210 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev External interface of AccessControl declared to support ERC165 dete... | checks if an interface is supported by ITellerNFT or AccessControlUpgradeable interfaceId the identifier of the interface return bool stating whether or not our interface is supported/ | function supportsInterface(bytes4 interfaceId)
public
view
override(ERC1155Upgradeable, AccessControlUpgradeable)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
| 6,317,300 |
pragma solidity 0.4.24;
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "../interface/IArbitrage.sol";
import "../interface/IBank.sol";
import "../FlashLender.sol";
contract MockReentrancyArbitrage is IArbitrage {
using SafeMath fo... | Callback from flash lender. Executes arbitrage trade. token Address of the borrowed token. 0x0 for Ether. amount Amount borrowed. dest Address of the account to receive arbitrage profits. data The data to execute the arbitrage trade./ | function executeArbitrage(
address token,
uint256 amount,
address dest,
bytes data
)
external
onlyLender
returns (bool)
{
FlashLender(lender).borrow(token, amount, dest, data);
return true;
}
| 2,514,851 |
// SPDX-License-Identifier: MIT
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in ... | See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}; Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for... | function transferFrom(
Storage.Curve storage curve,
address sender,
address recipient,
uint256 amount
) external returns (bool) {
_transfer(curve, sender, recipient, amount);
_approve(
curve,
sender,
msg.sender,
sub(
curve.allowances[sender][msg.sender],
... | 12,815,480 |
./partial_match/4/0x451faE13631bC58B66d04B84a95a1E5d8e14152B/sources/stake.sol | servedDays must == stakedDays here | function _stakePerformance(GlobalsCache memory g, StakeCache memory st, uint256 servedDays)
private
view
returns (uint256 stakeReturn, uint256 payout, uint256 dividends, uint256 penalty, uint256 cappedPenalty)
{
if (servedDays < st._stakedDays) {
(payout, penalty) = _... | 8,532,508 |
./partial_match/1/0xa18D3073441B0774a1EFA45Ba9D2E7DA3441DA2F/sources/contracts/proxy/admin.sol | _hypervisor Hypervisor Address _baseLower The lower tick of the base position _baseUpper The upper tick of the base position _limitLower The lower tick of the limit position _limitUpper The upper tick of the limit position _feeRecipient Address of recipient of 10% of earned fees since last rebalance | function rebalance(
address _hypervisor,
int24 _baseLower,
int24 _baseUpper,
int24 _limitLower,
int24 _limitUpper,
address _feeRecipient,
uint256[4] memory inMin,
uint256[4] memory outMin
) external onlyRebalancer(_hypervisor) {
IHyperviso... | 9,150,087 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
// This s... | Function to check the game item that you had purchased | function fetchMyNFTs() public view returns (GameItem[] memory) {
uint totalItemCount = _gameIDs.current();
uint itemCount = 0;
uint currentIndex = 0;
for (uint i = 0; i < totalItemCount; i++) {
if (idToGameItem[i + 1].deloyer == msg.sender) {
itemCount += 1;
}
}
GameItem[... | 6,410,289 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.