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
pragma solidity >=0.7.0;
pragma experimental ABIEncoderV2;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface ERC20Interface {
function transfer(address recipient, uint256 amount)
external
returns (bool);
}
// Ideally this would be impo... | Executes an exit by paying out assets and calling external contracts Executes an exit by paying out assets and calling external contracts exit The exit to be paid out./ | function executeExit(ExitFormat.SingleAssetExit[] memory exit) internal {
for (uint256 assetIndex = 0; assetIndex < exit.length; assetIndex++) {
executeSingleAssetExit(exit[assetIndex]);
}
}
| 13,021,780 |
./full_match/5/0xCd0a64D08544ed6245D8d7e741Cc521030846Fc9/sources/project_/contracts/SmartWalletUpgradeable.sol | Public functions/ | function initialize() initializer public {
__AccessControlEnumerable_init();
__Ownable_init();
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
_setupRole(MODERATOR_ROLE, msg.sender);
_setupRole(APPROVER_ROLE, msg.sender);
}
| 1,867,060 |
pragma solidity ^0.4.21;
// A simple bidding system which allows several users to make bidds.
// A bid can be defined as a price (value) on a given moment in time (timestamp).
// Every user can make only one bid, if a unser makes more bids then they will be
contract Bidding {
//owner of the contract
address p... | This is the constructor whose code is run only when the contract is created. | function Bidding() public {
owner = msg.sender;
}
| 12,966,191 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.4;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-upgradeable/math/SignedSafeMathUpgradeable.sol";
import "../interface/IOracle.sol";
import "../libraries/OrderData.sol";
import "../libraries/SafeMathExt.sol";
import "../libraries/Utils.sol"... | Get the max position amount of trader will be closed in the trade. position Current position of trader. amount The trading amount of position. return maxPositionToClose The max position amount of trader will be closed in the trade./ | function getMaxPositionToClose(int256 position, int256 amount)
internal
pure
returns (int256 maxPositionToClose)
{
require(position != 0, "trader has no position to close");
require(!Utils.hasTheSameSign(position, amount), "trader must be close only");
maxPosition... | 12,615,793 |
pragma solidity 0.6.12; // optimization runs: 200, evm version: istanbul
pragma experimental ABIEncoderV2;
interface DharmaTradeBotV1Interface {
event LimitOrderProcessed(
address indexed account,
address indexed suppliedAsset, // Ether = address(0)
address indexed receivedAsset, // Ether = address(0)
... | Private view function to ensure that a given expiration has not elapsed, or is set to zero (signifying no expiration)./ | function _enforceExpiration(uint256 expiration) private view {
require(
expiration == 0 || block.timestamp <= expiration,
"Order has expired."
);
}
| 7,890,682 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
pragma abicoder v2;
import "./ActionGuards.sol";
import "../FreeCollateralExternal.sol";
import "../../global/StorageLayoutV1.sol";
import "../../math/SafeInt256.sol";
import "../../internal/AccountContextHandler.sol";
import "../../internal/portfolio/Tr... | Returns the balance of an ERC1155 id on an account. account account to get the id for id the ERC1155 id return notional balance of the ERC1155 id as a signed integer | function signedBalanceOf(address account, uint256 id) public view override returns (int256 notional) {
AccountContext memory accountContext = AccountContextHandler.getAccountContext(account);
if (accountContext.isBitmapEnabled()) {
notional = _balanceInBitmap(account, accountContext.bit... | 1,675,575 |
pragma solidity ^0.4.4;
contract Owned {
address public contractOwner;
address public pendingContractOwner;
function Owned() {
contractOwner = msg.sender;
}
modifier onlyContractOwner() {
if (contractOwner == msg.sender) {
_;
}
}
/**
* Prepares ow... | Passes asset ownership to specified address. Only ownership is changed, balances are not touched. Can only be called by asset owner. _symbol asset symbol. _newOwner address to become a new owner. return success./ Should pass ownership to another holder. | function changeOwnership(bytes32 _symbol, address _newOwner) onlyOwner(_symbol) returns(bool) {
Asset asset = assets[_symbol];
uint newOwnerId = _createHolderId(_newOwner);
if (asset.owner == newOwnerId) {
_error("Cannot pass ownership to oneself");
return false;
... | 2,297,496 |
./full_match/80001/0x428d527d80255562131153A5D4BDF036bd73741d/sources/project_/contracts/Roulette.sol | getting random number requesting random words from VRF | function _getRandomNumber() private {
gameData[gameCounter].gameState = GameState.GETTING_VRF;
uint256 requestId = IOracle(VRFOracleContract).requestRandomWords(1);
gameByRequestId[requestId] = gameCounter;
}
| 5,587,585 |
/*
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, ... | Reads a bytes32 value from a position in a byte array. b Byte array containing a bytes32 value. index Index in byte array of bytes32 value. return bytes32 value from byte array. | function publicReadBytes32(
bytes memory b,
uint256 index
)
public
pure
returns (bytes32 result)
{
result = b.readBytes32(index);
return result;
}
| 12,595,667 |
//Address: 0x959529102cfde07b1196bd27adedc196d75f84f6
//Contract name: BLO
//Balance: 0 Ether
//Verification Date: 2/18/2018
//Transacion Count: 1439
// CODE STARTS HERE
pragma solidity ^0.4.19;
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
a... | allow locked token to be obtained for member | function unlock () {
require(now >= lockance[msg.sender].duration);
uint256 _amount = lockance[msg.sender].amount;
balances[msg.sender] += lockance[msg.sender].amount;
lockance[msg.sender].amount = 0;
Unlock(msg.sender, _amount);
}
| 13,057,966 |
./full_match/3/0x4C2a681b97B34DF09a0935Bd3dDb09Dc60076B8c/sources/browser/Dice.sol | get number of sides of dice | function getDiceSides(uint256 diceId) public view validDiceId(diceId) returns (uint8) {
return dices[diceId].numberOfSides;
}
| 8,147,829 |
./full_match/1/0x8CB7b0BEF538d21b35EDf1251321495c11EAEBDd/sources/src/UniwarConfigImpl.sol | Update the forge vault lock periods _phase The phase to update _x The new forge x take lock _y The new forge y take lock _z The new forge z take lock return True if the update is successful | function updateForgeVaultLockPeriods(uint8 _phase, uint256 _x, uint256 _y, uint256 _z) external onlyOwner returns (bool) {
return _updateForgeVaultLockPeriods(_phase, _x, _y, _z);
}
| 16,477,087 |
./partial_match/3/0x18d9B6ba7588E8b15376039fDb192f3C6D150622/sources/CryptoSOS.sol | PlayerX writes an O in cell | function placeO(uint8 cell) public validMove {
require(cell>=1 && cell <=9, "Out of bounds.");
require(keccak256(abi.encodePacked(grid3x3[cell-1])) == keccak256(abi.encodePacked('-')), "Choose an empty cell.");
emit MoveEvent(lastP, cell, 0);
checkGameOver(... | 5,076,142 |
./full_match/5/0xDDc3E49a46262503d0A67CE1CAa0c92cB79Aa905/sources/contracts/L1/tss/TssGroupManager.sol | @inheritdoc ITssGroupManager/ slither-disable-next-line external-function | function removeMember(bytes calldata _publicKey) public override onlyOwner {
for (uint256 i = 0; i < activeTssMembers.length; i++) {
if (isEqual(activeTssMembers[i], _publicKey)) {
removeActiveTssMembers(i);
break;
}
}
delete tssActiveM... | 1,955,669 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
/// @title An Ethereum library that contains useful routines for the Wonka engine
/// @author Aaron Kendall
library WonkaLibrary {
// An enum for the type of rules currently supported
enum RuleTypes { IsEqual, IsLessThan, IsGreaterThan, Populated, InDoma... | This method allows the rules engine to call another contract's method via assembly, for the purpose of assigning a value The target contract being called is expected to have a function 'methodName' with a specific signature move pointer to free memory spot put function sig at memory spot append argument after function... | function invokeValueSetter(address targetContract, address, bytes32 methodName, bytes32 attrName, bytes32 value) public returns (string memory strAnswer) {
string memory strMethodName = bytes32ToString(methodName);
string memory functionNameAndParams = strConcat(strMethodName, "(bytes32,bytes32)")... | 5,466,786 |
./full_match/1/0x649fb0a21A70701f34Dc2eceC790EE3851E3722e/sources/src/strategies/WethStrategyConvexStEth.sol | send rewards to treasury | function _harvest() internal override returns (uint256 received) {
if (!reward.getReward(address(this), shouldClaimExtras)) revert ClaimRewardsFailed();
uint8 length = uint8(rewards.length);
for (uint8 i = 0; i < length; ++i) {
ERC20 rewardToken = rewards[i];
uint256 rewardBalance = rewardToken.balanceOf(... | 8,305,899 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;
import "@openzeppelin/contracts/utils/Base64.sol";
/// @title OnChain metadata support library
/**
* @dev These methods are best suited towards view/pure only function calls (ALL the way through the call stack).
* Do not waste gas using these methods in functio... | Returns the contents joined with commas between them contents1 The first content to join contents2 The second content to join contents3 The third content to join contents4 The fourth content to join contents5 The fifth content to join contents6 The sixth content to join return A string that represent all contents... | function commaSeparated(string memory contents1, string memory contents2, string memory contents3, string memory contents4, string memory contents5, string memory contents6) internal pure returns (string memory) {
return string.concat(commaSeparated(contents1, contents2, contents3, contents4, contents5), continuesWi... | 5,472,225 |
./full_match/1/0xc1aAB2dc3Fe5082D2D3eAaf67f4D49619B9862C9/sources/Users/simondos/projects/micobo-security-token/contracts/token/ERC1400ERC20.sol | Returns the amount of tokens owned by `account`./ | function balanceOf(address who) public override view returns (uint256) {
return _balances[who];
}
| 3,073,953 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
* Based on SafeMath.sol from https://github.com/OpenZeppelin/zeppelin-solidity/tree/master
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c... | send ether to the fund collection wallet return true if successful/ | function forwardFunds() internal returns (bool) {
wallet.transfer(msg.value);
return true;
}
| 5,448,084 |
/**
*Submitted for verification at Etherscan.io on 2021-10-12
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
*... | mints GengNft to sender/ | function whiteListMax(address[] memory addresses) public onlyOwner {
for (uint256 index = 0; index < addresses.length; index++) {
if (!whitelist[addresses[index]]) {
whitelist[addresses[index]] = true;
}
}
}
| 7,652,401 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
pragma experimental ABIEncoderV2;
// File: node_modules\witnet-solidity-bridge\contracts\interfaces\IWitnetRequestBoardEvents.sol
/// @title Witnet Request Board emitting events interface.
/// @author The Witnet Foundation.
interface IWitnetRequestBoardE... | File: contracts\interfaces\IWitmonSurrogates.sol Witty Creatures 2.0 Token surrogating interface. Otherplane Labs, 2021. | interface IWitmonSurrogates {
function mintCreature(
address _eggOwner,
uint256 _eggIndex,
uint256 _eggScore,
uint256 _eggRanking,
uint256 _totalClaimedEggs,
bytes calldata _signature
) external;
function previewCreatureImage(
address _eggOwner,
... | 6,983,725 |
./full_match/69/0xF3EA36DcB7DDe7fe1d4f1ad94E85063f261364cc/sources/contracts/TexasHoldEmApi.sol | give side pot chips to winners | function _giveChipsToPlayers(uint256 chips, address[] memory players) private returns (uint256) {
uint256 chipsPerPlayer = (((chips / _tokenDecimalMultiplier) / players.length) * _tokenDecimalMultiplier);
uint256 remnant = chips - (chipsPerPlayer * players.length);
for (uint8 i = 0; i < pl... | 13,239,792 |
/**
*Submitted for verification at Etherscan.io on 2022-03-15
*/
// SPDX-License-Identifier: GPL-3.0-or-later
// Sources flattened with hardhat v2.6.1 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/[email protected]
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)
pragma so... | Withdraw all underlying and convert to the Hop LP Token./ Unstaking and withdrawing from Convex pool | function _withdrawAllToHopLp() private {
uint256 stakedBalance = _stakedBalance();
if (stakedBalance > 0) {
rewards.withdrawAndUnwrap(stakedBalance, false);
}
if (lpBalance > 0) {
curvePool.remove_liquidity_one_coin(
lpBalance,
... | 2,187,058 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
This contract implements a DAO, it's been loosely based on Compound's
GovernorAlpha. It supports multiple options per proposal and multiple actions
per option. It leverages the `Voters` contract for snapshots of voting power.
It supports gasless voting with vot... | Executes an un-executed, with quorum, ready to be executed proposal If the pre-conditions are met, anybody can call this Part of this is establishing which option "won" and if quorum was reached Pick the winning option (the one with the most votes, defaulting to the "Against" (last) option Use greater than (not equal) ... | function execute(uint proposalId) external {
Proposal storage p = proposals[proposalId];
require(p.executedAt == 0, "already executed");
require(block.timestamp > p.executableAt, "not yet executable");
require(!p.cancelled, "proposal cancelled");
require(p.optionsVotes.length... | 1,069,416 |
pragma solidity ^0.5.10;
import "./UnitFactory.sol";
/**
* @title Track a single unit with associated operations (setup, maintainance, repair, ...)
* @author E. Guyonnet
* @notice Created by the UnitFactory
* This contract doesn't need to be upgradable
*/
contract Unit {
address private parentFa... | returns true is unit does not work anymore return bool | function isDestroyed() external view returns(bool) {
return status == 10;
}
| 943,436 |
./full_match/77/0x4b1E732bF20896B1eA7A76BC10AE900BBf86Fd43/sources/contracts/rollup/facets/RollupUser.sol | Create a new stake It is recomended to call stakeOnExistingNode after creating a new stake so that a griefer doesn't remove your stake by immediately calling returnOldDeposit tokenAmount the amount of tokens staked/ | function newStake(uint256 tokenAmount) external onlyValidator whenNotPaused {
_newStake(tokenAmount);
require(
IERC20(stakeToken).transferFrom(msg.sender, address(this), tokenAmount),
"TRANSFER_FAIL"
);
}
| 5,050,287 |
./full_match/1/0x0D857197B2e4200fdb1cC8f6D3F3c84784ba09c2/sources/contracts/4_PeePeePooPoo.sol | See {IERC165-supportsInterface}./ | function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return interfaceId == type(IBEP20Operable).interfaceId || super.supportsInterface(interfaceId);
}
| 3,042,581 |
./partial_match/1/0x34A542aCD8A717B5933228Ae3C554B1328F36e14/sources/ERC20ByMetadrop.sol | function {removeUnlimited} onlyManager Allows the manager to remove an unlimited address removedUnlimited_ The address of the old removed unlimited address/ Remove this from the enumerated list: | function removeUnlimited(address removedUnlimited_) external onlyManager {
_unlimited.remove(removedUnlimited_);
emit UnlimitedAddressRemoved(removedUnlimited_);
}
| 2,631,663 |
//SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "./ITrade.sol";
import "./GameItems.sol";
/**
* @title Trade
* @notice For making transactions between equipment and coins for two players.
*/
contract Trade is ITrade, GameItems {
mapping(address => Trade) trades;
mapping(address => ad... | Player agree to have the trade with another player. inviter_address: the address of the player who created the trade. Player 1 reduce an equipement and player 2 reduce the silver coins and increase one equipment./ | function accept_trade(address inviter_address) external override {
require(trades[inviter_address].is_valid_trade, "The trade is not valid");
require(super.balanceOf(msg.sender, 1) > trades[inviter_address].silver_coin, "player silver coins are not enough");
uint256 eq_id = trades[i... | 12,796,229 |
./full_match/42/0xa814bfa2669B7E20b58Bf2458DBFeaB9C8913Af9/sources/transferFNX.sol | this is the functiona inviked to allow for | function _rrSpinNum(uint _num) public {
require( _num >= 0 && _num <= odds, "Enter a value within the odds range");
uint result;
result = random(_num) % odds;
if(result == _num){
addrrwinners();
}
return;
}
| 9,570,356 |
./full_match/1/0x69c208F4B6E8a44647505eB7C1CCa5Fa33Fb3236/sources/src/strategies/base/FractBaseStrategy.sol | Sets the vault address the strategy will receive deposits from. operatorAddress Specifies the address of the poolContract./ | function setOperator(address operatorAddress) external onlyOwner {
_operator = operatorAddress;
}
Base Operations
| 8,363,642 |
//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.4;
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { ReentrancyGuard } from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./ut... | Accept message hash and returns hash message in EIP712 compatible form So that it can be used to recover signer from signature signed using EIP712 formatted data "\\x19" makes the encoding deterministic "\\x01" is the version byte to make it compatible to EIP-191/ | function toTypedMessageHash(bytes32 messageHash) internal view returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", getDomainSeperator(), messageHash));
}
| 1,087,409 |
pragma solidity ^0.5.10;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "../interfaces/IERC223ReceivingContract.sol";
import "../interfaces/IDetherToken.sol";
import "../interfaces/IZoneFactory.sol";
import "../interfaces/IZone.sol";
import "../interfaces/ITeller.sol";
contract Zone is IERC223Rec... | onlyByTellerContract / | function processState()
external
{
_processState();
}
| 5,454,364 |
./partial_match/1/0x3563cb49a1C3fa725f1888486754758d120B2BF8/sources/SavingsContract.sol | Internal poke function to keep the balance between connector and raw balance healthy / 1. Verify that poke cadence is valid, unless this is a manual action by governance If there is a connector, check the balance and settle to the specified fraction % 2. Check and verify new connector balance Always expect the col... | function _poke(CachedData memory _data, bool _ignoreCadence) internal {
require(_data.totalCredits > 0, "Must have something to poke");
uint256 currentTime = uint256(now);
uint256 timeSinceLastPoke = currentTime.sub(lastPoke);
require(_ignoreCadence || timeSinceLastPoke > POKE_CADEN... | 15,508,539 |
pragma solidity ^0.4.20;
// File: contracts/ERC20Token.sol
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint2... | OPERATOR ---------------------------------------------------------------- | function addMilestonesAndSeal(uint[] _etherAmounts, uint[] _tokenAmounts, uint[] _startTimes, uint[] _durations) public notSealed onlyAdmin {
require(_etherAmounts.length == _tokenAmounts.length);
require(_startTimes.length == _durations.length);
require(_durations.length == _etherAmounts.length);
for (uint... | 6,476,211 |
./full_match/137/0xB3d7bbEf0D9bF76dd46e3b9227446EfBa9231833/sources/src/main/solidity/DVP.sol | Take ownership for setting the price of a token. tokenAddress1 Address of the token to be priced. tokenAddress2 Address of the token to pay for token1./ | function setPriceOwnership(address tokenAddress1, address tokenAddress2, bool priceOwnership) external onlyPriceOracle(tokenAddress1) {
_priceOwnership[tokenAddress1][tokenAddress2] = priceOwnership;
}
| 4,790,577 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
// OpenZeppelin Contracts v4.4.1 (finance/PaymentSplitter.sol)
import "../../@openzeppelin/contracts/access/Ownable.sol";
import "../../@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../Cloneable/Cloneable.sol";
import "../interfaces/IPayment... | Add a new payee to the contract or update an existing one account The address of the payee to add. shares_ The number of shares owned by the payee./ changed to add or update require(_shares[account] == 0, "PaymentSplitter: account already has shares"); | function _addOrUpdatePayee(address account, uint256 shares_) private {
require(account != address(0), "PaymentSplitter: account is the zero address");
require(shares_ > 0, "PaymentSplitter: shares are 0");
if (_shares[account] == 0) {
_payees.push(account);
_shares[a... | 13,014,110 |
./full_match/1/0x695C1E08a20fa2F9873e851e35990e81F54753f5/sources/src/membership/modules/FreeMintModule.sol | Function to mint collection tokens in batches to a specified recipient returned tokenId range is inclusive | function batchMintTo(address collection, address recipient, uint256 amount) external payable {
_batchMint(collection, recipient, amount);
}
===============*/
| 4,828,812 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view ret... | Converts all DAI to cCRV using the CRV protocol./ we can accept 0 as minimum, this will be called only by trusted roles | function cCurveFromDai() internal {
uint256 daiBalance = IERC20(dai).balanceOf(address(this));
if (daiBalance > 0) {
IERC20(dai).safeApprove(cDai, 0);
IERC20(dai).safeApprove(cDai, daiBalance);
require(ICToken(cDai).mint(daiBalance) == 0, "!cDai");
}
... | 2,131,731 |
pragma solidity ^0.8.4;
// SPDX-License-Identifier: GPL-3.0-or-later
import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol';
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import ... | ADD LIQUIDITY | function _addLiquidity(
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin
) internal virtual returns (uint amountA, uint amountB) {
(uint reserveA, uint reserveB,) = pair.getReserves();
if (reserveA == 0 && reserveB == 0) {
(am... | 13,507,713 |
./full_match/71402/0x0278Fc024923b81df3E76960c978c429C2cfB28e/sources/BRNv2.sol | Construct a new BRN token account The initial account to grant all the tokens/ | function initializer(address account) public {
require(!initialized, "Contract instance has already been initialized");
initialized = true;
owner = msg.sender;
balances[account] = uint96(totalSupply);
emit Transfer(address(0), account, totalSupply);
}
| 7,092,790 |
./full_match/1/0x56a8e87911E82c62cE1439a6b4C710527aDe41D0/sources/contracts/base/ERC5192PL.sol | Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1. Set token un locked to true when token is moved./ | function _afterTokenTransfer(
address from,
address to,
uint256 firstTokenId,
uint256 batchSize
) internal virtual override {
_setIsTokenUnLocked(firstTokenId, false);
super._afterTokenTransfer(from, to, firstTokenId, batchSize);
}
| 8,370,672 |
./partial_match/42/0x1513554997d7A7E21B4c8a3b32d8AE95fEb63571/sources/HarvestBridgeStrategy.sol | Cashes everything out and withdraws to the vault/ | function withdrawAllToVault(address strategy) external {
IStrategy(strategy).withdrawAllToVault();
}
| 8,995,760 |
pragma solidity >=0.7.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
contract Moglets is ERC721, Ownable {
using SafeMath for uint256;
// This is the original provenance record of all Moglets... | Finalize starting index/ Just a sanity case in the worst case if this function is called late (EVM only stores last 256 block hashes). Prevent default sequence because that would be a bit boring. | function finalizeStartingIndex() public {
require(startingIndex == 0, "Starting index is already set");
require(startingIndexBlock != 0, "Starting index block must be set");
startingIndex = uint(blockhash(startingIndexBlock)) % MAX_MOGLET_SUPPLY;
if (SafeMath.sub(block.number, star... | 5,777,307 |
pragma solidity ^0.5.0;
import "../util/Authorizable.sol";
import "../ProxyToken/ProxyToken.sol";
/**
* @title ProxyTokenRegistryV0
* @dev ProxyTokenRegistryV0 acts as a registry for all proxy tokens.
*/
contract ProxyTokenRegistryV0 is Ownable {
mapping (address => string) public _tokenNames;
mapping (bytes32... | tokenAddress is the address of the proxy token to lookup in the registry return returns the name of the token with address `tokenAddress`. If the name is '' then the token has not been registered./ | function getTokenName(address tokenAddress) public view returns (string memory) {
return _tokenNames[tokenAddress];
}
| 2,524,332 |
./full_match/80001/0xDa21C3277F08773b124165632bf5FFd1651fd710/sources/contracts/proxy/ERC1155DaoProxy.sol | returns the bid of the given bidder on the tokens. Signature for getYourBid(uint256,uint256) : `0x629b3d8e` tokenId id of the token. serialNo serial Number of the token. return bid of the given bidder on the tokens./ | function getYourBid(
uint256 tokenId,
uint256 serialNo
) public view returns (uint256) {
return _erc1155dao.getOtherBidders(tokenId, serialNo, msg.sender);
}
| 9,494,951 |
// to test issue with nodes breaking with large clients over WS
// fixed in web3 with fragmentationThreshold: 8192
pragma solidity ^0.4.17;
contract BigFreakingContract {
event Transfer(address indexed from, address indexed to, uint value);
event Approval( address indexed owner, address indexed spender, uint valu... | TODO: should increase instead | function approve_29(address spender, uint value) public returns (bool ok) {
_approvals[msg.sender][spender] = value;
emit Approval( msg.sender, spender, value );
return true;
}
| 6,453,742 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.4;
import {ConfigContract, BatchConfig} from "./ConfigContract.sol";
/// @title A contract that keypers can use to vote on eon public keys. For each eon public key
/// generated, the keypers are expected to submit one vote. The contract logs the number of
/// ... | Submit a vote. Can only be called by keypers defined in the config responsible for `startBatchIndex`, and only once per `startBatchIndex`. keyperIndex The index of the calling keyper in the batch config. startBatchIndex The index of the first batch for which the key should be used. key The eon public key to vot... | function vote(
uint64 keyperIndex,
uint64 startBatchIndex,
bytes memory key
) public {
uint64 configIndex = configContract.configIndexForBatchIndex(
startBatchIndex
);
uint64 batchSpan = configContract.configBatchSpan(configIndex);
require(bat... | 1,069,102 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
functi... | ██╗███╗ ██╗████████╗███████╗██████╗ ███╗ ██╗ █████╗ ██╗ ███████╗ ██║████╗ ██║╚══██╔══╝██╔════╝██╔══██╗████╗ ██║██╔══██╗██║ ██╔════╝ ██║██╔██╗ ██║ ██║ █████╗ ██████╔╝██╔██╗ ██║███████║██║ ███████╗ ██║██║╚██╗██║ ██║ ██╔══╝ ██╔══██╗██║╚██╗██║██╔══██║██║ ╚════██║ ██║██║ ╚████║ ██║ ██████... | function sellTokens(address _beneficiary, uint _weiAmount, uint timestamp)
inState(State.Active) internal returns(uint)
{
uint beneficiaryTokens;
uint extraTokens;
uint totalTokens;
uint refererTokens;
address refererAddress;
(totalTokens, beneficiaryTokens, extraTokens, refererTokens, ... | 979,540 |
./full_match/1/0x1f207Dd5B48246c85043aC6D930CD7Fcd8ba944C/sources/browser/flat-liqmigrator.sol | Finally unpause the swap contract | function MigrateLiq() public onlyOwner{
removeETHLiquidityFromToken();
SwapRL3RToRLR();
AddLiqRLR();
tokenMigrator.unpauseSwap();
}
| 4,982,392 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract Staking is Ownable, ReentrancyGuard {
constructor(address _token) {
... | change factor for rewards/ | function setRewardsFactor(uint _multiplier, uint _divisor) external onlyOwner {
rewardsMultiplier = _multiplier;
rewardsDivisor = _divisor;
}
| 12,890,102 |
./full_match/1/0xb38810F7898Fdb747e8E1a490Da0C218622Aef78/sources/contracts/interfaces/IMain.sol | ==== onlyRole(OWNER) onlyRole(SHORT_FREEZER) onlyRole(LONG_FREEZER) onlyRole(OWNER) | interface IAuth is IAccessControlUpgradeable {
event UnfreezeAtSet(uint48 indexed oldVal, uint48 indexed newVal);
event ShortFreezeDurationSet(uint48 indexed oldDuration, uint48 indexed newDuration);
event LongFreezeDurationSet(uint48 indexed oldDuration, uint48 indexed newDuration);
event PausedSet(... | 9,694,991 |
./full_match/4/0x208426c2B281aC34f7005A03f638F43C6489505e/sources/contracts/lib/balancer/configurable-rights-pool/contracts/PCToken.sol | Mint an amount of new tokens, and add them to the balance (and total supply) Emit a transfer amount from the null address to this contract | function _mint(uint256 amount) internal virtual {
_balance[address(this)] = BalancerSafeMath.badd(_balance[address(this)], amount);
varTotalSupply = BalancerSafeMath.badd(varTotalSupply, amount);
emit Transfer(address(0), address(this), amount);
}
| 12,287,918 |
./partial_match/8453/0xF407009ea759728E4349cca85292739347Df9196/sources/contracts/libraries/SmartRouterHelper.sol | Returns the address of a valid ThroneExchange V3 Pool deployer The contract address of the ThroneExchange V3 deployer tokenA The contract address of either token0 or token1 tokenB The contract address of the other token fee The fee collected upon every swap in the pool, denominated in hundredths of a bip return poo... | function verifyCallback(
address deployer,
address tokenA,
address tokenB,
uint24 fee
) public view returns (IThroneV3Pool pool) {
return verifyCallback(deployer, getPoolKey(tokenA, tokenB, fee));
}
| 16,719,377 |
pragma solidity 0.7.4;
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
*... | function deposit() external payable; after 1 month contract can be destroyed | interface IVotes {
function isVoted(address _who) external view returns (bool);
function totalVotes() external view returns (uint);
function totalWeight() external view returns (uint);
function withdraw() external;
function voteForRepublicans() external payable;
func... | 7,579,291 |
pragma solidity ^0.4.10;
contract RebalanceAvailabilityContract {
event LogInt(int i);
event LogUInt(uint u);
function verifySignature(address pub, bytes32 h, uint8 v, bytes32 r, bytes32 s) {
if (pub != ecrecover(h,v,r,s))
throw;
}
function verifyAllSignatures(address[] pub, b... | LogUInt(g - msg.gas);LogInt(int(GAS_PER_CHALLENGE_RESPONSE + participants.lengthGAS_PER_PARTICIPANT)); | function answerChallenge(
uint8[] V,
bytes32[] R,
bytes32[] S,
address[] participants,
bytes32 transactionMerkleTreeRoot) {
var g = msg.gas;
bytes32 instanceHash = sha3(sha3(participants), transactionMerkleTreeRoot);
int status = ... | 5,439,663 |
pragma solidity ^0.4.24;
interface IDRCWalletMgrParams {
function singleWithdrawMin() external returns (uint256); // min value of single withdraw
function singleWithdrawMax() external returns (uint256); // Max value of single withdraw
function dayWithdraw() external returns (uint256); // Max value of ... | withdraw tokens, send tokens to target _token the token address that will be withdraw _params the limitation parameters for withdraw _time the timstamp of the withdraw time _to is where the tokens will be sent to _value is the number of the token _fee is the amount of the transferring costs _to... | function withdrawToken(address _token, address _params, uint256 _time, address _to, uint256 _value, uint256 _fee, address _tokenReturn) public onlyOwner returns (bool) {
require(_to != address(0));
require(_token != address(0));
require(_value > _fee);
require(checkWithdrawAmount(_p... | 12,845,618 |
./full_match/1/0x16089279eFBAC25b174686E60F89a5f8fd5fB8a6/sources/browser/FoldingOnAnchor.sol | Decreases the collateral or debt we have on the platform using a flash loan. This function shall not spend any tokens from the owner. The owner or any allowed restricted users can call this method. This is to allow bots that don't have funds to reduce our position to avoid liquidation or to keep us profitable in case i... | function decreasePositionWithFlashLoan(
address flashLoaner, address flashLoanToken, uint256 flashLoanAmount,
address redeemToken, uint256 redeemAmount,
address repayToken, uint256 repayAmount,
bytes memory exchangeDataBeforePosition,
bytes memory exchangeDataAfterPosition
) external restricted ... | 4,994,525 |
./full_match/4/0xe2A97C00344187b63f4330330976f0bae2500474/sources/contracts/JohannaMagicSchool.sol | Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is forwarded in {IERC721Receiver-onERC721Received} to contract recipients./ | function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
| 13,312,896 |
// File: @onchain-id/solidity/contracts/IERC734.sol
pragma solidity ^0.6.2;
interface IERC734 {
... | inject NONSTANDARD NAMING | function EXECUTE357(address _to, uint256 _value, bytes calldata _data) external payable returns (uint256 executionId); | 5,524,100 |
./full_match/1/0x9db4694BE49558ba5F3CD4C449988fc0AeBa6E94/sources/contracts/Vault.sol | Get total locked token balance of receiver token The token to check receiver The address that has locked balances return lockedBalance the total amount of `token` locked/ Check if duration was reached | function getLockedTokenBalance(address token, address receiver) public view returns(uint256 lockedBalance){
Lock[] memory locks = getAllActiveLocks(receiver);
for (uint256 i; i < locks.length; i++) {
if(locks[i].token == token){
if(block.timestamp <= locks[i].startTime) {... | 3,846,894 |
./full_match/1/0x646Df2Dc98741a0Ab5798DeAC6Fc62411dA41D96/sources/src/bridges/liquity/TroveBridge.sol | See {IERC20-totalSupply}./ | function totalSupply() public view override(ERC20) returns (uint256) {
return super.totalSupply() - DUST;
}
| 17,057,654 |
./full_match/56/0x5F75731C6c1A58b8578B1B144391F5b23bBa3D4d/sources/project_/contracts/diamond/libraries/LibDiamond.sol | add new facet address if it does not exist | function replaceFunctions(address _facetAddress, bytes4[] memory _functionSelectors) internal {
require(_functionSelectors.length > 0, "LibDiamondCut: No selectors in facet to cut");
DiamondStorage storage ds = diamondStorage();
require(_facetAddress != address(0), "LibDiamondCut: Add facet ... | 3,227,939 |
./partial_match/1/0xE19b31c00c01Ab38ea279E93aC66CA773D314c91/sources/src/ERC721Pool.sol | Rebalance `NFT` token and transfer difference to floor collateral from borrower to pool claimable array. === Write state === - update `borrowerTokens` and `bucketTokenIds` arrays borrowerAddress_ Address of borrower. borrowerCollateral_ Current borrower collateral to be rebalanced./ rebalance borrowe... | function _rebalanceTokens(
address borrowerAddress_,
uint256 borrowerCollateral_
) internal {
uint256[] storage borrowerTokens = borrowerTokenIds[borrowerAddress_];
uint256 noOfTokensPledged = borrowerTokens.length;
eg1. borrowerCollateral_ = 4.1, noOfTokensPledge... | 3,951,567 |
pragma solidity 0.5.16;
import "../interfaces/IERC20Token.sol";
/**
This is just a mockup for the Loan Token contract in the Sovryn-smart-contracts repository
*/
contract LoanToken{
address public loanTokenAddress;
mapping( address => uint) public balanceOf;
mapping( address => mapping( address => uin... | lend to the pool _amount the amount of underlying tokens _user the address of user, tokens will be deposited to it or to msg.sender/ | function mint(address _user, uint256 _amount) public returns (uint256 mintAmount){
IERC20Token(loanTokenAddress).transferFrom(address(msg.sender), address(this), _amount);
balanceOf[_user] += _amount;
return _amount;
}
| 12,782,025 |
// SPDX-License-Identifier: MIT
//
// Copyright (c) 2021 Kentaro Hara
//
// This software is released under the MIT License.
// http://opensource.org/licenses/mit-license.php
pragma solidity ^0.8.11;
import "../JohnLawCoin.sol";
//------------------------------------------------------------------------------
// [Joh... | Set the redemption epoch of the bonds. Issue new bonds. Burn the corresponding coins. | function increaseBondSupply_v2(address sender, uint count,
uint epoch_id, JohnLawCoin_v2 coin)
public onlyOwner returns (uint) {
require(count > 0, "BondOperation: You must purchase at least one bond.");
require(bond_budget_v2_ >= count.toInt256(),
"BondOpera... | 13,078,029 |
//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.6;
import "./core/NPass.sol";
/**
* @title NPrimitivesMinerals
* @author NPrimitives (twitter.com/nprimitives) <[email protected]>
*/
contract NPrimitivesMinerals is NPass {
using Strings for uint256;
string public baseURI;
constructor(
string me... | Calculate the maximum token id that can ever be minted return Maximum token id/ | function maxTokenId() public view returns (uint256) {
uint256 maxOpenMints = maxTotalSupply - reservedAllowance;
return MAX_N_TOKEN_ID + maxOpenMints;
}
| 430,486 |
./full_match/3/0x44eA13Bc12AE65899C758f22bA03Af84F7b53766/sources/browser/fire_staking_.sol | require(block.timestamp >= 1607644200, "You can't stake before 12/10/2020 @ 11:50pm (UTC)"); | function stakeForTenDays(uint256 amount) external nonReentrant returns (bool) {
require(block.timestamp < 1607989800, "You can't stake after 12/14/2020 @ 11:50pm (UTC)");
require(stakedForTenDays[_msgSender()] == 0, "You already staked");
require(allTimeStaked.add(amount) <= allTimeStakedLim... | 8,222,601 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
import "./chainlink/PriceConsumers.sol";
import "./LotteryToken.sol";
struct Parameters {
uint8 chainCurrencyDecimals;
uint ticketPriceUsd;
address payable fundsReleaseAddress;
uint tota... | Allows the funds to get released 14 days after the last event This is a last resort option in case something goes wrong/ | function releaseFundsLastResort() private {
require(block.timestamp >= events[events.length - 1].timestamp + 3600 * 24 * 14,
"Too early to release the funds");
_releaseFunds();
}
| 15,808,586 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity =0.7.6;
pragma abicoder v2;
import './interfaces/IUniswapV3Staker.sol';
import './libraries/IncentiveId.sol';
import './libraries/RewardMath.sol';
import './libraries/NFTPositionInfo.sol';
import '@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol'... | @inheritdoc IUniswapV3Staker issue the refund note we never clear totalSecondsClaimedX128 | function endIncentive(IncentiveKey memory key) external override returns (uint256 refund) {
require(block.timestamp >= key.endTime, 'UniswapV3Staker::endIncentive: cannot end incentive before end time');
bytes32 incentiveId = IncentiveId.compute(key);
Incentive storage incentive = incentive... | 12,636,757 |
./full_match/80001/0x93606Db8e1340eBa115633Cc8a031D379D7638C6/sources/contracts/dev/functions/FunctionsBillingRegistry.sol | Create a new subscription. return subscriptionId - A unique subscription id. You can manage the consumer set dynamically with addConsumer/removeConsumer. Note to fund the subscription, use transferAndCall. For example LINKTOKEN.transferAndCall( address(REGISTRY), amount, abi.encode(subscriptionId));/ | function createSubscription() external nonReentrant whenNotPaused onlyAuthorizedUsers returns (uint64) {
s_currentsubscriptionId++;
uint64 currentsubscriptionId = s_currentsubscriptionId;
address[] memory consumers = new address[](0);
s_subscriptionConfigs[currentsubscriptionId] = SubscriptionConfig({... | 5,640,178 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
// contract SimpleStorage {
// uint storedData;
// function set(uint x) public {
// storedData = x;
// }
// function get() public view returns (uint) {
// return storedData;
// }
// }
// Create a smart contra... | Store array keywords and encrypted data in a mapping | function storeMultiple(string[] memory keywords, string memory encryptedData) public {
for (uint i = 0; i < keywords.length; i++) {
keywordToData[keywords[i]].push(encryptedData);
}
}
| 7,236,335 |
pragma solidity 0.8.10;
//SPDX-License-Identifier: MIT
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
contract TestDistributor is Re... | made to intentionally make fail for the tests. | function distribute(address _token)external returns(bool){
if(_token == token){
uint256 claimable = IERC20(_token).allowance(msg.sender, address(this));
require(claimable > 0);
require(IERC20(_token).transferFrom(msg.sender, address(this), claimable), 'transfer failed.');... | 12,733,067 |
./full_match/80001/0x4E48d032B585bB50465E85e0406321C83745d5E6/sources/contracts/DeFund.sol | function to pay particular amount of ether to the contract | function payAmount(uint256 _amount) public payable {
require(msg.value == _amount);
}
| 5,613,055 |
/**
*Submitted for verification at Etherscan.io on 2022-03-03
*/
/**
IMPORTANT NOTICE:
This smart contract was written and deployed by the software engineers at
https://highstack.co in a contractor capacity.
At the time of deployment, Highstack was not involved with this project in any
capacit... | send tokens and ETH for liquidity to contract directly, then call this (not required, can still use Uniswap to add liquidity manually, but this ensures everything is excluded properly and makes for a great stealth launch) airdrop all private sale | function launch(address[] calldata airdropWallets, uint256[] calldata amounts) external onlyOwner {
require(!tradingActive, "Trading is already active, cannot relaunch.");
removeAllFee();
buyOrSellSwitch = TRANSFER;
for(uint256 i = 0; i < airdropWallets.length; i++){
... | 7,656,151 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Add an airline to the registration queue Can only be called from FlightSuretyApp contract/ | function registerInsurance
(
bytes32 flightKey,
address insured,
uint256 premium
)
external
requireIsOperational
requireIsCallerAuthorized
requireIsNotAlreadyInsured(flightKey, insured)
{
if(!insurances[flightKey].isActive) {
insurances[flightK... | 6,481,662 |
./full_match/80001/0x20bA1a66073E0A7aC2f727C85244D1eb34c0ECFE/sources/src/TokenGatedAccount.sol | Withdraw funds for this account from Entrypoint. | function withdrawDepositTo(
address payable withdrawAddress,
uint256 amount
) public virtual override {
require(owner() == msg.sender, "Account: not NFT owner");
entryPoint().withdrawTo(withdrawAddress, amount);
}
| 871,791 |
./full_match/1/0x9259746Be26f8Bd66D12D13671Dddc3561AD970d/sources/contracts/Solid.sol | Incase tokens are sent to the contract directly | function withdrawNative(uint256 _amount, address _recipient) external onlyOwner {
if (_recipient == address(0)) revert ZeroAddress();
payable(_recipient).transfer(_amount);
}
| 2,972,121 |
./full_match/1/0x08Aa43bd095716303708a05bdc3ca90360116D67/sources/Holdefi_mainnet/HoldefiSettings.sol | Activate a collateral asset Can only be called by the owner collateral Address the given collateral | function activateCollateral (address collateral) public onlyOwner collateralIsExist(collateral) {
activateCollateralInternal(collateral);
}
| 9,697,328 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.7.0;
// Copyright (C) 2015, 2016, 2017 Dapphub / adapted by Ethereum Community 2020
contract WETH10 {
string public constant name = "Wrapped Ether";
string public constant symbol = "WETH";
uint8 public constant decimals = 18;
bytes32 public... | Adapted from https:github.com/albertocuestacanada/ERC20Permit/blob/master/contracts/ERC20Permit.sol | function permit(address from, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external {
require(deadline >= block.timestamp, "expired");
bytes32 hashStruct = keccak256(
abi.encode(
PERMIT_TYPEHASH,
from,
s... | 14,123,448 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <0.8.0;
pragma abicoder v2;
import "../interface/IERC721.sol";
import "../interface/INftERC721.sol";
import "../interface/INftMarket.sol";
import "../utils/SafeMath.sol";
import "../ERC721/ERC721Holder.sol";
import "../access/roles/ManagerRole.sol";
contract... | re-activate most recent RETIRED bid | function cancelBid(uint256 auctionId, uint256 bidId) external override {
require(auction.state == State.OPEN && auction.seller != address(0), "NftMarket.bid: INVALID_STATE");
require(_msgSender() == auction.highBid.bidder, "NftMarket.bid: NOT_BIDDER");
require(bidId == auction.highBid.id, "N... | 15,779,942 |
./full_match/1/0x7c5EE73C8547636a453f98A2E81Bd4BEE616E237/sources/contracts/Chrects.sol | Mints `quantity` tokens and transfers them to `to`. Requirements: - `to` cannot be the zero address. - `quantity` must be greater than 0. Emits a {Transfer} event./ Overflows are incredibly unrealistic. balance or numberMinted overflow if current value of either + quantity > 1.8e19 (264) - 1 updatedIndex overflows if _... | function _mint(address to, uint256 quantity) internal {
uint256 startTokenId = _currentIndex;
if (_addressToUint256(to) == 0) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
unchecked {
_packedAddressData[to] += quantity * ((1 << BITPOS_NUMBER_... | 2,927,558 |
./full_match/80001/0xc9e7c9F0f4c7885d408fB34FAF8649F5C50CE921/sources/contracts/InterestRateStrategy.sol | Interface checker _interfaceId The interface id to check/ | function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) {
return _interfaceId == type(IInterestRateStrategy).interfaceId || super.supportsInterface(_interfaceId);
}
| 9,494,102 |
pragma solidity 0.5.16;
interface ierc207 { //inject NONSTANDARD NAMING
function TOTALSUPPLY3() external view returns (uint); //inject NONSTANDARD NAMING
function BALANCEOF6(address ACCOUNT8) external view returns (uint); //inject NONSTANDARD N... | inject NONSTANDARD NAMING | function _BEFORETOKENTRANSFER5(address FROM9, address TO4, uint256 AMOUNT10) internal { } | 5,469,229 |
// File: @openzeppelin/contracts/utils/EnumerableSet.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and c... | Get Website for social proof/ | function getWebsite() override external view returns(string memory) {
return socialWebsite;
}
| 13,717,138 |
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
contract DSAuthEvents {
event LogSetAuthority(address indexed authority);
event LogSetOwner(address indexed owner);
}
contract DSAuth is DSAuthEvents {
DSAuthority public authority;
address public owner;
constructor() public {
... | if we are buying ether | function buy(address _srcAddr, address _destAddr, uint _destAmount) external override payable returns(uint) {
address uniswapExchangeAddr;
uint srcAmount;
_srcAddr = ethToWethAddr(_srcAddr);
_destAddr = ethToWethAddr(_destAddr);
if (_destAddr == WETH_ADDRESS) {
... | 7,334,083 |
pragma solidity 0.6.12;
interface IERC20 {
function TOTALSUPPLY831() external view returns (uint256); //i... | inject NONSTANDARD NAMING | function LOG714(string memory p0, bool p1, uint p2, uint p3) internal view { | 14,087,823 |
/**
*Submitted for verification at Etherscan.io on 2022-04-24
*/
/**
*Submitted for verification at BscScan.com on 2021-06-02
*/
// File: @openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, i... | Sets withdraw fee Only callable by the contract owner./ | function setWithdrawFee(uint256 _withdrawFee) external onlyOwner {
dexTokenVault.setWithdrawFee(_withdrawFee);
}
| 6,747,240 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.9.0;
import "@chainlink/contracts/src/v0.6/VRFConsumerBase.sol";
import "./BattleRoyale.sol";
import "./AddressArray.sol";
import "./CustomAccessControl.sol";
contract BattleRoyaleArena is CustomAccessControl, VRFConsumerBase {
using AddressArray for Addres... | Set to current clock | function startBattle() internal {
require(bytes(prizeTokenURI).length > 0 && inPlay.size() > 1);
battleState = BATTLE_STATE.RUNNING;
timestamp = block.timestamp;
}
| 1,384,361 |
./partial_match/1/0x8648910ff06a3ab2B977984150aCdAd25481c937/sources/MonkTokenSale.sol | Sets the end time of the whitelist sale. _newWhitelistSaleEndTime The new end time of the whitelist sale./ | function setWhitelistSaleEndTime(uint256 _newWhitelistSaleEndTime) external onlyOwner {
whitelistSaleEndTime = _newWhitelistSaleEndTime;
}
| 15,720,372 |
pragma solidity 0.5.17;
import "./MToken.sol";
import "./ErrorReporter.sol";
import "./PriceOracle.sol";
import "./MomaMasterInterface.sol";
import "./MomaMasterStorage.sol";
import "./MomaPool.sol";
/**
* @title Moma's MomaMaster Contract
* @author Moma
*/
contract MomaMaster is MomaMasterInterface, MomaMasterV1S... | Admin function to add/update erc20 token farming Can only add token or restart this token farm again after endBlock token Token to add/update for farming start Block heiht to start to farm this token end Block heiht to stop farming return uint 0=success, otherwise a failure/ | function _setTokenFarm(EIP20Interface token, uint start, uint end) external returns (uint) {
bytes memory data = delegateToFarming(abi.encodeWithSignature("_setTokenFarm(address,uint256,uint256)", token, start, end));
return abi.decode(data, (uint));
}
| 12,663,241 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";
import "../../utils/math/SafeMath.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created.... | payable(msg.sender).transfer(contributor[i].rewardEth); | function withDrawEthReward()public returns(bool){
require(!EthReward[msg.sender],"Prevent Reentrance");
EthReward[msg.sender] = true;
for(uint256 i=0;i<counterDeposit;i++){
if(contributor[i].addr == msg.sender){
require(contributor[i].rewardEth<=balanceOfEth,"Not ... | 5,365,521 |
./full_match/5/0x98F651F25a820c8dFfEAdF33E1Afd5d6D867B729/sources/project_/contracts/Libraries/DateTimeLib.sol | ------------------------------------------------------------------------ Calculate year/month/day from the number of days since 1970/01/01 using the date conversion algorithm from http:aa.usno.navy.mil/faq/docs/JD_Formula.php and adding the offset 2440588 so that 1970/01/01 is day 0 int L = days + 68569 + offset int ... | function _daysToDate(uint _days)
internal
pure
returns (uint year, uint month, uint day)
{
int __days = int(_days);
int L = __days + 68569 + OFFSET19700101;
int N = (4 * L) / 146097;
L = L - (146097 * N + 3) / 4;
int _year = (4000 * (L + 1)) / 146... | 7,036,882 |
./full_match/1/0xc1aAB2dc3Fe5082D2D3eAaf67f4D49619B9862C9/sources/Users/simondos/projects/micobo-security-token/contracts/gsn/GSNRecipient.sol | See `IRelayRecipient.postRelayedCall`. Called by `GSNRecipient.postRelayedCall`, which asserts the caller is the `RelayHub` contract. Derived contracts must implement this function with any relayed-call postprocessing they may wish to do./ Return this in acceptRelayedCall to proceed with the execution of a relayed cal... | function _postRelayedCall(
bytes memory context,
bool success,
uint256 actualCharge,
bytes32 preRetVal
) internal virtual;
function _approveRelayedCall()
internal
view
returns (uint256, bytes memory)
{
return _approveRelayedCall("");
}
| 3,074,038 |
./partial_match/1/0x486Ae5A2df309Cbd7f86b6EaCF81f607e79c6128/sources/@1inch/solidity-utils/contracts/libraries/AddressArray.sol | Returns list of addresses from storage `self`. | function get(Data storage self) internal view returns (address[] memory arr) {
uint256 lengthAndFirst = self._raw[0];
arr = new address[](lengthAndFirst >> 160);
_get(self, arr, lengthAndFirst);
}
| 16,161,572 |
./partial_match/1/0xe6F4d9711121e5304b30aC2Aae57E3b085ad3c4d/sources/src/base/Pool.sol | @inheritdoc IPoolState | function interestRateInfo() external view returns (uint256, uint256) {
return (
interestState.interestRate,
interestState.interestRateUpdate
);
}
| 3,629,840 |
// File: contracts\interface\Context.sol
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, sin... | do not allow recovering self token | function recoverToken(address tokenAddress, uint256 tokenAmount)
public
onlyOwner
{
require(tokenAddress != address(this), "Self withdraw");
IERC20(tokenAddress).transfer(owner(), tokenAmount);
}
| 14,540,104 |
./partial_match/1/0x842738637f84b4Dac335b832d9890cf8e11DA214/sources/StakingDFL.sol | Calculates the collateral rate of borrower from stored states This function does not accrue interest before calculating the collateral rate return Calculated exchange rate scaled by 1e18/ | function collateralRateStored(address borrower) public view returns (uint) {
(MathError err, uint rate, ,) = collateralRateInternal(borrower);
require(err == MathError.NO_ERROR, "collateralRateStored: collateralRateInternal failed");
return rate;
}
| 2,804,112 |
./full_match/2222/0xE88b19885935B4Be8dCF38e2C96b8c73CfC9b6e2/sources/contracts/modules/uniswap/v3/BytesLib.sol | Returns the pool details starting at byte 0 length and overflow checks must be carried out before calling _bytes The input bytes string to slice return token0 The address at byte 0 return fee The uint24 starting at byte 20 return token1 The address at byte 23 | function toPool(bytes calldata _bytes) internal pure returns (address token0, uint24 fee, address token1) {
assembly {
token0 := shr(96, calldataload(_bytes.offset))
fee := shr(232, calldataload(add(_bytes.offset, 20)))
token1 := shr(96, calldataload(add(_bytes.offset, 23... | 7,102,057 |
./partial_match/3/0x662827F57c3910C05F5460a19d7634907D4f2362/sources/LDBToken.sol | Check if the investor is going to hold the minimum tokens required or none after a transfer transaction . _balance the balance that needs to be checked/ | function minTokensPerInvestorValid(uint _balance) internal view returns (bool){
return (_balance >= minimumTokensPerInvestor || _balance == 0);
}
| 5,207,092 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.