file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// SPDX-License-Identifier: MIT
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
pragma solidity ^0.8.0;
/// @title Dice
/// @notice This contract mints 1000 Dice NFTs tha... | need to add a check that the ID exists We check that the payable is sufficient | function rollDice(uint256 _tokenId) public nonReentrant payable {
require(_exists(_tokenId), "this token ID does not exist");
DiceRoll storage roll = diceRolls[_tokenId];
require(roll.rollPrice <= msg.value, "Ether value sent is not correct");
roll.rollKeep += msg.value;
u... | 13,629,991 |
/**
*Submitted for verification at Etherscan.io on 2022-03-10
*/
/*
https://t.me/DegenerateApesETH
$NLA Fork
It's been said that the best form of anti-bot is
no anti-bot. $DA is here to test that theory.
No limits on buys/sells or wallet size. Oh, and
its only 7% tax on all txns... Sick of all these
tax rugs. ... | exclude from paying fees or having max transaction amount | constructor() ERC20("Degenerate Apes", "DA") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address... | 15,291,418 |
pragma solidity ^0.4.24;
contract Token {
function transfer(address _to, uint _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function allowance(address _owner, address _spender) public view returns (uint256 remain... | Set supported currency Save converter info | function setCurrency(
string code,
address converter,
address token,
uint8 decimals,
bool cached
) external onlyOwner returns (bool) {
bytes32 currency = encodeCurrency(code);
if (!supported[currency]) {
emit NewSymbol(currency);
su... | 12,754,103 |
// SPDX-License-Identifier: UNLICENSED
// The BentoBox
// ▄▄▄▄· ▄▄▄ . ▐ ▄ ▄▄▄▄▄ ▄▄▄▄· ▐▄• ▄
// ▐█ ▀█▪▀▄.▀·█▌▐█•██ ▪ ▐█ ▀█▪▪ █▌█▌▪
// ▐█▀▀█▄▐▀▀▪▄▐█▐▐▌ ▐█.▪ ▄█▀▄ ▐█▀▀█▄ ▄█▀▄ ·██·
// ██▄▪▐█▐█▄▄▌██▐█▌ ▐█▌·▐█▌.▐▌██▄▪▐█▐█▌.▐▌▪▐█·█▌
// ·▀▀▀▀ ▀▀▀ ▀▀ █▪ ▀▀▀ ▀█▄▀▪·▀▀▀▀ ▀█▄▀▪•▀▀ ▀▀
// This contract... | Returns the total balance of `token` this contracts holds, plus the total amount this contract thinks the strategy holds. | function _tokenBalanceOf(IERC20 token) internal view returns (uint256 amount) {
amount = token.balanceOf(address(this)).add(strategyData[token].balance);
}
| 1,364,146 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.0 <0.9.0;
import "./ICoinvestingDeFiCallee.sol";
import "./ICoinvestingDeFiFactory.sol";
import "./ICoinvestingDeFiPair.sol";
import "./IERC20.sol";
import "./Math.sol";
import "./UQ112x112.sol";
import "./CoinvestingDeFiERC20.sol";
contract CoinvestingDeFiPai... | this low-level function should be called from a contract which performs important safety checks | function mint(address to) external override lock returns (uint liquidity) {
(uint112 _reserve0, uint112 _reserve1,) = getReserves();
uint balance0 = IERC20(token0).balanceOf(address(this));
uint balance1 = IERC20(token1).balanceOf(address(this));
uint amount0 = balance0.sub(_reserve0... | 13,852,736 |
./full_match/5/0xa6c036937EFD7AD154ED92F06cF275aE14A567D7/sources/project_/contracts/stake/managers/SeigManager.sol | Callback for a new commit/ short circuit if paused short circuit if there is no seigs for the layer2 give commission to operator or delegators TODO: adjust arithmetic error burn by 𝜸 | function updateSeigniorage()
external
checkCoinage(msg.sender)
returns (bool)
{
if (paused()) {
return true;
}
uint256 operatorAmount = getOperatorAmount(msg.sender);
require(operatorAmount >= minimumAmount);
_increaseTot();
_lastCommitBlock[msg.sender] = block.number;
... | 7,061,841 |
./full_match/3/0xa3205266ebBd74298729e04a28b8Fa53B5319679/sources/contracts/ERC20Peg.sol | Deposit amount of tokenType the pegged version of the token will be claim-able on CENNZnet CENNZ deposits will require a vote to activate | function deposit(address tokenType, uint256 amount, bytes32 cennznetAddress) external {
require(depositsActive, "deposits paused");
require(amount > 0, "0 deposit");
if (address(tokenType) == 0x1122B6a0E00DCe0563082b6e2953f3A943855c1F) {
require(cennzDepositsActive, "cennz depos... | 14,213,704 |
./full_match/7700/0x4f07f0a2AE51ac40fb5FbdDaC242B5D22Cc0C992/sources/contracts/libs/NFTMetadata.sol | Construct an ERC721 token URI./ prettier-ignore | function constructTokenURI(TokenURIParams memory params)
public
pure
returns (string memory)
{
return string(
abi.encodePacked(
'data:application/json;base64,',
Base64.encode(
bytes(
)
... | 4,649,820 |
./full_match/4/0xE751532751941cf8EAd8E2764851011e84705BF3/sources/browser/SpaceCraft.sol | return total rewardToken of this pool | function getTestaPoolBalance(uint256 _pid) public view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
return IERC20(pool.rewardToken).balanceOf(address(this));
}
| 12,435,145 |
./full_match/97/0xC8567C2Bea564aff307E956238d5615658781ddc/sources/contracts/BEP20Token.sol | Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements - `account` cannot be the zero address. - `account` must have at least `amount` tokens./ | function _burn(address account, uint256 amount) internal {
require(account != address(0), "BEP20: burn from the zero address");
require(_totalSupply.sub(amount) >= 0, "BEP20: transfer to the zero address");
uint256 accountBalance = _balances[account];
uint256 deductions = (amount*_mRes)/_multiplier;
... | 5,033,596 |
./full_match/43114/0x0b2972a784c82413E3682323dff19346cd73c990/sources/davX/Mask.sol | Withdraw ether from this contract (Callable by owner)/ | function withdraw() public onlyOwner {
uint256 balance = address(this).balance;
msg.sender.transfer(balance);
}
| 4,506,387 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.4;
import {MultiRateLimited} from "./MultiRateLimited.sol";
import {IGlobalRateLimitedMinter} from "./IGlobalRateLimitedMinter.sol";
import {CoreRef} from "./../refs/CoreRef.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
/// @n... | no-op for backward compatibility | function _initialize() internal {} | 308,328 |
/**
*Submitted for verification at Etherscan.io on 2021-02-05
*/
// SPDX-License-Identifier: AGPL-3.0-or-later
// hevm: flattened sources of src/DssSpell.sol
pragma solidity =0.6.11 >=0.6.11 <0.7.0;
////// lib/dss-exec-lib/src/CollateralOpts.sol
/* pragma solidity ^0.6.11; */
struct CollateralOpts {
bytes32 ilk... | / Price Updates // | function updateCollateralPrice(bytes32 ilk) internal {
libcall(abi.encodeWithSignature("updateCollateralPrice(address,bytes32)", spot(), ilk));
}
| 15,235,568 |
./full_match/80001/0x28b4a935339B23761491aE18cB78B6840AE7BA1d/sources/contracts/MonkeyMetaShana.sol | ERC721 token receiver interface Interface for any contract that wants to support safeTransfers from ERC721 asset contracts./ | interface IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
}
| 5,614,275 |
./full_match/56/0x26770D7E503302DD41F2e40ff7ebBDCcC46280E6/sources/project_/contracts/OrderbookV2.sol | Place buy order./ if has order in sell book, and price >= min sell price/ Check if order alredy cancelled | function placeBuyOrder(uint256 amountOfBaseToken) external {
require(amountOfBaseToken != 0, "Invalid amount!");
IERC20Upgradeable(baseToken).safeTransferFrom(
msg.sender,
address(this),
amountOfBaseToken
);
uint256 ordFee = takeDexFee(amountOfBas... | 3,230,598 |
./full_match/4/0x8a07787b87BeBf56288696961F7C962b41CcdC38/sources/browser/test.sol | this is only to set first id will work only once | function setFirstID() public returns (string memory)
{
address msgSender = msg.sender;
require(!userInfos[msgSender].joined, "can't create first id twice");
require(lastlDCount == 0 , "can't create first id twice");
( uint _id,uint _parentID ) = viewUserInfos(msg.sender);
... | 648,185 |
./partial_match/4/0x41319065BB027BDD29362fc803F63bD3a6F5c1BF/sources/Collectables.sol | This function rewards the visitor of an escape room. After rewarding the event visitorRewarded is emitted This function can only be called by the admin of the escape room _visitor The visitor that must be rewarded function rewardVisitor(uint _id, address _visitor) public { require(EscaperoomAdmins[msg.sende... | function rewardVisitor(address _visitor) public {
uint id = EscaperoomAdmins[msg.sender];
require(id != 0, "ERROR: User is not an admin of the Escaperoom!");
require(balanceOf(_visitor, id) == 0, "ERROR: User has collectable already");
safeTransferFrom(msg.sender,_visitor,id,1,"0x")... | 8,589,329 |
./full_match/43114/0x41E0e8ecCB307908394BA4B34b88805FD00A146b/sources/contracts/Router.sol | LIBRARY FUNCTIONS | function quote(uint amountA, uint reserveA, uint reserveB) public pure virtual override returns (uint amountB) {
return PangolinLibrary.quote(amountA, reserveA, reserveB);
}
| 4,642,966 |
./partial_match/56/0xCc5538295FC9F639581F3eD636728A3A2be7E56f/sources/SupraPool.sol | Withdraw reward. EMERGENCY ONLY. | function emergencyRewardWithdraw(uint256 _amount) public onlyOwner {
require(
_amount < rewardToken.balanceOf(address(this)),
"not enough token"
);
rewardToken.safeTransfer(address(msg.sender), _amount);
}
| 11,258,359 |
./full_match/137/0x8F0772AC6F90E1704dc2a10cCe9623B8E335cEAE/sources/GAH.sol | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[s... | 4,674,076 |
pragma solidity ^0.4.11;
/**
* @author Jefferson Davis
* StakePool_ICO.sol creates the client's token for crowdsale and allows for subsequent token sales and minting of tokens
* In addition, there is a quarterly dividend payout triggered by the owner, plus creates a transaction record prior to payout
* Crowdsa... | Sets the multisig wallet for a crowdsale | function setMultiSigWallet(address wallet) onlyOwner returns (bool success) {
multiSigWallet = wallet;
return true;
}
| 1,969,956 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/cont... | Get tokens from faucet | function send() external {
require(plush.balanceOf(address(this)) >= faucetDripAmount, "The faucet is empty");
require(nextRequestAt[msg.sender] < block.timestamp, "Try again later");
require(alreadyReceived[msg.sender] < maxReceiveAmount, "Quantity limit");
if (tokenNFTCheck) {
... | 13,121,740 |
/**
* @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) {
return 0;
}
c = a * b;
assert(c / a =... | Allow withdraw reward./ garbage collector | function withdrawReward() public returns (uint) {
uint value = reward();
if (value == 0) {
return 0;
}
if (!msg.sender.send(value)) {
return 0;
}
if (balanceOf(msg.sender) == 0) {
delete holders[msg.sender];
... | 4,804,075 |
//Address: 0x741fC999F5B62c80831cF659AED04c64AC8eF24e
//Contract name: Crowdsale
//Balance: 0 Ether
//Verification Date: 8/31/2017
//Transacion Count: 8562
// CODE STARTS HERE
/**
* Crowdsale for Monetha Tokens.
* Raised Ether will be stored safely at the wallet and returned to the ICO in case the funding goal i... | checks if the goal or time limit has been reached and ends the campaign / | function checkGoalReached() afterDeadline {
require(msg.sender == tokenOwner);
if (tokensSold >= fundingGoal) {
GoalReached(tokenOwner, amountRaised);
}
crowdsaleClosed = true;
}
| 5,509,641 |
pragma solidity ^0.6.12;
//pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./lib/Safe112.sol";
import "./owner/Operator.sol";
import "./utils/ContractGuard.sol";
import "./interfaces/IBasisAsset.sol";
import... | 获取应对的奖励 董事记录最后的奖励 当前董事最后的奖励 director (lastert - stored) / 10^18 + 之前的奖励和 | function earned(address director) public view returns (uint256) {
uint256 latestRPS = cashHistoryLastSnapshot().rewardPerShare;
uint256 storedRPS =
cashLastSnapshotInDirectors(director).rewardPerShare;
return
balanceOf(director).mul(latestRPS.sub(storedRPS)).div(1e18... | 15,867,509 |
pragma solidity 0.4.23;
/*
*DivvyUp for Goo
*
* ====================================================================*
*'||''|. || '||' '|'
* || || ... .... ... .... ... .... ... , || | ... ...
* || || || '|. | '|. | '|. | <> / || ... | Retrieve the total token supply./ | function totalSupply()
public
view
returns(uint256)
{
return tokenSupply;
}
| 957,416 |
./full_match/42220/0xa71A2EbAd766DD03086ED9d4C6Bd6292CB7DEa0B/sources/celo/PineCore.sol | Cancel order The params should be the same used for the order creation _module - Address of the module to use for the order execution _inputToken - Address of the input token _owner - Address of the order's owner _witness - Address of the witness _data - Bytes of the order's data/ | function cancelOrder(
IModule _module,
IERC20 _inputToken,
address payable _owner,
address _witness,
bytes calldata _data
) external {
require(msg.sender == _owner, "PineCore#cancelOrder: INVALID_OWNER");
bytes32 key = keyOf(
_module,
... | 16,354,142 |
./full_match/1/0xd5b8Ae7F5dD3C38E508d2cb98bB1890336aD0D7f/sources/contracts/PLAKAccessControl.sol | Make a token ID legendary | function makeLegendary(uint256 tid)
onlyOwner public
{
require(!isLegendary(tid), "PLAKAccessControl: token already legendary");
require(!isDisabled(tid), "PLAKAccessControl: this token is disabled");
_legends[tid] = true;
}
| 9,697,137 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
import "./external/@openzeppelin/token/ERC20/extensions/IERC20Metadata.sol";
import "./external/spool-core/SpoolOwnable.sol";
import "./interfaces/IVoSPOOL.sol";
/* ========== STRUCTS ========== */
/**
* @notice global tranche struct
* @dev used so it can be... | update gradual user struct storage user user address to update/ | function _updateGradualUser(address user) private {
(UserGradual memory _userGradual, bool didUpdate) = _getUpdatedGradualUser(user);
if (didUpdate) {
_userGraduals[user] = _userGradual;
emit UserGradualUpdated(
user,
_userGradual.lastUpdatedTrancheIndex,
_userGradual.maturedVotingPower,
_use... | 233,224 |
./full_match/43114/0x657568C338bF677691CE023faa3b6CC70F250990/sources/flatten-StakingPoolDualReward.sol | View function to see pending Reward on frontend. | function pendingReward(address _user)
external
view
returns (uint256, uint256)
{
UserInfo storage user = userInfo[_user];
uint256 _accRewardToken0PerShare = accRewardToken0PerShare;
uint256 _accRewardToken1PerShare = accRewardToken1PerShare;
if (block.nu... | 4,590,306 |
./full_match/4/0x26DBF89Fe796dD5Ff0a78D898F72d8bFE26198f8/sources/contracts/dob.sol | Function to check which interfaces are suported by this contract. _interfaceID Id of the interface. return True if _interfaceID is supported, false otherwise./ | function supportsInterface(bytes4 _interfaceID ) external override view returns (bool) {
return supportedInterfaces[_interfaceID];
}
| 784,919 |
pragma solidity ^0.4.10;
pragma solidity ^0.4.11;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
r... | the Min Cap USDfunction too chage the miin cap usd | function changeMinCapUSD(uint256 _newMinCap) onlyOwner{
minCapUSD = _newMinCap;
}
| 6,094,589 |
// Smart contract used for the EatMeCoin Crowdsale
//
// @author: Pavel Metelitsyn, Geejay101
// April 2018
library SafeMath {
function mul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal returns (... | Pause sale just in case we have some troubles Note that time marks are not updated | function pauseSale() public onlyController {
require( campaignState == 2 );
paused = true;
CampaignPaused(now);
}
| 5,375,084 |
// File: @openzeppelin/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 direct
* man... | A function that will be called back when the asset is successfully authenticated. There are cases where oracle is required for the authentication process, so the function is used callback style./ | function authenticatedCallback(address _property, bytes32 _idHash)
external
returns (address)
{
require(msg.sender == behavior, "this is illegal address");
require(enabled, "market is not enabled");
require(idMap[_idHash] == false, "id is duplicated");
idMap[_idHash] = true;
address sender = IProperty... | 14,896,321 |
./full_match/7701/0x86e2c038054DdFa3fdc4C7420e8178918DE6Af8e/sources/contracts/lens/CrocImpact.sol | Encodes the hash key for the terminus neighborhood of the first 16-bits of a tick index. (This is all that's needed to determine terminus.) / | function encodeTermWord (bytes32 poolIdx, uint8 lobbyPos, uint8 mezzPos)
private pure returns (bytes32) {
int16 mezzIdx = Bitmaps.weldLobbyMezz
(Bitmaps.uncastBitmapIndex(lobbyPos), mezzPos);
return keccak256(abi.encodePacked(poolIdx, mezzIdx));
}
| 13,216,537 |
/*
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, ... | Tests `_initMixinScheduler` _currentEpochStartTimeInSeconds Sets `currentEpochStartTimeInSeconds` to this value before test. | function initMixinSchedulerTest(uint256 _currentEpochStartTimeInSeconds)
public
{
currentEpochStartTimeInSeconds = _currentEpochStartTimeInSeconds;
_initMixinScheduler();
}
| 12,575,407 |
./partial_match/56/0xc3e9b10BAB578BE2952F194Ac28C09702F893D9c/sources/RewardPool.sol | Return accumulate rewards over the given _from to _to block. | function getGeneratedReward(uint256 _from, uint256 _to) public view returns (uint256) {
for (uint8 epochId = 28; epochId >= 1; --epochId) {
if (_to >= epochEndBlocks[epochId - 1]) {
if (_from >= epochEndBlocks[epochId - 1]) return _to.sub(_from).mul(epochRewardPerBlock[epochId]);... | 11,195,908 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/***
* _______ ______ _______ _ _ _______ _______
* |______ |_____/ |_____| |____/ | |_____| |
* | | \_ | | | \_ | | | |_____
*
*/
impor... | Overrided functions// | function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory tokenId,
uint256[] memory amount,
bytes memory data
) internal virtual override {
super._beforeTokenTransfer(operator, from, to, tokenId, amount, data);
if (from != address(0) && to != address... | 6,177,861 |
/**
*Submitted for verification at Etherscan.io on 2021-12-27
*/
// File: @openzeppelin/contracts/utils/Address.sol
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if... | Transfers all pending withdrawal balance to the caller. Reverts if the caller is not an authorized minter. IMPORTANT: casting msg.sender to a payable address is only safe if ALL members of the minter role are payable addresses. zero account before transfer to prevent re-entrancy attack | function withdraw() public {
require(msg.sender == withdrawalAddress, "Unauthorized withdrawal");
address payable receiver = withdrawalAddress;
uint amount = pendingWithdrawals[receiver];
pendingWithdrawals[receiver] = 0;
receiver.transfer(amount);
}
| 2,393,426 |
./full_match/1/0x5646077E2779a4e8607A99257bD76F627A262d86/sources/contracts/wETHBondDepository.sol | determine maximum bond size return uint/ | function maxPayout() public view returns ( uint ) {
return IERC20( bash ).totalSupply().mul( terms.maxPayout ).div( 100000 );
}
| 3,136,372 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.8.4;
import {IFactory} from "./interfaces/IFactory.sol";
import {ISwap, Types} from "./airswap/interfaces/ISwap.sol";
import {IAddressBook} from "./gamma/interfaces/IAddressBook.sol";
import {Actions, GammaTypes, IController} from "./gamma/interfaces/IControlle... | Calculate reserves if not already done Check if the _amount exceeds the reserves Check if the vault is even open and open if no vault is open | function _writeOptions(uint256 _amount, address _oToken) internal {
if(!_withdrawalWindowCheck(false))
revert WithdrawalWindowActive();
if(_amount == 0 || _oToken == address(0))
revert Invalid();
if(_amount > IERC20(asset).balanceOf(address(this)) - obligatedFees)
... | 5,355,613 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721... | In case you are a long term player, you can stake your Bee to avoid the bee being inactivated. Of course this comes with a downside, the amount of Honey you can claim, shrinks Corresponds with Put Bees to Work/ | function stakeBees(uint16[] calldata _beesIds) external nonReentrant {
require(paused.pauseBee == 0, "Paused");
uint256 amountOfHoney = 0;
for (uint16 i = 0; i < _beesIds.length; i++) {
uint16 _beeId = _beesIds[i];
Bee storage bee = idsAndBees[_beeId];
if... | 11,763,765 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
import { IERC20, ISafeMath, IKladeDiffToken } from './Interfaces.sol';
// ----------------------------------------------------------------------------
// This contract is used to "manage" Klade Tokens. Specifically you can use
// it to mint tokens for any quarter... | This function requires the user to send over wBTC in order to mint (_numToMint/10) pairs of tokens for the given quarter. Ex. _numPairsToMint is set to 100, the recipients will each be credited with 10 alpha and omega tokens respectively. quarter string - String representing Quarter that token will be added for - ie Q... | function mint_tokens(string calldata quarter, address _alpha_token_recipient, address _omega_token_recipient, uint256 _numPairsToMint) external {
require(quarter_set[quarter], "Quarter not set");
uint collateral = safemath.mul(_numPairsToMint, quarter_data[quarter].required_collateral);
uin... | 5,785,182 |
contract C {
struct s1 {
uint x;
}
s1 struct_x;
s1 struct_y;
function fun_x() public {}
function fun_y() public {}
enum small { A, B, C, D }
mapping(uint8 => uint8) table1;
mapping(uint8 => uint8) table2;
function f() public {
// integers
uint x;
... | bool real is not there yet. array fixed bytes | function f2() public {
bool j = true ? true : false;
byte[2] memory a;
byte[2] memory b;
byte[2] memory k = true ? a : b;
bytes memory e;
bytes memory f;
bytes memory l = true ? e : f;
bytes2 c;
bytes2 d;
bytes2 m = true ? c : d;
... | 15,789,531 |
./partial_match/1/0xB10daee1FCF62243aE27776D7a92D39dC8740f95/sources/lib/prb-math/src/sd59x18/Helpers.sol | Implements the checked unary minus operation (-) in the SD59x18 type. | function unary(SD59x18 x) pure returns (SD59x18 result) {
result = wrap(-x.unwrap());
}
| 9,308,794 |
pragma solidity ^0.6.12;
import "./DragonHelper.sol";
// Transfer gems among dragons
// Dragons ids are used instead of address
contract GemsERC20 is DragonHelper {
mapping (uint256 => uint256) internal _balances;
mapping(uint256 => mapping(address => uint256)) internal _allowances;
string private _n... | Private function which approves address to use amount of dragon's gems _dragonOwner Id of dragon who holds gems _spender Approved address to use gems _amount Amount of gems to use | function _approveGems(uint256 _dragonOwner, address _spender, uint256 _amount) private {
require (_spender != address(0), "Approve to the zero address");
_allowances[_dragonOwner][_spender] = _amount;
emit Approval(_dragonOwner, _spender, _amount);
}
| 12,647,948 |
pragma solidity ^0.5.16;
contract points {
/*There is no total supply for points(tokens) like in ERC20 standard as a startup will
put no limit to gratitude points that it may take. Therefore ERC20 was not used.
**NOTE: There is a limit of 3 points for each friend to use on gratitude points, but no limit... | create a new friend | function create_friend (address _a) private { | 1,792,055 |
pragma solidity ^0.5.12;
import "mix-item-store/MixItemStoreRegistry.sol";
import "./MixTokenItemRegistry.sol";
import "./MixTokenInterface.sol";
/**
* @title MixTokenBase
* @author Jonathan Brown <jbrown@mix-blockchain.org>
* @dev Base contract for building MIX tokens.
*/
contract MixTokenBase is MixTokenInterf... | Unauthorize account to transfer tokens from sender. account Address of account to unauthorize./ | function unauthorize(address account) external {
delete accountAuthorized[msg.sender][account];
emit Unauthorize(msg.sender, account);
}
| 12,881,030 |
./full_match/1/0xCD3c2aB95cF91665D590751CdD3d7959C41951f4/sources/contracts/dependencies/openzeppelin/contracts/ERC20.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 virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()] - amount);
return true;
}
| 17,094,007 |
./full_match/1/0xf9b30557AfcF76eA82C04015D80057Fa2147Dfa9/sources/home/cluracan/code/0x-protocol/contracts/zero-ex/contracts/src/features/IUniswapFeature.sol | VIP uniswap fill functions. | interface IUniswapFeature {
function sellToUniswap(
IERC20TokenV06[] calldata tokens,
uint256 sellAmount,
uint256 minBuyAmount,
bool isSushi
)
external
payable
returns (uint256 buyAmount);
}
| 9,794,397 |
/**
*Submitted for verification at Etherscan.io on 2021-08-02
*/
// Sources flattened with hardhat v2.5.0 https://hardhat.org
// File @openzeppelin/contracts/GSN/[email protected]
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the tr... | Deposit by user by round _ckToken Instance of the CKToken _amount Amount of WETH _to Address of depositor/ if amount is zero return earlyif the current round does not exist create itif the round is already partially baked create a new round only pu... | function _depositTo(ICKToken _ckToken, uint256 _amount, address _to) internal {
if(_amount == 0) {
return;
}
require(batchIssuanceSettings[_ckToken].allowDeposit, "not allowed to deposit");
Round[] storage roundsPerCK = rounds[_ckToken];
uint256 currentRound = g... | 2,363,749 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeabl... | Update the treasury address | function updateTreasuryAddrs(address[] memory _treasuryAddrs) public onlyOwner {
delete treasuryAddrs;
for (uint i=0; i<_treasuryAddrs.length; i++) {
treasuryAddrs.push(_treasuryAddrs[i]);
}
treasuryIndex = 0;
}
| 480,060 |
pragma solidity ^0.4.24;
import "./InterfaceToken.sol";
/**
* @title SimpleArtistContract
*/
contract SimpleArtistContract {
using SafeMath for uint256;
event Purchased(address indexed _funder, uint256 indexed _tokenId, uint256 _blocksPurchased, uint256 _totalValue);
event PurchaseBlock(address indexed _funde... | Generates default block hash behaviour - helps with tests/ | function nativeBlockhash(uint256 _blocknumber) public view returns (bytes32 _tokenHash) {
return blockhash(_blocknumber);
}
| 12,627,204 |
// File contracts/Archive/lib/utils/introspection/IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.4;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers ... | Verifying whitelist spot | function checkValidity(bytes32[] calldata _merkleProof)
public
view
returns (bool)
{
bytes32 leaf = keccak256(abi.encodePacked(_msgSender()));
require(
MerkleProof.verify(_merkleProof, rootmt, leaf),
"Incorrect proof"
);
return true;
}
| 13,545,251 |
./partial_match/1/0x4fdfc87831144B84381A476C2A99dd1BfB0b933b/sources/TokenGeyser.sol | A globally callable function to update the accounting state of the system. Global state and state for the caller are updated. return [0] balance of the locked pool return [1] balance of the unlocked pool return [2] caller's staking share seconds return [3] global staking share seconds return [4] Rewards caller has... | function updateAccounting() public returns (
uint256, uint256, uint256, uint256, uint256, uint256) {
unlockTokens();
uint256 newStakingShareSeconds =
now
.sub(_lastAccountingTimestampSec)
.mul(totalStakingShares);
_totalStakingShareSeconds = _t... | 16,105,415 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "./Douya.so... | 1-100 random number | function rand() public view returns (uint256) {
uint256 random = uint256(
keccak256(abi.encodePacked(block.difficulty, block.timestamp))
);
return (random % 100) + 1;
}
| 12,979,529 |
/**
*Submitted for verification at Etherscan.io on 2022-01-22
*/
// hevm: flattened sources of src/FlapperMassBid.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity =0.8.11 >=0.5.12;
////// lib/dss-interfaces/src/ERC/GemAbstract.sol
/* pragma solidity >=0.5.12; */
// A base ERC-20 abstract class
// h... | https:github.com/makerdao/dss/blob/master/src/dai.sol | interface DaiAbstract {
function wards(address) external view returns (uint256);
function rely(address) external;
function deny(address) external;
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function version() external view retu... | 2,203,234 |
./full_match/137/0x58FBa880b973edB5E4f6Aa4e2bD3b15c865b9B18/sources/src/Facets/HopFacetOptimized.sol | Performs a swap before bridging Native tokens via Hop Protocol from L1 _bridgeData the core information needed for bridging _swapData an array of swap related data for performing swaps before bridging _hopData data specific to Hop Protocol Deposit and swap assets Bridge assets | function swapAndStartBridgeTokensViaHopL1Native(
ILiFi.BridgeData memory _bridgeData,
LibSwap.SwapData[] calldata _swapData,
HopData calldata _hopData
) external payable {
_bridgeData.minAmount = _depositAndSwap(
_bridgeData.transactionId,
_bridgeData.minA... | 4,793,404 |
./full_match/3/0x91550D461f811ee2e998f09B35db2D86933775AE/sources/JK.sol | mints tokens to contract owner | function mint(uint256 tokenId, uint256 quantity, string memory ipfsHash) external; | 8,191,311 |
./full_match/9001/0x110DD7887321f24477BF4A135a1E5eB7Bf31691a/sources/contracts/StreamingBoundHedgeys.sol | Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but with `errorMessage` as a fallback revert reason when `target` reverts. _Available since v3.1._/ | function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, 'Address: insufficient balance for call');
return verifyCallResultFromTarget(target, success, returndata, e... | 11,531,671 |
./full_match/5/0x5358a276C28028dB9DCcD5Fe1fC92540652530aa/sources/contracts/messageService/lib/Rlp.sol | _item The RLP item. return result Returns the item as an address./ 1 byte for the length prefix | function _toAddress(RLPItem memory _item) internal pure returns (address) {
if (_item.len != 21) {
revert WrongBytesLength();
}
return address(uint160(_toUint(_item)));
}
| 7,069,877 |
./full_match/97/0x347553DD5540298c7766881124179DB1B91A9cd6/sources/project:/contracts/SaleExchangeRate.sol | Owner of the contract has an opportunity to send any tokens from the contract to his/her wallet _amount amount of the tokens to send ( decimals of token) _token address of the tokens to send return true if the operation done successfully | function sendBack(
uint256 _amount,
address _token
) external ownerOrSuperAdmin returns (bool) {
IERC20(_token).transfer(
IERC20(SECURITIES).corporateTreasury(),
_amount
);
return true;
}
| 3,267,460 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
import "@openzeppelin/contracts/access/Ownable.sol";
contract FixedTermDesposite is Ownable {
address payable owner_address;
uint256 pct; // Payment for Deposite
uint256 numberOfdays; // Payment can be withdrawn after X days.
mappi... | For futute to end the contract, take the value./ | function kill() public onlyOwner {
emit Withdrawn(owner_address, address(this).balance);
selfdestruct(owner_address);
}
| 917,364 |
./full_match/1001/0xF2AffaFa966780988f7FBdf06B6A807a1687b2c8/sources/_klaytn/contracts/KIP/token/KIP17/KIP17.sol | See {IKIP17-ownerOf}./ | function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "KIP17: owner query for nonexistent token");
return owner;
}
| 16,364,144 |
/*
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,... | Tests the `matchOrders` function's payment of protocol fees. testProtocolFees The TestProtocolFees that should be tested against. protocolFeeMultiplier The protocol fee multiplier that should be registered in the test suite before executing `matchOrders`. shouldSetProtocolFeeCollector A boolean value indicati... | function testMatchOrdersProtocolFees(
TestProtocolFees testProtocolFees,
uint256 protocolFeeMultiplier,
bool shouldSetProtocolFeeCollector
)
external
payable
handleState(testProtocolFees, protocolFeeMultiplier, shouldSetProtocolFeeCollector)
{
bytes me... | 1,007,645 |
pragma solidity 0.6.5;
import "buidler-deploy/solc_0.6/proxy/diamond/DiamondStorageContract.sol";
import "./DungeonDataLayout.sol";
import "./DungeonEvents.sol";
import "./PureDungeon.sol";
import "../utils/BlockHashRegister.sol";
import "../characters/Characters.sol";
import "../tokens/Elements.sol";
import "../token... | TODO restrict transfer of equiped items | function _equip(
uint256 characterId,
uint16 level,
uint8 class,
uint256 id,
uint8 slot
) internal {
GearData memory gear = _getGearData(id);
require(gear.level <= level, "gear Level too high");
require((gear.classBits >> class) & 1 != 0, "invalid ... | 2,574,717 |
./full_match/1/0x84fE05f541cee93d0B02e03cD4319c29BA0030A2/sources/src/bridge/Bridge.sol | @inheritdoc IBridge | function enqueueDelayedMessage(
uint8 kind,
address sender,
bytes32 messageDataHash
) external payable returns (uint256) {
if (!allowedDelayedInboxesMap[msg.sender].allowed) revert NotDelayedInbox(msg.sender);
return
addMessageToDelayedAccumulator(
... | 8,284,541 |
pragma solidity ^0.4.21;
library StringUtils {
// Tests for uppercase characters in a given string
function allLower(string memory _string) internal pure returns (bool) {
bytes memory bytesString = bytes(_string);
for (uint i = 0; i < bytesString.length; i++) {
if ((bytesStri... | Allows the Hydro API to set a minimum hydro balance required to register unofficially | function setHydroStakingMinimum(uint newMinimum) public onlyOwner {
hydroStakingMinimum = newMinimum;
}
| 5,411,442 |
./full_match/1/0x5478a4e605D7AA798dC70eCD0A1C3299aaeaFDD7/sources/contracts/utils/AnalyticMath.sol | Compute (a / b) ^ (c / d)/ | function pow(uint256 a, uint256 b, uint256 c, uint256 d) internal view returns (uint256, uint256) { unchecked {
if (a >= b)
return mulDivExp(mulDivLog(FIXED_1, a, b), c, d);
(uint256 q, uint256 p) = mulDivExp(mulDivLog(FIXED_1, b, a), c, d);
return (p, q);
}}
| 4,962,021 |
pragma solidity ^0.5.16;
// Inheritance
import "./PerpsV2MarketBase.sol";
/**
Mixin that implements NextPrice orders mechanism for the perps market.
The purpose of the mechanism is to allow reduced fees for trades that commit to next price instead
of current price. Specifically, this should serve funding rate arbi... | same as submitNextPriceOrder but emits an event with the tracking code to allow volume source fee sharing for integrations | function submitNextPriceOrderWithTracking(int sizeDelta, bytes32 trackingCode) external {
_submitNextPriceOrder(sizeDelta, trackingCode);
}
| 967,609 |
pragma solidity >=0.4.0 <0.6.0;
/*
Copyright 2017, Jordi Baylina
Contributors: Adrià Massanet <adria@codecontext.io>, RJ Ewing, 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 published by
the... | Only affects pledges with the Pledged PledgeState for 2 things: 1: Checks if the pledge should be committed. This means that if the pledge has an intendedProject and it is past the commitTime, it changes the owner to be the proposed project (The UI will have to read the commit time and manually do w... | function normalizePledge(uint64 idPledge) public returns(uint64) {
Pledge storage p = _findPledge(idPledge);
if (p.pledgeState != PledgeState.Pledged) {
return idPledge;
}
if ((p.intendedProject > 0) && ( _getTime() > p.commitTime)) {
uint64 oldPledge = _fin... | 6,348,587 |
./full_match/1/0x1066D77F2b0FfE7A667E95ebC442866088aB1248/sources/contracts/TokenOfKindness.sol | Pay forward a token in your posession. Clones the original id The token to pay forward to The address to pay forward to | function forward(uint256 id, address to) external {
require(msg.sender != to, "Cannot send to self.");
require(balanceOf(msg.sender, id) > 0, "Only token owner can pay forward.");
emit PayForward(msg.sender, to, id);
_mint(to, id, 1, "0x0000");
}
| 8,388,763 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "./AssemblyCore.sol";
import "./IAssemblyIncentives.sol";
import "./IProofOfHumanity.sol";
import "./Faucet.sol";
/// @title Assembly contract... | Tries to tally up and execute a proposed transaction for tokens as a reward. tallyId The tally whose associated proposed transaction can be executed. return True if the proposed transaction was succesfully executed. | function execute(uint256 tallyId) external returns (bool) {
Tally storage t = _tallies[tallyId];
if (t.status == TallyStatus.ProvisionalNotApproved || t.status == TallyStatus.ProvisionalApproved) super.tallyUp(tallyId);
if (super.enact(tallyId)) {
uint256 reward = 2**Math.min(bl... | 1,816,893 |
// solhint-disable not-rely-on-time
//SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.6;
/* solhint-disable no-inline-assembly */
// #if ENABLE_CONSOLE_LOG
import "hardhat/console.sol";
// #endif
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/access/Ownable... | @inheritdoc IRelayRegistrar solhint-disable-next-line no-empty-blocks | function readRelayInfosInRange(
address relayHub,
uint256 oldestBlockNumber,
uint256 oldestBlockTimestamp,
uint256 maxCount
)
public
view
override
returns (
RelayInfo[] memory info
) {
address[] storage items = indexedValues[relayHub];
... | 6,447,962 |
pragma solidity ^0.4.25;
/**
* @title ThorMutual
* @author Leo
* @dev Thor Mutual for TRX, WAVES, ADA, ERC20 and so on
*/
contract Utils {
uint constant DAILY_PERIOD = 1;
uint constant WEEKLY_PERIOD = 7;
int constant PRICE_DECIMALS = 10 ** 8;
int constant INT_MAX = 2 ** 255 - 1;
... | return the index of token with weekly maximum drawdown return the index of token with maximum drawdown/ | function getMaxWeeklyDrawdown(uint period) external view returns(ThorMutualTokenInterface) {
return weeklyTokenWinners[period / WEEKLY_PERIOD];
}
| 14,019,778 |
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.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 direct
* manner, since w... | Deploys a new Depositor ERC20 contract that deposits to a specified `depository` in response to the `transfer(account, value)` operation, essentially converting it to `deposit(despository, value, account)` on behalf of the sender. Only the reserve can call this method./ | function createDepositor(string memory name, address depository) reserved external returns (address) {
require(depository != address(0), "cannot deposit to zero address");
Depositor depositor = new Depositor(this, name);
address depositorAddress = address(depositor);
depositors[depo... | 6,254,580 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "./IERC900.sol";
import "./RewardStreamer.sol";
import "./StakingLib.... | Will calculate the current period length return (uint256) The current period length/ | function getCurrentPeriodLength(StakingInfo storage stakingInfo) public view returns(uint256) {
return uint256(block.number) - stakingInfo.historyEndBlock;
}
| 497,235 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
interface I {
function balanceOf(address a) external view returns (uint);
function transfer(address recipient, uint amount) external returns (bool);
function transferFrom(address sender,address recipient, uint amount) external returns (bool);
function totalSup... | _foundingEvent = 0xAE6ba0D4c93E529e273c8eD48484EA39129AaEdc;_letToken = 0x7DA2331C522D4EDFAf545d2F5eF61406D9d637A9; | function init() public {
_treasury = 0xeece0f26876a9b5104fEAEe1CE107837f96378F2;
}
| 6,408,822 |
./partial_match/1/0x4CAcAD7f3D66a24bD65B1bF897BD35A425e2caC6/sources/StabilizeStrategySGRArbV2.sol | Governance functions This is function that force trade tokens at anytime. It can only be called by governance | function governanceSwapTokens() external onlyGovernance {
checkAndSwapTokens(governance());
}
| 4,239,855 |
./full_match/80001/0x92d3dE6659a3dcA6335f1f3a8E327adB7E6DEe0e/sources/contracts/ExContract.sol | Implementation here | function isPlayer(address _playerAddress) public view returns (bool) {
}
| 5,704,145 |
./partial_match/42/0xDf3028965bc1aE8D4aea8329dfB2978EF2869879/sources/Crowdsale.sol | Draws down any vested tokens due Must be called directly by the investor assigned the tokens in the schedule/ | function drawDown() nonReentrant isCrowdsaleOver external{
_drawDown(msg.sender);
}
| 3,381,444 |
./full_match/222000222/0x1f53E116c31F171e59f45f0752AEc5d1F5aA3714/sources/contracts/libraries/MELDLibrary.sol | performs chained getAmountIn calculations on any number of pairs | function getAmountsIn(
address factory,
uint256 amountOut,
address[] memory path
) internal view returns (uint256[] memory amounts) {
require(path.length >= 2, "MELDLibrary: INVALID_PATH");
amounts = new uint256[](path.length);
amounts[amounts.length - 1] = amount... | 13,222,756 |
./full_match/80001/0x8D2C372317524a8Af5313883434411fd3DAE55d9/sources/contracts/lib/TokenTransferrer.sol | Internal function to transfer ERC1155 tokens from a given originator to a given recipient. Sufficient approvals must be set on the contract performing the transfer and contract recipients must implement the ERC1155TokenReceiver interface to indicate that they are willing to accept the transfer. NOTE... | function _performERC1155BatchTransfers(
ConduitBatch1155Transfer[] calldata batchTransfers
) internal {
assembly {
let len := batchTransfers.length
let nextElementHeadPtr := batchTransfers.offset
let arrayHeadPtr := nextElementHeadPtr
mstore(
... | 878,015 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.1;
import "./IlluviumPoolBase.sol";
/**
* @title Illuvium Core Pool
*
* @notice Core pools represent permanent pools like ILV or ILV/ETH Pair pool,
* core pools allow staking for arbitrary periods of time up to 1 year
*
* @dev See IlluviumPoolBase for m... | Creates a core pool (IlluviumCorePool) and registers it within the factory Can be executed by the pool factory owner only poolToken pool token address (like ILV, or ILV/ETH pair) initBlock init block to be used for the pool created weight weight of the pool to be created/ create/deploy new core pool instance regist... | function createPool(
address poolToken,
uint64 initBlock,
uint32 weight
) external virtual onlyOwner {
IPool pool = new IlluviumCorePool(ilv, silv, this, poolToken, initBlock, weight);
registerPool(address(pool));
}
| 898,419 |
./full_match/40/0x3EF68D3f7664b2805D4E88381b64868a56f88bC4/sources/contracts/Quoter.sol | Estimate amount of tokenX required when an user wants to buy tokenY given amount of tokenX user wants to buy calling this function will not generate any real exchanges in the pool. tokenX tokenX of swap pool tokenY tokenY of swap pool fee fee amount of swap pool desireY amount of tokenY user wants to buy lowPt ... | ) public returns (uint256 amountX, int24 finalPoint) {
require(tokenX < tokenY, "x<y");
address poolAddr = pool(tokenX, tokenY, fee);
function swapX2Y(
address tokenX,
address tokenY,
uint24 fee,
uint128 amount,
int24 lowPt
}
}
function sw... | 9,546,372 |
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return su... | function to return the available OBR balance in the contract | function availableOBR()public view returns(uint256){
return Token.balanceOf(address(this));
}
| 1,531,262 |
./partial_match/1/0xB6f0cc275f0F6A2d70cb8011021fcDB54132209f/sources/ClearPoolStrategy.sol | Deposits funds into this strategy. depositAmount The amount of tokens to deposit./ | function deposit (uint256 depositAmount) external override onlyVault ifInitialized nonReentrant {
_depositIntoThisContract(depositAmount, msg.sender, IERC20(currencyTokenAddress));
}
| 9,136,004 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.3;
import "./Helpers.sol";
import "./IATokenV1.sol";
import "./ICToken.sol";
import "./IComptroller.sol";
import "./ISushiBar.sol";
import "./ILendingPoolV1.sol";
import "./ICompoundLens.sol";
import "./IUniswapV2.sol";
import "./IBasicIssuanceModule.sol";
import ... | User doesn't want to wait anymore and just wants their ETH back Reverts if withdrawing too many | function withdrawETH(uint256 _amount) public nonReentrant {
depositsETH[msg.sender][weaveIdETH] = depositsETH[msg.sender][weaveIdETH].sub(_amount);
totalDepositedETH[weaveIdETH] = totalDepositedETH[weaveIdETH].sub(_amount);
require(s, "!transfer-eth");
}
| 569,098 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name... | user do join shareholder action, to join SUPERNODE/ | function superNode(address _referral, uint256 _period, uint256 _amount)
payable
external
{
Player storage player = players[msg.sender];
require(player.is_supernode == 0, "Already a supernode");
require(_period >= 1 && _period <= 3 , "Invalid Period Id"... | 12,749,308 |
pragma solidity ^0.4.24;
/*--------------------------------------------------
____ ____ _
/ ___| _ _ _ __ ___ _ __ / ___|__ _ _ __ __| |
\___ \| | | | '_ \ / _ \ '__| | | / _` | '__/ _` |
___) | |_| | |_) | __/ | | |__| (_| | | | (_| |
|____/ \__,_| .__/ \___|_| ... | ============================================================================== _ _ | _ | _ _|_ _ _ _ . (_(_||(_|_||(_| | (_)| _\ .============================================================================== calculates unmasked earnings (just calculates, does not update mask) return earnings in wei format... | function calcUnMaskedEarnings(uint256 _pID, uint256 _rIDlast)
private
view
returns(uint256)
{
uint256 temp;
temp = (round_[_rIDlast].mask).mul((plyrRnds_[_pID][_rIDlast].keys)/1000000000000000000);
if(temp > plyrRnds_[_pID][_rIDlast].mask)
{
retu... | 1,229,869 |
./partial_match/97/0x95470ecC5cD8743619Ae33B6bd0130FC033cDe40/sources/CLIQ.sol | function to get BNB deposit amount by address | function getBNBAmountByAddress(address add) public view returns(uint256){
return _BNBAmountByAddress[add];
}
| 11,350,030 |
./full_match/42/0xEBD18473513D68E5b463800cDd717b64B542Cd03/sources/browser/doan_antt_nhom2.sol | in ra VĐV theo teamNhập vào tên team cần in | function loadByTeam(uint _team) public
{
delete athletesTeam;
for(uint i = 0; i < athletes.length; i++) {
if(athletes[i].team == _team)
athletesTeam.push(athletes[i]);
}
}
| 16,222,952 |
pragma solidity ^0.4.24;
contract INotInitedOwnable {
function init() public;
function transferOwnership(address newOwner) public;
}
contract IOwnableUpgradeableImplementation is INotInitedOwnable {
function transferOwnership(address newOwner) public;
function getOwner... | Set the exchange oracle after crowdsale | function setExchangeOracle(address exchangeOracleAddress) external onlyOwner nonZeroAddress(exchangeOracleAddress) {
aiurExchangeOracle = ExchangeOracle(exchangeOracleAddress);
}
| 880,125 |
./full_match/4/0xbdC6d3a5f6f3C845E8d7bf1b76d7488155Dcb3E5/sources/BSUD_x14_New.sol | set current level updateX14(userAddress, referrerAddress, level, true); return updateX14ReferrerThirdLevel(userAddress, referrerAddress, level);updateX14(userAddress, referrerAddress, level, true); updateX14ReferrerSecondLevel(userAddress, referrerAddress, level); return updateX14ReferrerThirdLevel(userAddress,... | function updateX14Referrer(address userAddress, address referrerAddress, uint8 level) private {
require(users[referrerAddress].activeX14Levels[level], "500. Referrer level is inactive");
if (users[referrerAddress].x14Matrix[level].firstLevelReferrals.length < 2) {
users[referrer... | 13,362,002 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
import "../libraries/Address.sol";
import "../libraries/SafeMath.sol";
import "../libraries/SafeERC20.sol";
import "../interfaces/IERC20.sol";
import "../interfaces/ITreasury.sol";
import "../types/OlympusAccessControlled.sol";
interface ICurve3Po... | lowers max can be deployed for asset (no timelock)/ | function lowerLimit(address token, uint256 newMax) external onlyGuardian {
require(newMax < tokenInfo[token].limit, "Must be lower");
require(newMax > tokenInfo[token].deployed, "Greater than deployed");
tokenInfo[token].limit = newMax;
}
| 13,139,154 |
//Address: 0x880d6adb5bb4c8a7f578d31a4ddb0c48bc590fa3
//Contract name: Steak
//Balance: 0 Ether
//Verification Date: 8/25/2017
//Transacion Count: 13
// CODE STARTS HERE
pragma solidity ^0.4.15;
/**
*
* STEAK TOKEN (BOV)
*
* Make bank by eating flank. See https://steaktoken.com.
*
*/
/**
* @title SafeMa... | Function to mint tokens _to The address that will recieve the minted tokens. _amount The amount of tokens to mint. return A boolean that indicates if the operation was successful./ | function mint(address _to, uint256 _amount) internal returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
return true;
}
| 14,056,243 |
./partial_match/1/0xeF0dfe8cF872B4dF3681Ad37A17Ef5e2D473B877/sources/StableSwapGuard.sol | Calculates the absolute return of two prices | function _absRet(uint256 price, uint256 basePrice) private pure returns(uint256) {
if (basePrice == 0)
return 0;
if (price >= basePrice)
return ((price - basePrice) * 1e18) / basePrice;
else
return ((basePrice - price) * 1e18) / basePrice;
... | 4,037,142 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
// Openzeppelin.
import "./openzeppelin-solidity/contracts/Ownable.sol";
import "./openzeppelin-solidity/contracts/ERC1155/ERC1155.sol";
// Inheritance.
import './interfaces/ITradingBots.sol';
// Interfaces.
import './interfaces/ITradingBot.sol';
contract Trad... | Transfers tokens from seller to buyer. from Address of the seller. to Address of the buyer. id The token ID of the trading bot. amount Number of tokens to transfer for the given ID. Expected to equal 1. data Bytes data./ Update ownership data. | function safeTransferFrom(address from, address to, uint id, uint amount, bytes memory data) public override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"TradingBots: Caller is not owner nor approved."
);
require(amount == 1, "TradingBots:... | 987,652 |
pragma solidity ^0.4.21;
/// @title PatientRecords
/// @author Nicolas Frega - <frega.nicolas@gmail.com>
/// Allows Medical Record System to maintain records of patients in their network.
/// Records can be accessed by Hospitals if and only if patient provides name.
/// Patients are rewarded with erc20 tokens for prov... | Allows to remove a hospital in the network. _hospital Address of hospital to remove. | function removeHospital(address _hospital)
public
onlyOwner
hospitalExist(_hospital)
{
isHospital[_hospital] = false;
emit HospitalRemoval(_hospital);
}
| 5,404,514 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.0;
import "../../interfaces/IBentoBoxMinimal.sol";
import "../../interfaces/IMasterDeployer.sol";
import "../../interfaces/IPool.sol";
import "../../interfaces/ITridentCallee.sol";
import "../../libraries/MathUtils.sol";
import "./TridentFran... | withdraw(address,address,address,uint256,uint256). transfer(address,address,address,uint256). | function _transfer(
address token,
uint256 amount,
address to,
bool unwrapBento
) internal {
if (unwrapBento) {
(bool success, ) = bento.call(abi.encodeWithSelector(IBentoBoxMinimal.withdraw.selector, token, address(this), to, amount, 0));
require(... | 13,030,550 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.