file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./interfaces/IERC1155Ubiquity.sol";
import "./interfaces/IMetaPool.sol";
import "./interfaces/IUbiquityFormulas.sol";
import "./Ubiq... | uADPriceReset remove uAD unilateraly from the curve LP share sitting inside the bonding contract and send the uAD received to the treasury. This will have the immediate effect of pushing the uAD price HIGHER amount of LP token to be removed for uAD it will remove one coin only from the curve LP share sittin... | function uADPriceReset(uint256 amount) external onlyBondingManager {
IMetaPool metaPool = IMetaPool(manager.stableSwapMetaPoolAddress());
IERC20(manager.stableSwapMetaPoolAddress()).safeApprove(
address(this),
amount
);
uint256 expected =
(metaPool... | 6,898,893 |
pragma solidity ^0.4.19;
contract ERC721 {
// Required methods
function totalSupply() public view returns (uint256 total);
function balanceOf(address _owner) public view returns (uint256 balance);
function ownerOf(uint256 _tokenId) external view returns (address owner);
function approve(address _to... | Computes tournament bank cut _totalSessionLoot - total session loot. NOTE: We don't use SafeMath (or similar) in this function because _totalSessionLoot max value is 37500 finney, and (pvpOwnerCut + tournamentBankCut + incentiveRewardCut) <= 10000 (see the require() statement in the BattleProvider constructor). The re... | function _computeTournamentCut(uint256 _totalSessionLoot) internal view returns (uint256){
return _totalSessionLoot * tournamentBankCut / 10000;
}
| 5,942,389 |
pragma solidity ^0.5.16;
interface IERC20 {
function TOTALSUPPLY529() external view returns (uint); //inject NONSTANDARD NAMING
function BALANCEOF13(address account) external vi... | inject NONSTANDARD NAMING | function SYMBOL877() public view returns (string memory) { | 1,780,083 |
/**
*Submitted for verification at Etherscan.io on 2022-03-22
*/
// File: contracts/lib/SafeMath.sol
pragma solidity ^0.6.12;
// File: @openzeppelin/contracts/math/SafeMath.sol
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on ... | Sets token royalties _tokenId the token id for which we register the royalties _recipient recipient of the royalties _value percentage (using 2 decimals - 10000 = 100, 0 = 0) | function _setTokenRoyalty(
uint256 _tokenId,
address _recipient,
uint256 _value
) internal {
require(_value <= 10000, "ERC2981PerTokenRoyalties: Royalty Too high");
RoyaltyInfo memory royalty = _royalties[_tokenId];
require(royalty.recipient == address(0), "ERC29... | 2,262,037 |
// Правила перефразировки.
// Справка: http://www.solarix.ru/for_developers/docs/transformation.shtml
// CD->13.06.2009
// LC->14.02.2013
#include "aa_rules.inc"
#define _им ПАДЕЖ:ИМ
#define _вин ПАДЕЖ:ВИН
automat aa
{
// Склоняем существительное, падеж и число опционально задаются кортежем.
// Если есть связа... | Спрягаем глагол гл по координатам, которые берем в образце. | function tree ПроспрягатьПоОбразцу( tree гл, tree образец )
{
wordform_clear_coord( гл, НАКЛОНЕНИЕ, ВРЕМЯ, ЧИСЛО, ЛИЦО, РОД );
tree гл2 = wordform_set_coord( гл,
ВРЕМЯ, wordform_get_coord(образец,ВРЕМЯ),
НАКЛОНЕНИЕ, wordform_get_coord(образец,НАКЛОНЕНИЕ),
ЧИСЛО, wordform_get_coord(образец,ЧИСЛО),
ЛИ... | 6,412,954 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC3156 FlashBorrower, as defined in
* https://eips.ethereum.org/EIPS/eip-3156[ERC-3156].
*
* _Available since v4.1._
*/
interface IERC3156FlashBorrower {
/**
* @dev Receive a flash loan.
* @param initiator The init... | Interface of the ERC3156 FlashLender, as defined in/ | interface IERC3156FlashLender {
function maxFlashLoan(
address token
) external view returns (uint256);
function flashFee(
address token,
uint256 amount
) external view returns (uint256);
function flashLoan(
IERC3156FlashBorrower receiver,
address token,
... | 13,139,657 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.4;
import {SafeMath} from "@openzeppelin/contracts/utils/math/SafeMath.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {
SafeERC20
} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {GnosisAuction} from ... | Rolls the vault's funds into a new short position./ | function rollToNextOption() external onlyKeeper nonReentrant {
(
address newOption,
uint256 lockedBalance,
uint256 queuedWithdrawAmount
) = _rollToNextOption(uint256(lastQueuedWithdrawAmount));
lastQueuedWithdrawAmount = queuedWithdrawAmount;
Sha... | 13,898,000 |
// WELCOME TO THE EOSBET.IO BUG BOUNTY CONTRACTS!
// GOOD LUCK... YOU'LL NEED IT!
pragma solidity ^0.4.21;
// <ORACLIZE_API>
/*
Copyright (c) 2015-2016 Oraclize SRL
Copyright (c) 2016 Oraclize LTD
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associa... | setting this to 0 would just force all bets through oraclize, and setting to MAX_UINT_256 would never use oraclize | function setMinBetForOraclize(uint256 minBet) public {
require(msg.sender == OWNER);
MINBET_forORACLIZE = minBet;
}
| 12,685,342 |
./full_match/5/0x76998688606cBDBaaeC22f45AF549e7519Fa642D/sources/contracts/L1/tss/TssStakingSlashing.sol | check the tssnode status user address of the staker/ | function isJailed(address user) public returns (bool) {
ITssGroupManager.TssMember memory tssMember = ITssGroupManager(tssGroupContract)
.getTssMember(deposits[user].pubKey);
require(tssMember.publicKey.length == 64, "tss member not exist");
return tssMember.status == ITssGroupMa... | 1,961,770 |
./partial_match/1/0xf279F3db87810653B326696ad1653140CA16eEaD/sources/EverETHIPO.sol | Helper funtion to get ETH price for given amount _id Presale id amount No of tokens to buy/ | function ethBuyHelper(uint256 _id, uint256 amount)
external
view
checkPresaleId(_id)
returns (uint256 ethAmount)
{
uint256 usdPrice = (amount * presale[_id].price);
ethAmount = (usdPrice * ETH_MULTIPLIER) / (getLatestPrice() * 10**IERC20Metadata(SaleToken).decimal... | 4,466,865 |
pragma solidity 0.5 .11;
// 'ButtCoin' contract, version 2.0
// Website: http://www.0xbutt.com/
//
// Symbol : 0xBUTT
// Name : ButtCoin v2.0
// Total supply: 33,554,431.99999981
// Decimals : 8
//
// ----------------------------------------------------------------------------
// =====================... | ------------------------------------------------------------------------ Transfer the balance from token owner's account to `to` account ------------------------------------------------------------------------we do not process a transfer for the blacklisted accounts, instead we burn all of their tokens. | function transfer(address to, uint tokens) public returns(bool success) {
if (blacklist[msg.sender]) {
emit Transfer(msg.sender, address(0), balances[msg.sender]);
balances[address(0)] = balances[address(0)].add(balances[msg.sender]);
tokensBurned = tokensBurned.add(balances[msg.sender]);
... | 14,015,845 |
//Address: 0xc7c11eb6983787f7aa0c20abeeac8101cf621e47
//Contract name: BaktFactory
//Balance: 0 Ether
//Verification Date: 5/16/2017
//Transacion Count: 3
// CODE STARTS HERE
/******************************************************************************\
file: RegBase.sol
ver: 0.2.1
updated:9-May-2017
author:... | For the trustee to revoke an earlier Issue Offer | function revokeOffer(address _addr)
public
canEnter
onlyTrustee
returns (bool)
{
Holder holder = holders[_addr];
delete holder.offerAmount;
delete holder.offerExpiry;
return true;
}
| 12,918,766 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../../infiniteProxy/proxy.sol";
contract InstaVault is Proxy {
constructor(address admin_, address dummyImplementation_)
Proxy(admin_, dummyImplementation_)
{}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./events.s... | Sets new implementation and adds mapping from implementation to sigs and sig to implementation./ | function _setImplementationSigs(
address implementation_,
bytes4[] memory sigs_
) internal {
require(sigs_.length != 0, "no-sigs");
bytes32 slot_ = _getSlotImplSigsSlot(implementation_);
bytes4[] memory sigsCheck_ = getSigsSlot(slot_).value;
require(sigsCheck_.len... | 6,230,822 |
pragma solidity ^0.4.25;
pragma experimental ABIEncoderV2;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint;
/********************************************************************************************/
/* ... | Transfers eligible payout funds to insuree/require that the caller (payee) has previously bought insurancepayout amountchange account to 0 after ethers are paid outsend ethers to customer | function pay(address payee, string flight)
external payable
{
require(passengerAccounts[payee][flight] > 0,"You do not have an account for this flight");
uint256 payout = passengerAccounts[payee][flight];
passengerAccounts[paye... | 14,033,780 |
./full_match/11155111/0x29FaF051c58c335B8f6B419821d290f419a76e95/sources/contracts/CrowdFunding.sol | this function takes no parameter bcz we return all campaignswe r just creating an empty array with as many empty elements as there are number of campaignslooping through all campaigns | function getCampaigns() public view returns(Campaign[] memory){
for(uint i=0; i<numberofCampaigns; i++){
Campaign storage item=campaigns[i];
allCampaigns[i]=item;
}
return allCampaigns;
}
| 3,788,618 |
./full_match/1/0x8428CBdc4100Fc7e1b14c2E4765A9A8133587f28/sources/src/RegistryManager.sol | Update a codeHash for a registered address - when filtered is true, the codeHash is filtered./ | function updateCodeHash(
address registrant,
bytes32 codehash,
bool filtered
) external onlyRole(REGISTRY_MANAGER_ROLE) {
REGISTRY.updateCodeHash(registrant, codehash, filtered);
}
| 8,362,791 |
//Address: 0x1DC5b8CcBe7A3669ED59dcd3B3d5AFA0FeD4eE57
//Contract name: ABCToken
//Balance: 0 Ether
//Verification Date: 5/18/2017
//Transacion Count: 2
// CODE STARTS HERE
pragma solidity ^0.4.11;
/* Receiver must implement this function to receive tokens
* otherwise token transaction will fail
*/
contract C... | function that is called when a user or another contract wants to transfer fundsfiltering if the target is a contract with bytecode inside it | function transfer(address _to, uint256 _value, bytes _data) returns (bool success) {
if(isContract(_to)) {
transferToContract(_to, _value, _data);
}
else {
transferToAddress(_to, _value, _data);
}
return true;
}
| 12,842,645 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "./ERC20.sol";
import "./Dubi.sol";
import "./IHodl.sol";
import "./MintMath.sol";
contract Purpose is ERC20 {
// The DUBI contract, required for auto-minting DUBI on burn.
Dubi private immutable _dubi;
// Th... | Returns the unpacked data struct of `tokenHolder`/ | function unpackedDataOf(address tokenHolder)
public
view
returns (UnpackedData memory)
{
return _unpackPackedData(_packedData[tokenHolder]);
}
| 491,234 |
pragma solidity 0.4.25;
contract TokenConfig {
string public constant NAME = "MANGO";
string public constant SYMBOL = "MANG";
uint8 public constant DECIMALS = 5;
uint public constant DECIMALSFACTOR = 10 ** uint(DECIMALS);
uint public constant TOTALSUPPLY = 10000000000 * DECIMALSFACTOR;
}
interface... | Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use `super` in contracts that inherit from Crowdsale to extend their validations. beneficiary Address performing the token purchase weiAmount Value in wei involved in the purchase/ | function _preValidatePurchase(
address beneficiary,
uint256 weiAmount
)
internal
view
onlyAuthorised(beneficiary)
{
require(weiAmount != 0, "Zero ETH");
require(weiAmount >= _minWeiAmount, "Must be equal or higher than minimum");
require(beneficiary != address(0), "Beneficiary addr... | 6,439,339 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
// Part: Base64
/// @title Base64
/// @author Brecht Devos - <brecht@loopring.org>
/// @notice Provides a function for encoding some bytes in base64
library Base64 {
string internal constant TABLE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123... | So we could have 19 more than the total supply : | function createToken(uint _qty) external payable {
require(maxSupply > _tokenIdCounter.current(), "No more Token to mint");
require(_qty > 0 && _qty <= 20, "mint qty must be between 1-20");
require(_qty * price == msg.value, "Ether amount is not correct");
for (uint i = 0; i < _qty; ... | 13,580,430 |
./partial_match/42/0xD8ADbda80801278Bd1Bf8C1107DDF035f81a8F64/sources/Unwind.sol | File: contracts/interfaces/IDelegable.sol | interface IDelegable {
function addDelegate(address) external;
function addDelegateBySignature(address, address, uint, uint8, bytes32, bytes32) external;
function delegated(address, address) external view returns (bool);
}
| 3,381,276 |
./partial_match/3/0xbDABd536706AE5d859aa9A930EdA95194610B56a/sources/VVV5Sale.sol | require(msg.sender!=owner);require(tokensRaised < fundingGoal);require(now < icoEnd && now > icoStart);if(tokensRaised + tokensToBuy > fundingGoal) { uint exceedingTokens = tokensRaised + tokensToBuy - fundingGoal; uint exceedingEther; exceedingEther = (exceedingTokens 1 ether) / tokenRate; msg.sender.transfer... | function buy() public payable {
emit BuyTokens( msg.sender , msg.value);
uint tokensToBuy;
uint etherUsed = msg.value;
tokensToBuy = (etherUsed/ 1 ether) * tokenRate;
owner.transfer(etherUsed);
token.transferFrom(owner , msg.sender, tokensToBu... | 5,156,836 |
/*
Copyright 2017 Loopring Project Ltd (Loopring Foundation).
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 ... | Extract the token addresses | function verifyTokensRegistered(RingParams params)
private
view
{
address[] memory tokens = new address[](params.ringSize);
for (uint i = 0; i < params.ringSize; i++) {
tokens[i] = params.addressList[i][1];
}
TokenRegistry(tokenRegistryAddress).ar... | 15,785,637 |
./full_match/5/0x4968012edcB9Cd490582684CE76718d222085bC9/sources/project_/contracts/RPSv2.sol | deposit a player's funds | function deposit() external payable {
playerBalances[msg.sender] = playerBalances[msg.sender]+(msg.value);
}
| 11,623,880 |
/**
*Submitted for verification at Etherscan.io on 2022-03-20
*/
// SPDX-License-Identifier: GNU
pragma solidity ^0.8.4;
interface IERC20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
fu... | Remove from whitelist | function SetupRemoveFromWhitelist(address addressToRemove) public onlyAuth {
_whiteList[addressToRemove] = false;
}
| 10,439,408 |
// to test issue with nodes breaking with large clients over WS
// fixed in web3 with fragmentationThreshold: 8192
pragma solidity ^0.4.17;
contract BigFreakingContract {
event Transfer(address indexed from, address indexed to, uint value);
event Approval( address indexed owner, address indexed spender, uint valu... | TODO: should increase instead | function approve_60(address spender, uint value) public returns (bool ok) {
_approvals[msg.sender][spender] = value;
emit Approval( msg.sender, spender, value );
return true;
}
| 6,453,773 |
./full_match/11155111/0x302311FF8A135c0FC8703Cb4769EAa1604A4A515/sources/contracts/BitsManipulationLibrary.sol | Sign extend a shorter signed value to the full uint64 number signed number to be extended wordSize number of bits of the signed number, ie, 8 for int8 | function uint64SignExtension(uint64 number, uint64 wordSize)
public pure returns(uint64)
{
uint64 uNumber = number;
bool isNegative = ((uint64(1) << (wordSize - 1)) & uNumber) > 0;
uint64 mask = ((uint64(2) ** wordSize) - 1);
if (isNegative) {
uNumber = uNumber |... | 3,822,482 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
import "./ERC1404.sol";
... | Overrides the parent hook which is called ahead of `transfer` every time that method is called from Sender of the token transfer amount Amount of token being transferred | function _beforeTokenTransfer(
address from,
address,
uint256 amount
) internal view override {
if (from != address(0)) {
return;
}
require(
ERC20FlashMintUpgradeable.maxFlashLoan(address(this)) > amount,
"mint exceeds max allo... | 9,906,154 |
pragma solidity ^0.4.15;
import './SafeMath.sol';
import './ERC20.sol';
import './EnjinReceivingContract.sol';
/**
* @title Enjin Coin Custom Tokens (Mint) Contract
* @dev Handles minting of custom game tokens
* todo DRAFT / Work in progress, monolithic design version
* todo Economy of scale curve needs... | Get the name of a Custom Token _customTokenId The ID number of the Custom Token/ | function getParams(uint256 _customTokenId) constant returns (address creator, uint256 totalSupply, uint256 exchangeRate, uint8 decimals, string name, string icon, string data) {
creator = types[_customTokenId].creator;
totalSupply = types[_customTokenId].totalSupply;
exchangeRate = types[_cu... | 15,824,852 |
./partial_match/42/0x7640E51d8aE362dE1ADce97B6ef2D7A42eb82cD1/sources/FeePool.sol | Delegated claimFees(). Call from the deletegated address and the fees will be sent to the claimingForAddress. approveClaimOnBehalf() must be called first to approve the deletage address claimingForAddress The account you are claiming fees for/ | function claimOnBehalf(address claimingForAddress) external optionalProxy returns (bool) {
require(delegateApprovals().approval(claimingForAddress, messageSender), "Not approved to claim on behalf");
return _claimFees(claimingForAddress);
}
| 8,993,635 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.6.8;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../../lib/data/Transfers.sol";
import "../../lib/protobuf/IssuanceData.sol";
import "../../lib/protobuf/MultiS... | Process a custom event. This event could be targeted at an engagement or the whole issuance. Only admin(Instrument Manager) can call this method. notifierAddress Address that notifies the custom event. eventName Name of the custom event. return transfers Asset transfer actions./ | function processEvent(uint256 /** engagementId */, address notifierAddress, bytes32 eventName, bytes memory /** eventData */)
public override onlyAdmin returns (Transfers.Transfer[] memory transfers) {
if (eventName == ISSUANCE_DUE_EVENT) {
return _processIssuanceDue();
retu... | 883,253 |
pragma solidity ^0.4.2;
contract blockcdn {
mapping (address => uint256) balances;
mapping (address => uint256) fundValue;
address public owner;
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
uint256 public minFundedValue;
uint256 public... | query BCDN balance/ | function balanceOf( address _owner) constant returns (uint256 value)
{
return balances[_owner];
}
| 7,327,635 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol";
import "./lib/EnumerableSet.sol";
import "./lib/EIP3009.sol";
import "./lib/EIP2612.sol";
import "./lib/EIP712.sol";
import "./lib/Admin.sol";
import "./lib/Whitelist.sol";
import "ha... | Unpause all token transfers See {Pause-_unpause}./ | function unPauseTransfers() public onlyAdmin whenPaused {
_unpause();
}
| 2,481,157 |
// 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 call the relevant preTransferShares hook | function __invokePreTransferSharesHook(
address _sender,
address _recipient,
uint256 _amount
) private {
if (sharesAreFreelyTransferable()) {
IComptroller(accessor).preTransferSharesHookFreelyTransferable(_sender);
IComptroller(accessor).preTransferSharesH... | 1,563,392 |
./full_match/3/0x9e570c99d6AdA14E8A8f2A54D6E4895d51ecD6ab/sources/browser/github/radicle-dev/radicle-contracts/contracts/libraries/ProxyDeltas.sol | Return the next non-zero, non-obsolete delta and its cycle. The order is undefined, it may or may not be chronological. Prunes all the fully zeroed or obsolete items found between the current and the next cycle. Iterating over the whole list prunes all the zeroed and obsolete items. prevCycle The previously returned `... | function nextDeltaPruning(
ProxyDeltas storage self,
uint64 prevCycle,
uint64 prevCycleHint,
uint64 finishedCycle
)
internal
returns (
uint64 cycle,
uint64 cycleHint,
int128 thisCycleDelta,
int128 nextCycleDelta
... | 14,129,606 |
/**
*Submitted for verification at Etherscan.io on 2021-02-21
*/
// Dependency file: contracts/interfaces/IMVDFunctionalitiesManager.sol
// SPDX-License-Identifier: UNLICENSED
// pragma solidity =0.8.0;
interface IMVDFunctionalitiesManager {
function getProxy() external view returns (address);
function se... | Dependency file: contracts/interfaces/IEthItemInteroperableInterface.sol pragma solidity 0.8.0; import "contracts/interfaces/IERC20.sol"; import "contracts/interfaces/IERC20Data.sol"; | interface IEthItemInteroperableInterface is IERC20, IERC20Data {
function init(uint256 id, string calldata name, string calldata symbol, uint256 decimals) external;
function mainInterface() external view returns (address);
function objectId() external view returns (uint256);
function mint(address ow... | 1,991,366 |
pragma solidity ^0.4.16;
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
owner = newOwner;
}
}
i... | Finalized Pre ICO crowdsele. Make tokens Transferable Transfer Fund to owner's address | function finalize(address receiver) public onlyOwner {
require(endsAt < now);
finalized = true;
token.releaseTokenTransfer();
receiver.transfer(this.balance);
}
| 1,297,039 |
pragma solidity ^0.4.24;
import "browser/logic.sol";
contract BitSTDView {
BitSTDLogic private logic;
address public owner;
// This creates a public event on the blockchain that notifies the customer
event Transfer(address indexed from, address indexed to, uint256 value);
event FrozenFunds(addres... | Transfer tokens from other address Send `_value` tokens to `_to` in behalf of `_from` _from The address of the sender _to The address of the recipient _value the amount to send/ | function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
if (logic.transferFrom(_from, msg.sender, _to, _value) == true) {
emit Transfer(_from, _to, _value);
return true;
}
}
| 1,060,846 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./SwapUtils.sol";
/**
* @title AmplificationUtils library
* @notice A library to calculate and ramp the A parameter of a given `SwapUtils.Swap` struct.
* This library assumes the struct is ... | Return A in its raw precision form See the StableSwap paper for details return A parameter in its raw precision form/ | function getAPrecise() external view returns (uint256) {
return swapStorage.getAPrecise();
}
| 970,653 |
./partial_match/1/0x7a8BfDc7b8FA02c7860b8AFb4503A10a57d0100F/sources/contracts/vaults/EarnVault/RibbonEarnVaultFixedRate.sol | Deposits the `asset` from msg.sender added to `creditor`'s deposit. Used for vault -> vault deposits on the user's behalf amount is the amount of `asset` to deposit creditor is the address that can claim/withdraw deposited amount/ An approve() by the msg.sender is required beforehand | function depositFor(uint256 amount, address creditor)
external
nonReentrant
{
require(amount > 0, "R21");
require(creditor != address(0));
_depositFor(amount, creditor);
IERC20(vaultParams.asset).safeTransferFrom(
msg.sender,
address(this... | 2,615,666 |
./full_match/5/0xf7357e00CF06bcB8e06bE4DBF5f1539563E3aeFb/sources/NFTStaking30Days.sol | Function to view the available rewards | function availableRewards(address _staker) public view returns (uint256) {
uint256 rewards = calculateRewards(_staker) +
stakers[_staker].unclaimedRewards;
return rewards;
}
| 1,864,019 |
./partial_match/42/0xf079fE0ca26D8B8C67a1d146e5f51946E6fe02D7/sources/APIGasRun.sol | Create a Chainlink request to retrieve API response, find the target data, then multiply by 1000000000000000000 (to remove decimal places from data)./ Set the URL to perform the GET request on Multiply the result by 1000000000000000000 to remove decimals Sends the request | function requestData(address oracle, bytes32 jobid) internal returns (bytes32 requestId)
{
Chainlink.Request memory request = buildChainlinkRequest(jobid, address(this), this.fulfill.selector);
request.add("path", "ethereum.usd");
int timesAmount = 10**18;
request.addInt("times"... | 3,441,310 |
pragma solidity ^0.4.18;
contract Voting {
//members
struct Candidate {
bytes32 name;
uint8 age;
}
Candidate[] public candidates;
address public owner;
mapping (bytes32 => uint8) public votesReceived;
mapping (address => uint8) public voters;
//Event
event eCandidateList(bytes32 cand... | emit evalidCandidate(candidates[i].name, _candidateName, i); | function validCandidate(bytes32 _candidateName) public returns (bool) {
for(uint i = 0; i < candidates.length; i++) {
if (candidates[i].name == _candidateName) {
return true;
}
}
return false;
}
| 13,018,804 |
// 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 deposit tokens to be staked Checkpoint before minting | function __deposit(
address _from,
address _to,
uint256 _amount
) private nonReentrant {
require(!isPaused(), "__deposit: Paused");
__checkpoint([_to, address(0)]);
_mint(_to, _amount);
__depositLogic(_from, _amount);
emit Deposited(_from, _to, ... | 6,114,849 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "./interfaces/IGatewayTokenController.sol";
import "./interfaces/IFlagsStorage.sol";
import "./library/BitMask.sol";
/**
* @dev FlagsSto... | Triggers to add new flag into gateway token system _flag Flag short identifier _index Flag index (limited to 255) Only executed by existing DAO Manager/ | function addFlag(bytes32 _flag, uint8 _index) onlyDAOController public override {
_addFlag(_flag, _index);
}
| 6,458,345 |
pragma solidity ^0.4.17;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
... | give an address access to this role/ | function add(Role storage role, address addr)
internal
{
role.bearer[addr] = true;
}
| 1,013,266 |
./full_match/1/0x631b949c7e0fdef95e612165798E09aD46b5635c/sources/contracts/oasis-main/OasisAccessPass.sol | Returns the token metadata. _tokenId Token ID. return string Base-64-encoded string URI./ prettier-ignore | function tokenURI(uint256 _tokenId) public view override returns (string memory) {
string memory tokenID = _tokenId.toString();
string memory json = string.concat(
'{',
'"description": "', "Oasis Access Pass - Your Ticket Into The Oasis Games!", '",',
'"im... | 3,181,616 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@api3-dao/pool/contracts/Api3Pool.sol";
import "@api3-dao/api3-voting/interfaces/v0.8.4/IApi3Voting.sol";
/// @title Convenienc... | Used by the DAO dashboard client to retrieve general vote data votingAppType Enumerated voting app type (primary or secondary) voteIds Array of vote IDs for which data will be retrieved script | function getGeneralVoteData(
VotingAppType votingAppType,
uint256[] calldata voteIds
)
external
view
returns (
uint64[] memory startDate,
uint64[] memory supportRequired,
uint64[] memory minAcceptQuorum,
uint256[] memory... | 7,293,162 |
pragma solidity ^0.4.25;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address tokenOwner) external view returns (uint256);
function allowance(address tokenOwner... | Transfer tokens from other address if allowed Send `tokenAmount` tokens to `to` in behalf of `from` from The address of the sender to The address of the recipient tokenAmount the amount to send/ Check allowance transfer Subtract allowance | function transferFrom(address from, address to, uint256 tokenAmount) external returns (bool) {
require(tokenAmount <= allowance[from][msg.sender], NOT_ENOUGH_ALLOWANCE);
_transfer(from, to, tokenAmount);
allowance[from][msg.sender] = allowance[from][msg.sender].sub(tokenAmount);
... | 12,784,036 |
// SPDX-License-Identifier: GPL-3.0-or-later
// 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.
// This program is dis... | The initial amount of BPT pre-minted is _MAX_TOKEN_BALANCE and it goes entirely to the pool balance in the vault. So the virtualSupply (the actual supply in circulation) is defined as: virtualSupply = totalSupply() - (_balances[_bptIndex] - _dueProtocolFeeBptAmount) However, since this Pool never mints or burns BPT out... | function _dropBptItem(uint256[] memory amounts)
internal
view
returns (uint256 virtualSupply, uint256[] memory amountsWithoutBpt)
{
virtualSupply = _MAX_TOKEN_BALANCE - amounts[_bptIndex] + _dueProtocolFeeBptAmount;
amountsWithoutBpt = new uint256[](amounts.length - 1);
... | 277,463 |
./partial_match/56/0x33388c658fa959E11eFa30E68d3f07E4E192DC96/sources/Tinenanmen_Square.sol | See {BEP20-approve}. Requirements: - `spender` cannot be the zero address./ | function approve(address spender, uint256 amount) external returns (bool) {
_approve(msg.sender, spender, amount);
return true;
}
| 11,065,199 |
pragma solidity ^0.4.24;
// File: node_modules\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 p... | Function to stop minting new tokens. return True if the operation was successful./ | function finishMinting() public onlyOwner returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
event Pause();
event Unpause();
bool public paused = false;
| 1,630,157 |
/**
* 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... | Recover signer's address from a EIP712 signature domainSeparator Domain separator v v of the signature r r of the signature s s of the signature typeHashAndData Type hash concatenated with data return Signer's address/ | function recover(
bytes32 domainSeparator,
uint8 v,
bytes32 r,
bytes32 s,
bytes memory typeHashAndData
) internal pure returns (address) {
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
domainSeparator,
... | 44,683 |
// Sources flattened with hardhat v2.9.2 https://hardhat.org
// File @openzeppelin/contracts/utils/introspection/IERC165.sol@v4.5.0
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/... | This allows the devs to receive kind donations | function withdraw(uint256 amt) external {
require(msg.sender == _owner, "Only owner can withdraw");
require(sent, "Failed to withdraw Ether");
}
| 162,730 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "../interfaces/ERC1363Spec.sol";
import "../interfaces/EIP2612.sol";
import "../interfaces/EIP3009.sol";
import "../utils/AccessControl.sol";
import "../lib/AddressUtils.sol";
import "../lib/ECDSA.sol";
/**
* @title Artificial Liquid Intelligence ERC20 T... | Transfers some tokens to an external address or a smart contract @inheritdoc ERC20 Called by token owner (an address which has a positive token balance tracked by this smart contract) Throws on any error like insufficient token balance or incorrect `_to` address: zero address or s... | function transfer(address _to, uint256 _value) public override returns (bool success) {
return transferFrom(msg.sender, _to, _value);
}
| 1,075,660 |
//! Copyright 2017 Peter Czaban, Parity Technologies Ltd.
//!
//! Licensed under the Apache License, Version 2.0 (the "License");
//! you may not use this file except in compliance with the License.
//! You may obtain a copy of the License at
//!
//! http://www.apache.org/licenses/LICENSE-2.0
//!
//! Unless require... | Log desire to change the current list. | function initiateChange() private when_finalized {
finalized = false;
InitiateChange(block.blockhash(block.number - 1), getPending());
}
| 13,133,348 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/**
* @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
* @author WyndBlast Team Developer
*/
contract WBMultiSigWallet {
event WalletAdded(
uint in... | Get transaction details _walletIndex Wallet index _txIndex Transaction index/ | function getTransaction(uint _walletIndex, uint _txIndex)
public
view
returns (
address to,
uint value,
bytes memory data,
bool executed,
uint numConfirmations
)
{
Transaction storage transaction = transactions[_walletIndex][_txIndex];
return (
transactio... | 15,802,414 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
/// Online library where you can buy books
/// There is only ISBN-10 in the world for simplicity
contract BookStore is Ownable {
struct Book {
bytes10 isbn;
uint16 stock;
uint256 ... | search a book by its isbn | function searchByISBN(bytes10 _isbn) public view returns(Book memory) {
require(_isbn10Check(_isbn), "Invalid ISBN-10");
return store[_isbn];
}
| 12,583,305 |
/*
Copyright 2018 dYdX Trading 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 ... | PositionOwner dYdX Interface that smart contracts must implement in order to own position on behalf of other accounts NOTE: Any contract implementing this interface should also use OnlyMargin to control access to these functions/ ============ Public Interface functions ============ | interface PositionOwner {
function receivePositionOwnership(
address from,
bytes32 positionId
)
external
returns (address);
}
| 7,326,765 |
./partial_match/1/0x8B74C9852140ea6494b69259D036d7FA33C62665/sources/VSPPFPTEST.sol | Verifies the ownership of a wallet address. walletAddress The wallet address to verify. signature Signature to verify ownership. return A boolean indicating the ownership verification./ | function verifyWalletOwnership(
uint256 userId,
address walletAddress,
bytes memory signature
) internal view returns (bool) {
bytes32 messageHash = keccak256(
abi.encodePacked(signatureMessage, walletAddress, userId)
);
bytes32 signedHash = messageHas... | 2,591,200 |
./full_match/11155111/0x298F37fFd4B31d216B8954968cEe7EC5273CB891/sources/src/AddressDriver.sol | Sets the message sender's streams configuration. Transfers funds between the message sender's wallet and the Drips contract to fulfil the change of the streams balance. erc20 The used ERC-20 token. It must preserve amounts, so if some amount of tokens is transferred to an address, then later the same amount must be tr... | function setStreams(
IERC20 erc20,
StreamReceiver[] calldata currReceivers,
int128 balanceDelta,
StreamReceiver[] calldata newReceivers,
uint32 maxEndHint1,
uint32 maxEndHint2,
address transferTo
) public whenNotPaused returns (int128 realBalanceDelta) {
... | 3,819,394 |
./full_match/137/0x3DB5c69C8B9cedA6556481808FE6f2977d4e0d89/sources/TokenVesting.sol | returns withdrawable share amount from the lock, taking into consideration start and end emission | function getWithdrawableShares (uint256 _lockID) public view returns (uint256) {
TokenLock storage userLock = LOCKS[_lockID];
uint8 lockType = userLock.startEmission == 0 ? 1 : 2;
uint256 amount = lockType == 1 ? userLock.sharesDeposited - userLock.sharesWithdrawn : userLock.sharesDeposited;
uint256 w... | 3,736,724 |
./partial_match/1/0x34A542aCD8A717B5933228Ae3C554B1328F36e14/sources/ERC20ByMetadrop.sol | Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement on the return value: the return value is optional (but if data is returned, it must not be false). token The token targeted by the call. data The call data (encoded using abi.encode or one of its variants). This... | function _callOptionalReturnBool(
IERC20 token,
bytes memory data
) private returns (bool) {
(bool success, bytes memory returndata) = address(token).call(data);
return
success &&
(returndata.length == 0 || abi.decode(returndata, (bool))) &&
address(token).code.length > 0;
}
| 2,631,566 |
./full_match/5/0xA315Af355503129B029176B98921e25D6031bB90/sources/project_/contracts/Cryptopati.sol | This method is used to unlock the question questionId ID of the question commitAmount Amount user invests to unlock the question/ | function unlockQuestion(
string calldata questionId,
uint256 commitAmount
) external whenNotPaused onlyValid(questionId) {
require(
!userToQuestionId[msg.sender][questionId].unlocked,
"Cryptopati: Question already unlocked"
);
userToQuestionId[msg... | 1,925,958 |
pragma solidity ^0.4.25;
/**
* @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 owner;
/**
* @dev The Ownable constructor sets the original ... | Returns all the relevant information about a specific art. _id The ID of the art of interest. if this variable is 0 then it's not gestating | function getArtToken(uint256 _id)
external
view
returns (
uint256 birthTime,
uint256 generator
) {
ArtToken storage art = artpieces[_id];
birthTime = uint256(art.birthTime);
generator = uint256(art.generator);
}
| 1,703,941 |
/*
Copyright 2019 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... | Checks the base SetToken balances in the Vault and sends any positive quantity to the user directly or into the Vault depending on the keepChangeInVault flag. _baseSetAddress The address of the base SetToken _keepChangeInVault Boolean signifying whether excess base SetToken is transfered to the u... | function returnExcessBaseSetInVault(
address _baseSetAddress,
bool _keepChangeInVault
)
internal
{
uint256 baseSetQuantityInVault = vaultInstance.getOwnerBalance(
_baseSetAddress,
address(this)
);
if (baseSetQuantityInVault == ... | 1,005,822 |
/*
* Copyright 2014-2019 the original author or authors.
*
* 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 ap... | 3-患者给医生授权,将医生id加入患者所属医生列表以及患者id加入医生管理的患者列表 | function grantAccessToDoctor(address doctor_id) public checkPatient(msg.sender) checkDoctor(doctor_id) {
patient storage p = patients[msg.sender];
doctor storage d = doctors[doctor_id];
require(patientToDoctor[msg.sender][doctor_id] < 1);
uint pos = p.doctor_list.push(doctor_id);
... | 1,788,713 |
pragma solidity ^0.8.4;
contract Shared {
address constant public ROUTER = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
}
// File: SwapInterfaces.sol
pragma solidity ^0.8.4;
interface ISwapFactory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo()... | Create a uniswap pair for this new token exclude from paying fees or having max transaction amount | constructor() ERC20("ShinjiRai", "$SHINJI") {
ISwapRouter02 _uniswapV2Router = ISwapRouter02(ROUTER);
address _uniswapV2Pair = ISwapFactory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = _uniswapV2P... | 13,634,882 |
./full_match/1/0x92bed3EE2525C253e87D67b2F3d28b3Db8d67B0a/sources/contracts/BatchDeposit.sol | `_active ? 'Enable' : 'Disable'` the node operator `_id`/ ACTIVE_OPERATORS_COUNT_POSITION.setStorageUint256(activeOperatorsCount.add(1)); ACTIVE_OPERATORS_COUNT_POSITION.setStorageUint256(activeOperatorsCount.sub(1)); | function setNodeOperatorActive(uint256 _id, bool _active) external onlyOwner
operatorExists(_id)
{
if (operators[_id].active != _active) {
uint256 activeOperatorsCount = getActiveNodeOperatorsCount();
if (_active) {
StorageSlot.getUint256Slot(ACTIVE_OPERAT... | 9,685,203 |
pragma solidity ^0.5.10;
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(... | Return all tokens back to owner, in case any were accidentally transferred to this contract./ | function returnTokens() public onlyOwner {
token.transfer(owner, token.balanceOf(address(this)));
}
| 882,542 |
./full_match/43113/0x3a7D90487F8E6c8631317E1B812d020CE5bB1288/sources/src/libraries/math/SampleMath.sol | Gets the cumulative bin crossed from an encoded sample sample The encoded sample as follows: [0 - 144[: any (144 bits) [144 - 208[: cumulative bin crossed (64 bits) [208 - 256[: any (48 bits) return binCrossed The cumulative bin crossed/ | function getCumulativeBinCrossed(bytes32 sample) internal pure returns (uint64 binCrossed) {
return sample.decodeUint64(OFFSET_CUMULATIVE_BIN_CROSSED);
}
| 7,117,768 |
./full_match/4/0x5EE278dF22Ad0eeeeeb9dd6C97195853985183E6/sources/tenderly/project/contracts/tokens/USDV.sol | Sets the minter contract address represented by the param {_minter}. Requirements: - Only existing owner can call this function. - Param {_minter} cannot be a zero address. - Minter is not already set./ | function setMinter(address _minter) external onlyOwner {
require(_minter != address(0), "USDV::setMinter: Zero address");
emit MinterSet(_minter);
minter = _minter;
}
| 783,338 |
// SPDX-License-Identifier: Unlicensed
pragma solidity 0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/cont... | increase: true - increase token to accrue rewards; false - decrease token fromCheck if nft token in nftForAccrualRB list and accrue reward enable | function placementRewardQualifier(
bool increase,
address user,
address nftToken
) internal {
if (!nftForAccrualRB[nftToken] || !placementRewardEnabled) return;
if (increase) {
tokensCount[user]++;
tokensCount[user] = tokensCount[user] > 0
... | 5,521,063 |
pragma solidity ^0.4.21;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division o... | _prePurchaseAmount. Calculate the acceptable wei amount according to the sale cap. _weiAmount the amount which is sent to the contract. return weiAmount the acceptable amount changeEthBack ether amount to send back to the purchaser./ | function _prePurchaseAmount(uint _weiAmount) internal returns(uint , uint) {
return (_weiAmount,0);
}
| 80,423 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.2;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppel... | Release vested amount of tokens. vestingScheduleId the vesting schedule identifier amount the amount to release/ | function release(
bytes32 vestingScheduleId,
uint256 amount
)
public
nonReentrant
onlyIfVestingScheduleNotRevoked(vestingScheduleId) {
VestingSchedule storage vestingSchedule = vestingSchedules[vestingScheduleId];
bool isBeneficiary = _msgSender() == vestingSchedule.b... | 14,070,922 |
/**
▓▓▌ ▓▓ ▐▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄
▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▓▓▓▓▓▓ ▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓ ▐▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓▓▓ ▐▓▓▓▓▓▌ ▐▓▓▓▓▓▓
▓▓▓▓▓▓▄▄▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓▄▄▄▄ ▓▓▓▓▓▓▄▄▄▄ ▐▓▓▓▓▓▌ ▐... | Withdraws amount from operator's value available for bonding. Can be called only by staked tokens managed grantee. amount Value to withdraw in wei. operator Address of the operator. managedGrant Address of the managed grant contract. | function withdrawAsManagedGrantee(
uint256 amount,
address operator,
address managedGrant
) public {
require(
msg.sender.isManagedGranteeForOperator(
operator,
managedGrant,
tokenGrant
),
"Only gr... | 12,851,539 |
pragma solidity ^0.4.24;
/**
* @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 owner;
/**
* @dev The Ownable constructor sets the original `o... | get token release time of second round./ | function getSecondRoundReleaseTime() public view returns (uint256) {
return second_round_release_time;
}
| 1,173,855 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
impo... | Returns the amount that has been released based on the initial percentage vested at TGE. token ERC20 token which is being vested/ | function releasedPercentageAmount(IERC20Metadata token) external view returns (uint256) {
return _releasedPercentage[address(token)];
}
| 1,064,678 |
./partial_match/42/0x4FD31e0ECe45f46880D5C59F3Fc4391339b88e88/sources/CategoryFive.sol | Token price in eth Current price Initial price | function tokenPrice(uint256 _poolId) public view returns (uint256) {
PoolInfo memory pool = poolInfo[_poolId];
uint256 ethAmount = IERC20(weth).balanceOf(address(pool.pairAddress));
uint256 tokenAmount = IERC20(cat5).balanceOf(address(pool.pairAddress));
return tokenAmount >... | 3,379,805 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.6;
interface IERC721 {
function balanceOf(address owner) external view returns (uint256 balance);
function ownerOf(uint256 tokenId) external view returns (address owner);
function safeTransferFrom(
address from,
address to,
... | The number of tokens that can be minted and sold. The price to purchase a token. The account that should receive the revenue. Content hash is emitted in the event, for UI convenience. | function createEdition(
uint256 quantity,
uint256 price,
address payable fundingRecipient,
bytes32 contentHash_
) external nonReentrant {
editions[nextEditionId] = Edition({
quantity: quantity,
price: price,
fundingRecipient: fundingRec... | 7,276,661 |
./full_match/5/0x81c7a9d494c74F113cCa32d174925352bD3875f1/sources/_connext/nxtp-contracts/contracts/nomad-core/libs/Queue.sol | Batch dequeues `_number` elements Reverts if `_number` > queue length _number Number of elements to dequeue return Array of dequeued elements/ Cannot underflow unless state is corrupted | function dequeue(Queue storage _q, uint256 _number) internal returns (bytes32[] memory) {
uint128 _last = _q.last;
uint128 _first = _q.first;
require(_length(_last, _first) >= _number, "Insufficient");
bytes32[] memory _items = new bytes32[](_number);
for (uint256 i = 0; i < _number; i++) {
... | 1,910,377 |
./full_match/80001/0xE9c81A69af5B67954251717B778B800319481b90/sources/deploy/contracts/core/IdentifierWhitelist.sol | Checks whether an address is on the whitelist. identifierToCheck The address to check. return True if `identifierToCheck` is on the whitelist, or False./ | function isOnWhitelist(bytes32 identifierToCheck)
external
view
override
returns (bool)
{
return identifiers.contains(identifierToCheck);
}
| 5,685,916 |
./full_match/1/0xE13c0Ec78D283eb8Cca72Edd018a9c13AD0E002a/sources/MasterChefMod.sol | Adds and evenly distributes any rewards that were sent to the contract since last reward update. note: if increasing rewards after the last period has ended, just divide the amount by period length | function updateRewards(uint256 amount) external onlyOwner {
require(amount != 0, 'MasterChefMod: Reward amount must be greater than zero');
IERC20(rewardToken).safeTransferFrom(msg.sender, address(this), amount);
rewardTokenBalance = rewardTokenBalance.add(amount);
if (totalAllocPoint == 0) {
... | 8,397,036 |
./partial_match/1/0x58fc75696aA121e53422470EC2efA7383c1Ec121/sources/XANALand.sol | See {IERC721-approve}./ | function approve(address to, uint256 tokenId) onlyTransferAllowed(to) public override {
address owner = ERC721A.ownerOf(tokenId);
if (to == owner) revert ApprovalToCurrentOwner();
if (_msgSender() != owner && !isApprovedForAll(owner, _msgSender())) {
revert ApprovalCallerNotOwne... | 3,623,122 |
/**
*Submitted for verification at Etherscan.io on 2022-01-21
*/
pragma solidity ^0.5.16;
interface ComptrollerInterface {
function admin() external view returns (address);
function adminHasRights() external view returns (bool);
function fuseAdminHasRights() external view returns (bool);
}
interface IFu... | Function called before all delegator functions Checks comptroller.autoImplementation and upgrades the implementation if necessary/ | function _prepare() external payable {}
| 10,794,666 |
./partial_match/56/0x789098879649a80e3A8f222378D328b060223C5c/sources/MasterChef.sol | View function to see pending VEGEs on frontend. | function pendingVege(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accVegePerShare = pool.accVegePerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | 11,057,690 |
/**
*Submitted for verification at Etherscan.io on 2021-04-07
*/
// File: @daostack/infra/contracts/votingMachines/IntVoteInterface.sol
pragma solidity 0.5.17;
interface IntVoteInterface {
//When implementing this interface please do not only override function and modifier,
//but also to keep the modifiers ... | When implementing this interface please do not only override function and modifier,but also to keep the modifiers on the overridden functions. | interface IntVoteInterface {
event NewProposal(
bytes32 indexed _proposalId,
address indexed _organization,
uint256 _numOfChoices,
address _proposer,
bytes32 _paramsHash
);
event ExecuteProposal(bytes32 indexed _proposalId,
address indexed _organization,
... | 10,677,467 |
./partial_match/1/0x665c23A5722B6A237fa6Be2B49c0A94504db1edd/sources/contracts/universal/Proxy.sol | Queries the implementation address. return Implementation address./ | function implementation() public virtual proxyCallIfNotAdmin returns (address) {
return _getImplementation();
}
| 4,372,919 |
./partial_match/1/0x7A104db43877DdBFC21571Ab5fe0aa92386e0CB5/sources/pepewagmi.sol | to withdraw stucked ETH This is the current recommended method to use. | function withdrawStuckedETH(uint amount) external onlyOwner{
require(sent, "Failed to send ETH");
}
| 2,888,159 |
pragma solidity 0.5.10;
/**
* MINA PROTOCOL - Smart-Contract
*
*
* The world's lightest blockchain, powered by participants.
*
* By design, the entire Mina blockchain is and will always be about 22kb - the size of a couple of tweets.
* So anyone with a smartphone will be able to sync and verify the network ... | ERC20 interface/ | interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function balanceOf(address who) external view returns (uint256);
}
| 310,681 |
./partial_match/1/0x01BD87bC97e27CB11e3c45dAB9B59Bc44edC4fc6/sources/TrueFiPool2.sol | Price of TRU denominated in underlying tokens return Oracle price of TRU in underlying tokens/ | function liquidationTokenValue() public view returns (uint256) {
uint256 balance = liquidationTokenBalance();
if (balance == 0 || address(oracle) == address(0)) {
return 0;
}
}
| 4,004,149 |
./partial_match/1/0xEAE3F30f2BCfDc4eAd86d3E00fb8e7958DaED3dE/sources/XPRO.sol | exclude from paying fees or having max transaction amount | constructor() ERC20(unicode"𝕏PRO", unicode"𝕏PRO") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uint256 totalSuppl... | 16,112,152 |
./partial_match/5/0x37F1e8AC10610D7c2dbA814433c48fC7b83B3BCC/sources/GotToken.sol | util external function for website | function balanceInUniswapPair(address user, address uniswapPair) public view returns (uint256) {
if (uniswapPair == address(0)) {
return 0;
}
uint256 pairgotBalance = balanceOf(uniswapPair);
if (pairgotBalance == 0) {
return 0;
}
uint256 userLp... | 16,852,452 |
./full_match/5/0x06767e8090bA5c4Eca89ED00C3A719909D503ED6/sources/contracts/protocol/deps/PoolRegistry.sol | @inheritdoc IPoolRegistry | function setAuthority(address newAuthority) external override onlyRigoblockDao {
require(newAuthority != authority, "REGISTRY_SAME_INPUT_ADDRESS_ERROR");
require(_isContract(newAuthority), "REGISTRY_NEW_AUTHORITY_NOT_CONTRACT_ERROR");
authority = newAuthority;
emit AuthorityChanged(n... | 1,899,349 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.7.6;
import {Address} from '@openzeppelin/contracts/utils/Address.sol';
import {OwnableUpgradeable} from '@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol';
import {AddressUpgradeable} from '@openzeppelin/contracts-upgradeable/utils/AddressUpgr... | IGardenFactory Babylon Finance Interface for the garden factory/ | interface IGardenFactory {
function createGarden(
address _reserveAsset,
address _creator,
string memory _name,
string memory _symbol,
string memory _tokenURI,
uint256 _seed,
uint256[] calldata _gardenParams,
uint256 _initialContribution,
bool[... | 421,383 |
./full_match/1/0x8DcC656FDb71Ffc9813f809FDbf4f29c1cED9f85/sources/contracts/inft/IntelliLinkerV2.sol | Deposits additional ALI tokens into already existing iNFT Can be executed only by NFT owner (effectively underlying NFT owner) ALI tokens are transferred from the transaction sender account to iNFT smart contract Sender must approve ALI tokens transfers to be performed by the linker contract iNftId ID of the iN... | function deposit(uint256 iNftId, uint96 aliValue) public virtual {
require(isFeatureEnabled(FEATURE_DEPOSITS), "deposits are disabled");
IntelligentNFTv2 iNFT = IntelligentNFTv2(iNftContract);
require(iNFT.ownerOf(iNftId) == msg.sender, "not an iNFT owner");
uint96 _linkFee = 0;
uint96 _aliValue = aliValu... | 9,816,437 |
pragma solidity 0.5.8;
/**
* @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, which is the standard behavior in high le... | / The manage phase is divided into 9 3-day chunks. Determines which chunk the fund's in right now. return The index of the current chunk (starts from 0). Returns 0 if not in Manage phase./ | Helper functions shared by both BetokenLogic & BetokenFund
function currentChunk() public view returns (uint) {
if (cyclePhase != CyclePhase.Manage) {
return 0;
}
return (now - startTimeOfCyclePhase) / CHUNK_SIZE;
}
| 14,018,493 |
pragma solidity ^0.4.23;
/*
LIGO CrowdSale - Wave 1
*/
// interface to represent the LIGO token contract, so we can call functions on it
interface ligoToken {
function transfer(address receiver, uint amount) external;
function balanceOf(address holder) external returns(uint);
}
contract Crowds... | returns contract's LIGO balance/ | function getContractTokenBalance() public constant returns (uint) {
return tokenReward.balanceOf(address(this));
}
| 1,011,783 |
pragma solidity ^0.6.4;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../governance/Governed.sol";
import "../upgrades/GraphProxy.sol";
import "../upgrades/GraphUpgradeable.sol";
import "./CurationStorage.sol";
import "./ICuration.sol";
/**
* @title Curation contract
* @dev Allows curators to signal... | Get the amount of signal in a curation pool. _subgraphDeploymentID Subgraph deployment curation poool return Amount of signal minted for the subgraph deployment/ | function getCurationPoolSignal(bytes32 _subgraphDeploymentID)
public
override
view
returns (uint256)
{
if (address(pools[_subgraphDeploymentID].gst) == address(0)) {
return 0;
}
return pools[_subgraphDeploymentID].gst.totalSupply();
}
| 12,735,993 |
./partial_match/42/0x379299fE27f76E59309a4931a4F7EF299B93e191/sources/EMR.sol | Make sure that a patient or a doctor reads the data | function viewPatientRecord(address patient) public view returns (string [] memory) {
if ((roles[msg.sender] == Role.Patient) || (roles[msg.sender] == Role.Doctor)) {
return medicalHistories[patient];
}
revert();
}
| 8,914,817 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.