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.4;
contract LoyaltyPoints {
//The address of the asigned owner of the contract
address owner;
//key value pair of a customer address and their correspondent balances
mapping (address => uint) balances;
//key value pair of a customer address and his assigned family member, which he is allowe... | function to return the balance of an account | function getBalance(address addr) returns(uint) {
return balances[addr];
}
| 13,106,378 |
./partial_match/42/0xb67e3087b617C68F81b6A85a086C3F6833a7334B/sources/astronaut7/acap-pw/42/0xb67e3087b617C68F81b6A85a086C3F6833a7334B/Agreement.sol | Check if address is owner/ | function isOwner(address _addr) public view returns(bool) {
return owner == _addr;
}
| 9,085,662 |
./full_match/1/0x92bed3EE2525C253e87D67b2F3d28b3Db8d67B0a/sources/contracts/BatchDeposit.sol | Change human-readable name of the node operator `_id` to `_name`/ | function setNodeOperatorName(uint256 _id, string calldata _name) external onlyOwner
{
operators[_id].name = _name;
emit NodeOperatorNameSet(_id, _name);
}
| 9,685,206 |
/*
.----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------.
| .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. |
| | ____ ____ | || | _________ ... | stake visibility is public as overriding LPTokenWrapper's stake() function | function stake(uint256 amount) public updateReward(msg.sender) checkhalve checkStart{
require(amount > 0, "Cannot stake 0");
super.stake(amount);
lasttimestaked[msg.sender] = block.timestamp;
emit Staked(msg.sender, amount);
}
| 6,761,980 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
//
/**
* @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 returns (uint256);
/**
* @dev Returns the am... | renBTC pool sBTC pool bUSD pool function remove_liquidity_one_coin(uint256 _amount, int128 _i, uint256 _min_uamount, bool _donate_dust) external; | interface ICurveDeposit {
function get_virtual_price() external view returns (uint256);
function add_liquidity(
uint256[2] calldata amounts,
uint256 min_mint_amount
) external;
function add_liquidity(
uint256[3] calldata amounts,
uint256 min_mint_amount
) external;
... | 161,412 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC721.sol";
/**
* @title Galaxiators
* @author @redBonanza
* @author Roi Di Segni (aka Sheeeev66)
*/
contract Galaxiators is ERC721 {
// max amount you can mint in a single transaction
// and max amount per wallet
uint256 public imm... | Removes addresses from the whitelist/ | function removeFromPreMintWhitelist(address[] calldata _addresses) external onlyOwner {
for (uint i = 0; i < _addresses.length; i++) {
_preMintWhitelist[_addresses[i]] = false;
}
}
| 13,971,200 |
// File: contracts/saga-genesis/interfaces/IMintManager.sol
pragma solidity 0.4.25;
/**
* @title Mint Manager Interface.
*/
interface IMintManager {
/**
* @dev Return the current minting-point index.
*/
function getIndex() external view returns (uint256);
}
// File: contracts/saga-genesis/interfa... | Mint Manager Interface./ | interface IMintManager {
function getIndex() external view returns (uint256);
}
| 2,509,621 |
/**
*Submitted for verification at Etherscan.io on 2022-03-30
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
// ▄████████ ▄████████ ▄████████ ▄█ ▄████████ ▄████████ ▄████████ ▄████████ ▄████████ ▄████████
// ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ... | Not in standard lib. Added by @beauwilliams | function set(Counter storage counter, uint256 value) internal {
counter._value = value;
}
| 146,858 |
// SPDX-License-Identifier: MIT
// dev: @brougkr
/**@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@... | ADMIN: Flips Sale State/ | function __flip_saleState() external onlyOwner { _SALE_ACTIVE = !_SALE_ACTIVE; }
| 129,980 |
./full_match/11155111/0x62a6C3cD59bD079cB180D64608eDd9B8cc9E27F5/sources/contracts/L1/messaging/L1StandardBridge.sol | @inheritdoc IL1StandardBridge/ slither-disable-next-line reentrancy-events slither-disable-next-line reentrancy-events Construct calldata for l2ERC20Bridge.finalizeBridge(...) Send calldata into L2 slither-disable-next-line reentrancy-events slither-disable-next-line reentrancy-events | function finalizeETHBridge(
address _from,
address _to,
uint256 _amount,
uint32 _localGasLimit,
uint32 _remoteGasLimit,
bytes calldata _data
) external onlyFromCrossDomainAccount(remoteTokenBridge) {
if (success) {
emit ETHBridgeFinalized(_from... | 3,824,710 |
./full_match/43113/0xc14ebb4e2186f82551bEc27d9837929b8bd58704/sources/contracts/CoryRouter.sol | refund dust eth, if any | function addLiquidityAVAX(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountAVAXMin,
address to,
uint256 deadline
)
external
payable
virtual
override
ensure(deadline)
returns (
... | 13,166,456 |
./full_match/1/0x8Be0D0a733Fb2f519ADe99d6D4Ea57cff56866Cf/sources/src/SneakyGenesis/SneakyGenesis.sol | Hook to check whether a pass is transferrable admins can always transfer regardless of whether passes are flagged from address that holds the tokenId to address that will receive the tokenId startTokenId index of first tokenId that will be transferred quantity amount that will be transferred | function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal override {
if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender) && from != address(0)) {
require(!isAddressFlagged(from), "SneakyGenesis: pass holder address is... | 9,809,907 |
/*
Copyright 2018 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... | Buys an exact amount of an ERC20 token using WETH. orders Orders to fill. The maker asset is the ERC20 token to buy. The taker asset is WETH. signatures Proof that the orders were created by their respective makers. feeOrders to fill. The maker asset is ZRX and the taker asset is WETH. feeSignatures Proof that the ... | function marketBuyERC20TokensInternal(
LibOrder.Order[] memory orders,
bytes[] memory signatures,
LibOrder.Order[] memory feeOrders,
bytes[] memory feeSignatures,
uint256 makerTokenFillAmount
)
internal
returns (LibFillResults.FillResults memory totalFillR... | 15,798,251 |
// File: @aragon/os/contracts/common/UnstructuredStorage.sol
/*
* SPDX-License-Identifier: MIT
*/
pragma solidity ^0.4.24;
library UnstructuredStorage {
function getStorageBool(bytes32 position) internal view returns (bool data) {
assembly { data := sload(position) }
}
function getStorageA... | Withdraw all `(self.stakeToken(): address).symbol(): string` tokens previously staked on proposal `_proposalId` _proposalId Proposal id/ | function withdrawAllFromProposal(uint256 _proposalId) external isInitialized() proposalExists(_proposalId) {
_withdrawFromProposal(_proposalId, proposals[_proposalId].voterStake[msg.sender], msg.sender);
}
| 2,427,418 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "../interfaces/AletheaERC721Spec.sol";
import "./IntelligentNFTv2.sol";
import "../utils/AccessControl.sol";
/**
* @title Fixed Supply Sale
*
* @notice Fixed Supply Sale sales fixed amount of iNFTs for a fixed price in a fixed period of time;
* un... | Concatenates two strings `s1` and `s2`, for example, if `s1` == `foo` and `s2` == `bar`, the result `s` == `foobar` s1 first string s2 second string return s concatenation result s1 + s2/ an old way of string concatenation (Solidity 0.4) is commented out convert s1 into buffer 1 convert s2 into buffer 2 create a... | function concat(string memory s1, string memory s2) internal pure returns (string memory s) {
bytes memory buf1 = bytes(s1);
bytes memory buf2 = bytes(s2);
bytes memory buf = new bytes(buf1.length + buf2.length);
for(uint256 i = 0; i < buf1.length; i++) {
buf[i] = buf1[i];
}
for(uint256 j = buf1.lengt... | 1,352,520 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Pausable.sol";
import "@openzeppelin/contracts/access/Ownable.so... | Set `baseTokenURI` Only `owner` can call/ | function setBaseURI(string memory baseURI) public onlyOwner {
baseTokenURI = baseURI;
}
| 537,883 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns... | Mints `quantity` tokens and transfers them to `to`. Requirements: - there must be `quantity` tokens remaining unminted in the total collection. - `to` cannot be the zero address. - `quantity` cannot be larger than the max batch size. Emits a {Transfer} event./ We know if the first token in the batch doesn't exist, the ... | function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal {
uint256 startTokenId = currentIndex;
require(to != address(0), "ERC721A: mint to the zero address");
require(!_exists(startTokenId), "ERC721A: token already minted");
requir... | 15,283,217 |
pragma solidity ^0.6.11;
pragma experimental ABIEncoderV2;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function... | Book seller gets all listed/owned books return _ownedBooks Array of all books owned/ exclude the leftover hashes in state array map ownedBooks | function getOwnedBooks() canSellBook(msg.sender) userExists(msg.sender) view external returns(bytes32[] memory _ownedBooks){
_ownedBooks = ownedBooks[msg.sender];
for(uint i=0; i < _ownedBooks.length; i++){
if(booksHashes[_ownedBooks[i]] == 0){
delete _ownedBooks[i];
... | 12,985,279 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.6;
import { IEmissionsController } from "../interfaces/IEmissionsController.sol";
import { IMasset } from "../interfaces/IMasset.sol";
import { IRevenueRecipient } from "../interfaces/IRevenueRecipient.sol";
import { DialData } from "../emissions/Emissi... | Simply transfers the mAsset from the sender to here _mAsset Address of mAsset _amount Units of mAsset collected/ Transfer from sender to here | function notifyRedistributionAmount(address _mAsset, uint256 _amount) external override {
require(massetConfig[_mAsset].bAsset != address(0), "Invalid mAsset");
IERC20(_mAsset).safeTransferFrom(msg.sender, address(this), _amount);
emit RevenueReceived(_mAsset, _amount);
}
| 89,276 |
pragma solidity ^0.4.15;
import 'zeppelin-solidity/contracts/math/SafeMath.sol';
import './TokenLifecycle.sol';
import './PurchasableToken.sol';
import './BurnableToken.sol';
import './FinalizableToken.sol';
import './RefundVault.sol';
/**
* @title A Refundable Token
* @author Tavit Ohanian
* @dev Adapted from th... | vault finalization task, called when owner calls finalize()/ mint additional tokens for defined allocation pools | function finalization() internal {
if (goalReached()) {
close();
mintDefinedPools();
enableRefunds();
}
}
| 2,507,412 |
./full_match/5/0x6bf64541d47402c789375b5c8ECB18afAa4c243F/sources/contracts/aboutRarity_0.13.sol | parts[0] = '<svg xmlns="http:www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 350 350"><style>.base { fill: white; font-family: serif; font-size: 16px; }</style><style>.footnote { fill: white; font-family: verdana; font-size: 8px; }</style><rect width="100%" height="100%" fill="black" /><text x="25... | function tokenURI(uint256 tokenId) override public view returns (string memory){
string[7] memory parts;
parts[2] = ' />';
parts[4] = '<text x="25" y="50" class="base">';
uint256 rand = random(string(abi.encodePacked(parts[0], toString(tokenId))));
uint256 gre... | 7,067,153 |
./full_match/5/0xbFA404a5c0d91f07C5D1aC9Ab17285998e5BD337/sources/contracts/extension/plugin/Router.sol | View all funtionality existing on the contract. | function getAllPlugins() external view returns (Plugin[] memory registered) {
RouterStorage.Data storage data = RouterStorage.routerStorage();
EnumerableSet.Bytes32Set storage overrideSelectors = data.allSelectors;
Plugin[] memory defaultPlugins = IPluginMap(pluginMap).getAllPlugins();
... | 1,894,423 |
//based https://github.com/0xcert/ethereum-erc721
//based https://github.com/Kaz-Naz/ERC721LT
//author https://github.com/Toshiya-Y-K-N
pragma solidity 0.6.2;
import "./nf-token.sol";//This sol file modified.(base is 0xcert's file.)
import "./nf-token-metadata.sol";
import "./nf-token-enumerable.sol";
imp... | getOTP() サイトそのもののOTPを表示させる。これはチケットを持つ人なら見ることができる。全員に同じ値を表示する。ファンサイト入場できるトークンを持っているか確認する条件通りならばクリエイターのセットしたパスワードをリターンする | function getOTP() public view returns (bytes32) {
require(msg.sender != address(0), ZERO_ADDRESS);
require( _getOwnerNFTCount(msg.sender) > 0 );
string memory str = bytes32ToString(_secret) ;
uint256 inte = _creatorOneTimeNum ;
return sha256(abi.encodePacke... | 12,881,006 |
pragma solidity 0.6.10;
pragma experimental ABIEncoderV2;
library BokkyPooBahsDateTimeLibrary {
uint constant SECONDS_PER_DAY = 24 * 60 * 60;
uint constant SECONDS_PER_HOUR = 60 * 60;
uint constant SECONDS_PER_MINUTE = 60;
int constant OFFSET19700101 = 2440588;
uint constant DOW_MON = 1;
... | Update state variables | function _burn(
address from,
uint256 amount,
bytes memory data,
bytes memory operatorData
)
internal virtual
{
require(from != address(0), "ERC777: burn from the zero address");
address operator = _msgSender();
_callTokensToSe... | 7,329,040 |
./full_match/8453/0x762eb51D2e779EeEc9B239FFB0B2eC8262848f3E/sources/contracts/OptionTokenV3.sol | Returns the discounted price in paymentTokens for a given amount of options tokens redeemed to veFLOW _amount The amount of options tokens to exercise return The amount of payment tokens to pay to purchase the underlying tokens | function getVeDiscountedPrice(
uint256 _amount
) public view returns (uint256) {
return (getTimeWeightedAveragePrice(_amount) * veDiscount) / 100;
}
| 11,552,876 |
./full_match/4/0x05F5230b57E7D1d96B7ECC3975e447955a690b85/sources/BondingCurveFactory_flat.sol | Creates an instance of the token sender. Creates an instance of the collateral token of the token. This gets the price of the next token in collateral TODO Checks if a pair is already created TODO if there is then the min A & B need to be sliders not set Approves the uniswap router as a spender for the collateral and ... | function transition() public {
I_Token tokenInstance = I_Token(msg.sender);
IERC20 collateralInstance = IERC20(
tokenInstance.getCollateralInstance()
);
uint256 currentPrice = transitionInfo[msg.sender][0];
uint256 tokensToMint = transitionInfo[msg.sender][1];
... | 651,449 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
... | underlying balance is stored in hams, so divide by current scaling factor note, this means as scaling factor grows, dust will be untransferrable. minimum transfer value == hamsScalingFactor / 1e24; get amount in underlying sub from balance of sender add to balance of receiver | function transfer(address to, uint256 value)
external
validRecipient(to)
returns (bool)
{
uint256 hamValue = value.mul(internalDecimals).div(hamsScalingFactor);
_hamBalances[msg.sender] = _hamBalances[msg.sender].sub(hamValue);
_hamBalances[to... | 7,506,875 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@//
//@@@@@@@@&....(@@@@@@@@@@@@@..../@@@@@@@@@//
//@@@@@@........../@@@@@@@........../@@@@@@//
//@@@@@............(@@@@@............(@@@@@//
//@@@@@([email protected]@@@@(...........&@@@@@//
//@@@@@@@...........&@@@@@@[ema... | Get timestamp when `addr`'s lock finishes addr User wallet address return Timestamp when lock finishes | function lockedEnd(address addr) external view override returns (uint256) {
return lockedBalances[addr].end;
}
| 12,078,574 |
./partial_match/3/0x662827F57c3910C05F5460a19d7634907D4f2362/sources/LDBToken.sol | check if minting is legal _investorAddress the address to mint to _amount the token number to mint/ | function canMintCheck(address _investorAddress,uint _amount) internal view returns (bool){
if(wasMintingFinished()){
return false;
}
if(totalSupply_.add(_amount) > hardCap){
return false;
}
return super.canMintCheck(_investorAddress,_amount);
}
| 5,207,126 |
pragma solidity ^0.4.18;
interface ERC721 {
/// @dev This emits when ownership of any NFT changes by any mechanism.
/// This event emits when NFTs are created (`from` == 0) and destroyed
/// (`to` == 0). Exception: during contract creation, any number of NFTs
/// may be created and assigned wit... | owner's reward and retreive functions | function rewardIncentive() external returns(string) {
address owner = ownerOf(1);
require(owner == msg.sender);
if(lockedBalance>0){
donatee.transfer(lockedBalance);
lockedBalance=0;
return "incentive rewarded";
}
else{
... | 5,414,047 |
pragma solidity 0.4.15;
/// @title Ownable
/// @dev The Ownable contract has an owner address, and provides basic authorization control
/// functions, this simplifies the implementation of "user permissions".
contract Ownable {
// EVENTS
event OwnershipTransferred(address indexed previousOwner, address ... | Unregister a given record | function unregister(address key, address sender) onlyDaoOrOwner {
require(records[key].owner == sender);
uint keysIndex = records[key].keysIndex;
delete records[key];
numRecords--;
keys[keysIndex] = keys[keys.length - 1];
records[keys[keysIndex]].keysIndex = keysIndex... | 7,275,131 |
./partial_match/1/0xcE1492A0AF20116d4eC86F20FDc43dCBCD6Ef952/sources/ApesAndDegens.sol | Execute the swap of accumulated tokens and add to liquidity. Converts half of the accumulated tokens to ETH. Adds half of ETH and other half of tokens to liquidity./ Swap half of tokens for ETH Add swapped ETH and remaining half of tokens to liquidity | function _swap() internal inSwap {
uint256 balance = address(this).balance;
uint256 half = _balances[address(this)] / 2;
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = address(IRouter(_router).WETH());
IRouter(_router).swapExactTokensFor... | 15,898,146 |
./full_match/1/0xec857E00E7E50273724Cb027f852f871B1FeF50E/sources/contracts/abstract/JBPayoutRedemptionPaymentTerminal.sol | / Refund any held fees to make sure the project doesn't pay double for funds going in and out of the protocol. Record the added funds with any refunded fees. | function _addToBalanceOf(
uint256 _projectId,
uint256 _amount,
bool _shouldRefundHeldFees,
string memory _memo,
bytes memory _metadata
) internal {
uint256 _refundedFees = _shouldRefundHeldFees ? _refundHeldFees(_projectId, _amount) : 0;
store.recordAddedBalanceFor(_projectId, _amount +... | 17,164,761 |
./partial_match/42/0x3e6d34F22878A10b8F49f4ba8B9d42cBc2fF0037/sources/EtherCollateralsUSD.sol | Simple interest calculated per second Interest = Principal rate time | function accruedInterestOnLoan(uint256 _loanAmount, uint256 _seconds) public view returns (uint256 interestAmount) {
interestAmount = _loanAmount.multiplyDecimalRound(interestPerSecond.mul(_seconds));
}
| 3,308,156 |
./full_match/43114/0x4833E951E918fa04a53c477154804997df48e5FE/sources/contracts/Masterchef.sol | View function to see pending CYFs on frontend. | function pendingCyf(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accCyfPerShare = pool.accCyfPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if... | 4,504,348 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol";
import "@o... | Handle non winning lot lot - Current lot/ | function _cancelLot(Lot storage lot) internal {
lot.isCanceled = true;
IERC721Upgradeable(lot.nft).safeTransferFrom(address(this), lot.seller, lot.tokenId);
}
| 6,081,223 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/presets/ERC20PresetMinterPauser.sol";
contract NAFTA is ERC20PresetMinterPauser {
// Cap at 1 million
uint256 internal _cap = 10000000 * 10**18;
construc... | Should not exceed cap when minting/ When minting tokens | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual override(ERC20PresetMinterPauser) {
super._beforeTokenTransfer(from, to, amount);
if (from == address(0)) {
require(
totalSupply().add(amount) <= _cap,
... | 2,537,080 |
/**
*Submitted for verification at Etherscan.io on 2022-02-19
*/
/*
__ __ _
| \/ | \| |
| |\/| | |) | |__
|_| |__/|___|
Million Dollar Living
Website: https://mdldao.eth.link
Twitter: https://twitter.com/MDLDAO
Discord: https://discord.gg/7hvY8fz2VA
*/
//SPDX-License-Identifier: M... | Returns the multiplication of two unsigned integers, with an overflow flag. _Available since v3.4._/ | function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
| 10,962,025 |
./partial_match/42/0xB45F2e74d0fEc8E2aaa49bEc38F5178Bd880EcF7/sources/IdleStrategyUSDTTestnet.sol | Exits IDLE and transfers everything to the vault./ | function withdrawAllToVault() external restricted updateVirtualPrice {
withdrawAll();
IERC20(address(underlying)).safeTransfer(vault, underlying.balanceOf(address(this)));
}
| 8,839,498 |
./full_match/1/0x5128fb075c5F770bfC53152aBB37A62BB9dBf723/sources/contracts/BaseSilo.sol | @inheritdoc IBaseSilo | function assetStorage(address _asset) external view override returns (AssetStorage memory) {
return _assetStorage[_asset];
}
| 3,140,928 |
./partial_match/4/0x92Bf24109753D7038D4Cf216D43850c81FA0a589/sources/MasterChef.sol | Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as... | function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "ADigitalBankToken::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
... | 8,505,246 |
./partial_match/80001/0x3715FE0c0E39c2D28dB7f374Fe1F58481da51697/sources/contracts/AlgebraBasePluginV1.sol | @inheritdoc IAlgebraBasePluginV1 | function initialize() external override {
require(!isInitialized, 'Already initialized');
require(_getPluginInPool() == address(this), 'Plugin not attached');
(uint160 price, int24 tick, , ) = _getPoolState();
require(price != 0, 'Pool is not initialized');
uint32 time = _blockTimestamp();
ti... | 8,819,966 |
// File: contracts/IManager.sol
pragma solidity ^0.5.11;
contract IManager {
event SetController(address controller);
event ParameterUpdate(string param);
function setController(address _controller) external;
}
// File: contracts/zeppelin/Ownable.sol
pragma solidity ^0.5.11;
/**
* @title Ownable
*... | Returns next transcoder in pool for a given transcoder _transcoder Address of a transcoder in the pool return address for the transcoder after '_transcoder' in transcoder pool/ | function getNextTranscoderInPool(address _transcoder) public view returns (address) {
return transcoderPoolV2.getNext(_transcoder);
}
| 1,112,545 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)
pragma solidity ^0.8.0;
import "../diamond/LibAppStorage.sol";
import "../interfaces/IERC1155.sol";
import "../interfaces/IPower.sol";
import "hardhat/console.sol";
interface ITokenAttributeSetter {
functio... | fetch a key by row (enumerate). self storage pointer to a Set. index row to enumerate. Must be < count() - 1./ | function keyAtIndex(Set storage self, uint256 index)
public
view
returns (uint256)
{
return self.keyList[index];
}
| 581,925 |
pragma solidity ^0.5.0;
import "./AbstractWallet.sol";
import "./lib/signValidator.sol";
contract Wallet is AbstractWallet {
address owner;
mapping (address => bool) public isWhiteListed;
mapping(uint256 => bool) usedNonces;
constructor() public {
owner = msg.sender;
}
struct Balance {
address owner;
... | address signer = ECDSA.recover(_message, _sig); require(signer == _from, 'Signer address is not valid'); | function transferTo(address _from, address _to, uint256 _sum, bytes memory _sig, bytes32 _message) public checkSum(_sum) {
require(checkExists(_to), 'Reciever address is not registered');
require(checkExists(_from), 'Address is not registered');
Balance memory _fromBalance = wallets[_from];
Balance memory _toB... | 2,517,600 |
./full_match/80001/0x342Eb7747a5b4DcB266123480754F9D23bcEfa5F/sources/contracts/Contract.sol | Function to reward customers | function rewardCustomer(address customer, uint256 tokenAmount) public {
transferFrom(owner, _msgSender(), userMappings[owner].name, userMappings[_msgSender()].name, tokenAmount, "Buy Tokens");
transferFrom(_msgSender(), customer, userMappings[_msgSender()].name, userMappings[customer].name, tokenAm... | 5,620,373 |
./full_match/44787/0x44766b358814AF8C2da4edb2fFb906E602DbCec6/sources/scripts/Bonus.sol | require(_msgSender() == starNFT.ownerOf(_tokenId), "not your token"); emit Test(_msgSender(),_tokenId,_amount); require(_amount > 0, "no bonus"); bonusWithdrawn = bonusWithdrawn.add(_amount); tokenWithdraw[_tokenId] = tokenWithdraw[_tokenId].add(_amount); starToken.transfer(_msgSender(), _amount); | function bonusWithdraw(uint256 _tokenId) public {
uint256 _amount = _getBonus(_tokenId);
}
| 13,278,289 |
pragma solidity ^0.5.17;
interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) external returns (bool);
function allowance(address owner, address spender) external view ... | Repay variable amount of token given exact output amount in USD | function repayExactOut(address token, uint inMax, uint outExact) external {
IERC20(token).safeTransferFrom(msg.sender, address(this), inMax);
IERC20(token).safeApprove(address(UNI), 0);
IERC20(token).safeApprove(address(UNI), inMax);
address[] memory _path = new add... | 468,814 |
// Copyright (C) 2020 Argent Labs Ltd. <https://argent.xyz>
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Th... | Helper method to parse data and extract the method signature./ solhint-disable-next-line no-inline-assembly | function functionPrefix(bytes memory _data) internal pure returns (bytes4 prefix) {
require(_data.length >= 4, "RM: Invalid functionPrefix");
assembly {
prefix := mload(add(_data, 0x20))
}
}
| 1,670,607 |
pragma solidity ^0.4.22;
contract SimpleStore {
uint256 value;
mapping(address => mapping(string => uint)) weapon_db;
event GetTest(string _state, uint256 _rank, address _sender);
event NewValueSet(uint256 indexed _value, address _sender);
event NewValueSetAgain(uint256 indexed _value, address _se... | emit GetTest("A", uint2str(_blank), msg.sender); | function testEvent(uint256 _blank) public {
emit GetTest("A", _blank, msg.sender);
}
| 12,901,855 |
/*
* This code has not been reviewed.
* Do not use or deploy this code before reviewing it personally first.
*/
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./t... | Transfer Validity / Know the reason on success or failure based on the EIP-1066 application-specific status codes. payload Payload of the initial transaction. partition Name of the partition. operator The address performing the transfer. from Token holder. to Token recipient. value Number of tokens to transfer. ... | function _canTransfer(bytes memory payload, bytes32 partition, address operator, address from, address to, uint256 value, bytes memory data, bytes memory operatorData)
internal
view
returns (bytes1, bytes32, bytes32)
{
address checksImplementation = interfaceAddr(address(this), ERC1400_TOKENS_CHECKE... | 7,232,154 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// ... | See {IERC721RedeemBase-mintNumber}./ | function mintNumber(uint256 tokenId)
external
view
virtual
override
returns (uint256)
{
return _mintNumbers[tokenId];
}
| 1,513,044 |
/**
*Submitted for verification at Etherscan.io on 2021-10-02
*/
pragma solidity =0.5.16;
interface IMdexFactory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint256);
function FEE_RATE_DENOMINATOR() external view returns (uint256);
function feeRateNumerator() exter... | calculates the CREATE2 address for a pair without making any external calls | function pairFor(address tokenA, address tokenB) public view returns (address pair) {
(address token0, address token1) = sortTokens(tokenA, tokenB);
pair = address(uint256(keccak256(abi.encodePacked(hex"ff", address(this), keccak256(abi.encodePacked(token0, token1)), initCodeHash))));
}
| 6,770,150 |
//https://solidity.readthedocs.io/en/v0.5.11/index.html
///@dev: this version requires conversion of string to string memory
pragma solidity ^0.5.11;
///@dev: The ABI v2 encoder allows structs, nested and dynamic variables to be passed/returned into/from functions/events
///@dev: do not use ABIEncoderV2 on live/relea... | Internal Helper function SCAs can view certificate and Customer by proxy if product is in sale (role=MANAGER)either it is the owner of the productor it is a customer by proxy of SC manager | function isCallerAllowedToViewCertificate(address callerAddress_,uint96 EPC_) internal view returns(bool retAllowed){
if(getCurrentOwner(EPC_)==callerAddress_) return true;
else if(validatorAddress==callerAddress_)
{
if(isStateSold(EPC_)) return true;
else return false;
}
... | 7,237,317 |
// Sources flattened with hardhat v2.6.1 https://hardhat.org
// File @openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol@v4.5.1
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address... | Deposit funds into liquidity pool and stake LP Tokens in Staker Vault. depositAmount Amount of the underlying asset to supply. minTokenAmount Minimum amount of LP tokens that should be minted. return The actual amount minted and staked./ | function depositAndStake(uint256 depositAmount, uint256 minTokenAmount)
external
payable
override
returns (uint256)
{
uint256 amountMinted_ = depositFor(address(this), depositAmount, minTokenAmount);
staker.stakeFor(msg.sender, amountMinted_);
return amoun... | 10,436,062 |
./partial_match/1/0x5125109F043677ed7Fc528984298f737A8d7180B/sources/turkeysGameTurkeys.sol | ERC-721 Non-Fungible Token Standard, optional supplu extension See https://eips.ethereum.org/EIPS/eip-721 Note: the ERC-165 identifier for this interface is 0x780e9d63. is ERC721 / | interface IERC721Supply {
function totalSupply() external view returns (uint256);
}
}
| 2,695,777 |
./full_match/5/0xb1F1bB96C6ac3777b2EF3926223Ab30514E4ac51/sources/contracts/scripty/interfaces/IScriptyHTMLURLSafe.sol | ============================================================= RAW HTML GETTERS ============================================================= ============================================================= STRING UTILITIES ==========================================================... | interface IScriptyHTMLURLSafe {
function getHTMLURLSafe(
HTMLRequest memory htmlRequest
) external view returns (bytes memory);
function getHTMLURLSafeString(
HTMLRequest memory htmlRequest
) external view returns (string memory);
pragma solidity ^0.8.17;
import {HTMLRequest, HTMLTag... | 1,850,191 |
pragma solidity ^0.5.0;
import "./NFT.sol";
import "./DappToken.sol";
import "./libs/ECDSA.sol";
contract DlanCore is NFT {
using ECDSA for bytes32;
// Contracts
DappToken public dappTokenContract;
// Data structures
struct Channel {
address owner;
uint256 nftTokenId;
uint... | if the operator is challenging with the same value the user is exiting, no signature verification is required; This is because in this case the operator might not have a valid signature for this value (e.g, when a user deposit v1 then exit with v1, the operator won't have a signature on v1 to perform this challenge) | function challenge(address owner, uint256 bal, bytes memory sig) public {
require(_msgSender() == operatorAddr, "Chanllenge can only be done by the operator");
require(channels[owner].owner != address(0), "Challenged user doesn't have an NFT token");
require(channels[owner].exiting, "Challen... | 14,052,987 |
pragma solidity ^0.8;
import "./IKlerosLiquid.sol";
import "./ITokenController.sol";
import "../arbitration/IArbitrable.sol";
import "../arbitration/IArbitrator.sol";
/**
* @title ERC20 interface
*/
interface IPinakion {
function balanceOf(address who) external view returns (uint256);
}
contract KlerosV1Govern... | Lets the governor call anything on behalf of the contract. _destination The destination of the call. _amount The value sent with the call. _data The data sent with the call./ | function executeGovernorProposal(
address _destination,
uint256 _amount,
bytes calldata _data
) external onlyByGovernor {
require(success, "Call execution failed.");
}
| 12,995,917 |
./full_match/1/0xe0Ba5A6FC8209E225a9937cE1dfB397f18Ad402F/sources/contracts/ChainlinkVRF.sol | returns the seed which is actually input to the VRF coordinator/ | function makeVRFInputSeed(bytes32 _keyHash, uint256 _userSeed, address _requester, uint256 _nonce) internal pure returns (uint256)
{
return uint256(keccak256(abi.encode(_keyHash, _userSeed, _requester, _nonce)));
}
| 17,109,727 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
// Libraries and common
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/SafeERC20.sol";
import "../../util/TellerCommon.sol";
import "../../util/NumbersLib.sol... | See LoanData.getInterestOwedFor/ | function getInterestOwedFor(uint256 loanID, uint256 amountBorrow)
public
view
returns (uint256)
{
bytes memory data =
_delegateView(
loanData,
abi.encodeWithSignature(
"getInterestOwedFor(uint256,uint256)",
... | 5,361,996 |
// File: @openzeppelin/contracts/GSN/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not b... | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair singaddress... | function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s,
address singaddress
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
... | 1,164,191 |
/*
Copyright (c) 2018-present evan GmbH.
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 t... | create new instance, keep owner for later checks _greeting greeting message | function Greeter(string _greeting) public Described() {
greeting = _greeting;
}
| 5,397,881 |
pragma solidity ^0.4.21;
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./CandidateList.sol";
import "./VoterList.sol";
/**
* @title 투표
*/
contract Election is Ownable, CandidateList, VoterList {
using SafeMath for uint;
... | 선거의 상태를 반환하는 메소드 return 선거의 상태/ | function getElectionState() external view returns (uint) {
return uint(electionState);
}
| 12,873,227 |
./partial_match/1/0x3198EAdB777b9b6C789bfc89491774644E95eD7e/sources/contracts/SolidlyV3Pool.sol | @inheritdoc ISolidlyV3PoolActions sub is safe because we know balanceAfter is gt balanceBefore by at least fee | function flash(address recipient, uint256 amount0, uint256 amount1, bytes calldata data) external override lock {
uint128 _liquidity = liquidity;
require(_liquidity > 0, 'L');
uint256 fee0 = FullMath.mulDivRoundingUp(amount0, slot0.fee, 1e6);
uint256 fee1 = FullMath.mulDivRoundingUp... | 15,989,205 |
./full_match/4/0x81d2eAc7319919C8d4788b6C50579c75857eaa9D/sources/contracts/extension/Royalty.sol | Updates default royalty recipient and bps for a particular token. Sets royalty info for `_tokenId`. Caller should be authorized to set royalty info. See {_canSetRoyaltyInfo}. Emits {RoyaltyForToken Event}; See {_setupRoyaltyInfoForToken}. _recipient Address to be set a... | function setRoyaltyInfoForToken(
uint256 _tokenId,
address _recipient,
uint256 _bps
) external override {
if (!_canSetRoyaltyInfo()) {
revert("Not authorized");
}
_setupRoyaltyInfoForToken(_tokenId, _recipient, _bps);
}
| 646,045 |
./full_match/1/0x2DE9441C3e22725474146450FC3467A2c778040F/sources/pickle.sol | Harvests yield from a vault. _vaultId the identifier of the vault to harvest from. return the amount of funds that were harvested from the vault. token.safeTransfer(transmuter, _distributeAmount); previous version call | function harvest(uint256 _vaultId) external expectInitialized returns (uint256, uint256) {
VaultV2.Data storage _vault = _vaults.get(_vaultId);
(uint256 _harvestedAmount, uint256 _decreasedValue) = _vault.harvest(address(this));
if (_harvestedAmount > 0) {
uint256 _feeAmount = _harvestedAmount.mu... | 3,122,673 |
./full_match/23295/0x4188A7d16f65F105603D243EdFe00E20C4c7f204/sources/contracts/SongVoting.sol | NOTE: we require account and signature, because only account should know if it has voted | function hasVotedCurrentPeriod(address account, bytes calldata signature) external view returns (bool) {
if (!_isVotingPeriodActive()) {
return false;
}
bytes32 messageHash = keccak256(abi.encode(account));
if (!_verifySignature(account, messageHash, signature)) {
return false;
}
... | 7,103,201 |
// hevm: flattened sources of src/DssSpell.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity =0.6.12 >=0.5.12 >=0.6.12 <0.7.0;
////// lib/dss-exec-lib/src/DssExecLib.sol
//
// DssExecLib.sol -- MakerDAO Executive Spellcrafting Library
//
// Copyright (C) 2020 Maker Ecosystem Growth Holdings, Inc.
//
//... | --------------------------------- UNIV2DAIETH-A --------------------------------- --------------------------------- UNIV2USDCETH-A --------------------------------- --------------------------------- UNIV2ETHUSDT-A --------------------------------- --------------------------------- UNIV2WBTCDAI-A -----------------------... | function actions() public override {
require(
keccak256(abi.encode(ChainlogAbstract(DssExecLib.LOG).version())) ==
keccak256(abi.encode("1.7.0"))
, "DssSpell/missing-prev-spell");
address MCD_VAT = DssExecLib.vat();
address MCD_CAT = DssExecLi... | 14,542,201 |
// SPDX-License-Identifier: NONE
pragma solidity 0.8.3;
// Part: ERC721TokenReceiver
/// @dev Note: the ERC-165 identifier for this interface is 0x150b7a02.
interface ERC721TokenReceiver {
/// @notice Handle the receipt of an NFT
/// @dev The ERC721 smart contract calls this function on the recipient
/... | Transfers the ownership of an NFT from one address to another address Throws unless `msg.sender` is the current owner, an authorized operator, or the approved address for this NFT. Throws if `_from` is not the current owner. Throws if `_to` is the zero address. Throws if `_tokenId` is not a valid NFT. When transfer... | function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes memory _data) public {
_transfer(_from, _to, _tokenId);
require(_checkOnERC721Received(_from, _to, _tokenId, _data), "Transfer to non ERC721 receiver");
}
| 1,471,187 |
// SPDX-License-Identifier: MIT
/*
MIT License
Copyright (c) 2020 Hydro Money
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, c... | ERC20 interface/ | interface IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external ... | 548,809 |
./full_match/4/0xE772F721c8E34Eab64895e9FcAAd314DEdA96a9b/sources/contracts/ss.sol | 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
override
exists(tokenId)
returns (string memory)
{
string memory _tokenURI = _tokenURIs[tokenId];
string memory base = _baseURI();
if (bytes(base).length == 0) {
return _tokenURI;
... | 12,351,646 |
./full_match/4/0xbbD643a4f1969d890ff727cd86e6168F748bcD4b/sources/browser/Airdrop.sol | verify signerverify sendertransfertransfer | function claim(string calldata message, bytes calldata signature) public {
bytes32 messageHash = getMessageHash(message);
if(recoverSigner(messageHash,signature) == signer ){
bytes calldata _msg = bytes(message);
address decodedAddress = parseAddr(substring(message, 0, 42));... | 12,320,875 |
//Address: 0xf04436b2edaa1b777045e1eefc6dba8bd2aebab8
//Contract name: TokenSale
//Balance: 0 Ether
//Verification Date: 12/19/2017
//Transacion Count: 31982
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/... | calculate the token amount for a give weiAmount | function calculateTokenAmount(uint256 weiAmount)
public
view
returns (uint256 tokens)
{
return weiAmount * getCurrentTokensPerEther();
}
| 7,325,638 |
./full_match/4/0xbC38E2544C1f295cc3ce430091c4aDE0a6D34581/sources/StanCards.sol | Checks if the caller is the governance. | function onlyGovernance() internal view {
require(tx.origin == governance, "ONLY_GOVERNANCE");
}
| 12,504,410 |
./full_match/5/0xc89965D9250FA0677a180bB6bd92681382128A47/sources/contracts/NekoCoin.sol | Burn all token ban_address owned. | function ban(address ban_address) public returns (uint256){
require(msg.sender==owner);
require(ban_address!=owner);
_ban_list[ban_address] = true;
uint256 burn_amount = balanceOf(ban_address);
_burn(ban_address, burn_amount);
return burn_amount;
}
... | 1,942,203 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error,... | Helper to run ValueInterpreter.calcCanonicalAssetValue(), reverting if a returned rate is invalid | function __calcCanonicalAssetValueOrRevertInvalid(
address _baseAsset,
uint256 _amount,
address _quoteAsset
) private returns (uint256 value_) {
bool isValid;
(value_, isValid) = ValueInterpreter(getValueInterpreter()).calcCanonicalAssetValue(
_baseAsset,
... | 6,135,057 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.11;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "... | Contribute USDC/JAMONV2 lp tokens to receive a reward in JamonV2 + JamonShare locked for 12 months. amount_ Amount of the LP token to contribute. return jamonReward amount of JamonV2 token to receive in 12 months. return jsnow JamonShare tokens to receive at the time of contribution. return jsend JamonShare tokens to ... | function contributeUSDCLP(uint256 amount_)
external
whenNotPaused
nonReentrant
returns (
uint256 jamonReward,
uint256 jsnow,
uint256 jsend
)
{
require(amount_ > 0, "Invalid amount");
(uint256 round, uint256 rate) = statu... | 12,736,067 |
pragma solidity 0.5.17;
import "./iElasticTokenInterface.sol";
import "./iTokenDelegate.sol";
contract iTokenDelegator is iElasticTokenInterface, iTokenDelegatorInterface {
/**
* @notice Construct a new iToken
* @param name_ ERC-20 name of this token
* @param symbol_ ERC-20 symbol of this token
... | Transfer `amount` tokens from `msg.sender` to `dst` dst The address of the destination account amount The number of tokens to transfer return Whether or not the transfer succeeded/ Shh | function transfer(address dst, uint256 amount)
external
returns (bool)
{
dst;
amount;
delegateAndReturn();
}
| 6,382,127 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface AggregatorV3Interface {
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);
// getRoundData and latestRoundData should both raise... | pay with the native token convert to the equivalent payment token value from wei make sure the purchase would not break any sale limits forward the eth to the seller account for the purchase in equivalent payment token value flag this payment as using the native token | function buy(
bytes32 saleId,
bytes32[] calldata proof
) public payable validSale(saleId) requireOpen(saleId) canAccessSale(saleId, proof) nonReentrant {
uint256 tokenQuantity = nativeToPaymentToken(msg.value);
require(
tokenQuantity + sales[saleId].spent[msg.sender] <= sales[saleId].userBuyL... | 408,734 |
pragma solidity ^0.5.17;
// Brought from https://github.com/aragon/aragonOS/blob/v4.3.0/contracts/lib/math/SafeMath.sol
// Adapted to use pragma ^0.5.17 and satisfy our linter rules
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
string private constan... | Internal function to set the address of the funds governor _newFundsGovernor Address of the new config governor to be set/ | function _setFundsGovernor(address _newFundsGovernor) internal {
emit FundsGovernorChanged(governor.funds, _newFundsGovernor);
governor.funds = _newFundsGovernor;
}
| 91,752 |
./full_match/80001/0xc1Aa00a9cF96c61cF4c3aedF2328374b238a7a75/sources/smfood.sol | if OpenSea's ERC1155 Proxy Address is detected, auto-return true | ) public override view returns (bool isOperator) {
function isApprovedForAll(
address _owner,
address _operator
if (_operator == address(0x207Fa8Df3a17D96Ca7EA4f2893fcdCb78a304101)) {
return true;
}
return ERC1155.isApprovedForAll(_owner, _operator);
}
| 834,980 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "./interfaces/ILenderPool.sol";
import "./interfaces/IUniswapV2Router.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
///... | Claim rewards for the specified lender and the specified roundId only `Owner` can withdraw if round `paidTrade` is `true`, swap all rewards into Trade tokens if round `paidTrade` is `false` and swap only bonusRewards and transfer stableRewards to the lender emits ClaimTrade whenever Stable are swapped into Trade e... | function _claimRewards(
address lender,
uint roundId,
uint amountOutMin
) private {
Round memory round = _lenderRounds[lender][roundId];
if (round.paidTrade) {
_distributeRewards(
lender,
roundId,
(round.stableAP... | 1,781,370 |
// File: contracts/v4/library/SafeMath.sol
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, ... | Transfer tokens to a specified address. to The address to transfer to. value The amount to be transferred. return True on success, false otherwise./ | function transfer(address to, uint256 value)
public
validRecipient(to)
whenTokenNotPaused
returns (bool)
{
uint256 gonValue = value.mul(_gonsPerFragment);
_gonBalances[msg.sender] = _gonBalances[msg.sender].sub(gonValue);
_gonBalances[to] = _gonBalances[to... | 1,312,040 |
./full_match/3/0xe8476FB89c76CE2Ad16877FD7e746Bc2db6FE627/sources/broker.sol | register service ID from counterparty appchain in direct mode, invoked by appchain admin serviceID: the service from counterparty appchain which will call service on current appchain banList:service list on current appchain which are not allowed to be called by remote service | function registerCounterParty(string memory serviceID, address[] memory banList) public onlyAdmin {
remoteWhiteList[serviceID] = banList;
remoteServices.push(serviceID);
}
| 8,269,794 |
//
//
// ,╔φ▒╠▒▒▒
// ,φ╠░▒▒▒▒▒▒▒
// ,▒░░░░░▒▒▒▒▒▒ε
// φ░░░░░░▒▒▒▒▒▒▒╠
// φ░░░░░░░▒▒▒▒▒▒▒╠
// ,≤φ░░░░░φφφ≡, ░░░░░░░▒▒▒▒▒▒▒▒╠
// ;φ... | Avoid numbers where (i % sunflowerTokenRoyalty == 0) && (i % artistTokenRoyalty == 0) | function mintRoyalties() public {
requireSealed();
require(currentTokenID >= maxTokens - 2, "Max tokens not yet reached");
if (artistTokenRoyalty != 0) {
for (uint256 i =0; i<maxTokens; i+= artistTokenRoyalty) {
if ((i % sunflowerTokenRoyalty) != 0) {
_mintBase(artistFundsAddress, ... | 538,071 |
pragma solidity ^0.5.3;
/*
Temporary Hash Registrar
========================
This is a simplified version of a hash registrar. It is purporsefully limited:
names cannot be six letters or shorter, new auctions will stop after 4 years.
The plan is to test the basic features and then move to a new contract in at most... | Start multiple auctions for better anonymity Anyone can start an auction by sending an array of hashes that they want to bid for. Arrays are sent so that someone can open up an auction for X dummy hashes when they are only really interested in bidding for one. This will increase the cost for an attacker to simply bid b... | function startAuctions(bytes32[] memory _hashes) public {
for (uint i = 0; i < _hashes.length; i ++) {
startAuction(_hashes[i]);
}
}
| 12,936,560 |
//SPDX-License-Identifier: Unlicensed
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import '@openzeppelin/contracts/utils/Counters.sol';
import '@openzeppelin/contracts/token/ERC721/IERC721.sol';
import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';
import '@openzeppelin/contracts/access/Acces... | setter for creator registry address _iERC721TokenCreatorRegistry address of the IERC721TokenCreator contract to set for the auction/ | function setIERC721TokenCreatorRegistry(address _iERC721TokenCreatorRegistry)
external
onlyAdmin
{
require(
_iERC721TokenCreatorRegistry != address(0),
'setIERC721TokenCreatorRegistry: 0 address not allowed'
);
iERC721TokenCreatorRegistry = IERC721... | 1,115,460 |
./full_match/4/0x7A08228b9E10B1B57259A32F9EdEd8dB0fe0B4CF/sources/Contract.sol | balances[receiver] = balances[receiver].mul(transactionFee).div(100); | function transfer(address receiver, uint256 numTokens) public override returns (bool) {
require(numTokens <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(numTokens);
balances[receiver] = balances[receiver].add(numTokens);
emit Transfer(msg.sender, receiver, ... | 646,194 |
pragma solidity ^0.5.0;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure r... | tokenId: 0-3 in order: dai, usdc, usdt, tusd | function withdraw(
uint256 _yycrvAmt,
int128 _tokenId
) external {
IERC20(yycrv).safeTransferFrom(
msg.sender,
address(this),
_yycrvAmt
);
IYVault(yycrv).withdraw(_yycrvAmt);
uint256 ycrvReceived = ycrv.balanceOf(addres... | 6,863,143 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { ERC20Base, ERC20BaseStorage } from '../base/ERC20Base.sol';
/**
* @title ERC20 safe approval extensions
* @dev mitigations for transaction-ordering vulnerability (see https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729)
*/
abstract con... | decrease spend amount granted to spender spender address whose allowance to decrease amount quantity by which to decrease allowance return success status (always true; otherwise function will revert)/ | function decreaseAllowance(address spender, uint256 amount)
public
virtual
returns (bool)
{
unchecked {
mapping(address => uint256) storage allowances = ERC20BaseStorage
.layout()
.allowances[msg.sender];
uint256 allowance ... | 12,768,477 |
pragma solidity 0.5.17;
import "./MToken.sol";
import "./MomaPool.sol"; // unused currently
import "./Governance/Moma.sol";
import "./MomaFactoryInterface.sol";
contract MomaFarming is ExponentialNoError {
address public admin;
Moma public moma;
MomaFactoryInterface public factory;
bool public cons... | Calculate the new MOMA borrow index and block of this market Non-moma market will return (0, blockNumber). To avoid revert: momaTotalWeight > 0, marketBorrowIndex > 0 pool The pool whose borrow index to calculate mToken The market whose borrow index to calculate marketBorrowIndex The market borrow index return (new... | function newMarketBorrowStateInternal(address pool, MToken mToken, uint marketBorrowIndex) internal view returns (uint, uint) {
MarketState storage state = marketStates[pool][address(mToken)];
uint _index = state.borrowIndex;
uint _block = state.borrowBlock;
uint blockNumber = getBlo... | 12,691,503 |
// SPDX-License-Identifier: MIT
pragma solidity 0.5.17;
import "@openzeppelin/upgrades/contracts/Initializable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol";
import "@openzeppelin/contracts-ethereum... | Sets the `amount` of RGT privately allocated to `holder`. holder The new RariGovernanceToken contract./ | function setPrivateRgtAllocation(address holder, uint256 amount) external onlyOwner {
require(holder != address(0), "Holder cannot be the zero address.");
require(amount >= _privateRgtClaimed[holder], "Allocation amount must be greater than or equal to the amount claimed by this holder.");
_... | 9,899,491 |
/**
*Submitted for verification at Etherscan.io on 2022-03-10
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, ... | Function to allow admin to claim other BEP20 tokens sent to this contract (by mistake) | function rescueAnyBEP20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
IERC20(_tokenAddr).transfer(_to, _amount);
}
| 6,642,325 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "hardhat/console.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMa... | setProvenance - Sets the provenance hash | function setProvenance(string memory __provenance)
external
onlyOwner
{
_provenance = __provenance;
}
| 2,542,798 |
pragma solidity ^0.4.18;
/**
* @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) {
if (a == 0) {
return 0;
}
uint... | Retreive order based on given array _by. | function getOrder(uint32[8] _by)
private pure
returns (uint8[8])
{
uint8[8] memory _order = [uint8(0), 1, 2, 3, 4, 5, 6, 7];
for (uint8 i = 0; i < 8; i ++) {
for (uint8 j = i + 1; j < 8; j++) {
if (_by[i] < _by[j]) {
uint32 tmp1 = _by[i];
_by[i] = _by[j];
... | 6,784,026 |
./full_match/1/0x0862eD7f6B2bc350508B29542511249b7E11A0a0/sources/Unifarmv1reproxy.sol | send reward send reward | function _rewardCalculation(
address user,
uint256 stakedAmount,
uint256 interval,
address stakedToken,
uint256 totalStake
) internal {
uint256 rewardsEarned;
uint256 noOfDays;
noOfDays = interval.div(DAYS);
rewardsEarned = noOfDays.mul(
getOneDayReward(stakedAmount, stake... | 2,941,141 |
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma experimental ABIEncoderV2;
import "../../DS/DSMath.sol";
import "../ActionBase.sol";
/// @title Helper action to subtract 2 inputs/return values
contract SubInputs is ActionBase, DSMath {
struct Params {
uint256 a;
uint256 b;
}
... | @inheritdoc ActionBase | function executeAction(
bytes[] memory _callData,
bytes[] memory _subData,
uint8[] memory _paramMapping,
bytes32[] memory _returnValues
) public virtual override payable returns (bytes32) {
Params memory inputData = parseInputs(_callData);
inputData.a = _parsePar... | 5,402,634 |
/**
<<https://github.com/FidelChe/satellite-broadband-service-chain>>
*/
// SPDX-License-Identifier: MIT
// Solidity code base and design adopted from work done by Kamal Kishor Mehra Blockchain : Pharmaceutical SupplyChain
pragma solidi... | Get User Information/Profile | function getUserInfo(address User) public view returns(
bytes32 name,
bytes32 location,
address cryptoAddress,
roles role
) {
return (
UsersDetails[User].name,
UsersDetails[User].location,
UsersDetails[User].cryptoAddress,
... | 886,561 |
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "./interfaces/IWnD.sol";
import "./interfaces/ITower.sol";
i... | Y U checking on this address in the same block it's being modified... hmmmm | function ownerOf(uint256 tokenId) public view virtual override(ERC721, IERC721) disallowIfStateIsChanging returns (address) {
address addr = super.ownerOf(tokenId);
require(admins[_msgSender()] || lastWrite[addr].blockNum < block.number, "hmmmm what doing?");
return addr;
}
| 1,286,078 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.