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/137/0xC71a0306a0A628C616DAC42097bDc21EcDBc5d9d/sources/contracts/ERC721Raffle.sol | `third` is a quantity of USDC tokens that are transferred from the caller's wallet into the prize pool for the winning Box. `second` is a quantity of USDC tokens that are transferred from the caller's wallet into the prize pool for the winning Row. `first` is a quantity of USDC tokens that are transferred from the call... | function addPrize(uint256 third, uint256 second, uint256 first) external onlyOwner {
require(usdcToken.transferFrom(_msgSender(), address(this), third + second + first), "Failed to transfer USDC");
prizePools.third += uint64(third);
prizePools.second += uint64(second);
prizePools.first += uint64(first);
}
| 3,517,015 |
./partial_match/1/0x43eA73168B8f192dBDEC088DA29F2C5E517f6fcB/sources/contracts-verify/libraries/WadRayMath.sol | Divides two ray, rounding half up to the nearest ray a Ray b Ray return c = a raydiv b/ to avoid overflow, a <= (type(uint256).max - halfB) / RAY | function rayDiv(uint256 a, uint256 b) internal pure returns (uint256 c) {
assembly {
c := div(add(mul(a, RAY), div(b, 2)), b)
}
}
| 15,921,160 |
./full_match/5/0xcc65Ea1d651ee8ACA6B8a0ba140221032aB73380/sources/lottoGratuity.sol | Swaps the beneficiary for a given beneficiary number. beneficiaryNumber The number of the beneficiary to swap. beneficiary The new beneficiary address. gratuity The gratuity to be paid to the new beneficiary. This function swaps the beneficiary for a given beneficiary number. It requires that the caller is the curr... | function _swapBeneficiary(
uint256 beneficiaryNumber,
address beneficiary,
uint256 gratuity
) internal virtual {
Beneficiary memory tmpBene = beneficiaryGratuity()[beneficiaryNumber];
require(tmpBene.beneficiary == _msgSender(), "only current can swap");
require(b... | 7,084,919 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
library SafeMath {
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
function trySub(uint256 a, uint256 b)... | Ledger Functions / | function addLedger(address address_, address pool_) public onlyOwner returns (bool) {
_ledgerMap[address_] = pool_;
uint rowCount = _ledgerList.length;
bool blnInsert = true;
if (rowCount > 0){
for (uint i = 0; i < rowCount; i++) {
if ( _ledgerList[i] == a... | 2,496,509 |
... | inject NONSTANDARD NAMING | function NAME28() public view returns (string memory) { | 6,418,016 |
./full_match/80001/0x809420EEE145CE61be213Bd4AE40885cE8b11E8e/sources/solady/src/utils/LibString.sol | Returns an UPPERCASED copy of the string. WARNING! This function is only compatible with 7-bit ASCII strings. | function upper(string memory subject) internal pure returns (string memory result) {
result = toCase(subject, true);
}
| 840,186 |
pragma solidity ^0.5.0;
contract HalfRouletteEvents {
event Commit(uint commit); // 배팅
event Payment(address indexed gambler, uint amount, uint8 betMask, uint8 l, uint8 r, uint betAmount); // 결과 처리
event Refund(address indexed gambler, uint amount); // 결과 처리
event JackpotPayment(address indexed g... | Memory copy. Full 32 byte words | function memcpy(uint dest, uint src, uint len) pure private {
for (; len >= 32; len -= 32) {
dest += 32;
src += 32;
}
assembly {
let srcpart := and(mload(src), not(mask))
let destpart := and(mload(dest), mask)
mstore(dest, or(destp... | 1,050,610 |
/*
This file is part of The Colony Network.
The Colony Network 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.
The Colony Netwo... | Transfer token remainder to the network Check this contract balances in the working tokens is 0 before we kill it | function destruct() public
auctionFinalized
allBidsClaimed
{
uint auctionTokenBalance = token.balanceOf(this);
token.transfer(colonyNetwork, auctionTokenBalance);
assert(clnyToken.balanceOf(this) == 0);
assert(token.balanceOf(this) == 0);
selfdestruct(colonyNetwork);
}
| 12,613,510 |
pragma solidity ^0.4.15;
/**
* @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 || c / a == b);
return c;
}
function div(uint256 a, uint256 ... | function that sells available tokens/ Calculate tokens to sell Calculate Bonus | function buyTokens() payable whenSaleIsActive {
uint256 weiAmount = msg.value;
uint256 tokens = weiAmount.mul(RATE);
uint256 bonus = 0;
if (now <= START.add(7 days)) {
bonus = tokens.mul(30).div(100);
bonus = tokens.mul(25).div(100);
bonus = tokens.mul(20).div(100);
bonus = t... | 10,863,048 |
pragma solidity ^0.5.13;
import "./ValTokenWithHook.sol";
import "./ValSafeMath.sol";
import { StakingAsset } from "./StakingAsset.sol";
/**
* @title Abstract StakedToken
* @dev Single token staking model for ERC-20
* StakedToken represents a share in an Assurace Pool.
* Accounts stake ERC-20 staking asset and re... | Deposit stake into the pool. _amount amount to deposit./ | function deposit(uint256 _amount) external {
require(stakeAsset().transferFrom(msg.sender, address(this), _amount));
}
| 12,859,247 |
pragma solidity 0.6.12;
import '@sphynxswap/sphynx-swap-lib/contracts/math/SafeMath.sol';
import '@sphynxswap/sphynx-swap-lib/contracts/token/BEP20/IBEP20.sol';
import '@sphynxswap/sphynx-swap-lib/contracts/token/BEP20/SafeBEP20.sol';
import '@sphynxswap/sphynx-swap-lib/contracts/access/Ownable.sol';
import './Sphynx... | Transfers management of the contract to a new account (`newManager`)./ | function _transferManagement(address newManager) internal {
require(newManager != address(0), 'Manageable: new manager is the zero address');
emit ManagementTransferred(_manager, newManager);
_manager = newManager;
}
| 1,357,292 |
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
pragma solidity ^0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(a... | Calculates and distributes the amount of fee proportionally between registered reward addresses. _feeType type of the updated fee, can be one of [HOME_TO_FOREIGN_FEE, FOREIGN_TO_HOME_FEE]. _token address of the token contract for which fee should apply, 0x00..00 describes the initial fee for newly created tokens. _v... | function _distributeFee(bytes32 _feeType, address _token, uint256 _value) internal returns (uint256) {
uint256 numOfAccounts = rewardAddressCount();
uint256 _fee = calculateFee(_feeType, _token, _value);
if (numOfAccounts == 0 || _fee == 0) {
return 0;
}
uint256 f... | 1,401,950 |
pragma solidity 0.5.6;
contract ArianeeWhitelist {
function addWhitelistedAddress(uint256 _tokenId, address _address) external;
}
contract ArianeeStore{
function canTransfer(address _to,address _from,uint256 _tokenId) external returns(bool);
function canDestroy(uint256 _tokenId, address _sender) external r... | The recovery timestamp for a given Token ID. Throws if `_tokenId` is not a valid NFT. _tokenId Id for which we want the recovery timestamp. return Recovery timestamp of _tokenId./ | function tokenRecoveryDate(uint256 _tokenId) external view returns(uint256 _tokenRecoveryTimestamp){
require(idToOwner[_tokenId] != address(0), NOT_VALID_NFT);
_tokenRecoveryTimestamp = certificate[_tokenId].tokenRecoveryTimestamp;
}
| 1,831,614 |
// Sources flattened with hardhat v2.6.4 https://hardhat.org
// Etherscan verify via api is broken right now it appears
// File @openzeppelin/contracts/utils/Strings.sol@v4.0.0
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant alph... | Mint the domains after they have been purchased At this point, domainsSold will already assume these domains are sold | function _sendDomains(uint256 numPurchased) internal {
for (uint256 i = 0; i < numPurchased; ++i) {
uint256 index = domainsSold - numPurchased + i;
zNSRegistrar.transferFrom(
address(holderWallet),
msg.sender,
zNSRegistrar.tokenByIndex(index)
);
}
}
| 10,004,952 |
./full_match/43113/0xf30298fe66FEbCbbEcF2f79EAdDaB16F2Ad02023/sources/docs.chain.link/samples/PriceFeeds/PriceConsumerMuliple.sol | Returns the latest price/ | function getLatestPrice(uint8 decimal) public view returns (priceStrut[] memory) {
priceStrut[] memory prices = new priceStrut[](5);
prices[0] = priceStrut("AVAX/USD", getPrice(avalance_avax_usd_price_feed, decimal));
prices[1] = priceStrut("AVAX/BTC", getDerivedPrice(avalance_avax_usd_price... | 7,163,662 |
/**
*Submitted for verification at Etherscan.io on 2021-10-29
*/
pragma solidity ^0.5.9;
pragma experimental ABIEncoderV2;
/*
Copyright 2019 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... | converting to arrays for use in function Ensure that no extra WETH owned by this contract has been spent.dust | function BuyOrderWithEth(
LibOrder.Order memory order,
uint256 makerAssetBuyAmount,
bytes memory signature,
uint256 refEthFeeAmount,
address payable refRecipient
)
public
payable
returns (
uint256 orderwethSpentAmount,
uint2... | 2,221,092 |
./partial_match/56/0x5d237401f94B0E5F8191f155aD9f60970dd8dBB2/sources/CLOCKStake.sol | ------------------------------------------------------------------------ Get the CLOCK balance of the token holder user the address of the token holder ------------------------------------------------------------------------ | function yourCLOCKBalance(address user) external view returns(uint256 CLOCKBalance){
require(user != address(0), "ERC20: sending to the zero address");
return IERC20(CLOCK).balanceOf(user);
}
| 11,164,236 |
./full_match/43113/0xF3c88f08927e321097BC85Ccfd685E56FF2dd0D1/sources/nft.sol | Calculate pricing Return prices index multiply with factor./ | function getPrice() public view returns (uint256) {
uint256 supply = totalSupply();
uint256 length = _prices.length - 1;
uint256 square = SafeMath.mul(_row, _column);
uint256 index = SafeMath.div(supply, square);
if(price.status == true){
return price.value;
... | 7,180,645 |
pragma solidity 0.5.9;
/**
* https://rekt.fyi
*
* Mock the performance of your friend's ETH stack by sending them a REKT token, and add a bounty to it.
*
* REKT tokens are non-transferrable. Holders can only burn the token and collect the bounty once their
* ETH balance is m times higher or their ETH i... | Bump the multiplier up or down. Multiplier has PRECISION precision and is rounded down unless the unrounded value hits the MULTIPLIER_CEILING or MULTIPLIER_FLOOR. _up Boolean representing whether the direction of the bump is up or not. amount = (value/price)bonusincrement | function bump(bool _up) external payable shutdownNotActive {
require(msg.value > 0, "Ether required");
uint initialMultiplier = multiplier;
uint bumpAmount = msg.value
.wdiv(bumpBasePrice)
.wmul(getBonusMultiplier(msg.sender))
.wmul(BUMP_INCREMENT);
... | 1,033,112 |
// SPDX-License-Identifier: MIT
// Copyright 2021 Mosaic Labs UG, Berlin
pragma solidity >=0.8.0 <0.9.0;
import "./IERC20Burnable.sol";
import "hardhat/console.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
// import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
/**
* @title Raffle c... | Draw raffle once the future block hashes are known to randomize the raffle. Note that only the last 256 ethereum block hashes are available to the EVM so if too much time has passed, then the raffle must be reshuffled first./ | function drawRaffle(
uint256 _index
)
external
isInPrecommittedPhase(_index)
{
uint256 endBlock = timeWindows[_index];
uint256 beginBlock = endBlock + uint256(1) - ENTROPY_LENGTH;
require(
endBlock < block.number,
"The entropy window mu... | 935,809 |
pragma solidity ^0.4.17;
import "zos-lib/contracts/Initializable.sol";
import "zeppelin-solidity/contracts/MerkleProof.sol";
import "zeppelin-solidity/contracts/token/ERC20.sol";
import "zeppelin-solidity/contracts/math/SafeMath.sol";
/**
* @title MerkleMine
* @dev Token distribution based on providing Merkle proo... | Start the generation period - first checks that this contract's balance is equal to `totalGenesisTokens` The generation period must not already be started/ Check that this contract has a sufficient balance for the generation period | function start() external isNotStarted {
require(token.balanceOf(this) >= totalGenesisTokens);
started = true;
}
| 5,360,572 |
/**
*Submitted for verification at Etherscan.io on 2021-09-29
*/
// Contract based on https://docs.openzeppelin.com/contracts/4.x/erc721
// SPDX-License-Identifier: MIT
// Pixel PepePunks // pepunks.com //
pragma solidity ^0.8.0;
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
... | See {ERC721Premint}./ | function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, IERC165) returns (bool) {
return
interfaceId == type(IERC721Enumerable).interfaceId ||
super.supportsInterface(interfaceId);
}
| 2,221,590 |
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma experimental ABIEncoderV2;
import "../helpers/LiquityHelper.sol";
import "../../../utils/TokenUtils.sol";
import "../../ActionBase.sol";
contract LiquityOpen is ActionBase, LiquityHelper {
using TokenUtils for address;
struct Params {
ui... | @inheritdoc ActionBase | function executeAction(
bytes[] memory _callData,
bytes[] memory _subData,
uint8[] memory _paramMapping,
bytes32[] memory _returnValues
) public payable virtual override returns (bytes32) {
Params memory params = parseInputs(_callData);
params.maxFeePercentage = ... | 5,390,608 |
./full_match/42220/0x1a8Dbe5958c597a744Ba51763AbEBD3355996c3e/sources/home/home/dotfiles/poofcelo/contracts/RewardsCELO.sol | Deposits wrappedCelo to the contract in exchange for RewardsCELO (pCELO) tokens. pCELO to mint is determined by the equivalence: savingsToCELO(toDeposit) / nextTotalSupplyCELO = toMint / (this.totalSupply() + toMint) and solving for `toMint`. toDeposit amount of wrappedCelo to deposit wrappedCeloIdx index of wrappedC... | function deposit(uint256 toDeposit, uint256 wrappedCeloIdx) external nonReentrant {
require(toDeposit > 0, "Can't deposit a zero amount");
require(wrappedCeloIdx < wrappedCelos.length, "wrappedCeloIdx out of bounds");
IWrappedCelo wrappedCelo = wrappedCelos[wrappedCeloIdx];
require(bans[address(wrappe... | 16,336,002 |
./partial_match/42/0x88278FA799bd151756C9b68b76D57a38Bb0b51Fc/sources/eMTV.sol | Burns a specific amount of tokens. Only an address listed in `isBurner` can do this. _value The amount of token to be burned./ | function burn(uint256 _value) public onlyBurner {
super.burn(_value);
}
| 3,406,273 |
./full_match/1/0x59D55D53a715b3B4581c52098BCb4075C2941DBa/sources/contracts/protocol/modules/v1/AuctionRebalanceModuleV1.sol | Calculates the protocol fee based on the tokens received during the bid and transfers it from the SetToken to the protocol recipient. _bidInfo Struct containing information related to the bid. return uint256 The amount of the received tokens taken as a protocol fee./ Calculate the amount of tokens exchanged during t... | function _accrueProtocolFee(BidInfo memory _bidInfo) internal returns (uint256) {
IERC20 receiveToken = IERC20(_bidInfo.receiveToken);
ISetToken setToken = _bidInfo.setToken;
uint256 exchangedQuantity = receiveToken.balanceOf(address(setToken))
.sub(_bidInfo.preBidTokenReceivedB... | 3,851,279 |
pragma solidity ^ 0.5.11;
contract PoWHr{
// scaleFactor is used to convert Ether into bonds and vice-versa: they're of different
// orders of magnitude, hence the need to bridge between the two.
uint256 constant scaleFactor = 0x10000000000000000;
int constant crr_n = 1;
int constant crr_d = 2;
int constant pub... | This allows you to buy bonds by sending Ether directly to the smart contract without including any transaction data (useful for, say, mobile wallet apps). msg.value is the amount of Ether sent by the transaction. | function () payable external {
if (msg.value > 0) {
fund();
withdraw( resolveEarnings(msg.sender) );
}
}
| 12,792,472 |
./full_match/84531/0xaBf20d6c101bd3DD955902056a4aE277faf8d62f/sources/project:/contracts/seedify-fund.sol | ========== OWNER FUNCTION ========== / | function setTiers(uint256[] calldata minCaps, uint256[] calldata maxCaps) public onlyOwner {
require(minCaps.length == 6, "array lenth must eval to 6");
require(minCaps.length == maxCaps.length, "maxCaps and minCaps must have a same length");
for (uint i = 0; i < 6; i++) {
tierDe... | 11,502,026 |
./full_match/1/0xF5abAdec1bcb7d79D0E972981F13D731D5d06aA8/sources/contracts/loyalty/GenArtLoyaltyVault.sol | Update reward for a user account _user address of the user/ | function _updateReward(address _user) internal {
if (block.number != lastUpdateBlock) {
rewardPerTokenStored = _rewardPerShare();
lastUpdateBlock = _lastRewardBlock();
}
userInfo[_user].rewards = _calculatePendingRewards(_user);
userInfo[_user].userRewardPerT... | 4,883,610 |
./full_match/11155111/0x5d258eb7400E468239Da08A0965e5be182445170/sources/contracts/Nevo.sol | Store the minter's address | function mint(string memory name, address user, string memory tokenURI) public payable returns (uint256) {
uint256 tokenId = _tokenIds.current();
_mint(user, tokenId);
_setTokenURI(tokenId, tokenURI);
tokenNames[tokenId] = name;
_tokenIds.increment();
... | 3,786,722 |
/**
*Submitted for verification at Etherscan.io on 2021-02-12
*/
pragma solidity 0.8.0;
pragma abicoder v2;
interface MassetStructs {
struct BassetPersonal {
// Address of the bAsset
address addr;
// Address of the bAsset
address integrator;
// An ERC20 can charge transfe... | Get the projected output of a given mint _inputs Non-duplicate address array of addresses to bAssets to deposit for the minted mAsset tokens. _inputQuantities Quantity of each bAsset to deposit for the minted mAsset. return mintOutput Estimated mint output in mAsset terms/ | function getMintMultiOutput(address[] calldata _inputs, uint256[] calldata _inputQuantities)
external
view
override
returns (uint256 mintOutput)
{
uint256 len = _inputQuantities.length;
require(len > 0 && len == _inputs.length, "Input array mismatch");
(ui... | 2,378,750 |
/**
*Submitted for verification at Etherscan.io on 2020-11-01
*/
pragma solidity ^0.5.10;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public... | Function to stop minting new tokens. return True if the operation was successful./ | function finishMinting() onlyOwner public canMint returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
| 5,392,519 |
/*
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, ... | Calculates partial value given a numerator and denominator. Reverts if rounding error is >= 0.1% numerator Numerator. denominator Denominator. target Value to calculate partial of. return Partial value of target. | function publicSafeGetPartialAmountCeil(
uint256 numerator,
uint256 denominator,
uint256 target
)
public
pure
returns (uint256 partialAmount)
{
return safeGetPartialAmountCeil(numerator, denominator, target);
}
| 5,455,225 |
./full_match/3/0x3c528EcF7A2e5D70A717A8d0e5daf0A18021cCB5/sources/browser/contracts/BRLx.sol | Usuário quer vender UtilityTokens em troca de BRLx um usuário chamou uma função do UTIL e queimou `tokens` tokens; recebemos um callback para mintar X BRLx para o usuário em troca do burn que ele efeutou; | function onTokensBurnedForTrade(address sender, uint tokens) public onlyUtilityToken whenNotPaused {
require(tokens > 0, "Must send at least 1 token");
uint quote = quotes[msg.sender];
require(quote > 0, 'Quote not found');
uint tokensToMint = tokens * quote / 10000;
emit ... | 8,148,777 |
./full_match/4/0x259d29f29ce99e49959974F83F115C6f7352C697/sources/contracts/leo.sol | const Message payload e: data }; const encrypted = await EthCrypto.encryptWithPublicKey( publicKeyLeo, by encryping with bobs publicKey, only bob can decrypt the payload with his privateKey JSON.stringify(data) we have to stringify the payload before we can encrypt it ); const encryptedString = EthCrypto.ciph... | function messageVulcan(string calldata data) public {
IVulcanApplication(va_addr).sendApplication(bytes(data));
}
| 12,363,243 |
pragma solidity 0.4.25;
// File: contracts/ERC777/ERC20Token.sol
/* This Source Code Form is subject to the terms of the Mozilla external
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This code has not been reviewed.
... | Unauthorize all official operators to manage `msg.sender`'s tokens. | function rejectAllOfficialOperators() external {
require(!mIsUserNotAcceptingAllOfficialOperators[msg.sender], "Official operators are already rejected by msg.sender.");
mIsUserNotAcceptingAllOfficialOperators[msg.sender] = true;
emit OfficialOperatorsRejectedByUser(msg.sender);
}
| 7,310,119 |
// our mirrors:
// ftec.io
// ftec.ai
// our official Telegram group:
// t.me/FTECofficial
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
... | Transfer tokens to buyer. Update total stats: Split received amount between balances of three beneficiaries. | function sellTokensForEth(
address _buyer,
uint256 _amountWei
) ifNotPaused internal {
require(startTime <= now && now <= endTime);
require(_amountWei >= minPaymentWei);
require(totalWeiReceived.add(_amountWei) <= maxCapWei);
uint tokensE18 = weiToToken... | 7,298,367 |
./partial_match/1/0x6DC6fd523A9F54BC6640e810f5b53d90AB270f11/sources/pepe.sol | exclude from paying fees or having max transaction amount | constructor() ERC20(unicode"pepe ccoin", unicode"pepe") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
unis... | 15,525,190 |
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/helpers/PointerLibraries.sol | Reads the int216 at `cdPtr` in calldata. | function readInt216(
CalldataPointer cdPtr
) internal pure returns (int216 value) {
assembly {
value := calldataload(cdPtr)
}
}
| 4,300,328 |
./partial_match/1313161554/0xa200B567579a577F582d292f7A1b5C4ecce195F8/sources/Comptroller.sol | Claim all PLY or AURORA accrued by one holder Only whitelisted address can claim the rewards for other users. This is to prevent users to lock others' reward into token lock. rewardType 0: Ply, 1: Aurora holder The address to claim PLY / AURORA for auTokens The list of markets to claim PLY / AURORA in borrowers W... | function _claimRewardForOne(uint8 rewardType, address holder, AuToken[] memory auTokens, bool borrowers, bool suppliers) internal {
checkRewardType(rewardType);
require(borrowers||suppliers,"either borrow or supply must be true");
require(isAllowedToClaimReward(holder, msg.sender), "not appr... | 16,936,513 |
./full_match/80001/0xa804650B1C4Ff76A4EF10eaEbBFAa9bE5e81E32e/sources/contracts/ERC721NESStakingController.sol | Stakes a token and records the start block number or time stamp./ | function stake(uint256 tokenId) public {
require(
ERC721NES(tokenContract).ownerOf(tokenId) == msg.sender,
"You are not the owner of this token"
);
tokenToWhenStaked[tokenId] = block.number;
ERC721NES(tokenContract).stakeFromController(tokenId, msg.sender);
... | 9,446,347 |
./full_match/80001/0xeA2F671AFB61B6ca8Eb2290f91aBfF425bA083f2/sources/project_/contracts/Seller.sol | EUR-USD STABLE_COIN-USD STABLE_COIN-EUR => How many Stable Coins for one Euro | function getPriceOneEuroStableCoin() internal view returns(int256) {
int256 decimals = int256(10 ** uint256(18));
( , int256 basePrice, , , ) = S_PRICE_FEED_EUR_USD.latestRoundData();
uint8 baseDecimals = S_PRICE_FEED_EUR_USD.decimals();
basePrice = scalePrice(basePrice, baseDecimal... | 5,614,177 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
contract AMM {
using SafeMath for uint256;
uint totalShares; // Stores the total amount of share issued for the pool
uint totalToken1; // Stores the amount of Token1 locked in the poo... | Swaps given amount of Token2 to Token1 using algorithmic price determination | function swapToken2(uint256 _amountToken2) external activePool validAmountCheck(token2Balance, _amountToken2) returns(uint256 amountToken1) {
amountToken1 = getSwapToken2Estimate(_amountToken2);
token2Balance[msg.sender] -= _amountToken2;
totalToken2 += _amountToken2;
totalToken1 -= amountToken1;
... | 5,372,384 |
./partial_match/56/0xfc96E7d7EECf17523f09023e650318C0bbf2d1Ba/sources/ABCToken.sol | 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/ | function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())... | 11,256,858 |
./full_match/42161/0xc6CcA907A475a70B2052582A0d52674d997a2c67/sources/contracts/EscrowAndStaking/StakingThales.sol | Claim the weekly staking rewards on behalf of the account account to claim on behalf of | function claimRewardOnBehalf(address account) public nonReentrant notPaused {
require(account != address(0) && account != msg.sender, "Invalid address");
require(canClaimOnBehalf[account][msg.sender], "Cannot claim on behalf");
_claimReward(account);
}
| 16,302,273 |
./full_match/42161/0x8B87E0b9a093B4f209F26Bd5ca664B7C6986220F/sources/contracts/StandWithCrypto.sol | Function to update the status of free and paid selfdrop | function updateSelfdrop(bool _enableFREE, bool _enablePAID) external onlyOwner {
enableFREE = _enableFREE;
enablePAID = _enablePAID;
}
| 16,309,813 |
./partial_match/1/0xEC233143B85892dd6A6E2dc48D7F73aF728d7164/sources/alch.sol | Updates `owner` s allowance for `spender` based on spent `amount`. Does not update the allowance amount in case of infinite allowance. Revert if not enough allowance is available. Might emit an {Approval} event./ | function _spendAllowance(
address owner,
address spender,
uint256 amount
) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(
currentAllowance >= amount,
... | 2,622,284 |
./full_match/5/0xB679452E6E41d7CeAa70D59A0f6F756F0362571A/sources/contracts/OratisNFT.sol | Update the public mint price in usdc. 6 decimal places _usdcPublicPrice the price per NFT in USDC. Remember 6 decimal places./ | function setUsdcPublicPrice(uint256 _usdcPublicPrice) external onlyOwner {
usdcPublicPrice = _usdcPublicPrice;
}
| 11,589,644 |
./full_match/1/0x08e2dd6A661d91C3Aa8b8E4ac1342a3C60be6857/sources/YGGD.sol | this method is responsible for taking all fee, if takeFee is true | function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
| 2,906,931 |
// SPDX-License-Identifier: MIT
// _ ______________ ____________
// / | / / ____/_ __/__ / ____/ ____/_________ ____ ___
// / |/ / /_ / / / _ \/ / __/ / __ / ___/ __ \/ __ `__ \
// / /| / __/ / / / __/ /_/ / /_/ // /__/ /_/ / / / / / /
// /_/ |_/_/ /_/ \___/\____/\_... | Used to approve the recovery of stuck token, also in future./ | function recoverERC721ApproveAll(address token, address recipient, bool approved) external onlyOwner {
return IERC721(token).setApprovalForAll(recipient, approved);
}
| 1,094,356 |
pragma solidity ^0.4.24;
// File: ..\openzeppelin-solidity\contracts\math\SafeMath.sol
/**
* @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 return... | / UPDATE the renaming cost UPDATE the market fees UPDATE the legit dev addresses list ADD a horse index to exchange PAUSE/UNPAUSE the dApp UPDATE carrots multiplier UPDATE rarity multiplier | function _doProposal() internal {
if( currentProposal.methodId == 0 ) HorseyToken(tokenAddress).setRenamingCosts(currentProposal.parameter);
if( currentProposal.methodId == 1 ) HorseyExchange(exchangeAddress).setMarketFees(currentProposal.parameter);
if( currentProposal.methodId ==... | 2,309,550 |
pragma solidity ^0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address ... | Transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./ | function transfer(address _to, uint256 _value) onlyPayloadSize(2 * 32) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _v... | 6,728,477 |
pragma solidity ^0.6.1;
pragma experimental ABIEncoderV2;
import "./IBusinessPartnerStorage.sol";
import "./IEternalStorage.sol";
import "./IAddressRegistry.sol";
import "./Ownable.sol";
import "./Bindable.sol";
import "./StringConvertible.sol";
contract BusinessPartnerStorage is IBusinessPartnerStorage, Ownable, Bin... | Configure contract nameOfEternalStorage key of the entry in the address registry that holds the eternal storage contract address Eternal storage | function configure(string memory nameOfEternalStorage) onlyOwner() override public
{
eternalStorage = IEternalStorage(addressRegistry.getAddressString(nameOfEternalStorage));
require(address(eternalStorage) != address(0), "Could not find EternalStorage address in registry");
}
| 894,345 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9;
/// @notice Emitted when the result overflows uint256.
error PRBMath__MulDivFixedPointOverflow(uint256 prod1);
/// @notice Emitted when the result overflows uint256.
error PRBMath__MulDivOverflow(uint256 prod1, uint256 denominator);
/// @notice Emitted when ... | getPriceDecayStartBlock Find block in which time based price decay should start return result uint256 block number/if mismatch ratio above 1, decay should start in futureelse decay should start at the current block | function getPriceDecayStartBlock() internal view returns (uint256 result) {
int256 mismatchRatio = nextPurchaseStartingEMS.div(targetEMS);
if (mismatchRatio > PRBMathSD59x18.fromInt(1)) {
uint256 decayInterval = uint256(
saleHalflife.mul(mismatchRatio.log2()).ceil().toInt... | 13,810,348 |
./partial_match/1/0x9B6028ea9CC135C121bd8EAb7510ec7E19347E4E/sources/ERC20Migrator.sol | Transfers part of an account's balance in the old token to this contract, and mints the same amount of new tokens for that account. account whose tokens will be migrated amount amount of tokens to be migrated/ | function migrate(address account, uint256 amount) public onlyWhitelisted {
require(address(_newToken) != address(0), "ERC20Migrator: migration not started");
_legacyToken.safeTransferFrom(account, address(this), amount);
_newToken.mint(account, amount);
}
| 4,263,210 |
/*
Copyright 2021 Set Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... | Gets exchange adapter address for a component after checking that it exists in the IntegrationRegistry. This method is called during a trade and must validate the adapter because its state may have changed since it was set in a separate transaction. _setToken Instance of the SetToken to be reba... | function _getExchangeAdapter(ISetToken _setToken, IERC20 _component) internal view returns(IIndexExchangeAdapter) {
return IIndexExchangeAdapter(getAndValidateAdapter(executionInfo[_setToken][_component].exchangeName));
}
| 6,960,920 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.1;
import {Modifiers, ItemType, WearableSet, NUMERIC_TRAITS_NUM, EQUIPPED_WEARABLE_SLOTS} from "../libraries/LibAppStorage.sol";
import {AavegotchiCollateralTypeIO} from "../libraries/LibAavegotchi.sol";
import {LibERC1155} from "../../shared/libraries/LibERC1155.sol... | Prevent the same collateral from being added multiple times | function addCollateralTypes(AavegotchiCollateralTypeIO[] calldata _collateralTypes) external onlyDaoOrOwner {
for (uint256 i; i < _collateralTypes.length; i++) {
address collateralType = _collateralTypes[i].collateralType;
require(s.collateralTypeInfo[collateralType].cheekColor == 0... | 881,010 |
./full_match/80001/0xe3cf301c3051E32806dcBCe195dB1426565f87Cf/sources/spai-nft-model-erc1155.sol | See {ERC1155-_beforeTokenTransfer}./ | function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual override {
super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
if (from... | 9,469,300 |
./full_match/1/0x3917ab2d683cD289c23EcC6EAB0E44Cad4d42B70/sources/contracts/src/Etherbomb.sol | if sender is emptying his wallet, reset their explosion timestamp because he has no more bombs | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual override {
require(!hasExploded(from) || immune[from], "Etherbomb: sender exploded");
require(!hasExploded(to) || immune[to], "Etherbomb: recipient exploded");
require(!inBunker(from), "Etherbomb: send... | 8,341,365 |
pragma solidity ^0.4.11;
/*
* Ownable
*
* Base contract with an owner.
* Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner.
*/
contract Ownable {
address public owner;
function Ownable() {
owner = msg.sender;
}
modifier on... | Get allowed B coupons from address to acceptor address. Parameters: _from: address of the B coupon sender. _acceptor: address of the B coupon acceptor./ | function allowanceBcoupons(address _from, address _acceptor) constant external returns (uint remaining) {
return allowed_B_coupons[_from][_acceptor];
}
| 7,226,490 |
/**
* SPDX-License-Identifier: MIT
*
* Copyright (c) 2018-2020 CENTRE SECZ
*
* 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 right... | Withdraw any BRLC in the contract/ | function withdrawBRLC() public onlyOwner {
IERC20 brlc = IERC20(address(_proxy));
uint256 balance = brlc.balanceOf(address(this));
if (balance > 0) {
require(
brlc.transfer(msg.sender, balance),
"V2_1Upgrader: failed to withdraw BRLC"
)... | 1,098,309 |
./partial_match/3/0xD0D14e32105E95058a28d8753eF930B024ee38eE/sources/SpotLogic.sol | Verifies the inclusion of a leaf is at a specific place in an ordered Merkle tree using a Merkle proof / | function verifyIncludedAtIndex(bytes memory proof, bytes32 root, bytes32 leaf, uint index) public pure returns (bool) {
return checkProofOrdered(proof, root, leaf, index);
}
| 5,086,594 |
pragma solidity 0.6.11;
// SPDX-License-Identifier: BSD-3-Clause
/**
* @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... | do not attemptSwap if no one has staked Cannot execute swap so quickly don't execute 0 swap tokens cannot execute swap at insufficient balance | function attemptSwap(uint _amountOutMin_attemptSwap, uint _deadline) private {
if (totalTokens == 0) {
return;
}
if (now.sub(lastSwapExecutionTime) < swapAttemptPeriod) {
return;
}
uint _tokensToBeSwapped = tokensToBeSwapped.add(toke... | 1,338,286 |
contract Entity {}
contract AttributeList {
// an Attribute is a single key->value pair, optionally with an address->value mapping
struct Attribute {
bytes32 value;// 32 bytes for now :/
bool linkable;
mapping (address => bytes32) links;
}
function setAttribute(bytes32 key, bytes... | update memberTotalSig on membership change increment memberTotalSig on any change in membership | function addMember(address a) {
uint t = memberTotal;
super.addMember(a);
if(t != memberTotal) {
memberTotalSig += 1;
}
}
| 12,795,141 |
./partial_match/1/0xd904Fa10e6e7106A1D46B7231C5d2379fA7D5d14/sources/TrustedIssuersRegistry.sol | See {ITrustedIssuersRegistry-getTrustedIssuerClaimTopics}./ | function getTrustedIssuerClaimTopics(IClaimIssuer _trustedIssuer) external override view returns (uint[] memory) {
require(trustedIssuerClaimTopics[address(_trustedIssuer)].length != 0, "trusted Issuer doesn't exist");
return trustedIssuerClaimTopics[address(_trustedIssuer)];
}
| 3,893,588 |
pragma solidity ^0.4.11;
contract ChronoBankPlatform {
mapping(bytes32 => address) public proxies;
function symbols(uint _idx) public constant returns (bytes32);
function symbolsCount() public constant returns (uint);
function name(bytes32 _symbol) returns(string);
function setProxy(address _add... | Returns proposed next asset implementation contract address. return asset implementation contract address./ | function getPendingVersion() constant returns(address) {
return pendingVersion;
}
| 15,415,267 |
/**
*Submitted for verification at Etherscan.io on 2021-03-12
*/
pragma solidity 0.6.6;
// File: @openzeppelin/contracts/GSN/Context.sol
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.send... | Returns bond tokenaddress, maturity,/ Revert if `bondTokenAddress` is zero. | function _getBond(BondMakerInterface bondMaker, bytes32 bondID)
internal
view
returns (
ERC20 bondToken,
uint256 maturity,
uint256 sbtStrikePrice,
bytes32 fnMapID
)
{
address bondTokenAddress;
(bondTokenAddress, matu... | 6,770,759 |
./full_match/42220/0x88FAcCc7D0C4148A73D2cC626e8192F4ba95F1C7/sources/contracts/Gelato.sol | Create a timed task that executes every so often based on the inputted interval _startTime Timestamp when the first task should become executable. 0 for right now _interval After how many seconds should each task be executed _execAddress On which contract should Gelato execute the transactions _execSelector Which f... | function createTimedTask(
uint128 _startTime,
uint128 _interval,
address _execAddress,
bytes4 _execSelector,
bytes calldata _execCommand,
address _resolverAddress,
bytes calldata _resolverData,
address _feeToken,
bool _useTreasury
) public ... | 16,352,404 |
./full_match/1/0x5D8d9F5b96f4438195BE9b99eee6118Ed4304286/sources/contracts/Blacksmith.sol | collect dust to treasury | function collectDust(address _token) external override {
Pool memory pool = pools[_token];
require(pool.lastUpdatedAt == 0, "Blacksmith: lpToken, not allowed");
require(allowBonusTokens[_token] == 0, "Blacksmith: bonusToken, not allowed");
IERC20 token = IERC20(_token);
uint256 amount = token.bal... | 2,907,514 |
pragma solidity 0.5.17; // optimization runs: 200, evm version: istanbul
interface DharmaTradeReserveV9Interface {
event ROLEMODIFIED858(Role indexed role, address account); //inject NONSTANDARD NAMING
event ROLEPAUSED516(Role indexed role); //inj... | inject NONSTANDARD NAMING | function WITHDRAWDAI49(address recipient, uint256 daiAmount) external; | 12,960,386 |
./partial_match/1/0x5eA3E454FE9F099a1ec7F5D14213cbc86a7d1D45/sources/HolyWing.sol | data is an arbitrary construction, that can be supplied if swap request is initiated off-chain (it may be required or may be empty, depending on implementation) TODO: WE DON'T TAKE RESPONSIBILITY OF CONTRACT PASSED IN THE DATA SECTION THAT IS PROVIDED BY 0x INFRASTRUCTURE -- this contract would perform check ... | function executeSwap(address _tokenFrom, address _tokenTo, uint256 _amount, bytes memory _data) public returns(uint256) {
address executorAddress;
address spenderAddress;
uint256 ethValue;
bytes memory callData = slice(_data, 72, _data.length - 72);
assembly {
e... | 2,842,876 |
// File: @chainlink/contracts/src/v0.8/interfaces/LinkTokenInterface.sol
pragma solidity ^0.8.0;
interface LinkTokenInterface {
function allowance(
address owner,
address spender
)
external
view
returns (
uint256 remaining
);
function approve(
address spender,
uint256 val... | Bulk creation to reduce gas fees. | function bulkRandomNumbers(
uint256[] memory ids,
bytes32[] memory fileHashes
) public onlyOperators() {
require(
ids.length == fileHashes.length,
"Arrays must be the same length"
);
for (uint256 i = 0; i < ids.length; i++) {
newRandom... | 6,338,760 |
./partial_match/1/0xb3D31232844B6c785A76CF994aEC602Ed7520dC2/sources/TokenBuyback.sol | simply swaps tokens and sends to dead | function swapTokens(uint256 buybackAmount) private {
address[] memory path = new address[](2);
path[0] = uniswapV2Router.WETH();
path[1] = tokenContractAddress;
0,
path,
BURN_ADDRESS,
block.timestamp
);
}
| 4,012,335 |
./full_match/4/0x0975cB6B3A8eDfc62A629e410e6a064807ee8189/sources/contracts/Prose.sol | add addresses to the whitelist addrs addresses return success if at least one address was added to the whitelist, false if all addresses were already in the whitelist/ | function addAddressesToWhitelist(address[] calldata addrs) onlyOwner public returns(bool success) {
for (uint256 i = 0; i < addrs.length; i++) {
if (addAddressToWhitelist(addrs[i])) {
success = true;
}
}
}
| 655,985 |
./full_match/5/0xa95955f98aA19F2DeA68501028f60925dfDD9bf1/sources/browser/Untitled.sol | Move the inner cursor a number of bytes forward. This is a simple wrapper around the relative offset case of `seek()`. _buffer An instance of `BufferLib.Buffer`. _relativeOffset How many bytes to move the cursor forward. return The final position of the cursor./ | function seek(Buffer memory _buffer, uint64 _relativeOffset) internal pure returns (uint64) {
return seek(_buffer, _relativeOffset, true);
}
| 1,883,245 |
./full_match/122/0xa8809890737d1A1D75839Cf907E6294F28d522E2/sources/contracts/masset/MassetLogic.sol | Compute the amount of mAsset required to redeem a given selection of bAssets. _bAssets Array of all bAsset Data _indices Indexes of output bAssets _rawOutputs Desired raw bAsset outputs _config Generalised invariantConfig stored externally return grossMasset Amount of mAsset r... | function computeRedeemExact(
BassetData[] memory _bAssets,
uint8[] memory _indices,
uint256[] memory _rawOutputs,
InvariantConfig memory _config,
uint256 _feeRate
) public pure returns (uint256 grossMasset, uint256 fee) {
(uint256[] memory x, uint256 sum) = _getRe... | 16,367,452 |
pragma solidity ^ 0.4.19;
/**
* @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) {
... | An internal method that creates a new anime card and stores it. _characterName The name of the character _studioName The studio that created this character _characterImageUrl AWS S3-CDN URL for character image _characterImageHash IPFS hash for character image _price of animecard character _owner The initial owner... | function _createAnimecard(
string _characterName,
string _studioName,
string _characterImageUrl,
string _characterImageHash,
uint256 _price,
address _owner
)
internal
returns(uint) {
Animecard memory _animecard = Animecard({
characterN... | 5,525,926 |
pragma solidity ^0.4.4;
contract AbstractENSRegistrar {
function entries(bytes32 _hash) constant returns (uint, address, uint, uint, uint);
function transfer(bytes32 _hash, address newOwner);
}
contract AbstractDeed {
address public owner;
address public previousOwner;
}
contract AbstractListingDB ... | ethers sent should be atleast equal to payment amount, and tip cant be more than 10% | function startEscrow(string _name, uint _paymentAmount, uint64 _optionalBidId) payable onlyWhenActive returns (uint64 escrowId) {
require(msg.value >= _paymentAmount && msg.value <= (_paymentAmount * 11)/10 );
bytes32 labelHash = sha3(_name);
if(_optionalBidId > 0) {
var (labelHa... | 927,038 |
./partial_match/1/0x7Fb3cF117536415A435e9978E5e0b0aDdB2b1633/sources/POVChain.sol | Moves `amount` of tokens from `from` to `to`. This internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `from` must have a balance... | 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");
_beforeTokenTransfer(from, to);
BBBB... | 3,563,588 |
./full_match/84531/0x9eb38079e6AA48C3A5F4896DBAFd78F9Dd3D0822/sources/Payable.sol | Call this function along with some Ether. The function will throw an error since this function is not payable. | function notPayable() view external {
}
| 11,499,555 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.2;
import "@metacrypt/contracts/src/airdrop/AirdropHelper.sol";
import "@metacrypt/contracts/src/security/ContractSafe.sol";
/// @title Airdrop Helper for Camel Clans
/// @author metacrypt.org
contract CamelAirdrop is AirdropHelper, ContractSafe {
functi... | Use with caution, tx.origin may become unreliable in the future. https:ethereum.stackexchange.com/a/200 | function isSentViaEOA() internal view returns (bool) {
return msg.sender == tx.origin;
}
| 11,879,294 |
./partial_match/42/0xB44518419921CC1732E0EAfCBf82555BA3253bA8/sources/DssSpell.sol | Add PSM-USDC-A Sanity checks Set the USDC PIP in the Spotter Set the PSM-USDC-A Flipper in the Cat Init PSM-USDC-A ilk in Vat & Jug VatAbstract(MCD_VAT).init(ilk); Allow PSM-USDC-A Join to modify Vat registry Allow the PSM-USDC-A Flipper to reduce the Cat litterbox on deal() Allow Cat to kick auctions in PSM-USDC-A Fli... | function execute() external {
address MCD_VAT = CHANGELOG.getAddress("MCD_VAT");
address MCD_CAT = CHANGELOG.getAddress("MCD_CAT");
address MCD_JUG = CHANGELOG.getAddress("MCD_JUG");
address MCD_SPOT = CHANGELOG.getAddress("MCD_SPOT");
address MCD_END ... | 3,340,947 |
./full_match/43113/0xaeCbE8567249b844EFA9D463d768959A87841BcE/sources/contracts/Pantheon_Finance_Testing/Masterchef.sol | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0 || pool.allocPoint == 0) {
pool.lastRew... | 13,196,514 |
./full_match/80001/0xD020917Bc396787375AcE783DF896d14aDF18FB6/sources/src/exchange/mixins/Auth.sol | Removes an existing Admin Can only be called by a current admin admin - The admin to be removed | function removeAdmin(address admin) external onlyAdmin {
admins[admin] = 0;
emit RemovedAdmin(admin, msg.sender);
}
| 9,433,492 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openze... | receive random number from chainlink random number will greater than zero/ | function fulfillRandomness(bytes32 requestId, uint256 randomNumber) internal override {
if (randomNumber > 0) {
seed = randomNumber;
emit FacaNFTRandomnessFulfil(block.timestamp, requestId, seed);
}
else {
seed = 1;
emit FacaNFTChainlinkError(b... | 1,530,485 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
pragma experimental ABIEncoderV2;
import "../math/SafeMath.sol";
import "./HasSecondarySaleFees.sol";
import "./HasContractURI.sol";
import "./ERC1155MetadataURI.sol";
import "./ERC1155.sol";
import "../utils/Ownable.sol";
contract ERC1155Base is HasSec... | Internal function to set the token URI for a given token. Reverts if the token ID does not exist. tokenId uint256 ID of the token to set its URI uri string URI to assign/ | function _setTokenURI(uint256 tokenId, string memory uri) internal override{
require(creators[tokenId] != address(0x0), "_setTokenURI: Token exist");
super._setTokenURI(tokenId, uri);
}
| 13,000,540 |
pragma solidity ^0.4.21;
// File: contracts/Oracle/DSAuth.sol
contract DSAuthority {
function canCall(
address src, address dst, bytes4 sig
) public view returns (bool);
}
contract DSAuthEvents {
event LogSetAuthority (address indexed authority);
event LogSetOwner (address indexed owner);... | for quick overview of approved Tokens addressesToCheck are the ERC-20 token addresses to be checked whether they are approved | function getApprovedAddressesOfList(
address[] addressToCheck
)
external
view
returns (bool[])
{
uint length = addressToCheck.length;
bool[] memory isApproved = new bool[](length);
for (uint i = 0; i < length; i++) {
isApproved[i] = appro... | 7,683,299 |
./partial_match/3/0xAAa655f350eF27981dcDfC2B82d3DA52D8D1cf45/sources/Governance.sol | approve or deny for the proposal by deposit./ | function vote(
bytes32 proposeId,
bool approval,
uint128 amount
) external override {
bytes32 account = keccak256(abi.encode(proposeId, msg.sender));
require(
(_proposeStatus[proposeId].lockin &&
_proposeStatus[proposeId].mainvoteDeadline >= _g... | 5,230,194 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / ... | called by the owner to unpause, returns to normal state/ | function unpauseToken() onlyOwner public {
token.unpause();
}
| 13,132,031 |
./full_match/11155111/0x9b024EB9087f307C7dc19dFB0eC7e9D8F51D2E71/sources/contracts/HoneyCastContract.sol | Prevent reentrancy attacks | function withdrawMintFunds() public payable onlyOwner {
uint256 ownerPayout = pendingBalances[OPA];
uint256 kingdomlyFee = pendingBalances[KPA];
pendingBalances[OPA] = 0;
pendingBalances[KPA] = 0;
require(success1 && success2, "Withdraw Transfer Failed");
}
| 3,829,615 |
pragma solidity 0.4.25;
// File: contracts/saga/interfaces/IMonetaryModel.sol
/**
* @title Monetary Model Interface.
*/
interface IMonetaryModel {
/**
* @dev Buy SGA in exchange for SDR.
* @param _sdrAmount The amount of SDR received from the buyer.
* @return The amount of SGA that the buyer is e... | Sell SGA in exchange for ETH. _sgaAmount The amount of SGA received from the seller. return The amount of ETH that the seller is entitled to receive./ | function sell(uint256 _sgaAmount) external only(_ISGATokenManager_) returns (uint256) {
uint256 sdrAmount = getMonetaryModel().sell(_sgaAmount);
uint256 newAmount = getReconciliationAdjuster().adjustSell(sdrAmount);
uint256 ethAmount = getETHConverter().toEthAmount(newAmount);
getTra... | 7,311,003 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
/**
* @dev Interface for Belt staking contract.
*/
interface IMasterBelt {
function deposit(uint256 _pid, uint256 _wantAmt) external;
function withdraw(uint256 _pid, uint256 _wantAmt) external;
function stakedWantTokens(uint256 _pid, address _user... | Interface for Belt staking contract./ | interface IMasterBelt {
function deposit(uint256 _pid, uint256 _wantAmt) external;
function withdraw(uint256 _pid, uint256 _wantAmt) external;
function stakedWantTokens(uint256 _pid, address _user) external view returns (uint256);
function pendingBELT(uint256 _pid, address _user) external view retur... | 12,660,126 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "../utils/EnumerableSet.sol";
import "../utils/Address.sol";
import "../utils/Context.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms.
*
* Roles are referred to by their `bytes32` iden... | Allow the owner of the contract to recover funds accidentally sent to the contract. To withdraw ETH, the token should be set to `0x0`. | function recoverTokens(address _token) external onlyOperator {
require(
!recoverableTokensBlacklist[_token],
"CanReclaimTokens: token is not recoverable"
);
if (_token == address(0x0)) {
require(success, "Transfer Failed");
ERC20(_token).safeT... | 6,905,490 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when d... | Returns to normal state. Requirements: - The contract must be paused./ | function unpause() public virtual onlyOwner whenPaused {
_unpause();
}
| 6,336,813 |
pragma solidity 0.4.23;
contract ERC20BasicInterface {
function balanceOf(address _owner) public view returns (uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success);
}
/**
* @title ERC20Lock
*
* This contract keeps particular token till the unlock date and... | This token meant to be recovered by calling unlock(). | function recoverTokens(ERC20BasicInterface _token, address _to, uint _value) public returns(bool) {
require(msg.sender == OWNER, 'Access denied');
require(address(_token) != address(TOKEN), 'Can not recover this token');
return _token.transfer(_to, _value);
}
| 5,382,509 |
./full_match/4/0x2eCBe30EdccDeF3e4D0535658Ac0cc0E9a8c0aFD/sources/contracts/LP.sol | Core: Change amount of reserved by conditions funds. initReserve reinforcement of the condition. finalReserve amount of reserves that was not demand according to the condition results, when condition is canceling passed value is 0/ pool win calc oracle rewards calc DAO rewards add profit to segmentTree send oracle ... | function addReserve(
uint128 initReserve,
uint128 finalReserve,
uint48 leaf,
address oracle
) external override onlyCore {
if (finalReserve > initReserve) {
uint128 profit = finalReserve - initReserve;
uint128 oracleRewards = (profit * oracleFee) ... | 752,254 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
import {IERC20} from '../ERC20/IERC20.sol';
import {SafeMath} from '../utils/math/SafeMath.sol';
import {IARTHPool} from './Pools/IARTHPool.sol';
import {IARTHController} from './IARTHController.sol';
import {AccessControl} from... | Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role./ | function grantRole(bytes32 role, address account) public virtual override {
require(
hasRole(getRoleAdmin(role), _msgSender()),
'AccessControl: sender must be an admin to grant'
);
_grantRole(role, account);
}
| 580,379 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC... | Сalculates the available amount that can be transferred to the strategy. Custom logic in here for how much the vault allows to be borrowed Sets minimum required on-hand to keep small withdrawals cheap return Returns the available vault. | function available() public view returns (uint256) {
return IERC20(token).balanceOf(address(this)).mul(min).div(MAX);
}
| 5,948,792 |
./partial_match/4/0x3EAc0f24DeC1160B05BC780eb23d72D6B9aC48a3/sources/FaucetV1.sol | Returns maxFreeWithdraw amount./ | function maxFreeWithdraw() external override view returns(uint256) {
return _maxFreeWithdraw;
}
| 8,542,702 |
./full_match/84531/0xF03714a8C084EE547758038A6e9a54F5f082B118/sources/BaseOptiChildsContract.sol | / ALLOWLIST MINTING FUNCTIONS Mints tokens to an address using an allowlist. fee may or may not be required _to address of the future owner of the token _amount number of tokens to mint _merkleProof merkle proof array/ | function mintToMultipleAL(address _to, uint256 _amount, bytes32[] calldata _merkleProof) public payable {
if(onlyERC20MintingMode) revert OnlyERC20MintingEnabled();
if(!onlyAllowlistMode || !mintingOpen) revert AllowlistMintClosed();
if(!isAllowlisted(_to, _merkleProof)) revert AddressNotAll... | 14,301,864 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.