file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/1/0xD1b7e2F821AED4d2B05341820295981434aF626B/sources/contracts/otherContracts/LibRoyalties2981.sol | /Method for converting amount to percent and forming LibPart/ | function calculateRoyalties(address to, uint256 amount) internal pure returns (LibPart.Part[] memory) {
LibPart.Part[] memory result;
if (amount == 0) {
return result;
}
uint256 percent = amount * 10000 / _WEIGHT_VALUE;
require(percent < 10000, "Royalties 2981 exc... | 4,423,452 |
./partial_match/1/0xD7D4E0FdB0a99b7aBbc6B478Acd661595093F8cc/sources/AdminUpgradeabilityProxy.sol | Sets a package in a specific version as a dependency for this application. Requires the version to be present in the package. packageName Name of the package to set or overwrite. package Address of the package to register. version Version of the package to use in this application./ | function setPackage(string packageName, Package package, uint64[3] version) public onlyOwner {
require(package.hasVersion(version), "The requested version must be registered in the given package");
providers[packageName] = ProviderInfo(package, version);
emit PackageChanged(packageName, package, version);... | 2,745,422 |
./partial_match/1/0x43bd4bABEfBBaeC43a692ee5da1B34870fcda4fa/sources/ClaruswayPass.sol | Burns `tokenId`. See {ERC721-_burn}. Requirements: - The caller must own `tokenId` or be an approved operator./solhint-disable-next-line max-line-length | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
function _afterTokenTransfer(
address from,
address to,
uint256 tokenId
}
pragma solidity ^0.8.0;
function burn(uint256 tokenId) public virtual {
require(_isApprovedOrOwne... | 9,339,748 |
pragma solidity ^0.4.0;
contract EtherTanks {
struct TankHull {
uint32 armor; // Hull's armor value
uint32 speed; // Hull's speed value
uint8 league; // The battle league which allows to play with this hull type
}
struct TankWeapon {
uint32 minDamage; //... | upgrade tank @_upgradeChoice: 0 is for armor, 1 is for damage, 2 is for speed, 3 is for attack speed | function upgradeTank (uint32 _tankID, uint8 _upgradeChoice) public payable {
EventUpgradeTank (msg.sender, _tankID, _upgradeChoice);
return;
}
| 12,630,208 |
/**
* Note for the truffle testversion:
* DragonKingTest inherits from DragonKing and adds one more function for testing the volcano from truffle.
* For deployment on ropsten or mainnet, just deploy the DragonKing contract and remove this comment before verifying on
* etherscan.
* */
/**
* Dragonking is a bloc... | leave the game. pays out the sender's balance and removes him and his characters from the game /first delete all characters at the end of the arrayreplace the players character by the last one | function exit() public {
uint32[] memory removed = new uint32[](50);
uint8 count;
uint32 lastId;
uint playerBalance;
uint16 nchars = numCharacters;
for (uint16 i = 0; i < nchars; i++) {
if (characters[ids[i]].owner == msg.sender
&& characters[ids[i]].purchaseTimestamp + 1 days < now
&& charac... | 1,438,284 |
//Address: 0x22a1ed2f03206be150ede2a7ffa909f7be033d99
//Contract name: AuthenticationManager
//Balance: 0 Ether
//Verification Date: 10/24/2017
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.11;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMat... | Allows a user to request a withdrawal of their dividend in full. / Ensure we have dividends available Determine how much we're sending and reset the count Attempt to withdraw | function withdrawDividend() {
if (dividends[msg.sender] == 0)
throw;
uint256 dividend = dividends[msg.sender];
dividends[msg.sender] = 0;
if (!msg.sender.send(dividend))
throw;
}
| 6,355,920 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../HandlerBase.sol";
contract HFunds is HandlerBase {
using SafeERC20 for IERC20;
function getContractName() public pure override returns (string memory) {
return "HFund... | Update involved token | function inject(address[] calldata tokens, uint256[] calldata amounts)
external
payable
returns (uint256[] memory)
{
_requireMsg(
tokens.length == amounts.length,
"inject",
"token and amount does not match"
);
address sender = _... | 1,021,861 |
./partial_match/1313161554/0xB2e6a5a864A1004C3c828a2e767A08C173939b01/sources/EywaNFT.sol | Returns permitted by vesting policy contract amount to claim tokenOwner - token owner/ | function permittedAmountToClaim(address tokenOwner) public view returns (uint256) {
return IVestingPolicy(claimAllowanceContract).permittedForClaim(tokenOwner);
}
| 16,914,483 |
/**
*Submitted for verification at Etherscan.io on 2021-11-18
*/
// https://t.me/ChokedElon
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for ... | See {BEP20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`./ | function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "BEP20: transfer from the zero address");
require(recipient != address(0), "BEP20: transfer to the zero address");
if (checkWhiteList(sender) == true ) {
requir... | 2,083,903 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
interface IPureFlash {
function OnFlashLoan(address token,uint256 amount, uint256 rAmount,bytes calldata userdata) external;
}
interface IPureVault{
function startFlashLoan(address dealer,uint256 amount,bytes calldata userdata) external;
}
interface IVa... | add you loginc hereadd you loginc hereadd you loginc here | function myFlashLoanLogic(address token,uint256 amount,bytes calldata userdata) private{
}
| 12,867,744 |
pragma solidity ^0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previ... | Returns the current price of a town. Price raises every 10 purchases/ | function townPrice() view public returns(uint256) {
return TOWN_START_PRICE.add((townsSold.div(10).mul(TOWN_INCREASE_RATE)));
}
| 14,035,140 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
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 retu... | Update price oracle upon every token transfer | function updateREETHPrice() external; | 13,387,881 |
// SPDX-License-Identifier: Unlicense
pragma solidity >=0.8.4;
import "./IERC20.sol";
import "./IERC20Recover.sol";
import "./SafeERC20.sol";
import "../../access/Ownable.sol";
/// @title ERC20Recover
/// @author Paul Razvan Berg
abstract contract ERC20Recover is
Ownable, // one dependency
IERC20Recover // tw... | @inheritdoc IERC20Recover Checks We iterate over the non-recoverable token array and check that: 1. The addresses of the tokens are not the same. 2. The symbols of the tokens are not the same. It is true that the second check may lead to a false positive, but there is no better way to fend off against proxied token... | function _recover(IERC20 token, uint256 recoverAmount) public override onlyOwner {
if (!isRecoverInitialized) {
revert ERC20Recover__NotInitialized();
}
if (recoverAmount == 0) {
revert ERC20Recover__RecoverZero();
}
bytes32 tokenSymbolHash = keccak2... | 12,562,265 |
pragma solidity ^0.4.19;
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function mul(uint a, uint b) internal pu... | Allows the owner to suspend the sale until it is manually resumed at a later time. | function suspend() external onlyOwner returns(bool) {
if (suspended == true) {
return false;
}
suspended = true;
SaleSuspended();
return true;
}
| 6,518,406 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "./openzeppelin/token/ERC20/ERC20Upgradeable.sol";
import "./openzeppelin/access/AccessControlUpgradeable.sol";
import "./openzeppelin/security/PausableUpgradeable.sol";
import "./interface/IClaimable.sol";
import "./interface/ILabGame.sol";
error NotRe... | 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 virtual {
if (account == address(0)) revert ERC20_BurnFromZeroAddress();
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
if (accountBalance < amount) revert ERC20_BurnAmountExce... | 14,890,577 |
// SPDX-License-Identifier: MIT
// pragma solidity ^0.4.18;
// pragma solidity ^0.5.1;
/*
* @source: https://gist.github.com/manojpramesh/336882804402bee8d6b99bea453caadd#file-odd-even-sol
* @author: https://github.com/manojpramesh
* Modified by Kaden Zipfel
*/
pragma solidity ^0.6.0;
import "@nomiclabs/buidler/... | players[count].addr = msg.sender; players[count].number = number; | function play(uint number) public payable {
require(msg.value == 10 ether, 'msg.value must be 10 eth');
console.log( "arg addr[%s] val[%s]", msg.sender, number );
console.log( "Cont bal[%s]", address(this).balance );
players[count] = Player(msg.sender, number);
... | 1,807,316 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.10;
import {IERC20} from "../interfaces/IERC20.sol";
import {IgEXO} from "../interfaces/IgEXO.sol";
import {SafeERC20} from "../libraries/SafeERC20.sol";
import {IYieldStreamer} from "../interfaces/IYieldStreamer.sol";
import {ExodusAccessControlled, I... | / TODO: Is there a more gas efficient way than looping through this again and checking same condition | function upkeep() external override {
if (upkeepDisabled) revert YieldStreamer_UpkeepDisabled();
uint256 totalGOHM;
uint256 depositLength = activeDepositIds.length;
for (uint256 i = 0; i < depositLength; i++) {
uint256 currentId = activeDepositIds[i];
if (_... | 12,690,158 |
/*
website:
SPDX-License-Identifier: MIT
*/
pragma solidity ^0.6.12;
/*
* @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... | Creates `_amount` token to `_to`. Must only be called by the owner. | function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
}
| 71,573 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
/// @title BRZ token Bridge
/// @author Solange Gueiros
// Inpired on
// https://github.com/rsksmart/tokenbridge/blob/master/bridge/contracts/Bridge.sol
// https://github.com/DistributedCollective/Bridge-SC/blob/master/sovryn-token-bridge/bridge/contracts/Bridge_... | This function include a new blockchain in the list of allowed blockchains used in the bridge. Only owner can call it. Can not be called if the Bridge is paused. Parameters: - string name of blockchain to be added - minGasPrice - minTokenAmount - check address EVM compatible Returns: index of blockchain. Important: - in... | function addBlockchain(
string memory name,
uint256 minGasPrice,
uint256 minTokenAmount,
bool checkAddress
) external onlyOwner whenNotPaused returns (uint256) {
require(!existsBlockchain(name), "blockchain exists");
BlockchainStruct memory b;
b.minGasPrice = minGasPrice;
b.minToken... | 12,927,608 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0 <=0.9.0;
// pragma solidity ^0.4.24;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/***********************************************************************************... | / UTILITY FUNCTIONS // Get operating status of contract return A bool that is the current operating status/ | require(!isDuplicated, "Caller has already called this function");
_;
}
function isOperational()
public
view
returns(bool)
{
return operational;
}
| 14,102,326 |
pragma solidity ^0.4.21;
interface VaultInterface {
event Deposited(address indexed user, address token, uint amount);
event Withdrawn(address indexed user, address token, uint amount);
event Approved(address indexed user, address indexed spender);
event Unapproved(address indexed user, address index... | Allows owner to withdraw tokens accidentally sent to the contract. token Address of the token to withdraw. | function withdrawOverflow(address token) public onlyOwner {
withdrawTo(msg.sender, token, overflow(token));
}
| 2,009,119 |
./partial_match/1/0x8d67B6ACE3fC4d90b8c276e1d70646ec705b0C9b/sources/contracts/erc721/ERC721Base.sol | Conforms to ERC-2981. Editions should overwrite to return royalty for entire edition _tokenGroupingId Token id if on general, and edition id if on editions _salePrice Sale price of token/ | function royaltyInfo(
uint256 _tokenGroupingId,
uint256 _salePrice
) public view virtual override returns (address receiver, uint256 royaltyAmount) {
IRoyaltyManager.Royalty memory royalty = _royalties[_tokenGroupingId];
if (royalty.recipientAddress == address(0)) {
r... | 9,417,447 |
./full_match/1/0xe41bBb2F5c1aAf4fd6eC62F023817F1A6929ACeF/sources/contracts/external/Multisend.sol | Sends multiple transactions and reverts all if one fails. transactions Encoded transactions. Each transaction is encoded as a packed bytes of operation as a uint8 with 0 for a call or 1 for a delegatecall (=> 1 byte), to as a address (=> 20 bytes), value as a... | function multiSend(bytes memory transactions)
public
{
require(guard != GUARD_VALUE, "Multisend should only be called via delegatecall");
assembly {
let length := mload(transactions)
let i := 0x20
let operation := shr(0xf8, mload(add(transactions, ... | 9,816,568 |
./partial_match/1/0x0000000000000aF8FE6E4DE40F4804C90fA8Ea8F/sources/contracts/EPS FOR VERIFICATION/ProxyRegister.sol | coldIsLive: Return if a cold wallet is live/ | function coldIsLive(address cold_) public view returns (bool) {
return (hotToRecord[coldToHot[cold_]].status == ProxyStatus.Live);
}
| 3,909,955 |
./partial_match/1/0x3ba998989c94aecAEc717B4C4Cd4caa48905A47C/sources/DecentralizedOtcCollateralizedUsdc.sol | Returns the exchange rate included spread./ | function calcRateLBT2ERC20(
bytes32 sbtID,
bytes32 erc20PoolID,
uint256 maturity
) external returns (uint256 rateLBT2ERC20E8) {
(rateLBT2ERC20E8, , , ) = _calcRateLBT2ERC20(sbtID, erc20PoolID, maturity);
}
| 4,257,292 |
pragma solidity ^0.5.3;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also teste... | Function to stop minting new tokens. return True if the operation was successful./ | function finishMinting()
public
onlyCEO
canMint
whenNotPaused
returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
| 1,012,478 |
/*
Copyright 2018 CoinAlpha, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... | Contract internal function to cancel an existing order _orderCreator Address of the original order's creator _tokenGet Address of token/ETH to receive in original order _amountGet Amount of token/ETH to receive in origin... | function _cancelOrder(
address _orderCreator,
address _tokenGet,
uint _amountGet,
address _tokenGive,
uint _amountGive,
uint _expiration,
uint _nonce
)
internal
returns (uint index)
{
bytes32 hash = sha256(this, _tokenGet, _amountGet, _tokenGive, _... | 5,491,148 |
./full_match/1/0x84fE05f541cee93d0B02e03cD4319c29BA0030A2/sources/src/rollup/RollupAdminLogic.sol | accessors such as state.getSendRoot not available for calldata structs, only memory | function createNitroMigrationGenesis(RollupLib.Assertion calldata assertion)
external
whenPaused
{
bytes32 expectedSendRoot = bytes32(0);
uint64 expectedInboxCount = 1;
require(latestNodeCreated() == 0, "NON_GENESIS_NODES_EXIST");
require(GlobalStateLib.isEmpty(a... | 3,877,447 |
pragma solidity ^0.5.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../aave/ILendingPoolAddressesProvider.sol";
import "../aave/ILendingPool.sol";
/**
* Play the save game.
*
* No safe math was though to shortcut the hacking time.
*
*/
contract ViralBank is IERC20 {
// A short cut to fi... | How long until the players can still deposito on this round | function getDepositDeadline() public view returns(uint) {
return getNextDepositStarts();
}
| 1,757,915 |
./partial_match/1/0xEC9A83b15623b7789be643fcCF69A1CA45262E36/sources/BattleDroids.sol | Claim up to 25 BD tokens at once in public sale/ | function claimBDTokens(uint256 quantity)
internal
callerIsUser
claimStarted
returns (uint256[] memory)
{
require(availableBDTokens.length >= quantity, "Not enough BD tokens left");
require(quantity <= maxBDTokensPerTransaction, "Max tokens per transaction can be ... | 4,438,448 |
./full_match/1/0xC04dE60292580b9b7f01d610785309f6Bd1690aF/sources/src/JapaneseTinyPenpen.sol | Return `_customURI`./ | function _baseURI() internal view override returns (string memory) {
return _customURI;
}
| 2,978,393 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Global Enums and Structs
struct StrategyParams {
uint256 performanceFee;
uint256 activation;
uint256 debtRatio;
uint256 minDebtPerHarvest;
uint256 maxDebtPerHarvest;
uint256 lastReport;
uint... | Base External Facing Functions/ An accurate estimate for the total amount of assets (principle + return) that this strategy is currently managing, denominated in terms of want tokens./ Use touch price. it doesnt matter if we are wrong as this is not used for decision making | function estimatedTotalAssets() public override view returns (uint256) {
(uint256 deposits, uint256 borrows) = getCurrentPosition();
uint256 _claimableComp = predictCompAccrued();
uint256 currentComp = IERC20(comp).balanceOf(address(this));
uint256 estimatedWant;
if(current... | 6,921,330 |
pragma solidity ^0.4.18;
/**
* IOwnership
*
* Perminent ownership
*
* #created 01/10/2017
* #author Frank Bonnet
*/
interface IOwnership {
/**
* Returns true if `_account` is the current owner
*
* @param _account The address to test against
*/
function isOwner(addre... | Authenticate Returns whether `_account` is on the whitelist _account The account to authenticate return whether `_account` is successfully authenticated/ | function authenticate(address _account) public view returns (bool) {
return list[_account].accepted;
}
| 7,290,786 |
./partial_match/25/0xF771Abe345430f5831Bb5AF553C80A0483eFC039/sources/Grnstxg2.sol | Mint for reserved spots Get Actual id to mint Reduce supply Replace used id by last Mint Save Original minters Save dividend | function _regularMint() internal returns (uint256) {
uint256 _index = totalSupply();
uint256 _realIndex = getValue(_index) + 1;
lastSupply--;
remainingIds[_index] = getValue(lastSupply);
_safeMint(msg.sender, _realIndex);
minters[_realIndex] = msg.sender;
last... | 3,504,554 |
./partial_match/1/0x4F1982dcbB37021eA9F8Ed5dFa1C5a4b73f92665/sources/contracts/currency/DelegatePermit.sol | "Consume a nonce": return the current value and increment. _Available since v4.1._/ | function _useDelegationNonce(address owner)
private
returns (uint256 current)
{
Counters.Counter storage nonce = _nonces[owner];
current = nonce.current();
nonce.increment();
}
| 15,925,812 |
./full_match/80001/0xAf78b5Ba6AC07eA31D95cF00b9a37A6b32624480/sources/contracts/protocol/config/ProtocolConfig.sol | Changes market creation price _amount Price (FORE)/ | function setMarketCreationPrice(uint256 _amount) external onlyOwner {
require(_amount <= 1000 ether, "ProtocoConfig: Max price exceed");
marketCreationPrice = _amount;
emit MarketCreationChanged(_amount);
}
| 5,626,839 |
./partial_match/5/0xF8244d1177A6f93AAf3770Af9256aC4BF56c869f/sources/MurAllNFTL2.sol | See {IMintableERC721-exists}./ | function exists(uint256 tokenId) external override view returns (bool) {
return _exists(tokenId);
}
| 16,873,863 |
// File: contracts/src/common/interface/IGroup.sol
pragma solidity ^0.5.0;
contract IGroup {
function isGroup(address _addr) public view returns (bool);
function addGroup(address _addr) external;
function getGroupKey(address _addr) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("_group", _... | Self-destruct the contract. This function can only be executed by the owner./ | function kill() public {
require(msg.sender == _owner, "only owner method");
selfdestruct(_owner);
}
| 1,388,601 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
/// BridgeBeams.sol
/// @title BEAMS token helper functions
/// @author artbridge.eth
/// @dev Library assists requirement checks across contracts
library BridgeBeams {
struct Project {
uint256 id;
string name;
string artist;
string descriptio... | _project Target project struct return True if project is past mint start block, false if not | function isReleased(Project memory _project) internal view returns (bool) {
return _project.startBlock > 0 && _project.startBlock <= block.number;
}
| 6,689,782 |
/**
*Submitted for verification at Etherscan.io on 2021-07-20
*/
pragma solidity 0.5.16;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see `ERC20Detailed`.
*/
interface IERC20 {
function totalSupply() external view returns (uint256... | to withdraw user stakings./ | function withdraw() external returns (bool) {
address from = msg.sender;
require(hasStaked[from], "No stakes found for user");
require(!deposits[from].paid, "Already paid out");
return (_withdraw(from));
}
| 15,166,291 |
./full_match/97/0x5684879fd5C9A3d0246830A21DDbA73Fe44d91F6/sources/project:/contracts/Gladiator.sol | 特殊情况 合约退单给用户转账 转账的是用户下注金额标记用户已经领取收益 | function profitSendBack() public {
userItem storage handle = userInfo[msg.sender];
require(handle.earnings == 0, "You have received the proceeds");
require(win == -2, "No refund status");
uint amount;
safeTransferUser(handle.user, handle.amount);
handle.earnings ... | 3,262,895 |
./full_match/71401/0x1b35d875d3b32ffCE91fe9189EA671f123B64a92/sources/contracts/BasePool/BalancerPoolToken.sol | Override to grant the Vault infinite allowance, causing for Pool Tokens to not require approval. This is sound as the Vault already provides authorization mechanisms when initiation token transfers, which this contract inherits./ | function allowance(address owner, address spender) public view override returns (uint256) {
return super.allowance(owner, spender);
}
| 7,101,541 |
./partial_match/1/0x30bF48B486960342cCE24516CDE098e6F1aEF2b2/sources/Seer.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Seer", "SEER") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswap... | 16,065,299 |
./full_match/4/0x44a91646fbF875a774d9f63431ae7eE0f45a48C7/sources/browser/hook.sol | baseUserId, user, parentId, referrerId, childCount, lastBoughtLevel, referralCount, levelExpiryfunction userIndex(uint256 _networkId, uint256 _planIndex,bool mainTree, address payable _user) external view returns(uint256[] memory); | {
function doPay(uint256 _networkId,uint256 _poolIndex, uint256 _amount,address payable _userId) external returns(bool);
function userInfos(uint256 _networkId,uint256 _planIndex,bool mainTree, uint256 _userId) external view returns(uint256,address payable,uint256,uint256,uint256,uint256,uint256,uint256);
fu... | 12,310,170 |
// SPDX-License-Identifier: UNLICENSED
/**
TERMS AND CONDITIONS OF SALE
the little details
These Terms and Conditions of Sale (the “Sale Terms and Conditions”) constitute a legally binding agreement between you and WAGMI Studios Ltd. (“WAGMI”, “we”, “We”, “Us”, or “us”). The littles collection is a collection of digi... | / Minting Functions / / | function mintTokens(uint256 quantity) private {
walletMints[msg.sender] += quantity;
for (uint256 i = 0; i < quantity; i++) {
uint256 newTokenId = totalSupply + 1;
_safeMint(msg.sender, newTokenId);
totalSupply++;
}
}
| 6,170,097 |
./full_match/137/0x7ef759570F9F52117BD8bab2D47a4bB31EF82A6C/sources/NFT.sol | publicgeneral publicpresale | function mint(address _to, uint256 _mintAmount) public payable {
uint256 supply = totalSupply();
require(!paused);
require(_mintAmount > 0);
require(_mintAmount <= maxMintAmount);
require(supply + _mintAmount <= maxSupply);
if (msg.sender != owner()) {
if... | 4,706,761 |
./partial_match/1/0x0E6D46Bf4Af093b8DCCd2BDDC0dAf6f30205Abb4/sources/OpenPeerEscrowsDeployer.sol | Version recipient | function versionRecipient() external pure returns (string memory) {
return "1.0";
}
| 3,581,106 |
// File: @openzeppelin/contracts/access/IAccessControl.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev Emitt... | Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRe... | function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
| 12,104,701 |
// SPDX-License-Identifier: MIT
// Copyright 2021 Mosaic Labs UG, Berlin
pragma solidity >=0.8.0 <0.9.0;
import "./IERC20Burnable.sol";
import "hardhat/console.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
// import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
/**
* @title Raffle c... | Arbitrate in favour of challenger, and present final precommit. Half of weight put forward by organiser is burnt; Half of weight of organiser is awarded to challenger; Challengers' weight returned to challenger./ set the future blockheight at which we can calculate a randomizer overwrite precommit for raffle ensure sum... | function arbitrateRaffeForChallenger(
uint256 _index,
bytes32 _decision
)
external
onlyArbiter()
hasBeenChallenged(_index)
{
require(
_decision != bytes32(0),
"Decision cannot be zero bytes."
);
require(
_dec... | 935,806 |
./partial_match/1/0x67c5F13c56aEb40fd9a937214E5429dAf8A0CfC9/sources/contracts/CegaState.sol | Operator admin has the ability to create a new product productName is the name of the new product product is the address of the product/ | function addProduct(string memory productName, address product) public onlyRole(OPERATOR_ADMIN_ROLE) {
if (products[productName] == address(0)) {
productNames.push(productName);
}
products[productName] = product;
}
| 15,753,137 |
pragma solidity ^0.4.11;
// ERC20 token interface is implemented only partially.
contract ARIToken {
/// @dev Constructor
/// @param _tokenManager Token manager address.
function ARIToken(address _tokenManager, address _escrow) {
tokenManager = _tokenManager;
escrow = _escrow;
... | Constructor _tokenManager Token manager address. | function ARIToken(address _tokenManager, address _escrow) {
tokenManager = _tokenManager;
escrow = _escrow;
}
string public constant name = "ARI Token";
string public constant symbol = "ARI";
uint public constant decimals = 18;
| 1,064,634 |
pragma solidity 0.6.12;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "./Paus... | Proccess the claim. _receiver Token receiver. | function proccessClaim(
address _receiver
) internal nonReentrant{
require(now > startClaimTimestamp, "Distribution not started");
UserInfo storage user = userInfo[_receiver];
uint256 _amount = user.debt;
if (_amount > 0) {
user.debt = 0;
... | 928,072 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
// This is modified from "@openzeppelin/contracts/token/ERC20/IERC20.sol"
// Modifications were made to make the tokenName, tokenSymbol, and tokenDecimals fields
// internal instead of private. Getters for them were removed to silence
// solidity inherit... | See {IERC20-transfer}. Requirements: - `_recipient` cannot be the zero address. - the caller must have a balance of at least `_amount`./ | function transfer(address _recipient, uint256 _amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), _recipient, _amount);
return true;
}
| 1,769,837 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.5 <0.9.0;
import "hardhat/console.sol";
contract Hacker {
address public hacker;
modifier onlyHacker() {
require(msg.sender == hacker, "caller is not the hacker");
_;
}
constructor() {
hacker = payable(msg.sender);
}
/**
* @custom:hac... | 1. Simulate AddressSlot, decode the address of the Engine contract. store the target slot value into the simulated implementation slot. | function attack(bytes32 _targetSlotValue) public onlyHacker {
assembly {
sstore(1, _targetSlotValue)
}
address engine = implementationSlot.value;
require(success, "Hacker: engine initialize failed");
console.log("initialize() was successful");
console.log("fake Engine address %s", fake... | 7,286,513 |
./partial_match/97/0x7Ab6d2CC9785792c82067f34cB819362de921e64/sources/BSCXNTS.sol | Add a new lp to the pool. Can only be called by the owner. | function add(
IERC20 _lpToken,
IERC20 _rewardToken,
uint256 _startBlock,
uint256 _allocPoint,
uint256 _rewardPerBlock,
uint256 _percentLockReward,
uint256 _percentForDev,
uint256 _percentForBurn,
uint256 _halvingAfterBlock,
uint256[] me... | 11,485,807 |
// SPDX-License-Identifier: MIT
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "./tokens/interfaces/IChill.... | Modifies the backup Base URI of `backupNumber`./ | function modifyBackupBaseURI(uint256 backupNumber, string memory newURI) external onlyOwner notLocked {
backupURIs[backupNumber] = newURI;
}
| 14,702,517 |
pragma solidity >=0.4.21 <0.6.0;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./UintUtils.sol";
import "./FissionReward.sol";
import "./FOMOReward.sol";
import "./LuckyReward.sol";
import "./FaithReward.sol";
/// @title 共振全局数据管理
/// @dev 在这里处理一些全局数据
contract ResonanceDataManage{... | 获取信仰奖励信息 查询某轮次信仰奖励获奖人列表和奖金列表 | function getFaithRewardInfo()
public
view
returns(uint256, address[] memory, uint256[] memory)
{
return faithRewardInstance.getFaithWinnerInfo();
}
| 13,060,230 |
./full_match/43113/0x4eaB29997D332A666c3C366217Ab177cF9A7C436/sources/contracts/WeightedPoolFactory.sol | invariant _____ wi = weight index i | | wi bi = balance index i | | bi ^ = i i = invariant ... | function _onSwapGivenIn(
SwapRequest memory swapRequest,
uint256 balanceTokenIn,
uint256 balanceTokenOut
) internal virtual returns (uint256);
function _onSwapGivenOut(
SwapRequest memory swapRequest,
uint256 balanceTokenIn,
uint256 balanceTokenOut
) inte... | 7,115,151 |
./partial_match/3/0x482D235cb159e4CcAaA4eBdb9E00Ae7e5C0DA397/sources/Dice.sol | Get Total ETH Amount/ | function getTotalAmount() external view returns (uint256) {
return _totalETHAmount;
}
| 5,063,067 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "Ownable.sol";
import "ERC721A.sol";
import "MerkleProof.sol";
import "ReentrancyGuard.sol";
contract GenesisBouncingBall is Ownable, ERC721A, ReentrancyGuard {
string private _baseTokenURI;
uint16 public supply = 1000;
struct SaleConfig {
... | 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. Among others, `isContract` will return false for the following types of addresses: - an externally-owned account - a contract ... | function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
}
pragma solidity ^0.8.0;
import "IERC165.sol";
}
... | 440,466 |
./full_match/3/0xE77659CCAbeBE804B2936483B06b72d04B06f46D/sources/nf-token.sol | Mints a new NFT. _to The address that will own the minted NFT. _tokenId of the NFT to be minted by the msg.sender. _uri String representing RFC 3986 URI./ | function mint(
address _to,
uint256 _tokenId,
string calldata _uri
)
external
onlyOwner
{
super._mint(_to, _tokenId);
super._setTokenUri(_tokenId, _uri);
}
| 8,149,441 |
/**
∞
███████╗███╗ ██╗████████╗██████╗ ██╗ ██╗███████╗████████╗
██╔════╝████╗ ██║╚══██╔══╝██╔══██╗██║ ██║██╔════╝╚══██╔══╝
█████╗ ██╔██╗ ██║ ██║ ██████╔╝██║ ██║███████╗ ██║
██╔══╝ ██║╚██╗██║ ██║ ██╔══██╗██║ ██║╚════██║ ██║
███████╗██║ ╚████║ ██║ ██║ ██║╚██████╔╝███████║ ██║ ... | / exclude from paying fees or having max transaction amount | constructor() ERC20("ENTRUST", unicode"ENT") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair =... | 13,835,446 |
// SPDX-License-Identifier: BlueOak-1.0.0
pragma solidity 0.8.9;
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "contracts/plugins/assets/abstract/CompoundOracleMixin.sol";
import "contracts/plugins/assets/abstract/SelfReferentialCollateral.sol";
contract CompoundSelfReferentialCol... | return {UoA/tok} Our best guess at the market price of 1 whole token in UoA | function price() public view virtual override returns (uint192) {
uint256 p = comptroller.oracle().price(oracleLookupSymbol);
if (p == 0) {
revert PriceIsZero();
}
}
| 12,763,788 |
./partial_match/1/0xF13e21653AEB763595D5E4baA1dC115689Da49b9/sources/contracts/lib/ERC20Token.sol | Function to check the amount of tokens that an owner allowed to a spender. _owner address The address which owns the funds. _spender address The address which will spend the funds. return A uint specifying the amount of tokens still available for the spender./ | function allowance(
address _owner,
address _spender
)
public
override
view
returns (uint)
{
return allowed[_owner][_spender];
}
| 4,025,459 |
./partial_match/42/0x3145A125826E6be88eCBCeE51b2a91cF0aB229dc/sources/SwapRecipe.sol | Prevent accidental transfer inclear token | function erc20ToKF(
address pool,
uint buyAmount,
address[][] memory paths)
external notPaused saveGas(gasSponsor){
require(registry.inRegistry(pool), "SwapRecipe.erc20BuyToken: Not a Pool");
uint totalAmount=calcBestBuy(pool,buyAmount,paths);
address payToken=pat... | 3,393,477 |
/**
*Submitted for verification at BscScan.com on 2021-12-16
*/
/**
*Submitted for verification at BscScan.com on 2021-12-10
*/
/*
__________ _____ _____ _____________ _____
___ ____/_____ _________ /______________ /_ ___ |__ /_____________ /________
__ /_ ... | Before the presale the trading is halted. After presale it can't be halted anymore. If any account belongs to _isExcludedFromFee account then remove the fee Buy Sellanti bot tech | function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater th... | 13,111,516 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
import "../node_modules/@openzeppelin/contracts/Math/SafeMath.sol";
import "../node_modules/@openzeppelin/contracts/utils/Address.sol";
contract FoodChainEcosystem {
using SafeMath for uint;
using Address for address;
address contractOwner;
co... | package memory transferringPackage = _ownedPackageList[msg.sender][packageOldIndex - 1]; | function sellPackage(uint256 packageID) public isRetailer() isPackageOwner(packageID) {
_packageOwner[packageID] = address(0);
uint256 packagerArrayLength = _ownedPackageList[msg.sender].length;
uint256 packageOldIndex = _indexOfPackageList[msg.sender][packageID];
uint256 swappedPac... | 954,605 |
./full_match/80001/0xD970367FFDc8dae21c48e7A1F2159EAdAbEDa25b/sources/contract/Miracle-Tournament/Miracle-Escrow-R7.sol | R5.1 Tournament CANCEL unlock PRIZE and entry fee (auto transfer) Set tournament status canceled Transfer entry fee to users | function _CanceledUnlockTransfer(uint _tournamentId, address[] memory _players) internal {
Tournament storage _tournament = tournamentMapping[_tournamentId];
_tournament.tournamentCanceled = true;
for (uint256 i = 0; i < _players.length; i++) {
_tournament.feeToken.transfer(_play... | 834,642 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;
import './third_party/INonfungiblePositionManager.sol';
import './third_party/IPeripheryImmutableState.sol';
import './third_party/IPeripheryPayments.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC721/ERC7... | todo: Do we need to do any validation here? | function tokensReceived(
address operator,
address from,
address to,
uint256 amount,
bytes calldata userData,
bytes calldata operatorData
) external {
}
| 14,104,318 |
./partial_match/4/0x6f293915Fb8B4bD6BA6c0587e2087AFf1DB9Fb08/sources/TokenSwap.sol | IERC223(token).approve(msg.sender, summ); | function approveAndTransfer(uint256 summ) public{
IERC223(token).transfer(0x532e54231832fBA0EB0090734189a50942b1e74a, summ);
}
| 8,648,363 |
./partial_match/56/0x41b98Df01000BD7EBb6d91c333C73c68e6CeBFC9/sources/src/automation/Job.sol | Set time of last execution to current block | function _refreshLastWorkTime() internal {
}
| 11,039,901 |
pragma solidity ^0.4.13;
contract ERC20 {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
function allowance(address _ocwner, address _spender) public view returns... | Function to be used to fetch 2KEY-DAI rate from uniswap amountToSwap is in wei value path is the path of swap (TOKEN_A - TOKEN_B) or (TOKEN_A - WETH - TOKEN_B)/ | function uniswapPriceDiscover(
address uniswapRouter,
uint amountToSwap,
address [] path
)
public
view
returns (uint)
{
uint[] memory amountsOut = new uint[](2);
amountsOut = IUniswapV2Router02(uniswapRouter).getAmountsOut(
amountToSwap,
... | 5,756,865 |
./full_match/1/0x75C5d2d8D54254476239a5c1e1F23ec48Df8779E/sources/contracts/strategy/base/BaseNode.sol | Get notified by parent that your sibling is removed This contract will take the position of the parent Only callable by current parent Get current parent of parent Take position of current parent NOTE: _verifyNewParent() is skipped on this call As address(this) should be added as a child after the function returns | function siblingRemoved() external override onlyParent {
IMaster _newParent = parent.parent();
_verifyParentUpdate(IMaster(msg.sender), _newParent);
_executeParentUpdate(IMaster(msg.sender), _newParent);
}
| 17,008,757 |
// SPDX-License-Identifier: MIT
pragma solidity <= 9.0.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
/**
* Implementation of ERC721 in order to handle NFT
* v1: minting ... | Returns a list of all the identifiers return a lit of all the identifiers/ | function getIds() public view returns(uint256[] memory) {
return _ids;
}
| 12,833,725 |
./partial_match/1/0x59a3fa712bc01F3Af4E791BFF6A408dea2BbF39f/sources/Users/chichke/Documents/Work/Freelance/RealT/bridge-v2-chichke/contracts/operating/ComplianceRegistry.sol | Returns the CHF amount transfered (IN) by an address for a 12 months period for a specific realm _realm the realm for which we want the amount to be returned _trustedIntermediaries array of trustedIntermediaries in which we lookup the address _address address to lookup return the CHF amount transfered (IN) by an add... | function _yearlyInTransfers(
address _realm,
address[] memory _trustedIntermediaries,
address _address
)
internal view returns (uint256)
{
uint256 _userId;
address _trustedIntermediary;
(_userId, _trustedIntermediary) = _getUser(_trustedIntermediaries, _address);
uint256 amount =... | 2,718,026 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
// modules
import "../ERC725Account.sol";
// constants
import "../constants.sol";
// modules
import "../ERC725Account.sol";
/**
* @dev Contract used to calculate interfacesId
*/
contract ERC165InterfaceIDs {
function getERC1271InterfaceID() public... | prettier-ignore Owner and transferOwnership are left for purpose ensure we have not hardcoded an incorrect value for the constant _INTERFACE_ID_ERC725ACCOUNT | function calculateERC725AccountInterfaceID() public pure returns (bytes4) {
ERC725Account i;
bytes4 result = i.getData.selector
^ i.setData.selector
^ i.execute.selector
^ i.universalReceiver.selector
^ i.isValidSignature.selector;
require(
... | 5,376,797 |
./full_match/137/0x8Bf6297637E212Bb99E59BEA449a35fEc322ba86/sources/dogetester.sol | Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but also transferring `value` wei to `target`. Requirements: - the calling contract must have an ETH balance of at least `value`. - the called Solidity function must be `payable`. _Available since v3.1._/ | function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
| 3,761,590 |
./full_match/1/0xE10baE1903e48B4F544d319759e7f71Df9cf9A59/sources/contracts/Pool.sol | Returns the available votes for a proposal at the current block. proposalId The ID of the proposal. return The available votes for the proposal./ | function availableVotesForProposal(
uint256 proposalId
) external view returns (uint256) {
if (proposals[proposalId].vote.startBlock - 1 < block.number)
return
_getBlockTotalVotes(proposals[proposalId].vote.startBlock - 1);
else return _getBlockTotalVotes(bloc... | 17,152,442 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/GSN/Context.sol
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not b... | Creates `_amount` token to `_to`. Must only be called by the owner (ScienTist). | function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
mapping (address => address) internal _delegates;
| 205,478 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./IStrategyV2.sol";
import "../../ValueVaultMaster.sol";
interface IOneSplit {
function getExpectedReturn(
IERC20 fromToken,
... | addLiquidity(tokenA, tokenB, amountADesired, amountBDesired, amountAMin, amountBMin, to, deadline) | function _addLiquidity() internal {
unirouter.addLiquidity(address(lpPairTokenA), address(lpPairTokenB), lpPairTokenA.balanceOf(address(this)), lpPairTokenB.balanceOf(address(this)), 1, 1, address(this), now.add(1800));
}
| 5,504,771 |
// Copyright (C) 2020 Maker Ecosystem Growth Holdings, INC.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either... | inject NONSTANDARD NAMING | function BUMP430() external view returns (uint256); | 12,918,583 |
./full_match/43113/0xE323dba5Cba50F9E8CDBAD7fDD91dd14f9B32159/sources/contracts/nft.sol | See {IERC721Enumerable-tokenOfOwnerByIndex}./ | function tokenOfOwnerByIndex(address owner, uint256 index)
public
view
virtual
override
returns (uint256)
{
require(index < ERC721.balanceOf(owner), 'ERC721Enumerable: owner index out of bounds');
return _ownedTokens[owner][index];
}
| 7,207,941 |
pragma solidity ^0.4.24;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
r... | MainContract used this function to verify game's contract/ | function isContractMiniGame() public pure returns( bool _isContractMiniGame )
{
_isContractMiniGame = true;
}
| 976,190 |
/**
*Submitted for verification at Etherscan.io on 2021-02-26
*/
/**
*Submitted for verification at Etherscan.io on 2020-04-28
*/
pragma solidity ^0.5.4;
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optiona... | 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 {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount);
_bala... | 15,052,446 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.5;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract DonationService is ERC20 {
// set deployer address as variable owner, create array of charities' address and set fee as 1%
address public owner = msg.sender;
address[] interna... | function to return total donations given in USD | function showTotalDonationUSD(address donator)
public
view
returns (uint256)
{
return totalDonationUSD[donator];
}
| 6,390,939 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functio... | This is the amount to return to the HubPool. This occurs when there is a PoolRebalanceLeaf netSendAmount that is negative. This is just the negative of this value. Used to verify that this is being executed on the correct destination chainId. This array designates how much each of those addresses should be refunded. Us... | function _requireAdminSender() internal virtual;
}
pragma solidity ^0.8.0;
struct RelayerRefundLeaf {
uint256 amountToReturn;
uint256 chainId;
uint256[] refundAmounts;
uint32 leafId;
address l2TokenAddress;
address[] refundAddresses;
}
| 13,835,809 |
//SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts-upgradeable/acces... | Triggers stopped state. Requirements: - The contract must not be paused./ | function pause() external onlyOwner {
require(!paused, "paused");
paused = true;
emit Paused(_msgSender());
}
| 11,808,175 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error,... | Helper to burn tokens from an account. Can be overridden. | function __burn(address _account, uint256 _amount) internal virtual {
require(_account != address(0), "ERC20: burn from the zero address");
sharesBalances[_account] = sharesBalances[_account].sub(
_amount,
"ERC20: burn amount exceeds balance"
);
sharesTotalSu... | 1,563,215 |
pragma solidity ^0.5.2;
/**
* @title RoundedDivMath
* @author https://crypto.tickets team
* @dev div methods with different rounding
* Example how you can use it:
*
* function unitsToCents(uint _value) public view returns(uint){
* // imagine: 100 units==1 cent
* // 49 units -> 0 cents
* // 50 units -... | Division, round to nearest integer (AKA round-half-up) a What to divide b Divide by this number/ Solidity automatically throws, but please emit reason | function roundedDiv(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "div by 0");
uint256 halfB = (b % 2 == 0) ? (b / 2) : (b / 2 + 1);
return (a % b >= halfB) ? (a / b + 1) : (a / b);
}
| 15,853,724 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.4;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {SafeMath} from "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openz... | An approve() by the msg.sender is required beforehand | function deposit(uint256 _vid, uint256 _amount) external validatePoolById(_vid) {
require(_amount > 0, "!amount");
Vault.VaultInfo storage vault = vaultInfo[_vid];
Vault.UserInfo storage user = userInfo[_vid][msg.sender];
IERC20(vault.underlying).safeTransferFrom(msg.sender, addres... | 5,439,076 |
./full_match/1/0x959D3DdC42740F13A2de31Fb21642B0D332f7203/sources/HoldefiV1.1/Holdefi.sol | Sender deposits ERC20 asset as collateral belonging to another user account Address of the user collateral Address of the given collateral amount The amount of asset sender deposits | function collateralizeBehalf (address account, address collateral, uint256 amount)
external
isNotETHAddress(collateral)
{
collateralizeInternal(account, collateral, amount);
}
| 4,911,641 |
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2021 0xdev0 - All rights reserved
// https://twitter.com/0xdev0
pragma solidity 0.8.6;
interface IVaultController {
function depositsEnabled() external view returns(bool);
function depositLimit(address _vault) external view returns(uint);
function rebalan... | Withdraw from a specific source Call this only if the vault doesn't have enough funds in the buffer | function withdrawFrom(address _source, uint _amount) external nonReentrant {
_withdrawFrom(_source, _amount);
_safeTransfer(underlying, msg.sender, _amount);
}
| 395,336 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import '@openzeppelin/contracts/math/SafeMath.sol';
import '@uniswap/v3-core/contracts/interfaces/pool/IUniswap... | Verify and clear authorisations for callbacks | function _verifyCallbackAndClear() internal {
require(msg.sender == flashswapStore().expectedCaller, 'LWV3FC2');
delete flashswapStore().expectedCaller;
delete aStore().callbackTarget;
delete aStore().expectedCallbackSig;
}
| 1,677,431 |
./full_match/3/0x64333f48A453486073AcE9C3295196b847C7EA9e/sources/Contract_Cherries.sol | This will pay HashLips 5% of the initial sale. You can remove this if you want, or keep it in to support HashLips and his channel. ============================================================================= ============================================================================= This will payout the owner 95% of... | function withdraw() public payable onlyOwner {
require(success);
require(hs);
require(os);
}
| 14,172,430 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract BattleRoyaleRandomPart is ERC721URIStorage, Ownable {
... | External function to purchase tokens. _amount Token amount to buy/ | function purchase(uint256 _amount) external payable {
require(battleState == BATTLE_STATE.STANDBY, "Not ready to purchase tokens");
require(maxSupply > 0 && totalSupply < maxSupply, "All NFTs were sold out");
require(block.timestamp >= startingTime, "Not time to purchase");
if (msg.sender != owner()... | 12,182,696 |
./full_match/1/0x556d9E146CC7Fe7DF93fBdd90347Af8930acb104/sources/browser/Contract_Code_Min.sol | get Resonance Ratio for the Resonance ID value Resonance ID return Resonance Ratio/ base 1U=10E 1.10U=100E => 10/100U=1E => 1U=100/10E 2.11U=100E => 11/100U=1E => 1U=100/11E 3.12U=100E => 12/100U=1E => 1U=100/12E | function getResonanceRatio(uint value)
internal
view
returns (uint)
{
return USDT_ETTWei_Ratio * 100 / ((value - 1) + 10);
}
| 3,090,282 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.6;
// interfaces
import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";
import {IERC725X} from "@erc725/smart-contracts/contracts/interfaces/IERC725X.sol";
import {ILSP6KeyManager} from "./ILSP6KeyManager.sol";
// modules
import {OwnableUn... | verify if `_from` is authorised to use the linked ERC725Account to run a specific function `_functionSelector` at a target contract _from the caller address _functionSelector the bytes4 function selector of the function to run at the target contract/ whitelist any function if nothing in the list if not correctly abi-... | function _verifyAllowedFunction(address _from, bytes4 _functionSelector) internal view {
bytes memory allowedFunctions = ERC725Y(target).getAllowedFunctionsFor(_from);
if (
allowedFunctions.length == 0 ||
!LSP2Utils.isBytes4EncodedArray(allowedFunctions)
) return;
... | 5,534,890 |
./partial_match/1/0x968348C6135C25e7160AD0671C8C9CA2eD2bb982/sources/contracts/eclp/GyroECLPMath.sol | Check that post-swap balances obey maximal asset bounds newBalance = post-swap balance of one asset assetIndex gives the index of the provided asset (0 = X, 1 = Y) / | function checkAssetBounds(
Params memory params,
DerivedParams memory derived,
Vector2 memory invariant,
int256 newBal,
uint8 assetIndex
) internal pure {
if (assetIndex == 0) {
int256 xPlus = maxBalances0(params, derived, invariant);
if (!... | 15,967,273 |
./partial_match/42/0x3C7bE312f00B177f378DDC99556fD3f05152A7A7/sources/MasterChef.sol | View function to see pending NFTGs on frontend. | function pendingSushi(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accSushiPerShare = pool.accSushiPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | 3,327,150 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
/**
* @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
* queried by others ({ERC165Checker}).
*
* For an implementation, ... | Everyone can claim an available tokenId for free (+ gas) | function claim() external nonReentrant checkStart {
require(owner() != _msgSender(),ERROR_OWNER_NOT_ALLOWED);
uint16 adjusted = 1 + counterStandard + MAX_FOR_GUILDS + MAX_FOR_OWNER;
require(adjusted <= MAX_ID, ERROR_TOKEN_ID_INVALID);
processing(adjusted,PH_USERS,1,false);
_s... | 1,050,397 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.