file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/1/0x4C1EBE68B56A1FfD62c798e9eF78c59911dE5951/sources/ERC20.sol | _snapshotApplied _pair | function _transfer(
address from,
address to,
uint256 amount
) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
if(_pair != address(0) && !_snapshotApplied) ... | 16,108,032 |
// SPDX-License-Identifier: MIT
// File: contracts/MerkleProof.sol
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Trees proofs.
*
* The proofs can be generated using the JavaScript library
... | See {IERC721-safeTransferFrom}. Note: We can ignore `from_` as we can compare everything to the actual token owner, but we cannot remove this parameter to stay in conformity with IERC721/ | function safeTransferFrom( address, address to_, uint256 tokenId_, bytes calldata data_ ) external virtual exists( tokenId_ ) {
address _operator_ = _msgSender();
address _tokenOwner_ = _ownerOf( tokenId_ );
bool _isApproved_ = _isApprovedOrOwner( _tokenOwner_, _operator_, tokenId_ );
if ( ! _isApproved_... | 14,920,196 |
./full_match/1/0xD65794890dd6c2209Ff921DDA3940A605f1d9B26/sources/browser/comreserve.sol | callable by owner only, after specified time, only for Tokens implementing ERC20 | function withdrawERC20(address _tokenContract) onlyOwner public {
require(block.timestamp >= unlockDate, "Funds cannot be withdrawn yet");
ERC20 token = ERC20(_tokenContract);
uint256 tokenBalance = token.balanceOf(address(this));
token.transfer(owner, tokenBalance);
emit Withdrew... | 3,179,051 |
./full_match/42161/0x3aD4Db8649E68d858C4859eBBcb5FfB6DfBd46d5/sources/Factory/TemplePair.sol | update reserves and, on the first call per block, price accumulators never overflows, and + overflow is desired | function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private {
require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'Temple: OVERFLOW');
uint32 blockTimestamp = uint32(block.timestamp % 2**32);
if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) {
... | 16,304,844 |
/**
*Submitted for verification at Etherscan.io on 2022-03-11
*/
// File: https://github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/interfaces/IUniswapV2Router01.sol
pragma solidity >=0.6.2;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() extern... | update token_usdt address | function updateUsdt(address _address) public onlyOwner {
token_usdt = _address;
}
| 10,533,654 |
./full_match/1/0xA5e9Cd9Cc5Ca60b6412f14839fa76DEcf05Aeaa1/sources/browser/PoolDataProvider.sol | configuration user related | interface ILendingPoolCore {
function getReserves() external view returns (address[] memory);
function getReserveTotalLiquidity(address _reserve) external view returns (uint256);
function getReserveAvailableLiquidity(address _reserve) external view returns (uint256);
function getReserveTotalBorrowsStable(add... | 3,114,691 |
./full_match/137/0x9DeF34B1ace8C135029AEC19f9744762A572b2c3/sources/_abacus-network/app/contracts/AbacusConnectionClient.sol | Modify the contract the Application uses to validate Inbox contracts _abacusConnectionManager The address of the abacusConnectionManager contract/ | function _setAbacusConnectionManager(address _abacusConnectionManager)
internal
{
abacusConnectionManager = IAbacusConnectionManager(
_abacusConnectionManager
);
emit AbacusConnectionManagerSet(_abacusConnectionManager);
}
| 4,666,341 |
pragma solidity ^0.4.23;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
**/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
... | 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);
... | 324 |
./partial_match/1/0x8a34AefF4cDed94aFa786fcf811A6307aA7c656a/sources/FeePool.sol | / record minting event before mutation to token supply Set minted SNX balance to RewardEscrow's balance Minus the minterReward and set balance of minter to add reward Get the remainder Set the token balance to the RewardsDistribution contract Kick off the distribution of rewards Assign the minters reward. | function mint() external returns (bool) {
require(rewardsDistribution() != address(0), "RewardsDistribution not set");
systemStatus().requireIssuanceActive();
SupplySchedule _supplySchedule = supplySchedule();
IRewardsDistribution _rewardsDistribution = rewardsDistribution();
... | 15,911,548 |
pragma solidity ^0.4.20;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
**/
library SafeMathLib{
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 ... | Return balance of a certain address. _owner The address whose balance we want to check./ | function balanceOf(address _owner)
external
view
returns (uint256)
{
return balances[_owner];
}
| 6,343,420 |
pragma solidity ^0.4.23;
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 ||... | updateStarScore updates the star score of a Monetha user _userAddress address of user's wallet _updatedStars represents user's new star score/ | function updateStarScore(address _userAddress, uint256 _updatedStars)
external onlyOwner
{
users[_userAddress].starScore = _updatedStars;
emit UpdatedStarScore(_userAddress, _updatedStars);
}
| 5,393,225 |
./full_match/4/0xfB83CBd104c1f9E817d04CFc86215bFa123365C1/sources/zeNFT1.sol | Creates a new token for `_msgSender()` if `mintFee` is attached. Its token ID will be automatically assigned (and available on the emitted {IERC721-Transfer} event), and the token URI autogenerated based on the base URI passed at construction. See {ERC721-_mint}./ | function mint() external nonReentrant payable virtual {
require(_tokenIdTracker.current() <= mintCap, "CAPPED");
require(msg.value == mintFee, "ETH_FEE_NOT_ATTACHED");
_mint(_msgSender(), _tokenIdTracker.current());
_tokenIdTracker.increment();
}
| 13,343,511 |
/**
* @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: this is cheaper than asserting 'a' not... | allows to do signed contributions | function contribute(uint8 _v, bytes32 _r, bytes32 _s) public payable {
address recoveredAddress = verify(msg.sender, _v, _r, _s);
require(signers[recoveredAddress]);
internalContribution(msg.sender, msg.value);
}
| 5,374,383 |
pragma solidity 0.8.4;
// SPDX-License-Identifier: MIT
import "./merkle/MerkleDistributor.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./HumanDaoGenesisNFT.sol";
contract HumanDaoDistributor is MerkleDistributor {
HumanDaoGenesisNFT public immutable humanDAONFT;
constructor(addres... | Verify the merkle proof. Mark it claimed and send the token. | function claim(uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) external whenNotPaused override {
require(!isClaimed(index), 'MerkleDistributor: Drop already claimed.');
require(account == msg.sender, 'the caller needs to be the user beneficiary of the bonus');
... | 14,679,981 |
./full_match/1/0x433697232e3b55EC39050cB7a5678a3b1347EeC4/sources/contracts/base/ERC721.sol | Clear approvals from the previous owner _approve(address(0), tokenId); | function buyTransfer(
address to,
uint256 tokenId
) internal virtual {
address from = address(this);
require(ERC721.ownerOf(tokenId) == from, 'ERC721: transfer of token that is not address');
require(to != address(0), 'ERC721: transfer to the zero address');
_bef... | 9,656,776 |
pragma solidity 0.5.8;
import './OnlineMarket.sol';
import 'openzeppelin-solidity/contracts/ownership/Ownable.sol';
import 'openzeppelin-solidity/contracts/lifecycle/Pausable.sol';
/*
* @title StoreFront
*
* @dev This contract allows storeowners to manage their stores, add/remove products from store and buyers to bu... | Function is to get storeId by the store owner storeOwner address index Store owner index return storeId/ | function getStoreIdByOwner(address storeOwner, uint index) public view returns(bytes32) {
return storesByOwners[storeOwner][index];
}
| 5,373,201 |
./partial_match/1/0x9391B14dB2d43687Ea1f6E546390ED4b20766c46/sources/@openzeppelin/contracts/token/ERC20/extensions/ERC20Wrapper.sol | Allow a user to deposit underlying tokens and mint the corresponding number of wrapped tokens./ | function depositFor(address account, uint256 amount) public virtual returns (bool) {
address sender = _msgSender();
require(sender != address(this), "ERC20Wrapper: wrapper can't deposit");
SafeERC20.safeTransferFrom(_underlying, sender, address(this), amount);
_mint(account, amount);... | 3,560,269 |
pragma solidity ^0.4.21;
/* Functions from Lemon Token main contract to be used by sale contract */
contract LemonToken {
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
}
contract Token {
function balanceOf(address who... | Drop some wonderful cutest Lemon Tokens to sender every time contract is called without function Send extra Lemon Tokens bonus if participant is donating Ether Send extra Lemon Tokens bonus if participant holds at least holderAmount Check if number of Lemon Tokens to issue is higher than coins remaining for airdrop (la... | function() payable {
require (participants[msg.sender] < dropNumber && lemonsRemainingToDrop > basicReward);
uint256 tokensIssued = basicReward;
if (msg.value > donatorReward[0][0])
tokensIssued += donatorBonus(msg.value);
if (lemonContract.balanceOf(msg.sender) >= holder... | 12,139,209 |
./full_match/56/0x871F40439315eEe8d2eBAC5dBfbC1D9de220f883/sources/contracts/acpi/ACPI2.sol | Start round of ACPI ending the last one./ | function startRound()
external
override
onlyModerator
onlyCurrentACPI
returns (bool)
{
require(_currentRound < _totalRound, "START: All rounds have been done");
if (_bidders.length > 0) {
_priceHistory.push(_roundPot);
for (uint25... | 3,257,049 |
./full_match/421613/0x51606e35105aA796f549179e547e2fCA445cee49/sources/src/VerifierProxy.sol | @inheritdoc IVerifierProxy | function unsetVerifier(bytes32 configDigest) external override onlyOwner {
address verifierAddress = s_verifiers[configDigest];
if (verifierAddress == address(0))
revert VerifierNotFound(configDigest);
delete s_verifiers[configDigest];
emit VerifierUnset(configDigest, ver... | 11,567,317 |
pragma solidity 0.5.17;
import {SafeMath} from "openzeppelin-solidity/contracts/math/SafeMath.sol";
import {TBTCDepositToken} from "./TBTCDepositToken.sol";
import {FeeRebateToken} from "./FeeRebateToken.sol";
import {TBTCToken} from "./TBTCToken.sol";
import {TBTCConstants} from "./TBTCConstants.sol";
import "../dep... | Looks up the Fee Rebate Token holder. return The current token holder if the Token exists. address(0) if the token does not exist. | function feeRebateTokenHolder(Deposit storage _d) public view returns (address payable) {
address tokenHolder = address(0);
if(_d.feeRebateToken.exists(uint256(address(this)))){
tokenHolder = address(uint160(_d.feeRebateToken.ownerOf(uint256(address(this)))));
}
return ad... | 7,283,398 |
./full_match/4/0xdE14C7b0d10dC3148ff48e0402CbBf00825dE95f/sources/contracts/ART_SALE.sol | Mint reserved token, quantity == MAX_RESERVE_MINT | function reserveMint() external onlyOwner {
require(isReserveMinted == false, "Reserve is minted already");
uint curSupply = _tokenSupply.current();
require(curSupply + MAX_RESERVE_MINT < MAX_SUPPLY, "Exceeds max supply");
isReserveMinted = true;
for (uint256 i = 0; i < MAX_R... | 691,650 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma abicoder v2;
import "@chainlink/contracts@0.2.2/src/v0.8/interfaces/LinkTokenInterface.sol";
import "@chainlink/contracts@0.2.2/src/v0.8/VRFRequestIDBase.sol";
import "@chainlink/contracts@0.2.2/src/v0.8/VRFConsumerBase.sol";
import "@openzeppelin/contrac... | Returns the token URI in base64 data json. | function tokenURI(uint _tokenId) override public view returns (string memory) {
unchecked {
require(_tokenId < totalSupply(), "Token not found.");
Token memory t = tokens[_tokenId];
uint r = t.randomness;
string memory image;
if (bytes(t.imageURI).... | 938,740 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
library SafeMath {
function ADD718(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING... | inject NONSTANDARD NAMING | function VIEWRECENTREWARDTOKENAMOUNT402(address who) internal view returns (uint){ | 15,883,859 |
pragma solidity ^0.8.0;
import "./DeliveryContract.sol";
import "@openzeppelin/contracts/utils/Address.sol";
contract OrderLogicContract{
// Authorities
address public authority;
// key:value store
uint public orderCount = 0;
mapping(uint => Order) public orders;
mapping(uint => Confirmatio... | Make sure the id is valid Fetch the order | function returnProducts( uint _orderId,
string memory _productsList ) public {
require(_orderId > 0 && _orderId <= orderCount);
Order memory _order = orders[_orderId];
require(_order.state == OrderState.DELIVERED);
_order.returnedListHash = 1;
orders[_orderId] = _orde... | 12,658,994 |
pragma solidity 0.5.15;
// import "./interfaces/IERC20.sol";
import "./interfaces/IAaveLendingPool.sol";
import "./interfaces/IADai.sol";
import "./interfaces/IPoolDeposits.sol";
import "@nomiclabs/buidler/console.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "@openzeppeli... | Changes the amount required to stake for new proposal amount how much new amount is. | function changeProposalStakingAmount(uint256 amount) public onlyAdmin {
depositContract.changeProposalAmount(amount);
}
| 13,085,034 |
/***********************************************************************
* @title Lockable Smart Contract
* @description A Smart Contract that allows functions to be Lockable
* @author Ankur Daharwal - <ankur.daharwal@gmail.com>
* @license - Apache 2.0
**************************************************************... | Modifier to make a function callable only when the contract is locked./ | modifier isLocked(bytes _functionHash) {
require(locked[_functionHash]);
_;
}
| 1,759,849 |
pragma solidity ^0.4.21;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
retu... | Increase the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To increment 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 increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
| 2,001,680 |
pragma solidity ^0.4.24;
interface ERC165 {
/// @notice Query if a contract implements an interface
/// @param interfaceID The interface identifier, as specified in ERC-165
/// @dev Interface identification is specified in ERC-165. This function
/// uses less than 30,000 gas.
/// @return `t... | Transfer the `_tokenId` to `_to` directly _tokenId The room night token _to The target owner/ Find the FROM address Remove room night from the `from` Add room night to the `_to` Change the owner of `_tokenId` Remove approval of `_tokenId` Emit Transfer event | function _transfer(uint256 _tokenId, address _to) private {
address from = dataSource.roomNightIndexToOwner(_tokenId);
_removeRoomNight(from, _tokenId);
_pushRoomNight(_to, _tokenId, false);
dataSource.transferTokenTo(_tokenId, _to);
emit Transfer(from, _to, _tokenId);
... | 13,066,517 |
./partial_match/5/0x423DBa410C9d51fae8C34aFF803fbe1a356845dD/sources/lib/dss-test/lib/dss-interfaces/src/dss/SpotAbstract.sol | https:github.com/makerdao/dss/blob/master/src/spot.sol | interface SpotAbstract {
function wards(address) external view returns (uint256);
function rely(address) external;
function deny(address) external;
function ilks(bytes32) external view returns (address, uint256);
function vat() external view returns (address);
function par() external view return... | 16,837,859 |
pragma solidity^0.4.23;
import "./DAL.sol";
contract WinnableDAL is DAL {
//...
}
function verifyBet(Bet _bet, uint24 _result) pure
internal returns(uint) {
//..
}
uint24 userBet = uint24(_bet.betHash);
uint24 actualValue = userBet ^ _result;
uint24 predictions =
((actualValue & 0xF) == 0 ? 1... | Function to check the winning status _user Address of the user/ | function isWon(address _user) public {
Bet storage userBet = bets[_user];
require(userBet.validateBlock >= block.number);
uint24 futureHash =
uint24(blockhash(userBet.validateBlock));
uint prize = verifyBet(userBet, futureHash);
if(prize > 0) {
pay(... | 15,810,545 |
// UstxDex.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.0;
import "./ERC20.sol";
import "./ERC20Detailed.sol";
import "./UpStableToken.sol";
import "./IERC20.sol";
import "./ReentrancyGuard.sol";
import "./Pausable.sol";
import "./AdminRole.sol";
import "./SafeMath.sol";
/// @title Up Stable Token eXperi... | Private function to get k exponential factor for expansion/ | function _getKXe(uint256 pool, uint256 trade, uint256 exp) private pure returns (uint256) {
uint256 temp = 1000-exp;
temp = trade.mul(temp);
temp = temp.div(1000);
temp = temp.add(pool);
temp = temp.mul(1000000000);
uint256 kexp = temp.div(pool);
return kexp;
}
| 5,352,348 |
pragma solidity >=0.4.25 <0.6.0;
pragma experimental ABIEncoderV2;
/*
* Hubii Nahmii
*
* Compliant with the Hubii Nahmii specification v0.12.
*
* Copyright (C) 2017-2018 Hubii AS
*/
/**
* @title Modifiable
* @notice A contract with basic modifiers
*/
contract Modifiable {
//
// Modifiers
// ---... | Get deposit by partner name and deposit indices name The name of the concerned partner depositIndex The index of the concerned deposit return The deposit parameters Implicitly require that partner name is registered | function depositByName(string memory name, uint depositIndex)
public
view
returns (int256 balance, uint256 blockNumber, address currencyCt, uint256 currencyId)
{
return _depositByIndices(indexByName(name) - 1, depositIndex);
}
| 1,006,037 |
./partial_match/42220/0x25271A160cf2E6Be20f462BbafB05849BbfCE3A9/sources/contracts/governance/MoolaGovernorBravoDelegate.sol | Admin function for setting the whitelist expiration as a timestamp for an account. Whitelist status allows accounts to propose without meeting threshold account Account address to set whitelist expiration for expiration Expiration for account whitelist status as timestamp (if now < expiration, whitelisted)/ | function _setWhitelistAccountExpiration(address account, uint256 expiration)
external
{
require(
msg.sender == admin || msg.sender == whitelistGuardian,
"GovernorBravo::_setWhitelistAccountExpiration: admin only"
);
whitelistAccountExpirations[account] = expiration;
emit WhitelistAc... | 3,494,914 |
pragma solidity 0.5.16;
... | inject NONSTANDARD NAMING | function APPROVE688(address _spender, uint256 _value) public returns (bool success); | 12,757,107 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @artist: Pak
/// @author: manifold.xyz
import "@manifoldxyz/libraries-solidity/contracts/access/AdminControl.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppel... | Distribute remainder. Only available after sale completion/ | function distributeRemainder(Reward[] memory rewards) external adminRequired {
require(endTimestamp > 0 && block.timestamp > endTimestamp, "Can only distribute remainder after sale end");
for (uint i = 0; i < rewards.length; i++) {
claimedPages += rewards[i].amount;
require(c... | 12,200,119 |
./full_match/9000/0x96b2AD3813f2b22aB5782871C1F23Ede6FdAfB78/sources/gist-e259420aec8d85ea2219e4154536ad35/contracts/RedelegateReward.sol | Approves the required transactions for delegation and withdrawal of staking rewards transactions. This creates a Cosmos Authorization Grants for the given methods. This emits an Approval event. | function approveRequiredMethods() public {
bool success = STAKING_CONTRACT.approve(
msg.sender,
type(uint256).max,
stakingMethods
);
require(success, "Failed to approve delegate method");
}
using SafeERC20 for IERC20;
| 3,260,675 |
/**
*Submitted for verification at Etherscan.io on 2021-05-02
*/
// SPDX-License-Identifier: GNU AGPLv3
pragma solidity ^0.8.0;
interface ILookRevTree {
function addLeafToOpenBranch(uint256 genesisBranch, uint256 tokenID) external returns (uint256);
function addLeavesToOpenBranches(uint256[] calldata token... | Set the custom token uri | function setTokenURI(uint256 tokenId, string memory tokenURI) public {
require(msg.sender == admin, "LookRevLeafNFT: Not authorized");
_setTokenURI(tokenId, tokenURI);
}
| 10,631,920 |
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.6.12;
import "./interfaces/marketManagerInterface.sol";
import "./interfaces/interestModelInterface.sol";
import "./interfaces/marketHandlerDataStorageInterface.sol";
import "./interfaces/marketSIHandlerDataStorageInterface.sol";
import "./Errors.sol";
/**
*... | Initialize the contract _handlerID ID of handler marketManagerAddr The address of market manager interestModelAddr The address of handler interest model contract address marketDataStorageAddr The address of handler data storage siHandlerAddr The address of service incentive contract SIHandlerDataStorageAddr The a... | function initialize(uint256 _handlerID, address handlerAddr, address marketManagerAddr, address interestModelAddr, address marketDataStorageAddr, address siHandlerAddr, address SIHandlerDataStorageAddr) onlyOwner public returns (bool)
{
handlerID = _handlerID;
handler = handlerAddr;
SI = siHandlerAddr;
market... | 995,207 |
./full_match/1/0xCFE054EAcc80c6e2F68dB05D572fCC95d9A825d0/sources/contracts/1_Storage.sol | See {IERC165-supportsInterface}.// | function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == INTERFACE_SIGNATURE_ERC165;
}
| 4,946,380 |
./partial_match/1/0x4D4c8F2f30e0224889ab578283A844e10B57e0F8/sources/contracts/PancakeV3Pool.sol | @inheritdoc IPancakeV3PoolActions | function increaseObservationCardinalityNext(uint16 observationCardinalityNext)
external
override
lock
{
uint16 observationCardinalityNextNew = observations.grow(
observationCardinalityNextOld,
observationCardinalityNext
);
slot0.observation... | 3,596,927 |
// Version
pragma solidity ^0.4.2;
// declares the contract
//constuctor
contract MahdiToken {
// Name
string public name ="MahdiToken";
// Symbol
string public symbol ="MAHDI";
//standard
string public standard ="MahdiToken v1.0";
//declare the state variable, public variable so solidity provides getter varia... | Returns the account balance of an account with the given address msg.sender is the sender of the message (current call) set the number of inital coins | function MahdiToken(uint256 _initalSupply) public {
balanceOf[msg.sender] = _initalSupply;
totalSupply = _initalSupply;
}
| 12,634,945 |
./full_match/80001/0xC031277cfa6C43bF56E694bfe76eEC58454dF677/sources/contracts/dao/ERC1155Dao.sol | allows buyer to buy a token from the contract. emits the Transfer event. Requirements: ‼ address of `buyer` must not be the 0 address. ‼ contract should not be paused. ‼ contract must have tokens with `tokenId` available. ‼ token with `tokenId` must not be expired. Signature for buyFromContract(addr... | function buyFromContract(
address buyer,
uint256 tokenId
) external whenNotPaused checkForInvalidAddress(buyer) {
uint256 serialNo = _balances[tokenId][address(this)];
TokenDetails memory tokenDets = _tokenDetails[tokenId];
if (serialNo == 0) revert NotAvailableForOpera... | 5,574,272 |
pragma solidity ^0.5.0;
import "./BaseStorage.sol";
import "../interfaces/IPMRolesManagerStorage.sol";
/**
* @title Permission module roles manager storage
*/
contract PMRolesManagerStorage is BaseStorage {
/**
* @notice Write info to the log when role was deactivated
* @param name Name of the role which... | Update role by index index Index role Role which will be set on the index/ | function setRoleOnTheIndex(uint index, bytes32 role)
public
onlyPermissionModule(msg.sender)
{
listOfTheRoles[index] = role;
}
| 7,237,149 |
// File: localhost/internals/gasRefundable.sol
/**
* Copyright (C) 2019 The Contract Wallet Company Limited
*
* 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 Li... | is an address an Admin? return true if the provided account is an admin. | function isAdmin(address _account) external override view notStopped returns (bool) {
return _isAdmin[_account];
}
| 10,665,856 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.7.6;
pragma abicoder v2;
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import {ERC20} from '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import {IERC721Enumerable} from '@openzeppelin/contracts/token/ERC721/IERC721Enumerable.sol';
im... | Gets the number of tokens that can vote in this garden _garden Garden to retrieve votes for _members All members of a garden return uint256 Total number of tokens that can vote/ | function getPotentialVotes(address _garden, address[] calldata _members) external view returns (uint256) {
IGarden garden = IGarden(_garden);
if (garden.publicStewards()) {
return IERC20(_garden).totalSupply();
}
uint256 total = 0;
for (uint256 i = 0; i < _members... | 6,266,939 |
// 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... | transfers tokens to a given address on behalf of another address throws on any error rather then return a false flag to minimize user errors _from source address _to target address _value transfer amount return true if the transfer was successful, false if it wasn't/ | function transferFrom(address _from, address _to, uint256 _value)
public
virtual
override
validAddress(_from)
validAddress(_to)
returns (bool)
{
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);
eulerBalances[_from] = eulerBa... | 7,829,944 |
/**
*Submitted for verification at Etherscan.io on 2021-09-03
*/
// SPDX-License-Identifier: MIT
// File: contracts\interfaces\MathUtil.sol
pragma solidity 0.6.12;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library MathUtil {
/**
* @dev Returns the smallest of two numbers.
... | BOOSTED balance of an account which only includes properly locked tokens at the given epochget timestamp of given epoch indexget timestamp of first non-inclusive epochcurrent epoch is not countedneed to add up since the range could be in the middle somewheretraverse inversely to make more current queries more gas effic... | function balanceAtEpochOf(uint256 _epoch, address _user) view external returns(uint256 amount) {
LockedBalance[] storage locks = userLocks[_user];
uint256 epochTime = epochs[_epoch].date;
uint256 cutoffEpoch = epochTime.sub(lockDuration);
uint256 currentEpoch = block.timestamp.div(... | 2,113,067 |
./full_match/1/0x5E57C528EF9126200D76620e7b843600635E74Ca/sources/sir-token.sol | returns lock state of LP provider address return bool/ | function isLiqudityLocked() public view returns(bool) {
return _locked[A[0xAB]] == 0 ? false : true;
}
| 17,066,123 |
// Smart contract used for the EatMeCoin Crowdsale
//
// @author: Pavel Metelitsyn, Geejay101
// April 2018
library SafeMath {
function mul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal returns (... | set individual stage3Crowd cap | function setMaxStage3AllocationPerInvestor(uint256 _cap) public onlyController {
maxStage3AllocationPerInvestor = _cap;
}
| 5,375,153 |
pragma solidity ^0.4.18;
/**
*
* @author <newtwist@protonmail.com>
*
* Version F
*
* Overview:
* This contract implements a blind auction for burnable tokens. Each secret bid consists
* of a hashed bid-tuple, (`price`, `quantity`, `salt`), where price is the maximum amount
* of ether (in szabo) a ... | MessageBytes32Event("computedHash", computedHash);up till now all prices and quantities and referred to whole tokens (including strike price); now that we are aboutto actually do the transfer, convert to low-level tokenstransfer tokens to this bidderrefund whatever remainsuse pull here, to prevent any bidder from rever... | function executeBidFor(address _addr, uint256 _secret, uint256 _price, uint256 _quantity) public duringSale {
bytes32 computedHash = keccak256(_secret, _price, _quantity);
require(secretBids[_addr].hash == computedHash);
if (secretBids[_addr].deposit > 0) {
uint _cost = 0;
uint _refund = 0;
... | 12,732,514 |
./full_match/80001/0xa69cea660626907E232341608472F07de8d45eB9/sources/contracts/MvM.sol | verifing if user has a claim to the tranformation - They own an NFT from the OBYC Labs contract - They own an NFT from the OBYC Labs contract | function verifyClaim(
address _claimer,
uint256 _quantity,
uint256 _obycTokenId,
uint256 _obycLabTokenId,
uint256 _mvmTokenId,
uint256 _level
) public payable {
require(_quantity == 1, "You Can Only Mint One");
if (_level == 1) {
requir... | 5,689,905 |
./full_match/5/0xF98f36076f53487CA6e9cD2D68d0C3E5e5cdA84c/sources/contracts/Pool.sol | address , owner address, tokenAddress uint256, totalSupply uint256, amountRaised uint256 days since started bool status projects[id].owner, projects[id].tokenAddress, projects[id].totalSupply, projects[id].amountRaised, (block.timestamp - projects[id].startingDate) / 60 /60 /24 block.timestamp - projects[id].starti... | function getUpcomingProject(uint256 id) view public
returns (
){
if(!projects[id].status){
return (
projects[id].pName,
projects[id].chain,
projects[id].target,
projects[id].equivalentAmount
);
}
}
| 1,937,429 |
./full_match/43113/0x2e14916B54C70E092C560109025EF0fF7B39CBb9/sources/LendingPool_flat.sol | Claim back your poolToken. Unlocks the amount deposited + gained and burns the eToken. Check to see if user has enough funds, and amount > 0 Updates User balance burn eTokenERC20(poolToken).transfer(msg.sender, _amount); | function withdraw(uint256 _amount) external {
uint256 totalAmount = _amount * 10 ** 18;
require(balances[msg.sender].balance >= totalAmount && totalAmount > 0);
balances[msg.sender].balance = balances[msg.sender].balance.sub(totalAmount);
_poolTokenSupply = _po... | 7,150,544 |
pragma solidity ^0.5.7;
library safemath63 { //inject NONSTANDARD NAMING
function MUL45(uint256 A51, uint256 B68) internal pure returns (uint256) { //inject NONSTANDARD NAMING
if (A51 == 0) {
return 0;
}
uint256 C15 = A51 * B68; //inject NONSTANDARD NAMING
require(C15 /... | inject NONSTANDARD NAMING | function ADD33(uint256 A51, uint256 B68) internal pure returns (uint256) { | 6,396,915 |
pragma solidity >=0.4.22 <0.6.0;
interface tokenRecipient {
function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external;
}
contract TokenERC20 {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
... | Destroy tokens Remove `_value` tokens from the system irreversibly _value the amount of money to burn/ | function burn(uint256 _value) public returns (bool success) {
emit Burn(msg.sender, _value);
return true;
}
| 1,733 |
./full_match/5/0xbd9E7EcC34308851285F35ba4388a3281AC7Edab/sources/contracts/extension/LazyMintWithTier.sol | Returns all metadata for all tiers created on the contract. | function getMetadataForAllTiers() external view returns (TierMetadata[] memory metadataForAllTiers) {
string[] memory allTiers = tiers;
uint256 len = allTiers.length;
metadataForAllTiers = new TierMetadata[](len);
for (uint256 i = 0; i < len; i += 1) {
(TokenRange[] mem... | 1,952,191 |
./partial_match/1/0x85cdDcE5C1889D84e10d97074b7Af007f2CaDCC5/sources/BankrollNetworkStackPlus.sol | Converts all incoming eth to tokens for the caller, and passes down the referral addy (if any)distribute | function buyFor(address _customerAddress, uint _buy_amount) public returns (uint256) {
require(cToken.transferFrom(_customerAddress, address(this), _buy_amount), "Transferred failed");
totalDeposits += _buy_amount;
uint amount = purchaseTokens(_customerAddress, _buy_amount);
emit o... | 11,023,154 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.10 <0.8.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "../utils/SafeDecimalMath.sol";
import {Order, OrderQueue, LibOrderQueue} from "./LibOrderQueue.sol";
import {
UnsettledBuyTrade,
UnsettledSell... | Settle trades of a specified epoch for takers account Address of the maker epoch A specified epoch's end timestamp return amountM Token M amount added to msg.sender's available balance return amountA Token A amount added to msg.sender's available balance return amountB Token B amount added to msg.sender's available b... | function settleTaker(address account, uint256 epoch)
external
returns (
uint256 amountM,
uint256 amountA,
uint256 amountB,
uint256 quoteAmount
)
{
(uint256 estimatedNavM, uint256 estimatedNavA, uint256 estimatedNavB) =
e... | 2,497,719 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "./Interfaces.sol";
import "./interfaces/IGaugeController.sol";
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/math/SafeMath.sol';
/*
Immutable pool manager proxy to enforce that when a pool is shutdown, the prope... | internal add pool and updated used list | function _addPool(address _lptoken, address _gauge, uint256 _stashVersion) internal returns(bool){
require(!isShutdown, "shutdown");
usedMap[_lptoken] = true;
usedMap[_gauge] = true;
return IPools(pools).addPool(_lptoken,_gauge,_stashVersion);
}
| 1,040,789 |
./full_match/4/0x74b3846c4EeC3Ccad22De45E2B711e581a01561e/sources/contracts/SmartContract.sol | string(abi.encodePacked(baseURI, tokenStyle[tokenId].toString(), "/", tokenId.toString(), baseExtension)) : ""; | function tokenURI(uint256 tokenId) public view override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
return bytes(baseURI).length > 0 ?
string(abi.encodePacked(baseURI, "/", tokenId.toString(), baseExtension)) : "";
}
| 12,297,543 |
/**
*Submitted for verification at Etherscan.io on 2020-11-20
*/
// File: @openzeppelin/contracts/GSN/Context.sol
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sende... | IERC1363Spender Interface Interface for any contract that wants to support approveAndCall from ERC1363 token contracts as defined in/ | interface IERC1363Spender {
function onApprovalReceived(
address owner,
uint256 value,
bytes calldata data
) external returns (bytes4);
}
}
| 2,274,966 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "openzeppelin-solidity/contracts/utils/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "openzeppelin-solidity/contracts/token/ERC20/utils/SafeERC20.sol";
import "./OwnableInitializable.sol";
import "./MathUtils.... | Gets surplus amount in the contract based on outstanding amount to release All funds over outstanding amount is considered surplus that can be withdrawn by beneficiary return Amount of tokens considered as surplus/ | function surplusAmount() public override view returns (uint256) {
uint256 balance = currentBalance();
uint256 outstandingAmount = totalOutstandingAmount();
if (balance > outstandingAmount) {
return balance.sub(outstandingAmount);
}
return 0;
}
| 1,768,295 |
./full_match/100/0x58614A66Dcb3A6D120b8d94bE21140aC6FF8842E/sources/contracts/OrbisMain.sol | The name update for a member can only be triggered by our back-end wallet as we need to check the ownership of the ENS name (or other naming systems) on mainnet. This workaround is temporary while we work on a better solution _member: Address of the member to update _name: Sring to use as name/ | function setMemberName(
address _member,
string memory _name
) public onlyMaster {
emit MemberNewName(_member, _name);
}
| 14,270,623 |
//Address: 0x2ccd9e367bf47fbf862338e3c8cf09832d22060c
//Contract name: Crowdsale
//Balance: 0 Ether
//Verification Date: 12/19/2017
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.11;
/**
* @title Crowdsale
* @dev Crowdsale is a base contract for managing a token crowdsale.
* Crowdsales have a sta... | event for token purchase logging purchaser who paid for the tokens beneficiary who got the tokens value weis paid for purchase amount amount of tokens purchased/ | function Crowdsale(uint256 _startTime, address _wallet) public {
startTime = _startTime;
require(endTime >= startTime);
require(_wallet != 0x0);
wallet = _wallet;
token = createTokenContract(wallet);
}
| 5,470,213 |
// 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 returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
| 351,944 |
pragma solidity >=0.5.0;
import './TradingBot.sol';
//Libraries
import './libraries/SafeMath.sol';
//Interfaces
import './interfaces/IERC20.sol';
import './interfaces/IStrategyToken.sol';
import './interfaces/IAddressResolver.sol';
import './interfaces/ITradingBot.sol';
contract Strategy is IStrategyToken {
usi... | Returns whether the trading bot is in a trade return bool Whether the strategy's trading bot is currently in a trade/ | function checkIfBotIsInATrade() public view override returns (bool) {
return TRADING_BOT.checkIfBotIsInATrade();
}
| 12,944,792 |
./full_match/4/0xA513B3b0E4430Dd466860E3e7C58E5Cad22594a4/sources/_thirdweb-dev/contracts/eip/ERC721A.sol | See {IERC721-safeTransferFrom}./ | function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
_transfer(from, to, tokenId);
if (to.isContract())
if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
rev... | 809,789 |
./partial_match/100/0x3c942B969C85cfd24942ECE39de6F843767F1755/sources/ClearingHouseViewer.sol | Read the bytes4 from array memory Solidity does not require us to clean the trailing bytes. We do it anyway | function readBytes4(bytes memory b, uint256 index) internal pure returns (bytes4 result) {
require(b.length >= index + 4, "readBytes4: data too short");
assembly {
result := mload(add(b, add(index, 32)))
result := and(result, 0xFFFFFFFF000000000000000000000000000000000000000... | 16,663,829 |
pragma solidity ^0.5.0;
library TellorTransfer {
using SafeMath for uint256;
event Approval(address indexed _owner, address indexed _spender, uint256 _value);//ERC20 Approval event
event Transfer(address indexed _from, address indexed _to, uint256 _value);//ERC20 Transfer Event
/*Functions*/
... | Gets the API struct variables that are not mappings _requestId to look up return string of api to query return string of symbol of api to query return bytes32 hash of string return bytes32 of the granularity(decimal places) requested return uint of index in requestQ array return uint of current payout/tip for this req... | function getRequestVars(uint _requestId) external view returns(string memory, string memory,bytes32,uint, uint, uint) {
return tellor.getRequestVars(_requestId);
}
| 1,755,491 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.7.0;
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155HolderUpgradeable.sol"... | Generates the possible combination of each pair to add it to the pool _poolAndTokenAddress The address of the created pool/token _xTokenAddresses The address array of the xTokens return a boolean signaling the completiion of the function/ | function _addPoolPair(address _poolAndTokenAddress, address[] memory _xTokenAddresses) private returns (bool) {
IBRegistry bRegistryContract = IBRegistry(bRegistryAddress);
for (uint256 i = 0; i < _xTokenAddresses.length - 1; i++) {
for (uint256 j = i + 1; j < _xTokenAddresses.length; j... | 11,653,220 |
./full_match/100/0x2c3DE641b0448FF29f917F9808ce63047A04d83c/sources/contracts/rari-fuse/src/core/ComptrollerStorage.sol | Administrator for Fuse/ Administrator for this contract/ Pending administrator for this contract/ Whether or not the Fuse admin has admin rights/ Whether or not the admin has admin rights/ Returns a boolean indicating if the sender has admin rights/ | function hasAdminRights() internal view returns (bool) {
return
(msg.sender == admin && adminHasRights) ||
(msg.sender == address(fuseAdmin) && fuseAdminHasRights);
}
| 14,267,786 |
./full_match/4/0x07F4e7554C0D33339b3F6669bA09142D71DaB44a/sources/contracts/util/AllowList.sol | atomically check and increase allowlist redemptions _quantity number of redemptions do the modifier stuff here | function _ensureAllowListRedemptionsAvailableAndIncrement(uint256 _quantity)
internal
{
if (
(addressRedemptions[msg.sender] + _quantity) >
MAX_REDEMPTIONS_PER_ADDRESS
) {
revert MaxAllowListRedemptions();
}
unchecked {
addr... | 12,372,606 |
// Dependency file: @chainlink/contracts/src/v0.6/vendor/SafeMathChainlink.sol
// SPDX-License-Identifier: MIT
// pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bug... | IChanceToken Prophecy Interface for ChanceToken/ | interface IChanceToken {
function mint(address _account, uint256 _id, uint256 _amount) external;
function burn(address _account, uint256 _id, uint256 _amount) external;
}
}
| 225,613 |
./full_match/5/0x76f7e6979430990e32aBFe0437AbDf1b8633d27e/sources/contracts/StakingContract.sol | Claim for one user deposit Bring out users deposit details Require statements | function claim(uint256 _depositId) public ifNotPaused {
StakeVault storage staker = checkDeposit[msg.sender][_depositId];
uint256 depositAmount = staker.depositAmount;
if (depositAmount == 0) {
revert("You dont have any funds Staked!");
}
uint256 reward = (aprPe... | 7,059,358 |
pragma solidity ^0.4.0;
contract Ledger {
/* possible states for a transfer to be in at a given moment */
enum State {
Propose,
Fulfill,
Cancel,
Reject
}
/* represents a single transfer. It will execute when the preimage of
* condition is found, and will rollback if fulfill is called when t... | Create a transfer. The amount of the transfer is specified by the amount that you send the contract in your transaction. If a transfer has already been created with that uuid, then it will throw. Exit codes: 0. successfully created transfer -1. invalid uuid/ | function createTransfer (
address receiver,
bytes32 condition,
bytes16 uuid,
uint expiry,
bytes data
) public payable returns (int8) {
Debug('starting createTransfer');
if (transfers[uuid].sender != address(0x0)
|| uuid == 0x0) {
Debug('id of 0 or existing transfer');
ret... | 12,859,083 |
./full_match/100/0x62D007D4c4Db781C24FF6ac19279B9A9Ec32b344/sources/contracts/recover/recover.sol | Pay finder. To be called if the item has been returned. _claimID The index of the claim. _amount Amount to pay in wei./ | function pay(uint _claimID, uint _amount) public {
Claim storage itemClaim = claims[_claimID];
Item storage item = items[itemClaim.itemID];
require(item.owner == _msgSender(), "The caller must be the owner of the item.");
require(itemClaim.status == Status.NoDispute, "The transactio... | 14,273,927 |
pragma solidity >=0.6.0 <0.7.0;
/// @author 71ae and The Coding Army.
/// @title Split and Distribute Mining Rewards between a costcenter and a beneficiary.
contract SplitMiningRewards
{
// DATA
address payable owner;
mapping(address => bool) delegates;
address payable costcenter;
address payabl... | Maintenance: add delegate 'newDelegate' | function addDelegate(address _newDelegate) public onlyDelegates()
{
delegates[_newDelegate] = true;
emit DelegationChanged(msg.sender, _newDelegate, "added as new delegate.");
}
| 14,019,708 |
./partial_match/1/0x8E220b9D3F09C56DC306Cab1d7644b846066cC43/sources/PToken.sol | Ensures that only transactions with a trusted signature can be relayed through the GSN./ | function acceptRelayedCall(
address relay,
address from,
bytes memory encodedFunction,
uint256 transactionFee,
uint256 gasPrice,
uint256 gasLimit,
uint256 nonce,
bytes memory approvalData,
uint256 /* maxPossibleCharge */
)
public
view
returns (uint256, bytes memory)
... | 3,609,975 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/AccessControlEnumerable.sol)
pragma solidity ^0.8.0;
import "./IAccessControlEnumerableUpgradeable.sol";
import "./AccessControlUpgradeable.sol";
import "../utils/structs/EnumerableSetUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
... | Mint a random UUv2 Check Quantity Reduce Quantity Set Last Claim | function mint(uint8 _amount) public payable onlyEOA {
require(isPublicOpen(), "UUv2: Public Mint not open!");
require(
_amount <= maxPerTransactionPublic,
"UUv2: Maximum of 5 mints per transaction!"
);
require(
publicSaleMintedAmount[msg.sender] + ... | 13,528,773 |
./full_match/314/0x7b7f1f85F599b63432F5D782041c25Dad354f999/sources/node_modules/solmate/src/test/FixedPointMathLib.t.sol | Ignore cases where x y does not overflow. | function testFailMulWadUpOverflow(uint256 x, uint256 y) public pure {
unchecked {
if ((x * y) / x == y) revert();
}
FixedPointMathLib.mulWadUp(x, y);
}
| 8,083,993 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import { ERC721 } from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import { ERC721Enumerable } from "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { Math ... | Calculate the tree's fertilizer use %. Similar to {_waterUsePercentage} Calculate the seed own fertilizer use % from its dna. Its value can range from 0 to (2 3 - 1) 5 = 35%. | function _fertilizerUsePercentage(TreeData storage _seed) internal view returns (uint16) {
uint16 _seedFertilizerUsePercentage = _traitFromDNA(_seed.dna, _treeFertilizerUseFactorLastBitPosition, _treeFertilizerUseFactorMask) * 5;
return baseFertilizerUsePercentage + _seedFertilizerUsePercentage;
... | 12,779,367 |
./partial_match/56/0x8a30265A930526589069d10869507b70b459505E/sources/StrategyValueDefiLP.sol | Takes out 4.5% as system fees from the rewards. 0.5% -> Call Fee 0.5% -> Treasury fee 0.5% -> Strategist fee 3.0% -> BIFI Holders/ | function chargeFees() internal {
uint256 toWbnb = IERC20(vbswap).balanceOf(address(this)).mul(45).div(1000);
IValueLiquidRouter(valueRouter).swapExactTokensForTokens(vbswap, wbnb, toWbnb, 0, vbswapToWbnbRoute, address(this), now.add(600));
uint256 wbnbBal = IERC20(wbnb).balanceOf(ad... | 11,243,388 |
// contracts/HelloWorld.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
contract HelloWorld {
mapping(address => uint256) public voteAllowance;
// For example sake, voting is on a single proposition.
mapping(uint8 => mapping(address => uint256)) public votes;
// Deployer governs the election
a... | return ID of winning option Only the governor can close elections Set vote allowance for next election Return the winning option | function closeVoting() public returns (uint256) {
require(msg.sender == governor, "Governor only");
setNextVoteAllowance(_bob);
setNextVoteAllowance(_sue);
setNextVoteAllowance(_alice);
if (getVoteCount(1) > getVoteCount(2)) {
return 1;
return 2;
}
}
| 14,052,485 |
// SPDX-License-Identifier: MIT
/// @title RaidParty Party Contract
/**
* ___ _ _ ___ _
* | _ \__ _(_)__| | _ \__ _ _ _| |_ _ _
* | / _` | / _` | _/ _` | '_| _| || |
* |_|_\__,_|_\__,_|_| \__,_|_| \__|\_, |
* |__/
*/
pragma solidity ^0.8.0;
import... | Compute damage update given a prev enhancement value Check if party size was downgraded | function _updateDamageEnhancement(
Property item,
uint256[] memory ids,
uint8[] memory prev
) internal {
require(
item == Property.HERO || item == Property.FIGHTER,
"Party::_updateDamageEnhancement: invalid item"
);
require(
ids... | 237,805 |
pragma solidity ^0.5.3;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "./interfaces/IExchange.sol";
import "./interfaces/ISortedOracles.sol";
import "./interfaces/IReserve.sol";
import "./interfaces/IStableToken.sol";
import "../commo... | Allows owner to set the minimum number of reports required newMininumReports The new update minimum number of reports required/ | function setMinimumReports(uint256 newMininumReports) public onlyOwner {
minimumReports = newMininumReports;
emit MinimumReportsSet(newMininumReports);
}
| 2,472,858 |
pragma solidity ^0.5.3;
/**
* @author ESPAY PTY LTD.
*/
/**
* @title ERC223ReceivingContract
* @dev ContractReceiver abstract class that define by erc223, the method tokenFallback must by receiver contract if it want
* to accept erc223 tokens.
* ERC223 Receiving Contract interface
*/
contract ERC223Receivi... | _evilUser address of user the owner want to add in BlackList/ | function addBlackList (address _evilUser) public onlyOwner {
require(!isBlackListed[_evilUser]);
isBlackListed[_evilUser] = true;
emit AddedBlackList(_evilUser);
}
| 949,157 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;
// ERC20 Interface
interface iERC20 {
function balanceOf(address) external view returns (uint256);
function transfer(address, uint) external returns (bool);
function approve(address, uint) external returns (bool... | Any vault calls to transfer any asset to any recipient. | function transferOut(address payable to, address asset, uint amount, string memory memo) public payable {
uint safeAmount;
if(asset == address(0)){
safeAmount = msg.value;
safeAmount = amount;
}
emit TransferOut(msg.sender, to, asset, safeAmount, memo);
}
... | 55,980 |
./full_match/1/0x3b985118468164b310C5254b0710888dd57c7599/sources/contracts/pool/PoolBase.sol | Function is used to redeem previously provided liquidity with interest, burning cpTokens tokens Amount of cpTokens to burn (MaxUint256 to burn maximal possible) | function redeem(uint256 tokens) external {
_accrueInterest();
uint256 exchangeRate = _storedExchangeRate();
uint256 currencyAmount;
if (tokens == type(uint256).max) {
(tokens, currencyAmount) = _maxWithdrawable(exchangeRate);
currencyAmount = tokens.mulDecima... | 3,086,557 |
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.12;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability war... | uint256 rLiqidity = tLiquidity.mul(currentRate); | function _getRValues(uint256 tAmount, uint256 tFee, uint256 currentRate, uint256 tBurnValue,uint256 tTax) private pure returns (uint256, uint256, uint256,uint256,uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rBurnValue = tBurnValue.mul(c... | 340,732 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "../access/Ownable.sol";
import "./TransparentUpgradeableProxy.sol";
/**
* @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an
* explanation of why you would want to use this see the d... | Upgrades `proxy` to `implementation` and calls a function on the new implementation. See {TransparentUpgradeableProxy-upgradeToAndCall}. Requirements: - This contract must be the admin of `proxy`./ | function upgradeAndCall(TransparentUpgradeableProxy proxy, address implementation, bytes memory data) public payable onlyOwner {
}
| 321,204 |
./partial_match/1/0x1473F3e4d236CBBe3412b9f65B4c210756BE2C0E/sources/src/FrxEthEthDualOracle.sol | The ```calculatePrices``` function calculates the normalized prices in a pure function return isBadData True if any of the oracles return stale data return priceLow The normalized low price return priceHigh The normalized high price | function calculatePrices(
uint256 ethPerFrxEthCurveEma,
uint256 fraxPerFrxEthTwap,
bool isBadDataEthUsdChainlink,
uint256 usdPerEthChainlink,
bool isBadDataFraxUsdChainlink,
uint256 usdPerFraxChainlink
) external view returns (bool isBadData, uint256 priceLow, uin... | 4,389,214 |
/*
Utility functions for safe math operations. See link below for more information:
https://ethereum.stackexchange.com/questions/15258/safemath-safe-add-function-assertions-against-overflows
*/
pragma solidity ^0.4.19;
contract SafeMath {
function safeAdd(uint256 x, uint256 y) pure internal returns (ui... | Special Manager creation/actination Check if it's a non-zero address If this special manager already exists If this special manager disabled, activate him again | function specialManagerOn( address _onSpecialManagerAddress ) external isOwner returns (bool retrnVal) {
require( _onSpecialManagerAddress != address(0) );
if ( specialManagerAddressNumberMap[ _onSpecialManagerAddress ]>0 )
{
if ( !specialManagerAddressMap[ _onSpecialManagerAddress ] )
{
specialManager... | 6,396,170 |
./full_match/5/0xCbD7874fB3F6843DFB056147EC83fFf469Bcec33/sources/project_/lib/CurrencyTransferLib.sol | Transfers a given amount of currency. (With native token wrapping)console.log("transferCurrencyWithWrapper: %s %s %s", _currency, _from, _to);console.log("%s %s %s", _amount, _nativeTokenWrapper, address(this)); withdraw from weth then transfer withdrawn native token to recipient store native currency in weth | function transferCurrencyWithWrapper(
address _currency,
address _from,
address _to,
uint256 _amount,
address _nativeTokenWrapper
) internal {
if (_amount == 0) {
return;
}
if (_currency == NATIVE_TOKEN) {
if (_from == addr... | 1,898,980 |
pragma solidity ^0.7.5;
pragma abicoder v2;
import "./lib/LibSafeMath.sol";
import "./ERC1155Mintable.sol";
import "./mixin/MixinOwnable.sol";
contract ProofOfCultureMinter is Ownable {
using LibSafeMath for uint256;
struct _HashtagContainer {
string originalHashtag;
string normalizedHashtag;
uint256... | mints a non-fungible token type_ token type to beneficiaries of minted tokens Index are 1-based. cache to reduce number of loads You could use base-type id to store NF type balances if you wish. if `to` is a contract then trigger its callback | function mintNonFungible(
uint256 type_,
address[] calldata to
)
external
override
onlyCreator(type_)
{
require(
isNonFungible(type_),
"TRIED_TO_MINT_NON_FUNGIBLE_FOR_FUNGIBLE_TOKEN"
);
uint256 index = maxIndex[type_] +... | 130,464 |
pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint... | transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./ | function transfer(address _to, uint256 _value) public timeAllowed returns (bool) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
| 1,847,511 |
pragma solidity ^0.5.0;
contract SafeRemotePurchase {
event SellerAdded(uint idItem); //used in market page for getting all seller details
event BuyerAdded(uint idItem); //used in process order page for getting buyer details
event OrderReceived(uint idItem); //used in market page to disable confirm button
st... | Set and get Seller hash for perticular product | function addSellerHash(string memory sellerHash) public {
uint idItem = numberOfItemAvailableForSale++;
items[idItem].sellerHash = sellerHash;
emit SellerAdded(idItem);
}
| 6,443,364 |
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... | return true if `msg.sender` is the owner of the contract./ | function isOwner() public view returns (bool) {
return msg.sender == _owner;
}
| 13,055,894 |
pragma solidity ^0.4.21;
contract Math
{
/*
standard uint256 functions
*/
function add(uint256 x, uint256 y) constant internal returns (uint256 z) {
assert((z = x + y) >= x);
}
function sub(uint256 x, uint256 y) constant internal returns (uint256 z) {
assert((z ... | startTime = block.timestamp; | function Grass() public
{
owner = msg.sender;
admins[msg.sender] = true;
totalSupply = 0;
name = 'GRASS Token';
decimals = 18;
symbol = 'GRASS';
availableTokens = 800 * 10**18;
lastUpdateEtherPrice = block.times... | 12,881,915 |
./partial_match/1/0xeCcfd7c19936Fc4B4CfBF829F08513340777702D/sources/Oasis.sol | Set the token minter. Only callable by the owner when not locked. _minter The address of the new minter./emit MinterUpdated(_minter); | function setMinter(address _minter) external onlyOwner override {
minter = _minter;
}
| 15,714,593 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.