file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) public pure returns (uint256) {
uint256 c = a * b;
require(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) pu... | Overrides ERC20 transferFrom function with modifier that prevents the ability to transfer tokens until after transfers have been enabled. function transferFrom(address _from, address _to, uint256 _value) public onlyWhenTransferEnabled validDestination(_to) returns (bool) {/ | function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
bool result = super.transferFrom(_from, _to, _value);
if (result) {
if (msg.sender == crowdSaleAddr)
crowdSaleAllowance = crowdSaleAllowance.sub(_value);
if (msg.sender =... | 6,460,941 |
pragma solidity ^0.4.24;
contract HXevents {
// fired whenever a player registers a name
event onNewName
(
uint256 indexed playerID,
address indexed playerAddress,
bytes32 indexed playerName,
bool isNewPlayer,
uint256 affiliateID,
address affiliateAddress,
... | calculates how many keys would exist with given an amount of eth _eth eth "in contract" return number of keys that would exist/ | function keys(uint256 _eth)
internal
pure
returns(uint256)
{
return ((((((_eth).mul(1000000000000000000)).mul(156250000000000000000000000)).add(1406247070314025878906250000000000000000000000000000000000000000)).sqrt()).sub(37499960937500000000000000000000)) / (78125000);
}
| 88,579 |
/**
*Submitted for verification at Etherscan.io on 2022-03-24
*/
/**
https://t.me/GoldmanSachsDigitalization
*/
pragma solidity 0.8.9;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual re... | exclude from paying fees or having max transaction amount | constructor() ERC20("Goldman Sachs", "DIGITALIZATION") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswa... | 10,709,388 |
/*
A standard ERC20 compliant token
This software is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See MIT Licence for further details.
<https://opensource.org/licenses/MIT>.
*/
pragma solidity ^0.4... | Using an explicit getter allows for function overloading | function allowance(address ownerAddress, address spenderAddress) public view returns (uint256 remaining)
{
return allowed[ownerAddress][spenderAddress];
}
| 2,513,458 |
pragma solidity ^0.5.7;
library SafeMath {
int256 constant private in... | inject NONSTANDARD NAMING | function TOKEN293() public view returns (IERC20) { | 12,598,116 |
./full_match/1/0x162A78B8bbB2c7dbD6D7aceC507EF9625d2b34E4/sources/contracts/savings/Bank.sol | Ratio of the capital in Compound _token token address/ | function getCapitalCompoundRatio(address _token) public view returns (uint256) {
address cToken = globalConfig.tokenRegistry().getCToken(_token);
if (totalCompound[cToken] == 0) {
return 0;
return uint256(totalCompound[cToken].mul(INT_UNIT).div(getTotalDepositStore(_token)));... | 17,083,686 |
pragma solidity ^0.4.11;
//
// Ann.sol - A smart contract for managing announcements cryptographically.
// Licensed under MIT
// See https://github.com/secure-vote/ann.sol/ for the readme and license
//
// This contract allows publishers to push out announcements cryptographically.
// Before the contract reco... | ensure we store the message first finally note that this has been processed and clean up | function addMsgFinal(Message msg, uint256 msgWaitingN) private {
msgMap[nMsg] = msg;
nMsg += 1;
msgsWaitingDone[msgWaitingN] = true;
delete msgsWaiting[msgWaitingN];
}
| 12,554,311 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@openzeppelin/contracts/utils/EnumerableMap.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "@open... | TODO document SM functions SPDX-License-Identifier: MIT | interface IRewardsGenerator {
function blocksWithRewardsPassed(address _policyBook) external view returns (uint256);
function rewardPerToken(address _policyBook) external view returns (uint256);
function earned(
address _policyBook,
address _userLeveragePool,
address _account
)... | 12,077,285 |
./full_match/80001/0xCaFC54116Bf17151155e93D798dCbC7Ce81D7e5F/sources/project_/contracts/Shopify.sol | Allow owner to delete the default royalty for all collection | function deleteDefaultRoyalty() external onlyHasRole(ADMIN_ROLE) {
_deleteDefaultRoyalty();
}
| 9,499,272 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization... | function to get tokens number for eth send | function getTokensForWeiReceived(uint256 _weiAmount) internal view returns (uint256) {
return _weiAmount.mul(ETH_USD).div(tokenCost);
}
| 5,475,599 |
pragma experimental ABIEncoderV2;
/* Contract Imports */
import { StateManager } from "./StateManager.sol";
import { StateTransitioner } from "./StateTransitioner.sol";
import { ExecutionManager } from "./ExecutionManager.sol";
/* Library Imports */
import { ContractResolver } from "../utils/resolvers/ContractResolve... | Set storage for OVM contract at some slot. _ovmContractAddress The contract we're setting storage of. _slot The slot we're setting. _value The value we will set the storage to./ | function setStorage(
address _ovmContractAddress,
bytes32 _slot,
bytes32 _value
)
public
onlyExecutionManager
{
if (!storageSlotTouched[_ovmContractAddress][_slot]) {
updatedStorageSlotContract[updatedStorageSlotCounter] = bytes32(bytes20(_ovmContr... | 5,473,845 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "../interfaces/IUniswapV2Pair.sol";
import "../interfaces/IUniswapV2Factory.sol";
import "../interfaces/IPriceOracle.sol";
import "../interfaces/IExtendedAggregator.sol";
import "../misc/SafeMath.sol";
import "../misc... | Calculates the price of the pair token using the formula of arithmetic mean. ethTotal_0 Total eth for token 0. ethTotal_1 Total eth for token 1./ | function getArithmeticMean(uint256 ethTotal_0, uint256 ethTotal_1)
internal
view
returns (uint256)
{
uint256 totalEth = ethTotal_0 + ethTotal_1;
return Math.bdiv(totalEth, getTotalSupplyAtWithdrawal());
}
| 393,282 |
// SPDX-License-Identifier: UNLICENSE
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/token/ERC721/ERC721.sol';
import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/utils/Counters.sol';
import '@open... | don't release the worm ensure minting is only possible once it has begun ensure only the 0riginal is ever minted ensure the price was paid in full | function release() public payable {
uint newTokenId = _tokenIdTracker.current();
require(
hasItBegun == true,
'TOO EARLY: it has not begun yet.'
);
require(
newTokenId == 0,
'TOO LATE: the 0riginal can only be minted once.'
);
require(
msg.value >= priceToRelease,
'TOO POOR: send moar ... | 147,001 |
pragma solidity 0.5.12;
pragma experimental ABIEncoderV2;
import { IInterest } from "../interfaces/IInterest.sol";
import { SafeMath } from "../lib/SafeMath.sol";
import { Types } from "../lib/Types.sol";
/**
* @title DaiFiInterest Contract
* @notice Abstract contract for calculating interest on supplied and borrowed... | Returns the current per block interest rate on borrowed attoDai (public pure) return The current interest rate/ TODO: implement and test, for now 1% (!) per block | function getBorrowedAttoDaiInterestRate() public pure returns (uint256) {
return 100000000000000000000;
}
| 5,368,277 |
./full_match/5/0xa3E2D77D02095d04dE8CFbf34b1C03fC9b24307A/sources/contracts/Marketplacev4.sol | Returns the CloudaxNFT Listing price | function getServiceFee() public view returns (uint256) {
return _serviceFee;
}
| 1,880,470 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While thes... | Adds or removes a minter contract./ | function approveMinter(address minter, bool approve) external onlyOwner {
minters[minter] = approve;
}
| 1,587,621 |
pragma solidity 0.5.10;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions... | Interface of the ERC20 standard as defined in the EIP. Does not include the optional functions; to access them see {ERC20Detailed}./ | interface TRC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint25... | 2,179,707 |
/**
*Submitted for verification at Etherscan.io on 2020-09-18
*/
/**
*Submitted for verification at Etherscan.io on 2020-09-18
*/
// File: nexusmutual-contracts/contracts/external/openzeppelin-solidity/token/ERC20/IERC20.sol
pragma solidity 0.5.7;
/**
* @title ERC20 interface
* @dev see https://github.com/ethe... | Transfers ERC20 investment asset from this Pool to another Pool./ | {
function _transferInvestmentAsset(
bytes4 _curr,
address _transferTo,
uint _amount
)
internal
if (_curr == "ETH") {
if (_amount > address(this).balance)
_amount = address(this).balance;
p1.sendEther.value(_amount)();
... | 7,287,130 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "./ChainWalletAgent.sol";
abstract contract WalletManagerUpgradeable is Initializable, ContextUpgradeab... | Initializes the contract./ | function __WalletManager_init() internal onlyInitializing {
__WalletManager_init_unchained();
}
| 2,497,437 |
/*
ERC20StakingModule
https://github.com/gysr-io/core
SPDX-License-Identifier: MIT
*/
pragma solidity 0.8.4;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./interfaces/IStakingModule.sol";
/**
* @title ERC20 staking module
*
*... | @inheritdoc IStakingModule/ validate transfer mint staking shares at current rate update user staking info add newly minted shares to global total | function stake(
address user,
uint256 amount,
bytes calldata
) external override onlyOwner returns (address, uint256) {
require(amount > 0, "sm1");
uint256 total = _token.balanceOf(address(this));
_token.safeTransferFrom(user, address(this), amount);
uint... | 218,739 |
./full_match/1/0x5036BD87b5294878587230C3A87d50584B52ae39/sources/contracts/facets/AdminFacet.sol | To be updated by contract owner to allow public sale minting _saleActiveState - bool new public sale state return bool - new public sale state/ | function setPublicSaleState(bool _saleActiveState) external returns (bool) {
LibDiamond.enforceIsContractOwner();
require(
LibDiamondDapes.diamondDapesStorage().isPublicSaleActive != _saleActiveState,
"NEW_STATE_IDENTICAL_TO_OLD_STATE"
);
LibDiamondDapes.diamondDapesStorage().isPublicSaleA... | 16,465,633 |
/*
Copyright 2018-2019 RigoBlock, Rigo Investment Sagl, 2020 Rigo Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by app... | CONSTANT PUBLIC FUNCTIONS/ Returns structs of infos on a list of dragos for a group. _dragoRegistry Address of the pools registry. _group Number of the target drago group. return Arrays of structs of data and related address of a pool. | function queryAllPoolsByGroup(
address _dragoRegistry,
address _group)
external
view
returns (
PoolBaseData[] memory
)
{
DragoRegistryFace dragoRegistryInstance = DragoRegistryFace(_dragoRegistry);
uint256 length = dragoRegistryInstance... | 7,316,677 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
// constants
import "./constants.sol";
// interfaces
import "./interfaces/IERC725Y.sol";
// modules
import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";
import "./utils/OwnableUnset.sol";
/**
* @title Core implementation of ERC725 Y ... | Gets singular data at a given `key` key The key which value to retrieve return value The data stored at the key/ | function _getData(bytes32 key) internal view virtual returns (bytes memory value) {
return store[key];
}
| 6,440,262 |
/*
Copyright 2020 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... | Returns the address to approve component for staking tokens. _stakingContract Address of the gauge staking contract return address Address of the contract to approve tokens transfers to/ | function getSpenderAddress(address _stakingContract) external pure returns(address) {
return _stakingContract;
}
| 13,118,558 |
pragma solidity ^0.4.25;
contract toff {
using SafeMath for uint256;
mapping(address => uint256) investments;
mapping(address => uint256) joined;
mapping(address => uint256) withdrawals;
mapping(address => uint256) referrer;
mapping(address => uint256) withdraStock;
uint256 public step ... | bonus share/ calculate share update withdrawShare | function withdrawStock() public
{
require(joined[msg.sender] > 0);
require(timeWithdrawstock < now);
uint256 share = stock.mul(investments[msg.sender]).div(totalPot);
uint256 currentWithDraw = withdraStock[msg.sender];
uint256 balance = share.sub(current... | 2,057,633 |
./full_match/42161/0xDa0B4870f6aD3B9A7D4B638E53f736E2a7d1906C/sources/contracts/QuestFactory.sol | set the default referral fee recipient defaultReferralFeeRecipient_ The address of the default referral fee recipient | function setDefaultReferralFeeRecipient(address defaultReferralFeeRecipient_) external onlyOwner {
defaultReferralFeeRecipient = defaultReferralFeeRecipient_;
}
EXTERNAL VIEW
| 16,299,898 |
pragma solidity ^0.4.24;
import 'openzeppelin-solidity/contracts/crowdsale/emission/MintedCrowdsale.sol';
import 'openzeppelin-solidity/contracts/crowdsale/distribution/RefundableCrowdsale.sol';
import './BurnableCrowdsale.sol';
import './TicketToken_01.sol';
/**
* @dev This EventCrowd_01 contract contins a col... | this function is used to get Excrow address, then that address will be used to get it's balance. it will be accessed by web3 instance/ | function getEscrowAddress() public view returns (address){
return escrow;
}
| 6,349,708 |
./partial_match/3/0x1C1CF91E0f028aad2bf835f6F209382B2E3210bA/sources/PigeonswapV2Pair.sol | this low-level function should be called from a contract which performs important safety checks | function mint(address to) external lock returns (uint liquidity) {
uint balance0 = IERC20(token0).balanceOf(address(this));
uint balance1 = IERC20(token1).balanceOf(address(this));
uint amount0 = balance0.sub(_reserve0);
uint amount1 = balance1.sub(_reserve1);
bool feeOn = _... | 5,110,434 |
pragma solidity ^0.7.1;
import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol";
import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol";
import "@uniswap/lib/contracts/libraries/FixedPoint.sol";
import "@uniswap/v2-periphery/contracts/libraries/UniswapV2OracleLibrary.sol";
import "@uniswap/v2-p... | Updates a pair's most recent snapshot if the period has elapsed./ | function updatePair(address pair) external returns (bool) {
return _update(pair);
}
| 955,849 |
./full_match/4/0x3B0dE749344778659D77CED7b076e00fB7378731/sources/contracts/pix_v5.sol | / make sure the array lengths are all the same loop through arrays, committing each individual vote values | function VoteOnProposals(uint[] calldata _proposalIDs, bool[] memory _decisions) external {
require(_proposalIDs.length == _decisions.length, "input arrays must be same length");
@notice Commits votes on an array of proposals
for (uint i = 0; i < _proposalIDs.length; i++) {
... | 683,494 |
/**
*Submitted for verification at Etherscan.io on 2021-04-12
*/
// File: @openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While the... | Gets current Whape price based on current supply./ Whale or Ape, we all pay the same price | function getWhapePrice() public view returns (uint256) {
require(totalSupply() < MAX_WHAPE_SUPPLY, "Sale has already ended, no more Whapes left to sell.");
return salesPrice;
}
| 2,202,140 |
pragma solidity ^0.4.21;
/*
* ##### ## ##### ## ### ## ### ###
* ###### /### ###### / #### / /#### #### / ### ###
* /# / / ### /# / / ####/ / ### /####/ ## ##
* ... | init/ Initialize the PHX Contract | function PHXroll() public {
owner = msg.sender;
treasury = msg.sender;
PHXTKN = PHXInterface(PHXTKNADDR);
ownerSetHouseEdge(990);
ownerSetMaxProfitAsPercentOfHouse(10000);
ownerSetMinBet(100000000000000000);
| 5,812,935 |
pragma solidity ^0.6.4;
library PrimeField {
uint256 internal constant MODULUS = 0x0800000000000011000000000000000000000000000000000000000000000001;
uint256 internal constant MODULUS_MASK = 0x0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
uint256 internal constant MONTGOMERY_R = 0x7ffff... | Lookup data at an index | function lookup(EvalX memory eval_x, uint256 index) internal trace_mod('eval_x_lookup') returns (uint256) {
return fpow(eval_x.eval_domain_generator, index);
}
| 2,520,672 |
./full_match/97/0x81e206F92d237Dc849353F6E15513b8D88ea451B/sources/project_/contracts/Escrow.sol | Seller already sets the crypto item, now it's time to buy this crypto cryptoTradeId crypto trade id/ tax policy | function buyCrypto (uint256 cryptoTradeId) external payable nonReentrant{
CryptoItem storage cryptoProduct = cryptoTrades[cryptoTradeId];
require(msg.value >= cryptoProduct.price, "Not enough paid");
require(!cryptoProduct.completed, "Already completed");
(cryptoProduct.seller).tran... | 3,286,962 |
./partial_match/1/0x9A3fB36bF72a387fCC821A38eE9F50f1A0eb8Cbd/sources/derpman.sol | Transfer tokens from owner to contract Add liquidity | function addLiquidity(uint256 tokenAmount) public payable onlyOwner lockTheSwap {
_transfer(owner(), address(this), tokenAmount);
_addLiquidity(tokenAmount, msg.value);
}
| 2,698,899 |
./partial_match/42/0xb36628385431331E3636d908237D06fB7e3308eb/sources/HodlerPool.sol | TODO: this is where I need to put my logic... return stakingBalanceOf(account) .mul(rewardPerToken().sub(userRewardPerTokenPaid[account])) .div(1e18) .add(_allStakers[account].rewardsBalance); | function earned(address account, uint stakerLevel) private view returns (uint256) {
if (stakerLevel == stakerLevelNULL)
stakerLevel = getStakerLevel(account);
uint256 earnedForAmount = (stakingBalanceOf(account)
.mul(rewardPerToken().sub(userRewardPerTokenPaid[account])))
... | 9,086,360 |
pragma solidity 0.4.25;
library SafeMath256 {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure... | if it's the first applicant then set auto select block | function apply(
uint256 _challengeId,
address _user,
uint256 _dragonId,
uint8[2] _tactics,
) external onlyController {
_validateChallengeId(_challengeId);
_validateTactics(_tactics);
_checkTheBattleHasNotOccurred(_challengeId);
_checkTheChallengeIs... | 15,786,959 |
// File: @uniswap\lib\contracts\libraries\TransferHelper.sol
pragma solidity >=0.6.0;
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
function safeApprove(address token, address to, uint value) internal {
// bytes4(kec... | SWAP requires the initial amount to have already been sent to the first pair 10000000000000000 | function _swap(uint[] memory amounts, address[] memory path, address _to) internal virtual {
for (uint i; i < path.length - 1; i++) {
(address input, address output) = (path[i], path[i + 1]);
(address token0,) = PancakeLibrary.sortTokens(input, output);
uint amountOut = a... | 1,720,517 |
pragma solidity ^0.5.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions... | / GSNRecipient implementation // Ensures that only users with enough gas payment token balance can have transactions relayed through the GSN./ restrict to burn function only load methodId stored in first 4 bytes https:solidity.readthedocs.io/en/v0.5.16/abi-spec.htmlfunction-selector-and-argument-encoding load amount s... | function acceptRelayedCall(
address /*relay*/,
address /*from*/,
bytes calldata encodedFunction,
uint256 /*transactionFee*/,
uint256 /*gasPrice*/,
uint256 /*gasLimit*/,
uint256 /*nonce*/,
bytes calldata /*approvalData*/,
uint256 /*maxPossibleCh... | 1,033,741 |
./full_match/42/0x2d17723662A0e3E5Ce03d40e961B784329525985/sources/contracts/FController.sol | Checks if the account should be allowed to mint tokens in the given market rToken The market to verify the mint against minter The account which would get the minted tokens mintAmount The amount of underlying being supplied to the market for tokens return 0 if the mint is allowed, otherwise a semi-opaque error code ... | function mintAllowed(address rToken, address minter, uint mintAmount) external override returns (uint) {
require(!mintGuardianPaused[rToken], "mint is paused");
minter;
mintAmount;
require(!IFControllerMembership(controllerMembershipAddress).isTokenListedInMarkets(rToken),"Market ... | 16,253,118 |
./full_match/1/0x07C6219393CfA3fBdc332F1f26aD742aDCA45425/sources/browser/GoldenBurn.sol | calculates the CREATE2 address for a pair without making any external calls | function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = sortTokens(tokenA, tokenB);
pair = address(uint(keccak256(abi.encodePacked(
hex'ff',
factory,
keccak256(abi.encodePacked(token0, t... | 4,881,676 |
pragma solidity ^0.5.0;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "../ProxyToken/ProxyToken.sol";
import "../UniversalProtocolToken/UniversalProtocolToken.sol";
import "./ProxyTokenAuthorizable.sol";
import "./ProxyTokenRequestsStorage.sol";
/**
* @title ProxyTokenRequestsV0
*/
contract Pr... | The proxy token owner or an authorized requester cancels a burn request requestId requestId of burn request to cancel data external data logged as part of the burn request cancellation/ | function cancelBurnRequest(
uint256 requestId,
string memory data)
public
onlyNewBurnRequest(requestId)
onlySelfBurnRequester(msg.sender, requestId)
{
_storage.setBurnRequestStatus(requestId, ProxyTokenRequestsStorageV0.Status.CANCELLED);
_storage.setBurnRequestStringMap(requestId, "canc... | 7,277,713 |
./full_match/1/0x34DAaCe448Bf390BA014f3D2D169A89f559E6fE1/sources/contracts/CryptoVoucherToken.sol | For auto liquidity, liquidate half tokens and put in the remaining ones for liquidity. Team tokens are all tokens left. Liquidate tokens. Send team funds. Auto-liquidity | function _liquidateFees(uint tokensForLiquidation, Fees memory transferFees) private {
uint autoLiquidityTokens = tokensForLiquidation * ((transferFees.buyAutoLiquidity + transferFees.sellAutoLiquidity)) / (transferFees.buyTotal + transferFees.sellTotal);
uint autoLiquidityTokensToLiquidate = autoLiquidityTok... | 8,380,742 |
pragma solidity ^0.5.0;
import "node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
import "node_modules/openzeppelin-solidity/contracts/cryptography/ECDSA.sol";
import "node_modules/tabookey-gasless/contracts/RelayRecipient.sol";
import "node_modules/tabookey-gasless/contracts/RecipientUtils.sol";
import... | Validate fund status. _id Lookup key id. | function isClaimExpired(
bytes32 _id
)
public
view
returns (bool)
{
if(isFundValid(_id)){
return (funds[_id].expirationTime < now);
return true;
}
}
| 5,456,815 |
./full_match/4/0xDb6C95550436d73E1331Fec70dB209ad9EaBE128/sources/contracts/SGFC.sol | adds a list of accounts to the whitelist/ | function batchAddToWhitelist(address[] memory accounts) public onlyOwner {
address[] memory addresses = accounts;
uint64 i;
uint256 length = accounts.length;
for (i = 0; i < length; i++) {
addToWhitelist(addresses[i]);
}
}
| 13,371,021 |
pragma solidity ^0.5.16;
contract SimpleStorage {
// These varaibles will be stored on the blockchain.
string public text = "Hello";
uint public i = 123;
function doSomething() public {
// These variables will not be stored on the blockchain.
string memory text = "Test";
uint i... | Function to get text. Actually we don't need this function. The compiler automatically creates getter functions for all public variables. | function get() public view returns (string memory) {
return text;
}
| 12,807,947 |
./full_match/4/0xc1e602a21baf6D6eA8fF380D8fA8eC10898F6723/sources/CounterMock.sol | custom function that wraps endpoint.send(...) which will cause lzReceive() to be called on the destination chain! | function incrementCounter(uint16 _dstChainId, bytes calldata _dstCounterMockAddress) public payable {
}
| 724,803 |
./full_match/43113/0x9ee8993c2bB8d9670d58F58d9eC239DDc703427c/sources/apps/avai/src/contracts/openzep/TimelockController.sol | External interface of AccessControl declared to support ERC165 detection./ | interface IAccessControl {
event RoleAdminChanged(
bytes32 indexed role,
bytes32 indexed previousAdminRole,
bytes32 indexed newAdminRole
);
event RoleGranted(
bytes32 indexed role,
address indexed account,
address indexed sender
);
event RoleRevoked(
bytes32 indexed role,
add... | 7,185,356 |
/**
*Submitted for verification at Etherscan.io on 2019-12-02
*/
pragma solidity ^0.5.4;
/**
* ERC20 contract interface.
*/
contract ERC20 {
function totalSupply() public view returns (uint);
function decimals() public view returns (uint);
function balanceOf(address tokenOwner) public view returns (uin... | Implementation of EIP 1271. Should return whether the signature provided is valid for the provided data. _msgHash Hash of a message signed on the behalf of address(this) _signature Signature byte array associated with _msgHash/ | function isValidSignature(bytes32 _msgHash, bytes memory _signature) public view returns (bytes4) {
require(_signature.length == 65, "TM: invalid signature length");
address signer = recoverSigner(_msgHash, _signature, 0);
require(isOwner(BaseWallet(msg.sender), signer), "TM: Invalid signer"... | 2,499,622 |
/**
*Submitted for verification at Etherscan.io on 2022-03-17
*/
/*
Telegram: https://t.me/MasterElona
*/
pragma solidity ^0.7.5;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns... | exclude from paying fees or having max transaction amount | constructor() ERC20("Master Elona", "MELONA") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUni... | 2,343,448 |
./partial_match/1/0xe1ac13c21e3F1EeBF71CC0F9e74D6059AbAc7970/sources/ORentable.sol | @inheritdoc IERC721ReadOnlyProxy | function mint(address to, uint256 tokenId) external override onlyMinter {
_mint(to, tokenId);
}
| 2,889,800 |
./full_match/421611/0x93D807dfe363030AeD7676b65251c98078BB1c54/sources/_aave/core-v3/contracts/protocol/tokenization/AToken.sol | Transfers the aTokens between two users. Validates the transfer (ie checks for valid HF after the transfer) if required from The source address to The destination address amount The amount getting transferred validate True if the transfer needs to be validated, false otherwise/ | function _transfer(
address from,
address to,
uint256 amount,
bool validate
) internal {
address underlyingAsset = _underlyingAsset;
uint256 index = _pool.getReserveNormalizedIncome(underlyingAsset);
uint256 fromBalanceBefore = super.balanceOf(from).rayMul(index);
uint256 toBalance... | 13,220,727 |
./full_match/1/0xcC8AC8077a8D99CBA9a17f824609E3470E2Cd743/sources/contracts/HYPEMERICADELUXE.sol | Sum the total amount of NFTs being gifted | function gift(uint[] calldata quantity, address[] calldata recipient) external onlyTeam{
uint totalQuantity = 0;
uint256 s = mintCount;
for(uint i = 0; i < quantity.length; ++i){
totalQuantity += quantity[i];
}
mintCount += totalQuantity;
delete totalQuantity;
for(uint i = 0;... | 8,433,415 |
import "./BibleToken.sol";
/**
* @title SafeBEP20
* @dev Wrappers around BEP20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this l... | Update fee address by the previous fee address. | function setFeeAddress(address _feeAddress) public {
require(_feeAddress != address(0), "setFeeAddress: invalid address");
require(msg.sender == feeAddress, "setFeeAddress: FORBIDDEN");
feeAddress = _feeAddress;
emit SetFeeAddress(msg.sender, _feeAddress);
}
| 14,029,392 |
./partial_match/3/0x6d66801D1Da3022F407dcBf4d1E53Dc00138F672/sources/Howdoo.sol | update allowedMinting flat | function disableMinting() public onlyStateChangeAgents() {
allowedMinting = false;
}
| 5,329,640 |
pragma solidity ^0.5.0;
import "./GoAssetBank.sol";
import "./EvmAssetBank.sol";
import "../Oracle.sol";
import "../GoAssetBridge.sol";
/**
* @title BridgeBank
* @dev Bank contract which coordinates asset-related functionality.
* GoAssetBank manages the minting and burning of tokens which
* represent go... | : Burns bank tokens _goAssetReceiver: The _goAsset receiver address in bytes. _goAssetTokenAddress: The currency type _amount: number of goAsset tokens to be burned/ | function burnBridgeTokens(address _goAssetReceiver, address _goAssetTokenAddress, uint256 _amount) public
{
return burnGoAssetTokens(
msg.sender,
_goAssetReceiver,
_goAssetTokenAddress,
_amount
);
}
| 12,900,010 |
// 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,... | Checks if an asset is supported by the price feed _asset The asset to check return isSupported_ True if the asset is supported | function isSupportedAsset(address _asset) external view override returns (bool isSupported_) {
return getPoolForDerivative(_asset) != address(0);
}
| 10,238,052 |
pragma solidity ^0.4.24;
import "./EtherFairyBase.sol";
import "./ERC/ERC721.sol";
import "./ERC/ERC721TokenReceiver.sol";
import "./Util/SafeMath.sol";
// 요정 소유권 관련 기능
contract FairyOwnership is EtherFairyBase, ERC721 {
using SafeMath for uint256;
// 요정의 소유주 정보
mapping(uint256 => address) public fairyIdToMaster... | ERC721: 요정 거래 권한이 승인된 지갑 주소를 가져옵니다. | function getApproved(uint256 fairyId) public view returns (address) {
return fairyIdToApproved[fairyId];
}
| 7,308,894 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
// interfaces cannot have any function implemented, can be inherited. cannot inherit from other contracts, but can inherit from other interfaces
// all declared functions must be external
// they cannot declare a constructor
// they cannot declare state vari... | interfaces cannot have any function implemented, can be inherited. cannot inherit from other contracts, but can inherit from other interfaces all declared functions must be external they cannot declare a constructor they cannot declare state variables some of these restrictions might be lifted in the future int public ... | interface Base {
function setX(int _x) external;
}
| 6,432,847 |
// contracts/Blog.sol
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "hardhat/console.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract Blog {
string public name;
address public owner;
using Counters for Counters.Counter;
Counters.Counter private _postIds;
... | updates the blog name / | function updateName(string memory _name) public {
name = _name;
}
| 909,225 |
// 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... | We expose this function to modify the address where the treasuryTax goes | function setTreasuryAddress(address payable treasuryAddress) external {
require(
_msgSender() == _treasuryAddress,
"You are not the treasury address"
);
require(
(treasuryAddress != address(0)),
"Give me the treasury address"
);
... | 9,861,477 |
// SPDX-License-Identifier: MIT
// File: contracts\Interfaces.sol
pragma solidity 0.6.12;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library MathUtil {
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256)... | create a virtual balance reward pool that mimicks the balance of a pool's main reward contractused for extra incentive tokens(ex. snx) as well as vecrv feescreate new pool, use main pool for balance lookupadd the new pool to main pool's list of extra rewards, assuming this factory has "reward manager" rolereturn new po... | function CreateTokenRewards(address _token, address _mainRewards, address _operator) external returns (address) {
require(msg.sender == operator || rewardAccess[msg.sender] == true, "!auth");
VirtualBalanceRewardPool rewardPool = new VirtualBalanceRewardPool(_mainRewards,_token,_operator);
... | 10,440,242 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.1;
import "./IPool.sol";
interface ICorePool is IPool {
function vaultRewardsPerToken() external view returns (uint256);
function poolTokenReserve() external view returns (uint256);
function stakeAsPool(address _staker, uint256 _amount) external;
... | Initializes the contract setting the deployer as the initial owner./ | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
}
pragma solidity 0.8.1;
constructor() {
address msgSender = msg.sender;
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
| 11,665,364 |
./full_match/5/0xC51b205F2faB5D157eB32F918388f964D59C6EB2/sources/project_/contracts/NFTlendingBorrowing.sol | Allows a user to bid a loan for an nft. _NFTid The Id of the NFTDetail. _bidAmount The amount being bidded. _ERC20Address The address of the tokens being bidded. _percent The interest percentage for the loan bid. _duration The duration of the loan bid. _expiration The timestamp after which the bid can be withdraw... | function Bid(
uint256 _NFTid,
uint256 _bidAmount,
address _ERC20Address,
uint16 _percent,
uint32 _duration,
uint256 _expiration
) external whenNotPaused nonReentrant {
require(
_ERC20Address != address(0)
);
require(_bidAmount !... | 11,610,773 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;
import '@ensdomains/ens-contracts/contracts/registry/ENS.sol';
import {SDaoRegistrar} from '../SDaoRegistrar.sol';
import {ISDaoRegistrar} from '../ISDaoRegistrar.sol';
import {ISDaoRegistrarClaimable} from './interfaces/ISDaoRegistrarClaimable.sol';
import {ENS... | Register a name. Can only be called if label is not booked./ | function register(string memory label)
public
virtual
override(SDaoRegistrar, ISDaoRegistrar)
{
bytes32 labelHash = keccak256(bytes(label));
require(
ENS_LABEL_BOOKER.getBooking(labelHash) == address(0),
'SDAO_REGISTRAR_CLAIMABLE: LABEL_BOOKED'
);
super.register(label);
}
| 6,369,949 |
./full_match/1/0x6aF8B4d6c83f96B4A6630550d96C942b2F4E0368/sources/contracts/pools/MSPoolBasic.sol | it sets a new start Price _newStartPrice the new start Price | function setStartPrice( uint128 _newStartPrice ) external onlyOwner {
require( startPrice != _newStartPrice, "new price is equal than current");
require( Algorithm.validateStartPrice( _newStartPrice ), "invalid Start Price" );
startPrice = _newStartPrice;
emit NewStartPrice( _new... | 9,696,266 |
/**
*Submitted for verification at Etherscan.io on 2020-04-25
*/
pragma solidity ^0.5.10;
/**
* @title Guardian node nest storage
*/
contract NEST_NodeSave {
IBMapping mappingContract;
IBNEST nestContract;
/**
* @dev Initialization method
... | Change mapping contract map Mapping contract address/ | function changeMapping(address map) public onlyOwner {
mappingContract = IBMapping(address(map));
nestContract = IBNEST(address(mappingContract.checkAddress("nest")));
}
| 7,235,099 |
// File: @openzeppelin/contracts/GSN/Context.sol
// SPDX-License-Identifier: MIT
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 be... | Calculate and returns price per share of the pool./ | function getPricePerShare() external view returns (uint256) {
return totalValue().mul(1e18).div(totalSupply());
}
| 6,547,708 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.4;
// Uncomment if needed.
// import "hardhat/console.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@ope... | View function to get position ids staked here for an user. _user The related address. push could not be used in memory array we set the tokenIdList into a fixed-length array rather than dynamic | function getTokenIds(address _user)
external
view
returns (uint256[] memory)
{
EnumerableSet.UintSet storage ids = tokenIds[_user];
uint256[] memory tokenIdList = new uint256[](ids.length());
for (uint256 i = 0; i < ids.length(); i++) {
tokenIdList[i] ... | 5,850,564 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
// import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import './Admin.sol';
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
contract TheWellNFT is ERC721, Re... | See {IERC721Metadata-tokenURI}. Returns metadata uri for token tokenId/ If there is no base URI, return the token URI. If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). | function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721URIStorage: URI query for nonexistent token");
string memory tokenMetadataURI_ = tokens[tokenId].metadataURI;
string memory base = _baseURI();
if (bytes(base).... | 5,958,490 |
pragma solidity ^0.4.23;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/AddressUtils.sol";
import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol";
import "./ERC721HoldingsBasic.sol";
/**
* @title Holdings of ERC-721 Non-Fungible Token Standard, basic im... | Internal function to remove a token ID from the list of a given holder ID _from uint256 ID representing the previous holder of the given token ID _fromOrigin address of the previous holder's origin _tokenId uint256 ID of the token to be removed from the tokens list of the given holder ID/ | function removeTokenFrom(uint256 _from, address _fromOrigin, uint256 _tokenId) internal {
require(tokenHolder[_tokenId].origin != address(0));
require(tokenHolder[_tokenId].id == _from && tokenHolder[_tokenId].origin == _fromOrigin);
heldTokensCount[_fromOrigin][_from] = heldTokensCount[_fromOrigin][_from... | 12,729,797 |
./full_match/5/0x45D12f25C815a8007B240D9F9e293687b571195B/sources/project_/contracts/TokenDistributor.sol | Allows owner to set a list of recipients to receive tokens This may need to be called many times to set the full list of recipients sanity check that the address being set is consistent | function setRecipients(address[] calldata _recipients, uint256[] calldata _claimableAmount)
external
onlyOwner
{
require(
_recipients.length == _claimableAmount.length, "TokenDistributor: invalid array length"
);
uint256 sum = totalClaimable;
for (uint... | 7,082,682 |
./full_match/1/0x0b3aC3ab056DcC9Baee89A821CbBf87DCe2B34B7/sources/src/brokerbot/Brokerbot.sol | Payment hub might actually have sent another accepted token, including Ether. Is either called from payment hub or from transferAndCall of the share token (via onTokenTransfer). incomingAsset the erc20 address of either base currency or the share token. from Who iniciated the sell/buy. amount The amount of shares t... | function processIncoming(IERC20 incomingAsset, address from, uint256 amount, bytes calldata ref) public override payable returns (uint256) {
require(msg.sender == address(incomingAsset) || msg.sender == paymenthub, "invalid caller");
if(msg.value > 0) {
emit Received(from, msg.value, amo... | 8,374,561 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.1;
import "./IlluviumPoolBase.sol";
/**
* @title Illuvium Core Pool
*
* @notice Core pools represent permanent pools like ILV or ILV/ETH Pair pool,
* core pools allow staking for arbitrary periods of time up to 1 year
*
* @dev See IlluviumPoolBase for m... | Used internally, mostly by children implementations, see sync() Updates smart contract state (`yieldRewardsPerWeight`, `lastYieldDistribution`), updates factory state via `updateILVPerBlock`/ update ILV per block value in factory if required if locking weight is zero - update only `lastYieldDistribution` and exit | function _sync() internal virtual {
if (factory.shouldUpdateRatio()) {
factory.updateILVPerBlock();
}
if (lastYieldDistribution >= endBlock) {
return;
}
if (blockNumber() <= lastYieldDistribution) {
return;
}
if (usersLocki... | 898,353 |
/**
*Submitted for verification at Etherscan.io on 2021-05-04
*/
pragma solidity 0.7.6;
interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address whom) external view returns (uint);
function allowance(address src, address dst) external view returns (uint);
f... | Derivative Specification interface Immutable collection of derivative attributes Created by the derivative's author and published to the DerivativeSpecificationRegistry | interface IDerivativeSpecification {
function isDerivativeSpecification() external pure returns (bool);
function oracleSymbols() external view returns (bytes32[] memory);
function oracleIteratorSymbols() external view returns (bytes32[] memory);
function collateralTokenSymbol() external view returns ... | 6,507,947 |
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
... | Calculates the bid price in wei per aToken based on the current reserve amount return Price of aToken in wei | function quoteBid() private returns (uint256) {
if(initialSaleComplete)
{
bid = fracExp(1e16, R, (_totalSupply/1e16)-1, P);
}
else
{
bid = ICObid;
}
return bid;
}
| 2,479,718 |
./full_match/80001/0xdfba8ec1CA2abb43d7238fe9518bcD83B05a4aa7/sources/contracts/Strategy/PolygonBridgeStrategy.sol | Withdraw all underlying token to the vault For PolygonBridgeStrategy the vault is FundDivision Strategy/ | function withdrawAllToVault() public override restricted {
uint256 currentBalance = underlyingERC.balanceOf(address(this));
if (currentBalance > 0) {
IERC20(address(underlyingERC)).safeTransfer(vault, currentBalance);
}
}
| 9,432,734 |
pragma solidity >=0.5.5 <0.6.0;
pragma experimental ABIEncoderV2;
... | inject NONSTANDARD NAMING | function SAFEAPPROVE641(IERC20 token, address spender, uint256 value) internal { | 7,293,349 |
./full_match/43113/0xE9Cc97730a4e951BbfF27bbE998282cE73579C72/sources/contracts/Chain.sol | we had stack too deep in `submit` so this method was created as a solution we increasing `_consensusData.sequence` here so we don't have to read sequence again in other place `data.lastTimestamp` must be setup either on deployment or via cloning from previous contract we will not overflow with timestamp and padding in ... | function _verifySubmitTimestampAndIncSequence(uint256 _dataTimestamp) internal {
ConsensusData memory data = _consensusData;
if (data.lastTimestamp == 0) revert ContractNotReady();
unchecked {
if (data.lastTimestamp + data.padding >= _dataTimestamp) revert BlockSubmittedToFastO... | 7,206,311 |
./partial_match/1/0xbF6acaF315477b15D638bf4d91eA48FA79b58335/sources/contracts/universal/CrossDomainMessenger.sol | Computes the amount of gas required to guarantee that a given message will be received on the other chain without running out of gas. Guaranteeing that a message will not run out of gas is important because this ensures that a message can always be replayed on the other chain if it fails to exec... | function baseGas(bytes calldata _message, uint32 _minGasLimit) public pure returns (uint64) {
return
((uint64(_minGasLimit) * MIN_GAS_DYNAMIC_OVERHEAD_NUMERATOR) /
MIN_GAS_DYNAMIC_OVERHEAD_DENOMINATOR) +
(uint64(_message.length) * MIN_GAS_CALLDATA_OVERHEAD) +
... | 9,120,381 |
pragma solidity ^0.6.0;
import "./interfaces/IERC20.sol";
import "./VRFConsumerBase.sol";
import "@openzeppelin/contracts/utils/Address.sol";
// import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
cont... | Sets the Lottery Config, initializes an instance of ERC20 contract that the lottery is based on and starts the lottery. Emits an {LotteryStarted} event indicating the Admin has started the Lottery. Requirements: - Cannot be called if the lottery is in progress. - Only the address set at `adminAddress` can call this fun... | function setLotteryRules(
uint256 numOfWinners,
uint256 playersLimit,
uint256 registrationAmount,
uint256 adminFeePercentage,
uint256 randomSeed
) public onlyOwner {
require(
lotteryStatus == LotteryStatus.NOTSTARTED,
"Error: An existing lo... | 12,624,499 |
./full_match/1/0x4A20F53E612E6Ab515A46EcA9dd36a290a2287F7/sources/contracts/protocol/core/callable/structs/CallableCreditLine.sol | Interest accrued up to now minus the max(totalInterestPaid, totalInterestOwedAt) | function interestAccrued(CallableCreditLine storage cl) internal view returns (uint256) {
assert(cl._checkpointedAsOf == block.timestamp);
return
cl._totalInterestAccruedAtLastCheckpoint.saturatingSub(
Math.max(cl._waterfall.totalInterestPaid(), cl._totalInterestOwedAtLastCheckpoint)
);
... | 9,813,943 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import {IEToken} from "../interfaces/IEToken.sol";
/**
* @title DataTypes library
* @dev Library with two EnumerableSet:
* - ETokenToWadMap: enumerable mapping... | Returns true if the key is in the map. O(1)./ | function _contains(Map storage map, address key) private view returns (bool) {
return map._keys.contains(key);
}
| 2,551,083 |
./full_match/1/0x467a2B91f231D930F5eeB6B982C7666E81DA8626/sources/contracts/nft/libs/ERC721.sol | Internal function to set the base URI for all token IDs. It is automatically added as a prefix to the value returned in {tokenURI}. _Available since v2.5.0._/ | function _setBaseURI(string memory baseURI_) internal {
_baseURI = baseURI_;
}
| 3,857,770 |
./partial_match/1/0x99b57Abf76E69E52EfF39a5f876280d4B525119F/sources/contracts/cedar/drop/CedarERC721Drop.sol | See ERC 721 - Returns the URI for a given tokenId. | function tokenURI(uint256 _tokenId)
public
view
override(ERC721Upgradeable, ICedarNFTMetadataV1)
returns (string memory)
{
return CedarERC721DropLogic.tokenURI(claimData, _tokenId);
}
| 3,659,890 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.1;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
/**
* @title NFTMarke... | withdraw/return currencyToken.balanceOf(address(this)); | function totalBalance() external view returns(uint) {
return payable(address(this)).balance;
}
| 6,478,989 |
./full_match/5/0xF55f21107a46d86A997E9D33f011e8727703c389/sources/contracts/Nokko.sol | _safeMint(to, tokenId); _setTokenURI(tokenId, tokenURI); | function mintNFT(address to, uint256 tokenId, string memory uri, uint256 revealTime, uint256 price) public payable {
require(msg.value >= price, "Insufficient ether sent");
_tokenIds.increment();
uint256 newItemId = _tokenIds.current();
_mint(to, newItemId);
_setT... | 1,910,926 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.8.0;
// ====================================================================
// | ______ _______ |
// | / _____________ __ __ / ____(_____ ____ _____ ________ |
// | / /_ / ___/ __ `| |/_/ /... | This function is what other minters will call to mint new tokens | function minter_mint(address m_address, uint256 m_amount) external onlyMinters {
_mint_capped(m_address, m_amount);
emit TokenMinted(msg.sender, m_address, m_amount);
}
| 1,090,357 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view ret... | Update the given pool's XDEX allocation point. Can only be called by the owner. | function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint);
poolInfo[_pid].allocPoint = _allocPoint;
}
| 60,441 |
./full_match/10/0x6604de3C9E7D511894d05939EE0f7538965be066/sources/contracts/KtbArbitrageur.sol | CA_CAC: caller is a contract Transfer tokenIn to here for msg.sender | function arbitrage(
address kantabanVault,
address tokenIn,
address tokenOut,
uint256 amountIn,
bool isToBuyOnKtb,
uint24 uniswapV3PoolFeeTier,
bytes calldata oneInchTxData
) external nonReentrant returns (uint256) {
address msgSender = msg.sender;... | 3,779,357 |
//! { "cases": [ {
//! "name": "complex",
//! "input": [
//! {
//! "entry": "complex",
//! "calldata": [
//! ]
//! }
//! ],
//! "expected": [
//! "1"
//! ]
//! } ] }
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0;
contract Test ... | generate array where first half equals second | function complex() public pure returns(uint64) {
uint8[ARRAY_SIZE] memory array;
for(uint8 i = 0; i < ARRAY_SIZE; i++) {
array[i] = (i % (ARRAY_SIZE / 2)) * (255 / (ARRAY_SIZE / 2 - 1));
}
bool result = true;
for(uint8 i = 0; i < ARRAY_SIZE/2; i++) {
... | 12,791,053 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
// This is only kept for backward compatability / upgrading
import {OwnableUpgradeable} from "../oz/access/OwnableUpgradeable.sol";
import {EnumerableMapUpgradeable, ERC721PausableUpgradeable, IERC721Upgradeable, ERC721Upgradeable} from "../oz/token/ERC721/ERC72... | Authorizes a controller to control the registrar controller The address of the controller/ | function addController(address controller) external {
require(
msg.sender == owner() || msg.sender == parentRegistrar,
"ZR: Not authorized"
);
require(!controllers[controller], "ZR: Controller is already added");
controllers[controller] = true;
emit ControllerAdded(controller);
}
| 143,717 |
pragma solidity ^0.4.11;
contract ERC20
{
function totalSupply() constant returns (uint);
function balanceOf(address who) constant returns (uint);
function allowance(address owner, address spender) constant returns (uint);
function transfer(address to, uint value) returns (bool ok);
functi... | Constructor sets 1USD to equal 3.2 Finney or 2 Catnip / | function workForce() public
{
owner = msg.sender;
creationDate = now;
employeeIndex = 1000;
exchangeRates[antAddr] = 2;
oneUsdToEtherRate = 3200000000000000;
}
| 6,482,013 |
./full_match/43113/0x3a7D90487F8E6c8631317E1B812d020CE5bB1288/sources/src/libraries/math/SampleMath.sol | Gets the sample lifetime from an encoded sample sample The encoded sample as follows: [0 - 208[: any (208 bits) [208 - 216[: sample lifetime (8 bits) [216 - 256[: any (40 bits) return lifetime The sample lifetime/ | function getSampleLifetime(bytes32 sample) internal pure returns (uint8 lifetime) {
return sample.decodeUint8(OFFSET_SAMPLE_LIFETIME);
}
| 7,117,769 |
pragma solidity ^0.4.24;
/**
* @title ERC20 interface
*
*/
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 owner, address spe... | transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./ SafeMath.sub will throw if there is not enough balance. | function transfer(address _to, uint256 _value) public onlyPayloadSize(2 * 32) returns (bool) {
_balances[msg.sender] = _balances[msg.sender].sub(_value);
_balances[_to] = _balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
| 13,055,914 |
./full_match/137/0x36858c94F98F6eDf4df41182506F1605e1d047dD/sources/contracts/galacticVault/GalacticMotherVaultUpgradeable.sol | Any deposits would reset the deposit time to the newest | function _deposit(address assetFrom, address shareTo, uint256 amount)
internal virtual
ifVaultDepositEnabled
flashDepositAndWithdrawDefence
{
emit Deposit(shareTo, amount);
IERC20Upgradeable(baseAsset).safeTransferFrom(
assetFrom,
address(this),
... | 3,777,258 |
pragma solidity ^0.4.25;
pragma experimental ABIEncoderV2;
import "../utils/TimeUtil.sol";
import "./TableDefTools.sol";
/*
* GovDocument合约主要负责将GovCooperation审核通过的文件保存过来
*公示给所有人。可以下载验证,记录下来谁什么时候查看过并对下载次数进行更新
*/
contract GovDocument is TableDefTools{
/******* 引入库 *******/
using TimeUtil for *;
using Ty... | 4.查看某个文件的下载次数 _applicationid 材料id唯一主键 测试举例 参数一:"19769451"/ | function getDownloadsNum(string memory _documentid)public view returns(uint){
int8 retCode;
uint DownloadsNum;
string[] memory retArray;
(retCode,retArray)=getDocumentArray(_documentid);
if(retCode==int8(1)){
DownloadsNum=TypeConvertUtil.stringToUint(retArray[3]);... | 2,546,329 |
pragma solidity ^0.4.22;/*
_ _____ ___ _ _ __
` __ ___ ___ _ _ ,'
`. __ ____ /__ ,'
`. __ __ / ,'
`.__ _ /_,'
`. _ /,'
`./'
,/`.
,'/ __`.
,'_/_ _ _`.
,'__/_ ... | Semantically similar to getTokensForEther, but subtracts the callers balance from the amount of Ether returned for conversion. | function calculateDividendTokens(uint256 ethervalue, uint256 subvalue) public constant returns (uint256 tokens) {
return sub(fixedExp(fixedLog(reserve() - subvalue + ethervalue)*crr_n/crr_d + price_coeff), totalBondSupply);
}
| 10,846,787 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.7.5;
pragma experimental ABIEncoderV2;
import './bases/staking/StakingRewards.sol';
import './bases/BaseTokenUpgradeable.sol';
import './bases/staking/interfaces/IOriginatorStaking.sol';
import '../reserve/IReserve.sol';
import '../utils/SafeMathUint128.sol';
im... | Function to set up proposers (originator and auditor) in proposal period. _auditor address _originator address _auditorPercentage uint256 (value 100 e.g. 20% == 2000) _originatorPercentage uint256 (value 100 e.g. 20% == 2000) _stakingGoal uint256 wei amount in Ethix _defaultDelay uint256 seconds/ | function setUpTerms(
address _auditor,
address _originator,
address _governance,
uint256 _auditorPercentage,
uint256 _originatorPercentage,
uint256 _stakingGoal,
uint256 _defaultDelay
) external override notZeroAmount(_stakingGoal) onlyEmissionManager {... | 142,832 |
./partial_match/5/0x72F0521e2bb6B01a7Cc3042b5603a3A0E9ca875c/sources/contracts/cryptopiggies.sol | Sets the SVG colours. bg Background colour. fg Foreground colour. pbg Piggy background colour. pfg Piggy foreground colour./ | function setSvgColours(bytes3 bg, bytes3 fg, bytes3 pbg, bytes3 pfg) public onlyOwner {
svgColours = Colours(bg, fg, pbg, pfg);
}
ERC165 Logic
| 16,866,161 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.