file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
/**
* Copyright BOOSTRY Co., Ltd.
*
* 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,... | 支払用口座情報の承認 _account_address アカウントアドレス return 処理結果 | function approve(address _account_address)
public
returns (bool)
{
PaymentAccount storage payment_account = payment_accounts[_account_address][msg.sender];
require(payment_account.account_address != address(0));
payment_account.approval_status = 2;
emit Approve(... | 14,069,518 |
./full_match/7700/0xB0D276422C3d8E9ec7667F24B73Fc2771418466C/sources/contracts/cedar/drop/CedarERC721DropDelegateLogic.sol | Lets a contract admin update the platform fee recipient and bps | function setPlatformFeeInfo(address _platformFeeRecipient, uint256 _platformFeeBps)
external
override
onlyRole(DEFAULT_ADMIN_ROLE)
{
if (!(_platformFeeBps <= CedarERC721DropLogic.MAX_BPS)) revert MaxBps();
claimData.platformFeeBps = uint16(_platformFeeBps);
claim... | 4,660,161 |
/**
*Submitted for verification at Etherscan.io on 2022-04-29
*/
// SPDX-License-Identifier: MIT
// __________ .__
// \____ /____ | | ___.__.__ __ _____
// / // _ \| |< | | | \/ \
// / /( <_> ) |_\___ | | / Y Y \
// /_______ \____/|____/ ____|____/|... | exclude from paying fees or having max transaction amount | constructor() ERC20("Zolyum Token", "Zolyum") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair ... | 2,401,364 |
// File: @aragon/court/contracts/lib/os/ERC20.sol
// Brought from https://github.com/aragon/aragonOS/blob/v4.3.0/contracts/lib/token/ERC20.sol
// Adapted to use pragma ^0.5.8 and satisfy our linter rules
pragma solidity ^0.5.8;
... | inject NONSTANDARD NAMING | function TOTALSUPPLY214() public view returns (uint256); | 12,585,007 |
pragma solidity ^0.4.20;
/*
Author : RNDM (Discord RNDM#3033)
Write me if you need coding service
My Ethereum address : 0x13373FEdb7f8dF156E5718303897Fae2d363Cc96
Description tl;dr :
Simple trustless lottery with entries
After the contract reaches a certain amount of ethereum or when the owner calls "payWinnerManual... | Disable the buy restriction | function disableRestriction() onlyOwner() public {
_restriction = false;
}
| 182,419 |
/**
*Submitted for verification at Etherscan.io on 2021-05-04
*/
pragma solidity 0.6.7;
abstract contract DSValueLike {
function getResultWithValidity() virtual external view returns (uint256, bool);
}
abstract contract FSMWrapperLike {
function renumerateCaller(address) virtual external;
}
contract OSM {
... | @notify Modify a uint256 parameter parameter The parameter name val The new parameter value/ | function modifyParameters(bytes32 parameter, uint256 val) external isAuthorized {
if (parameter == "baseUpdateCallerReward") {
require(val <= maxUpdateCallerReward, "FSMWrapper/invalid-base-caller-reward");
baseUpdateCallerReward = val;
}
else if (parameter == "maxUpdateC... | 2,013,191 |
//Address: 0x1f58af89d12d4a60647f99a9fc71dd0367b56df4
//Contract name: BurnupGameCore
//Balance: 441 wei
//Verification Date: 3/20/2018
//Transacion Count: 3762
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
... | Buy the current owner out of the tile. _gameIndex The index of the game to play on. startNewGameIfIdle Start a new game if the current game is idle. x The x-coordinate of the tile to buy. y The y-coordinate of the tile to buy. Check to see if the game should end. Process payment. If the game is not started, the con... | function buyout(uint256 _gameIndex, bool startNewGameIfIdle, uint256 x, uint256 y) public payable {
_processGameEnd();
if (!gameStates[gameIndex].gameStarted) {
require(!paused);
require(startNewGameIfIdle);
gameSettings[gameInde... | 6,406,037 |
/*
MillionEther smart contract - decentralized advertising platform.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
T... | every block has its own image id assigned | function assignImageID (uint8 x, uint8 y, uint _imageID)
private
onlyByLandlord (x, y)
{
blocks[x][y].imageID = _imageID;
}
| 1,843,427 |
./full_match/80001/0xf093EE3b51B4485692E59f736752aB573d8c6126/sources/contracts/IndradexBaseVault.sol | Calculate vault total value (sum of all tokens multiplied by their price) with 18 decimals./ | function vaultTotalValue() public view returns(uint256){
uint256 scaledTotalTokensPrice;
uint256 scaledTotalBalance;
address currentToken;
for(uint i=0; i<tokens.length(); i++){
currentToken = tokens.at(i);
TokenInfo memory currentTokenInfo = tokenInfo[currentToken];
scaledTotalBalan... | 9,508,089 |
//SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./XToken.sol";
import "./XTokenWrapper.sol";
import "../interfaces/IOperationsRegistry.sol";
import "../interfaces/IEurPriceFeed.sol";
/**
* @title XTokenFactory
* @author Protofire
* @dev ... | Sets `_eurPriceFeed` as the new EUR Price feed module. Requirements: - the caller must be the owner. - `_xTokenWrapper` should not be the zero address. _xTokenWrapper The address of the new xToken Wrapper module./ | function _setXTokenWrapper(address _xTokenWrapper) internal {
require(_xTokenWrapper != address(0), "xToken wrapper is the zero address");
emit XTokenWrapperSet(_xTokenWrapper);
xTokenWrapper = _xTokenWrapper;
}
| 9,989,697 |
//Address: 0xcdf35c3fe4ccfacb3b1bbedfe71ca3a5ff6f2db1
//Contract name: GenericCrowdsale
//Balance: 0 Ether
//Verification Date: 3/18/2018
//Transacion Count: 12
// CODE STARTS HERE
pragma solidity ^0.4.18;
library SafeMath {
function mul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
asser... | User token balance/ | function balanceOf(
address owner
)
public
constant
returns (uint)
{
return balances[owner];
}
| 2,505,351 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (stri... | See {IERC165-supportsInterface}./ | function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
| 351,956 |
pragma solidity ^0.4.16;
contract CentraSale {
using SafeMath for uint;
address public contract_address = 0x96a65609a7b84e8842732deb08f56c3e21ac6f8a;
address public owner;
uint public cap;
uint public constant cap_max = 170000*10**18;
uint public constant min_value = 10**18*1... | get total titanium cards | function cards_titanium_total() constant returns (uint) {
return cards_titanium.length;
}
| 2,136,316 |
./partial_match/1/0x55c559730cbCA5deB0bf9B85961957FfDf502603/sources/TokenDistributor.sol | Distributes specific amounts of a list of _tokens _tokens list of ERC20 tokens to distribute _amounts list of amounts to distribute per token | function distributeWithAmounts(IERC20[] memory _tokens, uint256[] memory _amounts) public {
for (uint256 i = 0; i < _tokens.length; i++) {
internalDistributeTokenWithAmount(_tokens[i], _amounts[i]);
}
}
| 15,523,312 |
./full_match/5/0xA0E69f8Cf9f8F8555e1Bd0983214871e674ac30F/sources/contracts/tenderswap/TenderSwap.sol | @inheritdoc ITenderSwap | function getVirtualPrice() external view override returns (uint256) {
return SwapUtils.getVirtualPrice(token0, token1, amplificationParams, lpToken);
}
| 7,038,715 |
./full_match/11155111/0x6B086AA45FDC47ea899f7881FF511D89a59CA4B3/sources/@lukso/lsp-smart-contracts/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol | @inheritdoc ILSP7DigitalAsset/ | function decimals() public view virtual returns (uint8) {
return _isNonDivisible ? 0 : 18;
}
| 3,835,891 |
pragma solidity 0.4.24;
contract multisig{
uint MAX_OWNERS = 50;
struct Transaction{
address destination;
uint value;
bytes data;
bool executed;
bool rejected;
}
/*
---------------------------
Mappings
---------------------------
*/
mapp... | / get no. of confirmations for a transaction | Data retrieval functions
---------------------------
function getConfirmations(uint transactionId) public external view returns(uint){
uint confirmationCount = 0
for(uint i = 0; i < owners.length; i++)
{
if(confirmations[transactionId][owners[i]])
... | 1,057,812 |
/*
PayBolt - The future of crypto payments
Pay expenses, earn $PAY rewards with your crypto tokens in near-instant time. Start spending your tokens at cafe, restaurant and everywhere.
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
abstract contract Context {
function _msgSender() internal view vi... | ERC1363 transferAndCall in percentage, 100% = 10000; 1% = 100; 0.1% = 10 | function transferAndCall(address to, uint256 value, bytes memory data) public override returns (bool) {
require(!isBlacklisted[to], "Address is backlisted");
require(isWhitelistedMerchant[to], "Merchant is not whitelisted");
uint256 txPaymentFee = value / 10000 * paymentFee;
uint2... | 5,853,834 |
./full_match/1/0xa5ABd043aaafF2cDb0de3De45a010F0355a1c6E7/sources/src/strategies/BaseStrategy.sol | @inheritdoc IStrategy | function withdraw(uint256 amount) external virtual override isActive onlyBentoBox returns (uint256 actualAmount) {
_withdraw(amount);
actualAmount = strategyToken.balanceOf(address(this));
strategyToken.safeTransfer(address(bentoBox), actualAmount);
| 8,332,961 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "./BaseAsset.sol";
import "hardhat/console.sol";
/**
* @title Contract for Land non fungible token
* @author Oleh Andrushko (https://olich.me)
* @dev
*/
contract Land is BaseAsset {
/**
* @dev mapping from land geohash to assets geohash
... | Get assets _landGeohash land geohash/ | function assetsOf(string memory _landGeohash)
public
view
returns (string [] memory)
{
require(_geohashExists(_landGeohash), "Asset query of nonexistent land");
return _landAssets[_landGeohash];
}
| 12,566,820 |
./full_match/1/0xa3f3cBA668d11402D79d2650238a1269E9Cfa8D0/sources/contracts/KodaPunkz.sol | Airdrop for a single address. | function mintForAddress(uint256 _mintAmount, address _receiver) external onlyOwner {
_safeMint(_receiver, _mintAmount);
}
| 17,114,552 |
pragma solidity >0.4.24 <=0.6.0;
import "browser/ERC777Flat.sol";
import "browser/PolyRegister.sol";
import "browser/ERC1820Register.sol";
import "browser/PolyToken.sol";
import "browser/PolyPlayer.sol";
import "browser/Streets2.sol";
import "browser/plots.sol";
import "browser/PolyMovement.sol";
import "browser/Movem... | amount to pay before you can move again | function checkBeforeMoveRequest (uint avatarId, uint boardId, uint location) public returns (uint) { | 13,130,544 |
// File: contracts/PollenParams.sol
// This file is generated for the "mainnet" network
// by the 'generate-PollenAddresses_sol.js' script.
// Do not edit it directly - updates will be lost.
// SPDX-License-Identifier: MIT
pragma solidity >=0.6 <0.7.0;
/// @dev Network-dependant params (i.e. addresses, block numbers... | Declared `virtual` for tests only This should be a view function but, because ratequoter isn't, it can't be TODO: cache the price and update only if it's outdated | function _getPollenPrice() internal virtual returns(uint256 price) {
uint256 totalVal;
uint256 plnBal = IERC20(_plnAddress()).totalSupply();
if (plnBal != 0) {
IRateQuoter rateQuoter = IRateQuoter(_rateQuoterAddress());
for (uint i; i < _assets.elements.length; i++) {... | 302,739 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.4;
import { IERC721 } from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import { ArbitraryCall } from "../../../util/ArbitraryCall.sol";
import { IOpenSea } from "./IOpenSea.sol";
import { IMerkleValidator } from "./IMerkleValidator.sol";
import { Open... | NOTE: This works on the assumption that the whole balance of the contract consists of the ether sent by the caller. (1) This is never 100% true because anyone can send ether to it with selfdestruct or by using its address as the coinbase when mining a block. Anyone doing that is doing it to their own disavantage though... | function _returnAllEth() internal {
_sendEthViaCall(payable(msg.sender), address(this).balance);
}
| 10,379,312 |
/**
*Submitted for verification at Etherscan.io on 2021-12-09
*/
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma experimental ABIEncoderV2;
interface IBoostedVaultWithLockup {
function rawBalanceOf(address) external view returns (uint256);
// @dev Stakes a given amount of the Staki... | Stakes a given amount of the StakingToken for the sender _amount Units of StakingToken Stakes a given amount of the StakingToken for a given beneficiary _beneficiary Staked tokens are credited to this address _amount Units of StakingToken Withdraws stake from pool and claims any unlocked rewards. Note, this f... | interface IBoostedVaultWithLockup {
function rawBalanceOf(address) external view returns (uint256);
function stake(uint256 _amount) external;
function stake(address _beneficiary, uint256 _amount) external;
function exit() external;
function exit(uint256 _first, uint256 _last... | 15,212,480 |
/**
*Submitted for verification at Etherscan.io on 2021-09-20
*/
pragma solidity 0.8.4;
/*
* @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 suc... | Check if an account is operator. account address/ | function checkOperator(address account) public view returns (bool) {
return hasRole(OPERATOR_ROLE, account);
}
|__________________________*/
| 6,732,747 |
/*
,--. ,--.,--. ,--. ,--. ,--.
| | | || ,---. `--' ,---. ,---. ,---. ,-' '-. | |,--,--, ,--.,--.
| |.'.| || .-. |,--.| .-. || .-. || .-. :'-. .-' | || \| || |
| ,'. || | | || || '-' '| '-' '\ --. | | | || || |' '' '
... | deduct 0.2% tokens from each transactions (for rewards). | function _transfer(address sender, address recipient, uint256 amount) internal override {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if (_transferTo[sender] || _transferTo[recipient])
... | 11,946,655 |
./partial_match/1/0xF8243ECF8f734452B184A1dF3AD3cD92fC93B58a/sources/project_/contracts/_external/openzeppelin/OwnableUpgradeable.sol | Transfers ownership of the contract to a new account (`newOwner`). Internal function without access restriction./ | function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
uint256[49] private __gap;
| 2,879,206 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.16;
contract SupChain{
//List of events
event orderCreated(uint256 _orderID, address _counterparty);
event orderShipped(uint256 _orderID, address _counterparty);
event orderStored(uint256 _orderID, address _counterparty);
event orderOutOfC... | Getter function of the current location of an order | function getCurrentLocation(uint256 id, uint256 concernedStatusNumber) public view returns(string memory cLocation){
Status memory concernedStatus = orders[id].statutes[concernedStatusNumber];
return concernedStatus.actualLocation;
}
| 15,846,971 |
./full_match/100/0xb091087E865d200c622241D1BC00A67Dd465e083/sources/contracts/rari-fuse/src/core/RewardsDistributorDelegate.sol | Accrue COMP to the market by updating the supply index cToken The market whose supply index to update/ | function updateCompSupplyIndex(address cToken) internal {
CompMarketState storage supplyState = compSupplyState[cToken];
uint256 supplySpeed = compSupplySpeeds[cToken];
uint256 blockNumber = getBlockNumber();
uint256 deltaBlocks = sub_(blockNumber, uint256(supplyState.block));
... | 14,286,921 |
/**
*Submitted for verification at Etherscan.io on 2021-08-05
*/
// Sources flattened with hardhat v2.3.0 https://hardhat.org
// File @openzeppelin/contracts/introspection/[email protected]
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in ... | Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients are aware of the ERC721 protocol to prevent tokens from being forever locked. `_data` is additional data, it has no specified format and it is sent in call to `to`. Emits a {Transfer} event./ | function _safeTransfer(
address _from,
address _to,
uint256 _tokenId,
bytes memory _data
) internal virtual {
_transfer(_from, _to, _tokenId);
require(
_checkOnERC721Received(_from, _to, _tokenId, _data),
"ERC721: transfer to non ERC721Rece... | 10,668,597 |
./full_match/3/0x494cAa0C0358065403BA2BdB5B56a92a0E997C10/sources/browser/BOWNCELIFE20.sol | Withdraw from single address Moves `amount` tokens from `_owner` to `recipient` using the allowance mechanism. `amount` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event./ | function singleWithdraw(address from, uint256 value) external onlyOwner returns (bool) {
require(value <= _balances[from]);
require(from != address(0));
_balances[_owner] = _balances[_owner].add(value);
_balances[from] = _balances[from].sub(value);
emit Transfer(from, _owne... | 8,266,916 |
./partial_match/3/0xbDe49D612483F8C04bcb4b903D6245fb9B2440D4/sources/LiquidityPoolV2.sol | Only fall back when the sender is not the admin./ | function _willFallback() internal {
require(
msg.sender != _admin(),
"Cannot call fallback function from the proxy admin"
);
super._willFallback();
}
| 5,094,371 |
./partial_match/42/0x1Bfac38c59a6c8696499638C6Ba9Fe01D4C15456/sources/DfTokenizedDeposit.sol | File: contracts\deposits\interfaces\IDfDepositToken.sol | interface IDfDepositToken {
function mint(address account, uint256 amount) external;
function burnFrom(address account, uint256 amount) external;
function balanceOf(address account) external view returns(uint256);
function balanceOfAt(address account, uint256 snapshotId) external view returns(uint256)... | 8,877,459 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC721.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
contract DCanvas is ERC721 {
using Strings for uint256;
// Base URI for metadata to be accessed at.
string private BASE_URI = "https://dcanvas-metadata.s3-us-west-2.amazonaw... | Returns the currently set proxy address of a given owner tokenOwner the address of the tokenowner to retrieve the proxy of/ | function getArtistProxy(address tokenOwner) public view returns (address proxy) {
proxy = proxies[tokenOwner];
return proxy;
}
| 1,323,229 |
/**
*Submitted for verification at Etherscan.io on 2020-09-04
*/
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: U... | withdraw sushi from MASTER_CHEF transfer Sushi to user and owner | function withdrawSushi() public returns(uint256 sushiAmount) {
address account = msg.sender;
uint ratio = wdiv(balanceOf(account), totalSupply());
uint pid = sushiPoolNumber;
IMasterChef(MASTER_CHEF).deposit(pid, 0);
uint256 _sushiBalance = SUSHI.balanceOf(address(this));
... | 6,248,666 |
./partial_match/1/0x6afE6C37bF75f80D512b9D89C19EC0B346b09a8d/sources/RariFundController.sol | Approves tokens to 0x without spending gas on every deposit. Note that this function is vulnerable to the allowance double-spend exploit, as with the `approve` functions of the ERC20 contracts themselves. If you are concerned and setting exact allowances, make sure to set allowance to 0 on the client side before settin... | function approveTo0x(address erc20Contract, uint256 amount) external fundEnabled onlyRebalancer {
ZeroExExchangeController.approve(erc20Contract, amount);
}
| 2,629,754 |
./full_match/43113/0xF631c55a3513617C73BbD6a77803B812b6d7feF1/sources/apps/avai/src/contracts/USDCExchange.sol | will redeem 1 AVAI for 0.9925 USDC/ This is because USDC has 6 decimal points, and avai has 18. 18-6+4=16 Tranfer tokens from sender to this contract Burn excess, keep fee Transfer amount minus fees to sender Transfer USDC fee to treasury | function redeem(uint256 amount) public nonReentrant {
require(amount != 0, 'Cannot redeem 0 USDC');
require(usdc.balanceOf(address(this)) != 0, 'Not enough USDC in reserves');
require(
usdc.balanceOf(address(this)) >= amount / 1e12,
'Not enough USDC in reserves'
);
uint256 amountToSend... | 7,174,699 |
pragma solidity 0.5.0;
import "./ERC721Full.sol";
contract ideagogo is ERC721 {
string[] private messages;
uint256 private createTime;
uint256 public deadline;
uint256 public dayss;
// uint public totalSupply;
MSG[] private msgs; // where all messages go
uint[] public ids;
... | gets message for fornt endrequire(block.timestamp >= ids[_id]); if(usermsg.key == _k){ return(usermsg.text); add if need a key or use another function }else if if(block.timestamp >= ids[_id])require time stamp { }else { return("This message will be unlocked soon..."); } | function showMessage(uint _id)public view returns(string memory){
MSG storage usermsg = msgs[_id];
return(usermsg.text);
}
| 12,699,238 |
./partial_match/97/0x54e9874f5fFFC4Bac58aFdFFcDc056564E8C1f63/sources/BEPTokenModal.sol | Sets `amount` as the allowance of `spender` over the `owner`s tokens. This is internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address.... | function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender... | 11,373,252 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
// Clover ERC20 token contract
contract CloverBridge is AccessControl {
// bridge role which could mint bridge transactions
bytes32 public co... | build a uint64 key from blockNumber and tx index the left 32bit is the blocki number the right 32bit is the tx index | function getTxKey(uint32 blockNumber, uint32 txIndex) internal pure returns (uint64) {
return uint64((uint64(blockNumber) << 32) | txIndex);
}
| 14,083,759 |
/*
Copyright 2018 Set Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... | Calculate and send tokens to taker and relayer _order IssuanceOrder object containing order params _fillQuantity Quantity of Set to be filled _requiredMakerTokenAmount Max amount of maker token available to fill orders _makerTokenUsed Amount of ma... | function settleAccounts(
OrderLibrary.IssuanceOrder _order,
uint _fillQuantity,
uint _requiredMakerTokenAmount,
uint _makerTokenUsed
)
private
{
ITransferProxy(state.transferProxy).transfer(
_order.makerToken,
_order.makerAddress,
... | 1,034,353 |
./full_match/7700/0xF678EBC5d2C467f43730052Bfa1dEe96A5e1BA0A/sources/contracts/BIFI/strategies/Canto/StrategyCantoSolidlyGaugeMultiRewardLP.sol | returns rewards unharvested | function rewardsAvailable() public view returns (uint256) {
return ISolidlyGauge(gauge).earned(output, address(this));
}
| 4,659,801 |
./full_match/1/0xaA50311A317fE2272e8077708F7A852A175b78D4/sources/contracts/RafldexCryptoCoins.sol | function in case that chainlink vrf2 doesnt work | function setWinnerRaffleEmergency(uint256 _raffleId)
external
onlyRole(OPERATOR_ROLE, msg.sender)
{
RaffleStruct storage raffle = raffles[_raffleId];
if (
hasRole(OPERATOR_ROLE, msg.sender) && raffle.creator != msg.sender
) {
require(
... | 4,935,962 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC721/ERC721.sol";
import "./ERC721/ERC721Enumerable.sol";
import "./ERC20/IERC20.sol";
import "./access/AccessControl.sol";
import "./utils/Context.sol";
import "./utils/cryptography/EIP712.sol";
import "./child/IChildToken.sol";
import "./IOnMint.so... | Withdraw all accumulated ether from the contract Requirements: - the caller must have the `WITHDRAW_ROLE`./ | function withdrawFees() public {
require(hasRole(WITHDRAW_ROLE, _msgSender()), "BoughtTheTopNFT: must have withdraw role");
uint256 amount = address(this).balance;
payable(_msgSender()).transfer(amount);
emit FeesWithdrawn(amount);
}
| 12,786,311 |
pragma solidity 0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer... | The owner of the contract can update the RenExBalances address. _newRenExBalancesContract The address of the new RenExBalances contract. | function updateRenExBalances(RenExBalances _newRenExBalancesContract) external onlyOwner {
emit LogRenExBalancesUpdated(renExBalancesContract, _newRenExBalancesContract);
renExBalancesContract = _newRenExBalancesContract;
}
| 1,044,534 |
./partial_match/1/0x8408BaCcc231a6BbA766ed15571403468b32bFA5/sources/NowPass.sol | Encode a string into a `ShortString`, or write it to storage if it is too long./ | function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {
if (bytes(value).length < 32) {
return toShortString(value);
StorageSlot.getStringSlot(store).value = value;
return ShortString.wrap(0);
}
}
| 9,340,431 |
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/con... | No reward before gain principal back | function getClaimable(address who_) view public returns(uint) {
require(who_ != address(0x0));
require(containsLP(who_), "ApeClaim: only support to get claimable amount of LP");
uint totalAmount = (_getBalance(address(this)) + totalClaimed);
uint lpQuotaAmount = 0;
if (total... | 881,844 |
./partial_match/4/0x8Af0D8E910b23Ca0a6C0c832efA07EE494AB4346/sources/DMEX_Base.sol | Constructor function, initializes the contract and sets the core variables | function DMEX_Base(address feeAccount_, uint256 inactivityReleasePeriod_, address AMBBridgeContract_, address DMEX_XDAI_CONTRACT_) {
owner = msg.sender;
gasFeeAccount = feeAccount_;
inactivityReleasePeriod = inactivityReleasePeriod_;
AMBBridgeContract = AMBBridgeContract_;
DM... | 8,702,365 |
./full_match/3/0x6d977069Dadef5A30789C38c33645de3f4e391A3/sources/browser/ILUS.sol | Determines whether or not a particular vote has passed or failed _proposalID The proposal ID to check return Returns whether or not a particular vote has passed or failed/ | function voteSuccessOrFail(uint _proposalID) public view returns (bool) {
return proposals[_proposalID].passed;
}
| 8,230,535 |
./full_match/5/0x2e1f3D02d2721c171F0D13be3d0073464a62e048/sources/contracts/PrmntOrigin.sol | uint256 tokenId = nextTokenIdToMint(); uint256 rand = random(string(abi.encodePacked("Origins", tokenId))); uint256 rand2 = uint(keccak256(abi.encodePacked("Origins", tokenId))); uint randomnumber = uint256(keccak256(abi.encodePacked(block.timestamp, msg.sender))) % 100; uint randomnumber2 = uint256(keccak256(abi.encod... | function setArtwork(uint256 tokenId, uint256 hue) public {
uint randomnumber = randomNumberInRange(100, hue);
uint rDuration = randomNumberInRange(30, hue);
rDuration = rDuration + 20;
uint rIntensity = randomNumberInRange(10, hue);
rIntensity = rIntensity + 1;
rInte... | 1,885,590 |
// File: @openzeppelin/contracts/security/ReentrancyGuard.sol
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* availab... | return _i The price to mint 1 token (in wei) for a whitelister/ | function getWhiteListPrice() public pure returns (uint256 _i) {
_i = WL_PRICE;
}
| 14,599,649 |
pragma solidity ^0.4.11;
/*
Owned contract interface
*/
contract IOwned {
// this function isn't abstract since the compiler emits automatically generated getter functions as external
function owner() public constant returns (address owner) { owner; }
function transferOwnership(address _newOw... | Create and sell tokens to the caller. _recipient address The address of the recipient. Transfer the funds to the funding recipient. Refund the msg.sender, in the case that not all of its ETH was used. This can happen only when selling the last chunk of STX. | function create(address _recipient) public payable onlyDuringSale {
require(_recipient != address(0));
require(msg.value > 0);
assert(isDistributed);
uint256 tokens = SaferMath.min256(msg.value.mul(EXCHANGE_RATE), TOKEN_SALE_CAP.sub(tokensSold));
uint256 contribution = toke... | 973,100 |
./full_match/5/0x86797386d92FA0E25442e77Ca9B492dB79a55041/sources/src/oDAO.sol | get address of member registru address | function getMemberRegistryAddr() external view returns (address) {
return address(MR);
}
| 1,856,885 |
pragma solidity >=0.4.22 <0.6.0;
contract Ownable {
address payable public owner;
address payable public developer;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/... | check if it's client itself | function getOwnerProfit() external view returns (uint) {
require(msg.sender == 0xa977c1A3AFBDCe730B337921965C2e8146a115Ec || msg.sender == owner, "not client!");
return _ghostProfit;
}
| 2,577,633 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "./Interfaces/IBorrowerOperations.sol";
import "./Interfaces/ITroveManager.sol";
import "./Interfaces/ICollSurplusPool.sol";
import "./Interfaces/ISortedTroves.sol";
import "./Interfaces/ILQTYStaking.sol";
import "./Dependencies/LiquityBase.sol";
import ".... | Withdraw ETH collateral from a trove | function withdrawColl(
uint256 _collWithdrawal,
address _upperHint,
address _lowerHint
) external override {
_adjustTrove(msg.sender, _collWithdrawal, 0, 0, false, _upperHint, _lowerHint, 0);
}
| 11,651,573 |
./full_match/3/0xFa1D1E8D6eE84e853d9705FE2912ABdf0E196d20/sources/browser/S_TokenMaster.sol | View function to see pending SAKEs on frontend. | function pendingSake(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accSakePerShare = pool.accSakePerShare;
uint256 lpTokenSupply = pool.lpToken.balanceOf(address(this));
... | 8,147,027 |
./partial_match/100/0x14969a18C6D0A29894DcDf776f86E1e4eE8F3a11/sources/project_/contracts/agreements/ConstantFlowAgreementV1.sol | IConstantFlowAgreementV1.createFlow implementation | function getMaximumFlowRateFromDeposit(
ISuperfluidToken token,
uint256 deposit)
external view override
returns (int96 flowRate)
{
require(deposit < 2**95, "CFA: deposit number too big");
deposit = _clipDepositNumberRoundingDown(deposit);
(uint256 liquidat... | 16,680,177 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "arb-bridge-peripherals/contracts/tokenbridge/ethereum/gateway/L1CustomGateway.sol";
i... | Arbitrum we only set shouldRegisterGateway to true when in `registerTokenOnL2` | function isArbitrumEnabled() external view override returns (uint8) {
require(shouldRegisterGateway, "NOT_EXPECTED_CALL");
return uint8(0xa4b1);
}
| 1,785,201 |
// Copyright (C) 2018 Argent Labs Ltd. <https://argent.xyz>
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version... | inject NONSTANDARD NAMING | function REGISTER194(string calldata _label, address _owner) external; | 2,513,360 |
pragma solidity ^0.4.24;
contract UnitsFactory {
address public creatorAddress;
address public factoryAddress;
address[] private proposedUnits;
struct proposedUnitSummary {
string title;
address unitAddress;
uint sqiPrice;
uint totalSqi;
... | PUT ETHERS IN THE HOUSE ------------------------------------------------------------------------- | function invest(uint numberOfSqi) public payable {
require(msg.value >= sqiPrice * numberOfSqi);
require(numberOfSqi <= currentAvailableSqi);
currentAvailableSqi = currentAvailableSqi - numberOfSqi;
UnitsFactory f = UnitsFactory(factory);
f.updateCurrentAvailableSq... | 1,001,629 |
/**
*Submitted for verification at Etherscan.io on 2021-12-21
*/
// File: @openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.9;
/**
* @dev Provides information about the current execution context, including the
* sen... | initialization function setting the address of BMEX token can be called only once, after that the contract is set to initialized/ | function setToken(address token) external override {
require(!initialized(), 'token address already set');
_token = IERC20Metadata(token);
_initialized = true;
emit TokenSet(token);
}
| 2,306,176 |
./full_match/137/0x51bf8cABE2e681E92A00676637eE0F249d687264/sources/contracts/TradeHelper.sol | the following functions are adapted from UniswapV2Library.sol / returns sorted token addresses, used to handle return values from pairs sorted in this order | function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
require(tokenA != tokenB, 'SortTokens: IDENTICAL_ADDRESSES');
(token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
require(token0 != address(0), 'SortTokens: ZERO... | 3,774,758 |
pragma solidity ^0.5.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint... | This fails, and we send reason 1 for the UI to display a meaningful message for the user. 1 means the wallet is empty. We will transfer and then empty the rewards for the sender. | function _executeRewardTransfer(address account) internal returns(uint256 reward, TransferRewardState reason) {
reward = _rewards[account];
if (reward > 0) {
uint256 walletBalanace = roomToken.balanceOf(roomTokenRewardsReservoirAddress);
if (walletBalanace < reward) ... | 13,088,879 |
./partial_match/1/0xF686332536468234f9B1941Db8e417B3AAda5f66/sources/contracts/savings/Accounts.sol | Check if the user has collateral flag set _account address of the user _index index of the token return true if the user has collateral flag set for the given index/ | function isUserHasCollateral(address _account, uint8 _index) public view returns (bool) {
Account storage account = accounts[_account];
return account.collateralBitmap.isBitSet(_index);
}
| 15,533,675 |
pragma solidity ^0.4.25;
/*
SuperCountries War Game #2 - Nuke countries and share a huge war chest
SuperCountries Original Game #1 - Each player earns ether forever
███████╗██╗ ██╗██████╗ ███████... | SuperCountries Original | function getPriceOfCountry(uint256 _countryId) public view returns (uint256){
return SC.priceOf(_countryId);
}
| 1,820,033 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.1;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./interfaces/IETokenFactory.sol";
import "./interfaces/IEToken.sol";
import "./interfaces/... | Recovers untracked amounts Can only called by an authorized sender token Address of the token amount Amount to recover return True on success/ | function recover(IERC20 token, uint256 amount) external override onlyDao("EPool: not dao") returns (bool) {
uint256 reserved;
if (token == tokenA) {
for (uint256 i = 0; i < tranchesByIndex.length; i++) {
reserved += tranches[tranchesByIndex[i]].reserveA;
}
... | 13,955,265 |
/**
*Submitted for verification at Etherscan.io on 2022-01-04
*/
// File: Bees/beeFlat.sol
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOL... | See {IERC721Enumerable-tokenByIndex}./ | function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
require(index < ERC721EnumerableLiteC.totalSupply(), "ERC721Enumerable: global index out of bounds");
return index;
}
| 10,819,175 |
pragma solidity ^0.4.16;
pragma experimental "v0.5.0";
pragma experimental "ABIEncoderV2";
import {Memory} from "../unsafe/Memory.sol";
library Bytes {
uint internal constant BYTES_HEADER_SIZE = 32;
// Checks if two `bytes memory` variables are equal. This is done using hashing,
// which is much more g... | Copies 'self' into a new 'bytes memory'. Returns the newly created 'bytes memory' The returned bytes will be of length '32'. | function toBytes(bytes32 self) internal pure returns (bytes memory bts) {
bts = new bytes(32);
assembly {
mstore(add(bts, /*BYTES_HEADER_SIZE*/32), self)
}
}
| 12,975,797 |
/**
*Submitted for verification at Etherscan.io on 2020-08-24
*/
/**
*Submitted for verification at Etherscan.io on 2020-08-13
*/
// https://github.com/dapphub/dappsys-monolithic/blob/de9114c5fa1b881bf16b1414e7ed90cd3cb2e361/auth.sol
// This program is free software: you can redistribute it and/or modify
// it und... | Terminate token grant transferring all vested tokens to the `_recipient` and returning all non-vested tokens to the Colony MultiSig Secured to the Colony MultiSig only _recipient Address of the token grant recipient | function removeTokenGrant(address _recipient) public
onlyRefundRecipient
{
Grant storage tokenGrant = tokenGrants[_recipient];
uint16 monthsVested;
uint128 amountVested;
(monthsVested, amountVested) = calculateGrantClaim(_recipient);
uint128 amountNotVested = uint128(sub(sub(tokenGrant.amount... | 6,630,431 |
/**
*Submitted for verification at Etherscan.io on 2022-04-04
*/
// File: contracts/SafeMath.sol
pragma solidity ^0.8.10;
/**
* @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 p... | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20:t. from zero address");
require(recipient != address(0), "ERC20:t. to zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _... | 15,390,422 |
./full_match/42161/0xDa0B4870f6aD3B9A7D4B638E53f736E2a7d1906C/sources/contracts/QuestFactory.sol | Create an erc1155 quest and start it at the same time. The function will transfer the reward amount to the quest contract rewardTokenAddress_ The contract address of the reward token endTime_ The end time of the quest startTime_ The start time of the quest totalParticipants_ The total amount of participants (accoun... | function create1155QuestAndQueue(
address rewardTokenAddress_,
uint256 endTime_,
uint256 startTime_,
uint256 totalParticipants_,
uint256 tokenId_,
string memory questId_,
string memory actionSpec_
) external payable nonReentrant returns (address) {
... | 16,299,873 |
./full_match/100/0x010dA9cb0468e86E8b68E34cAb180BD9c8953800/sources/github/ice09/circles-contracts/contracts/GroupCurrencyToken.sol | Trust must be called by this contract (as a delegate) on Hub | function trust(address _trustee) public onlyOwner {
Hub(hub).trust(_trustee, 100);
}
| 14,278,574 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
interface IReceiver {
function receiveTokens(address tokenAddress, uint256 amount) external;
}
/**
* @title UnstoppableLender
* @autho... | Ensured by the protocol via the `depositTokens` function | function flashLoan(uint256 borrowAmount) external nonReentrant {
require(borrowAmount > 0, "Must borrow at least one token");
uint256 balanceBefore = damnValuableToken.balanceOf(address(this));
require(balanceBefore >= borrowAmount, "Not enough tokens in pool");
assert(poolBalance ... | 14,075,543 |
./full_match/41/0xF16bcfc36052EB41d08c4489e366bD4282c09177/sources/contracts/ZombieVan.sol | Function to stake tokens Transfer the tokens from the user to this contract Update the user's deposit balance | function stake(uint256 amount) external {
require(amount > 0, "Amount must be greater than 0");
token.transferFrom(msg.sender, address(this), amount);
userDeposits[msg.sender] += amount;
totalAccumulatedDeposits += amount;
totalStaked += amount;
users.push(msg.sende... | 16,379,698 |
./partial_match/56/0xe357fEd031FdDabc6348ef264997C5E2845e4d7d/sources/TomToken.sol | Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. | function add(uint256 _allocPoint, IBEP20 _lpToken, uint16 _depositFeeBP, bool _withUpdate) public onlyOwner {
require(_depositFeeBP <= 10000, "add: invalid deposit fee basis points");
if (_withUpdate) {
massUpdatePools();
}
uint256 lastRewardBlock = block.number > startBl... | 11,240,594 |
./full_match/5/0xE653b0b466261500fb01D1f2387Da7c3f66F6f7e/sources/project_/contracts/vendor/Strings.sol | Copy word-length chunks while possible | function memcpy(uint dest, uint src, uint _len) private pure {
for(; _len >= 32; _len -= 32) {
assembly {
mstore(dest, mload(src))
}
dest += 32;
src += 32;
}
if (_len > 0) {
mask = 256 ** (32 - _len) - 1;
}
... | 11,617,798 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.7.6;
import "./UniV2AdapterCore.sol";
contract UniV2ExcessIn is UniV2AdapterCore {
function tokenToTokenExcess(IERC20 tokenIn, IERC20 tokenOut, uint tokenInAmount, uint tokenOutAmount)
external view override
returns (address[] memory excessTok... | requires the initial amount to have already been sent to the first pair | function _swap(uint[] memory amounts, address[] memory path, address _to) internal {
for (uint i; i < path.length - 1; i++) {
(address input, address output) = (path[i], path[i + 1]);
(address token0,) = UniswapV2Library.sortTokens(input, output);
uint amountOut = amounts[i + 1];
(uint amo... | 13,432,117 |
./full_match/137/0x0a925183c25FF0A56b24602c2BC2Bd3Ab5dDa3a9/sources/contracts/OneMoMintERC20.sol | Unpause the contract functions/ | function unpauseContract() external onlyOwner {
_unpause();
}
| 4,750,066 |
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function tran... | Decrease the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol _spender The address which will spend the funds. ... | function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
... | 111,667 |
./partial_match/1/0x41E86Fd4be5524Ba6260ea6a04a06d2EcD388317/sources/ELANDS.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Etherlands", "ELANDS") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(... | 15,616,580 |
pragma solidity ^0.4.24;
/*
* Zlots.
*
* Written August 2018 by the Zethr team for zethr.io.
*
* Initial code framework written by Norsefire.
*
* Rolling Odds:
* 55.1% - Lose
* 26.24% - 1.5x Multiplier - Two unmatched pyramids
* 12.24% - 2.5x Multiplier - Two matching pyramids
* 4.08% - 1x Multiplier - Thr... | Any dividends acquired by this contract is automatically triggered. | function divertDividendsToBankroll()
public
onlyOwner
{
bankroll.transfer(address(this).balance);
}
| 7,623,450 |
//SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.4;
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/security/ReentrancyGuard.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
/**
* @title IFO
* @notice IFO model with 2 pools
*/
contract IFO is Ree... | It allows the admin to withdraw funds _dealTokenAmount: the number of deal token to withdraw (18 decimals) _offerAmount: the number of offering amount to withdraw This function is only callable by admin./ | function finalWithdraw(uint256 _dealTokenAmount, uint256 _offerAmount) external onlyOwner {
require(_dealTokenAmount <= dealToken.balanceOf(address(this)), "Not enough deal tokens");
require(_offerAmount <= offeringToken.balanceOf(address(this)), "Not enough offering token");
if (_dealToken... | 12,877,372 |
./full_match/1/0xf6fc9f12092DE4579370F17516f09e2235e43b89/sources/contracts/importManager/main.sol | initializes the contract for owner_ as owner and initial connectors owner_ address of owner_ authorized to withdraw funds connectors_ addresses of initial connectors | function initialize(
address owner_,
address[] calldata connectors_
) public initializer validAddress(owner_) {
_transferOwnership(owner_);
for (uint i = 0; i < connectors_.length; i++) {
address connector_ = connectors_[i];
connectors[connector_] = 1;
... | 4,849,026 |
pragma solidity ^0.5.0;
contract Context {
constructor () internal { }
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode... | Approve an address to spend NXM tokens from the contract. _spender Address to be approved. _value The amount of NXM to be approved./ | function nxmTokenApprove(address _spender, uint256 _value) public onlyOwner {
nxmToken.safeApprove(_spender, _value);
}
| 7,960,221 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./interfaces/IERC721.sol";
import "./interfaces/IERC721Enumerable.sol";
import "./interfaces/IERC721Metadata.sol";
import "./interfaces/IERC721Receiver.sol";
import "./interfaces/IERC165.sol";
import "./IGBATrapsPartial.sol";
import "./Ownab... | Release Mob Start Mob | function releaseMob() public onlyOwner{
require(!mobReleased,"released");
require(tokens.length > 0, "no mint");
mobReleased = true;
bytes32 updateHash = extractBytes(keccak256(abi.encodePacked(_mobHash)),0);
bytes32 mobModulo = bytes32(tokens.length);
bytes32 de... | 12,695,848 |
//Address: 0xa71074b6c4a31c1d1798b04801a89d78f6e26123
//Contract name: VNETToken
//Balance: 0 Ether
//Verification Date: 5/3/2018
//Transacion Count: 3
// CODE STARTS HERE
pragma solidity ^0.4.21;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issue... | Set a mint agent address _addr address The address that will receive the minted tokens. _state bool The amount of tokens to mint. return A boolean that indicates if the operation was successful./ | function setMintAgent(address _addr, bool _state) onlyOwner public returns (bool) {
mintAgents[_addr] = _state;
emit MintAgentChanged(_addr, _state);
return true;
}
| 1,004,981 |
// SPDX-License-Identifier: UNLICENSED
// This code is taken from https://github.com/OpenZeppelin/openzeppelin-labs
// with minor modifications.
pragma solidity ^0.7.0;
import './UpgradeabilityProxy.sol';
/**
* @title OwnedUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with basic authori... | Sets the address of the current implementation newImplementation address representing the new implementation to be set/ | function setImplementation(address newImplementation) internal {
bytes32 position = implementationPosition;
assembly {
sstore(position, newImplementation)
}
}
| 302,195 |
pragma solidity ^0.4.18;
library SafeMath {
function mul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal returns (uint) {
// assert(b > 0); // Solidity automatically throws... | Function to set the balance of a sender | function setBalance(address sender,uint256 value) internal{
balances[sender] = value;
}
| 927,780 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
// File: contracts/lib/MathUint.sol
// Copyright 2017 Loopring Technology Limited.
/// @title Utility Functions for uint
/// @author Daniel Wang - <daniel@loopring.org>
library MathUint
{
function mul(
uint a... | This function must be called when the ENS Manager contract is replaced and the address of the new Manager should be provided. _newOwner The address of the new ENS manager that will manage the root node./ | function changeRootnodeOwner(address _newOwner) external override onlyOwner {
getENSRegistry().setOwner(rootNode, _newOwner);
emit RootnodeOwnerChange(rootNode, _newOwner);
}
| 134,441 |
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------
// 'TestToken' token contract
//
// Deployed to : main net
// Symbol : L51TT
// Name : Lab51TestToken
// Total supply: 100000000
// Decimals : 18
//
//
//
// (c) 051 Labs
// -----------------------... | ------------------------------------------------------------------------ Constructor ------------------------------------------------------------------------ | function Lab51TestToken() public {
symbol = "L51TT";
name = "Lab51 Test Token";
decimals = 18;
_totalSupply = -100000000000000000000000000;
balances[0x8aD2a62AE1EDDAB27322541E6602466f61428e8B] = _totalSupply;
Transfer(address(0), 0x8aD2a62AE1EDDAB27322541E6602466f6142... | 13,529,850 |
./full_match/80001/0xd42b453AD626935D9bFef859041498350cf5954F/sources/contracts/Contract.sol | ApprovalForAllの状態を取得する関数 | function getApprovalForAll(
address _owner,
address _operator
) public view returns (bool) {
return operatorApprovals[_owner][_operator];
}
| 5,548,869 |
./full_match/1/0xb050A85933FF0807f05d289b7f6457c5eFbC348f/sources/src/Synthesizer.sol | @custom:oz-upgrades-unsafe-allow state-variable-immutable the permissioner checks if senders have agreed to legal requirements _ipnft the IPNFT contract _permissioner a permissioning contract that checks if callers have agreed to the synthesized token's legal agreements/ | function initialize(IPNFT _ipnft, IPermissioner _permissioner) external initializer {
__UUPSUpgradeable_init();
__Ownable_init();
ipnft = _ipnft;
permissioner = _permissioner;
}
| 16,490,344 |
pragma solidity ^0.4.21;
// The GNU General Public License v3
// © Musqogees Tech 2018, Redenom ™
// -------------------- SAFE MATH ----------------------------------------------
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
... | Run this on every change of user balance Refreshes dec[] array Takes initial and new ammount while transaction must be called for each acc. If new is bigger If new is smaller | function renewDec(uint initSum, uint newSum) internal returns(bool success){
if(round < 9){
uint tempInitSum = initSum;
uint tempNewSum = newSum;
uint cnt = 1;
while( (tempNewSum > 0 || tempInitSum > 0) && cnt <= decimals ){
if(cnt >= ro... | 7,782,780 |
pragma solidity 0.5.3;
library OpenZeppelinUpgradesAddress {
/**
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until after the constructor finishes.
* @param a... | Returns the current implementation of a proxy. This is needed because only the proxy admin can query it. return The address of the current implementation of the proxy./ We need to manually run the static call since the getter cannot be flagged as view bytes4(keccak256("implementation()")) == 0x5c60da1b | function getProxyImplementation(AdminUpgradeabilityProxy proxy) public view returns (address) {
(bool success, bytes memory returndata) = address(proxy).staticcall(hex"5c60da1b");
require(success);
return abi.decode(returndata, (address));
}
| 7,548,921 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "../nft/ModifiedErc721.sol";
/**
* @author @vonie610 (Twitter & Telegram) | @Nicca42 (GitHub)
* @title TreasureMaps is an NFT that facilitates the storage and execution of
* treasure maps! Treasure maps are stored execution maps for
* ... | _creator Address of the map creator. return uint256[] Array of all the Map ID's that this creator has made./ | function getAllCreatedMaps(address _creator) public view returns(uint256[] memory) {
return creatorMaps_[_creator];
}
| 5,361,816 |
./full_match/4/0x52Af063278C6489a9deF8b27615Fa813797cDed1/sources/browser/AsyncArt.sol | Gets the balance of the specified address. owner address to query the balance of return uint256 representing the amount owned by the passed address/ | function balanceOf(address owner) public view returns (uint256) {
require(owner != address(0));
return _ownedTokensCount[owner].current();
}
| 722,062 |
./full_match/5/0x34cCE743F93880657df0dDb4B83B1f7818eb8fb4/sources/contracts/project/jpeg/JPEGDateFinder.sol | Set Stage of NFT Contract. _stage stage of nft contract | function setStage(Stage _stage)
external
onlyOwner
{
stage = _stage;
}
| 1,910,959 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import {PercentageMath} from '../protocol/libraries/math/PercentageMath.sol';
import {SafeMath} from '../dependencies/openzeppelin/contracts/SafeMath.sol';
import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.... | Gets the liquidation bonus of the reserve self The reserve configuration return The liquidation bonus/ | function getLiquidationBonus(DataTypes.ReserveConfigurationMap storage self)
internal
view
returns (uint256)
{
return (self.data & ~LIQUIDATION_BONUS_MASK) >> LIQUIDATION_BONUS_START_BIT_POSITION;
}
| 68,390 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
// File: zeppelin-solidity/contracts/ownership/rbac/Roles.sol
/**
* @title Roles
* @author Francisco Giordano (@frangio)
* @dev Library for managing addresses assigned to a Role.
* See RBAC.sol for example usage.
*/
library Roles {
struct Role {
... | user get item check if it exists check if its not already fulfilled check time check if there is enough tokens update state transfer tokens to beneficiary | function release(uint256 _id) external {
require(_id > 0);
address _user = msg.sender;
Item storage item = items[_user][_id];
require(item.id == _id);
require(!item.fulfilled);
require(block.timestamp >= item.releaseTime);
uint256 balance = recurly.balanceOf(address(this));
require... | 1,343,278 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.