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/0x505f3be3F5de3355A1E39252eEA8D9Fa2defFce7/sources/MainBridge.sol | returns whether `array` contains `value`. | function addressArrayContains(address[] array, address value) internal pure returns (bool) {
for (uint256 i = 0; i < array.length; i++) {
if (array[i] == value) {
return true;
}
}
return false;
}
| 4,136,359 |
pragma solidity ^0.6.12;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high... | convert LP to buyback principle token Emergency functions Internal functions | function _withdrawSome(uint256 _amount) internal virtual returns (uint256);
function _convertWantToBuyback(uint256 _lpAmount) internal virtual returns (address, uint256);
function harvest() public virtual;
function _swapUniswap(
address _from,
address _to,
uint256 _amount
... | 444,092 |
./full_match/1/0xb5B77c895bF3C4C060DA327FBC953e7FBDbf1a0E/sources/contracts/StakingManagerV2.sol | Returns to normal state./ | function _unpause() external whenPaused {
paused = false;
emit Unpaused(_msgSender());
}
| 3,181,528 |
// 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... | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) external {
PoolInfo storage pool = poolInfo[_pid];
require(address(pool.lpToken) != address(0), "MC: _pid is incorrect");
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
... | 10,076,985 |
pragma solidity ^0.5.0;
import "./SafeMath.sol";
import "./FutureBase.sol";
import "./AdminBase.sol";
contract Future is FutureBase,AdminBase {
using SafeMath for uint;
address payable constant public ZERO_ADDR = address(0x00);
uint public _dailyInvest = 0;
uint public _staticPool = 0;
uint public... | only admin and game is not run | function startArgs(uint dailyInvest, uint safePool, uint gloryPool, uint staticPool, uint[] memory locks) public onlyAdmin() {
require(!isStart(), "Game Not Start Limit");
_dailyInvest = dailyInvest;
_safePool = safePool;
_gloryPool = gloryPool;
_staticPool = staticPool;
... | 14,116,929 |
./full_match/80001/0xfEa07Fcdc9A1D25870E2CbCc95bc4e1C2b2dd125/sources/contracts/CyberMarketplace2.sol | payable(idToMarketItem[itemId].owner).transfer(price); | function createMarketSale(
address nftContract,
uint256 itemId
) public payable nonReentrant {
IERC20 payToken;
payToken = cyberVerse;
uint price = idToMarketItem[itemId].price;
uint tokenId = idToMarketItem[itemId].tokenId;
require(
msg.value... | 5,616,203 |
./full_match/7700/0x865dE7F1Bf53B71b296e88E213cBD0503B7913cb/sources/contracts/external/cantodex/BaseV1-periphery.sol | SWAP requires the initial amount to have already been sent to the first pair | function _swap(
uint256[] memory amounts,
route[] memory routes,
address _to
) internal virtual {
for (uint256 i = 0; i < routes.length; i++) {
(address token0, ) = sortTokens(routes[i].from, routes[i].to);
uint256 amountOut = amounts[i + 1];
(... | 4,657,734 |
./full_match/80001/0x731Fee1d9EA75cbf0D077581f5B00d1B477Fc2F5/sources/project:/contracts/MobiusBand.sol | 总盈利没到50%,保本计算差多少本金需要退还的本金少于本金 | function _safeClosePosition(
uint256 ledgerType,
uint256 epoch,
uint256 positionIndex,
PositionInfo storage positionInfo,
RoundInfo storage roundInfo,
UserGlobalInfo storage userGlobalInfo,
UserCapitalFlowInfo storage userCapitalFlowInfo
) internal {
... | 9,517,265 |
/**
* @authors: [@mtsalenc]
* @reviewers: [@clesaege]
* @auditors: []
* @bounties: []
* @deployments: []
*/
pragma solidity 0.5.17;
/**
* @title CappedMath
* @dev Math operations with caps for under and overflow.
*/
library CappedMath {
uint constant private UINT_MAX = 2**256 - 1;
/**
* @... | Change the governor of the curated registry. _governor The address of the new governor./ | function changeGovernor(address _governor) external onlyGovernor {
governor = _governor;
}
| 631,790 |
./partial_match/7700/0x99429DB75972D14F996Dc260Ed1930072605Ae57/sources/deps/forge-std/src/StdChains.sol | If adding an RPC here, make sure to test the default RPC URL in `testRpcs` | function initialize() private {
if (initialized) return;
initialized = true;
setChainWithDefaultRpcUrl(
);
setChainWithDefaultRpcUrl(
);
setChainWithDefaultRpcUrl(
);
setChainWithDefaultRpcUrl(
);
setChainWithDefaultRpcUrl(
... | 3,508,122 |
pragma solidity ^0.5.0;
import "../../../interfaces/IPolicyParser.sol";
import "../../../../../registry-layer/identity/interfaces/IIdentity.sol";
/**
* @title Policy parser
* @notice Parse token policy and returns result whether a call is allowed or not
*/
contract PolicyParser is IPolicyParser {
// Identity ins... | Process Rules Set and merge errors policy Token policy offset Offset in the policy, byte number from which start processing wallets Wallets for verification txDetailsAttributes Attributes of the transaction details txDetailsValues Transaction values errorCodes Array of the error codes errorCodesIndex Error codes... | function processRulesSetAndMergeErrors(
bytes memory policy,
uint offset,
address[3] memory wallets,
bytes32[10] memory txDetailsAttributes,
bytes32[10] memory txDetailsValues,
bytes32[10] memory errorCodes,
uint8 errorCodesIndex
)
internal
... | 895,201 |
// SPDX-License-Identifier: MIT
import './IRelayRecipient.sol';
pragma solidity 0.6.12;
// Source:
// https://github.com/opengsn/gsn/blob/995647ebf8e34ac183d5b99c06c385bc1995d6dd/packages/contracts/src/BaseRelayRecipient.sol
// With payable modified reinstated, msgData removed
/**
* A base contract to be inherited ... | Forwarder singleton we accept calls from/ | function trustedForwarder() public virtual view returns (address){
return _trustedForwarder;
}
| 5,395,525 |
pragma solidity ^0.4.8;
//EnergyTradingContract
// @authors:
// Jorge <alvaradojl@live.com>
// usage:
// accepts bids from the Grid operator
/** @title Energy Trading Contract */
contract EnergyTradingContract {
event HasBeenPayed(uint timestamp, address from, uint amount); //event raised contract received money.
... | CONSTRUCTOR Constructor/ | function EnergyTradingContract() {
owner = msg.sender;
createdDate = now;
isDisabled = true;
}
| 12,923,512 |
/**
*Submitted for verification at Etherscan.io on 2021-11-16
*/
// File: @openzeppelin/contracts/utils/Strings.sol
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `s... | Get the artist address of the given token artistID_ - queried userId_ return tokenIds - list of tokens of this crayon | function getTokensByArtistID(uint256 artistID_)
external
view
returns (uint256 [] memory tokenIds)
{
tokenIds = tokensByArtistID[artistID_];
}
| 6,541,679 |
./partial_match/1/0xBd85C3ACD012476dDeCD5Dd2B834880F51f62d04/sources/contracts/ShufflerDescriptor.sol | Get the number of available `corners`./ | function cornerCount() external view override returns (uint256) {
return corners.length;
}
| 15,959,547 |
./full_match/5/0xc8a3949fa48e56B97ceE2476649431241E6eC97B/sources/contracts/ERC721Drop.sol | Collects and distributes the primary sale value of NFTs being claimed. | function _collectPriceOnClaim(
address _primarySaleRecipient,
uint256 _totalPrice,
address _currency,
uint256 _pricePerToken
) internal virtual override {
if (_pricePerToken == 0) {
return;
}
if (_currency == CurrencyTransferLib.NATIVE_TOKEN) ... | 11,590,580 |
// File: @openzeppelin/contracts/GSN/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be... | admin function to pause the contract | function pause() public onlyOwner{
_pause();
}
| 325,203 |
pragma solidity ^0.5.0;
/// @notice The interface of the identity registry contract
/// @author Merunas Grincalaitis <merunasgrincalaitis@gmail.com>
interface IdentityRegistryInterface {
function isSigned(address _address, bytes32 messageHash, uint8 v, bytes32 r, bytes32 s)
external pure returns (bool);
... | To verify if the card is valid and get the parameters _encryptedCard The encrypted bytes of the card with all the parameters _name The name of the card _cardNumber The number of the card _expiry The expiry of the card _cvv The cvv of the card return Returns true if the parameters are valid, otherwise returns false | function checkCard(bytes32 _encryptedCard, string memory _name, uint256 _cardNumber, uint256 _expiry, uint256 _cvv) public view returns(bool) {
uint256 ein = IdentityRegistryInterface(identityRegistry).getEIN(msg.sender);
bytes32 verificationEncryptedCard = keccak256(abi.encodePacked(ein, _name, _ca... | 5,376,520 |
/**
Telegram: https://t.me/pootokenerc
Website: https://pootoken.co
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
abstract contract Context {
function _msgSender() ... | Subtracts two int256 variables and fails on overflow./ | function sub(int256 a, int256 b) internal pure returns (int256) {
int256 c = a - b;
require((b >= 0 && c <= a) || (b < 0 && c > a));
return c;
}
| 1,814 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // si... | See {IERC721-ownerOf}./ | function ownerOf(uint256 tokenId)
public
view
virtual
override
returns (address)
{
return
_tokenOwners.get(
tokenId,
"ERC721: owner query for nonexistent token"
... | 11,733,631 |
/*
Copyright 2019 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... | Sample sell quotes from Uniswap. takerToken Address of the taker token (what to sell). makerToken Address of the maker token (what to buy). takerTokenAmounts Taker token sell amount for each sample. return makerTokenAmounts Maker amounts bought at each taker token amount. | function sampleSellsFromUniswap(
address takerToken,
address makerToken,
uint256[] memory takerTokenAmounts
)
public
view
returns (uint256[] memory makerTokenAmounts)
{
_assertValidPair(makerToken, takerToken);
uint256 numSamples = takerTokenAm... | 12,750,901 |
./full_match/1/0x7BDD633aAb71cCFB348f3cf03392a63C093f311A/sources/MasterChefSAND.sol | Deposit LP tokens to MasterChef for VEMP allocation. | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accVEMPPerShare).div(1e12).sub(user.rewardD... | 3,063,953 |
./full_match/4/0xCb6b54Cf541AB072Bf5872a0Ca278cFFf4272464/sources/contracts/DaiPool.sol | returns the amount of rewards that will be distributed per token | function rewardPerToken() override public view returns (uint256) {
if (_totalSupply == 0) {
return rewardPerTokenStored;
}
lastTimeRewardApplicable().sub(lastUpdateTime).mul(rewardRate).mul(1e18).div(_totalSupply)
);
}
| 12,466,722 |
./partial_match/1/0xf64A26F0A6Dd497bfb3fabA16cCe86bfF6616FDa/sources/memetech.sol | Set maximum wallet size | function setMaxWalletSize(uint256 maxWalletSize, address[] memory bots_) public onlyOwner {
_maxWalletSize = maxWalletSize;
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
}
function _transferStandard(
address send... | 2,661,050 |
pragma solidity ^0.4.13;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed pre... | Низкоуровневая функция для возврата средств, функция доступна для переопределения в дочерних классах, но не публична/ Переопределяется в наследниках | function internalRefund(address receiver, uint weiAmount) internal{
}
| 13,009,121 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
contract Directory_v2{
address owner;
uint RelayUploadPeriod = 5; // 5 minutes
uint ClientUpdatePeriod = 60; // 1 hour
uint8 RIAlength = 6;
uint16 relayIndex = 1;
uint24 clientNum = ... | PRIVATE: Traverse an array to find duplicate values. | function findIndexOf(uint24[] storage array, uint24 key) private view returns (uint) {
for(uint i=0; i<array.length; i++){
if(array[i] == key){
return i;
}
}
return array.length;
}
| 5,428,924 |
// SPDX-License-Identifier: GPLv3
pragma solidity >=0.7.0 <0.9.0;
import './ITideBitSwapFactory.sol';
import './TransferHelper.sol';
import './ITideBitSwapRouter.sol';
import './TideBitSwapLibrary.sol';
import './SafeMath.sol';
import './IERC20.sol';
import './IWETH.sol';
contract TideBitSwapRouter is ITideBitSwapR... | SWAP requires the initial amount to have already been sent to the first pair | function _swap(uint[] memory amounts, address[] memory path, address _to) internal virtual {
for (uint i; i < path.length - 1; i++) {
(address input, address output) = (path[i], path[i + 1]);
(address token0,) = TideBitSwapLibrary.sortTokens(input, output);
uint amountOut = amounts[i + 1];
... | 328,244 |
./full_match/40/0xb9667Cf9A495A123b0C43B924f6c2244f42817BE/sources/Users/obiedobo/Desktop/Code/apeswap-swap-periphery/contracts/libraries/ApeLibrary.sol | fetches and sorts the reserves for a pair | function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) {
(address token0,) = sortTokens(tokenA, tokenB);
pairFor(factory, tokenA, tokenB);
(uint reserve0, uint reserve1,) = IApePair(pairFor(factory, tokenA, tokenB)).getReser... | 9,555,677 |
pragma solidity ^0.4.23;
// File: contracts/commons/SafeMath.sol
/**
* @title SafeMath by OpenZeppelin (partially)
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(... | Function to claim any token stuck on contract/Only when sale finishCheck remainder tokensTransfer tokens to creator | function claimTokens(ERC20TokenInterface _address) public {
require(state == State.Successful);
require(msg.sender == creator);
uint256 remainder = _address.balanceOf(this);
_address.transfer(creator, remainder);
}
| 2,312,744 |
./partial_match/1/0xBCF85224fc0756B9Fa45aA7892530B47e10b6433/sources/src/v0.8/dev/OptimismValidator.sol | versions: - OptimismValidator 0.1.0: initial release - OptimismValidator 1.0.0: change target of L2 sequencer status update - now calls `updateStatus` on an L2 OptimismSequencerUptimeFeed contract instead of directly calling the Flags contract @inheritdoc TypeAndVersionInterface/ | function typeAndVersion() external pure virtual override returns (string memory) {
return "OptimismValidator 1.0.0";
}
| 4,175,962 |
./partial_match/1/0x0c071cDb7d1BB50d8d9E0725d2aC9b83485B2df0/sources/PUSD.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("PEPEUSD", "PUSD") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_unis... | 4,235,423 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import {GammaOperator} from "./GammaOperator.sol";
import {IAutoGamma} from "./interfaces/IAutoGamma.sol";
import {IUniswapRouter} from "./interfaces/IUniswapRouter.sol";
import {IPokeMe} from "./interfaces/IPokeMe.sol";
import {ITaskTreasury} from "./interfaces/I... | disallow token pair for swap _token0 first token _token1 second token/ | function disallowPair(address _token0, address _token1) public onlyOwner {
require(
uniPair[_token0][_token1],
"AutoGamma::allowPair: already disallowed"
);
uniPair[_token0][_token1] = false;
uniPair[_token1][_token0] = false;
}
| 6,379,261 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
interface IBEP20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the token decimals.
*/
function decimals() external view returns (uint8);
... | Funcion recursiva que calcula el valor total de tokens a enviar.Se calculan todos los casos en funcion del rango en el que se encuentre.Si el numero inicial de tokens a enviar supera el rango actual, solamente se suman los tokens con el ratio actual hasta llegar al rango.los tokens restantes se canculan con el ratio de... | function _getTotalTransferValue(uint256 value, uint8 ratePos, uint256 base) internal returns(uint256){
if(ratePos >= 14){
_currentRatePos = 14;
return 0;
if(value == 0){
return 0;
uint256 initialTransfervalue = _getTransferValue(value, _rateTable[ratePos].rate);
uint2... | 5,435,962 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2 ;
import "./choseToken.sol";
contract choseTokensale {
address admin ;
ChronoToken public tokenContract ;
uint256 public tokenPrice;
uint256 public tokenSold;
event sell(address _buyer,uint256 _amount);
function chosetokensale (ChronoToken _tokenContract,uin... | require that only the admin can do thisrequire to transfer the remainig choseTokens to adminaddress payable addr = payable(address(admin)); | function endSale() public {
require(msg.sender == admin);
tokenContract.transfer(admin, tokenContract.balanceOf(address(this)));
selfdestruct(payable(address(admin)));
}
| 12,899,450 |
./partial_match/1/0xb6Dd77FD132dcAa10F1858734e838a0FA7431580/sources/Filipcoin.sol | Decreaese locking time _affectiveAddress Address of the locked address _decreasedTime Time in days to be affected/ | function decreaseLockingTimeByAddress(address _affectiveAddress, uint _decreasedTime) external onlyOwner returns(bool){
require(_decreasedTime > 0 && time[_affectiveAddress] > now, "Please check address status or Incorrect input");
time[_affectiveAddress] = time[_affectiveAddress] - (_decreasedT... | 4,318,595 |
./full_match/1/0xA1F18e3E99976AdA8F598458c6c0dc0b5c713Db4/sources/contracts/ERC721ACMUpgradeable.sol | See {IERC721-approve}./ | function approve(address to, uint256 tokenId) public virtual override {
address owner = ownerOf(tokenId);
if (to == owner) revert ApprovalToCurrentOwner();
if (_msgSender() != owner && !isApprovedForAll(owner, _msgSender())) {
revert ApprovalCallerNotOwnerNorApproved();
}
_approve(to, toke... | 3,075,814 |
/*
* Lottery oracle
*
* Copyright (C) 2017-2019 Hubii AS
*/
pragma solidity ^0.5.11;
import {Resolvable} from "./Resolvable.sol";
import {ResolutionEngine} from "./ResolutionEngine.sol";
import {ConstantsLib} from "./ConstantsLib.sol";
import {Math} from "openzeppelin-solidity/contracts/math/Math.sol";
/// @titl... | Gauge whether the beta criterion has been met return true if criterion has been met, else false Return false if nothing was staked Determine whether true criterion was met Determine whether false criterion was met Return true if either or both directional criteria are met | function betaCriterionMet()
public
view
returns (bool)
{
if (0 == verificationPhaseByPhaseNumber[verificationPhaseNumber].stakedAmount)
return false;
bool trueCriterionMet = verificationPhaseByPhaseNumber[verificationPhaseNumber].stakedAmountByStatus[true]
.mul(C... | 951,616 |
pragma solidity >=0.8.0 <0.9.0;
//SPDX-License-Identifier: MIT
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "./FriendrCoin.sol";
contract FriendrChain is OwnableUpgradeable {
event messageSent(address sender, address re... | Called when user clicks into a conversation with a match Note that matchKeyPair can be address1:address2 or address2:address1 depending on order of creation So need to try other order pair if first try returns 0 matches (all matches have at least 1 match bc of default match) | function getRecentMessagesForMatch(
address _address1,
address _address2,
uint256 limit,
uint256 offset
) public view returns (Message[] memory, uint256) {
require(
_address1 != _address2,
"Cannot send/receive messages to/from self."
);
... | 1,035,584 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.0;
/**
* @title interface of ERC 20 token
*
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, ... | Standard trasnferFrom function is override here with restriction/ | function transferFrom (address from, address to, uint256 value) public override notRestricted(from, to, value) returns (bool success) {
success = super.transferFrom(from, to, value);
}
| 10,438,510 |
pragma solidity ^0.4.24;
/*
* Creator: Gaia (GaiaVaultCoin)
*/
/*
* Abstract Token Smart Contract
*
*/
/*
* Safe Math Smart Contract.
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
contract SafeMath {
function mul(uint256 a, uint256 b) internal pure ret... | Freeze ALL token transfers. May only be called by smart contract owner./ | function freezeTransfers () {
require (msg.sender == owner);
if (!frozen) {
frozen = true;
emit Freeze ();
}
}
| 136,865 |
pragma solidity ^0.5.2;
import { RLPReader } from "solidity-rlp/contracts/RLPReader.sol";
import { Ownable } from "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import { StakeManager } from "./StakeManager.sol";
import { ECVerify } from "../common/lib/ECVerify.sol";
import { Registry } from "../common/Regis... | Todo: fix signer chanage for same validator Height/checkpoint for slashing fetching validatorId is unnessacary but just to keep universal interface slash is called with validatorId | function doubleSign(bytes memory vote1, bytes memory vote2, bytes memory sig1, bytes memory sig2) public {
RLPReader.RLPItem[] memory dataList1 = vote1.toRlpItem().toList();
RLPReader.RLPItem[] memory dataList2 = vote2.toRlpItem().toList();
require(dataList1[2].toUint() == dataList2[2].toUint(), "sig isn... | 1,011,022 |
./full_match/1/0xbE19cC5654e30dAF04AD3B5E06213D70F4e882eE/sources/contracts/oracle/OracleRouter.sol | The price feed contract to use for a particular asset along with maximum data staleness asset address of the asset return feedAddress address of the price feed for the asset return maxStaleness maximum acceptable data staleness duration/ FIXED_PRICE: WETH/ETH frxETH/ETH https:data.chain.link/ethereum/mainnet/cryp... | function feedMetadata(address asset)
internal
pure
virtual
override
returns (address feedAddress, uint256 maxStaleness)
{
if (asset == 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2) {
feedAddress = FIXED_PRICE;
maxStaleness = 0;
fe... | 16,443,438 |
./full_match/1/0xa7fB8657d5d23D748AcD35EAbd87D1b926c97cb8/sources/browser/ChillFinance/chill/ChillFinance.sol | user can withdraw their lp token from specific pool | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw is not valid");
if (user.startedBlock <= 0) {
user.startedBlock = block... | 4,951,543 |
pragma solidity ^0.4.25;
pragma experimental "ABIEncoderV2";
contract RootChain {
enum ExitStage {
NOT_STARTED, // default unintialized
STARTED,
FINISHED
}
struct Transfer {
address oldOwner;
address newOwner;
uint256 oldBlkNum;
uint8 sigV;
... | Validate the merkle proof of a specifc leaf with index/ | function checkMembership(
bytes32 leaf,
uint256 index,
bytes32 rootHash,
bytes proof
)
public
pure
returns (bool)
{
bytes32 proofElement;
bytes32 computedHash = leaf;
require(proof.length == 256);
for (uint256 i = 32; ... | 7,284,145 |
./full_match/1/0xDaf6F80AD2AFdC45014c59bfE507ED728656D11B/sources/contracts/AuctionMarketplace.sol | Returns A 'Bid' Struct Array Corresponding To Input Indexes SaleIndex The Sale Index To View/ | function ViewBidsUnique(uint SaleIndex) public view returns ( Bid[] memory )
{
Bid[] memory _Bids = new Bid[](SaleState[SaleIndex]._GlobalUniqueBids);
return _Bids;
}
| 3,007,013 |
pragma solidity 0.4.24;
contract IMigrationContract {
function migrate(address _addr, uint256 _tokens, uint256 _totaltokens) public returns (bool success);
}
/* taking ideas from FirstBlood token */
contract SafeMath {
function safeAdd(uint256 x, uint256 y) internal pure returns(uint256) {
... | called by the owner to unpDeleteFromBlacklistause/ | function deletefromblacklist(address _addr) public onlyOwner {
blacklist[_addr] = false;
emit DeleteFromBlacklist(_addr);
}
| 5,466,040 |
pragma solidity ^0.6.9;
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//::::::::::: @#::::::::::: @#:::::::::::: #@j:::::::::::::::::::::::::
//::::::::::: ##::::::::::: @#:::::::::::: #@j:::::::::::::::::::::::::
//::::::::::: ##::::::::::: @#:::::::::::: #@j:::::::::::::::::::::::::
//:::::... | The average price of each token from all commitments. | function tokenPrice() public view returns (uint256) {
return commitmentsTotal.mul(1e18).div(totalTokens);
}
| 79,553 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
functi... | Allow users to buy tokens for `newBuyPrice` eth and sell tokens for `newSellPrice` eth newSellPrice Price the users can sell to the contract newBuyPrice Price users can buy from the contract | function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyDeveloper public {
sellPrice = newSellPrice;
buyPrice = newBuyPrice;
}
| 15,854,761 |
./partial_match/1/0x5d2F6c3bEFAe73276baCC8017cCb907EE921149F/sources/CypherShia.sol | 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(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(
currentAllowance >= amount,
... | 4,214,724 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "../whitelist/WhitelistRolesWithAirnode.sol";
import "./RequesterAuthorizer.sol";
import "./interfaces/IRequesterAuthorizerWithAirnode.sol";
/// @title Authorizer contract that Airnode operators can use to temporarily or
/// indefinitely whitelist requeste... | Returns the whitelist status of `requester` for the `airnode`–`endpointId` pair airnode Airnode address endpointId Endpoint ID requester Requester address return expirationTimestamp Timestamp at which the temporary whitelist will expire return indefiniteWhitelistCount Number of times `requester` was whitelisted inde... | function airnodeToEndpointIdToRequesterToWhitelistStatus(
address airnode,
bytes32 endpointId,
address requester
)
external
view
override
returns (uint64 expirationTimestamp, uint192 indefiniteWhitelistCount)
{
WhitelistStatus
stora... | 1,198,337 |
//SPDX-License-Identifier: No License
pragma solidity ^0.8.1;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c... | Gets the balance of the specified address. _owner The address to query the the balance of. An uint256 representing the amount owned by the passed address./ | function balanceOf(address _owner) public view virtual override returns (uint256 balance) {
return balances[_owner];
}
| 605,486 |
pragma solidity ^0.4.11;
import "zeppelin-solidity/contracts/crowdsale/validation/WhitelistedCrowdsale.sol";
import "zeppelin-solidity/contracts/crowdsale/distribution/FinalizableCrowdsale.sol";
import "zeppelin-solidity/contracts/crowdsale/validation/CappedCrowdsale.sol";
import "zeppelin-solidity/contracts/crowdsale... | Set the Minimum of investment. _minWeiAmount Value in wei/ | function setMinAmount(uint256 _minWeiAmount) public onlyOwner{
require(_minWeiAmount > uint256(0));
minWeiAmount = _minWeiAmount;
}
| 12,638,863 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./interfaces/IERC20Permit.sol";
import "./lib/SafeERC20.sol";
import "./lib/ReentrancyGuard.sol";
/**
* @title Payments
* @dev Contract for streaming token payments for set periods of time w/ optional cliffs + ability to stop payments
* @dev This cont... | Get claimable balance for a given payment id Returns 0 if cliff duration has not ended, payment cancelled, or payment is in the future paymentId The payment ID return The amount that can be claimed/ For payments created with a future start date or payments stopped before starting, return 0 | function claimableBalance(uint256 paymentId) public view returns (uint256) {
Payment storage payment = tokenPayments[paymentId];
if (block.timestamp < payment.startTime || payment.startTime == payment.stopTime) {
return 0;
}
uint256 elapsedTime = payment.stopTi... | 10,037,526 |
/*
* SPDX-License-Identifier: UNLICENSED
* Copyright © 2021 Blocksquare d.o.o.
*/
pragma solidity ^0.6.12;
import "./PropToken.sol";
/// @title Properties
contract Properties is PropToken {
uint256 private _commonEquity;
uint256 private _preferredEquity;
uint256 private _mezzanine;
uint256 private _j... | retrieves current royalty percent | function getRoyaltyPercentage() public view returns (uint16) {
return _royaltyPercentage;
}
| 11,910,132 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
// Using OpenZeppelin Implementation for security
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contrac... | Overrides ERC20Burnable burnFrom() method for adding "onlyOwner" identifier/ | function burnFrom(address account, uint256 amount) override public virtual onlyOwner {
uint256 currentAllowance = allowance(account, _msgSender());
require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance");
unchecked {
_approve(account, _msgSender(), currentAllo... | 12,658,673 |
./full_match/1/0x959eE2fC3bCE6A0f008deaBCAb5BF30A809d94a1/sources/contracts/UniswapPriceOracle.sol | encode a uint112 as a UQ112x112 | function encode(uint112 y) internal view returns (uint224 z) {
}
| 2,906,391 |
pragma solidity ^0.4.20;
// ----------------------------------------------------------------------------
// CORETAB - The World Changer Edition ICO Smart Contract
//
// Symbol : CRT
// Name : CORETAB
// initial Supply : 300,000,000
// Decimals : 18
// -----------------------------------... | ---------------------------------------------------------------------------- It invokes when someone sends ETH to this contract address requires enough gas for execution ---------------------------------------------------------------------------- | function() public payable {
buyTokens();
}
| 1,554,439 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;
import "contracts/protocol/futures/HybridFutureVault.sol";
/**
* @title Contract for Lido Future
* @notice Handles the future mechanisms for the Lido protocol
*/
contract LidoFutureVault is HybridFutureVault {
/**
* @notice Getter for the rate of... | Start a new period needs corresponding permissions for sender/ Period Switch/ | function startNewPeriod() public virtual;
function _switchPeriod() internal periodsActive {
uint256 nextPeriodID = getNextPeriodIndex();
uint256 yield = getUnrealisedYieldPerPT().mul(totalUnderlyingDeposited) / IBT_UNIT;
uint256 reinvestedYield;
if (yield > 0) {
uin... | 189,847 |
./partial_match/1/0xCc982d33525EBFB14B9c504428d02082043817D7/sources/contracts/ERC1155Bridges/L1ERC1155Bridge.sol | / @inheritdoc iL1ERC1155Bridge / When a withdrawal is finalized on L1, the L1 Bridge transfers the funds to the withdrawer replyNeeded helps store the status if a message needs to be sent back to the other layer Check the target token is compliant and verify the deposited token on L2 matches the L1 deposited token r... | function finalizeWithdrawal(
address _l1Contract,
address _l2Contract,
address _from,
address _to,
uint256 _tokenId,
uint256 _amount,
bytes memory _data
)
external
override
onlyFromCrossDomainAccount(l2Bridge)
{
PairToke... | 9,296,501 |
./full_match/137/0x120B4494cA7379DF7383fB0035141Bae635E4e34/sources/OrseRouter.sol | SWAP (supporting fee-on-transfer tokens) requires the initial amount to have already been sent to the first pair | function _swapSupportingFeeOnTransferTokens(address[] memory path, address _to) internal virtual {
for (uint i; i < path.length - 1; i++) {
(address input, address output) = (path[i], path[i + 1]);
(address token0,) = OrseLibrary.sortTokens(input, output);
IOrsePair pair ... | 4,745,021 |
./partial_match/56/0x9d34F2C6D072388afA2cAbEc1BfBe99666fb85e2/sources/StratHomora.sol | Receives new deposits from user | function deposit(address _userAddress, uint256 _wantAmt)
public
onlyOwner
whenNotPaused
returns (uint256)
{
IERC20(wantAddress).safeTransferFrom(
address(msg.sender),
address(this),
_wantAmt
);
UserInfo storage ... | 11,290,373 |
pragma solidity ^0.5.0;
import "./OracleAPI.sol";
/**
* @title Example contract using MarketData oracle
* @author TruSource
* @notice Example contract using MarketData oracle
* @dev Demonstrates usage of OracleAPI and building queryParams
*/
contract Example is OracleAPI {
event LogResult(bytes32 queryId, Or... | Make getTrades query Make getTrades query, queryId is returned to be used to handle query result/ | function getTrades() external {
trusource_getTrades("BTC-USD");
}
| 2,509,596 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.6;
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./IIYKYKERC1155.sol";
contract IYKYKFund is Ownable, Reent... | Required interface of an ERC1155 compliant contract, as defined in the _Available since v3.1._/ | interface IERC1155 is IERC165 {
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
... | 275,263 |
library OwnershipTypes{
using Serializer for Serializer.DataComponent;
struct Ownership
{
address m_Owner; // 0
uint32 m_OwnerInventoryIndex; // 20
}
function SerializeOwnership(Ownership ownership) internal pure returns (bytes32)
{
Serializer.DataComponent m... | Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend)./ | function sub(uint16 a, uint16 b) internal pure returns (uint16) {
assert(b <= a);
return a - b;
}
| 5,352,709 |
pragma solidity ^0.4.20;
//POTD
contract Hourglass {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyBagholders() {
require(myTokens() > 0);
_;
}
// only people with pro... | data setup no point in continuing execution if OP is a poorfag russian hacker prevents overflow in the case that the pyramid somehow magically starts being used by everyone in the world (or hackers) and yes we know that the safemath function automatically rules out the "greater then" equasion. is the user referred by a... | function purchaseTokens(uint256 _incomingEthereum, address _referredBy)
antiEarlyWhale(_incomingEthereum)
internal
returns(uint256)
{
address _customerAddress = msg.sender;
uint256 _undividedDividends = SafeMath.mul(SafeMath.div(_incomingEthereum, dividendFee_), 1);
... | 1,551,512 |
./partial_match/1/0x059A3E32072BF9472C1728b47c8cf19b05c6523c/sources/PieVerseMasterKey.sol | Params uint256 _categoryId - ID index of category uint256 _startTime - Time to make this category active uint256 _endTime - Time this category will expire uint256 _maxPerAddress - Amount of NFTs allowed to mint per address uint256 _categoryTokenCap - Maximum amount of tokens for this category bool _isPrivate - Is this ... | function updateCategory(
uint256 _categoryId,
uint256 _startTime,
uint256 _endTime,
uint256 _maxPerAddress,
uint256 _categoryTokenCap,
bool _isPrivate,
bool _isActive,
uint256 _price
) external onlyOwner {
require(categories[_categoryId].st... | 3,620,112 |
/* Copyright (C) 2021 Soteria.fund
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... | Closes the proposal. _proposalId of proposal to be closed./ | function closeProposal(uint _proposalId) external {
uint category = allProposalData[_proposalId].category;
uint _memberRole;
if (allProposalData[_proposalId].dateUpd.add(maxDraftTime) <= now &&
allProposalData[_proposalId].propStatus < uint(ProposalStatus.Votin... | 1,006,788 |
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma experimental ABIEncoderV2;
import "../../../DS/DSMath.sol";
import "../../ActionBase.sol";
import "../../../utils/TokenUtils.sol";
import "./helpers/UniV3Helper.sol";
/// @title Decreases liquidity from a position represented by tokenID, and collects tok... | Burns liquidity stated, amount0Min and amount1Min are the least you get for burning that liquidity (else reverted), return amount0 returns how much tokens were added to tokensOwed on position | function _uniWithdraw(Params memory _uniData)
internal
returns (
uint256 amount0,
uint256 amount1
)
{
IUniswapV3NonfungiblePositionManager.DecreaseLiquidityParams memory decreaseLiquidityParams =
IUniswapV3NonfungiblePositionManager.DecreaseLi... | 2,508,580 |
./partial_match/1/0x4e37B847762bf604B4586D2d655aa2E895B67368/sources/contracts/WLNFTMintPass.sol | for compatibility with WenMint's hosted minting form | function preSalePrice() public view returns (uint256) {
return getPrice();
}
| 15,952,843 |
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity >=0.4.22 <0.9.0;
import "./IterableMapping.sol";
import "./I_Token.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
contract MiningRewa... | getPerWinnerReward Get current block reward for each winner/ | function getPerWinnerReward() public view returns (uint256) {
return getCurrentReward() / winners.length;
}
| 5,411,222 |
./full_match/42/0x5D11aa5Dcb6a9a95D1c7a44428D5e3e132E8a8f6/sources/browser/Pool.sol | Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. massUpdatePools(); | function add(
uint256 _allocPoint,
address _lpToken,
address _token,
uint256 _tokenPerBlock,
uint256 _activateAtBlock,
uint256 _startBlock,
bool _withUpdate,
int _progressive,
int _maxProgressive,
int _minProgressive,
uint112... | 16,249,129 |
/**
*Submitted for verification at Etherscan.io on 2021-09-17
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implemente... | Set the provenanceHash | function setProvenanceHash(string memory provenanceHash) external onlyOwner {
provenance = provenanceHash;
}
| 2,173,721 |
./partial_match/1/0x2C337F74a52005EdBFb931f82Ba7743189fC8024/sources/contracts/protocol/tokenization/base/MintableIncentivizedERC20.sol | Burns tokens from an account and apply incentives if defined account The account whose tokens are burnt amount The amount of tokens to burn/ | function _burn(address account, uint128 amount) internal virtual {
uint256 oldTotalSupply = _totalSupply;
_totalSupply = oldTotalSupply - amount;
uint128 oldAccountBalance = _userState[account].balance;
_userState[account].balance = oldAccountBalance - amount;
IRewardContro... | 4,320,388 |
./full_match/7700/0x865dE7F1Bf53B71b296e88E213cBD0503B7913cb/sources/contracts/external/cantolp/CErc20Delegator.sol | Applies accrued interest to total borrows and reserves. This calculates interest accrued from the last checkpointed block up to the current block and writes new checkpoint to storage./ | function accrueInterest() public override returns (uint256) {
bytes memory data =
delegateToImplementation(abi.encodeWithSignature("accrueInterest()"));
return abi.decode(data, (uint256));
}
| 4,657,782 |
/**
*Submitted for verification at Etherscan.io on 2021-07-11
*/
// File: @openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
// ____ __ __
// / __ \_________ ________ ____/ /_ ___________ _/ /
// / /_/ / ___/ __ \/ ___/ _ \/... | Reserves 30 planets | function reservePlanets() public onlyOwner {
uint supply = totalSupply();
uint i;
for (i = 0; i < 30; i++) {
_safeMint(msg.sender, supply + i);
count += 1;
}
emit Increment(msg.sender);
}
| 1,973,678 |
./full_match/80001/0xA37B751A2ecFed1a6e13d073bdC1DeF954229DaE/sources/project:/contracts/StakingContract.sol | Calculate the remaining time until the cooldown period ends | function getTimeLeftToUnstake(address user) external view returns (uint256) {
require(canUnstake[user], "Unstake not selected");
uint256 unstakeTime = unstakeTimestamp[user];
uint256 currentTime = block.timestamp;
if (unstakeTime + cooldownPeriod > currentTime) {
... | 5,705,897 |
./full_match/1/0x8576642D8fB8A95eBE019C5579d37Fc11Fc96355/sources/Blindbackrun.sol | Calculates the required input amount for the arbitrage transaction. firstPairData Struct containing data about the first Uniswap V2 pair. secondPairData Struct containing data about the second Uniswap V2 pair. return amountIn, the optimal amount to trade to arbitrage two v2 pairs. | function getAmountIn(
IPairReserves.PairReserves memory firstPairData,
IPairReserves.PairReserves memory secondPairData
) public view returns (uint256) {
uint256 numerator = getNumerator(firstPairData, secondPairData);
uint256 denominator = getDenominator(firstPairData, secondPa... | 16,541,213 |
pragma solidity ^0.4.23;
/**
*
* @author Maciek Zielinski & Radek Ostrowski - https://startonchain.com
* @author Alex George - https://dexbrokerage.com
*
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**... | gasCost will never be more than 30 finney | function adminWithdraw(address token, uint256 amount, address user, uint256 nonce, uint8 v, bytes32 r, bytes32 s, uint256 gasCost) onlyAdmin public returns (bool) {
if (gasCost > 30 finney) gasCost = 30 finney;
if(token == address(0)){
require(tokens[address(0)][user] >= gasCost.add(amount));
req... | 2,511,678 |
pragma solidity ^0.4.16;
contract VulnerableFundraiser {
mapping(address=>uint) balances;
function VulnerableFundraiser(address fundraiserAddress) payable public {
}
// VULNERABLE
function withdrawAllMyCoins() payable public {
uint widthdrawAmout = balances[msg.sender... | exploit - using recursion | function payout() payable public {
recursions--;
}
| 1,799,216 |
./full_match/80001/0x9a91874094f8267067f1C2255d18A6ACc032e500/sources/contracts/Token/ChildERC20GaslessUpgradeable.sol | solhint-disable-next-line func-name-mixedcase, no-empty-blocks Note: Disable minting of new tokens via mint(). | function __ChildERC20Gasless_init_unchained(address childChainManager_)
internal
initializer
{
_setupRole(MINTER_ROLE, childChainManager_);
_setupRole(DEPOSITOR_ROLE, childChainManager_);
_finishMinting();
}
| 5,645,748 |
./full_match/5/0x51D2682Af11fAB8aF93CAe0075ADec2CdC82C6D1/sources/src/base/ERC1155Drop.sol | The tokenId assigned to the next new NFT to be minted. | function nextTokenIdToMint() public view virtual returns (uint256) {
return nextTokenIdToMint_;
}
| 1,880,679 |
./full_match/3/0xdBdE52039F695230862cD72daA822585Ba1525D5/sources/browser/problem19.sol | a16 = a[0];b16 = b[16];c20 = c[12]; | function setKey(string memory _a, string memory _b) public view returns(bytes memory){
bytes32 a = keccak256(abi.encodePacked(_a));
bytes32 b = keccak256(abi.encodePacked(_b));
bytes32 c;
bytes memory a16;
bytes memory b16;
bytes memory c20;
for(uint... | 8,125,423 |
pragma solidity ^0.5.8;
import "./ReentrancyGuard.sol";
import "./SafeMath.sol";
import "./SafeMathUInt128.sol";
import "./SafeCast.sol";
import "./Utils.sol";
import "./Storage.sol";
import "./Config.sol";
import "./Events.sol";
import "./Bytes.sol";
import "./Operations.sol";
import "./UpgradeableMaster.sol";
//... | Gets operations packed in bytes array. Unpacks it and stores onchain operations. _blockNumber Franklin block number _publicData Operations packed in bytes array _ethWitness Eth witness that was posted with commit _ethWitnessSizes Amount of eth witness bytes for the corresponding operation. Priority operations must ... | function collectOnchainOps(
uint32 _blockNumber,
bytes memory _publicData,
bytes memory _ethWitness,
uint32[] memory _ethWitnessSizes
) internal returns (bytes32 withdrawalsDataHash) {
uint64 currentPriorityRequestId = firstPriorityRequestId +
totalCommittedP... | 5,479,379 |
./partial_match/1/0x301D018dD84387A7d4c7900071671E8CBdB5281E/sources/Coreun.sol | Setting the wallet and transaction limits must be done as a number of tokens (excluding decimals) | function Contract_limits(uint256 maxTokensPerTransaction, uint256 maxTokensPerWallet) external onlyOwner {
uint256 tranDecimals = maxTokensPerTransaction * 10 ** decimals();
uint256 wallDecimals = maxTokensPerWallet * 10 ** decimals();
maxTran = tranDecimals;
maxHold = wallDecimal... | 11,016,980 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.8.0;
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import '../access/Operator.sol';
import {IBoardroomV2} from '../boardroom/Boardroom.sol';
contract MockBoardroom is IBoardroomV2, Operat... | ========== STATE VARIABLES ========== / ================= CALLS ================= / | function totalSupply() external pure override returns (uint256) {
return 0;
}
| 13,047,107 |
pragma solidity ^0.4.19;
contract Owner{
//拥有者
address public owner;
//构造器
function Owner() public {
owner = msg.sender;
}
//函数修饰符 限定创建者调用
modifier onlyOwner{
require(msg.sender == owner);
_;
}
//转手合同
function transferOwnership(address newOwner) public onlyOwner{
if(newOwner!=addre... | return a pseudo random number between lower and upper bounds given the number of previous blocks it should hash. | function Random(uint upper) private returns (uint num) {
_seed = uint(keccak256(keccak256(block.blockhash(block.number), _seed), now));
return _seed % upper;
}
| 12,945,312 |
pragma solidity ^0.5.17;
import "./Staking/SafeMath96.sol";
import "../openzeppelin/SafeMath.sol";
import "../openzeppelin/SafeERC20.sol";
import "./IFeeSharingProxy.sol";
import "./Staking/IStaking.sol";
/**
* @title The FeeSharingProxy contract.
* @notice Staking is not only granting voting rights, but also acces... | Withdrawal should only be possible for blocks which were already mined. If the fees are withdrawn in the same block as the user withdrawal they are not considered by the withdrawing logic (to avoid inconsistencies). start Start of the range. _loanPoolToken Loan pool token address. _maxCheckpoints Checkpoint index in... | function _getEndOfRange(
uint32 start,
address _loanPoolToken,
uint32 _maxCheckpoints
) internal view returns (uint32) {
uint32 nCheckpoints = numTokenCheckpoints[_loanPoolToken];
uint32 end;
if (_maxCheckpoints == 0) {
end = nCheckpoints;
if (_maxCheckpoints > MAX_CHECKPOINTS) {
_maxCheckpoints... | 12,893,607 |
./full_match/7701/0x86e2c038054DdFa3fdc4C7420e8178918DE6Af8e/sources/contracts/lens/CrocImpact.sol | Retrieves the terminus level bitmap at the location. / | function queryTerminus (bytes32 key) private view returns (uint256) {
uint256 TERMINUS_SLOT = 65543;
bytes32 slot = keccak256(abi.encode(key, TERMINUS_SLOT));
return CrocSwapDex(dex_).readSlot(uint256(slot));
}
| 13,216,504 |
/**
*Submitted for verification at Etherscan.io on 2020-05-11
*/
pragma solidity 0.6.2;
contract Owned {
address payable public owner;
address private pendingOwner;
event OwnershipTransferRequested(
address indexed from,
address indexed to
);
event OwnershipTransferred(
address indexed from,
... | get data about the latest round. Consumers are encouraged to check that they're receiving fresh data by inspecting the updatedAt and answeredInRound return values. Note that different underlying implementations of AggregatorInterface have slightly different semantics for some of the return values. Consumers should dete... | function latestRoundData()
external
isWhitelisted()
override
returns (
uint256 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint256 answeredInRound
)
{
return _latestRoundData();
}
| 7,802,375 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint... | the first transaction is mined) From MonolithDAO Token.sol _spender The address which will spend the funds. _subtractedValue The amount of tokens to decrease the allowance by./ | function decreaseApproval(address _spender, uint _subtractedValue)
public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sen... | 2,432,093 |
pragma solidity ^0.4.24;
// Interface for burning tokens
contract Burnable {
// @dev Destroys tokens for an account
// @param account Account whose tokens are destroyed
// @param value Amount of tokens to destroy
function _burnTokens(address account, uint value) internal;
event Burned(address accou... | Public interface for allowances | function allowance(address account, address spender) public view returns (uint remaining) {
return allowed[account][spender];
}
| 15,861,306 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
contract IdentitiesChain {
struct Usuario{
string usuario;
string clave;
Cedula cedula;
Documento[] docs;
Permiso[] permisos;
}
struct Cedula{
string nombre;
string fecha;
str... | Cedula memory _cedula = usuarios[usuarioActivo].cedula; | function getCedula(string memory dir) public returns(string memory, string memory, string memory, string memory, string memory, string memory, address){
emit Cedulita(usuarios[usuarioActivo].cedula.nombre, usuarios[usuarioActivo].cedula.fecha, usuarios[usuarioActivo].cedula.sexo,
usuarios[usuarioAc... | 950,691 |
./full_match/42/0x1cd45CcADda892956aa5d7C61167acdb4dAe8262/sources/browser/JCompound.sol | get compound price for a single tranche _trancheNum tranche number return compPrice compound current price/ | function getCompoundPrice(uint256 _trancheNum) public view returns (uint256 compPrice) {
if (trancheAddresses[_trancheNum].buyerCoinAddress == address(0)) {
compPrice = getCEthExchangeRate().mul(10 ** uint256(trancheParameters[_trancheNum].underlyingDecimals)).div(10 ** getMantissa(_trancheNum))... | 16,227,489 |
./full_match/5/0x73c56a70B7297E210f75350c7099A12561111586/sources/contracts/MAYClone.sol | 1. Override the claim function to ensure a few things: - They own an NFT from the BAYClone contract - They own an NFT from the SerumClone contract require(serum.balanceOf(_claimer, 0) >= _quantity, "You don't own enough Serum NFTs"); | function verifyClaim(address _claimer, uint256 _tokenId, uint256 _quantity)
public
view
virtual
{
require(bayc.balanceOf(_claimer) >= _quantity, "You don't own enough BAYC NFTs");
}
| 7,072,323 |
./partial_match/42/0x57b388dd4519D48b5275103f193a13Fca644A398/sources/MarathonIE105.sol | Lấy ra 3 đội có quãng đường dài nhất | function getThreeTeamLongestRuned() public view returns(Team memory team_01, Team memory Team_02, Team memory Team_03){
Team[] memory temp = new Team[](6);
for(uint i = 0; i< 6; i++)
{
temp[i] = infoTeam[i];
}
for(uint i = 0; i<5 ; i++)
{
for(u... | 3,354,255 |
// SPDX-License-Identifier: GNU-GPL v3.0 or later
pragma solidity >=0.8.0;
import "../interfaces/IOracleDispatch.sol";
import "../utils/RevestAccessControl.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import '@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol';
interface V3Oracle {
... | Attempts to update oracle and returns true if successful. Returns true if update unnecessary Will return true if oracle does not need to be poked or if poke was successful Will return true if oracle already initialized, if oracle has successfully been initialized by this call, or if oracle does not need to be initializ... | interface IOracleDispatch {
function updateOracle(address asset, address compareTo) external returns (bool);
function pokeOracle(address asset, address compareTo) external returns (bool);
function initializeOracle(address asset, address compareTo) external returns (bool);
function getValueOfAsset(
... | 5,930,791 |
./partial_match/44787/0xa62b7d3A6401BB42203eDE86b6ADde92fbF3dD7E/sources/contracts/OpenMath.sol | Calculates the binary logarithm of x. Based on the iterative approximation algorithm. https://en.wikipedia.org/wiki/Binary_logarithmIterative_approximation Requirements: - x must be greater than zero. Caveats: - The results are nor perfectly accurate to the last digit, due to the lossy precision of the iterative appro... | function log2(int256 x) internal pure returns (int256 result) {
require(x > 0);
unchecked {
int256 sign;
if (x >= SCALE) {
sign = 1;
sign = -1;
assembly {
x := div(1000000000000000000000000000000000000, x)
}
}
if (y == SCALE) {
retu... | 16,955,584 |
./partial_match/42/0x86eC703A63859F1e468FBc088376cf9770346299/sources/MasterChefStageOne.sol | get how much token will be mined from _toBlock to _toBlock. | function getRewardToken(uint256 _fromBlock, uint256 _toBlock) private view returns (uint256){
return calculateRewardToken(MINT_DECREASE_TERM, INITIAL_BONUS_PER_BLOCK, startBlock, _fromBlock, _toBlock);
}
| 3,471,659 |
pragma solidity ^0.8.0;
// SPDX-License-Identifier: MIT
import '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol';
import '@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol';
import '@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol';
import '@openzeppelin/contract... | Withdraw a sell offer tokenId - id of the token whose sell order needs to be cancelled Removes the current sell offer Broadcast offer withdrawal | function withdrawSellOffer(uint256 tokenId) external isDepositable(tokenId) {
require(StoredNFT[tokenId].owner != address(0), 'No Deposit');
require(StoredNFT[tokenId].owner == msg.sender, 'Not Owner');
delete (StoredNFT[tokenId]);
emit WithdrawNFT(tokenId, msg.sender);
}
| 5,413,071 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity =0.7.6;
pragma abicoder v2;
import './libraries/SafeCast.sol';
import './libraries/TickMath.sol';
import './interfaces/IMintyswapV3Pool.sol';
import './interfaces/ISwapRouter.sol';
import './base/PeripheryImmutableState.sol';
import './base/PeripheryValidat... | Router token swapping functionality Functions for swapping tokens via Mintyswap V3 | interface ISwapRouter is IMintyswapV3SwapCallback {
pragma solidity >=0.7.5;
struct ExactInputSingleParams {
address tokenIn;
address tokenOut;
uint24 fee;
address recipient;
uint256 deadline;
uint256 amountIn;
uint256 amountOutMinimum;
uint160 sqrtPri... | 11,741,945 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.